function WhoIs_Parse($Domain) { #------------------------------------------------------------------------------- Debug(SPrintF('[system/libs/WhoIs]: run function WhoIs_Parse, Domain = %s', $Domain)); #------------------------------------------------------------------------------- $Regulars = Regulars(); #------------------------------------------------------------------------------- if (!Preg_Match($Regulars['Domain'], $Domain)) { return new gException('WRONG_DOMAIN_NAME', 'Неверное доменное имя'); } #------------------------------------------------------------------------------- $DomainZones = System_XML('config/DomainZones.xml'); if (Is_Error($DomainZones)) { return ERROR | @Trigger_Error('[WhoIs_Parse]: не удалось загрузить базу WhoIs серверов'); } #------------------------------------------------------------------------------- foreach ($DomainZones as $DomainZone) { #------------------------------------------------------------------------------- $Name = $DomainZone['Name']; #------------------------------------------------------------------------------- if (Preg_Match(SPrintF('/^([0-9a-zабвгдеёжзийклмнопрстуфхцчшщьыъэюя\\-]+)\\.%s$/', Str_Replace('.', '\\.', $Name)), $Domain, $Matches)) { return array('DomainName' => Next($Matches), 'DomainZone' => $DomainZone['Name']); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- return FALSE; #------------------------------------------------------------------------------- }
public function __construct($core) { $this->core = $core; $this->page_slug = Sanitize_Title(Str_Replace(array('\\', '/', '_'), '-', __CLASS__)); # Option boxes $this->arr_option_box = array('main' => array(), 'side' => array()); Add_Action('admin_menu', array($this, 'Add_Options_Page')); }
public static function title2pagename($text) { $znaky = array('á' => 'a', 'é' => 'e', 'ě' => 'e', 'í' => 'i', 'ó' => 'o', 'ú' => 'u', 'ů' => 'u', 'ý' => 'y', 'ž' => 'z', 'š' => 's', 'č' => 'c', 'ř' => 'r', 'Á' => 'A', 'É' => 'E', 'Ě' => 'E', 'Í' => 'I', 'Ó' => 'O', 'Ú' => 'U', 'Ů' => 'U', 'Ý' => 'Y', 'Ž' => 'Z', 'Š' => 'S', 'Č' => 'C', 'Ř' => 'R'); $return = strtr($text, $znaky); $return = Str_Replace(" ", "", $return); //smaze mezery $return = StrToLower($return); //velká písmena nahradí malými. return $return; }
static function loadBaseURL() { $absolute_plugin_folder = RealPath(self::$plugin_folder); if (StrPos($absolute_plugin_folder, ABSPATH) === 0) { self::$base_url = Get_Bloginfo('wpurl') . '/' . SubStr($absolute_plugin_folder, Strlen(ABSPATH)); } else { self::$base_url = Plugins_Url(BaseName(self::$plugin_folder)); } self::$base_url = Str_Replace("\\", '/', self::$base_url); # Windows Workaround }
public static function friendly_url($text) { $friendlyurl = Str_Replace(' ', '-', AddSlashes($text)); $tbl = array("á" => "a", "ä" => "a", "č" => "c", "ď" => "d", "é" => "e", "ě" => "e", "í" => "i", "ľ" => "l", "ĺ" => "l", "ň" => "n", "ó" => "o", "ö" => "o", "ő" => "o", "ô" => "o", "ř" => "r", "ŕ" => "r", "š" => "s", "ť" => "t", "ú" => "u", "ů" => "u", "ü" => "u", "ű" => "u", "ý" => "y", "ž" => "z", "Á" => "A", "Ä" => "A", "Č" => "C", "Ď" => "D", "É" => "E", "Ě" => "E", "Í" => "I", "Ľ" => "L", "Ĺ" => "L", "Ň" => "N", "Ó" => "O", "Ö" => "O", "Ő" => "O", "Ô" => "O", "Ř" => "R", "Ŕ" => "R", "Š" => "S", "Ť" => "T", "Ú" => "U", "Ů" => "U", "Ü" => "U", "Ű" => "U", "Ý" => "Y", "Ž" => "Z", "'" => "", ",-" => "kc"); $url = StrTr($friendlyurl, $tbl); $text = StrTr($url, "ÁÄČÇĎÉĚËÍŇÓÖŘŠŤÚŮÜÝŽáäčçďéěëíňóöřšťúůüýž", "AACCDEEEINOORSTUUUYZaaccdeeeinoorstuuuyz"); // somehow I wasnt able to add following characters to previous StrTr strings: $text = StrTr($text, "& .,?!_+", "--------"); //$text = Preg_Replace ("/[^[:alpha:][:digit:]]/", "-", $text); $text = Trim($text, "-"); $text = Preg_Replace("/[-]+/", "-", $text); return strtolower($text); }
function __construct() { if (Is_Admin() && !$this->Validate_Licence()) { $this->base_url = get_bloginfo('wpurl') . '/' . Str_Replace("\\", '/', SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH))); Add_Action('admin_init', array($this, 'Load_TextDomain')); Add_Action('admin_init', array($this, 'Add_Contribution_Code_Field')); Add_Action('admin_print_footer_scripts', array($this, 'Print_Contribution_JS'), 99); Add_Action('admin_notices', array($this, 'Print_Contribution_Form'), 1); Add_Action('wp_dashboard_setup', array($this, 'Register_Dashboard_Widget'), 9); Add_Action('donation_message', array($this, 'Print_Contribution_Message')); Add_Action('dh_contribution_message', array($this, 'Print_Contribution_Message')); } $this->Check_Remote_Activation(); }
function Table_Super_Replace($Array, $Matches) { #--------------------------------------------------------------------------- $Result = array(); #--------------------------------------------------------------------------- if (Is_Array($Array)) { #------------------------------------------------------------------------- foreach (Array_Keys($Array) as $ElementID) { #----------------------------------------------------------------------- $Element = $Array[$ElementID]; #----------------------------------------------------------------------- $Result[$ElementID] = Is_Array($Element) ? Table_Super_Replace($Element, $Matches) : Str_Replace(Array_Keys($Matches), Array_Values($Matches), $Element); } } #--------------------------------------------------------------------------- return $Result; }
function __construct() { // Read base $this->base_url = get_bloginfo('wpurl') . '/' . Str_Replace("\\", '/', SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH))); // Get ready to translate $this->Load_TextDomain(); // Set Hooks if (Is_Admin()) { Add_Action('admin_menu', array($this, 'add_options_page')); Add_Action('admin_head', array($this, 'print_admin_header')); } else { Add_Action('wp_head', array($this, 'print_header')); Add_ShortCode('gallery', array($this, 'gallery_shortcode')); } // Add jQuery wp_enqueue_script('jquery'); }
function HexToRGB($color) { // Delete the # symbol $input = Trim(Str_Replace("#", "", StrToUpper($color))); // Get every single number-letter $a = $this->_convertToDecimal($input[0]); $b = $this->_convertToDecimal($input[1]); $c = $this->_convertToDecimal($input[2]); $d = $this->_convertToDecimal($input[3]); $e = $this->_convertToDecimal($input[4]); $f = $this->_convertToDecimal($input[5]); // Build the RGB code $r = $a * 16 + $b; $g = $c * 16 + $d; $b = $e * 16 + $f; // Put R, G and B in an array for separate use $RGB = array($r, $g, $b); return $RGB; }
function TemplateReplace($Text, $Params = array(), $NoBody = TRUE) { #------------------------------------------------------------------------------- $Text = Trim($Text); #------------------------------------------------------------------------------- # проверяем что нам сунули - текст или файл if (!Preg_Match('/\\s/', $Text)) { #------------------------------------------------------------------------------- # достаём текст из файла $Path = System_Element(SPrintF('templates/modules/%s.html', $Text)); #------------------------------------------------------------------------------- if (Is_Error($Path)) { #------------------------------------------------------------------------------- $Text = SprintF('Отсутствует шаблон сообщения (templates/modules/%s.html)', $Text); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Text = Trim(IO_Read($Path)); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($NoBody) { $Text = SPrintF('<NOBODY><SPAN>%s</SPAN></NOBODY>', $Text); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Replace = Array_ToLine($Params, '%'); #------------------------------------------------------------------------------- foreach (Array_Keys($Replace) as $Key) { $Text = Str_Replace($Key, $Replace[$Key], $Text); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return $Text; #------------------------------------------------------------------------------- }
#------------------------------------------------------------------------------- /** @author Великодный В.В. (Joonte Ltd.) */ /******************************************************************************/ /******************************************************************************/ $__args_list = array('LinkID', 'Text'); /******************************************************************************/ /******************************************************************************/ /******************************************************************************/ eval(COMP_INIT); /******************************************************************************/ /******************************************************************************/ $Links =& Links(); #------------------------------------------------------------------------------- $Object =& $Links[$LinkID]; #------------------------------------------------------------------------------- $Object->AddAttribs(array('onmouseover' => SPrintF("PromptShow(event,'%s',this);", AddcSlashes(Str_Replace("\n", '<BR />', $Text), "\n\r\\\\'")))); #------------------------------------------------------------------------------- if (!Comp_IsLoaded('Form/Prompt')) { #----------------------------------------------------------------------------- $DOM =& $Links['DOM']; #----------------------------------------------------------------------------- $Script = new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/Prompt.js}')); #----------------------------------------------------------------------------- $DOM->AddChild('Head', $Script); #----------------------------------------------------------------------------- $Comp = Comp_Load('Css', array('Prompt')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- foreach ($Comp as $Css) {
private function SearchUserByName($user) { $user = trim($user); if (strlen($user) <= 0) { return array(); } $userId = 0; if ($user . "|" == intval($user) . "|") { $userId = intval($user); } if ($userId <= 0) { $arMatches = array(); if (preg_match("#\\[(\\d+)\\]#i", $user, $arMatches)) { $userId = intval($arMatches[1]); } } $arResult = array(); $dbUsers = false; if ($userId > 0) { $arFilter = array("ID_EQUAL_EXACT" => $userId); $dbUsers = CUser::GetList($by = "LAST_NAME", $order = "asc", $arFilter, array("NAV_PARAMS" => false)); } else { $userLogin = ""; $arMatches = array(); if (preg_match("#\\((.+?)\\)#i", $user, $arMatches)) { $userLogin = $arMatches[1]; $user = trim(str_replace("(" . $userLogin . ")", "", $user)); } $userEmail = ""; $arMatches = array(); if (preg_match("#<(.+?)>#i", $user, $arMatches)) { if (check_email($arMatches[1])) { $userEmail = $arMatches[1]; $user = Trim(Str_Replace("<" . $userEmail . ">", "", $user)); } } $arUser = array(); $arUserTmp = Explode(" ", $user); foreach ($arUserTmp as $s) { $s = Trim($s); if (StrLen($s) > 0) { $arUser[] = $s; } } if (strlen($userLogin) > 0) { $arUser[] = $userLogin; } $dbUsers = CUser::SearchUserByName($arUser, $userEmail, true); } if ($dbUsers) { while ($arUsers = $dbUsers->GetNext()) { $arResult[] = $arUsers["ID"]; } } return $arResult; }
public static function InitGroupsTmp($message, $titleTemplate1, $titleTemplate2, $arParams, $bRSS = false) { $arGroupsID = explode(",", $message); $message = ""; $title = ""; $bFirst = true; $count = 0; foreach ($arGroupsID as $groupID) { list($titleTmp, $messageTmp) = CSocNetLog::InitGroupTmp($groupID, $arParams, $bRSS); if (StrLen($titleTmp) > 0) { if (!$bFirst) $title .= ", "; $title .= $titleTmp; $count++; } if (StrLen($messageTmp) > 0) { if (!$bFirst) $message .= " "; $message .= $messageTmp; } $bFirst = false; } return array(Str_Replace("#TITLE#", $title, (($count > 1) ? $titleTemplate2 : $titleTemplate1)), $message); }
#------------------------------------------------------------------------------- switch (ValueOf($Contract)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('CONTRACT_NOT_FOUND', 'Договора не найдены'); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- Debug(SPrintF('[comp/Tasks/GC/WithdrawalOldUsers]: юзер (%s), договор #%u, балланс %s', $User['Email'], $Contract['ID'], $Contract['Balance'])); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Settings['WithdrawSumm'] = Str_Replace(',', '.', $Settings['WithdrawSumm']); #------------------------------------------------------------------------------- $Summ = $Contract['Balance'] > $Settings['WithdrawSumm'] ? $Settings['WithdrawSumm'] : $Contract['Balance']; #------------------------------------------------------------------------------- $IsUpdate = Comp_Load('www/Administrator/API/PostingMake', array('ContractID' => $Contract['ID'], 'Summ' => -$Summ, 'ServiceID' => 2100, 'Comment' => SPrintF('Хранение клиентской информации за период %s', Date('Y/m', MkTime(4, 0, 0, Date('n') - 1, 5, Date('Y')))))); #------------------------------------------------------------------------------- switch (ValueOf($IsUpdate)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); }
$lang = Explode("|", $file[$i]); $lang[1] = MySQL_Escape_String($lang[1]); Query("INSERT delayed ignore INTO va_languages VALUES ('lv', '".$lang[0]."', '".$lang[1]."', '".$lang[2]."')") OR Die("#".MySQL_ErrNo()." : ".MySQL_Error()); } FOR($i = 0; $i < Count($file_en); $i++) { $file_en[$i] = Ereg_Replace("([\$\"\;\t])", "", $file_en[$i]); $file_en[$i] = Str_Replace("( =)|(\\\\)", "|", $file_en[$i]); $lang = Explode("|", $file_en[$i]); $lang[1] = MySQL_Escape_String($lang[1]); Query("INSERT delayed ignore INTO va_languages VALUES ('lv', '".$lang[0]."', '".$lang[1]."', '".$lang[2]."')") OR Die("#".MySQL_ErrNo()." : ".MySQL_Error()); } UnSet($file); $file = File("scripts/languages/it.php"); FOR($i = 0; $i < Count($file); $i++) { $file[$i] = Ereg_Replace("([\$\"\;\t])", "", $file[$i]); $file[$i] = Str_Replace(" =", "|", $file[$i]); $lang = Explode("|", $file[$i]); $lang[1] = MySQL_Escape_String($lang[1]); Query("INSERT delayed ignore INTO va_languages VALUES ('it', '".$lang[0]."', '".$lang[1]."', '".$lang[2]."')") OR Die("#".MySQL_ErrNo()." : ".MySQL_Error()); } FOR($i = 0; $i < Count($file_en); $i++) { $file_en[$i] = Ereg_Replace("([\$\"\;\t])", "", $file_en[$i]); $file_en[$i] = Str_Replace("( =)|(\\\\)", "|", $file_en[$i]); $lang = Explode("|", $file_en[$i]); $lang[1] = MySQL_Escape_String($lang[1]); Query("INSERT delayed ignore INTO va_languages VALUES ('it', '".$lang[0]."', '".$lang[1]."', '".$lang[2]."')") OR Die("#".MySQL_ErrNo()." : ".MySQL_Error()); } ?>
$Array = array(); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # настройки сети из которой можно выполнять команды if ($Settings['xset-up-param']['IsActive']) { $Array[] = SPrintF('<func name="xset.up.param"><arg name="ip">%s</arg></func>', $Settings['xset-up-param']['LAN']); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # настройки DNS $Args = array('<arg name="sok">ok</arg><arg name="sync">on</arg>'); #------------------------------------------------------------------------------- if ($Settings['dnsparam']['IsActive']) { foreach (Array_Keys($Settings['dnsparam']) as $Name) { if ($Name != 'IsActive') { $Args[] = SPrintF('<arg name="%s">%s</arg>', Str_Replace('dnsparam.', '', Str_Replace('-', '.', $Name)), $Name == 'dnsparam-email' ? $Owner[0]['Email'] : $Settings['dnsparam'][$Name]); } } } #------------------------------------------------------------------------------- $Array[] = SPrintF('<func name="dnsparam">%s</func>', Implode('', $Args)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # TODO надо вытянуть номерки автосоздаваемых тарифов, и юзать их заказы #------------------------------------------------------------------------------- # по юзеру, которому принадлежит заказ находим заказы на DNSmanager if ($Settings['slaveserver-edit']['IsActive']) { #------------------------------------------------------------------------------- $DNSmanagerOrders = DB_Select('DNSmanagerOrdersOwners', array('ServerID', 'Login', 'Password', '(SELECT `Params` FROM `Servers` WHERE `Servers`.`ID` = `ServerID`) AS `Params`'), array('Where' => SPrintF('`UserID` = %u', $Owner[0]['UserID']), 'IsDesc' => TRUE, 'SortOn' => 'ID')); #------------------------------------------------------------------------------- switch (ValueOf($DNSmanagerOrders)) {
#------------------------------------------------------------------------- $Attribs['pCountry'] = $Attribs['Country']; $Attribs['pState'] = $Attribs['State']; $Attribs['pCity'] = $Attribs['City']; $Attribs['pAddress'] = Trim(Preg_Replace('/ул./iu', '', $Attribs['Address'])); $Attribs['AddressEn'] = Translit($Attribs['pAddress']); $Attribs['pIndex'] = $Attribs['PostIndex']; $Attribs['pRecipient'] = $Attribs['Recipient']; #------------------------------------------------------------------------- #------------------------------------------------------------------------- $Attribs['PasportWhom'] = $Attribs['PasportWhom']; $Attribs['PasportDate'] = $Attribs['PasportDate']; #------------------------------------------------------------------------- if (Preg_Match('/(.*)\\s(.*)$/', $Attribs['PasportNum'], $Matches)) { #----------------------------------------------------------------------- $Attribs['PasportLine'] = Str_Replace(' ', '', $Matches[1]); $Attribs['PasportNum'] = $Matches[2]; } #------------------------------------------------------------------------- #------------------------------------------------------------------------- $Template = System_XML(SPrintF('profiles/%s.xml', $Profile['TemplateID'])); if (Is_Error($Template)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------- foreach (Array_Keys($Template['Attribs']) as $AttribID) { #----------------------------------------------------------------------- if (!isset($Attribs[$AttribID])) { $Attribs[$AttribID] = $Template['Attribs'][$AttribID]['Value']; } }
$j2++; } if ($j2 > $arResult["LIMITS"]["TO"]) { $arResult["LIMITS"]["TO"] = $j2; } } else { $j1 = 0; $j2 = 48; } $arResult["LIMITS"]["FROM"] = 0; $arResult["LIMITS"]["TO"] = 48; for ($j = $j1; $j < $j2; $j++) { if ($arResult["ITEMS_MATRIX"][$i][$j]) { $cId = $arResult["ITEMS"][$arResult["ITEMS_MATRIX"][$i][$j]]; if (!In_Array($arElement["ID"] . "-" . $counter . "-" . $cId["ID"], $arConflict)) { $arResult["ErrorMessage"] .= Str_Replace(array("#TIME#", "#RES1#", "#RES2#"), array(Date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATE), MkTime(0, 0, 0, $weekMonth, $weekDay + $i - 1, $weekYear)) . " " . __RM_MkT($j), $cId["NAME"], $arElement["NAME"]), GetMessage("INTASK_C25_CONFLICT2") . ". "); $arConflict[] = $arElement["ID"] . "-" . $counter . "-" . $cId["ID"]; } } else { $arResult["ITEMS_MATRIX"][$i][$j] = $arElement["ID"] . "-" . $counter; } } } } } } // End Period $ar = array(); foreach ($arParams["WEEK_HOLIDAYS"] as $v) { if (!Array_Key_Exists($v + 1, $arResult["ITEMS_MATRIX"])) { $ar[] = $v;
case 'array': #------------------------------------------------------------------- foreach ($Articles as $Article) { #------------------------------------------------------------------------------- # prepare text: delete tags, begin/end space $Text = trim(Strip_Tags($Article['Text'])); # delete space on string begin $Text = Str_Replace("\n ", "\n", $Text); # delete double spaces $Text = Str_Replace(" ", " ", $Text); # delete carrier return $Text = Str_Replace("\r", "", $Text); # delete many \n $Text = Str_Replace("\n\n", "\n", $Text); # prepare for java script $Text = Str_Replace("\n", '\\n', $Text); # format: SortOrder:ImageName.gif # button image, get image name $Partition = Explode(":", $Article['Partition']); $Extension = isset($Partition[1]) ? Explode(".", StrToLower($Partition[1])) : ''; #------------------------------------------------------------------------------- # если есть чё-то после точки, и если оно похоже на расширение картинки, ставим это как картинку $Image = 'Info.gif'; #дефолтовую информационную картинку if (isset($Extension[1]) && In_Array($Extension[1], array('png', 'gif', 'jpg', 'jpeg'))) { $Image = $Partition[1]; } #------------------------------------------------------------------------------- # делаем кнопку, если это системная кнопка или этого админа if (!Preg_Match('/@/', $Partition[0]) && $Partition[0] < 2000 && $__USER['Params']['Settings']['EdeskButtons'] == "No" || StrToLower($Partition[0]) == StrToLower($__USER['Email'])) { #-------------------------------------------------------------------------------
if (isset($Attrib['Example'])) { $NoBody->AddChild(new Tag('SPAN', array('class' => 'Comment'), SPrintF('Например: %s', $Attrib['Example']))); } #------------------------------------------------------------------------------- $Table[] = array($NoBody, $Comp); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Table[] = 'Служба мониторинга'; #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/TextArea', array('name' => 'Monitoring', 'style' => 'width:100%;', 'rows' => 5, 'prompt' => 'Сервисы которые необходимо мониторить на данном сервере. Список, по одному значению СЕРВИС=ПОРТ на каждой строке'), Str_Replace(" ", "\n", $Server['Monitoring'])); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table[] = array('Сервисы', $Comp); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Table[] = 'Заметка'; #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/TextArea', array('name' => 'AdminNotice', 'style' => 'width:100%;', 'rows' => 5, 'prompt' => 'Информация о сервере, "чисто для себя"'), $Server['AdminNotice']); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table[] = $Comp;
#--------------------------------------------------------------------- $tAttribs = $Template['Attribs']; #--------------------------------------------------------------------- foreach (Array_Keys($tAttribs) as $AttribID) { #------------------------------------------------------------------- if (!isset($pAttribs[$AttribID])) { $pAttribs[$AttribID] = $tAttribs[$AttribID]['Value']; } } #--------------------------------------------------------------------- $Replace = Array_ToLine($pAttribs, '%'); #--------------------------------------------------------------------- $ProfileName = $Template['ProfileName']; #--------------------------------------------------------------------- foreach (Array_Keys($Replace) as $Key) { $ProfileName = Str_Replace($Key, $Replace[$Key], $ProfileName); } #--------------------------------------------------------------------- $IProfile = array('CreateDate' => GetTime($Profile['CreateDate']), 'UserID' => $UserID, 'TemplateID' => $Profile['TemplateID'], 'Name' => $ProfileName, 'Attribs' => $pAttribs, 'StatusID' => 'Checked', 'StatusDate' => GetTime($Profile['CreateDate'])); #--------------------------------------------------------------------- $ProfileID = DB_Insert('Profiles', $IProfile); if (Is_Error($ProfileID)) { return ERROR | @Trigger_Error(500); } } } #------------------------------------------------------------------------- if (Is_Error(DB_Commit($TransactionID))) { return ERROR | @Trigger_Error(500); } #-------------------------------------------------------------------------
public static function hash($input) { $hash = Strings::toAscii($input); $hash = Str_Replace(' ', '', $hash); $hash = md5($hash); return $hash . '-' . base64_encode($input); }
#----------------------------------------------------- @($DOM->Links['Stamp']->Childs = array()); #----------------------------------------------------- $DOM->AddChild('Stamp', new Tag('IMG', array('src' => 'SRC:{Images/Stamp.bmp}'))); } #------------------------------------------------------- $Document = $DOM->Build(); if (Is_Error($Document)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------- foreach (Array_Keys($Replace) as $LinkID) { #----------------------------------------------------- $Text = (string) $Replace[$LinkID]; #----------------------------------------------------- $Document = Str_Replace(SPrintF('%%%s%%', $LinkID), $Text ? $Text : '-', $Document); } #------------------------------------------------------- $PDF = HTMLDoc_CreatePDF('WorksCompliteReport', $Document); #------------------------------------------------------- switch (ValueOf($PDF)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'string': #--------------------------------------------------- $Comp = Comp_Load('Formats/WorkComplite/Report/Number', $ContractID, $Month); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); }
s)</em></th> </tr> </thead> <tbody> <?php if ($Info !== false) { foreach ($Info as $InfoKey => $InfoValue) { ?> <tr> <td><?php echo htmlspecialchars($InfoKey); ?> </td> <td><?php if ($InfoKey === 'favicon') { echo '<img width="64" height="64" src="' . Str_Replace("\n", "", $InfoValue) . '">'; } else { if (Is_Array($InfoValue)) { echo "<pre>"; print_r($InfoValue); echo "</pre>"; } else { echo htmlspecialchars($InfoValue); } } ?> </td> </tr> <?php } } else {
if ($userSettingsId <= 0) { $viewId = 0; $action = "create"; } $arResult["Perms"]["CanModifyCommon"] = $taskType == 'user' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $ownerId, "tasks", 'modify_common_views') || $taskType == 'group' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $ownerId, "tasks", 'modify_common_views'); if ($action == "edit" && $userSettingsId > 0 && $arUserSettings["COMMON"] != "N") { if (!$arResult["Perms"]["CanModifyCommon"]) { $viewId = 0; $action = "create"; } } if ($arParams["SET_TITLE"] == "Y") { if ($action == "create") { $APPLICATION->SetTitle(GetMessage("INTV_CREATE_TITLE")); } else { $APPLICATION->SetTitle(Str_Replace("#NAME#", $arUserTemplate["NAME"], GetMessage("INTV_EDIT_TITLE"))); } } $arResult["MODE"] = $action; if (StrLen($userTemplateId) > 0) { $arResult["ShowStep"] = 2; $arResult["UserSettings"] = $arUserSettings; if ($_SERVER["REQUEST_METHOD"] == "POST" && StrLen($_POST["save"]) > 0 && check_bitrix_sessid()) { if (!array_key_exists("SHOW_COLUMN", $_POST) || !is_array($_POST["SHOW_COLUMN"]) || Count($_POST["SHOW_COLUMN"]) <= 0) { $_POST["SHOW_COLUMN"] = array(); foreach ($arResult["TaskFields"] as $key => $value) { $_POST["SHOW_COLUMN"][] = $key; } } $arFieldsColumns = array(); foreach ($_POST["SHOW_COLUMN"] as $col) {
function __WalkThrougtTree($path, $arSkipPaths, $level, &$arTs, $fileFunction) { $path = Str_Replace("\\", "/", $path); $path = Trim(Trim($path, "/\\")); if (StrLen($path) > 0) { $path = "/" . $path; } $le = false; if (StrLen($this->startPath) > 0) { if (StrLen($path) <= 0 || StrLen($this->startPath) >= StrLen($path) && SubStr($this->startPath, 0, StrLen($path)) == $path) { if (StrLen($path) > 0) { $startPath = SubStr($this->startPath, StrLen($path) + 1); } else { $startPath = $this->startPath; } $pos = StrPos($startPath, "/"); $le = $pos === false ? false : true; if ($pos === false) { $startPathPart = $startPath; } else { $startPathPart = SubStr($startPath, 0, $pos); } } } $arFiles = array(); if ($handle = @opendir($_SERVER["DOCUMENT_ROOT"] . $path)) { while (($file = readdir($handle)) !== false) { if ($file == "." || $file == "..") { continue; } if (StrLen($startPathPart) > 0 && ($le && $startPathPart > $file || !$le && $startPathPart >= $file)) { continue; } if (Count($arSkipPaths) > 0) { $bSkip = False; for ($i = 0; $i < count($arSkipPaths); $i++) { if (strlen($path . "/" . $file) >= strlen($arSkipPaths[$i]) && substr($path . "/" . $file, 0, strlen($arSkipPaths[$i])) == $arSkipPaths[$i]) { $bSkip = True; break; } } if ($bSkip) { continue; } } $arFiles[] = $file; } closedir($handle); } for ($i = 0; $i < Count($arFiles) - 1; $i++) { for ($j = $i + 1; $j < Count($arFiles); $j++) { if ($arFiles[$i] > $arFiles[$j]) { $t = $arFiles[$i]; $arFiles[$i] = $arFiles[$j]; $arFiles[$j] = $t; } } } for ($i = 0; $i < Count($arFiles); $i++) { if (is_dir($_SERVER["DOCUMENT_ROOT"] . $path . "/" . $arFiles[$i])) { $res = $this->__WalkThrougtTree($path . "/" . $arFiles[$i], $arSkipPaths, $level + 1, $arTs, $fileFunction); if (!$res) { return false; } } else { if (Count($this->arCollectedExtensions) > 0) { $fileExt = StrToLower(GetFileExtension($arFiles[$i])); if (!In_Array($fileExt, $this->arCollectedExtensions)) { continue; } } Call_User_Func(array(&$this, $fileFunction), $path . "/" . $arFiles[$i]); $arTs["StatNum"]++; } if ($arTs["MaxExecutionTime"] > 0 && getmicrotime() - START_EXEC_TIME > $arTs["MaxExecutionTime"]) { $arTs["StartPoint"] = $path . "/" . $arFiles[$i]; return false; } } $arTs["StartPoint"] = ""; return true; }
$arResult["Features"][] = "blog"; } if (IsModuleInstalled("photogallery")) { $arResult["Features"][] = "photo"; } if (IsModuleInstalled("intranet")) { $arResult["Features"][] = "calendar"; $arResult["Features"][] = "tasks"; } if (IsModuleInstalled("webdav") || IsModuleInstalled("disk")) { $arResult["Features"][] = "files"; } if ($arParams["SET_TITLE"] == "Y" || $arParams["SET_NAV_CHAIN"] != "N") { $arParams["TITLE_NAME_TEMPLATE"] = str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]); $title_user = CUser::FormatName($arParams['TITLE_NAME_TEMPLATE'], $arUser, $bUseLogin); $title = Str_Replace("#TITLE#", $title_user, GetMessage("SONET_ACTIVITY_PAGE_TITLE")); if ($arParams["SET_TITLE"] == "Y") { $APPLICATION->SetTitle($title); } if ($arParams["SET_NAV_CHAIN"] != "N") { $APPLICATION->AddChainItem($title_user, CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arParams["USER_ID"]))); $APPLICATION->AddChainItem(GetMessage("SONET_ACTIVITY_CHAIN_TITLE")); } } $arResult["CurrentUserPerms_UserID"] = CSocNetUserPerms::InitUserPerms($GLOBALS["USER"]->GetID(), $arParams["USER_ID"], $bCurrentUserIsAdmin); $arResult["Events"] = false; $arFilter = array("USER_ID" => $arParams["USER_ID"]); if ($arParams["LOG_DATE_DAYS"] > 0) { $arrAdd = array("DD" => -$arParams["LOG_DATE_DAYS"], "MM" => 0, "YYYY" => 0, "HH" => 0, "MI" => 0, "SS" => 0); $stmp = AddToTimeStamp($arrAdd, time() + CTimeZone::GetOffset()); $arFilter[">=LOG_DATE"] = ConvertTimeStamp($stmp, "FULL");
function toIndex($text) { $text = iconv('Windows-1252', 'ASCII//TRANSLIT', $text); return Str_Replace(' ', '_', $text); }
function Sources(&$Object) { #----------------------------------------------------------------------------- $Attribs =& $Object->Attribs; #----------------------------------------------------------------------------- foreach (array('src', 'style', 'href', 'onclick') as $AttribID) { #--------------------------------------------------------------------------- if (!isset($Attribs[$AttribID])) { continue; } #--------------------------------------------------------------------------- $Attrib =& $Attribs[$AttribID]; #--------------------------------------------------------------------------- if (Preg_Match_All('/SRC\\:\\{([a-zA-Z0-9\\.\\/\\_\\-]+)[?a-zA-Z\\=\\,]*\\}/', $Attrib, $Matches)) { #------------------------------------------------------------------------- $Matches = Array_Combine(Current($Matches), Next($Matches)); #------------------------------------------------------------------------- foreach (Array_Keys($Matches) as $What) { #----------------------------------------------------------------------- $Url = Styles_Url($Matches[$What]); if (!Is_Error($Url)) { $Attrib = Str_Replace($What, $Url, $Attrib); } } } } }
$Folder = SPrintF('%s/hosts/%s', SYSTEM_PATH, HOST_ID); #------------------------------------------------------------------------------- $Files = IO_Files($Folder); if (Is_Error($Files)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- foreach ($Files as $File) { #----------------------------------------------------------------------------- if (!Preg_Match('/\\.xml/', $File)) { continue; } #----------------------------------------------------------------------------- $Sourse = IO_Read($File); if (Is_Error($Sourse)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Out = Str_Replace('path="MenuLeft"', 'path="Menus/Left"', $Sourse); #----------------------------------------------------------------------------- if ($Out != $Sourse) { #--------------------------------------------------------------------------- $IsWrite = IO_Write($File, $Out, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } } } #------------------------------------------------------------------------------- return TRUE; #-------------------------------------------------------------------------------