* file that was distributed with this source code. */ if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die; } use Bitrix\Main\Application; use Bitrix\Main\Localization\Loc; use Bitrix\Main\Entity; use Bitrix\Main\Loader; use Bitrix\IBlock; use Citfact\FilterSubscribe\Model\SubscribeUserTable; Loc::loadMessages(__FILE__); Loader::includeModule('citfact.filter.subscribe'); $app = Application::getInstance(); $request = $app->getContext()->getRequest(); $arResult['COMPONENT_ID'] = CAjax::GetComponentID($this->getName(), $this->getTemplateName(), array()); $userId = $arParams['USER_ID']; $queryBuilder = new Entity\Query(SubscribeUserTable::getEntity()); $queryBuilder->registerRuntimeField('filter', array('data_type' => 'Citfact\\FilterSubscribe\\Model\\SubscribeTable', 'reference' => array('=this.FILTER_ID' => 'ref.ID')))->setSelect(array('*', 'filter'))->setOrder(array('ID' => 'DESC'))->setFilter(array('USER_ID' => $userId)); $filterResult = $queryBuilder->exec(); while ($filter = $filterResult->fetch()) { $arResult['ITEMS'][] = $filter; $arResult['IBLOCKS_ID'][] = $filter['IBLOCK_ID']; if ($filter['SECTION_ID'] > 0) { $arResult['SECTION_ID'][] = $filter['SECTION_ID']; } } if (array_key_exists('ITEMS', $arResult)) { $filterLexer = new \Citfact\FilterSubscribe\FilterLexer(); foreach ($arResult['ITEMS'] as $key => $filter) { $arResult['ITEMS'][$key]['FILTER_LINK'] = $filterLexer->getFilterUniqId(unserialize($filter['FILTER']));
/** * 故事评价:用鲜花或鸡蛋表达 */ public function appraise() { $id = (int) $this->input->get('id'); $type = (int) $this->input->get('type'); $return = $this->_modelStory->appraise($id, $type); CAjax::result($return); }
/** * 删除用户 */ public function drop() { $id = $this->input->post('id'); $return = $this->_modelPay->deletepay($id); $repArr = array('0', 'successful'); if ($return !== true) { $repArr = array('1001', 'fail'); } CAjax::show($repArr[0], $repArr[1]); }
/** * 编辑密码 */ public function password() { $id = $this->input->get('id'); $password = $this->input->post('password'); $return = $this->_modelOrder->setPassword($id, $password); $repArr = array('0', 'successful'); if ($return !== true) { $repArr = array('1001', 'fail'); } CAjax::show($repArr[0], $repArr[1]); }
public function setPage() { if (file_exists("Includes/config.inc.php")) { require_once "Includes/config.inc.php"; $logged = -1; $session = new USession(); $VIndex = new VIndex(); $controller = $VIndex->getController(); $task = $VIndex->getTask(); if ($controller == "log" && ($task == "in" || $task == "out")) { $CLog = new CLog(); $CLog->mux(); $VIndex->deleteController(); $VIndex->deleteTask(); } $logged = $session->getValue('type'); if ($logged === false) { $logged = -1; } if ($VIndex->isClient()) { $CAjax = new CAjax(); $CAjax->mux($logged); } else { $content = $this->mux($logged); $logged = $session->getValue('type'); if ($logged === false) { $logged = -1; } $VIndex->setContent($content); if ($logged >= 0) { $VIndex->setLoggedPage(); } else { $VIndex->setGuestPage(); } $VIndex->showPage(); } } else { $CSetup = new CSetup(); $CSetup->mux(); } }
/** * ajax获取项目列表 */ public function getList() { $page = $this->input->get('page', true); $data = $this->_modelItem->getList($page); //格式化为json输出 $list = array(); if ($data) { foreach ($data as $itemId => $planItem) { $list[$itemId] = array('item' => $planItem->row, 'goods' => $planItem->goods->rows); } } CAjax::show(0, 'successful', $list); }
/** * 注册院校专业 */ protected function regMajor() { if (REQUEST_METHOD == 'POST') { $academy = $this->input->post('academy', true); $major = $this->input->post('major', true); $this->setSession('academy', $academy); $this->setSession('major', $major); //保存注册 $return = $this->regSave(); CAjax::result($return); } else { CView::show('register/reg_gender'); } }
die; } $file = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/lang/" . LANGUAGE_ID . "/template.php")); __IncludeLang($file); if (empty($arResult["ELEMENTS_LIST"])) { return true; } elseif (!$this->__component->__parent || strpos($this->__component->__parent->__name, "photogallery") === false) { $GLOBALS['APPLICATION']->SetAdditionalCSS('/bitrix/components/bitrix/photogallery/templates/.default/style.css'); $GLOBALS['APPLICATION']->SetAdditionalCSS('/bitrix/components/bitrix/photogallery/templates/.default/themes/gray/style.css'); } $GLOBALS['APPLICATION']->AddHeadScript('/bitrix/js/main/utils.js'); $GLOBALS['APPLICATION']->AddHeadScript("/bitrix/components/bitrix/photogallery.detail.list/templates/slider_big/script_cursor.js"); if ($GLOBALS['USER']->IsAuthorized()) { $GLOBALS['APPLICATION']->AddHeadScript('/bitrix/js/main/admin_tools.js'); } CAjax::Init(); $arTemplates = array("default" => GetMessage("P_DEFAULT_TEMPLATE"), "square" => GetMessage("P_SQUARE_TEMPLATE"), "rectangle" => GetMessage("P_RECTANGLE_TEMPLATE"), "table" => "table", "ascetic" => "ascetic"); /******************************************************************** Input params ********************************************************************/ // PICTURE $temp = array("STRING" => preg_replace("/[^0-9]/is", "/", $arParams["THUMBNAIL_SIZE"])); list($temp["WIDTH"], $temp["HEIGHT"]) = explode("/", $temp["STRING"]); $arParams["THUMBNAIL_SIZE"] = intVal($temp["WIDTH"]) > 0 ? intVal($temp["WIDTH"]) : 120; if ($arParams["PICTURES_SIGHT"] != "standart" && intVal($arParams["PICTURES"][$arParams["PICTURES_SIGHT"]]["size"]) > 0) { $arParams["THUMBNAIL_SIZE"] = $arParams["PICTURES"][$arParams["PICTURES_SIGHT"]]["size"]; } $arParams["PERCENT"] = intVal($arParams["PERCENT"]) > 0 ? intVal($arParams["PERCENT"]) : 60; $arParams["percent_width"] = $arParams["percent_height"] = 100; $arParams["ID"] = md5(serialize(array("default", $arParams["FILTER"], $arParams["SORTING"]))); $arParams["~TEMPLATE"] = trim(strtolower($arParams["TEMPLATE"]));
<? $APPLICATION->AddHeadScript( SITE_TEMPLATE_PATH . '/js/jquery.inputmask.bundle.min.js', true ) ?> <? $APPLICATION->AddHeadString( '<script>BX.message(' . CUtil::PhpToJSObject( $MESS, false ) . ')</script>', true ); ?> <? $APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH . '/js/detectmobilebrowser.js'); ?> <? $APPLICATION->AddHeadScript(SITE_TEMPLATE_PATH . '/js/general.js'); ?> </head> <body> <? CAjax::Init(); ?> <div id="panel"><? $APPLICATION->ShowPanel(); ?></div> <? if (!CModule::IncludeModule("aspro.allcorp")): ?> <? $APPLICATION->SetTitle(GetMessage("ERROR_INCLUDE_MODULE_ALLCORP_TITLE")); ?> <div class="include_module_error"> <img src="<?php echo SITE_TEMPLATE_PATH; ?> /images/error.jpg" title=":-("> <p><?php echo GetMessage("ERROR_INCLUDE_MODULE_ALLCORP_TEXT"); ?> </p> </div> <? die(); ?>
<?php // define("NO_KEEP_STATISTIC", true); // define("NOT_CHECK_PERMISSIONS", true); require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php"; $APPLICATION->SetTitle(""); $hash = $_GET['hash']; if ($url = CAjax::decodeURI($hash)) { LocalRedirect($url); } else { LocalRedirect('/'); } require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php";
/** * 用户登出 */ public function logout() { $this->_user->logout(); CAjax::show(0, 'successful'); }
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } $bChecked = false; if ($arResult['FILTER_VALUES'][$arParams['FILTER_NAME'] . '_IS_ONLINE']) { if ($key = array_search($arParams['FILTER_NAME'] . '_IS_ONLINE', $arResult['FILTER_PARAMS'], true)) { $bChecked = true; unset($arResult['FILTER_PARAMS'][$key]); } } $arParams['LIST_URL'] .= strpos($arParams['LIST_URL'], '?') === false ? '?' : '&'; $arExtraVars = array('current_view' => $arParams['CURRENT_VIEW'], 'current_filter' => $arParams['CURRENT_FILTER']); $extraUrl = 'set_filter_' . $arParams['FILTER_NAME'] . '=Y' . GetFilterParams($arResult['FILTER_PARAMS'], true, $arExtraVars); // ajax mode hack - especially for complex component if ($arParams['AJAX_MODE'] == 'Y') { $url = CAjax::AddSessionParam($arParams['LIST_URL'] . $extraUrl, $arParams['AJAX_ID']); $onclick = 'jsAjaxUtil.InsertDataToNode(\'' . CUtil::JSEscape($url) . '\' + (this.checked ? \'' . CUtil::JSEscape('&' . $arParams['FILTER_NAME'] . '_IS_ONLINE=Y') . '\' : \'\'), \'comp_' . $arParams['AJAX_ID'] . '\', ' . ($arParams['AJAX_OPTION_SHADOW'] == 'Y' ? 'true' : 'false') . ');'; } else { $onclick = 'window.location.href=\'' . CUtil::JSEscape($arParams['LIST_URL'] . $extraUrl) . '\' + (this.checked ? \'' . CUtil::JSEscape('&' . $arParams['FILTER_NAME'] . '_IS_ONLINE=Y') . '\' : \'\')'; } ?> <input type="checkbox" name="<?php echo $arParams['FILTER_NAME'] . '_IS_ONLINE'; ?> " value="Y" <?php echo $bChecked ? 'checked="checked"' : ''; ?> id="<?php echo $arParams['FILTER_NAME'] . '_IS_ONLINE'; ?> " title="<?php
function _PrepareAdditionalData() { /** @global CMain $APPLICATION */ global $APPLICATION; // get CSS changes list if ($this->bStyle) { $arCSSList = $APPLICATION->sPath2css; $cnt_old = count($this->arCSSList); $cnt_new = count($arCSSList); $arCSSNew = array(); if ($cnt_old != $cnt_new) { for ($i = $cnt_old; $i < $cnt_new; $i++) { $css_path = $arCSSList[$i]; if (strtolower(substr($css_path, 0, 7)) != 'http://' && strtolower(substr($css_path, 0, 8)) != 'https://') { if (($p = strpos($css_path, "?")) > 0) { $css_file = substr($css_path, 0, $p); } else { $css_file = $css_path; } if (file_exists($_SERVER["DOCUMENT_ROOT"] . $css_file)) { $arCSSNew[] = $arCSSList[$i]; } } else { $arCSSNew[] = $arCSSList[$i]; } } } } // get scripts changes list $arHeadScripts = $APPLICATION->arHeadScripts; $cnt_old = count($this->arHeadScripts); $cnt_new = count($arHeadScripts); $arHeadScriptsNew = array(); if ($cnt_old != $cnt_new) { for ($i = $cnt_old; $i < $cnt_new; $i++) { $arHeadScriptsNew[] = $arHeadScripts[$i]; } } if (!$APPLICATION->oAsset->optimizeJs()) { $arHeadScriptsNew = array_merge(CJSCore::GetScriptsList(), $arHeadScriptsNew); } // prepare additional data $arAdditionalData = array(); $arAdditionalData['TITLE'] = htmlspecialcharsback($APPLICATION->GetTitle()); $arAdditionalData['WINDOW_TITLE'] = htmlspecialcharsback($APPLICATION->GetTitle('title')); $arAdditionalData['SCRIPTS'] = array(); $arHeadScriptsNew = array_unique($arHeadScriptsNew); foreach ($arHeadScriptsNew as $script) { $arAdditionalData['SCRIPTS'][] = CUtil::GetAdditionalFileURL($script); } if (null !== $this->__nav_params) { $arAdditionalData['NAV_CHAIN'] = $APPLICATION->GetNavChain($this->__nav_params[0], $this->__nav_params[1], $this->__nav_params[2], $this->__nav_params[3], $this->__nav_params[4]); } if ($this->bStyle) { $arAdditionalData["CSS"] = array(); /** @noinspection PhpUndefinedVariableInspection */ $arCSSNew = array_unique($arCSSNew); foreach ($arCSSNew as $style) { $arAdditionalData['CSS'][] = CUtil::GetAdditionalFileURL($style); } } $additional_data = '<script type="text/javascript" bxrunfirst="true">' . "\n"; $additional_data .= 'var arAjaxPageData = ' . CUtil::PhpToJSObject($arAdditionalData) . ";\r\n"; $additional_data .= 'top.BX.ajax.UpdatePageData(arAjaxPageData)' . ";\r\n"; $additional_data .= '</script><script type="text/javascript">'; if (!$this->bIFrameMode && $this->bHistory) { $additional_data .= 'top.BX.ajax.history.put(window.AJAX_PAGE_STATE.getState(), \'' . CUtil::JSEscape(CAjax::encodeURI($APPLICATION->GetCurPageParam('', array(BX_AJAX_PARAM_ID), false))) . '\')' . ";\r\n"; } if ($this->bJump) { if ($this->bIFrameMode) { $additional_data .= 'top.setTimeout(\'BX.scrollToNode("comp_' . $this->componentID . '")\', 100)' . ";\r\n"; } else { $additional_data .= 'top.BX.scrollToNode(\'comp_' . $this->componentID . '\')' . ";\r\n"; } } $additional_data .= '</script>'; echo $additional_data; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (strlen($arParams["START_PAGE"]) <= 0) { $arParams["START_PAGE"] = 'new'; } if ($arParams["AJAX_MODE"] == "Y") { $ajaxSession = CAjax::GetSession(); if ($ajaxSession && $arParams["AJAX_ID"] != $ajaxSession) { return; } } if (CModule::IncludeModule("form")) { $componentPage = ""; if ($arParams["SEF_MODE"] == "Y") { // SEF mode enabled $WEB_FORM_ID_TEMP = $arParams["WEB_FORM_ID"]; $arDefaultUrlTemplates404 = array("new" => "#WEB_FORM_ID#/", "list" => "#WEB_FORM_ID#/list/", "edit" => "#WEB_FORM_ID#/edit/#RESULT_ID#/", "view" => "#WEB_FORM_ID#/view/#RESULT_ID#/", "success" => ""); $arDefaultVariableAliases404 = array(); $arDefaultVariableAliases = array(); $arComponentVariables = array("WEB_FORM_ID", "RESULT_ID"); $arVariables = array(); $arComponentPage = array_keys($arDefaultUrlTemplates404); $arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]); $arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams["VARIABLE_ALIASES"]); // get current component page if (array_key_exists($arVariables["page"], $arDefaultUrlTemplates404)) { $componentPage = $arVariables["page"]; }
public static function ClearForm($form_params, $ajax_id = false) { $form_params = str_replace(CAjax::GetSessionParam($ajax_id), '', $form_params); return '<form ' . trim($form_params) . '>'; }
/** * Restarts buffer if the ajax-request */ private function startAjax() { if ($this->arParams['USE_AJAX'] !== 'Y') { return false; } if (strlen($this->arParams['AJAX_PARAM_NAME']) <= 0) { $this->arParams['AJAX_PARAM_NAME'] = 'compid'; } if (strlen($this->arParams['AJAX_COMPONENT_ID']) <= 0) { $this->arParams['AJAX_COMPONENT_ID'] = \CAjax::GetComponentID($this->getName(), $this->getTemplateName(), $this->ajaxComponentIdSalt); } if ($this->isAjax()) { global $APPLICATION; if ($this->arParams['AJAX_HEAD_RELOAD'] === 'Y') { $APPLICATION->ShowAjaxHead(); } else { $APPLICATION->RestartBuffer(); } if ($this->arParams['AJAX_TYPE'] === 'JSON') { header('Content-Type: application/json'); } if (strlen($this->arParams['AJAX_TEMPLATE_PAGE']) > 0) { $this->templatePage = basename($this->arParams['AJAX_TEMPLATE_PAGE']); } } }
public static function result($boolean) { $boolean === true ? CAjax::success() : CAjax::fail(); }