Beispiel #1
0
	function ShowPanel()
	{
		if ($GLOBALS["USER"]->IsAdmin() && COption::GetOptionString("main", "wizard_solution", "", SITE_ID) == "eshop")
		{
			$GLOBALS["APPLICATION"]->SetAdditionalCSS("/bitrix/wizards/bitrix/eshop/css/panel.css"); 

			$arMenu = Array(
				Array(		
					"ACTION" => "jsUtils.Redirect([], '".CUtil::JSEscape("/bitrix/admin/wizard_install.php?lang=".LANGUAGE_ID."&wizardSiteID=".SITE_ID."&wizardName=bitrix:eshop&".bitrix_sessid_get())."')",
					"ICON" => "bx-popup-item-wizard-icon",
					"TITLE" => GetMessage("STOM_BUTTON_TITLE_W1"),
					"TEXT" => GetMessage("STOM_BUTTON_NAME_W1"),
				)
			);

			$GLOBALS["APPLICATION"]->AddPanelButton(array(
				"HREF" => "/bitrix/admin/wizard_install.php?lang=".LANGUAGE_ID."&wizardName=bitrix:eshop&wizardSiteID=".SITE_ID."&".bitrix_sessid_get(),
				"ID" => "eshop_wizard",
				"ICON" => "bx-panel-site-wizard-icon",
				"MAIN_SORT" => 2500,
				"TYPE" => "BIG",
				"SORT" => 10,	
				"ALT" => GetMessage("SCOM_BUTTON_DESCRIPTION"),
				"TEXT" => GetMessage("SCOM_BUTTON_NAME"),
				"MENU" => $arMenu,
			));
		}
	}
Beispiel #2
0
 /**
  * Upgrade version method
  */
 public function actionUpgradeversion()
 {
     // check is newest
     $aryVersionData = $this->actionHasnew(true);
     $isok = 0;
     $data = array();
     $msg = "";
     try {
         if ($aryVersionData['ISOK'] !== 1 || empty($aryVersionData['DATA']['v'])) {
             throw new CModelException(CUtil::i18n('exception,version_upgrad_withoutUpgrad'));
         }
         // get up to version
         $strVersion = $aryVersionData['DATA']['v'];
         if (empty($strVersion)) {
             throw new CModelException(CUtil::i18n('exception,version_upgrad_upgradFaild'));
         }
         if ($strVersion <= CUR_VERSION_NUM) {
             throw new CModelException(CUtil::i18n('exception,version_upgrad_withoutUpgrad'));
         }
         // execute upgrade
         $command = SUDO_COMMAND . "cd " . WEB_ROOT . ";" . SUDO_COMMAND . "wget " . MAIN_DOMAIN . "/down/v{$strVersion}.zip;" . SUDO_COMMAND . "unzip -o v{$strVersion}.zip;" . SUDO_COMMAND . "rm -rf v{$strVersion}.zip;";
         exec($command);
         $isok = 1;
     } catch (CModelException $e) {
         $msg = $e->getMessage();
     } catch (CException $e) {
         $msg = NBT_DEBUG ? $e->getMessage() : CUtil::i18n('exception,sys_error');
     }
     header('Content-Type: text/html; charset=utf-8');
     echo $this->encodeAjaxData($isok, $data, $msg);
     exit;
 }
Beispiel #3
0
    function __CrmFieldMultiEditRenderItem($item, $mnemonic, $typeID, $referenceData, $editorID)
    {
        $itemID = isset($item['ID']) ? $item['ID'] : '';
        $itemVal = isset($item['VALUE']) ? $item['VALUE'] : '';
        ?>
<div class="bx-crm-edit-fm-item">
		<input type="text" class="bx-crm-edit-input" name="<?php 
        echo htmlspecialcharsbx($mnemonic);
        ?>
[<?php 
        echo htmlspecialcharsbx($typeID);
        ?>
][<?php 
        echo htmlspecialcharsbx($itemID);
        ?>
][VALUE]" value="<?php 
        echo htmlspecialcharsbx($itemVal);
        ?>
"><?php 
        echo SelectBoxFromArray(CUtil::JSEscape($mnemonic) . '[' . htmlspecialcharsbx($typeID) . '][' . htmlspecialcharsbx($itemID) . '][VALUE_TYPE]', $referenceData, isset($item['VALUE_TYPE']) ? $item['VALUE_TYPE'] : '', '', "class='bx-crm-edit-input bx-crm-edit-input-small'");
        ?>
<div class="delete-action" onclick="BX.CrmFieldMultiEditor.items['<?php 
        echo CUtil::addslashes($editorID);
        ?>
'].deleteItem('<?php 
        echo CUtil::addslashes($itemID);
        ?>
');" title="<?php 
        echo GetMessage('CRM_STATUS_LIST_DELETE');
        ?>
"></div>
		</div><?php 
    }
