includes/namespaces/file.php
changeset 953 323c4cd1aa37
parent 912 95d0d8596c87
child 1081 745200a9cc2a
equal deleted inserted replaced
952:d52dfa1f08da 953:323c4cd1aa37
    46     
    46     
    47     // Prevent unnecessary work
    47     // Prevent unnecessary work
    48     if ( $local_namespace != 'File' )
    48     if ( $local_namespace != 'File' )
    49       return null;
    49       return null;
    50     
    50     
    51     $selfn = $local_page_id;
    51     $selfn = $db->escape($this->page_id);
    52     if ( substr($paths->cpage['name'], 0, strlen($paths->nslist['File'])) == $paths->nslist['File'])
       
    53     {
       
    54       $selfn = substr($local_page_id, strlen($paths->nslist['File']), strlen($local_page_id));
       
    55     }
       
    56     $selfn = $db->escape($selfn);
       
    57     $q = $db->sql_query('SELECT f.mimetype,f.time_id,f.size,l.log_id FROM ' . table_prefix . "files AS f\n"
    52     $q = $db->sql_query('SELECT f.mimetype,f.time_id,f.size,l.log_id FROM ' . table_prefix . "files AS f\n"
    58                       . "  LEFT JOIN " . table_prefix . "logs AS l\n"
    53                       . "  LEFT JOIN " . table_prefix . "logs AS l\n"
    59                       . "    ON ( l.time_id = f.time_id AND ( l.action = 'reupload' OR l.action IS NULL ) )\n"
    54                       . "    ON ( l.time_id = f.time_id AND ( l.action = 'reupload' OR l.action IS NULL ) )\n"
    60                       . "  WHERE f.page_id = '$selfn'\n"
    55                       . "  WHERE f.page_id = '$selfn'\n"
    61                       . "    ORDER BY f.time_id DESC;");
    56                       . "    ORDER BY f.time_id DESC;");