Beispiel #1
0
 function pictureAction()
 {
     $img_id = $_SESSION['imag_id'];
     $imgAccount = ImgAccountUtil::getImgAccountById($img_id, TRUE);
     $v_params['sys_name'] = SysPropertiesUtil::getPropertyValue("sys_name");
     $v_params['sys_slog'] = SysPropertiesUtil::getPropertyValue("sys_slog");
     if (NULL != $imgAccount) {
         $v_params['logined'] = LoginChecker::isLogined();
         if ($v_params['logined'] == $img_id) {
             $v_params['picture'] = ImgPictureUtil::getImgPictureById($_GET[PICT_PARAM_NAME]);
             $v_params['img_album'] = ImgAlbumUtil::getImgAlbumByID($v_params['picture']['album_id'], $imgAccount['id']);
             if (NULL == $v_params['img_album']) {
                 $v_params['img_album_name'] = "Картинки без альбома";
             } else {
                 $v_params['img_album_name'] = $v_params['img_album']['name'];
                 $v_params['img_album_add_link'] = "&alb_id=" . $v_params['img_album']['id'];
             }
             $albumURL = "/" . IMAG_PREFIX . $imgAccount['id'] . "/admin/album?act=show";
             if ($v_params['picture'] && $_POST['del_check']) {
                 $file_path = dirname(__FILE__) . "/../../../application_data" . $v_params['picture']['path'];
                 @unlink($file_path);
                 $path_blocks = explode("/", $v_params['picture']['path']);
                 $last = count($path_blocks) - 1;
                 $path_blocks[$last] = SMAL_PICT_PREFIX . $path_blocks[$last];
                 $path_small = implode("/", $path_blocks);
                 $smal_file_path = dirname(__FILE__) . "/../../../application_data" . $path_small;
                 @unlink($smal_file_path);
                 if ($v_params['picture']['album_id']) {
                     $albumURL .= "&alb_id=" . $v_params['picture']['album_id'];
                 }
                 ImgPictureUtil::deleteImgPictureById($v_params['picture']['id']);
                 header("Location: {$albumURL}");
             }
             $v_params['mysc']['main'] = TRUE;
             $v_params['img_name'] = $imgAccount['img_name'];
             $v_params['img_all_gds_cats_href'] = "/" . IMAG_PREFIX . $img_id . "/" . IMAG_DIR;
             $v_params['img_all_blog_cats_href'] = "/" . IMAG_PREFIX . $img_id . "/" . BLOG_DIR;
             $v_params['img_gds_cats_HTML'] = ImgGdsCatUtil::createTreeHTML($imgAccount['id'], "/" . IMAG_PREFIX . $img_id . "/" . IMAG_DIR . "?" . PROD_CAT_PARAM_NAME . "=");
             $v_params['img_blog_cats_HTML'] = ImgBlogCatUtil::createTreeHTML($imgAccount['id'], "/" . IMAG_PREFIX . $img_id . "/" . BLOG_DIR . "?" . ART_CAT_PARAM_NAME . "=");
             Application::fastView('imag-admin/img_admin_picture', $v_params);
             exit;
         }
     }
     Application::fastView('main/sys_error', $v_params);
 }
Beispiel #2
0
 function pictureAction()
 {
     $v_params['sys_name'] = SysPropertiesUtil::getPropertyValue("sys_name");
     $v_params['sys_slog'] = SysPropertiesUtil::getPropertyValue("sys_slog");
     if (LoginChecker::isAdmin()) {
         $v_params['picture'] = ImgPictureUtil::getImgPictureById($_GET[PICT_PARAM_NAME]);
         $v_params['img_album'] = ImgAlbumUtil::getImgAlbumByID($v_params['picture']['album_id'], 0);
         if (NULL == $v_params['img_album']) {
             $v_params['img_album_name'] = "Картинки без альбома";
         } else {
             $v_params['img_album_name'] = $v_params['img_album']['name'];
             $v_params['img_album_add_link'] = "&alb_id=" . $v_params['img_album']['id'];
         }
         $albumURL = "/superAdmin/album?act=show";
         if ($v_params['picture'] && $_POST['del_check']) {
             $file_path = dirname(__FILE__) . "/../../application_data" . $v_params['picture']['path'];
             @unlink($file_path);
             $path_blocks = explode("/", $v_params['picture']['path']);
             $last = count($path_blocks) - 1;
             $path_blocks[$last] = SMAL_PICT_PREFIX . $path_blocks[$last];
             $path_small = implode("/", $path_blocks);
             $smal_file_path = dirname(__FILE__) . "/../../application_data" . $path_small;
             @unlink($smal_file_path);
             if ($v_params['picture']['album_id']) {
                 $albumURL .= "&alb_id=" . $v_params['picture']['album_id'];
             }
             ImgPictureUtil::deleteImgPictureById($v_params['picture']['id']);
             header("Location: {$albumURL}");
         }
         Application::fastView('super-admin/picture', $v_params);
         exit;
     } else {
         header("Location: /superAdmin/login");
     }
 }