Beispiel #4
0
	public function Authorize()
	{	
	//	var_dump( $skip_check_user_data);
		$GLOBALS["APPLICATION"]->RestartBuffer();
		
		if(isset($_REQUEST["vk_session"]["user"]["id"]))
		{	
			global $skip_check_user_data;
			if(self::CheckUserData($_REQUEST["vk_session"]["sig"]) || $skip_check_user_data)
			{
				CUtil::decodeURIComponent($_REQUEST);

				$u_id = $_REQUEST["vk_session"]["user"]["id"];
				$arFields = array(
					'EXTERNAL_AUTH_ID' => self::ID,
					'WORK_NOTES' => self::ID, //это для того, чтоб можно было избавится от EXTERNAL_AUTH_ID и разрешить авторизовываться несколькими способами одновременно
					'XML_ID' => $u_id,
					'LOGIN' => "id".$u_id,
					'NAME'=> $_REQUEST["vk_session"]["user"]["first_name"],
					'LAST_NAME'=> $_REQUEST["vk_session"]["user"]["last_name"],
				);
				
				if($this->AuthorizeUser($arFields)){
					if($skip_check_user_data){
						return true;		
					}
					die("OK");
				}	
			}
		}
		die("FAILURE");
	}
Beispiel #5
0
 protected static function getJSPrice(array $prices)
 {
     if (empty($prices)) {
         return "";
     }
     return '(function(value){var prices=' . \CUtil::PhpToJSObject($prices) . '; return prices[value]["PRICE"];})(this.value)';
 }
Beispiel #6
0
function getJsTitle()
{
    $title = $GLOBALS["APPLICATION"]->GetTitle("title", true);
    $title = html_entity_decode($title, ENT_QUOTES, SITE_CHARSET);
    $title = CUtil::JSEscape($title);
    return $title;
}
Beispiel #7
0
 protected function doPostAction($isEdit, $action)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     if ($isEdit) {
         $APPLICATION->RestartBuffer();
         header('Content-Type: application/json', true);
         echo CSecurityJsonHelper::encode($this->arResult);
         die;
     } else {
         switch ($action) {
             case 'download':
                 $APPLICATION->restartBuffer();
                 header('Content-Type: text/plain', true);
                 header('Content-Disposition: attachment; filename="recovery_codes.txt"');
                 header('Content-Transfer-Encoding: binary');
                 header(sprintf('Content-Length: %d', CUtil::BinStrlen($this->arResult['PLAIN_RESPONSE'])));
                 echo $this->arResult['PLAIN_RESPONSE'];
                 exit;
                 break;
             case 'print':
                 $APPLICATION->restartBuffer();
                 $this->includeComponentTemplate(static::PRINT_PAGE);
                 exit;
                 break;
             case 'view':
             default:
                 $this->includeComponentTemplate(static::VIEW_PAGE);
                 break;
         }
     }
 }
