function Action($action) { $res = false; switch ($action) { case "add": $res = $this->Add(); break; case "edit": $res = $this->Edit(); break; case "del": $res = $this->Del(); break; case "import": $res = $this->Import(); break; case "delete": $res = $this->Delete(); break; case "sortname": $res = $this->SortName(); break; } if ($res) { A::goUrl("admin.php?mode=structures&item=" . ITEM); } }
function Action($action) { $res = false; switch ($action) { case "add": $res = $this->Add(); break; case "edit": $res = $this->Edit(); break; case "del": $res = $this->Del(); break; case "addurl": $res = $this->AddUrl(); break; case "editurl": $res = $this->EditUrl(); break; case "delurl": $res = $this->DelUrl(); break; } if ($res) { A::goUrl("admin.php?mode=structures&item=" . ITEM, array('idv', 'tab')); } }
/** * Маршрутизатор действий. */ function Action($action) { $res = false; switch ($action) { case "save": $res = $this->SavePage(); break; case "fld_add": $res = $this->AddField(); break; case "fld_edit": $res = $this->EditField(); break; case "fld_del": $res = $this->DelField(); break; case "delarch": $res = $this->delArch(); break; case "delete": $res = $this->Delete(); break; } if ($res) { A::goUrl("admin.php?mode=sections&item=" . SECTION, array('tab', 'page')); } }
/** * Маршрутизатор действий. */ function Action($action) { switch ($action) { case "savesections": $res = $this->SaveSections(); break; } if (!empty($res)) { A::goUrl("admin.php?mode=sections&item=" . SECTION); } }
/** * Маршрутизатор действий. */ function Action($action) { switch ($action) { case "indexall": $res = $this->indexAll(); break; } if (!empty($res)) { A::goUrl("admin.php?mode=sections&item=" . SECTION); } }
function Action($action) { $res = false; switch ($action) { case "save": $res = $this->Save(); break; } if ($res) { A::goUrl("admin.php?mode=structures&item=" . ITEM, array('idcat')); } }
/** * Маршрутизатор действий. */ function Action($action) { switch ($action) { case "additem": $res = $this->AddItem(); break; case "edititem": $res = $this->EditItem(); break; case "delitem": $res = $this->DelItem(); break; case "setsort": $res = $this->setSort(); break; case "setrows": $res = $this->setRows(); break; case "setactive": $res = $this->SetActive(); break; case "setunactive": $res = $this->SetUnActive(); break; case "delete": $res = $this->Delete(); break; case "moveitems": $res = $this->MoveItems(); break; case "save": $res = $this->Save(); break; case "addimage": $res = $this->AddImage(); break; case "isetmain": $res = $this->SetMainImage(); break; case "idelete": $res = $this->DeleteImages(); break; case "isave": $res = $this->SaveImages(); break; } if (!empty($res)) { A::goUrl("admin.php?mode=sections&item=" . SECTION, array('idcat', 'idalb', 'tab', 'tab_albums', 'page')); } }
function Action($action) { $res = false; switch ($action) { case "addcat": $res = $this->AddCategory(); break; case "editcat": $res = $this->EditCategory(); break; case "delcat": $res = $this->DelCategory(); break; case "addbanner": $res = $this->AddBanner(); break; case "editbanner": $res = $this->EditBanner(); break; case "delbanner": $res = $this->DelBanner(); break; case "setrows": $res = $this->setRows(); break; case "setsort": $res = $this->setSort(); break; case "seton": $res = $this->setOn(); break; case "setoff": $res = $this->setOff(); break; case "reset": $res = $this->Reset(); break; case "delete": $res = $this->Delete(); break; } if ($res) { A::goUrl("admin.php?mode=structures&item=" . ITEM, array('idcat', 'tab', 'page')); } }
function Action($action) { $res = false; switch ($action) { case "addrss": $res = $this->AddRSS(); break; case "editrss": $res = $this->EditRSS(); break; case "delrss": $res = $this->DelRSS(); break; } if ($res) { A::goUrl("admin.php?mode=structures&item=" . ITEM); } }
/** * Маршрутизатор действий. */ function Action($action) { switch ($action) { case "additem": $res = $this->AddItem(); break; case "edititem": $res = $this->EditItem(); break; case "delitem": $res = $this->DelItem(); break; case "setsort": $res = $this->setSort(); break; case "setrows": $res = $this->setRows(); break; case "setfilter": $res = $this->setFilter(); break; case "unfilter": $res = $this->unFilter(); break; case "setactive": $res = $this->SetActive(); break; case "setunactive": $res = $this->SetUnActive(); break; case "delete": $res = $this->Delete(); break; case "moveitems": $res = $this->MoveItems(); break; case "save": $res = $this->Save(); break; } if (!empty($res)) { A::goUrl("admin.php?mode=sections&item=" . SECTION, array('idcat', 'page', 'tab')); } }
/** * Маршрутизатор действий. */ function Action($action) { $res = false; switch ($action) { case "adddir": $res = $this->AddDir(); break; case "addpage": $res = $this->AddPage(); break; case "editdir": $res = $this->EditDir(); break; case "editpage": $res = $this->EditPage(); break; case "del": $res = $this->Del(); break; case "delete": $res = $this->Delete(); break; case "setrows": $res = $this->SetRows(); break; case "setactive": $res = $this->SetActive(); break; case "setunactive": $res = $this->SetUnActive(); break; case "move": $res = $this->Move(); break; case "cmove": $res = $this->CMove(); break; } if ($res) { A::goUrl("admin.php?mode=sections&item=" . SECTION, array('page')); } }
/** * Формирование данных доступных в шаблоне страницы "мои заказы". */ function MyOrdersPage() { if (!A::$AUTH->isLogin()) { A::goUrl(getSectionLink(SECTION)); } $orders = array(); $pager = new A_Pager(20); $pager->tab = "orders"; $pager->query("SELECT * FROM " . SECTION . "_orders WHERE iduser=? ORDER BY date DESC", A::$AUTH->id); while ($row = $pager->fetchRow()) { if ($section = getSectionByModule('robopay')) { $row['paylink'] = getSectionLink($section) . "?action=pay&code=" . md5($section . $row['date']); } $row['pay'] = function_exists('pay_getname') ? pay_getname($row['pay']) : "Наличные"; $row['basket'] = !empty($row['basket']) ? unserialize($row['basket']) : array(); $row['sum'] = round($row['sum'], 2); $orders[] = $row; } $pager->free(); $this->Assign("orders", $orders); $this->Assign("orders_pager", $pager); $this->AddNavigation(SECTION_NAME, getSectionLink(SECTION)); }
/** * Обработчик действия: Комментирование альбома. */ function AddComment() { if (!getAccess("comment")) { return false; } if (empty($_REQUEST['captcha']) || md5(strtolower($_REQUEST['captcha'])) != A_Session::get('captcha')) { $this->errors['captcha'] = true; return false; } A_Session::unregister('captcha'); $data = array(); $data['date'] = time(); $data['idsec'] = SECTION_ID; $data['iduser'] = A::$AUTH->id; $data['iditem'] = $this->idalb; $data['name'] = strip_tags($_REQUEST['name']); $data['bbcode'] = $_REQUEST['message']; $data['message'] = parse_bbcode($data['bbcode']); $data['active'] = A::$OPTIONS['cactive'] ? 'N' : 'Y'; if (empty($data['name']) || empty($data['message'])) { return false; } if ($id = A::$DB->Insert(DOMAIN . "_comments", $data)) { $count = A::$DB->getCount(DOMAIN . "_comments", "idsec=" . SECTION_ID . " AND iditem={$this->idalb}"); A::$DB->execute("UPDATE " . SECTION . "_albums SET comments={$count} WHERE id={$this->idalb}"); $link = gallery_createItemLink($this->idalb, SECTION); if (!empty(A::$OPTIONS['cemail'])) { if (!empty(A::$OPTIONS['commenttpl'])) { $item = A::$DB->getRowById($this->idalb, SECTION . "_albums"); $item['link'] = "http://" . HOSTNAME . $link; $mail = new A_Mail(A::$OPTIONS['commenttpl'], "html"); $mail->Assign("item", $item); $mail->Assign("comment", $data); $mail->send(A::$OPTIONS['cemail']); } } if (A::$OPTIONS['cactive']) { A::goUrl($link . '?newcomment=1'); } else { A::goUrl($link); } } else { return false; } }
<?php /** * @project Astra.CMS * @link http://a-cms.ru/ * @copyright 2010 "Астра Вебтехнологии" * @author Vitaly Hohlov <*****@*****.**> * @package Plugins */ /**************************************************************************/ if (!empty($_GET['id'])) { if ($row = A::$DB->getRowById($_GET['id'], STRUCTURE)) { A::$DB->execute("UPDATE " . STRUCTURE . " SET clicks=clicks+1 WHERE id=" . (int) $_GET['id']); A::goUrl($row['url']); } }
/** * Обработчик действия: Отправка сообщения. */ function sendMessage() { if (empty($_REQUEST['captcha']) || md5(strtolower($_REQUEST['captcha'])) != A_Session::get('captcha')) { $this->errors['captcha'] = true; return false; } A_Session::unregister('captcha'); $mail = new A_Mail(A::$OPTIONS['template'], "html"); if (!empty($_REQUEST['email'])) { $mail->setFrom($_REQUEST['email'], !empty($_REQUEST['name']) ? $_REQUEST['name'] : ''); } $mail->Assign("data", $_REQUEST); $fields = array(); A::$DB->query("SELECT * FROM " . DOMAIN . "_fields WHERE item='" . SECTION . "' ORDER BY sort"); while ($row = A::$DB->fetchRow()) { if ($row['type'] == "select" || $row['type'] == "mselect") { $row['options'] = loadList($row['property']); if ($row['type'] == "mselect") { $row['value'] = array(); $values = isset($_REQUEST[$row['field']]) ? $_REQUEST[$row['field']] : array(); foreach ($values as $value) { $row['value'][] = isset($row['options'][$value]) ? is_array($row['options'][$value]) ? $row['options'][$value]['name'] : $row['options'][$value] : ""; } $row['value'] = implode(", ", $row['value']); } else { $row['value'] = isset($_REQUEST[$row['field']]) ? (int) $_REQUEST[$row['field']] : 0; $row['value'] = isset($row['options'][$row['value']]) ? $row['options'][$row['value']] : ""; if (is_array($row['value'])) { $row['data'] = $row['value']; $row['value'] = !empty($row['data']['name']) ? $row['data']['name'] : ""; } } } elseif ($row['type'] == "file") { if (isset($_FILES[$row['field']]['tmp_name']) && is_file($_FILES[$row['field']]['tmp_name'])) { $mail->addAttachment($_FILES[$row['field']]['tmp_name'], $_FILES[$row['field']]['name'], $_FILES[$row['field']]['type']); } } else { $row['value'] = isset($_REQUEST[$row['field']]) ? strip_tags($_REQUEST[$row['field']]) : ""; } if ($row['type'] == "float") { $row['value'] = round($row['value'], 2); } $row['name'] = $row['name_' . LANG]; $fields[$row['field']] = $row; } A::$DB->free(); $mail->Assign("fields", $fields); if (isset($fields['subject'])) { $mail->setSubject($fields['subject']['value']); } if (isset($_REQUEST['mailto']) && isset($fields['mailto']['options'][$_REQUEST['mailto']]['email'])) { $mail->send($fields['mailto']['options'][$_REQUEST['mailto']]['email']); } elseif (!empty(A::$OPTIONS['email'])) { $mail->send(A::$OPTIONS['email']); } $data = array('date' => time(), 'message' => $mail->getContent(), 'data' => serialize($fields)); if (A::$AUTH->isLogin()) { $data['iduser'] = A::$AUTH->id; } if ($id = A::$DB->Insert(SECTION . "_arch", $data)) { A_Session::set(SECTION . "_id", $id); A::goUrl(getSectionLink(SECTION) . "message.html"); } else { return false; } }
/** * Маршрутизатор действий. */ function Action($action) { switch ($action) { case "additem": $res = $this->AddItem(); break; case "edititem": $res = $this->EditItem(); break; case "delitem": $res = $this->DelItem(); break; case "setsort": $res = $this->setSort(); break; case "setrows": $res = $this->setRows(); break; case "setfilter": $res = $this->setFilter(); break; case "unfilter": $res = $this->unFilter(); break; case "setactive": $res = $this->SetActive(); break; case "setunactive": $res = $this->UnActive(); break; case "setfavorite": $res = $this->SetFavorite(); break; case "unfavorite": $res = $this->UnFavorite(); break; case "setnew": $res = $this->SetNew(); break; case "unnew": $res = $this->UnNew(); break; case "delete": $res = $this->Delete(); break; case "moveitems": $res = $this->MoveItems(); break; case "copyitems": $res = $this->CopyItems(); break; case "save": $res = $this->Save(); break; case "settie": $res = $this->setTie(); break; case "delorder": $res = $this->DelOrder(); break; case "setrows2": $res = $this->setRows2(); break; case "setstatus0": $res = $this->setStatus(0); break; case "setstatus1": $res = $this->setStatus(1); break; case "setstatus2": $res = $this->setStatus(2); break; case "odelete": $res = $this->OrdersDelete(); break; case "addcol": $res = $this->AddCol(); break; case "delcol": $res = $this->DelCol(); break; case "import": $res = $this->Import(); break; case "export": $res = $this->Export(); break; } if (!empty($res)) { A::goUrl("admin.php?mode=sections&item=" . SECTION, array('idcat', 'date', 'from', 'to', 'sum1', 'sum2', 'status', 'pay', 'tab', 'page', 'page1', 'page3')); } }
A::$MAINFRAME->Assign('keywords', $row['keywords']); } if ($row['description']) { A::$MAINFRAME->Assign('description', $row['description']); } } } } } A::$OBSERVER->AddHandler('ShowPage', 'seo_ShowPage'); function seo_CreateAdminFrame($item) { if ((MODE == 'site' || MODE == 'sections') && ($structure = getStructureByPlugin('seo'))) { A::$MAINFRAME->AddJScript("/plugins/seo/admin/seo.js"); A::$MAINFRAME->AddJVar("SEOSTRUCTURE", $structure); A::$MAINFRAME->Assign("seo", $structure); } } A::$OBSERVER->AddHandler('CreateAdminFrame', 'seo_CreateAdminFrame'); if (A_MODE == A_MODE_FRONT && ($structure = getStructureByPlugin('seo'))) { if ($urls = A::$DB->getAssoc("SELECT url,move,notfound FROM {$structure} WHERE move<>'' OR notfound='Y'")) { $PURL = parse_url(urldecode(getenv('REQUEST_URI'))); if (isset($urls[$PURL['path']])) { if ($urls[$PURL['path']]['notfound'] == 'Y') { A::NotFound(); } elseif ($urls[$PURL['path']]['move']) { A::goUrl($urls[$PURL['path']]['move'], null, true); } } } }
/** * Формирование данных доступных в шаблоне главной страницы раздела. */ function MainPage() { if (empty($_GET['filter'])) { $this->supportCached(); $this->addCacheParam_Get('filter'); $this->addCacheParam_Get('page'); } if (!empty($_GET['idcat'])) { if ($this->category = A::$DB->getRowById($_GET['idcat'], SECTION . "_categories")) { A::goUrl(catalog_createCategoryLink($this->category['id'], SECTION) . '?' . getenv('QUERY_STRING')); } } $levels = A::$DB->getOne("SELECT MAX(level) FROM " . SECTION . "_categories WHERE active='Y'"); $this->Assign("levels", $levels); $categories = array(); A::$DB->query("SELECT * FROM " . SECTION . "_categories WHERE idker=0 AND active='Y' ORDER BY sort"); while ($row = A::$DB->fetchRow()) { $row['link'] = catalog_createCategoryLink($row['id'], SECTION); $row['subcategories'] = array(); A::$DB->query("SELECT * FROM " . SECTION . "_categories WHERE idker={$row['id']} AND active='Y' ORDER BY sort"); while ($subrow = A::$DB->fetchRow()) { $subrow['link'] = catalog_createCategoryLink($subrow['id'], SECTION); $row['subcategories'][] = $subrow; } A::$DB->free(); $categories[] = $row; } A::$DB->free(); $this->Assign("categories", $categories); if (!empty($_GET['sort'])) { A_Session::set(SECTION . '_msort', $_GET['sort']); } if (!empty($_GET['rows'])) { A_Session::set(SECTION . '_mrows', $_GET['rows']); } $sort = escape_order_string(A_Session::get(SECTION . '_msort', !empty(A::$OPTIONS['mysort']) ? A::$OPTIONS['mysort'] : A::$OPTIONS['sort'])); $rows = (int) A_Session::get(SECTION . '_mrows', A::$OPTIONS['mrows']); $this->Assign("rows", $rows); $this->Assign("sort", $sort); $where = $this->frontfilter(); $items = array(); $pager = new A_Pager($rows); if (A::$OPTIONS['mainmode'] == 0) { $pager->query("SELECT *,svote/cvote AS vote FROM " . SECTION . "_catalog WHERE idcat=0 AND active='Y'{$where} ORDER BY {$sort}"); } else { $pager->query("SELECT *,svote/cvote AS vote FROM " . SECTION . "_catalog WHERE active='Y'{$where} ORDER BY {$sort}"); } while ($row = $pager->fetchRow()) { $row['link'] = catalog_createItemLink($row['id'], SECTION); $row['vote'] = round($row['vote'], 2); if (A::$OPTIONS['mainmode'] == 1) { $row['category'] = getTreePath(SECTION . "_categories", $row['idcat']); } if (A::$OPTIONS['useimages']) { $row['images'] = A::$DB->getAll("SELECT * FROM " . DOMAIN . "_images WHERE idsec=? AND iditem=? ORDER BY sort", array(SECTION_ID, $row['id'])); $row['idimg'] = isset($row['images'][0]['id']) ? $row['images'][0]['id'] : 0; } if (A::$OPTIONS['usefiles']) { $row['files'] = A::$DB->getAll("SELECT * FROM " . DOMAIN . "_files WHERE idsec=? AND iditem=? ORDER BY sort", array(SECTION_ID, $row['id'])); foreach ($row['files'] as $i => $data) { $row['files'][$i]['link'] = (LANG == DEFAULTLANG ? "" : "/" . LANG) . "/getfile/" . $data['id'] . "/" . $data['name']; $row['files'][$i]['size'] = sizestring($data['size']); } $row['idfile'] = isset($row['files'][0]['id']) ? $row['files'][0]['id'] : 0; } if (A::$OPTIONS['usetags']) { $row['tags'] = A_SearchEngine::getInstance()->convertTags($row['tags']); } prepareValues(SECTION, $row); $row = A::$OBSERVER->Modifier('catalog_prepareValues', SECTION, $row); $items[] = $row; } $pager->free(); $this->Assign("items", $items); $this->Assign("items_pager", $pager); $this->AddNavigation(SECTION_NAME); }