Ejemplo 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);
 }
Ejemplo n.º 2
0
 function newsBlockAction()
 {
     $v_params['sys_name'] = SysPropertiesUtil::getPropertyValue("sys_name");
     $v_params['sys_slog'] = SysPropertiesUtil::getPropertyValue("sys_slog");
     if (LoginChecker::isAdmin()) {
         if (0 == strcmp("add", $_GET['act']) && isset($_GET['corresp'])) {
             $v_params['sys_news_art'] = SysNewsArtUtil::getSysNewsArtById($_GET['corresp']);
             if (isset($_POST['send_block_form'])) {
                 $sysNewsArtBlock['sys_news_art_id'] = $_GET['corresp'];
                 $sysNewsArtBlock['text_content'] = $_POST['text_content'];
                 $sysNewsArtBlock['order_in_art'] = (int) $_POST['order'];
                 $sysNewsArtBlock['image_id'] = (int) $_POST['pict_id'];
                 $sysNewsArtBlock['image_title'] = $_POST['img_desk'];
                 if (0 == $_POST['selected_tab']) {
                     $sysNewsArtBlock['block_type'] = 1;
                 } else {
                     if (1 == $_POST['selected_tab']) {
                         $sysNewsArtBlock['block_type'] = 0;
                     }
                 }
                 SysNewsArtBlockUtil::insertSysNewsArtBlock($sysNewsArtBlock);
                 $snaID = $v_params['sys_news_art']['id'];
                 header("Location: /superAdmin/newsArt?id={$snaID}&act=upd");
             }
             $img_albums = ImgAlbumUtil::getImgAlbumsByAccountID(0);
             $img_album_pictures = ImgPictureUtil::getImgPicturesNoAlbum(0);
             $v_params['img_albums'][] = array("name" => "Без альбома", "pictures" => $img_album_pictures);
             foreach ($img_albums as $img_album) {
                 $img_album_pictures = ImgPictureUtil::getImgPicturesByAlbumId($img_album['id'], 0);
                 $v_params['img_albums'][] = array("name" => $img_album['name'], "pictures" => $img_album_pictures);
             }
             $v_params['act_name'] = "Добавить блок";
             $v_params['num_tab'] = 0;
             Application::fastView('super-admin/news/news_page_block_au', $v_params);
             exit;
         } else {
             if (0 == strcmp("upd", $_GET['act']) && isset($_GET['corresp']) && isset($_GET['id'])) {
                 $v_params['sys_news_art'] = SysNewsArtUtil::getSysNewsArtById($_GET['corresp']);
                 $v_params['ssp_block'] = SysNewsArtBlockUtil::getSysNewsArtBlockById($_GET['id']);
                 $v_params['act_name'] = "Редактировать блок";
                 $img_albums = ImgAlbumUtil::getImgAlbumsByAccountID(0);
                 $img_album_pictures = ImgPictureUtil::getImgPicturesNoAlbum(0);
                 $v_params['img_albums'][] = array("name" => "Без альбома", "pictures" => $img_album_pictures);
                 foreach ($img_albums as $img_album) {
                     $img_album_pictures = ImgPictureUtil::getImgPicturesByAlbumId($img_album['id'], 0);
                     $v_params['img_albums'][] = array("name" => $img_album['name'], "pictures" => $img_album_pictures);
                 }
                 $v_params['num_tab'] = 0;
                 if (0 == $v_params['ssp_block']['block_type']) {
                     $v_params['num_tab'] = 1;
                 }
                 if (isset($_POST['send_block_form'])) {
                     $v_params['ssp_block']['sys_news_art_id'] = $_GET['corresp'];
                     $v_params['ssp_block']['text_content'] = $_POST['text_content'];
                     $v_params['ssp_block']['order_in_art'] = (int) $_POST['order'];
                     $v_params['ssp_block']['image_id'] = (int) $_POST['pict_id'];
                     $v_params['ssp_block']['image_title'] = $_POST['img_desk'];
                     if (0 == $_POST['selected_tab']) {
                         $v_params['ssp_block']['block_type'] = 1;
                     } else {
                         if (1 == $_POST['selected_tab']) {
                             $v_params['ssp_block']['block_type'] = 0;
                         }
                     }
                     SysNewsArtBlockUtil::updateSysNewsArtBlock($v_params['ssp_block']);
                 }
                 Application::fastView('super-admin/news/news_page_block_au', $v_params);
                 exit;
             } else {
                 if (0 == strcmp("del", $_GET['act']) && isset($_GET['corresp']) && isset($_GET['id'])) {
                     $v_params['sys_news_art'] = SysNewsArtUtil::getSysNewsArtById($_GET['corresp']);
                     if (isset($_POST['send_block_form'])) {
                         SysNewsArtBlockUtil::deleteSysNewsArtBlockById($_GET['id']);
                         $snaID = $v_params['sys_news_art']['id'];
                         header("Location: /superAdmin/newsArt?id={$snaID}&act=upd");
                     }
                     $v_params['ssp_block'] = SysNewsArtBlockUtil::getSysNewsArtBlockById($_GET['id']);
                     $v_params['act_name'] = "Удалить блок";
                     Application::fastView('super-admin/news/news_page_block_del', $v_params);
                     exit;
                 }
             }
         }
     } else {
         header("Location: /superAdmin/login");
     }
 }