Beispiel #8
0
    function __sbpc_bind_post_to_form($xml_id, $form_id_get = null, $arParams)
    {
        static $form_id = null;
        if ($form_id_get !== null) {
            $form_id = $form_id_get;
            return;
        }
        ?>
<script type="text/javascript">BX.ready(function(){__blogLinkEntity({'<?php 
        echo CUtil::JSEscape($xml_id);
        ?>
' : ['BG', <?php 
        echo $arParams["ID"];
        ?>
, '<?php 
        echo $arParams["LOG_ID"];
        ?>
']}, <?php 
        if ($form_id == null) {
            ?>
 window.SBPC.form.id<?php 
        } else {
            ?>
"<?php 
            echo $form_id;
            ?>
"<?php 
        }
        ?>
);});</script><?php 
    }
Beispiel #9
0
 public static function AddByChannel($channelId, $arParams = array())
 {
     global $DB;
     if (!is_array($channelId)) {
         $channelId = array($channelId);
     }
     if (strlen($arParams['module_id']) > 0 || strlen($arParams['command']) > 0) {
         $arData = array('module_id' => $arParams['module_id'], 'command' => $arParams['command'], 'params' => is_array($arParams['params']) ? $arParams['params'] : array());
         if (CPullOptions::GetQueueServerStatus()) {
             $command = array('MESSAGE' => array($arData), 'ERROR' => '');
             if (!is_array($channelId) && CPullOptions::GetQueueServerVersion() == 1) {
                 $command['CHANNEL_ID'] = $channelId;
             }
             $message = CUtil::PhpToJsObject($command);
             if (!defined('BX_UTF') || !BX_UTF) {
                 $message = $GLOBALS['APPLICATION']->ConvertCharset($message, SITE_CHARSET, 'utf-8');
             }
             $res = CPullChannel::Send($channelId, str_replace("\n", " ", $message));
             $result = $res ? true : false;
         } else {
             foreach ($channelId as $channel) {
                 $arParams = array('CHANNEL_ID' => $channel, 'MESSAGE' => str_replace("\n", " ", serialize($arData)), '~DATE_CREATE' => $DB->CurrentTimeFunction());
                 $res = IntVal($DB->Add("b_pull_stack", $arParams, array("MESSAGE")));
                 $result = $res ? true : false;
             }
         }
         if (isset($arParams['push_text']) && strlen($arParams['push_text']) > 0 && isset($arParams['push_user']) && intval($arParams['push_user']) > 0) {
             $CPushManager = new CPushManager();
             $CPushManager->AddQueue(array('USER_ID' => $arParams['push_user'], 'MESSAGE' => str_replace("\n", " ", $arParams['push_text']), 'PARAMS' => $arParams['push_params'], 'BADGE' => isset($arParams['push_badge']) ? intval($arParams['push_badge']) : '', 'TAG' => isset($arParams['push_tag']) ? $arParams['push_tag'] : '', 'SUB_TAG' => isset($arParams['push_sub_tag']) ? $arParams['push_sub_tag'] : '', 'APP_ID' => isset($arParams['push_app_id']) ? $arParams['push_app_id'] : ''));
         }
         return $result;
     }
     return false;
 }
Beispiel #10
0
 public static function AddByChannel($channelId, $arParams = array())
 {
     global $DB;
     if (!is_array($channelId)) {
         $channelId = array($channelId);
     }
     $result = false;
     if (strlen($arParams['module_id']) > 0 || strlen($arParams['command']) > 0) {
         $arData = array('module_id' => $arParams['module_id'], 'command' => $arParams['command'], 'params' => is_array($arParams['params']) ? $arParams['params'] : array());
         if (CPullOptions::GetQueueServerStatus()) {
             $command = array('SERVER_TIME_WEB' => time(), 'SERVER_NAME' => COption::GetOptionString('main', 'server_name', $_SERVER['SERVER_NAME']), 'MESSAGE' => array($arData), 'ERROR' => '');
             if (!is_array($channelId) && CPullOptions::GetQueueServerVersion() == 1) {
                 $command['CHANNEL_ID'] = $channelId;
             }
             $message = CUtil::PhpToJsObject($command);
             if (!defined('BX_UTF') || !BX_UTF) {
                 $message = $GLOBALS['APPLICATION']->ConvertCharset($message, SITE_CHARSET, 'utf-8');
             }
             $options = isset($arParams['expiry']) ? array('expiry' => intval($arParams['expiry'])) : array();
             $res = CPullChannel::Send($channelId, str_replace("\n", " ", $message), $options);
             $result = $res ? true : false;
         } else {
             foreach ($channelId as $channel) {
                 $arParams = array('CHANNEL_ID' => $channel, 'MESSAGE' => str_replace("\n", " ", serialize($arData)), '~DATE_CREATE' => $DB->CurrentTimeFunction());
                 $res = IntVal($DB->Add("b_pull_stack", $arParams, array("MESSAGE")));
                 $result = $res ? true : false;
             }
         }
         return $result;
     }
     return false;
 }
function print_rrr($var)
{
    if (is_array($var)) {
        if ($var == array_values($var)) {
            foreach ($var as $key => $value) {
                $var[$key] = print_rrr($value);
            }
            return "Array(" . implode(", ", $var) . ")";
        }
        $res = "\nArray(\n";
        $first = true;
        foreach ($var as $key => $value) {
            if ($first) {
                $first = false;
            } else {
                $res .= ",\n";
            }
            $res .= "'" . CUtil::JSEscape($key) . "' => " . print_rrr($value);
        }
        $res .= "\n)";
        return $res;
    } elseif (is_bool($var)) {
        if ($var === true) {
            return 'true';
        } else {
            return 'false';
        }
    } else {
        return "'" . CUtil::JSEscape($var) . "'";
    }
}
 public function fetchUserDetails($ident, $type)
 {
     $search_cond = 'users.user_id = ' . $ident;
     if ($type == 'code') {
         $search_cond = 'users.user_code = ' . $ident;
     }
     $user_details = array();
     $user_details['err_msg'] = '';
     $user_details['own_profile'] = 'No';
     $udetails = User::whereRaw($search_cond)->first(array('users.first_name', 'users.id', 'users.last_name', 'users.email', 'users.activated', 'users.activated_at'));
     if (count($udetails) > 0) {
         $user_details['user_code'] = CUtil::setUserCode($udetails['id']);
         $user_details['email'] = $udetails['email'];
         $user_details['user_id'] = $user_id = $udetails['id'];
         $user_details['first_name'] = $udetails['first_name'];
         $user_details['last_name'] = $udetails['last_name'];
         $user_display_name = $udetails['first_name'] . ' ' . substr($udetails['last_name'], 0, 1);
         $user_details['display_name'] = ucwords($user_display_name);
         $user_details['activated_at'] = $udetails['activated_at'];
         $user_details['activated'] = $udetails['activated'];
     } else {
         $user_details['err_msg'] = 'No such user found';
     }
     return $user_details;
 }
Beispiel #13
0
 function ShowPanel()
 {
     if ($GLOBALS["USER"]->IsAdmin() && COption::GetOptionString("main", "wizard_solution", "", SITE_ID) == "eshop") {
         $GLOBALS["APPLICATION"]->SetAdditionalCSS("/bitrix/wizards/bitrix/eshop/css/panel.css");
         $arMenu = array(array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape("/bitrix/admin/wizard_install.php?lang=" . LANGUAGE_ID . "&wizardSiteID=" . SITE_ID . "&wizardName=bitrix:eshop&" . bitrix_sessid_get()) . "')", "ICON" => "bx-popup-item-wizard-icon", "TITLE" => GetMessage("STOM_BUTTON_TITLE_W1"), "TEXT" => GetMessage("STOM_BUTTON_NAME_W1")), array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape("/bitrix/admin/wizard_install.php?lang=" . LANGUAGE_ID . "&site_id=" . SITE_ID . "&wizardName=bitrix:eshop.mobile&" . bitrix_sessid_get()) . "')", "ICON" => "bx-popup-item-wizard-icon", "TITLE" => GetMessage("STOM_BUTTON_TITLE_W5"), "TEXT" => GetMessage("STOM_BUTTON_NAME_W5")));
         /*if(COption::GetOptionString("bitrix.eshop", "demo_deleted", "", SITE_ID) != 'Y')
         			{
         				CModule::IncludeModule("iblock");
         				$dbr = CIBlock::GetList(Array(), Array("XML_ID"=>"furniture_".SITE_ID));
          				if($arR = $dbr->Fetch())
         				{
         					if($_REQUEST['delete_demo']=='eshop' && check_bitrix_sessid())
         					{
         				    		if(CIBlock::Delete($arR['ID']))
         				    		{
         				    			DeleteDirFilesEx(SITE_DIR.'catalog/furniture');
         								COption::GetOptionString("bitrix.eshop", "demo_deleted", "Y", SITE_ID);
         				    		}
         							unset($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]);
         					}
         					else
         				 		$arMenu[] = Array(		
         							"ACTION" => "if(confirm('".GetMessage("STOM_BUTTON_CONFIRM_W2")."')) jsUtils.Redirect([], '".CUtil::JSEscape(SITE_DIR)."catalog/?delete_demo=eshop&".bitrix_sessid_get()."');",
         							"ICON" => "bx-popup-item-delete-icon",
         							"TITLE" => GetMessage("STOM_BUTTON_TITLE_W3"),
         							"TEXT" => GetMessage("STOM_BUTTON_NAME_W3"),
         						);
         				}
         				else
         					COption::SetOptionString("bitrix.eshop", "demo_deleted", "Y", "", SITE_ID);
         
         			}  */
         $GLOBALS["APPLICATION"]->AddPanelButton(array("HREF" => "/bitrix/admin/wizard_install.php?lang=" . LANGUAGE_ID . "&wizardName=bitrix:eshop&wizardSiteID=" . SITE_ID . "&" . bitrix_sessid_get(), "ID" => "eshop_wizard", "ICON" => "bx-panel-site-wizard-icon", "MAIN_SORT" => 2500, "TYPE" => "BIG", "SORT" => 10, "ALT" => GetMessage("SCOM_BUTTON_DESCRIPTION"), "TEXT" => GetMessage("SCOM_BUTTON_NAME"), "MENU" => $arMenu));
     }
 }
