/** * Старт сессии * */ protected function Start() { session_name(Config::Get('sys.session.name')); session_set_cookie_params(Config::Get('sys.session.timeout'), Config::Get('sys.session.path'), Config::Get('sys.session.host')); if (!session_id()) { /** * Попытка подменить идентификатор имени сессии через куку */ if (isset($_COOKIE[Config::Get('sys.session.name')]) and !is_string($_COOKIE[Config::Get('sys.session.name')])) { die("Hacking attemp! Please check cookie PHP session name."); } /** * Попытка подменить идентификатор имени сессии в реквесте */ $aRequest = array_merge($_GET, $_POST); // Исключаем попадаение $_COOKIE в реквест if (@ini_get('session.use_only_cookies') === "0" and isset($aRequest[Config::Get('sys.session.name')]) and !is_string($aRequest[Config::Get('sys.session.name')])) { die("Hacking attemp! Please check cookie PHP session name."); } /** * Даем возможность флешу задавать id сессии */ $sUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null; if ($sUserAgent and (in_array($sUserAgent, $this->aFlashUserAgent) or strpos($sUserAgent, "Adobe Flash Player") === 0) and is_string(getRequest('SSID')) and preg_match("/^[\\w\\d]{5,40}\$/", getRequest('SSID'))) { session_id(getRequest('SSID')); } else { session_regenerate_id(); } session_start(); } }
public function _network_settings($network) { $this->setHeaderLabel(getLabel("header-social_networks-settings") . $network->getName()); $mode = getRequest("param0"); $cmsController = cmsController::getInstance(); $type = $network->getCodeName(); $module = $cmsController->getCurrentModule(); $method = $cmsController->getCurrentMethod(); $config = mainConfiguration::getInstance(); $templateId = $config->get("templates", "{$module}.{$method}"); $inputData = array( 'object' => $network->getObject(), 'type' => $type ); if($mode == "do") { $config->set("templates", "{$module}.{$method}", getRequest('template-id')); $object = $this->saveEditedObjectData($inputData); $this->chooseRedirect($this->pre_lang . '/admin/social_networks/' . $type . '/'); } $this->setDataType("form"); $this->setActionType("modify"); $data = $this->prepareData($inputData, "object"); $data['template-id'] = array('@id' => $templateId); $this->setData($data); return $this->doData(); }
public function onModifyObject(iUmiEventPoint $event) { static $modifiedCache = array(); $object = $event->getRef("object"); $typeId = umiObjectTypesCollection::getInstance()->getBaseType('emarket', 'order'); if($object->getTypeId() != $typeId) return; if($event->getMode() == "before") { $data = getRequest("data"); $id = $object->getId(); $newOrderStatus = getArrayKey($data[$id], 'status_id'); $newPaymentStatus = getArrayKey($data[$id], 'payment_status_id'); $newDeliveryStatus = getArrayKey($data[$id], 'delivery_status_id'); switch(true) { case ($newOrderStatus != $object->getValue("status_id") ) : $modifiedCache[$object->getId()] = "status_id"; break; case ($newDeliveryStatus != $object->getValue("delivery_status_id")) : $modifiedCache[$object->getId()] = "delivery_status_id"; break; case ($newPaymentStatus != $object->getValue("payment_status_id") ) : $modifiedCache[$object->getId()] = "payment_status_id"; break; } } else { if(isset($modifiedCache[$object->getId()])) { if ($modifiedCache[$object->getId()] == 'payment_status_id' && $object->getValue("payment_status_id") == order::getStatusByCode('accepted', 'order_payment_status')) { self::addBonus($object->getId()); } if ($modifiedCache[$object->getId()] == 'status_id' && ($object->getValue("status_id") == order::getStatusByCode('canceled') || $object->getValue("status_id") == order::getStatusByCode('rejected'))) { self::returnBonus($object->getId()); } $this->notifyOrderStatusChange(order::get($object->getId()), $modifiedCache[$object->getId()]); } } }
public function reportList() { if ($this->isLogin()) { if (!$this->isPost()) { import('ORG.Util.Page'); //导入分页类 $count = $this->model->where()->count(); $Page = new Page($count, 5); $show = $Page->show(); $list = $this->model->where()->order('createtime desc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); $this->assign('list', $list); $this->assign('page', $show); $this->display(); } else { import('ORG.Util.Page'); //导入分页类 $account = getRequest('account'); $count = $this->model->where(array('account' => $account))->count(); $Page = new Page($count, 5); $show = $Page->show(); if (!$account) { $this->error('请填写查询条件'); } $list = $this->model->where(array('account' => $account))->order('createtime desc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); $this->assign('page', $show); $this->assign('list', $list); $this->display(); } } else { $this->error('请先登录', U('/Manager/login')); } }
/** * @desc Отображение сервисной информации * @return string */ public function service() { $event = strtoupper(getRequest('param0')); $autoupdates_disabled = (bool) regedit::getInstance()->getVal("//modules/autoupdate/autoupdates_disabled"); if ($autoupdates_disabled) { $this->flush('DISABLED', "text/plain"); } $this->checkIsValidSender(); switch ($event) { case "STATUS": $result = $this->returnStatus(); break; case "VERSION": $result = $this->returnVersions(); break; case "LAST_UPDATED": $result = $this->returnLastUpdated(); break; case "MODULES": $result = $this->getModules(); break; case "DOMAINS": $result = $this->getDomains(); break; default: $result = "UNHANDLED_EVENT"; break; } $this->flush($result, "text/plain"); }
public function poll() { $buffer = outputBuffer::current(); $buffer->clear(); $buffer->contentType('text/plain'); $buffer->push('Sorry, but this payment system doesn\'t support server polling.' . getRequest('param0')); $buffer->end(); }
public function edit() { if ($this->isLogin()) { $id = getRequest('id'); $cont = $this->model->getById($id); if (empty($cont)) { $this->error('没有该菜单!'); } $cont['text'] = stripslashes($cont['text']); if (!$this->isPost()) { $pid = $cont['parentid'] ? $cont['parentid'] : $id; $parent_menus = $this->model->getParentMenus($pid); $menus = $this->model->getChildrenMenus($pid, $id); $this->assign('addhref', U('/Richtext/add/pid/' . $pid)); $this->assign('cont', $cont); $this->assign('parent_menus', $parent_menus); $this->assign('menus', $menus); $this->display(); die; } $data = array('title' => getRequest('title'), 'text' => getRequest('text')); if ($this->model->checkData($data, false)) { $ret = $this->model->where(array('id' => $id))->data($data)->save(); if ($ret) { $this->success('修改成功!', $_SERVER['HTTP_REFERER']); } else { $this->error('内容没有更改或保存数据库失败!'); } } else { $this->error($this->model->getError()); } } else { $this->error('请先登录', U('/Manager/login')); } }
public function partialReindex() { $this->setDataType("settings"); $this->setActionType("view"); $lastId = (int) getRequest("lastId"); $search = searchModel::getInstance(); $total = (int) $search->getAllIndexablePages(); $limit = regedit::getInstance()->getVal("//modules/search/one_iteration_index"); if ($limit==0) { $limit = 5; } $result = $search->index_all($limit, $lastId); $data = Array( 'index-status' => Array( 'attribute:current' => $result['current'], 'attribute:total' => $total, 'attribute:lastId' => $result['lastId'] ) ); $this->setData($data); return $this->doData(); }
public function rss_list() { $typesCollection = umiObjectTypesCollection::getInstance(); $objectsCollection = umiObjectsCollection::getInstance(); $type_id = $typesCollection->getTypeIdByGUID('12c6fc06c99a462375eeb3f43dfd832b08ca9e17'); $result = $objectsCollection->getGuidedItems($type_id); $mode = (string) getRequest('param0'); if($mode == "do") { $params = Array( "type_id" => $type_id ); $this->saveEditedList("objects", $params); try { $this->import_feeds(); }catch(publicException $e) {} $this->chooseRedirect(); } // $type_id = 21; $result = array_keys($result); $total = sizeof($result); $this->setDataType("list"); $this->setActionType("modify"); $this->setDataRange($total, 0); $data = $this->prepareData($result, "objects"); $this->setData($data, $total); return $this->doData(); }
protected function EventIndex() { /** * Обработка удаления плагинов */ if (isPost('submit_plugins_del')) { $this->Security_ValidateSendForm(); $aPluginsDelete = getRequest('plugins_del'); if (is_array($aPluginsDelete)) { $this->Plugin_Delete(array_keys($aPluginsDelete)); } } if ($sPlugin = getRequest('plugin', null, 'get') and $sAction = getRequest('action', null, 'get')) { return $this->SubmitManagePlugin($sPlugin, $sAction); } /** * Передан ли номер страницы */ $iPage = preg_match("/^\\d+\$/i", $this->GetEventMatch(2)) ? $this->GetEventMatch(2) : 1; /** * Получаем список блогов */ $aPlugins = $this->Plugin_GetList(); /** * Загружаем переменные в шаблон */ $this->Viewer_Assign("aPlugins", $aPlugins); $this->Viewer_AddHtmlTitle($this->Lang_Get('plugins_administartion_title')); /** * Устанавливаем шаблон вывода */ $this->SetTemplateAction('index'); }
public function getChildren() { $upid = getRequest('upid'); $level = getRequest('level'); $html = $this->model->getChildren($upid, $level); echo $html; }
public function json_get_referer_pages() { $this->updateFilter(); $requestId = (int) $_REQUEST['requestId']; if($host = getRequest('host')) { $_SERVER['HTTP_HOST'] = $host; } $domain_url = "http://" . $_SERVER['HTTP_HOST']; $referer_uri = str_replace($domain_url, "", $_SERVER['HTTP_REFERER']); $factory = new statisticFactory(dirname(__FILE__) . '/classes'); $factory->isValid('pageNext'); $report = $factory->get('pageNext'); $report->setStart(time() - 3600*24*7); //TODO: Fix to real dates $report->setFinish(time() + 3600*24); //TODO: Fix to real dates if(!$referer_uri) $referer_uri = "/"; $report->setParams( Array("page_uri" => $referer_uri) ); $result = $report->get(); $res = <<<END var response = new lLibResponse({$requestId}); response.links = new Array(); END; $total = 0; foreach($result as $r_item) { $total += (int) $r_item['abs']; $res .= <<<END response.links[response.links.length] = {"uri": "{$r_item['uri']}", "abs": "{$r_item['abs']}"}; END; } $res .= <<<END response.total = '{$total}'; END; $res .= <<<END lLib.getInstance().makeResponse(response); END; $this->flush($res); }
protected function readDataBlock() { $v9a09b4dfda82e3e665e31092d1c3ec8d = parent::readDataBlock(); if ($v9a09b4dfda82e3e665e31092d1c3ec8d->getElementsByTagName('domains')->length) { $ve4e46deb7f9cc58c7abfb32e5570b6f3 = $v9a09b4dfda82e3e665e31092d1c3ec8d->getElementsByTagName('domains')->item(0); if ($ve4e46deb7f9cc58c7abfb32e5570b6f3->getElementsByTagName('domain')->length) { $vad5f82e879a9c5d6b5b442eb37e50551 = $ve4e46deb7f9cc58c7abfb32e5570b6f3->getElementsByTagName('domain')->item(0); $vfc4dd24e8dcaab0826b9ab09db0da5bf = false; $v72ee76c5c29383b7c9f9225c1fa4d10b = false; $v495a73fe6d3367859f634a689771d209 = getRequest('param0'); if ($v495a73fe6d3367859f634a689771d209) { $v6a7f245843454cf4f28ad7c5e2572aa2 = umiObjectsCollection::getInstance()->getObject($v495a73fe6d3367859f634a689771d209)->elements; if (is_array($v6a7f245843454cf4f28ad7c5e2572aa2) && count($v6a7f245843454cf4f28ad7c5e2572aa2)) { $v72ee76c5c29383b7c9f9225c1fa4d10b = $v6a7f245843454cf4f28ad7c5e2572aa2[0]->getDomainId(); } } if ($v72ee76c5c29383b7c9f9225c1fa4d10b) { $vfc4dd24e8dcaab0826b9ab09db0da5bf = domainsCollection::getInstance()->getDomain($v72ee76c5c29383b7c9f9225c1fa4d10b); } else { $vfc4dd24e8dcaab0826b9ab09db0da5bf = domainsCollection::getInstance()->getDefaultDomain(); } if ($vfc4dd24e8dcaab0826b9ab09db0da5bf instanceof domain) { $v9b98b21540033f68b145fb236bd91a73 = $vfc4dd24e8dcaab0826b9ab09db0da5bf->getHost(); $vad5f82e879a9c5d6b5b442eb37e50551->setAttribute('host', $v9b98b21540033f68b145fb236bd91a73); } } } return $v9a09b4dfda82e3e665e31092d1c3ec8d; }
public function AddValuesToObject($data) { $data['oTopic']->setFixedStatus(0); if ($this->checkUserRights($data['oBlog'])) { $data['oTopic']->setFixedStatus(getRequest('topic_fixed') ? 1 : 0); } }
public function onAddTopicToDispatch(iUmiEventPoint $oEvent) { $iDispatchId = regedit::getInstance()->getVal("//modules/forum/dispatch_id"); if (!$iDispatchId) { return false; } $dispatches_module = cmsController::getInstance()->getModule('dispatches'); if (!$dispatches_module) { return false; } $iTopicId = (int) $oEvent->getParam('topic_id'); $oTopicElement = umiHierarchy::getInstance()->getElement($iTopicId); if ($oTopicElement instanceof umiHierarchyElement) { $sTitle = (string) getRequest('title'); $sMessage = (string) getRequest('body'); $iHierarchyTypeId = umiHierarchyTypesCollection::getInstance()->getTypeByName("dispatches", "message")->getId(); $iMsgTypeId = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($iHierarchyTypeId); $oMsgType = umiObjectTypesCollection::getInstance()->getType($iMsgTypeId); $iMsgObjId = umiObjectsCollection::getInstance()->addObject($sTitle, $iMsgTypeId); $oMsgObj = umiObjectsCollection::getInstance()->getObject($iMsgObjId); if ($oMsgObj instanceof umiObject) { $iReleaseId = $dispatches_module->getNewReleaseInstanceId($iDispatchId); $oMsgObj->setValue('release_reference', $iReleaseId); $oMsgObj->setValue('header', $sTitle); $oMsgObj->setValue('body', $sMessage); $oMsgObj->commit(); return true; } else { return false; } } else { return false; } }
public function config() { // // получить экземпляр для работы с реестром // $regedit = regedit::getInstance(); // // создать массив // $params = array('config' => array('int:per_page' => NULL)); // получить первый параметр строки запроса $mode = getRequest("param0"); // Если режим Do if ($mode == "do") { //$params = $this->expectParams($params); //$regedit->setVar("//modules/modulelements/per_page", $params['config']['int:per_page']); $this->chooseRedirect(); } // // запишем в массив значение из реестра // $params['config']['int:per_page'] = (int) $regedit->getVal("//modules/modulelements/per_page"); $params = array('config' => array('string:message' => NULL)); $params['config']['string:message'] = 'Здеся будет конфиг'; // установить тип данных и режим $this->setDataType("settings"); $this->setActionType("modify"); // подготовка данных и вывод $data = $this->prepareData($params, "settings"); $this->setData($data); return $this->doData(); }
public function houseList() { if ($this->isLogin()) { import('ORG.Util.Page'); //导入分页类 if (!$this->ispost()) { $count = $this->model->where(array(status => 0))->count(); $Page = new Page($count, 5); $show = $Page->show(); $data = $this->model->where(array(status => 0))->order('createtime desc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); $this->assign('page', $show); $this->assign('data', $data); $this->display(); } else { $decoration = getRequest("decoration"); $style = getRequest("style"); $map = array('decoration_style' => $decoration, 'style' => $style); if (!$map) { $this->error('请填写查询条件'); } else { $count = $this->model->where($map)->count(); $Page = new Page($count, 5); $show = $Page->show(); $data = $this->model->where($map)->order('createtime desc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); if ($data) { $this->assign('page', $show); $this->assign('data', $data); $this->display(); } else { $this->error('没有查到符合内容!', $_SERVER['HTTP_REFERER']); } } } } }
/** * Закрывает одно сообщение и сохраняет информацию об этом в профиле пользователя * */ public function closeUmiMessage() { $this->flushAsXML("closeUmiMessage"); $permissions = permissionsCollection::getInstance(); $objects = umiObjectsCollection::getInstance(); $user_id = $permissions->getUserId(); $user = $objects->getObject($user_id); if ($user instanceof umiObject == false) { throw new coreException("Can't get current user with id #{$user_id}"); } $settings_data = $user->getValue("user_settings_data"); $settings_data = unserialize($settings_data); if (!is_array($settings_data)) { $settings_data = array(); } $value = (int) getRequest('value'); if (isset($settings_data['umiMessages']['closed']) && $settings_data['umiMessages']['closed'] != '') { $closed = explode(';', $settings_data['umiMessages']['closed']); $closed[] = $value; $closed = array_unique($closed); $settings_data['umiMessages']['closed'] = implode(';', $closed); } else { $settings_data['umiMessages']['closed'] = $value; } $user->setValue("user_settings_data", serialize($settings_data)); $user->commit(); }
/** * Проверяет наличие security-ключа в сессии * * @return bool */ public function ValidateSessionKey($sCode = null) { if (!$sCode) { $sCode = getRequest('security_ls_key'); } return $sCode == $this->GenerateSessionKey(); }
public function reply() { $id = getRequest('id'); $data = $this->model->getById($id); $this->checkPurviewData($data); if ($this->isPost()) { $newdata = array(); if ($data['reply'] == '') { $newdata['reply'] = getRequest('reply'); } if ($data['additional_reply'] == '') { $newdata['additional_reply'] = getRequest('additional_reply'); } if ($data['comment'] && !$newdata['reply'] || $data['additional'] && !$newdata['additional_reply']) { $newdata['isreply'] = 0; } else { $newdata['isreply'] = 1; } $returl = U('index'); if ($this->model->where(array('id' => $id))->data($newdata)->save() !== false) { $this->success('回复成功!', $returl); } else { $this->error('操作失败!', $returl); } } else { $this->assign('data', $data); $reply_disable = $data['comment'] && !$data['reply'] ? 0 : 1; $additional_disable = $data['additional'] && !$data['additional_reply'] ? 0 : 1; $this->assign('reply_disable', $reply_disable); $this->assign('additional_disable', $additional_disable); $this->display(); } }
/** * Получить информацию о блоге * * @return bool */ public function EventAjaxBlogInfo() { $this->Viewer_SetResponseAjax('json'); $sBlogName = getRequest('param'); if (!is_string($sBlogName) or !func_check($sBlogName, 'login', 3, 50)) { $this->Message_AddError('Error in blog`s name'); return false; } if (!($oBlog = $this->Blog_GetBlogByUrl($sBlogName))) { return false; } // get blog users with all roles $aBlogAdministratorsResult = $this->Blog_GetBlogUsersByBlogId($oBlog->getId(), ModuleBlog::BLOG_USER_ROLE_ADMINISTRATOR); $aBlogAdministrators = $aBlogAdministratorsResult['collection']; $aBlogModeratorsResult = $this->Blog_GetBlogUsersByBlogId($oBlog->getId(), ModuleBlog::BLOG_USER_ROLE_MODERATOR); $aBlogModerators = $aBlogModeratorsResult['collection']; $aBlogUsersResult = $this->Blog_GetBlogUsersByBlogId($oBlog->getId(), ModuleBlog::BLOG_USER_ROLE_USER, 1, Config::Get('plugin.popupinfo.Blog_User_On_Page')); $aBlogUsers = $aBlogUsersResult['collection']; $oViewer = $this->Viewer_GetLocalViewer(); $oViewer->Assign('oBlog', $oBlog); $oViewer->Assign('aBlogAdministrators', $aBlogAdministrators); $oViewer->Assign('aBlogModerators', $aBlogModerators); $oViewer->Assign('aBlogUsers', $aBlogUsers); $oViewer->Assign('iCountBlogAdministrators', $aBlogAdministratorsResult['count'] + 1); $oViewer->Assign('iCountBlogModerators', $aBlogModeratorsResult['count']); $oViewer->Assign('iCountBlogUsers', $aBlogUsersResult['count']); $oViewer->Assign('oUserCurrent', $this->oUserCurrent); $this->Viewer_AssignAjax('sText', $oViewer->Fetch(Plugin::GetTemplatePath(__CLASS__) . '/getbloginfo.tpl')); }
public function listWhere($stime, $etime, $username, $comment) { $stime = getRequest("stime"); $etime = getRequest("etime"); $username = getRequest("username"); $comment = getRequest("comment"); $map = array(); if (!empty($stime)) { $start = strtotime($stime); $end = strtotime($etime); $map['_string'] = "createtime>{$start} AND createtime<{$end}"; } if (!empty($username)) { $map['username'] = $username; } if (!empty($comment)) { $map['comment'] = array('like', "%{$comment}%"); } if (empty($map)) { return array(); } else { $map['status'] = 0; return $map; } }
public function edit() { $id = getRequest('id'); if (!$id) { $id = $this->model->getIndexId(); if ($id) { redirect(U('edit') . '/id/' . $id); } else { redirect(U('add')); } } else { $data = $this->model->getById($id); } if (empty($data)) { redirect(U('add')); //$this->error('没有该菜单!'); } $data['text'] = stripslashes($data['text']); if ($this->isPost()) { $this->_edit($data); } else { $pid = $data['parentid'] ? $data['parentid'] : $id; $parent_menus = $this->model->getParentMenus($pid); $menus = $this->model->getChildrenMenus($pid, $id); $this->assign('addhref', U('/Richtext/add/pid/' . $pid)); $this->assign('parent_menus', $parent_menus); $this->assign('menus', $menus); $this->_display_form($data); } }
/** * Возвращает html для вставки в блок сообществ */ protected function ajaxGetBlogs() { $this->Viewer_SetResponseAjax('json'); $sCatName = getRequest('blog_cat', ''); $sCatName = $sCatName == 'ALL' ? '' : $sCatName; if ($sCatName) { if (!($sCatName = $this->PluginCommunitycats_ModuleCategory_GetFullCategoryName($sCatName))) { return ''; } } //Исходим из того, что у нас двухуровненвые каталоги $aCatName = explode(':', $sCatName); array_pop($aCatName); $sTemplateName = 'actions/' . strtolower(implode('_', $aCatName)) . 'blogs.tpl'; //загоняем данные в фильтр if ($sCatName) { $aFilter = array('beginLike' => array('blog_cat' => $sCatName)); } else { $aFilter = array(); } $aFilter['in'] = array('blog_type' => array('open', 'close')); $aOrder = array('blog_count_user' => 'desc'); $aLimit = array('iPage' => 1, 'iElementsPerPage' => Config::Get('plugin.communitycats.blockBlogCount')); $aBlogsCat = $this->PluginCommunitycats_ModuleCategory_GetBlogsByFilter($aFilter, $aOrder, $aLimit, false); $oViewerLocal = $this->Viewer_GetLocalViewer(); $oViewerLocal->Assign('aBlogsCatatalog', $aBlogsCat); $this->Viewer_AssignAjax('sToggleText', $oViewerLocal->Fetch(Plugin::GetTemplatePath(__CLASS__) . $sTemplateName)); }
/** * Ищет идентификатор заказа в ответе платежной системы. * Сначала проверяются стандартные поля, потом опрашивается метод getOrderId * каждой подключенной платежной системы * @return Integer | boolean false */ public static final function getResponseOrderId() { $orderId = (int) getRequest('param0'); if (!$orderId) { $orderId = (int) getRequest('orderid'); } if (!$orderId) { $orderId = (int) getRequest('orderId'); } // RBK if (!$orderId) { $orderId = (int) getRequest('order-id'); } // Chronopay if (!$orderId) { $orderId = (int) getRequest('order_id'); } if (!$orderId) { $paymentSystems = self::getList(); foreach ($paymentSystems as $paymentSystem) { $classPrefix = objectProxyHelper::getClassPrefixByType($paymentSystem->payment_type_id); objectProxyHelper::includeClass('emarket/classes/payment/systems/', $classPrefix); $className = $classPrefix . 'Payment'; //TODO: change to $className::getOrderId() after minimum requirements for UMI changes to PHP 5.3 $orderId = (int) call_user_func("{$className}::getOrderId"); if ($orderId) { break; } } } return $orderId; }
public function selectCurrency() { $currencyCode = getRequest('currency-codename'); $selectedCurrency = $this->getCurrency($currencyCode); if ($currencyCode && $selectedCurrency) { $defaultCurrency = $this->getDefaultCurrency(); if (permissionsCollection::getInstance()->isAuth()) { $customer = customer::get(); if ($customer->preffered_currency != $selectedCurrency->id) { if ($selectedCurrency->id == $defaultCurrency->id) { $customer->preffered_currency = null; } else { $customer->preffered_currency = $selectedCurrency->id; } $customer->commit(); } } else { setcookie('customer_currency', $selectedCurrency->id, time() + customer::$defaultExpiration, '/'); } } if ($redirectUri = getRequest('redirect-uri')) { $this->redirect($redirectUri); } else { $this->redirect(getServer('HTTP_REFERER')); } }
public function order_edit() { $object = $this->expectObject("param0", true); $mode = (string) getRequest('param1'); $objectId = $object->getId(); $this->setHeaderLabel("header-users-edit-" . $this->getObjectTypeMethod($object)); $this->checkSv($objectId); $inputData = array("object" => $object, "allowed-element-types" => array('emarket', 'order')); if ($mode == "do") { $oldDeliveryPrice = $object->getValue('delivery_price'); $object = $this->saveEditedObjectData($inputData); $newDeliveryPrice = $object->getValue('delivery_price'); $order = order::get($object->id); $amounts = getRequest('order-amount-item'); $dels = getRequest('order-del-item'); $isChanged = false; if (is_array($amounts)) { foreach ($amounts as $itemId => $amount) { $item = $order->getItem($itemId); if ($item instanceof orderItem) { if ($item->getAmount() != $amount) { $item->setAmount($amount); $item->commit(); $isChanged = true; } } } } if (is_array($dels)) { foreach ($dels as $itemId) { $item = orderItem::get($itemId); if ($item instanceof orderItem) { $order->removeItem($item); $isChanged = true; } } } if ($isChanged) { $order->refresh(); $order->commit(); } if ($oldDeliveryPrice != $newDeliveryPrice && !$isChanged) { $originalPrice = $object->getValue('total_original_price'); $totalPrice = $originalPrice; $discount = $order->getDiscount(); if ($discount instanceof discount) { $totalPrice = $discount->recalcPrice($originalPrice); } $totalPrice += $newDeliveryPrice; $object->setValue('total_price', $totalPrice); $object->commit(); } $this->chooseRedirect(); } $this->setDataType("form"); $this->setActionType("modify"); $data = $this->prepareData($inputData, "object"); $this->setData($data); return $this->doData(); }
protected function EventUsersBan() { $this->Security_ValidateSendForm(); $oUserCurrent = $this->ModuleUser_GetUserCurrent(); if (!$oUserCurrent->IsGlobalModerator()) { return false; } $bOk = false; $sUserLogin = getRequest('ban_login'); if ($sUserLogin == $oUserCurrent->GetLogin()) { return false; } if (getRequest('ban_period') == 'days') { $nDays = intval(getRequest('ban_days')); } else { $nDays = null; } $sComment = getRequest('ban_comment'); $oUser = $this->ModuleUser_GetUserByLogin($sUserLogin); if (getRequest('clear') == "true") { $this->PluginAceadminpanel_Admin_ClearUserBan($oUser->getId()); $this->Viewer_Assign('dir', "Бан с пользователя " . $sUserLogin . " снят."); return true; } if ($this->PluginAceadminpanel_Admin_SetUserBan($oUser->GetId(), $nDays, $sComment)) { $bOk = "Пользователь " . $sUserLogin . " забанен."; } $this->Viewer_Assign('dir', $bOk); }
public function delete() { $id = getRequest('id'); $data = $this->model->getById($id); $this->checkPurviewData($data); $this->_delete(array('id' => $id)); }
protected function display_social_frame($network) { $cmsController = cmsController::getInstance(); $path = getRequest('path'); $path = trim($path, "/"); $path = explode("/", $path); if ($cmsController->getCurrentLang()->getPrefix() == $path[0]) { array_shift($path); } $path = array_slice($path, 2); $_REQUEST['path'] = $path = '/' . implode('/', $path); if (!$network || !$network->isIframeEnabled()) { $buffer = outputBuffer::current(); $buffer->push("<script type='text/javascript'>parent.location.href = '" . $path . "';</script>"); $buffer->end(); } // find element again $cmsController->analyzePath(true); $current_element_id = $cmsController->getCurrentElementId(); $cmsController->setUrlPrefix('' . __CLASS__ . '/' . $network->getCodeName()); if ($cmsController->getCurrentMode() == "admin" || !$network->isHierarchyAllowed($current_element_id)) { $buffer = outputBuffer::current(); $buffer->push("<script type='text/javascript'>parent.location.href = '" . $path . "';</script>"); $buffer->end(); } $this->current_network = $network; $currentModule = $cmsController->getCurrentModule(); $cmsController->getModule($currentModule); return $cmsController->getGlobalVariables(true); }