Exemplo n.º 1
0
 function ARTBlockAction()
 {
     $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['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 . "=");
             $img_albums = ImgAlbumUtil::getImgAlbumsByAccountID($imgAccount['id']);
             $img_album_pictures = ImgPictureUtil::getImgPicturesNoAlbum($imgAccount['id']);
             $v_params['img_albums'][] = array("name" => "Без альбома", "pictures" => $img_album_pictures);
             foreach ($img_albums as $img_album) {
                 $img_album_pictures = ImgPictureUtil::getImgPicturesByAlbumId($img_album['id'], $imgAccount['id']);
                 $v_params['img_albums'][] = array("name" => $img_album['name'], "pictures" => $img_album_pictures);
             }
             $artID = $_GET['corresp'];
             $article_url = "ART?id={$artID}&act=upd";
             if (0 == strcmp("add", $_GET['act']) && isset($_GET['corresp'])) {
                 $v_params['action'] = "Добавить";
                 $v_params['img_blog_art'] = ImgBlogArtUtil::getImgBlogArtById($imgAccount['id'], $artID);
                 $v_params['num_tab'] = 0;
                 if (isset($_POST['send_block_form'])) {
                     if (0 == $_POST['selected_tab']) {
                         $imgBlogArtBlock['img_blog_art_id'] = $_GET['corresp'];
                         $imgBlogArtBlock['block_type'] = 1;
                         $imgBlogArtBlock['text_content'] = $_POST['text_content'];
                         $imgBlogArtBlock['order_in_art'] = (int) $_POST['order'];
                         ImgBlogArtBlockUtil::insertImgBlogArtBlock($imgBlogArtBlock);
                         header("Location: {$article_url}");
                     } else {
                         if (1 == $_POST['selected_tab']) {
                             $imgBlogArtBlock['img_blog_art_id'] = $_GET['corresp'];
                             $imgBlogArtBlock['block_type'] = 0;
                             $imgBlogArtBlock['img_picture_id'] = $_POST['pict_id'];
                             $imgBlogArtBlock['pict_desc'] = $_POST['img_desk'];
                             $imgBlogArtBlock['order_in_art'] = (int) $_POST['order'];
                             ImgBlogArtBlockUtil::insertImgBlogArtBlock($imgBlogArtBlock);
                             header("Location: {$article_url}");
                         }
                     }
                 }
                 Application::fastView('imag-admin/art/img_article_block_au', $v_params);
                 exit;
             } else {
                 if (0 == strcmp("upd", $_GET['act']) && isset($_GET['corresp']) && isset($_GET['id'])) {
                     $v_params['action'] = "Редактировать";
                     $v_params['img_blog_art_block'] = ImgBlogArtBlockUtil::getImgBlogArtBlocksById($_GET['id']);
                     $v_params['img_blog_art'] = ImgBlogArtUtil::getImgBlogArtById($imgAccount['id'], $v_params['img_blog_art_block']['img_blog_art_id']);
                     $v_params['num_tab'] = 0;
                     if (0 == $v_params['img_blog_art_block']['block_type']) {
                         $v_params['num_tab'] = 1;
                     }
                     if (isset($_POST['send_block_form'])) {
                         if (0 == $_POST['selected_tab']) {
                             $v_params['img_blog_art_block']['img_blog_art_id'] = $_GET['corresp'];
                             $v_params['img_blog_art_block']['block_type'] = 1;
                             $v_params['img_blog_art_block']['text_content'] = $_POST['text_content'];
                             $v_params['img_blog_art_block']['order_in_art'] = (int) $_POST['order'];
                             ImgBlogArtBlockUtil::updateImgBlogArtBlock($v_params['img_blog_art_block']);
                         } else {
                             if (1 == $_POST['selected_tab']) {
                                 $v_params['img_blog_art_block']['img_blog_art_id'] = $_GET['corresp'];
                                 $v_params['img_blog_art_block']['block_type'] = 0;
                                 $v_params['img_blog_art_block']['img_picture_id'] = $_POST['pict_id'];
                                 $v_params['img_blog_art_block']['pict_desc'] = $_POST['img_desk'];
                                 $v_params['img_blog_art_block']['order_in_art'] = (int) $_POST['order'];
                                 ImgBlogArtBlockUtil::updateImgBlogArtBlock($v_params['img_blog_art_block']);
                             }
                         }
                         header("Location: {$article_url}");
                     }
                     Application::fastView('imag-admin/art/img_article_block_au', $v_params);
                     exit;
                 } else {
                     if (0 == strcmp("del", $_GET['act']) && isset($_GET['corresp']) && isset($_GET['id'])) {
                         $v_params['action'] = "Удалить";
                         $v_params['img_blog_art_block'] = ImgBlogArtBlockUtil::getImgBlogArtBlocksById($_GET['id']);
                         $v_params['img_blog_art'] = ImgBlogArtUtil::getImgBlogArtById($imgAccount['id'], $v_params['img_blog_art_block']['img_blog_art_id']);
                         if (isset($_POST['del_block_form'])) {
                             ImgBlogArtBlockUtil::deleteImgBlogArtBlockById($_GET['id']);
                             header("Location: {$article_url}");
                         }
                         Application::fastView('imag-admin/art/img_article_block_del', $v_params);
                         exit;
                     }
                 }
             }
         }
     }
     Application::fastView('main/sys_error', $v_params);
 }