Beispiel #14
0
	function addWMVJSConfig(&$str, $key, $value, $default = false)
	{
		if (!isset($value) || $value == '' || $value === $default)
			return;
		if ($str != '{')
			$str .= ',';
		$str .= $key.': \''.CUtil::JSEscape($value).'\'';
	}
Beispiel #15
0
 public function GetValue()
 {
     $result = $this->value;
     if (ord($result[0]) == 0x0) {
         $result = CUtil::BinSubstr($result, 1);
     }
     return $result;
 }
Beispiel #16
0
 /**
  * Index method
  */
 public function actionIndex()
 {
     //检查是否登入
     Nbt::app()->login->checkIsLogin();
     $this->replaceSeoTitle(CUtil::i18n('controllers,monitor_index_seoTitle'));
     $aryData = array();
     $this->render('index', $aryData);
 }
Beispiel #17
0
function InputTags($sName="", $sValue="", $arSites=array(), $sHTML="", $sId="")
{
	if(!$sId)
		$sId = GenerateUniqId($sName);
	TagsShowScript();
	$order = class_exists("cuseroptions")? CUserOptions::GetOption("search_tags", "order", "CNT"): "CNT";
	return '<input name="'.htmlspecialcharsbx($sName).'" id="'.htmlspecialcharsbx($sId).'" type="text" autocomplete="off" value="'.htmlspecialcharsex($sValue).'" onfocus="'.htmlspecialcharsbx('window.oObject[this.id] = new JsTc(this, '.CUtil::PhpToJSObject($arSites).');').'" '.$sHTML.'/><input type="checkbox" id="ck_'.$sId.'" name="ck_'.htmlspecialcharsbx($sName).'" '.($order=="NAME"? "checked": "").' title="'.GetMessage("SEARCH_TAGS_SORTING_TIP").'">';
}
Beispiel #18
0
 function __fcParseAnswer(&$output, $arParams, $arResult)
 {
     $GLOBALS["APPLICATION"]->RestartBuffer();
     while (ob_end_clean()) {
     }
     echo CUtil::PhpToJSObject($arResult["OUTPUT_LIST"]["JSON"]);
     die;
 }
