function ARTAction() { $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 . "="); $v_params['img_blog_cats'] = ImgBlogCatUtil::getImgBlogCatsByAccountId($imgAccount['id']); $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); } if (0 == strcmp("add", $_GET['act'])) { $v_params['act_name'] = "Добавить статью"; if (0 == strcmp("savehead", $_GET['subact'])) { if (0 != strcmp("", $_POST['art_name']) && $_POST['cat_id'] && isset($_POST['pict_id']) && 0 != strcmp("", $_POST['preview'])) { $imgBlogArt['img_account_id'] = $imgAccount['id']; $imgBlogArt['img_blog_cat_id'] = $_POST['cat_id']; $imgBlogArt['name'] = $_POST['art_name']; $imgBlogArt['main_pict_id'] = $_POST['pict_id']; $imgBlogArt['preview'] = $_POST['preview']; $artID = ImgBlogArtUtil::insertImgBlogArt($imgBlogArt); $redirectURL = "/imag" . $imgAccount['id'] . "/admin/ART?id={$artID}&act=upd"; header("Location: {$redirectURL}"); } else { $v_params['error_msg'] = "Введены не все поля"; } } Application::fastView('imag-admin/art/img_article_a', $v_params); exit; } else { if (0 == strcmp("upd", $_GET['act']) && isset($_GET['id'])) { $v_params['act_name'] = "Редактировать статью"; $imgBlogArt = ImgBlogArtUtil::getImgBlogArtById($imgAccount['id'], $_GET['id']); if ($_POST['form_send']) { if (0 != strcmp("", $_POST['art_name']) && isset($_POST['cat_id']) && 0 != strcmp("", $_POST['art_name'])) { $imgBlogArt['img_blog_cat_id'] = $_POST['cat_id']; $imgBlogArt['name'] = $_POST['art_name']; $imgBlogArt['main_pict_id'] = $_POST['pict_id']; $imgBlogArt['preview'] = $_POST['preview']; ImgBlogArtUtil::updateImgBlogArt($imgBlogArt); $imgBlogArt = ImgBlogArtUtil::getImgBlogArtById($imgAccount['id'], $imgBlogArt['id']); } else { $v_params['error_msg'] = "Введены не все поля"; } } $v_params['img_blog_art_blocks'] = ImgBlogArtBlockUtil::getImgBlogArtBlocksByArtId($_GET['id']); $v_params['img_blog_art'] = $imgBlogArt; Application::fastView('imag-admin/art/img_article_u', $v_params); exit; } else { if (0 == strcmp("del", $_GET['act']) && isset($_GET['id'])) { $v_params['act_name'] = "Удалить статью"; if ($_POST['artID']) { ImgBlogArtUtil::deleteImgBlogArtById($_POST['artID']); header("Location: ARTs"); } $v_params['img_blog_art'] = ImgBlogArtUtil::getImgBlogArtById($imgAccount['id'], $_GET['id']); $v_params['img_blog_art_blocks'] = ImgBlogArtBlockUtil::getImgBlogArtBlocksByArtId($_GET['id']); Application::fastView('imag-admin/art/img_article_del', $v_params); exit; } } } } } Application::fastView('main/sys_error', $v_params); }