This post will provide guidance, how to create a file that is uploaded in the gallery file that can only be viewed by the user who has the right to view it. The principle works are the same as in submission list. In the end, the file is public, but file management is carried out by the competent authority. The trick is as follows:
- Open file /lib//filegals/filegallib.php and find "function get_files_info".
- Right before the script $return = false;, insert the script as follows:
//additional procedure to control user, begin
global $tiki_p_admin_file_galleries;
if ($tiki_p_admin_file_galleries !='y') {
if ( $where != '' ) {
$where .= ' AND ';
$bindvars = array_merge($bindvars, (array)$user);
} else {
$where = ' WHERE ';
$bindvars = (array)$user;
}
$where .= ' `user`' . ( is_array($user) ? $this->bindvars_to_sql_in($user, true, true) : '=?' );
}
//additional procedure to control user, end - Save and close file /lib//filegals/filegallib.php.
- Open file /lib//tikilib.php and find "function get_files".
- Right before the script if( !empty($filter['categId']) ) {, insert the script as follows:
//additional procedure to control user, begin
if ($tiki_p_admin_file_galleries !='y') {
$f_where .= " AND tf.`user` = '$user' ";
}
//additional procedure to control user, end - Save and close file /lib//tikilib.php. Finish.
No comments:
Post a Comment