Beispiel #19
0
 public static function GetPathTemplateParam($menuType, $ID, $parameterName, $defaultValue = "", $parentID = "URL_TEMPLATES")
 {
     if ($menuType == "LISTS") {
         return array("PARENT" => $parentID, "NAME" => $parameterName, "TYPE" => "STRING", "DEFAULT" => $defaultValue);
     } else {
         return array("PARENT" => $parentID, "NAME" => $parameterName, "TYPE" => "CUSTOM", "DEFAULT" => $defaultValue, "JS_FILE" => BX_ROOT . "/js/iblock/path_templates.js", "JS_EVENT" => "IBlockComponentProperties", "JS_DATA" => str_replace("\n", "", CUtil::PhpToJSObject(array("mnu_" . $ID, 5000, CListsParameters::GetPathTemplateMenuItems($menuType, "window.IBlockComponentPropertiesObj.Action", "mnu_" . $ID)))));
     }
 }
Beispiel #20
0
 function GetHTML($params)
 {
     $html = '';
     $max_size = 102400;
     $max_width = 150;
     $max_height = 150;
     $url_template = '';
     $show_input = true;
     $show_info = true;
     if (is_array($params)) {
         if (isset($params['max_size'])) {
             $max_size = intval($params['max_size']);
         }
         if (isset($params['max_width'])) {
             $max_width = intval($params['max_width']);
         }
         if (isset($params['max_height'])) {
             $max_height = intval($params['max_height']);
         }
         if (isset($params['url_template'])) {
             $url_template = $params['url_template'];
         }
         if (isset($params['show_input'])) {
             $show_input = (bool) $params['show_input'];
         }
         if (isset($params['show_info'])) {
             $show_info = (bool) $params['show_info'];
         }
     }
     if ($show_input) {
         $html .= $this->_ob_file->GetInputHTML(array('show_info' => true, 'input_name' => $this->_input_name));
     } elseif ($show_info) {
         $html .= $this->_ob_file->GetInfoHTML();
     }
     if ($this->_ob_file->IsImage() && $this->_ob_file->GetSize() < $max_size) {
         $html .= '<br />';
         //Popup link
         $bPopUp = $this->_ob_file->GetWidth() > $max_width || $this->_ob_file->GetHeight() > $max_height;
         if ($bPopUp) {
             $img_src = $this->_ob_file->GetImgSrc(array('url_template' => $url_template));
             $img_onclick = "ImgShw('" . CUtil::JSEscape($img_src) . "', '" . $this->_ob_file->GetWidth() . "', '" . $this->_ob_file->GetHeight() . "', ''); return false;";
             $html .= '<a title="' . htmlspecialcharsbx($params['a_title']) . '" onclick="' . htmlspecialcharsbx($img_onclick) . '" href="' . htmlspecialcharsbx($img_src) . '" target="_blank">';
             ob_start();
             CFile::OutputJSImgShw();
             $html .= ob_get_contents();
             ob_end_clean();
         }
         //img tag
         $html .= $this->_ob_file->GetImgHtml(array('url_template' => $url_template, 'max_width' => $max_width, 'max_height' => $max_height, 'html_attributes' => array('border' => '0')));
         //Close popup link
         if ($bPopUp) {
             $html .= '</a>';
         }
     } else {
         $html .= '<br />' . $this->_ob_file->GetLinkHtml(array('url_template' => $url_template, 'download_text' => $params['download_text']));
     }
     return $html;
 }
