本文整理汇总了PHP中GetCfg函数的典型用法代码示例。如果您正苦于以下问题:PHP GetCfg函数的具体用法?PHP GetCfg怎么用?PHP GetCfg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCfg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quickAdminBlock
function quickAdminBlock($pageID)
{
global $modulesMgr, $structureMgr, $authenticationMgr, $permissionsMgr, $cacheMgr, $templatesMgr;
$realURL = $structureMgr->getPathByPageID($pageID, false);
$metaData = $structureMgr->getMetaData($pageID);
$dt = $metaData["DataType"];
$dTypes = $modulesMgr->execute($metaData["ModuleName"], "getSubItemType", array($metaData["DataType"]), false);
$addLinks = "";
foreach ($dTypes as $k => $v) {
if ($addLinks) {
$addLinks .= ", ";
}
$addLinks .= "<a class=\"admlink\" target=\"_blank\" href=\"/admin/?cmd=addPage&pageID={$pageID}&ModuleName={$metaData['ModuleName']}&DataType={$k}\">{$v}</a>";
}
if ($addLinks) {
$addLinks = " | <strong style=\"font-size: 13px;\">Добавить: </strong>{$addLinks}";
}
if (GetCfg("AdminPanelShowHidden")) {
$mblock = "none";
$hblock = "block";
} else {
$hblock = "none";
$mblock = "block";
}
$timeout = GetCfg("HideAdminPanelTimeout");
return "\n <script type=\"text/javascript\">\n function showBlock(b, show, centered)\n {\n bl = document.getElementById(b);\n if (bl)\n {\n bl.style.display = (show ? 'block': 'none');\n /*if (centered)\n {\n bl.style.left = (document.body.clientWidth/2) - (bl.offsetWidth/2);\n bl.style.top = (document.body.clientHeight/2) - (bl.offsetHeight/2);\n }*/\n }\n }\n\n function hideQuickAdmin()\n {\n showBlock('QAdm', 0, true); \n showBlock('QAdmShow', 1, false);\n }\n\n\n\n var qaTimeOut = window.setTimeout(\"hideQuickAdmin();\", {$timeout});\n </script>\n\n\n<!-- QuickAdmin -->\n <style type=\"text/css\">\n .admblk { font-family: Tahoma, Serif; font-size: 14px; background-color: #F6F6F6; }\n a.admlink:link,a.admlink:visited,a.admlink:hover,a.admlink:active {font-size: 13px; font-weight: bold; text-decoration: underline;}\n a.admlink2:link,a.admlink2:visited,a.admlink2:hover,a.admlink2:active {font-size: 13px; font-weight: bold; color: #10A010; text-decoration: underline;}\n </style>\n\n <div id=\"QAdm\" class=\"admblk\" style=\"display: {$mblock};position: relative; width: 97%;\n border-style: double; border-color: #C6C6C6; padding: 0px 10px 10px 10px; margin: 5px;\n filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color='gray', Positive='true');\n -moz-opacity: 0.9;\" onmouseover=\"window.clearTimeout(qaTimeOut);\">\n <div style=\"margin-bottom: 5px; margin-top: 0px;\">\n <a href=\"#\" onclick=\"showBlock('QAdm', 0, true); showBlock('QAdmShow', 1, false); return false;\" style=\"font-size: 10px;\">скрыть панель администратора</a>\n </div>\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"admblk\" width=\"100%\">\n <tr><td>\n <a class=\"admlink\" target=\"_blank\" href=\"/admin{$realURL}\">Редактировать</a>\n {$addLinks}\n | <a class=\"admlink\" target=\"_blank\" href=\"/admin/?cmd=hidePage&pageID={$pageID}\" onclick=\"return confirm('Действительно скрыть текущий раздел со всеми подразделами?')\">Скрыть</a>\n | <a class=\"admlink\" target=\"_blank\" href=\"/admin/?cmd=delPage&pageID={$pageID}\" style=\"color: #CE0530;\" onclick=\"return confirm('Действительно удалить текущий раздел со всеми подразделами?')\">Удалить</a>\n </td>\n <td align=right><a class=\"admlink2\" target=\"_blank\" href=\"/admin/\">Структура сайта</a>\n </td>\n </tr>\n </table>\n </div>\n\n<!-- Hidden QuickAdmin -->\n\n <div id=\"QAdmShow\" style=\"display: {$hblock}; width: 150; margin: 5px;\n font-family: Tahoma, Serif; font-size: 9px; background-color: #F6F6F6; \n border-style: solid; border-color: #334DFE; border-width: 1px;\n padding: 0px 5px 0px 4px; \n filter:progid:DXImageTransform.Microsoft.Alpha(opacity=75)\n progid:DXImageTransform.Microsoft.dropshadow(OffX=3, OffY=3, Color='gray', Positive='true'); \n -moz-opacity: 0.75;\">\n <a href=\"#\" onclick=\"showBlock('QAdmShow', 0, false); \n showBlock('QAdm', 1, true); window.clearTimeout(qaTimeOut); return false;\" style=\"font-size: 10px;\">панель администратора</a>\n </div>\n \n";
}
示例2: authBlock
function authBlock($args)
{
global $authenticationMgr, $templatesMgr;
$containerID = $args["id"];
if (!isset($args["TEMPLATE"])) {
trigger_error("template filename must be specified for autBlock [{$containerID}]", PM_FATAL);
}
$tpl = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/" . $args["TEMPLATE"]);
$block = "";
$userID = $authenticationMgr->getUserID();
$tpl = str_replace("\r", "\\r", $tpl);
$tpl = str_replace("\n", "\\n", $tpl);
if ($userID > 1) {
if (preg_match("/\\<block\\s+authenticated=\"1\"\\s*\\>(.*?)\\<\\/block\\>/", $tpl, $match)) {
$block = $match[1];
} else {
trigger_error("In template [" . $args["TEMPLATE"] . "] section authenticated=\"1\" not found.", PM_FATAL);
}
$uData = $authenticationMgr->getUserData($userID);
$block = str_replace("%username%", $uData["FirstName"] . " " . $uData["LastName"], $block);
$block = str_replace("%carInfo%", $uData["plantName"] . " " . $uData["carModel"], $block);
} else {
if (preg_match("/\\<block\\s+authenticated=\"0\"\\s*\\>(.*?)\\<\\/block\\>/", $tpl, $match)) {
$block = $match[1];
} else {
trigger_error("In template [" . $args["TEMPLATE"] . "] section authenticated=\"0\" not found.", PM_FATAL);
}
$block = str_replace("%carInfo%", "", $block);
$block = str_replace("%currentpath%", str_replace("&", "&", getenv("REQUEST_URI")), $block);
}
$block = str_replace("\\r", "\r", $block);
$block = str_replace("\\n", "\n", $block);
return $block;
}
示例3: getTemplate
function getTemplate($templateID, $fileName)
{
if ($templateID != -1) {
$q = "SELECT tplFilename FROM pm_templates WHERE tplID = '{$templateID}'";
$qr = mysql_query($q);
if (!$qr || mysql_num_rows($qr) == 0) {
trigger_error("Unknown templateID", PM_FATAL);
}
list($tplFilename) = mysql_fetch_row($qr);
$fname = GetCfg("TemplatesPath") . "/{$tplFilename}";
} else {
$fname = $fileName;
}
if (isset($this->_templates[$fname])) {
return $this->_templates[$fname];
}
if (!file_exists($fname)) {
trigger_error("Template [{$fname}] not found", PM_FATAL);
}
$fp = fopen($fname, "r");
if (!$fp) {
trigger_error("Couldn't read template {$fname}", PM_FATAL);
}
$contents = fread($fp, filesize($fname));
fclose($fp);
$this->_templates[$fname] = $contents;
return $contents;
}
示例4: getContent
function getContent($banID = 0)
{
global $templatesMgr;
$tpl = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/banner.html");
$banners = $this->getBannersList();
if (count($banners)) {
$bannerContent = "";
foreach ($banners as $banner) {
$bannerContent .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $banner['param'] . "</td>\n\t\t\t\t\t\t<td>" . $banner['text'] . "</td>\n\t\t\t\t\t\t<td>" . $banner['link'] . "</td>\n\t\t\t\t\t\t<td>" . $banner['url'] . "</td>\n\t\t\t\t\t\t<td>" . $banner['show'] . "</td>\n\t\t\t\t\t\t<td>" . $banner['click'] . "</td>\n\t\t\t\t\t\t<td>" . $banner['isactive'] . "</td>\n\t\t\t\t\t\t<td><a href=\"/admin?cmd=banner&banID=" . $banner['banID'] . "\">–едактировать</a></td>\n\t\t\t\t\t\t<td><a href=\"/admin?cmd=banner&act=delete&banID=" . $banner['banID'] . "\">”далить</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t";
if ($banID == $banner['banID']) {
$tpl = str_replace("%banID%", $banner['banID'], $tpl);
$tpl = str_replace("%param%", $banner['param'], $tpl);
$tpl = str_replace("%url%", $banner['url'], $tpl);
$tpl = str_replace("%link%", $banner['link'], $tpl);
$tpl = str_replace("%text%", $banner['text'], $tpl);
$tpl = str_replace("%isactive%", $banner['isactive'] == 1 ? "checked" : "", $tpl);
}
}
$tpl = str_replace("%banners%", $bannerContent, $tpl);
} else {
$tpl = str_replace("%banners%", "", $tpl);
}
if (!$banID) {
$tpl = str_replace("%banID%", "", $tpl);
$tpl = str_replace("%param%", "", $tpl);
$tpl = str_replace("%url%", "", $tpl);
$tpl = str_replace("%link%", "", $tpl);
$tpl = str_replace("%text%", "", $tpl);
$tpl = str_replace("%isactive%", "", $tpl);
}
return $tpl;
}
示例5: prepareVar
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;
}
示例6: getContent
function getContent($qID = 0)
{
global $templatesMgr;
$tpl = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/vote.html");
$votes = $this->getVotesList();
if (count($votes)) {
$voteContent = "";
foreach ($votes as $vote) {
$voteContent .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $vote['qID'] . "</td>\n\t\t\t\t\t\t<td>" . $vote['Question'] . "</td>\n\t\t\t\t\t\t<td>" . $vote['Ans1'] . "<br>" . $vote['Ans2'] . "<br>" . $vote['Ans2'] . "<br>" . $vote['Ans3'] . "<br>" . $vote['Ans4'] . "<br>" . $vote['Ans5'] . "<br>" . $vote['Ans6'] . "<br>" . $vote['Ans7'] . "<br>" . $vote['Ans8'] . "<br>" . $vote['Ans9'] . "<br>" . $vote['Ans10'] . "</td>\n\t\t\t\t\t\t<td> " . $vote['isactive'] . "</td>\n\t\t\t\t\t\t<td> " . $vote['isdefault'] . "</td>\n\t\t\t\t\t\t<td><a href=\"/admin?cmd=vote&qID=" . $vote['qID'] . "\">–едактировать</a></td>\n\t\t\t\t\t\t<td><a href=\"/admin?cmd=vote&act=delete&qID=" . $vote['qID'] . "\">”далить</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t";
if ($qID == $vote['qID']) {
$tpl = str_replace("%qID%", $vote['qID'], $tpl);
$tpl = str_replace("%Question%", $vote['Question'], $tpl);
$tpl = str_replace("%Ans1%", $vote['Ans1'], $tpl);
$tpl = str_replace("%Ans2%", $vote['Ans2'], $tpl);
$tpl = str_replace("%Ans3%", $vote['Ans3'], $tpl);
$tpl = str_replace("%Ans4%", $vote['Ans4'], $tpl);
$tpl = str_replace("%Ans5%", $vote['Ans5'], $tpl);
$tpl = str_replace("%Ans6%", $vote['Ans6'], $tpl);
$tpl = str_replace("%Ans7%", $vote['Ans7'], $tpl);
$tpl = str_replace("%Ans8%", $vote['Ans8'], $tpl);
$tpl = str_replace("%Ans9%", $vote['Ans9'], $tpl);
$tpl = str_replace("%Ans10%", $vote['Ans10'], $tpl);
$tpl = str_replace("%isactive%", $vote['isactive'] == 1 ? "checked" : "", $tpl);
$tpl = str_replace("%isdefault%", $vote['isdefault'] == 1 ? "checked" : "", $tpl);
}
}
$tpl = str_replace("%votes%", $voteContent, $tpl);
} else {
$tpl = str_replace("%votes%", "", $tpl);
}
if (!$qID) {
$tpl = str_replace("%qID%", "", $tpl);
$tpl = str_replace("%Question%", "", $tpl);
$tpl = str_replace("%Ans1%", "", $tpl);
$tpl = str_replace("%Ans2%", "", $tpl);
$tpl = str_replace("%Ans3%", "", $tpl);
$tpl = str_replace("%Ans4%", "", $tpl);
$tpl = str_replace("%Ans5%", "", $tpl);
$tpl = str_replace("%Ans6%", "", $tpl);
$tpl = str_replace("%Ans7%", "", $tpl);
$tpl = str_replace("%Ans8%", "", $tpl);
$tpl = str_replace("%Ans9%", "", $tpl);
$tpl = str_replace("%Ans10%", "", $tpl);
$tpl = str_replace("%isactive%", "", $tpl);
$tpl = str_replace("%isdefault%", "", $tpl);
}
return $tpl;
}
示例7: getMenu
function getMenu($args)
{
global $structureMgr, $templatesMgr, $_defTemplate;
$pageID = $args[0];
$containerID = $args["id"];
if (!isset($args["DEPTH"])) {
$level = 9999;
} else {
$level = $args["DEPTH"];
if ($level < 0) {
$level = 9999;
}
}
if (!isset($args["EXPANDED"])) {
$expanded = false;
} else {
$expanded = $args["EXPANDED"];
}
if (!isset($args["TEMPLATE"])) {
trigger_error("template filename must be specified for menu [{$containerID}]", PM_FATAL);
}
$xmlTemplate = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/" . $args["TEMPLATE"]);
//print $xmlTemplate;
$template = $this->parseXMLTemplate(&$xmlTemplate);
//print "----------------------------\n";
//print_r( $template );
if (!isset($args["ROOTID"])) {
$rootID = $structureMgr->getRootPageID();
} else {
$rootID = $args["ROOTID"];
switch ($rootID) {
case "current":
$rootID = $pageID;
break;
case "parent":
$rootID = $structureMgr->getParentPageID($pageID);
break;
}
}
$path = $structureMgr->getPathByPageID($rootID, false);
$menuStructure = $structureMgr->getStructureForPageID($rootID, $level);
$menu = $this->getMenuLevel(&$menuStructure, $pageID, $path, 1, $level, $expanded, &$template);
return $menu;
}
示例8: loadModule
function loadModule($moduleName)
{
if (isset($this->_modules[$moduleName])) {
if ($this->_modules[$moduleName]["loaded"] == 0) {
require_once GetCfg("ModulesPath") . "/" . $this->_modules[$moduleName]["fileName"];
if (class_exists($moduleName)) {
$mod = new $moduleName();
if ($mod) {
$this->_modules[$moduleName]["mod"] = $mod;
} else {
trigger_error("Couldn`t create an instance of [{$moduleName}] class.", PM_FATAL);
}
} else {
trigger_error("Module " . $this->_modules[$moduleName]["fileName"] . " doesn`t contain a definition of [{$moduleName}] class.", PM_FATAL);
}
$this->_modules[$moduleName]["loaded"] = 1;
} else {
trigger_error("Trying to load already loaded module [{$moduleName}].", PM_WARNING);
}
} else {
trigger_error("Module [{$moduleName}] not found.", PM_FATAL);
}
}
示例9: admMenu
function admMenu($cmd)
{
global $templatesMgr;
$items = array('' => 'Структура', 'cards' => 'Клубные карты', 'users' => 'Пользователи', 'modparams' => 'Настройки модулей', 'banner' => 'Баннеры', 'vote' => 'Голосования', 'mails' => 'Отправить почту');
$b = $templatesMgr->getValidTags($templatesMgr->getTemplate(-1, GetCfg('TemplatesPath') . '/admin/adm_menu.xml'), array('container', 'separator', 'item', 'activeitem'));
$amItems = '';
foreach ($items as $_cmd => $menu) {
if ($_cmd == $cmd) {
$ln = $b['activeitem'];
} else {
$ln = $b['item'];
}
if (!$_cmd) {
$lnk = '/admin/';
} else {
$lnk = '/admin/?cmd=' . $_cmd;
}
$ln = str_replace('%text%', $menu, $ln);
$ln = str_replace('%link%', $lnk, $ln);
if ($amItems) {
$amItems .= $b['separator'];
}
$amItems .= $ln;
}
$t = $b['container'];
$t = str_replace('%items%', $amItems, $t);
return $t;
}
示例10: loadModule
/**
* Подключает код модуля $modulName и создает его экземляр
*
* @param string $moduleName
*/
function loadModule($moduleName)
{
// Если модуль зарегистрирован
if (isset($this->_modules[$moduleName])) {
// Если модуль не загружен
if ($this->_modules[$moduleName]['loaded'] == 0) {
// подключить к сценарию код модуля
require_once GetCfg('ModulesPath') . '/' . $this->_modules[$moduleName]['fileName'];
// Если экземпляр модуля не создан
if (class_exists($moduleName)) {
// создать экземпляр
$mod = new $moduleName();
if ($mod) {
$this->_modules[$moduleName]['mod'] = $mod;
} else {
trigger_error("Couldn`t create an instance of [{$moduleName}] class.", PM_FATAL);
}
} else {
trigger_error("Module " . $this->_modules[$moduleName]["fileName"] . " doesn`t contain a definition of [{$moduleName}] class.", PM_FATAL);
}
// Пометить, что модуль подключен и создан его экземпляр
$this->_modules[$moduleName]['loaded'] = 1;
} else {
trigger_error("Trying to load already loaded module [{$moduleName}].", PM_WARNING);
}
} else {
trigger_error("Module [{$moduleName}] not found.", PM_FATAL);
}
}
示例11: getFilledItemDescriptionTemplate
function getFilledItemDescriptionTemplate($catItem)
{
global $structureMgr, $templatesMgr;
if (count($catItem) == 0) {
trigger_error("Invaid function call - arguments array is empty.", PM_FATAL);
}
$tplName = GetCfg("TemplatesPath") . "/Catalogue/" . $catItem["DescriptionTemplate"];
$tpl = $templatesMgr->getTemplate(-1, $tplName);
$blocks = $templatesMgr->getValidTags($tpl, array("container", "picture", "description", "spec", "details", "zoom"));
//SPECIFICATIONS
$spec = "";
$specs = array("Compatibility" => "Марка", "accPlantName" => "Производитель");
$count = 0;
foreach ($specs as $key => $val) {
if (isset($catItem[$key]) && $catItem[$key]) {
$style = $count > 0 ? "mid" : "up";
$sp = $blocks["spec"];
$sp = str_replace("%style%", $style, $sp);
$sp = str_replace("%spec_name%", $val, $sp);
$sp = str_replace("%spec_value%", $catItem[$key], $sp);
$spec .= $sp;
$count++;
}
}
$props = $this->getCatItemProperties($catItem["sID"], "CatItem", $structureMgr->getParentPageID($catItem["sID"]));
$prop_list = "";
foreach ($props as $prop) {
if ($prop[3] && !$prop[4]) {
$style = $count > 0 ? "mid" : "up";
$sp = $blocks["spec"];
$sp = str_replace("%style%", $style, $sp);
$sp = str_replace("%spec_name%", $prop[1], $sp);
$sp = str_replace("%spec_value%", "{$prop['3']} {$prop['2']}", $sp);
$spec .= $sp;
$count++;
}
}
$bonusName = "";
$bonusValue = "";
$oldPriceStyle = "";
switch ($catItem["ptID"]) {
case 2:
$typeClass = "t_bonus";
$bonusName = "<strong>Спецпредложение (<a href=\"/main/club\">по карте</a>):</strong>";
$bonusValue = "<span class=\"t_bonus\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
case 3:
$typeClass = "t_bonus";
$bonusName = "<strong>Спецпредложение (<a href=\"/main/club\">по карте</a>):</strong>";
$bonusValue = "<span class=\"t_bonus\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
case 4:
$typeClass = "t_bonus";
$bonusName = "<strong>Спецпредложение (<a href=\"/main/club\">по карте</a>):</strong>";
$bonusValue = "<span class=\"t_bonus\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
case 5:
$typeClass = "t_salepr";
$oldPriceStyle = "<span class=\"t_old\">";
$bonusName = "<strong>Распродажа:</strong>";
$bonusValue = "<span class=\"t_sale\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
case 6:
$typeClass = "t_salepr";
$oldPriceStyle = "<span class=\"t_old\">";
$bonusName = "<strong>Распродажа:</strong>";
$bonusValue = "<span class=\"t_sale\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
case 7:
$typeClass = "t_salepr";
$oldPriceStyle = "<span class=\"t_old\">";
$bonusName = "<strong>Распродажа:</strong>";
$bonusValue = "<span class=\"t_sale\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
}
//$tpl = str_replace("%bonus%", $bonus, $tpl);
if ($bonusName && $bonusValue) {
$style = $count > 0 ? "mid" : "up";
$sp = $blocks["spec"];
$sp = str_replace("%style%", $style, $sp);
$sp = str_replace("%spec_name%", $bonusName, $sp);
$sp = str_replace("%spec_value%", "- " . $bonusValue, $sp);
$spec .= $sp;
$count++;
}
//DETAILS
$details = $structureMgr->getData($catItem["sID"]);
if ($details) {
$blocks["details"] = str_replace("%content%", $details, $blocks["details"]);
} else {
$blocks["details"] = "";
}
//ZOOM
//echo GetCfg("ROOT") . $catItem["PicturePath"] . "/" . $catItem["sID"] . "_3.jpg";
if (file_exists(GetCfg("ROOT") . $catItem["PicturePath"] . "/" . $catItem["sID"] . "_3.jpg")) {
//$catItem["bigPicture"] = $catItem["PicturePath"] . "/" . $catItem["sID"] . "_3.jpg";
$catItem["bigPicture"] = "/pic.php?sID=" . $catItem["sID"];
} else {
$catItem["bigPicture"] = "";
}
//.........这里部分代码省略.........
示例12: getFilledItemDescriptionTemplate
function getFilledItemDescriptionTemplate(&$catItem)
{
global $structureMgr, $templatesMgr;
if (count($catItem) == 0) {
trigger_error("Invaid function call - arguments array is empty.", PM_FATAL);
}
$tplName = GetCfg("TemplatesPath") . "/Catalogue/" . $catItem["DescriptionTemplate"];
$tpl = $templatesMgr->getTemplate(-1, $tplName);
$blocks = $templatesMgr->getValidTags($tpl, array("container", "picture", "description", "spec", "details", "zoom"));
//SPECIFICATIONS
$spec = "";
$specs = array("Compatibility" => "Марка", "accPlantName" => "Производитель");
$count = 0;
foreach ($specs as $key => $val) {
if (isset($catItem[$key]) && $catItem[$key]) {
$style = $count > 0 ? "mid" : "up";
$sp = $blocks["spec"];
$sp = str_replace("%style%", $style, $sp);
$sp = str_replace("%spec_name%", $val, $sp);
$sp = str_replace("%spec_value%", $catItem[$key], $sp);
$spec .= $sp;
$count++;
}
}
$props = $this->getCatItemProperties($catItem["sID"], "CatItem", $structureMgr->getParentPageID($catItem["sID"]));
$prop_list = "";
foreach ($props as $prop) {
if ($prop[3] && !$prop[4]) {
$style = $count > 0 ? "mid" : "up";
$sp = $blocks["spec"];
$sp = str_replace("%style%", $style, $sp);
$sp = str_replace("%spec_name%", $prop[1], $sp);
$sp = str_replace("%spec_value%", "{$prop['3']} {$prop['2']}", $sp);
$spec .= $sp;
$count++;
}
}
$bonusName = "";
$bonusValue = "";
$oldPriceStyle = "";
switch ($catItem["ptID"]) {
case 2:
$typeClass = "t_bonus";
$bonusName = "<strong>Спецпредложение (<a href=\"/main/club\">по карте</a>):</strong>";
$bonusValue = "<span class=\"t_bonus\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
case 3:
$typeClass = "t_bonus";
$bonusName = "<strong>Спецпредложение (<a href=\"/main/club\">по карте</a>):</strong>";
$bonusValue = "<span class=\"t_bonus\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
case 4:
$typeClass = "t_bonus";
$bonusName = "<strong>Спецпредложение (<a href=\"/main/club\">по карте</a>):</strong>";
$bonusValue = "<span class=\"t_bonus\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
case 5:
$typeClass = "t_salepr";
$oldPriceStyle = "<span class=\"t_old\">";
$bonusName = "<strong>Распродажа:</strong>";
$bonusValue = "<span class=\"t_sale\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
case 6:
$typeClass = "t_salepr";
$oldPriceStyle = "<span class=\"t_old\">";
$bonusName = "<strong>Распродажа:</strong>";
$bonusValue = "<span class=\"t_sale\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
case 7:
$typeClass = "t_salepr";
$oldPriceStyle = "<span class=\"t_old\">";
$bonusName = "<strong>Распродажа:</strong>";
$bonusValue = "<span class=\"t_sale\">" . $catItem["ptPercent"] . "% </span><br/> ";
break;
}
//$tpl = str_replace("%bonus%", $bonus, $tpl);
if ($bonusName && $bonusValue) {
$style = $count > 0 ? "mid" : "up";
$sp = $blocks["spec"];
$sp = str_replace("%style%", $style, $sp);
$sp = str_replace("%spec_name%", $bonusName, $sp);
$sp = str_replace("%spec_value%", "- " . $bonusValue, $sp);
$spec .= $sp;
$count++;
}
$sID = $catItem['sID'];
// ID товара в структуре
//DETAILS & COMMENTS
function pages($count, $per_page)
{
$out = 'Страницы';
$page = isset($_GET['compage']) && is_numeric($_GET['compage']) ? $_GET['compage'] : 1;
$pages = ceil($count / $per_page);
if ($page > $pages || $page < 1) {
$page = 1;
}
for ($i = 1; $i <= $pages; $i++) {
$out .= ' - ';
if ($i != $page) {
$out .= '<a href="?compage=' . $i . '">' . $i . '</a>';
//.........这里部分代码省略.........
示例13: processLoginRequest
function processLoginRequest()
{
global $templatesMgr;
print $templatesMgr->getFilledTemplate(-1, GetCfg('LoginTemplate'));
}
示例14: getItems
function getItems($startFrom, $endAt, $order)
{
$orderStr = " ORDER BY ";
if ($order == 'name') {
$orderStr .= "ShortTitle";
} elseif ($order == 'price') {
$orderStr .= "salePrice";
} elseif ($order == 'pricedesc') {
$orderStr .= "salePrice desc";
} else {
$orderStr .= "ShortTitle";
}
$query = "SELECT SQL_CALC_FOUND_ROWS\n\t\t\t\t\taccID, p.sID, ShortTitle, deliveryCode, accPlantName, logotype, smallPicture, p.tplID, salePrice, \n\t\t\t\t\tMustUseCompatibility, PicturePath, DescriptionTemplate, ptPercent \n\t\t\t\t\tFROM `pm_as_parts` p\n\t\t\t\t\tLEFT JOIN pm_as_producer ap ON (ap.accPlantID = p.accPlantID)\n\t\t\t\t\tLEFT JOIN pm_structure s ON (p.sID = s.sID)\n\t\t\t\t\tLEFT JOIN pm_as_categories ac ON (s.pms_sID = ac.sID)\n\t\t\t\t\tLEFT JOIN pm_as_pricetypes pt ON (pt.ptID = p.ptID)\n\t\t\t\t\tWHERE pt.ptID = 5 || pt.ptID = 6 || pt.ptID = 7\n\t\t\t\t\t" . $orderStr . "\n\t\t\t\t\tLIMIT " . $startFrom . "," . GetCfg("Sale.itemsPerPage") . "\n\t\t\t\t";
$result = mysql_query($query);
if (!$result) {
trigger_error("Invaid query. " . mysql_error(), PM_FATAL);
}
if (mysql_num_rows($result) == 0) {
trigger_error("Empty result for {$query}", PM_WARNING);
}
$query = "SELECT FOUND_ROWS() as itemsCount";
$res = mysql_query($query);
$row = mysql_fetch_assoc($res);
$this->itemsCount = $row['itemsCount'];
$catItems = array();
while ($item = mysql_fetch_assoc($result)) {
if ($item["MustUseCompatibility"]) {
$item["Compatibility"] = "";
$query2 = "SELECT atc.carID, carModel, carName FROM pm_as_acc_to_cars atc LEFT JOIN pm_as_cars c ON (c.carID = atc.carID) \n\t\t\t\t\tWHERE accID=" . $item["accID"];
$result2 = mysql_query($query2);
if (!$result2) {
trigger_error("Error retrieving car model links [{$query2}] - " . mysql_error(), PM_FATAL);
}
while (false !== (list($carID, $carModel, $carName) = mysql_fetch_row($result2))) {
if ($item["Compatibility"]) {
$item["Compatibility"] .= ", ";
}
$item["Compatibility"] .= "{$carModel}";
if ($carName) {
$item["Compatibility"] .= " {$carName}";
}
}
}
$catItems[] = $item;
}
return $catItems;
}
示例15: getItems
function getItems($startFrom, $endAt, $order)
{
$orderStr = ' ORDER BY ';
if ($order == 'name') {
$orderStr .= 'ShortTitle';
} elseif ($order == 'price') {
$orderStr .= 'salePrice';
} elseif ($order == 'pricedesc') {
$orderStr .= 'salePrice desc';
} else {
$orderStr .= 'ShortTitle';
}
$query = 'SELECT SQL_CALC_FOUND_ROWS
accID, p.sID, ShortTitle, deliveryCode, accPlantName, logotype, smallPicture, p.tplID, salePrice,
MustUseCompatibility, PicturePath, DescriptionTemplate, ptPercent
FROM `pm_as_parts` p
LEFT JOIN pm_as_producer ap ON (ap.accPlantID = p.accPlantID)
LEFT JOIN pm_structure s ON (p.sID = s.sID)
LEFT JOIN pm_as_categories ac ON (s.pms_sID = ac.sID)
LEFT JOIN pm_as_pricetypes pt ON (pt.ptID = p.ptID)
WHERE pt.ptID = 2 || pt.ptID = 3 || pt.ptID = 4
' . $orderStr . '
LIMIT ' . $startFrom . ',' . GetCfg('Bonus.itemsPerPage');
$result = mysql_query($query);
if (!$result) {
trigger_error('Invaid query. ' . mysql_error(), PM_FATAL);
}
if (mysql_num_rows($result) == 0) {
trigger_error('Empty result', PM_WARNING);
}
$query = 'SELECT FOUND_ROWS() as itemsCount';
$res = mysql_query($query);
$row = mysql_fetch_assoc($res);
$this->itemsCount = $row['itemsCount'];
$catItems = array();
while ($item = mysql_fetch_assoc($result)) {
if ($item['MustUseCompatibility']) {
$item['Compatibility'] = '';
$query2 = 'SELECT atc.carID, carModel, carName
FROM pm_as_acc_to_cars atc
LEFT JOIN pm_as_cars c ON (c.carID = atc.carID)
WHERE accID=' . $item['accID'];
$result2 = mysql_query($query2);
if (!$result2) {
trigger_error('Error retrieving car model links' . mysql_error(), PM_FATAL);
}
while (false !== (list($carID, $carModel, $carName) = mysql_fetch_row($result2))) {
if ($item['Compatibility']) {
$item['Compatibility'] .= ', ';
}
$item['Compatibility'] .= ' ' . $carModel;
if ($carName) {
$item['Compatibility'] .= ' ' . $carName;
}
}
}
$catItems[] = $item;
}
return $catItems;
}