Exemplo n.º 1
0
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+
define('PHPWG_ROOT_PATH', './');
include_once PHPWG_ROOT_PATH . 'include/common.inc.php';
include PHPWG_ROOT_PATH . 'include/section_init.inc.php';
include_once PHPWG_ROOT_PATH . 'include/functions_picture.inc.php';
// Check Access and exit when user status is not ok
check_status(ACCESS_GUEST);
// access authorization check
if (isset($page['category'])) {
    check_restrictions($page['category']['id']);
}
$page['rank_of'] = array_flip($page['items']);
// if this image_id doesn't correspond to this category, an error message is
// displayed, and execution is stopped
if (!isset($page['rank_of'][$page['image_id']])) {
    $query = '
SELECT id, file, level
  FROM ' . IMAGES_TABLE . '
  WHERE ';
    if ($page['image_id'] > 0) {
        $query .= 'id = ' . $page['image_id'];
    } else {
        // url given by file name
        assert(!empty($page['image_file']));
        $query .= 'file LIKE \'' . str_replace(array('_', '%'), array('/_', '/%'), $page['image_file']) . '.%\' ESCAPE \'/\' LIMIT 1';
Exemplo n.º 2
0
 if (isset($_GET['changedir'])) {
     // Change a directory
     $dir = change_folder($dir, $show_root, $enable_folder_browsing, $exclude_directories);
 }
 // needed for browsing - we check again because folder could have changed!
 $show_root = isset($_SESSION["TFU_ROOT_DIR"]) ? $dir != $_SESSION["TFU_ROOT_DIR"] : false;
 // Read all files and folders
 $size = read_dir($dir, $myFiles, $myDirs, $fix_utf8, $exclude_directories, $sort_files_by_date);
 // Sort files and folders
 sort_data($myFiles, $myDirs, $sort_files_by_date);
 if ($show_root) {
     array_unshift($myDirs, "..");
 }
 $nrFiles = count($myFiles);
 // check restrictions like if files can be deleted or folders created or of the folder does exists
 $status = check_restrictions($dir, $show_root, $myFiles, $fix_utf8, $status);
 // we check if we have an error in the upload!
 if (isset($_SESSION["upload_memory_limit"]) && isset($_GET['check_upload'])) {
     $mem_errors = "&upload_mem_errors=" . $_SESSION["upload_memory_limit"];
     unset($_SESSION["upload_memory_limit"]);
 } else {
     $mem_errors = "";
 }
 $upload_ok = '&upload_ok=' . (isset($_SESSION["TFU_LAST_UPLOADS"]) ? count($_SESSION['TFU_LAST_UPLOADS']) : '0');
 $files = implode('|', $myFiles);
 $dirs = $enable_folder_browsing == "true" ? implode("|", $myDirs) : "";
 $dirsub = create_directory_title($dir, $hide_directory_in_title, $fix_utf8);
 $baseurl = "&baseurl=" . getRootUrl() . $dir . "/";
 // the baseurl
 if ($fix_utf8 == "") {
     $baseurl = utf8_encode($baseurl);