Beispiel #21
0
 /**
  * 用户信息
  * @param string $strVerifyType 登入形式,例如输入密码登入 或者cookie登入
  * @param array $aryUserInfo 传进来的用户数据
  * 
  * @author zhangyi
  * @date 2014-5-29
  */
 public function checkLogin($aryData = array())
 {
     if (empty($aryData)) {
         throw new CModelException(CUtil::i18n('exception,sys_error'));
     }
     $aryUserInfo = $this->getUserInfo();
     //验证用户名和密码
     return $aryUserInfo['uname'] === $aryData['uname'] && $aryUserInfo['pwd'] === $aryData['pwd'];
 }
Beispiel #22
0
 /**
  * @param $arParameter
  * @param array $arChooserCurVals - если arParameter[MULTIPLE] == Y
  * 			тогда надо обазательно пробрасывать arCurrentValues["PARAM_NAME"] во второй агрумент
  * @return array
  *
  * @example
  * $arChooserValues = (empty($arCurrentValues['CHOOSER'])?array():$arCurrentValues['CHOOSER']);
  * $arComponentParameters['PARAMETERS']['CHOOSER'] = $ParameterTools->getListChooser(
  * 		array(
  * 			'NAME' => 'CHOOSER',
  * 			'VALUES' => array(
  * 				'key1' => 'значение 1',
  * 				'key2' => 'значение 2',
  * 				'key3' => 'значение 3',
  * 				'key4' => 'значение 4',
  * 			),
  * 			'DEFAULT' => 'key2',
  * 			'MULTIPLE' => 'Y',
  * 			'PARENT' => 'BASE'
  * 		),
  * 		$arChooserValues
  * );
  */
 public function getListChooser($arParameter, &$arChooserCurVals = array())
 {
     if (!is_array($arChooserCurVals)) {
         $arChooserCurVals = array();
     }
     $arParameter['IX_CUR_VALS'] = array_flip($arChooserCurVals);
     //TODO: Сделать обработку $arParameter
     return array('NAME' => $arParameter['NAME'], 'TYPE' => 'CUSTOM', 'JS_DATA' => \CUtil::PhpToJSObject($arParameter), 'JS_FILE' => $this->_customParamsJSLib, 'JS_EVENT' => 'obx.componentParams.showListChooser');
 }
