function News() { $this->name = "News"; $this->desc = "Provides a news system with comments"; $this->publicFunctions = array("getContent", "getSubItemType", "getItemType", "getItemDesc", "getSpecificDataForEditing", "getSpecificBlockDesc", "updateSpecificData", "newsBlock", 'updateAdditionalColumns'); $this->cmdFunctions = array(); SetCfg("News.perPage", 10); }
function Producer() { $this->name = "Producer"; $this->desc = "producer"; $this->publicFunctions = array("getContent", "getItemType", "getSubItemType", "getItemDesc", "getSpecificDataForEditing", "getSpecificBlockDesc", "updateSpecificData", 'updateAdditionalColumns'); $this->cmdFunctions = array(); SetCfg("Producer.perPage", 50); SetCfg("Producer.itemsPerPage", 20); SetCfg("Producer.itemsPerCol", 2); }
function getContent($args) { global $structureMgr, $templatesMgr; SetCfg("Search.itemsPerPage", 10); SetCfg("Search.itemsPerCol", 1); $order = _get('order'); $searchtext = trim(_get("searchtext")); $searchtype = _get("searchtype"); if (!$searchtype) { $searchtype = 0; } $pageID = $args[0]; $content = ''; $pager = ''; $msg = ''; $topContent = $structureMgr->getData($pageID); $pNum = $structureMgr->getPageNumberByPageID($pageID); $URL = $structureMgr->getPathByPageID($pageID, false); $perPage = GetCfg('Search.itemsPerPage'); $startFrom = ($pNum - 1) * $perPage; $endAt = $startFrom + $perPage - 1; $cats = $structureMgr->getStructureForPageID(3, 1); $content = ""; $searchForm = '<form action="/search" method="get"><div class="podbor"> <p>%msg%</p> <input name="searchtext" type="text" class="searchsel" value="' . $searchtext . '" /> '; $searchForm .= '<input type="image" src="/images/search_butt_inside.gif" class="search_butt" alt="Искать" /> </div> </form>'; $items = $this->getItems($searchtext, $startFrom, $endAt, $searchtype, $order); $cnt = $this->itemsCount; if (strlen($searchtext) < 2) { $msg .= "Слишком короткий запрос. Введите запрос размером более трех символов"; } else { if (!$cnt) { $msg .= "На ваш запрос результатов не найдено"; } else { $msg .= "На ваш запрос найдено <strong>" . $cnt . "</strong> результатов"; if ($endAt >= $cnt) { $endAt = $cnt - 1; } $pagesCount = ceil($cnt / $perPage); $filter = "searchtext=" . $searchtext; if ($order) { $filter .= '&order=' . $order; } if ($pagesCount < $pNum) { trigger_error("Invalid pageNumber [{$pNum} of {$pagesCount}] - possibly hacking or serious change in DB", PM_ERROR); } else { if ($pagesCount > 1) { $tpl = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/" . "pager_filter.html"); $purePager = ""; for ($i = 1; $i <= $pagesCount; $i++) { if ($i > 1) { $purePager .= ' - '; $u = $URL . '/page' . $i; } else { $u = $URL; } if ($filter) { $u .= '?' . $filter; } if ($i == $pNum) { $purePager .= $i; } else { $purePager .= "<a href=\"{$u}\" class=\"levm\">" . $i . "</a>"; } } switch ($order) { case "name": $tpl = str_replace("%sel1%", 'selected="selected"', $tpl); break; case "price": $tpl = str_replace("%sel2%", 'selected="selected"', $tpl); break; case "desc": $tpl = str_replace("%sel3%", 'selected="selected"', $tpl); break; case "order": $tpl = str_replace("%sel4%", 'selected="selected"', $tpl); break; } $tpl = str_replace("%sel1%", '', $tpl); $tpl = str_replace("%sel2%", '', $tpl); $tpl = str_replace("%sel3%", '', $tpl); $tpl = str_replace("%sel4%", '', $tpl); $tpl = str_replace("%links%", $purePager, $tpl); $tpl = str_replace("%catFilter%", "<input type=\"hidden\" name=\"searchtext\" value=\"" . $searchtext . "\" />", $tpl); $pager = str_replace("%links%", $purePager, $tpl); } } $i = 1; $content .= "<div class=\"items\">\n<table cellpadding=\"0\" cellspacing=\"0\" class=\"items-table\">\n"; foreach ($items as $item) { $style = $i > GetCfg("Search.itemsPerCol") ? "dwn" : "up"; $content .= $this->getFilledTemplate($item, $style); $i++; } $content .= "\n</table>\n</div>\n"; } } $searchForm = str_replace("%msg%", $msg, $searchForm); return $topContent . $searchForm . $pager . $content . $pager; }
<?php SetCfg("Orders.ModuleName", "Заказы"); SetCfg("Orders.ModuleDesc", ""); // $this->desc = "Provides an articles system with comments";
<?php SetCfg("Club.GoodID", "2543"); SetCfg("Club.ModuleName", " луб"); SetCfg("Club.ModuleDesc", "");
function getFilteredItems($pageID, $propVals, $prodIDs, $cats) { global $structureMgr, $templatesMgr; //echo '<br />'.$pageID.' 2'; SetCfg("Catalogue.itemsPerPage", 10); SetCfg("Catalogue.itemsPerCol", 1); //$car0 = _varByPattern('/c0-\\d+/'); //$cats = _varByPattern('/c' . $carID . '-\\d+/'); //$prodIDs = _varByPattern('/p-\\d+/'); //$propVals = _varByPattern('/propVal-\\d+/'); $from = _get("from"); $to = _get("to"); $propID = _get("propID"); $carID = _get("carID"); $order = _get("order"); $filterTpl = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/" . "Catalogue/filterMenu.html"); $branch = $structureMgr->getChildrenDataTypesForPageID($pageID, 1); //echo $pageID; $catFilter = ""; $propsArray = array(); $bsIDArray = array(); foreach ($branch as $i => $v) { $bsID = $v["sID"]; $URL = $structureMgr->getPathByPageID($v["sID"], false); $chCount = $structureMgr->getChildrenCount($v["sID"]); if ($chCount > 0) { $catFilter .= "<img src=\"/images/arr_gray2.gif\" width=\"7\" height=\"9\" alt=\"\" /><a href=\"?c-{$i}={$bsID}\" >" . $v["Title"] . " ({$chCount})</a><br/>\n"; } $bsIDArray[] = $bsID; } if ($this->FILTER_CONSTANT_ARRAY[$pageID]['otherParamId']) { $subCats = $this->getSubCategoris($pageID, $bsIDArray, $this->FILTER_CONSTANT_ARRAY[$pageID]['otherParamId'], 1); } else { $subCats = array(); } $propsArray = $subCats; $pageIDList = array(); foreach ($branch as $i => $v) { $pageIDList[] = $v["sID"]; } $prodList = array(); if (count($pageIDList) > 0) { $prodList = $structureMgr->getProducersByPageIDList($pageIDList); } $prods = ""; foreach ($prodList as $prodItem) { $prods .= "<option value=\"" . $prodItem[0] . "\" " . (in_array($prodItem[0], $prodIDs) ? "selected" : "") . ">" . $prodItem[1] . "</option>"; } $filterTpl = str_replace("%prods%", $prods, $filterTpl); /** * Код формирует доп. поле для фильра * См. раздел шины, масла. */ $propsValues = ""; foreach ($propsArray as $propsArrayItem) { $propsValues .= $this->addInputType($propsArrayItem['propListID'], $propsArrayItem['propValue'], $propsArrayItem['propValue'], "select", $propsArrayItem['propValue'] == $propID ? 1 : 0); } if ($this->FILTER_CONSTANT_ARRAY[$pageID]['otherParamId']) { $propsValues = '<tr> <td class="tdmidleft filtr">' . $propsArray[0]['propName'] . '</td> <td class="tdmidright filtr"><select name="propID" class="widesel" id="propID"> <option value="">-----</option>' . $propsValues . '</select> </td> </tr>'; $filterTpl = str_replace("%propsValues%", $propsValues, $filterTpl); } else { $filterTpl = str_replace("%propsValues%", "", $filterTpl); } $filterTpl = str_replace("%filter_result%", $this->FILTER_CONSTANT_ARRAY[$pageID]['result'], $filterTpl); $filterTpl = str_replace("%from%", $from, $filterTpl); $filterTpl = str_replace("%to%", $to, $filterTpl); $filterTpl = str_replace("%ShortTitle%", $ShortTitle, $filterTpl); //$filterTpl = str_replace("%actionUrl%", ($_SERVER['QUERY_STRING']?$_SERVER['HTTP_REFERER']."?".$_SERVER['QUERY_STRING']:""), $filterTpl); $props = array(); $filterArray = array(); $podborArray = array(); $hidenInputArray = array(); //$props['1'][] = " p.sID = '".$pageID."'"; //$props['2'][] = " s.pms_sID = '".$pageID."'"; if ($carID) { $hidenInputArray[] = '<input type="hidden" name="carID" value="' . $carID . '" />'; $filterArray[] = "carID=" . $carID; } if ($order) { $hidenInputArray[] = '<input type="hidden" name="order" value="' . $order . '" />'; $filterArray[] = "order=" . $order; } if ($propID) { $filterArray[] = "propID=" . $propID; } if ($from) { $filterArray[] = "from=" . $from; } if ($to) { $filterArray[] = "to=" . $to; } foreach ($cats as $key => $value) { if ($value) { $props['sID'][] = "s.pms_sID = '" . $value . "'"; //$props['p.accCatID'][] = $param[0]; $filterArray[] = $key . "=" . $value; $hidenInputArray[] = '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n"; } } foreach ($propVals as $key => $value) { if ($value) { $param = explode("_", $value); $props['props'][] = "pp.propValue = '" . $param[1] . "' && s.pms_sID = '" . $param[0] . "'"; //$props['p.accCatID'][] = $param[0]; $podborArray['prop'][] = $param[1]; $filterArray[] = $key . "=" . $value; $hidenInputArray[] = '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n"; } } foreach ($prodIDs as $key => $value) { if ($value) { $props['prods'][] = "ap.accPlantID = '" . $value . "'"; $filterArray[] = $key . "=" . $value; $query = "SELECT * FROM pm_as_producer WHERE accPlantID='" . $value . "'"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $podborArray['prod'][] = $row['accPlantName']; $hidenInputArray[] = '<input type="hidden" name="' . $key . '" value="' . $value . '" />'; } } //if(count($podborArray)) //{ $catFilter = "<p><img src=\"/images/arr_gray2.gif\" width=\"7\" height=\"9\" alt=\"\" />" . $structureMgr->getTitleFromParams($cats) . "</p>" . "\n<p>" . $catFilter . "</p>"; //} if (count($hidenInputArray)) { $catFilter .= implode("\n", $hidenInputArray); } $filterTpl = str_replace("%catFilter%", $catFilter, $filterTpl); //$filter = $_SERVER['QUERY_STRING']; //echo $filter; $filter = implode("&", $filterArray); $content = ""; $pager = ""; //$topContent = $structureMgr->getData($pageID); $pNum = _get("pNum"); if (!$pNum) { $pNum = 1; } //$pNum = $structureMgr->getPageNumberByPageID($pageID); //$URL = $structureMgr->getPathByPageID($pageID, false); $perPage = GetCfg("Catalogue.itemsPerPage"); $startFrom = ($pNum - 1) * $perPage; $endAt = $startFrom + $perPage - 1; $items = $this->getItemsWithFilter($props, $startFrom, $endAt, $from, $to, $propID, $carID, $order); $cnt = $this->itemsCount; if ($endAt >= $cnt) { $endAt = $cnt - 1; } $pagesCount = ceil($cnt / $perPage); if ($pagesCount < $pNum - 1) { trigger_error("Invalid pageNumber [{$pNum} of {$pagesCount}] - possibly hacking or serious change in DB", PM_ERROR); } else { if ($pagesCount > 1) { $tpl = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/" . "pager_filter.html"); $purePager = ""; for ($i = 1; $i <= $pagesCount; $i++) { /*if ($i > 1) {*/ $purePager .= " - "; $u = "?pNum=" . $i; //} //else // $u = ""; if ($filter) { $u .= "&" . $filter; } if ($i == $pNum) { $purePager .= $i; } else { $purePager .= "<a href=\"{$u}\" class=\"levm\">" . $i . "</a>"; } } switch ($order) { case "name": $tpl = str_replace("%sel1%", 'selected="selected"', $tpl); break; case "price": $tpl = str_replace("%sel2%", 'selected="selected"', $tpl); break; case "desc": $tpl = str_replace("%sel3%", 'selected="selected"', $tpl); break; case "rating": $tpl = str_replace("%sel4%", 'selected="selected"', $tpl); break; } $tpl = str_replace("%sel1%", '', $tpl); $tpl = str_replace("%sel2%", '', $tpl); $tpl = str_replace("%sel3%", '', $tpl); $tpl = str_replace("%sel4%", '', $tpl); $tpl = str_replace("%links%", $purePager, $tpl); $pager = str_replace("%catFilter%", implode("\n", $hidenInputArray), $tpl); $filterTpl = str_replace("%links%", "Страницы: " . $purePager, $filterTpl); } else { $filterTpl = str_replace("%links%", " ", $filterTpl); } } $content .= "<div class=\"items\">\n<table cellpadding=\"0\" cellspacing=\"0\" class=\"items-table\">\n"; //print_r($items); $i = 0; //print_r($items); foreach ($items as $item) { $style = $i > 0 ? "mid" : "up"; $content .= $this->getFilledItemTemplate($item, $style); $i++; } $content .= "\n</table>\n</div>\n"; if (!count($items)) { $URL = $structureMgr->getPathByPageID($pageID, false); header('Location: ' . $URL . "?error=1"); } return $filterTpl . $content . $pager; }
<?php $mp = GetCfg("mysql.port"); $hst = GetCfg("mysql.host"); if ($mp) { $hst .= ":{$mp}"; } $dblink = mysql_pconnect($hst, GetCfg("mysql.username"), GetCfg("mysql.password")); if ($dblink) { if (!mysql_select_db(GetCfg("mysql.dbname"), $dblink)) { trigger_error("Could not select db - " . mysql_error(), PM_WARNING); } SetCfg("dblink", $dblink); } else { trigger_error("Could not connect to mysql - " . mysql_error(), PM_WARNING); } mysql_query("SET NAMES 'cp1251'"); mysql_query("SET CHARACTER SET cp1251"); function prepareVar($value) { if (get_magic_quotes_gpc()) { $value = stripslashes($value); } if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value, GetCfg("dblink")) . "'"; } return $value; }
<?php SetCfg("Search.ModuleName", "Поиск"); SetCfg("Search.ModuleDesc", "Поиск");
<?php SetCfg("Catalogue.ModuleName", "Каталог"); SetCfg("Catalogue.ModuleDesc", ""); SetCfg("Catalogue.dictionaries", array("pm_as_producer" => array("Производители", array("id" => array("accPlantID", "4", 0), "Производитель" => array("accPlantName", "32", 1), "Логотип" => array("logotype", "18", 1), "Логотип большой" => array("logotypeb", "18", 1), "Ид страницы" => array("sID", "5", 1)), "accPlantID"), "pm_as_pricetypes" => array("Типы цен", array("id" => array("ptID", "4", 0), "Наименование цены" => array("ptName", "32", 1), "Процент скидки" => array("ptPercent", "4", 1)), "ptID")));
function getTopBlock() { SetCfg('Xit.itemsPerPage', 4); SetCfg('Xit.itemsPerCol', 1); $content = ''; $items = $this->getRandomBlockItems(); foreach ($items as $item) { $content .= $this->getFilledSmallTemplate($item, $this->LOW_DETAILED); } return $content . '<div class="more"><img src="/images/arr_gray2.gif" width="7" height="9" alt="" /><a href="/main/hitofsales/">Подробнее о хитах продаж</a></div>'; }
<?php SetCfg("Producer.ModuleName", "Производители"); SetCfg("Producer.ModuleDesc", "");
<?php SetCfg("Register.ModuleName", "Регистрация"); SetCfg("Register.ModuleDesc", ""); // $this->desc = "Provides an articles system with comments";
<?php SetCfg("Bonus.ModuleName", "—пец предложени¤"); SetCfg("Bonus.ModuleDesc", "Ѕлок специальных предложений");
<?php SetCfg("Profile.ModuleName", "–едактирование пользовател¤"); SetCfg("Profile.ModuleDesc", ""); // $this->desc = "Provides an articles system with comments";
<?php SetCfg("News.ModuleName", "Новости"); SetCfg("News.ModuleDesc", "");
function getResults($args) { global $structureMgr, $templatesMgr; SetCfg("Vote.itemsPerPage", 10); SetCfg("Vote.itemsPerCol", 1); $pageID = $args[0]; $pager = ""; $content = ""; $pNum = $structureMgr->getPageNumberByPageID($pageID); $URL = $structureMgr->getPathByPageID($pageID, false); $perPage = GetCfg("Vote.itemsPerPage"); $startFrom = ($pNum - 1) * $perPage; $endAt = $startFrom + $perPage - 1; $voteresults = $this->getVoteResults($startFrom, $endAt); $cnt = $this->itemsCount; if ($endAt >= $cnt) { $endAt = $cnt - 1; } $pagesCount = ceil($cnt / $perPage); if ($pagesCount < $pNum) { //echo $pagesCount . " -- ". $pNum."<br>"; trigger_error("Invalid pageNumber [{$pNum} of {$pagesCount}] - possibly hacking or serious change in DB", PM_ERROR); } else { if ($pagesCount > 1) { $tpl = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/" . "pager.html"); $purePager = ""; for ($i = 1; $i <= $pagesCount; $i++) { if ($i > 1) { $purePager .= " - "; $u = $URL . "/page" . $i; } else { $u = $URL; } if ($filter) { $u .= "?" . $filter; } if ($i == $pNum) { $purePager .= $i; } else { $purePager .= "<a href=\"{$u}\" class=\"levm\">" . $i . "</a>"; } } $pager = str_replace("%links%", $purePager, $tpl); } } $content .= "<div class=\"items\">\n\t\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" class=\"items-table\">\n\t\t\t\t\t\t"; if (count($voteresults)) { $i = 1; foreach ($voteresults as $voteresult) { if ($i == 1) { $style = "up"; } elseif ($i == count($voteresults)) { $style = "dwn"; } else { $style = "mid"; } $content .= "<tr>" . $this->getResultsFilledTemplate($voteresult, $style) . "</tr>"; $i++; } } $content .= "</table></div>"; return $pager . $content . $pager; }
<?php SetCfg("Vote.ModuleName", "Голосование:"); SetCfg("Vote.ModuleDesc", "Блок опросов:");
function getTopBlock() { SetCfg("Sale.itemsPerPage", 4); SetCfg("Sale.itemsPerCol", 1); $content = ""; $items = $this->getRandomBlockItems(); foreach ($items as $item) { $content .= $this->getFilledSmallTemplate($item, $this->LOW_DETAILED); } return $content . '<div class="more"><img src="/images/arr_gray2.gif" width="7" height="9" alt="" /><a href="/catalogue/sale/">Подробнее о распродажах</a></div>'; }
<?php SetCfg("Links.ModuleName", "Каталог ссылок"); SetCfg("Links.ModuleDesc", "Каталог ссылок");
<?php SetCfg("Cart.ModuleName", "Корзина заказа"); SetCfg("Cart.ModuleDesc", "");
function processOrdersRequest($url) { global $modulesMgr, $structureMgr, $authenticationMgr, $permissionsMgr, $cacheMgr, $templatesMgr; $userID = $authenticationMgr->getUserID(); if ($userID == 1) { header('Status: 302 Moved'); header('Location: /login'); exit; } SetCfg('InOrders', true); include '_kernel.orders.php'; $res .= processOrdersCommand('orders'); print $res; }
<?php SetCfg("Xit.ModuleName", "’иты продаж"); SetCfg("Xit.ModuleDesc", "Ѕлок хит продаж");
<?php SetCfg("Banner.ModuleName", "–еклама"); SetCfg("Banner.ModuleDesc", "–еклама");
function getBlock() { SetCfg('Bonus.itemsPerPage', 4); SetCfg('Bonus.itemsPerCol', 2); $content = ''; $items = $this->getRandomBlockItems(); $i = 1; $content .= '<div class="items"><table cellpadding="0" cellspacing="0" class="items-table">'; //print_r($items); foreach ($items as $item) { if (($i - 1) % GetCfg('Bonus.itemsPerCol') == 0) { $content .= '<tr>'; } $style = 'td' . ($i > GetCfg('Bonus.itemsPerCol') ? 'dwn' : 'up') . ($i % GetCfg('Bonus.itemsPerCol') != 0 ? 'left' : 'right'); $content .= $this->getFilledTemplate($item, $this->MEDIUM_DETAILED, $style); if ($i % GetCfg('Bonus.itemsPerCol') == 0) { $content .= '</tr>'; } $i++; } $content .= '</table>'; return $content . '<div class="more"><img src="/images/arr_gray2.gif" width="7" height="9" alt="" /><a href="/main/bonus/">Подробнее о спецпредложениях</a></div></div>'; }
<?php SetCfg("New1.ModuleName", "Новинки"); SetCfg("New1.ModuleDesc", "Блок новинок");
<?php SetCfg("Articles.ModuleName", "ѕубликации"); SetCfg("Articles.ModuleDesc", ""); // $this->desc = "Provides an articles system with comments";
<?php SetCfg("Sale.ModuleName", "Распродажа"); SetCfg("Sale.ModuleDesc", "Блок распродажи");