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"; }
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; }
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; }
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; }
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; }
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; }
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; }
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); } }
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; }
/** * Подключает код модуля $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); } }
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"] = ""; } if ($catItem["bigPicture"]) { $zoom = str_replace("%link%", $catItem["bigPicture"], $blocks["zoom"]); } else { $zoom = ""; } if (file_exists(GetCfg("ROOT") . $catItem["PicturePath"] . "/" . $catItem["sID"] . "_2.jpg")) { $catItem["stdPicture"] = $catItem["PicturePath"] . "/" . $catItem["sID"] . "_2.jpg"; } else { if (!isset($catItem["stdPicture"]) || !$catItem["stdPicture"]) { $bigLogo = str_replace(".gif", "_2.gif", $catItem["logotype"]); if ($catItem["logotype"] != NULL && file_exists(GetCfg("ROOT") . $bigLogo)) { $catItem["stdPicture"] = $bigLogo; } else { $catItem["stdPicture"] = "/products/empty_2.gif"; } } } if ($zoom) { $blocks["picture"] = str_replace("%aopen%", "<a style=\"cursor: pointer\" onClick=\"openPopupWindow('" . $catItem["bigPicture"] . "', 450, 450); return false;\">", $blocks["picture"]); $blocks["picture"] = str_replace("%aclose%", "</a>", $blocks["picture"]); } else { $blocks["picture"] = str_replace("%aopen%", "", $blocks["picture"]); $blocks["picture"] = str_replace("%aclose%", "", $blocks["picture"]); } /** * Добавление поля "РЕЙТИНГ" */ $sID = $catItem['sID']; $oResult = mysql_query("SELECT grade, count FROM pm_rating WHERE sID='{$sID}' LIMIT 1"); $fRating = 0; if ($oResult && mysql_num_rows($oResult)) { $oRating = mysql_fetch_object($oResult); $fRating = $oRating->grade / $oRating->count; } $fRating = number_format($fRating, 1, '.', ''); $htmlRating = '<span class="red" id="ratingStat">' . $fRating . '</span> - Рейтинг <select class="ratinglist" name="rating" id="ratingValue"> <option value="0" selected="selected">Оцените 1 - 5</option> <option value="5">5 - Отлично</option> <option value="4">4 - Хорошо</option> <option value="3">3 - Средне</option> <option value="2">2 - Плохо</option> <option value="1">1 - Очень плохо</option> </select><input src="/images/butt_ok2.gif" type="image" id="ratingSend" /> <input type="hidden" name="ratingsID" id="ratingsID" value="' . $sID . '" /> <div id="ratingStatus" style="display:none; text-align:center;"></div>'; $blocks['picture'] = str_replace('%rating%', $htmlRating, $blocks['picture']); /** * Конец кода для поля "РЕЙТИНГ" */ /* !!!MAIN job here */ if ($catItem["ptPercent"] == 0 && $catItem["ptID"] != 8) { $firstPrice = "<strong>" . round($catItem["salePrice"] - $catItem["salePrice"] * 5 / 100) . "</strong>" . " / "; } else { if ($catItem["ptID"] != 8) { $firstPrice = "<strong><span class=\"" . $typeClass . "\">" . round($catItem["salePrice"] - $catItem["salePrice"] * $catItem["ptPercent"] / 100) . "</span></strong>" . " / "; } } //$tpl = str_replace("%price%", "$firstPrice" . " / " . $catItem["salePrice"] . " руб.", $tpl); $tpl = str_replace("%price%", "{$firstPrice}" . $oldPriceStyle . $catItem["salePrice"] . ($oldPriceStyle ? "</span>" : "") . " руб.", $tpl); $blocks["description"] = str_replace("%price%", "{$firstPrice}" . $oldPriceStyle . $catItem["salePrice"] . ($oldPriceStyle ? "</span>" : ""), $blocks["description"]); //$blocks["description"] = str_replace("%bonus%", $bonus, $blocks["description"]); $blocks["description"] = str_replace("%spec%", $spec, $blocks["description"]); $blocks["description"] = str_replace("%details%", $blocks["details"], $blocks["description"]); $blocks["description"] = str_replace("%goodID%", $catItem["accID"], $blocks["description"]); $blocks["picture"] = str_replace("%zoom%", $zoom, $blocks["picture"]); $blocks["picture"] = str_replace("%image%", $catItem["stdPicture"], $blocks["picture"]); $blocks["picture"] = str_replace("%good_name%", $catItem["ShortTitle"], $blocks["picture"]); $blocks["container"] = str_replace("%picture%", $blocks["picture"], $blocks["container"]); $blocks["container"] = str_replace("%description%", $blocks["description"], $blocks["container"]); return $blocks["container"]; }
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>'; } else { $out .= $i; } } return $out; } $iCountComments = 0; $oResult = mysql_query("SELECT COUNT(cID) FROM pm_comments WHERE sID = '{$sID}' AND public = '1'"); if ($oResult && mysql_num_rows($oResult)) { list($iCountComments) = mysql_fetch_array($oResult); } $blocks['details'] = str_replace('{com_count}', $iCountComments, $blocks['details']); $page = isset($_GET['compage']) && is_numeric($_GET['compage']) ? $_GET['compage'] : 1; $com_num = 15; $pages = ceil($iCountComments / $com_num); if ($page > $pages || $page < 1) { $page = 1; } $com_from = ($page - 1) * $com_num; // получить комментарии страницы $oResult = mysql_query("SELECT * FROM pm_comments WHERE sID = '{$sID}' AND public='1' ORDER BY date ASC LIMIT {$com_from}, {$com_num}"); $aComments = array(); $htmlComments = ''; if ($pages > 1) { $htmlComments .= '<div class="comment">' . pages($iCountComments, $com_num) . '</div>'; } // составить html-код списка комментариев if ($oResult && mysql_num_rows($oResult)) { while ($v = mysql_fetch_assoc($oResult)) { $htmlComments .= '<div class="comment">' . date('d-m-Y', $v['date']) . ' | <strong>'; if ($v['email']) { $htmlComments .= '<a href="mailto:' . $v['email'] . '">' . strip_tags($v['name']) . '</a>'; } else { $htmlComments .= strip_tags($v['name']); } $htmlComments .= '</strong><br />'; $htmlComments .= nl2br($v['comment']); $htmlComments .= '</div>'; } } else { $htmlComments .= '<div class="comment">Здесь пока никто не оставил комментариев.</div>'; } // Защитный код $sCode = '0000' . rand(0, 9999); $sCode = substr($sCode, strlen($sCode) - 4, 4); mysql_query("INSERT INTO pm_comments_codes (id, date, code) VALUES ('', " . time() . ", '{$sCode}')"); $iCode = mysql_insert_id(); if (empty($iCode)) { die('bad arguments'); } mysql_query("DELETE FROM pm_comments_codes WHERE date < '" . (time() - 600) . "'"); $tplComments = file_get_contents('_pm/templates/Catalogue/comment.html'); $tplComments = str_replace('{comments}', $htmlComments, $tplComments); $tplComments = str_replace('{code}', $iCode, $tplComments); $tplComments = str_replace('{sID}', $sID, $tplComments); $tplComments = str_replace('{name}', $_POST['comment']['Name'], $tplComments); $tplComments = str_replace('{email}', $_POST['comment']['Email'], $tplComments); $tplComments = str_replace('{text}', $_POST['comment']['Text'], $tplComments); if (isset($_POST['comment']['Error']) && $_POST['comment']['Error']) { $sError = '<div style="padding:5px; margin:5px; text-align:center; border:1px solid red;">' . $_POST['comment']['Error'] . '</div>'; $tplComments = str_replace('{error}', $sError, $tplComments); } else { $tplComments = str_replace('{error}', '', $tplComments); } $blocks['details'] = str_replace('{com_content}', $tplComments, $blocks['details']); $blocks['details'] = str_replace('{id}', $sID, $blocks['details']); $details = $structureMgr->getData($catItem["sID"]); if ($details) { $blocks['details'] = str_replace('{content}', $details, $blocks['details']); if (isset($_POST['comment']['sID'])) { $blocks['details'] = str_replace('{detals_none}', 2, $blocks['details']); } else { $blocks['details'] = str_replace('{detals_none}', 0, $blocks['details']); } } else { $blocks['details'] = str_replace('{content}', '', $blocks['details']); $blocks['details'] = str_replace('{detals_none}', 1, $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"] = ""; } if ($catItem["bigPicture"]) { $zoom = str_replace("%link%", $catItem["bigPicture"], $blocks["zoom"]); } else { $zoom = ""; } if (file_exists(GetCfg("ROOT") . $catItem["PicturePath"] . "/" . $catItem["sID"] . "_2.jpg")) { $catItem["stdPicture"] = $catItem["PicturePath"] . "/" . $catItem["sID"] . "_2.jpg"; } else { if (!isset($catItem["stdPicture"]) || !$catItem["stdPicture"]) { $bigLogo = str_replace(".gif", "_2.gif", $catItem["logotype"]); if ($catItem["logotype"] != NULL && file_exists(GetCfg("ROOT") . $bigLogo)) { $catItem["stdPicture"] = $bigLogo; } else { $catItem["stdPicture"] = "/products/empty_2.gif"; } } } if ($zoom) { $blocks["picture"] = str_replace("%aopen%", "<a style=\"cursor: pointer\" onClick=\"openPopupWindow('" . $catItem["bigPicture"] . "', 450, 450); return false;\">", $blocks["picture"]); $blocks["picture"] = str_replace("%aclose%", "</a>", $blocks["picture"]); } else { $blocks["picture"] = str_replace("%aopen%", "", $blocks["picture"]); $blocks["picture"] = str_replace("%aclose%", "", $blocks["picture"]); } /** * Добавление поля "РЕЙТИНГ" */ $aRatingTypes = array(0 => 'Общий рейтинг', 1 => 'Функции', 2 => 'Цена', 3 => 'Качество'); $aRating = array(0, 0, 0, 0); $oResult = mysql_query("SELECT type, grade, count FROM pm_rating WHERE sID='{$sID}' LIMIT 3"); $iRatingGrage = 0; $iRatingCount = 0; if ($oResult && mysql_num_rows($oResult) == 3) { while ($oRating = mysql_fetch_assoc($oResult)) { $aRating[$oRating['type']] = $oRating['grade'] / $oRating['count']; $iRatingCount = $oRating['count']; } } $aRating[0] = ($aRating[1] + $aRating[2] + $aRating[3]) / 3; for ($i = 0; $i <= 3; $i++) { $aRating[$i] = number_format($aRating[$i], 1, '.', ''); } function rating($r, $name) { list($r1, $r2) = explode('.', $r); $content = ''; $count = 5; if ($r2 >= 8) { $r1++; $r2 = 0; } elseif ($r2 < 3) { $r2 = 0; } else { $r2 = 1; } for ($i = 1; $i <= $r1; $i++) { $content .= '<img src="/images/star/' . $name . '.gif" alt="" />'; $count--; } if ($r2) { $content .= '<img src="/images/star/' . $name . '_half.gif" alt="" />'; $count--; } while ($count) { $content .= '<img src="/images/star/' . $name . '_empty.gif" alt="" />'; $count--; } return $content; } $htmlRating = ''; $htmlRating .= '<div class="rating"><div class="red">' . $aRating[0] . '</div><div class="text">' . $aRatingTypes[0] . '</div><div class="stars">' . rating($aRating[0], 'green') . '</div></div>'; for ($i = 1; $i <= 3; $i++) { $htmlRating .= '<div class="rating1"><div class="black">' . $aRating[$i] . '</div><div class="text">' . $aRatingTypes[$i] . '</div><div class="stars">' . rating($aRating[$i], 'black') . '</div></div>'; } $htmlRating .= '<div class="separate">'; $htmlRating .= '<img src="/images/podrobnee_ocenit.gif" id="ratingBtn" alt="Оценить" />' . '<div id="ratingStatus">Товар оценили (' . $iRatingCount . ')</div></div>' . '<input type="hidden" name="ratingsID" id="ratingsID" value="' . $sID . '" />'; $blocks['picture'] = str_replace('%rating%', $htmlRating, $blocks['picture']); /** * Конец кода для поля "РЕЙТИНГ" */ /* !!!MAIN job here */ if ($catItem["ptPercent"] == 0 && $catItem["ptID"] != 8) { $firstPrice = "<strong>" . round($catItem["salePrice"] - $catItem["salePrice"] * 5 / 100) . "</strong>" . " / "; } else { if ($catItem["ptID"] != 8) { $firstPrice = "<strong><span class=\"" . $typeClass . "\">" . round($catItem["salePrice"] - $catItem["salePrice"] * $catItem["ptPercent"] / 100) . "</span></strong>" . " / "; } } //$tpl = str_replace("%price%", "$firstPrice" . " / " . $catItem["salePrice"] . " руб.", $tpl); $tpl = str_replace("%price%", "{$firstPrice}" . $oldPriceStyle . $catItem["salePrice"] . ($oldPriceStyle ? "</span>" : "") . " руб.", $tpl); $blocks["description"] = str_replace("%price%", "{$firstPrice}" . $oldPriceStyle . $catItem["salePrice"] . ($oldPriceStyle ? "</span>" : ""), $blocks["description"]); //$blocks["description"] = str_replace("%bonus%", $bonus, $blocks["description"]); $blocks["description"] = str_replace("%spec%", $spec, $blocks["description"]); $blocks["description"] = str_replace("%details%", $blocks["details"], $blocks["description"]); $blocks["description"] = str_replace("%goodID%", $catItem["accID"], $blocks["description"]); $blocks["picture"] = str_replace("%zoom%", $zoom, $blocks["picture"]); $blocks["picture"] = str_replace("%image%", $catItem["stdPicture"], $blocks["picture"]); $blocks["picture"] = str_replace("%good_name%", $catItem["ShortTitle"], $blocks["picture"]); $blocks["container"] = str_replace("%picture%", $blocks["picture"], $blocks["container"]); $blocks["container"] = str_replace("%description%", $blocks["description"], $blocks["container"]); return $blocks["container"]; }
function processLoginRequest() { global $templatesMgr; print $templatesMgr->getFilledTemplate(-1, GetCfg('LoginTemplate')); }
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; }
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; }
function CacheManager() { $this->dblink = GetCfg("dblink"); }
function getVoteResults($startFrom, $endAt) { $voteResults = array(); $query = "SELECT SQL_CALC_FOUND_ROWS\n\t\t\t\t\t\tqID, sID, Question, Ans1, Ans2, Ans3,\n\t\t\t\t\t\tAns4, Ans5, Ans6, Ans7, Ans8, Ans9, Ans10\n\t\t\t\t\t\tFROM pm_vote\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tisActive = 1\n\t\t\t\t\t\tLIMIT " . $startFrom . "," . GetCfg("Vote.itemsPerPage") . "\n\t\t\t\t\t"; $result = mysql_query($query); $query = "SELECT FOUND_ROWS() as itemsCount"; $res = mysql_query($query); $row = mysql_fetch_assoc($res); $this->itemsCount = $row['itemsCount']; if (mysql_num_rows($result)) { $j = 0; while ($vote = mysql_fetch_assoc($result)) { for ($i = 1; $i < 11; $i++) { if ($vote["Ans{$i}"]) { $qAns = "SELECT qID FROM pm_vote_results WHERE qID = '" . $vote['qID'] . "' && aID = '" . $i . "'"; $rAns = mysql_query($qAns); $voteResults[$j]['answers'][$vote["Ans{$i}"]] = mysql_num_rows($rAns); } } $voteResults[$j]['question'] = $vote['Question']; $voteResults[$j]['qID'] = $vote['qID']; $voteResults[$j]['sID'] = $vote['sID']; $j++; } } return $voteResults; }
function getContent($args) { global $structureMgr, $templatesMgr, $authenticationMgr; $userId = $authenticationMgr->getUserID(); $userData = $authenticationMgr->getUserData($userId, ''); $userName = $userData['FirstName'] . " " . $userData['LastName']; $this->setItemData('userData', $userData); $this->setItemData('userName', $userName); $blocks = $templatesMgr->getValidTags($templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/Cart/cart.xml"), array("container", "goods", "cart", "emptycart", "order", "quickorder", "login", "comment")); $sessionID = $authenticationMgr->getSessionID(); $tpl = $blocks["container"]; $goodsline = $blocks["goods"]; $qr = mysql_query("SELECT p.sID, p.accID, p.ptID, ShortTitle, salePrice, accCount, ptPercent, p.accPlantID, logotype, p.smallPicture, s.MetaDesc, s.pms_sID, pc.PicturePath FROM pm_as_parts p \n LEFT JOIN pm_structure s ON (p.sID = s.sID) \n\t\t\t\t\t\t\t LEFT JOIN pm_as_producer ap ON (ap.accPlantID = p.accPlantID)\n LEFT JOIN pm_as_cart c ON (c.accID = p.accID)\n LEFT JOIN pm_as_pricetypes pt ON (pt.ptID = p.ptID)\n LEFT JOIN pm_as_categories pc ON (s.pms_sID = pc.sID)\n WHERE c.sessionID='{$sessionID}'"); if (!$qr) { trigger_error("Error getting cart items - \n" . mysql_error(), PM_FATAL); } $goodsCount = mysql_num_rows($qr); $goods = ""; $cardSum = 0; $curSum = 0; $sum = 0; $total = 0; if (mysql_num_rows($qr) > 0) { $cat = new Catalogue(); //goods list from $qr $goodsArray = array(); while (false !== ($r = mysql_fetch_assoc($qr))) { /* if ($catItem["ptPercent"] == 0) $firstPrice = "<strong>" . round($catItem["salePrice"] - ($catItem["salePrice"] * 5 / 100)) . "</strong>"; else $firstPrice = "<strong><font class=\"".$typeClass."\">" . round($catItem["salePrice"] - ($catItem["salePrice"] * $catItem["ptPercent"] / 100)) . "</font></strong>"; */ $gl = $goodsline; $URL = $structureMgr->getPathByPageID($r['sID'], false); $isCardInCart = Cart::isItemInCart(GetCfg('Club.GoodID')); $isClubMember = isset($userData['cardID']) && $userData['cardID'] != '0' || $isCardInCart; switch ($r['ptID']) { case 1: if ($userData['cardID'] || $isCardInCart) { $curPrice = round($r["salePrice"] - $r["salePrice"] * 5 / 100); } else { $curPrice = $r['salePrice']; } $cardPrice = round($r["salePrice"] - $r["salePrice"] * 5 / 100); break; case 2: if ($userData['cardID'] || $isCardInCart) { $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); } else { $curPrice = $r['salePrice']; } $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; case 3: if ($userData['cardID'] || $isCardInCart) { $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); } else { $curPrice = $r['salePrice']; } $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; case 4: if ($userData['cardID'] || $isCardInCart) { $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); } else { $curPrice = $r['salePrice']; } $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; case 5: $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; case 6: $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; case 7: $curPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); $cardPrice = round($r["salePrice"] - $r["salePrice"] * $r["ptPercent"] / 100); break; default: $curPrice = $r['salePrice']; $cardPrice = $r['salePrice']; break; } $curPrice *= $r["accCount"]; $cardPrice *= $r["accCount"]; $price = $r['salePrice'] * $r["accCount"]; //must calc as needed $priceCells = '<td class="gray"><p> <a href="%good_link%" class="bluem" target="_blank">%good_name%</a></p></td> <td><strong>%card_price%</strong></td> <td>%cur_price%</td>'; if ($isClubMember) { $priceCells = '<td>%cur_price%</td>'; } $gl = str_replace("%good_name%", $r['ShortTitle'], $gl); $gl = str_replace("%good_link%", $URL, $gl); $gl = str_replace("%card_price%", $cardPrice . " * " . $r["accCount"], $gl); $gl = str_replace("%cur_price%", $curPrice . " * " . $r["accCount"], $gl); $gl = str_replace("%price%", $price . " * " . $r["accCount"], $gl); $gl = str_replace("%good_count%", $r['accCount'], $gl); $gl = str_replace("%goodID%", $r['accID'], $gl); $cardSum += $cardPrice; $curSum += $curPrice; $sum += $price; $total += $r['accCount']; //echo "$curSum in Cart<br>"; if (file_exists(GetCfg("ROOT") . $r["PicturePath"] . "/" . $r["sID"] . ".gif")) { $r["smallPicture"] = $r["PicturePath"] . "/" . $r["sID"] . ".gif"; } else { if ($r["logotype"] == NULL) { $r["smallPicture"] = "/products/empty.gif"; } else { $r["smallPicture"] = $r["logotype"]; } } $good = new Good(array('goodID' => $r['sID'], 'good_name' => $r['ShortTitle'], 'PicturePath' => $r['PicturePath'], 'good_link' => $URL, 'card_price' => $cardPrice, 'smallPicture' => $r["smallPicture"], 'cur_price' => $curPrice, 'price' => $price, 'good_count' => $r['accCount'])); foreach ($r as $var => $val) { $good->setItemData($var, $val); } $good->setItemData('priceClass', $this->getPriceClass($r['ptID'])); $good->setItemData('ptID', $r['ptID']); $good->setItemData('ptPercent', $r['ptPercent']); $good->setItemData('props', $props = $cat->getCatItemProperties($r['sID'], "CatItem", $structureMgr->getParentPageID($r['sID']))); $this->goods[$r['sID']] = $good; $imgRes = mysql_query("SELECT accPlantName, logotype FROM pm_as_producer WHERE accPlantID = '{$r["accPlantID"]}'"); if (mysql_num_rows($imgRes) > 0) { $imgRow = mysql_fetch_assoc($imgRes); $this->goods[$r['sID']]->setItemData('accPlantName', $imgRow['accPlantName']); $this->goods[$r['sID']]->setItemData('logotype', $imgRow['logotype']); } $goods .= $gl; } $tcart = $blocks["cart"]; } else { $tcart = $blocks["emptycart"]; } if ($total > 0) { $order = $blocks["order"]; $qorder = $blocks["quickorder"]; if ($authenticationMgr->getUserID() == 1) { $blocks["login"] = str_replace("%currentpath%", getenv("REQUEST_URI"), $blocks["login"]); $order = str_replace("%right%", $blocks["login"], $order); $order = str_replace("%left%", $qorder, $order); } else { $order = str_replace("%right%", $blocks["comment"], $order); $order = str_replace("%left%", $qorder, $order); //echo $order; } } else { $order = ""; } $ret = ''; $isCardInCart = Cart::isItemInCart(GetCfg('Club.GoodID')); $isClubMember = isset($userData['cardID']) && $userData['cardID'] != '0' || $isCardInCart; $this->setItemData('isCardInCart', $isCardInCart); $this->setItemData('isClubMember', $isClubMember); $this->setItemData('userID', $userId); $this->userData = $userData; $carName = 'марка автомобиля не определена'; if ($userId > 1 && $isClubMember && $userData['carID'] != 0) { $carRow = mysql_fetch_assoc(mysql_query("SELECT * FROM pm_as_cars WHERE carID='{$userData['carID']}'")); $carName = "ВАЗ " . $carRow['carModel'] . (isset($carRow['carName']) && $carRow['carName'] != '' ? "({$carRow['carName']})" : ''); } $this->setItemData('carName', $carName); if ($userId == 1) { $ret .= '<p><strong>Внимание!:</strong></p> <p>Для вашего удобства мы предлагаем вам:</p> <p><a href="/registration" class="levm"><img src="/images/arr_gray2.gif" width="7" height="9" border="0" align="absmiddle"/>Зарегестрироваться</a><br/> <a href="/main/club" class="levm"><img src="/images/arr_gray2.gif" width="7" height="9" border="0" align="absmiddle"/>Стать членом клуба</a></p>'; } elseif ($userId > 1 && !$isClubMember) { $ret .= '<p><strong>Внимание:</strong></p> <p>Для вашего удобства мы предлагаем вам:</p> <a href="/main/club" class="levm"><img src="/images/arr_gray2.gif" width="7" height="9" border="0" align="absmiddle"/>Стать членом клуба</a></p>'; } elseif ($userId > 1 && $isClubMember) { $carName = 'марка автомобиля не определена'; if ($userData['carID'] != 0) { $carRow = mysql_fetch_assoc(mysql_query("SELECT * FROM pm_as_cars WHERE carID='{$userData['carID']}'")); $carName = "ВАЗ " . $carRow['carModel'] . (isset($carRow['carName']) && $carRow['carName'] != '' ? "({$carRow['carName']})" : ''); } $ret .= '<p><strong>Здравствуйте!</strong></p> <p>' . $userName . '</p> <p>№ Вашей карты: ' . ($userData['cardID'] == '0' ? 'Будет присвоен после оплаты.' : $userData['cardID']) . '</p> <p>' . $carName . '</p> <p> <a href="#" class="levm"><img src="/images/arr_gray2.gif" width="7" height="9" border="0" align="absmiddle"/>Изменить анкету </a> <a href="#" class="levm"><img src="/images/arr_gray2.gif" width="7" height="9" border="0" align="absmiddle"/>Выход (log out)</a></p> '; } $club = $ret; $this->setItemData('cart', $tcart); $this->setItemData('cardsum', $cardSum); $this->setItemData('cursum', $curSum); $this->setItemData('sum', $sum); $this->setItemData('total', $total); $this->setItemData('goods', $goods); $this->setItemData('order', $order); $this->setItemData('club', $club); $dost = new Template('blockdost', $this); $this->setItemData('blockdost', $dost->getContent()); if ($userId == 1) { $header = new Template('header', 'Быстрый заказ'); $of = new Template('orderQuick'); $orderForm = $header->getContent() . $of->getContent(); } else { $header = new Template('header', 'Контактная информация'); $of = new Template('orderUser', $this->getItemData('userData')); $orderForm = $header->getContent() . $of->getContent(); } $this->setItemData('orderForm', $orderForm); $cartTpl = new Template('cart', $this); $tpl = $cartTpl->getContent(); $msg = _get("msg"); if ($msg == 1) { $msg = '<div class="podbor">Заполните пожалуйства поле "Ваше имя"</div>'; } elseif ($msg == 2) { $msg = '<div class="podbor">Заполните пожалуйства поле "Ваше имя"</div>'; } return $msg . $tpl; }
function PermissionsManager() { $this->dblink = GetCfg("dblink"); }
function getItems($searchtext, $startFrom, $endAt, $searchType = 0, $order) { //echo $searchtext.'<br>'; $searchArray = explode(' ', $searchtext); //print_r($searchArray); $orderStr = ' ORDER BY '; if ($order == 'name') { $orderStr .= 's.ShortTitle'; } elseif ($order == 'price') { $orderStr .= 'salePrice'; } elseif ($order == 'pricedesc') { $orderStr .= 'salePrice desc'; } elseif ($order == 'rating') { $orderStr .= 'rating DESC, s.ShortTitle'; } else { $orderStr .= 's.ShortTitle'; } //$query = Array(); $whereText = ""; $whereArray = array(); $whereArray[] = "CONCAT(s.ShortTitle, ' ', s.Title, ' ', ap.accPlantName, ' ', prop.propValue) LIKE '%" . str_replace(' ', '%', $searchtext) . "%'\n"; $whereArray[] = "CONCAT(ap.accPlantName, ' ', s.ShortTitle, ' ', s.Title, ' ', prop.propValue) LIKE '%" . str_replace(' ', '%', $searchtext) . "%'\n"; $whereArray[] = "CONCAT(ap.accPlantName, ' ', prop.propValue, ' ', s.ShortTitle, ' ', s.Title) LIKE '%" . str_replace(' ', '%', $searchtext) . "%'\n"; $whereArray[] = "CONCAT(prop.propValue, ' ', ap.accPlantName, ' ', s.ShortTitle, ' ', s.Title) LIKE '%" . str_replace(' ', '%', $searchtext) . "%'\n"; $whereArray[] = "CONCAT(prop.propValue, ' ', s.ShortTitle, ' ', s.Title, ' ', ap.accPlantName) LIKE '%" . str_replace(' ', '%', $searchtext) . "%'\n"; $str .= implode(" || ", $whereArray); if ($str) { $whereText .= " && ( " . $str . " )\n"; } $query = "SELECT SQL_CALC_FOUND_ROWS\n\t\t\t\t\t\t\t\tCOUNT(p.accID) as numOfDoubles,\n\t\t\t\t\t\t\t\tp.accID, p.sID, s.ShortTitle, deliveryCode, accPlantName, logotype, smallPicture, p.tplID, salePrice,\n\t\t\t\t\t\t\t\tMustUseCompatibility, PicturePath, DescriptionTemplate, ptPercent, p.xit, p.new,\n\t\t\t\t\t\t\t\tCONCAT(s.ShortTitle, ' ', s.Title, ' ', ap.accPlantName, ' ', prop.propValue),\n\t\t\t\t\t\t\t\tCONCAT(ap.accPlantName, ' ', s.ShortTitle, ' ', s.Title, ' ', prop.propValue),\n\t\t\t\t\t\t\t\tCONCAT(prop.propValue, ' ', ap.accPlantName, ' ', s.ShortTitle, ' ', s.Title),\n\t\t\t\t\t\t\t\tCONCAT(prop.propValue, ' ', s.ShortTitle, ' ', s.Title, ' ', ap.accPlantName),\n \t\t\t\t\t (SELECT SUM( r.grade ) / r.count /3\n FROM pm_rating r\n WHERE r.sID = s.sID\n ) AS rating\n\t\t\t\t\t\t\t\tFROM `pm_as_parts` p\n\t\t\t\t\t\t\t\tLEFT JOIN pm_as_producer ap ON (ap.accPlantID = p.accPlantID)\n\t\t\t\t\t\t\t\tLEFT JOIN pm_structure s ON (p.sID = s.sID && s.isHidden = 0)\n\t\t\t\t\t\t\t\tLEFT JOIN pm_as_categories ac ON (s.pms_sID = ac.sID)\n\t\t\t\t\t\t\t\tLEFT JOIN pm_as_pricetypes pt ON (pt.ptID = p.ptID)\n\t\t\t\t\t\t\t\tLEFT JOIN pm_as_parts_properties prop ON (prop.accID = p.accID)\n\t\t\t\t\t\t\t\tWHERE s.DataType = 'CatItem' && p.notAvailable = 0\n\t\t\t\t\t\t\t\t" . $whereText . "\n\t\t\t\t\t\t\t\tGROUP BY p.accID, s.sID\n\t\t\t\t\t\t\t\t" . $orderStr . " LIMIT " . $startFrom . "," . GetCfg("Search.itemsPerPage") . " "; //$bigQuery = implode(" UNION ",$query); //$bigQuery .= "; //echo $query.'<br><hr>'; $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}"; } } } //echo '<pre>'; //print_r($item); //echo '</pre><br>'; $catItems[] = $item; } //print_r($catItems); return $catItems; }
function getAnket($orderID) { global $authenticationMgr, $templatesMgr; $order = $this->getOrder($orderID); if ($order['userID'] == 1) { $query = "SELECT orderID, userName, userPhone, userEmail, userAdress FROM pm_order_quick WHERE orderID = '" . $orderID . "'"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $userData['LastName'] = $row['userName']; $userData['phone'] = $row['userPhone']; $userData['Email'] = $row['userEmail']; $userData['address'] = $row['userAdress']; } else { $userData = $authenticationMgr->getUserData($order['userID'], ''); } $tpl = $templatesMgr->getTemplate(-1, GetCfg('TemplatesPath') . '/orders/_anketa.html'); $tpl = str_replace('%ordertype%', 'orders', $tpl); //print_r($userData); //echo $userData['cardID'].' ---- '.$userData['userID']; $tpl = $userData['cardID'] ? str_replace('%userID%', '<strong>' . $userData['userID'] . ' (<font color="#009966">' . $userData['cardID'] . '</font>)</strong>', $tpl) : str_replace('%userID%', $userData['userID'], $tpl); $tpl = $userData['cardID'] ? str_replace('%userIDTitle%', $userData['userID'] . ' ' . $userData['cardID'], $tpl) : str_replace('%userIDTitle%', $userData['userID'], $tpl); $tpl = str_replace('%email%', $userData['Email'], $tpl); $tpl = str_replace('%lastName%', $userData['LastName'], $tpl); $tpl = str_replace('%firstName%', $userData['FirstName'], $tpl); $tpl = str_replace('%secondName%', $userData['SurName'], $tpl); $tpl = str_replace('%phone%', $userData['phone'], $tpl); $tpl = str_replace('%region%', $userData['region'], $tpl); $tpl = str_replace('%city%', $userData['city'], $tpl); $tpl = str_replace('%adress%', $userData['address'], $tpl); $tpl = str_replace('%car%', $userData['plantName'] . ' ' . $userData['carModel'], $tpl); return $tpl; }
function getContent() { global $authenticationMgr; $userID = $authenticationMgr->getUserID(); $ret = ''; $isCardInCart = Cart::isItemInCart(GetCfg('Club.GoodID')); if (isset($_GET['act'])) { $handler = new ClubGetCardHandler(); $ret .= $handler->getContent(); } else { $userData = array(); if ($userID != 1) { $userData = $authenticationMgr->getUserData($userID, ''); $userName = $userData['FirstName'] . " " . $userData['LastName']; $ret .= 'Здравствуйте, ' . $userName . '<br/><br/>'; if ($isCardInCart || isset($userData['cardID']) && $userData['cardID'] != '0') { $ret .= $isCardInCart ? 'Ваша клубная карта будет доступна после оплаты<br/>' : 'Номер вашей карты: ' . $userData['cardID']; } else { $ret .= ' <table style="width:100%;margin:0 0 20px;" cellspacing="0" cellpadding="0"> <tr> <td style="width:100px;"> <div style="padding:20px 0 0 20px;"><img src="http://www.carumba.ru/images/minime.gif" border="0" /> <!-- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="65" height="90"> <param name="movie" value="/images/carumbych.swf"/> <param name="quality" value="high"/> <embed src="/images/carumbych.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="65" height="90"></embed> </object> --> </div> </td> <td style="vertical-align:middle;width:195px;"> <div style="padding:10px;"> <a href="/main/club"><img src="/images/club.gif" alt="Автоклуб КАРУМБА (скидки, бонусы)" width="175" height="98" border="0" align="absmiddle"/></a> </div> </td> <td><br/><br/> <p>Для вступления в клуб Вам необходимо положить карту в корзину.<br/>Как карта появится в корзине Ваше цена станет "Цена по карте".<br/>Цена: 500 руб.<br/> <form action="/" method="post" style="margin: 0;"> <input type="image" src="/images/buy.gif" alt="Купить" /> <input type=hidden name=module value=Cart> <input type=hidden name=function value=tocart> <input type=hidden name=goodID value="' . GetCfg('Club.GoodID') . '"> </form> </p> </td> </tr> </table> '; } } else { $ret .= 'Пожалуйста, <a href="/registration">зарегистрируйтесь</a>'; } if (!(sizeof($userData) && $userData['cardID'] != '0')) { $ret .= '<div style="margin:10px 0;"> <p>Цена карты до 1 января 2008 года <strong>всего 500 рублей</strong>! </p> <strong>5 За! Для вступления в автоклуб "Карумба":</strong> <ol> <li>Скидки на весь ассортимент on-line каталога</li> <li> Уникальные низкие цены на широкий ассортимент товаров Спецпредложений</li> <li> Индивидуальный подход к каждому члену клуба</li> <li> Дополнительные удобства при заказе товаров</li> <li> Номера карт участвуют в розыгрыше призов</li> </ol> <p><em>Приобретая карту автоклуба вы экономите время при заказе товара!</em></p> <p><strong>Для новых покупателей:</strong></p> <ul> <li> для вступления в автоклуб вам сначала нужно пройти регистрацию</li> </ul> <p><strong>Для зарегистрированных пользователей:</strong></p> <ul> <li> если вы уже за регистрированы то вам нужно просто положить карту в корзину</li> <li> номер карты будет присвоен Вам нашим оператором, после проверки анкеты</li> </ul> <em>Карта которую приобретете сейчас будет с вами долгие годы!</em> </div>'; } } return $ret; }
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; }
function getBonusList() { global $structureMgr; $items = $this->getBonusItems(); $content = "<p><strong>Спецпредложение для членов автоклуба: </strong></p>"; foreach ($items as $item) { $URL = $structureMgr->getPathByPageID($item['sID'], false); $URL = "http://carumba.ru" . $URL; if ($item["ptPercent"] == 0) { $firstPrice = round($item["salePrice"] - $item["salePrice"] * 5 / 100); } else { $firstPrice = round($item["salePrice"] - $item["salePrice"] * $item["ptPercent"] / 100); } if ($catItem["smallPicture"] == NULL) { if (file_exists(GetCfg("ROOT") . $item["PicturePath"] . "/" . $item["sID"] . ".gif")) { $item["smallPicture"] = $item["PicturePath"] . "/" . $item["sID"] . ".gif"; } else { if ($item["logotype"] == NULL) { $item["smallPicture"] = "/products/empty.gif"; } else { $item["smallPicture"] = $item["logotype"]; } } } $content .= "<p><a href='" . $URL . "'><img src='http://carumba.ru" . $item["smallPicture"] . "' width=70 height=70 border=0></a><br><a href=\"" . $URL . "\">" . $item["ShortTitle"] . "</a><br><strong>" . $firstPrice . "</strong> / " . $item["salePrice"] . " руб. (- <strong>" . $item["ptPercent"] . "</strong>%)</p>"; } $content .= "<p> </p>"; return $content; }
function processOrdersCommand($cmd) { global $modulesMgr, $structureMgr, $authenticationMgr, $permissionsMgr, $cacheMgr, $templatesMgr; $tpl = $templatesMgr->getTemplate(-1, GetCfg('TemplatesPath') . '/orders/top.html'); $content = ''; $cmd = !_get('cmd') ? _post('cmd') : _get('cmd'); $act = !_get('act') ? _post('act') : _get('act'); switch ($cmd) { case 'vinorders': $tpl = str_replace('%orders%', '<a href="/carorders?cmd=orders&status=1">Заказы общие</a>', $tpl); $tpl = str_replace('%vinorders%', 'Заказ на иномарки (VIN)', $tpl); $tpl = str_replace('%vinordersgem%', '<a href="/carorders?cmd=vinordersgem&status=1">Заказ на иномарки Германии (VIN)</a>', $tpl); $handler = new VinOrdersHandler(); $status = _get('status'); if (!$status) { $status = 1; } $page = _get('page'); $orderID = _get('orderID'); if (!$page) { $page = 1; } switch ($act) { case 'refresh': $handler->updateOrders(); break; case 'setDeliveryDate': $handler->setDeliveryDate(); break; case 'setPrePayment': $handler->setPrePayment(); break; case 'recalc': $handler->recalcOrders(); break; case 'addPart': $handler->addPart(); break; case 'sendPart': $handler->sendPart(); break; case 'setMessage': $handler->setComment(); break; case 'sendReply': $handler->sendReply(); break; case 'viewReplies': $tpl = $handler->viewReplies($orderID); break; case 'anket': $tpl = $handler->getAnket($orderID); break; case 'order': $tpl = $handler->getLookOrder($orderID); break; case 'data': $tpl = $handler->getDataHistory($orderID); break; case 'delivery': $tpl = $handler->getDeliveryDate($orderID); break; case 'send': $tpl = $handler->getSend($orderID); break; case 'prepayment': $tpl = $handler->getPrepayment($orderID); break; default: $content .= $handler->getContent($status, $page); $tpl = str_replace('%content%', $content, $tpl); break; } break; case 'vinordersgem': $tpl = str_replace('%orders%', '<a href="/carorders?cmd=orders&status=1">Заказы общие</a>', $tpl); $tpl = str_replace('%vinorders%', '<a href="/carorders?cmd=vinorders&status=1">Заказ на иномарки (VIN)</a>', $tpl); $tpl = str_replace('%vinordersgem%', 'Заказ на иномарки Германии (VIN)', $tpl); $handler = new VinOrdersGemHandler(); $status = _get('status'); if (!$status) { $status = 1; } $page = _get('page'); $orderID = _get('orderID'); if (!$page) { $page = 1; } switch ($act) { case 'refresh': $handler->updateOrders(); break; case 'setDeliveryDate': $handler->setDeliveryDate(); break; case 'setPrePayment': $handler->setPrePayment(); break; case 'recalc': $handler->recalcOrders(); break; case 'addPart': $handler->addPart(); break; case 'sendPart': $handler->sendPart(); break; case 'setMessage': $handler->setComment(); break; case 'sendReply': $handler->sendReply(); break; case 'viewReplies': $tpl = $handler->viewReplies($orderID); break; case 'anket': $tpl = $handler->getAnket($orderID); break; case 'order': $tpl = $handler->getLookOrder($orderID); break; case 'data': $tpl = $handler->getDataHistory($orderID); break; case 'delivery': $tpl = $handler->getDeliveryDate($orderID); break; case 'send': $tpl = $handler->getSend($orderID); break; case 'prepayment': $tpl = $handler->getPrepayment($orderID); break; default: $content .= $handler->getContent($status, $page); $tpl = str_replace('%content%', $content, $tpl); break; } break; default: $tpl = str_replace('%orders%', 'Заказы общие', $tpl); $tpl = str_replace('%vinorders%', '<a href="/carorders?cmd=vinorders&status=1">Заказ на иномарки (VIN)</a>', $tpl); $tpl = str_replace('%vinordersgem%', '<a href="/carorders?cmd=vinordersgem&status=1">Заказ на иномарки Германии (VIN)</a>', $tpl); $handler = new OrdersHandler(); $status = _get('status'); if (!$status) { $status = 1; } $page = _get('page'); $orderID = _get('orderID'); if (!$page) { $page = 1; } //print 'act='.$act; switch ($act) { case 'refresh': //print '<br>in'; $handler->updateOrders(); break; case 'setDeliveryDate': $handler->setDeliveryDate(); break; case 'setPrePayment': $handler->setPrePayment(); break; case 'recalc': $handler->recalcOrders(); break; case 'addPart': $handler->addPart(); break; case 'setMessage': $handler->setComment(); break; case 'sendReply': $handler->sendReply(); break; case 'viewReplies': $tpl = $handler->viewReplies($orderID); break; case 'anket': $tpl = $handler->getAnket($orderID); break; case 'order': $tpl = $handler->getLookOrder($orderID); break; case 'data': $tpl = $handler->getDataHistory($orderID); break; case 'delivery': $tpl = $handler->getDeliveryDate($orderID); break; case 'send': $tpl = $handler->getSend($orderID); break; case 'prepayment': $tpl = $handler->getPrepayment($orderID); break; default: //print 'status='.$status.' page='.$page; $content .= $handler->getContent($status, $page); $tpl = str_replace('%content%', $content, $tpl); break; } break; } return $tpl; }
function writeLine($errno, $errstr, $errfile, $errline) { if ($this->fd) { fwrite($this->fd, "[" . strftime(GetCfg("DateFormat")) . "] {$errfile}:{$errline} - {$errstr}\n"); } }
function getRegForm($pageID) { global $structureMgr, $templatesMgr, $authenticationMgr; $doRegister = 0; $msg = ""; if ($authenticationMgr->getUserID() <= 1) { // return "Незарегистрированные пользователи даже попасть сюда не должны!"; header("Status: 302 Moved"); $msg = "Для подписки на рассылку предложений по распродаже, нужна регистрация"; header("Location: /registration?msg=" . $msg . "&email=" . _post("email")); exit; } if (_post("action") == "doUpdate") { if (_post("login") != "") { $ud = array(); // $authenticationMgr->getUserData(-1, _post("login")); if (count($ud) == 0) { $vals = array("firstname", "lastname", "surname", "email", "phone", "address", "car", "car_type"); $names = array("Имя", "Фамилия", "Отчество", "E-mail", "Контактный телефон", "Адрес доставки", "Ваш автомобиль", "Марка автомобиля"); for ($i = 0; $i < count($vals); $i++) { if ($vals[$i] != "car_type") { if (_post($vals[$i]) == "") { $msg .= "Заполните, пожалуйста, поле `{$names[$i]}`.<br>"; } } else { $pcar = _post("car"); if (($pcar == "0" || $pcar > 15 && $pcar < 24) && _post($vals[$i]) == "") { $msg .= "Заполните, пожалуйста, поле `{$names[$i]}`.<br>"; } } } if (_post("psw") != _post("psw2") && _post("psw")) { $msg .= "Пароли не совпадают."; } if (!$msg) { $updateInfo = array(); if (_post("login")) { $updateInfo[] = "login = "******"login")); } if (_post("psw")) { $updateInfo[] = "`password` = MD5(" . prepareVar(_post("psw")) . ")"; } if (_post("firstname")) { $updateInfo[] = "FirstName = " . prepareVar(_post("firstname")); } if (_post("lastname")) { $updateInfo[] = "LastName = " . prepareVar(_post("lastname")); } if (_post("surname")) { $updateInfo[] = "SurName = " . prepareVar(_post("surname")); } if (_post("email")) { $updateInfo[] = "Email = " . prepareVar(_post("email")); } if (_post("sex")) { $updateInfo[] = "sex = " . prepareVar(_post("sex")); } if (_post("phone")) { $updateInfo[] = "phone = " . prepareVar(_post("phone")); } if (_post("region")) { $updateInfo[] = "region = " . prepareVar(_post("region")); } if (_post("city")) { $updateInfo[] = "city = " . prepareVar(_post("city")); } if (_post("address")) { $updateInfo[] = "address = " . prepareVar(_post("address")); } if (_post("carID")) { $updateInfo[] = "carID = " . prepareVar(_post("carID")); } if (_post("carType")) { $updateInfo[] = "carType = " . prepareVar(_post("carType")); } if (_post("subscribe")) { $updateInfo[] = "subscribe = " . prepareVar(_post("subscribe")); } if (count($updateInfo)) { $q = "UPDATE pm_users SET\n\t\t\t\t\t\t\t\t" . implode(",", $updateInfo) . "\n\t\t\t\t\t\t\t\tWHERE userID ='" . $authenticationMgr->getUserID() . "'"; //echo $q; $qr = mysql_query($q); } if ($qr) { $msg = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/Register/" . "regmsg.txt"); $subj = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/Register/" . "regmailsubj.txt"); $body = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/Register/" . "regmail.txt"); $body = str_replace("%login%", _post("login"), $body); $body = str_replace("%psw%", _post("psw"), $body); $body = str_replace("%firstname%", _post("firstname"), $body); $body = str_replace("%lastname%", _post("lastname"), $body); $body = str_replace("%car_type%", _post("car_type"), $body); mail(_post("email"), $subj, $body, "From: info@carumba.ru\r\n"); $doUpdate = 1; } else { $msg = mysql_error(); } } } else { $msg .= "Уже существует пользователь с логином `" . _post("login") . "`.<br>"; } } else { $msg .= "Заполните, пожалуйста, поле "Логин".<br>"; } } if ($doUpdate == 0) { $js = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/Register/" . "reg.js"); $form = <<<FORM <TABLE class="" cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD class="" width=8><IMG height=8 src="/images/pix.gif" width=8></TD> <TD class="" vAlign=top> <TABLE class="" cellSpacing=1 cellPadding=5 width="100%" bgColor=#dcdde0 border=0> <TBODY> <TR bgColor=#ffffff> <TD class="" vAlign=top width="50%"> <TABLE class="" cellSpacing=0 cellPadding=10 width="100%" border=0> <TBODY> <TR vAlign=top> <TD class="" width=65><IMG height=85 alt="Полезная информация" src="/images/minime.gif" width=65 align=absMiddle border=0></TD> <TD class=""> <P><STRONG>Внимание:</STRONG></P> <UL> <LI>После отправки анкеты, на Ваш e-mail будет отослано письмо</LI> <LI>Указанная вами марка автомобиля поможет улучшить качество получаемой Вами информации о распродаже</LI> <LI>Все поля данной анкеты обязательны для заполнения </LI></UL></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD> <TD class="" width=8><IMG height=8 src="/images/pix.gif" width=8></TD></TR></TBODY></TABLE><BR>%MSG% <TABLE class="" cellSpacing=0 cellPadding=0 width="100%" border=0> <FORM onsubmit="return checkReg();" method=post><INPUT type=hidden value=doUpdate name=action> <TBODY> <TR> <TD class="" width=8><IMG height=8 src="/images/pix.gif" width=8></TD> <TD class="" vAlign=top> <TABLE class="" cellSpacing=0 cellPadding=0 width="100%" bgColor=#f2f2f2 border=0> <TBODY> <TR> <TD class="" width=10 height=10><IMG height=10 src="/images/t_01.gif" width=10></TD> <TD class="" background=/images/tb_01.gif height=10><IMG height=10 src="/images/pix.gif" width=10></TD> <TD class="" width=10 height=10><IMG height=10 src="/images/t_02.gif" width=10></TD></TR> <TR> <TD class="" width=10 background=/images/tb_02.gif><IMG height=10 src="/images/pix.gif" width=10></TD> <TD class="" vAlign=top> <TABLE class="" cellSpacing=1 cellPadding=5 bgColor=#cccccc border=0> <TBODY> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Логин:</TD> <TD class=""><INPUT class=input03 value=%login% name=login></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Пароль:</TD> <TD class=""><INPUT class=input03 type=password value=%psw% name=psw></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Пароль повторно:</TD> <TD class=""><INPUT class=input03 type=password value=%psw2% name=psw2></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>E-mail:</TD> <TD class=""><INPUT class=input03 value=%email% name=email></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Фамилия:</TD> <TD class=""><INPUT class=input03 value=%lastname% name=lastname></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Имя:</TD> <TD class=""><INPUT class=input03 value=%firstname% name=firstname></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Отчество:</TD> <TD class=""><INPUT class=input03 value=%surname% name=surname></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Ваш пол:</TD> <TD class=""><INPUT type=radio %male% value=m name=sex> Мужской <INPUT type=radio %female% value=f name=sex> Женский </TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Контактный телефон:</TD> <TD class=""><INPUT class=input03 value=%phone% name=phone></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Регион:</TD> <TD class=""><SELECT class=input03 name=region> <OPTION value=Санкт-Петербург selected>Санкт-Петербург</OPTION></SELECT></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Город:</TD> <TD class=""><SELECT class=input03 name=city> <OPTION value=Санкт-Петербург selected>Санкт-Петербург</OPTION></SELECT></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Адрес доставки:</TD> <TD class=""><TEXTAREA class=input05 name=address>%address%</TEXTAREA></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Ваш автомобиль:</TD> <TD class="" bgColor=#f2f2f2> <SELECT class=input03 name=car> <OPTION value="">-------------- <OPTION value=1>ВАЗ 2101</OPTION> <OPTION value=2>ВАЗ 2102</OPTION> <OPTION value=3>ВАЗ 2103</OPTION> <OPTION value=4>ВАЗ 2104</OPTION> <OPTION value=5>ВАЗ 2105</OPTION> <OPTION value=6>ВАЗ 2106</OPTION> <OPTION value=7>ВАЗ 2107</OPTION> <OPTION value=8>ВАЗ 2108</OPTION> <OPTION value=9>ВАЗ 2109</OPTION> <OPTION value=10>ВАЗ 21099</OPTION> <OPTION value=11>ВАЗ 2110</OPTION> <OPTION value=12>ВАЗ 2112</OPTION> <OPTION value=13>Ока</OPTION> <OPTION value=14>Нива</OPTION> <OPTION value="">-------------- <OPTION value=16>Honda</OPTION> <OPTION value=17>Infiniti</OPTION> <OPTION value=18>Lexus</OPTION> <OPTION value=19>Mazda</OPTION> <OPTION value=20>Mitsubishi</OPTION> <OPTION value=21>Nissan</OPTION> <OPTION value=22>Subaru</OPTION> <OPTION value=23>Toyota</OPTION> <OPTION value="">--------------</OPTION> <OPTION value=0>Другой</OPTION> </SELECT> </TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Модель автомобиля<br>(заполняется, если указана иномарка либо Ваш автомобиль не входит в список):</TD> <TD class="" bgColor=#f2f2f2><input type="text" class="input03" name="car_type" value="%car_type%"></TD></TR> <TR bgColor=#f2f2f2> <TD class="" align=right width=160>Подписаться на e-mail рассылку предложений по распродаже:</TD> <TD class=""><INPUT type=checkbox %subscribe% value=1 name=subscribe></TD></TR></TBODY></TABLE><BR> <TABLE class="" height=15 cellSpacing=0 cellPadding=0 width=116 border=0> <TBODY> <TR> <TD class="" vAlign=top bgColor="#676971" height=15><INPUT type=image src="images/reg.gif"></TD></TR></TBODY></TABLE><BR></TD> <TD class="" width=10 background=/images/tb_03.gif><IMG height=10 src="/images/pix.gif" width=10></TD></TR> <TR> <TD class="" width=10 height=10><IMG height=10 src="/images/t_03.gif" width=10></TD> <TD class="" background=/images/tb_04.gif height=10><IMG height=10 src="/images/pix.gif" width=10></TD> <TD class="" width=10 height=10><IMG height=10 src="/images/t_04.gif" width=10></TD></TR></TBODY></TABLE></TD> <TD class="" width=8><IMG height=8 src="/images/pix.gif" width=8></TD></TR></TBODY></FORM></TABLE> FORM; if ($msg) { $msg = "<div style=\"color: red; text-align: center\">{$msg}<br><br></div>"; } $user = $this->getUserData($authenticationMgr->getUserID()); $form = str_replace("%MSG%", $msg, $form); $form = str_replace("%login%", "\"" . str_replace("\"", """, _post("login") ? _post("login") : $user['Login']) . "\"", $form); $form = str_replace("%psw%", "\"" . str_replace("\"", """, _post("psw") ? _post("psw") : "") . "\"", $form); $form = str_replace("%psw2%", "\"" . str_replace("\"", """, _post("psw2") ? _post("psw2") : "") . "\"", $form); $form = str_replace("%firstname%", "\"" . str_replace("\"", """, _post("firstname") ? _post("firstname") : $user['FirstName']) . "\"", $form); $form = str_replace("%lastname%", "\"" . str_replace("\"", """, _post("lastname") ? _post("lastname") : $user['LastName']) . "\"", $form); $form = str_replace("%surname%", "\"" . str_replace("\"", """, _post("surname") ? _post("surname") : $user['SurName']) . "\"", $form); $form = str_replace("%email%", "\"" . str_replace("\"", """, _post("email") ? _post("email") : $user['Email']) . "\"", $form); $form = str_replace("%phone%", "\"" . str_replace("\"", """, _post("phone") ? _post("phone") : $user['phone']) . "\"", $form); $form = str_replace("%address%", str_replace("\"", """, _post("address") ? _post("address") : $user['address']), $form); $form = str_replace("%car_type%", str_replace("\"", """, _post("car_type") ? _post("car_type") : $user['carType']), $form); $form = str_replace("%subscribe%", (_post("subscribe") ? _post("subscribe") : $user['subscribe']) == 1 ? "checked" : "", $form); if ((_post("sex") ? _post("sex") : $user['sex']) == 'm') { $male = "checked"; $female = ""; } else { $male = ""; $female = "checked"; } $form = str_replace("%male%", $male, $form); $form = str_replace("%female%", $female, $form); return "<script>{$js}</script>" . $form; } else { return $msg; } }
function getProducerList($page, $pageid) { global $structureMgr, $templatesMgr; $perPage = GetCfg('Producer.perPage'); $q = "SELECT DISTINCT accPlantID, accPlantName, logotype FROM pm_structure s, pm_as_producer pr WHERE isHidden=0 AND pr.sID > 0 AND pr.sID=s.sID"; $qr = mysql_query($q); $cnt = mysql_num_rows($qr); $pagesCount = ceil($cnt / $perPage); $startFrom = $page * $perPage; $purePager = ""; $URL = $structureMgr->getPathByPageID($pageid, true); for ($i = 0; $i < $pagesCount; $i++) { if ($i > 0) { $purePager .= ' - '; $u = $URL . '?pg=' . $i; } else { $u = $URL; } if ($filter) { $u .= '?' . $filter; } if ($i == $page) { $purePager .= $i + 1; } else { $purePager .= '<a href="' . $u . '" class="levm">' . ($i + 1) . '</a>'; } } $producers = "\n \n <div class=\"podbor\">\n <table cellspacing=\"0\" cellpadding=\"0\" class=\"both\">\n <tr>\n <td class=\"leftpage\">\n Страницы: {$purePager}\n </td>\n <td class=\"rightpage\">\n\n </td>\n </tr>\n </table>\n </div> \n <div class=\"podbor\"><table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">"; $prodList = array(); $prodList = $this->getProducers($startFrom, $perPage); for ($i = 0; $i < count($prodList); $i++) { if ($i % 5 == 0) { $producers .= "\n<tr>\n"; } if ($prodList[$i][2] && file_exists(GetCfg("ROOT") . $prodList[$i][2])) { $isrc = $prodList[$i][2]; } else { $isrc = "/products/empty.gif"; } $prodID = $prodList[$i][0]; $pg = ""; $URL = $structureMgr->getPathByPageID($prodList[$i][3], true); $producers .= "<td align=\"center\" width=20%><a href=\"" . $URL . "\"><img alt=\"" . $prodList[$i][1] . "\" src=\"{$isrc}\" /></a><br /><a href=\"" . $URL . "\">" . $prodList[$i][1] . "</a><br /><br/><br/></td>\n"; if (($i + 1) % 5 == 0 || $i == count($prodList) - 1) { $producers .= "\n</tr>\n"; } } $producers .= "</table></div>\n <div class=\"podbor\">\n <table cellspacing=\"0\" cellpadding=\"0\" class=\"both\">\n <tr>\n <td class=\"leftpage\">\n Страницы: {$purePager}\n </td>\n <td class=\"rightpage\">\n\n </td>\n </tr>\n </table>\n </div>"; return $producers; }
function getNewsList($pageID, $tplFilename, $count) { global $structureMgr, $templatesMgr; $res = ""; $branch = $structureMgr->getStructureForPageID($pageID, 1); if (count($branch) == 0) { return "Новостей нет."; } $tpl = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/News/" . $tplFilename); //$tpl = set_safe_newlines($tpl); $blocks = $templatesMgr->getValidTags(&$tpl, array("container", "item", "separator")); $from = count($branch); if ($count == -1 || $count > $from) { $to = 0; } else { $to = $from - $count; } for ($i = $from - 1; $i >= $to; $i--) { $news = $branch[$i]; $URL = $structureMgr->getPathByPageID($news["sID"], true); $bl = $blocks["item"]; $bl = str_replace("%short_title%", $news["ShortTitle"], $bl); $bl = str_replace("%date%", $news["CreateDate"], $bl); $bl = str_replace("%news_link%", $URL, $bl); $bl = str_replace("%summary%", $structureMgr->getData($news["sID"]), $bl); if ($res && isset($blocks["separator"])) { $res .= $blocks["separator"]; } $res .= $bl; } $blocks["container"] = str_replace("%items%", $res, $blocks["container"]); return $blocks["container"]; }
function processOrdersCommand($cmd) { global $modulesMgr, $structureMgr, $authenticationMgr, $permissionsMgr, $cacheMgr, $templatesMgr; $tpl = $templatesMgr->getTemplate(-1, GetCfg("TemplatesPath") . "/orders/top.html"); $content = ""; $cmd = !_get("cmd") ? _post("cmd") : _get("cmd"); $act = !_get("act") ? _post("act") : _get("act"); switch ($cmd) { case "vinorders": $tpl = str_replace("%orders%", '<a href="/carorders?cmd=orders&status=1">Заказы общие</a>', $tpl); $tpl = str_replace("%vinorders%", 'Заказ на иномарки (VIN)', $tpl); $handler = new VinOrdersHandler(); $status = _get("status"); if (!$status) { $status = 1; } $page = _get("page"); $orderID = _get("orderID"); if (!$page) { $page = 1; } switch ($act) { case "refresh": $handler->updateOrders(); break; case "setDeliveryDate": $handler->setDeliveryDate(); break; case "setPrePayment": $handler->setPrePayment(); break; case "recalc": $handler->recalcOrders(); break; case "addPart": $handler->addPart(); break; case "sendPart": $handler->sendPart(); break; case "setMessage": $handler->setComment(); break; case "sendReply": $handler->sendReply(); break; case "viewReplies": $tpl = $handler->viewReplies($orderID); break; case "anket": $tpl = $handler->getAnket($orderID); break; case "order": $tpl = $handler->getLookOrder($orderID); break; case "data": $tpl = $handler->getDataHistory($orderID); break; case "delivery": $tpl = $handler->getDeliveryDate($orderID); break; case "send": $tpl = $handler->getSend($orderID); break; case "prepayment": $tpl = $handler->getPrepayment($orderID); break; default: $content .= $handler->getContent($status, $page); $tpl = str_replace("%content%", $content, $tpl); break; } break; default: $tpl = str_replace("%orders%", 'Заказы общие', $tpl); $tpl = str_replace("%vinorders%", '<a href="/carorders?cmd=vinorders&status=1">Заказ на иномарки (VIN)</a>', $tpl); $handler = new OrdersHandler(); $status = _get("status"); if (!$status) { $status = 1; } $page = _get("page"); $orderID = _get("orderID"); if (!$page) { $page = 1; } switch ($act) { case "refresh": $handler->updateOrders(); break; case "setDeliveryDate": $handler->setDeliveryDate(); break; case "setPrePayment": $handler->setPrePayment(); break; case "recalc": $handler->recalcOrders(); break; case "addPart": $handler->addPart(); break; case "setMessage": $handler->setComment(); break; case "sendReply": $handler->sendReply(); break; case "viewReplies": $tpl = $handler->viewReplies($orderID); break; case "anket": $tpl = $handler->getAnket($orderID); break; case "order": $tpl = $handler->getLookOrder($orderID); break; case "data": $tpl = $handler->getDataHistory($orderID); break; case "delivery": $tpl = $handler->getDeliveryDate($orderID); break; case "send": $tpl = $handler->getSend($orderID); break; case "prepayment": $tpl = $handler->getPrepayment($orderID); break; default: $content .= $handler->getContent($status, $page); $tpl = str_replace("%content%", $content, $tpl); break; } break; } return $tpl; }