Exemplo n.º 2
0
 function articleAction()
 {
     $img_id = $_SESSION['imag_id'];
     $v_params['sys_name'] = SysPropertiesUtil::getPropertyValue("sys_name");
     $v_params['sys_slog'] = SysPropertiesUtil::getPropertyValue("sys_slog");
     $imgAccount = ImgAccountUtil::getImgAccountById($img_id, TRUE);
     $imgArticle = ImgBlogArtUtil::getImgBlogArtById($img_id, $_REQUEST[ART_PARAM_NAME]);
     if (NULL != $imgAccount && NULL != $imgArticle) {
         $v_params['logined'] = LoginChecker::isLogined();
         $v_params['in_card_count'] = CardCounter::countGDSinCard();
         if ($v_params['logined'] == $img_id) {
             $v_params['mysc']['main'] = TRUE;
         }
         $v_params['img_name'] = $imgAccount['img_name'];
         $v_params['img_slog'] = $imgAccount['img_slog'];
         $v_params['img_all_gds_cats_href'] = "/" . IMAG_PREFIX . $img_id . "/" . IMAG_DIR;
         $v_params['img_gds_cats_HTML'] = ImgGdsCatUtil::createTreeHTML($imgAccount['id'], "/" . IMAG_PREFIX . $img_id . "/" . IMAG_DIR . "?" . PROD_CAT_PARAM_NAME . "=");
         $v_params['img_all_blog_cats_href'] = "/" . IMAG_PREFIX . $img_id . "/" . BLOG_DIR;
         $v_params['img_blog_cats_HTML'] = ImgBlogCatUtil::createTreeHTML($imgAccount['id'], "/" . IMAG_PREFIX . $img_id . "/" . BLOG_DIR . "?" . ART_CAT_PARAM_NAME . "=");
         $v_params['img_blog_url'] = "/" . IMAG_PREFIX . $img_id . "/" . BLOG_DIR . "/";
         $v_params['img_blog_breadcrump_HTML'] = ImgBlogCatUtil::createBreadcrumpHTML($imgAccount['id'], $imgArticle['img_blog_cat_id']);
         $v_params['img_article'] = $imgArticle;
         $v_params['img_blog_art_blocks'] = ImgBlogArtBlockUtil::getImgBlogArtBlocksByArtId($imgArticle['id']);
         Application::fastView('imags/img_article', $v_params);
     } else {
         Application::fastView('main/sys_error', NULL);
     }
 }