Beispiel #23
0
	public function translite($text)

	{

		$arParams = array("replace_space" => "-", "replace_other" => "-");

		return \CUtil::translit(trim($text), "ru", $arParams);

	}
Beispiel #24
0
 /**
  * Set new secret
  *
  * @param string $secret Secret (binary).
  * @return $this
  */
 public function setSecret($secret)
 {
     $this->secret = $secret;
     // Backward compatibility. This is the old logic and i can't change it right now:-(
     if (\CUtil::binStrlen($this->secret) > 25) {
         $this->digest = 'sha256';
     }
     return $this;
 }
Beispiel #25
0
 public function exec()
 {
     try {
         \CUtil::JSPostUnescape();
         $this->checkRequest();
         $this->processAction();
     } catch (\Exception $e) {
         $this->runProcessingException($e);
     }
 }
Beispiel #26
0
 /**
  * Returns batch of the message
  * @return string
  */
 public function getBatch()
 {
     $data = array("data" => array('contentTitle' => $this->title, "contentText" => $this->text, "messageParams" => $this->customProperties), "time_to_live" => $this->expiryValue, "registration_ids" => $this->deviceTokens);
     $data = CPushManager::_MakeJson($data, "", true);
     $batch = "Content-type: application/json\r\n";
     $batch .= "Content-length: " . CUtil::BinStrlen($data) . "\r\n";
     $batch .= "\r\n";
     $batch .= $data;
     return base64_encode($batch);
 }
Beispiel #27
0
 function __CrmMobileDealEditEndResonse($result)
 {
     $GLOBALS['APPLICATION']->RestartBuffer();
     Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
     if (!empty($result)) {
         echo CUtil::PhpToJSObject($result);
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
     die;
 }
Beispiel #28
0
 private static function injectDataParams()
 {
     $result = "";
     foreach (static::$data as $index => $arItem) {
         foreach ($arItem as $key => $value) {
             $jsValue = is_array($value) ? \CUtil::PhpToJSObject($value) : \CUtil::JSEscape($value);
             $result .= '_ba.push(["ad[' . $index . '][' . \CUtil::JSEscape($key) . ']", "' . $jsValue . '"]);';
         }
     }
     return $result;
 }
Beispiel #29
0
function __GetSubmenu($menu)
{
	global $aUserOpt, $bSkipRecent;

	$aPopup = array();
	if (is_array($menu))
	{
		foreach($menu as $item)
		{
			if(!is_array($item))
				continue;

			$aItem = array(
				"TEXT"=>$item["text"],
				"TITLE"=>($aUserOpt['start_menu_title'] <> 'N'? $item["title"] : ''),
				"ICON"=>$item["icon"],
			);
			if($item["url"] <> "")
			{
				$link = htmlspecialcharsback($item["url"]);
				if(strpos($link, "/bitrix/admin/") !== 0)
					$link = "/bitrix/admin/".$link;

				if ($_REQUEST['back_url_pub'])
					$link .= (strpos($link, '?') > 0 ? '&' : '?')."back_url_pub=".urlencode($_REQUEST["back_url_pub"]);

				$aItem['LINK'] = $link;

				if (!$bSkipRecent)
					$aItem['ONCLICK'] = 'BX.admin.startMenuRecent('.CUtil::PhpToJsObject($aItem).')';
			}

			if(is_array($item["items"]) && count($item["items"])>0)
			{
				$aItem["MENU"] = __GetSubmenu($item["items"]);
				if($item["url"] <> "" && $aUserOpt['start_menu_title'] <> 'N')
					$aItem["TITLE"] .= ' '.GetMessage("get_start_menu_dbl");
			}
			elseif($item["dynamic"] == true)
			{
				$aItem["MENU_URL"] = '/bitrix/admin/get_start_menu.php?mode=dynamic&lang='.LANGUAGE_ID.'&admin_mnu_module_id='.urlencode($item['module_id']).'&admin_mnu_menu_id='.urlencode($item['items_id']).($bSkipRecent?'&skip_recent=Y':'').($_REQUEST["back_url_pub"]<>''? '&back_url_pub='.urlencode($_REQUEST["back_url_pub"]):'').'&'.bitrix_sessid_get();
				$aItem['MENU_PRELOAD'] = false;

				if($item["url"] <> "" && $aUserOpt['start_menu_title'] <> 'N')
					$aItem["TITLE"] .= ' '.GetMessage("get_start_menu_dbl");
			}

			$aPopup[] = $aItem;
		}
	}

	return $aPopup;
}
Beispiel #30
0
 function ShowPanel()
 {
     global $USER, $APPLICATION;
     if (defined("ADMIN_SECTION") && ADMIN_SECTION == true) {
         return;
     }
     if ($USER->IsAdmin()) {
         if ($_REQUEST['add_new_site_sol'] == 'sol' && check_bitrix_sessid()) {
             $dbrSites = CSite::GetList($by, $ord);
             $arSitesID = array();
             $arSitesPath = array();
             $siteCnt = 0;
             while ($arSite = $dbrSites->Fetch()) {
                 if ($arSite["ACTIVE"] == "Y") {
                     $siteCnt++;
                 }
                 $arSitesID[] = strtolower($arSite["ID"]);
                 $arSitesPath[] = strtolower($arSite["PATH"]);
             }
             $newSiteID = "";
             while (true) {
                 $newSiteID = chr(rand(ord("a"), ord("z"))) . chr(rand(ord("a"), ord("z")));
                 if (!in_array($newSiteID, $arSitesID) && !in_array("/site" . $newSiteID . "/", $arSitesPath) && !file_exists($_SERVER['DOCUMENT_ROOT'] . "/site" . $newSiteID)) {
                     break;
                 }
             }
             $culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => FORMAT_DATE, "=FORMAT_DATETIME" => FORMAT_DATETIME, "=FORMAT_NAME" => CSite::GetDefaultNameFormat(), "=CHARSET" => SITE_CHARSET)));
             if ($culture) {
                 $cultureId = $culture["ID"];
             } else {
                 $addResult = CultureTable::add(array("NAME" => $newSiteID, "CODE" => $newSiteID, "FORMAT_DATE" => FORMAT_DATE, "FORMAT_DATETIME" => FORMAT_DATETIME, "FORMAT_NAME" => CSite::GetDefaultNameFormat(), "CHARSET" => SITE_CHARSET));
                 $cultureId = $addResult->getId();
             }
             $arFields = array("LID" => $newSiteID, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => $newSiteID, "DIR" => "/site_" . $newSiteID . "/", "SITE_NAME" => $newSiteID, "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "", "CULTURE_ID" => $cultureId);
             $obSite = new CSite();
             $result = $obSite->Add($arFields);
             if ($result) {
                 LocalRedirect("/bitrix/admin/wizard_install.php?lang=" . LANGUAGE_ID . "&wizardName=bitrix:portal&wizardSiteID=" . $newSiteID . "&" . bitrix_sessid_get());
             } else {
                 echo $obSite->LAST_ERROR;
             }
         }
         $arMenu = array(array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape(SITE_DIR) . "?add_new_site_sol=sol&" . bitrix_sessid_get() . "')", "TEXT" => "<b>" . GetMessage("SOL_BUTTON_TEST_TEXT", array("#BR#" => " ")) . "</b>", "TITLE" => GetMessage("SOL_BUTTON_TEST_TITLE")));
         $arSites = array();
         $dbrSites = CSite::GetList($by, $ord, array("ACTIVE" => "Y"));
         while ($arSite = $dbrSites->GetNext()) {
             $arSites[] = array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($arSite["DIR"]) . "');", "ICON" => $arSite["LID"] == SITE_ID ? "checked" : "", "TEXT" => $arSite["NAME"], "TITLE" => GetMessage("SOL_BUTTON_GOTOSITE") . " " . $arSite["NAME"]);
         }
         $arMenu[] = array("SEPARATOR" => true);
         $arMenu[] = array("TEXT" => GetMessage("SOL_BUTTON_GOTOSITE"), "MENU" => $arSites);
         $APPLICATION->AddPanelButton(array("HREF" => SITE_DIR . "?add_new_site_sol=sol&" . bitrix_sessid_get(), "ID" => "solutions_wizard", "ICON" => "bx-panel-install-solution-icon", "TYPE" => "BIG", "ALT" => GetMessage("SOL_BUTTON_TEST_TITLE"), "TEXT" => GetMessage("SOL_BUTTON_TEST_TEXT"), "MAIN_SORT" => 2520, "SORT" => 20, "MENU" => $arMenu, 'HINT' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_TEXT_HINT')), 'HINT_MENU' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_MENU_HINT'))));
     }
 }