Esempio n. 1
0
 public function Query()
 {
     $Length = StrLen($this->ServerIP);
     $Data = Pack('cccca*', HexDec($Length), 0, 0x4, $Length, $this->ServerIP) . Pack('nc', $this->ServerPort, 0x1);
     Socket_Send($this->Socket, $Data, StrLen($Data), 0);
     // handshake
     Socket_Send($this->Socket, "", 2, 0);
     // status ping
     $Length = $this->ReadVarInt();
     // full packet length
     if ($Length < 10) {
         return FALSE;
     }
     Socket_Read($this->Socket, 1);
     // packet type, in server ping it's 0
     $Length = $this->ReadVarInt();
     // string length
     $Data = Socket_Read($this->Socket, $Length, PHP_NORMAL_READ);
     // and finally the json string
     if ($Data === FALSE) {
         throw new MinecraftPingException('Server didn\'t return any data');
     }
     $Data = JSON_Decode($Data, true);
     if (JSON_Last_Error() !== JSON_ERROR_NONE) {
         if (Function_Exists('json_last_error_msg')) {
             throw new MinecraftPingException(JSON_Last_Error_Msg());
         } else {
             throw new MinecraftPingException('JSON parsing failed');
         }
         return FALSE;
     }
     return $Data;
 }
Esempio n. 2
0
 protected function ReadInternal($Buffer, $Length, $SherlockFunction)
 {
     if ($Buffer->Remaining() === 0) {
         throw new InvalidPacketException('Failed to read any data from socket', InvalidPacketException::BUFFER_EMPTY);
     }
     $Header = $Buffer->GetLong();
     if ($Header === -1) {
         // We don't have to do anything
     } else {
         if ($Header === -2) {
             $Packets = [];
             $IsCompressed = false;
             $ReadMore = false;
             do {
                 $RequestID = $Buffer->GetLong();
                 switch ($this->Engine) {
                     case SourceQuery::GOLDSOURCE:
                         $PacketCountAndNumber = $Buffer->GetByte();
                         $PacketCount = $PacketCountAndNumber & 0xf;
                         $PacketNumber = $PacketCountAndNumber >> 4;
                         break;
                     case SourceQuery::SOURCE:
                         $IsCompressed = ($RequestID & 0x80000000) !== 0;
                         $PacketCount = $Buffer->GetByte();
                         $PacketNumber = $Buffer->GetByte() + 1;
                         if ($IsCompressed) {
                             $Buffer->GetLong();
                             // Split size
                             $PacketChecksum = $Buffer->GetUnsignedLong();
                         } else {
                             $Buffer->GetShort();
                             // Split size
                         }
                         break;
                 }
                 $Packets[$PacketNumber] = $Buffer->Get();
                 $ReadMore = $PacketCount > sizeof($Packets);
             } while ($ReadMore && $SherlockFunction($Buffer, $Length));
             $Data = Implode($Packets);
             // TODO: Test this
             if ($IsCompressed) {
                 // Let's make sure this function exists, it's not included in PHP by default
                 if (!Function_Exists('bzdecompress')) {
                     throw new \RuntimeException('Received compressed packet, PHP doesn\'t have Bzip2 library installed, can\'t decompress.');
                 }
                 $Data = bzdecompress($Data);
                 if (CRC32($Data) !== $PacketChecksum) {
                     throw new InvalidPacketException('CRC32 checksum mismatch of uncompressed packet data.', InvalidPacketException::CHECKSUM_MISMATCH);
                 }
             }
             $Buffer->Set(SubStr($Data, 4));
         } else {
             throw new InvalidPacketException('Socket read: Raw packet header mismatch. (0x' . DecHex($Header) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH);
         }
     }
     return $Buffer;
 }
 function __construct()
 {
     // Read base
     $this->base_url = get_bloginfo('wpurl') . '/' . SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH));
     $this->base_url = Str_Replace("\\", '/', $this->base_url);
     // Windows Workaround
     // Option boxes
     $this->arr_option_box = array('main' => array(), 'side' => array());
     // Meta Boxes
     $this->arr_gallery_meta_box = array();
     // Template directory
     $this->template_dir = WP_CONTENT_DIR . '/fancy-gallery-templates';
     // Get ready to translate
     Add_Action('widgets_init', array($this, 'Load_TextDomain'));
     // This Plugin supports post thumbnails
     if (Function_Exists('Add_Theme_Support')) {
         Add_Theme_Support('post-thumbnails');
     }
     // Load Update class
     $this->Load_Construct(DirName(__FILE__) . '/construct.updates.php', 'Fancy_Gallery_Pro_Updates');
     new Fancy_Gallery_Pro_Updates(__FILE__, $this->Get_Option('update_username'), $this->Get_Option('update_password'), !$this->get_option('disable_update_notification'));
     // Set Hooks
     Register_Activation_Hook(__FILE__, array($this, 'Plugin_Activation'));
     Add_Action('init', array($this, 'Register_Gallery_Post_Type'));
     Add_Action('init', array($this, 'Register_Gallery_Taxonomies'));
     Add_Action('init', array($this, 'Add_Taxonomy_Archive_Urls'), 99);
     Add_Action('init', array($this, 'Add_GetTextFilter'), 99);
     Add_Filter('post_updated_messages', array($this, 'Gallery_Updated_Messages'));
     Add_Action('admin_menu', array($this, 'Add_Options_Page'));
     Add_Filter('the_content', array($this, 'Filter_Content'), 9);
     Add_Filter('the_content_feed', array($this, 'Filter_Feed_Content'));
     Add_Filter('the_excerpt_rss', array($this, 'Filter_Feed_Content'));
     Add_Filter('image_upload_iframe_src', array($this, 'Image_Upload_Iframe_Src'));
     Add_Filter('post_class', array($this, 'Filter_Post_Class'));
     Add_Action('wp_enqueue_scripts', array($this, 'enqueue_frontend_scripts'));
     Add_Action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
     Add_Action('save_post', array($this, 'Save_Meta_Box'));
     Add_ShortCode('gallery', array($this, 'ShortCode_Gallery'));
     if (isset($_REQUEST['strip_tabs'])) {
         Add_Action('media_upload_gallery', array($this, 'Add_Media_Upload_Style'));
         Add_Action('media_upload_image', array($this, 'Add_Media_Upload_Style'));
         Add_Filter('media_upload_tabs', array($this, 'Media_Upload_Tabs'));
         Add_Filter('media_upload_form_url', array($this, 'Media_Upload_Form_URL'));
         Add_Action('media_upload_import_images', array($this, 'Import_Images'));
     }
     if (!$this->get_option('disable_excerpts')) {
         Add_Filter('get_the_excerpt', array($this, 'Filter_Excerpt'), 9);
     }
     // Add to GLOBALs
     $GLOBALS[__CLASS__] = $this;
 }
Esempio n. 4
0
 public function GetUsers()
 {
     /******************************************************************************/
     $__args__ = Func_Get_Args();
     eval(FUNCTION_INIT);
     /******************************************************************************/
     Array_UnShift($__args__, $this->Settings);
     #-------------------------------------------------------------------------------
     $Function = SPrintF('%s_Get_Users', $this->SystemID);
     #-------------------------------------------------------------------------------
     if (!Function_Exists($Function)) {
         return new gException('FUNCTION_NOT_SUPPORTED', SPrintF('Функция (%s) не поддерживается API модулем', $Function));
     }
     #-------------------------------------------------------------------------------
     $Result = Call_User_Func_Array($Function, $__args__);
     if (Is_Error($Result)) {
         return ERROR | @Trigger_Error('[ISPswServer->GetUsers]: не удалось вызвать целевую функцию');
     }
     #-------------------------------------------------------------------------------
     return $Result;
     #-------------------------------------------------------------------------------
 }
Esempio n. 5
0
<?php

Define("STOP_STATISTICS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if (CModule::IncludeModule("socialnetwork") && !IsModuleInstalled("b24network")) {
    if ($GLOBALS["USER"]->IsAuthorized()) {
        $bIntranet = IsModuleInstalled('intranet');
        if (!Function_Exists("__UnEscapeTmp")) {
            function __UnEscapeTmp(&$item, $key)
            {
                if (Is_Array($item)) {
                    Array_Walk($item, '__UnEscapeTmp');
                } else {
                    if (StrPos($item, "%u") !== false) {
                        $item = $GLOBALS["APPLICATION"]->UnJSEscape($item);
                    }
                }
            }
        }
        Array_Walk($_REQUEST, '__UnEscapeTmp');
        $arParams = array();
        $params = Explode(",", $_REQUEST["params"]);
        foreach ($params as $param) {
            list($key, $val) = Explode(":", $param);
            $arParams[$key] = $val;
        }
        $arParams["pe"] = IntVal($arParams["pe"]);
        if ($arParams["pe"] <= 0 || $arParams["pe"] > 50) {
            $arParams["pe"] = 10;
        }
        $arParams["gf"] = IntVal($arParams["gf"]);
Esempio n. 6
0
<?php

if (!Defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("socialnetwork")) {
    return false;
}
if (!Function_Exists("__IntaskInitTaskFields")) {
    CComponentUtil::__IncludeLang(BX_PERSONAL_ROOT . "/components/bitrix/intranet.tasks", "init.php");
    function __IntaskInitTaskFields($iblockId, $taskType, $ownerId, $arSelect)
    {
        $arTasksFields = array("ID" => array("NAME" => GetMessage("INTI_ID"), "FULL_NAME" => GetMessage("INTI_ID_F"), "TYPE" => "int", "EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => false, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 10), "NAME" => array("NAME" => GetMessage("INTI_NAME"), "FULL_NAME" => GetMessage("INTI_NAME_F"), "TYPE" => "string", "EDITABLE_AUTHOR" => true, "EDITABLE_RESPONSIBLE" => true, "IS_REQUIRED" => "Y", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 60), "TIMESTAMP_X" => array("NAME" => GetMessage("INTI_TIMESTAMP_X"), "FULL_NAME" => GetMessage("INTI_TIMESTAMP_X_F"), "TYPE" => "datetime", "EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => false, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 40), "CODE" => array("NAME" => GetMessage("INTI_CODE"), "FULL_NAME" => GetMessage("INTI_CODE_F"), "TYPE" => "string", "EDITABLE_AUTHOR" => true, "EDITABLE_RESPONSIBLE" => true, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 10), "XML_ID" => array("NAME" => GetMessage("INTI_XML_ID"), "FULL_NAME" => GetMessage("INTI_XML_ID_F"), "TYPE" => "string", "EDITABLE_AUTHOR" => true, "EDITABLE_RESPONSIBLE" => true, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 10), "MODIFIED_BY" => array("NAME" => GetMessage("INTI_MODIFIED_BY"), "FULL_NAME" => GetMessage("INTI_MODIFIED_BY_F"), "TYPE" => "user", "EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => false, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 30), "DATE_CREATE" => array("NAME" => GetMessage("INTI_DATE_CREATE"), "FULL_NAME" => GetMessage("INTI_DATE_CREATE_F"), "TYPE" => "datetime", "EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => false, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 20), "CREATED_BY" => array("NAME" => GetMessage("INTI_CREATED_BY"), "FULL_NAME" => GetMessage("INTI_CREATED_BY_F"), "TYPE" => "user", "EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => false, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 10), "DATE_ACTIVE_FROM" => array("NAME" => GetMessage("INTI_DATE_ACTIVE_FROM"), "FULL_NAME" => GetMessage("INTI_DATE_ACTIVE_FROM_F"), "TYPE" => "datetime", "EDITABLE_AUTHOR" => true, "EDITABLE_RESPONSIBLE" => true, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 80), "DATE_ACTIVE_TO" => array("NAME" => GetMessage("INTI_DATE_ACTIVE_TO"), "FULL_NAME" => GetMessage("INTI_DATE_ACTIVE_TO_F"), "TYPE" => "datetime", "EDITABLE_AUTHOR" => true, "EDITABLE_RESPONSIBLE" => true, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 90), "ACTIVE_DATE" => array("NAME" => GetMessage("INTI_ACTIVE_DATE"), "FULL_NAME" => GetMessage("INTI_ACTIVE_DATE_F"), "TYPE" => "bool", "EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => false, "IS_REQUIRED" => "N", "SELECTABLE" => false, "FILTERABLE" => true, "PSORT" => 10), "IBLOCK_SECTION" => array("NAME" => GetMessage("INTI_IBLOCK_SECTION"), "FULL_NAME" => GetMessage("INTI_IBLOCK_SECTION_F"), "TYPE" => "group", "EDITABLE_AUTHOR" => true, "EDITABLE_RESPONSIBLE" => true, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => true, "PSORT" => 55), "DETAIL_TEXT" => array("NAME" => GetMessage("INTI_DETAIL_TEXT"), "FULL_NAME" => GetMessage("INTI_DETAIL_TEXT_F"), "TYPE" => "text", "EDITABLE_AUTHOR" => true, "EDITABLE_RESPONSIBLE" => true, "IS_REQUIRED" => "N", "SELECTABLE" => true, "FILTERABLE" => false, "PSORT" => 70));
        $arTasksProps = array("TASKPRIORITY" => array("EDITABLE_AUTHOR" => true, "EDITABLE_RESPONSIBLE" => true, "LIST_NAME" => GetMessage("INTI_TASKPRIORITY_L"), "FILTERABLE" => true, "DISPLAY" => true, "PSORT" => 100), "TASKSTATUS" => array("EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => true, "LIST_NAME" => GetMessage("INTI_TASKSTATUS_L"), "FILTERABLE" => true, "DISPLAY" => true, "PSORT" => 110), "TASKCOMPLETE" => array("EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => true, "LIST_NAME" => GetMessage("INTI_TASKCOMPLETE_L"), "FILTERABLE" => true, "DISPLAY" => true, "PSORT" => 130), "TASKASSIGNEDTO" => array("EDITABLE_AUTHOR" => true, "EDITABLE_RESPONSIBLE" => true, "TYPE" => "user", "LIST_NAME" => GetMessage("INTI_TASKASSIGNEDTO_L"), "FILTERABLE" => true, "DISPLAY" => true, "PSORT" => 50), "TASKALERT" => array("EDITABLE_AUTHOR" => true, "EDITABLE_RESPONSIBLE" => false, "TYPE" => "bool", "LIST_NAME" => GetMessage("INTI_TASKALERT_L"), "FILTERABLE" => false, "DISPLAY" => true, "PSORT" => 160), "TASKSIZE" => array("EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => true, "LIST_NAME" => GetMessage("INTI_TASKSIZE_L"), "FILTERABLE" => true, "DISPLAY" => true, "PSORT" => 140), "TASKSIZEREAL" => array("EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => true, "LIST_NAME" => GetMessage("INTI_TASKSIZEREAL_L"), "FILTERABLE" => true, "DISPLAY" => true, "PSORT" => 150), "TASKFINISH" => array("EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => false, "LIST_NAME" => GetMessage("INTI_TASKFINISH_L"), "FILTERABLE" => true, "DISPLAY" => true, "PSORT" => 130), "TASKREPORT" => array("EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => true, "LIST_NAME" => GetMessage("INTI_TASKREPORT_L"), "FILTERABLE" => false, "DISPLAY" => true, "PSORT" => 120), "TASKREMIND" => array("EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => true, "LIST_NAME" => GetMessage("INTI_TASKREMIND_L"), "FILTERABLE" => false, "DISPLAY" => true, "PSORT" => 170), "VERSION" => array("EDITABLE_AUTHOR" => false, "EDITABLE_RESPONSIBLE" => false, "LIST_NAME" => GetMessage("INTI_VERSION_L"), "FILTERABLE" => false, "DISPLAY" => false, "PSORT" => 10));
        if (!Is_Array($arSelect)) {
            $arSelect = array();
        }
        $arNeedBeSelected = array("ID", "NAME", "TIMESTAMP_X", "MODIFIED_BY", "DATE_CREATE", "CREATED_BY", "DATE_ACTIVE_FROM", "DATE_ACTIVE_TO", "IBLOCK_SECTION", "DETAIL_TEXT", "TASKPRIORITY", "TASKSTATUS", "TASKCOMPLETE", "TASKASSIGNEDTO", "TASKALERT", "TASKSIZE", "TASKSIZEREAL", "TASKFINISH", "TASKREPORT", "TASKREMIND", 'VERSION');
        foreach ($arNeedBeSelected as $v) {
            if (!In_Array($v, $arSelect)) {
                $arSelect[] = $v;
            }
        }
        $iblockId = IntVal($iblockId);
        if ($iblockId <= 0) {
            return false;
        }
        $taskType = StrToLower($taskType);
        if (!in_array($taskType, array("group", "user"))) {
            $taskType = "user";
        }
Esempio n. 7
0
 public function Read($Length = 1400)
 {
     $this->Buffer->Set(FRead($this->Socket, $Length));
     if ($this->Buffer->Remaining() > 0 && $this->Buffer->GetLong() == -2) {
         $Packets = array();
         $IsCompressed = false;
         $ReadMore = false;
         do {
             $RequestID = $this->Buffer->GetLong();
             switch ($this->Engine) {
                 case CI_SourceQuery::GOLDSOURCE:
                     $PacketCountAndNumber = $this->Buffer->GetByte();
                     $PacketCount = $PacketCountAndNumber & 0xf;
                     $PacketNumber = $PacketCountAndNumber >> 4;
                     break;
                 case CI_SourceQuery::SOURCE:
                     $IsCompressed = ($RequestID & 0x80000000) != 0;
                     $PacketCount = $this->Buffer->GetByte();
                     $PacketNumber = $this->Buffer->GetByte() + 1;
                     if ($IsCompressed) {
                         $this->Buffer->GetLong();
                         // Split size
                         $PacketChecksum = $this->Buffer->GetUnsignedLong();
                     } else {
                         $this->Buffer->GetShort();
                         // Split size
                     }
                     break;
             }
             $Packets[$PacketNumber] = $this->Buffer->Get();
             $ReadMore = $PacketCount > sizeof($Packets);
         } while ($ReadMore && $this->Sherlock($Length));
         $Buffer = Implode($Packets);
         // TODO: Test this
         if ($IsCompressed) {
             // Let's make sure this function exists, it's not included in PHP by default
             if (!Function_Exists('bzdecompress')) {
                 throw new RuntimeException('Received compressed packet, PHP doesn\'t have Bzip2 library installed, can\'t decompress.');
             }
             $Data = bzdecompress($Data);
             if (CRC32($Data) != $PacketChecksum) {
                 throw new SourceQueryException('CRC32 checksum mismatch of uncompressed packet data.');
             }
         }
         $this->Buffer->Set(SubStr($Buffer, 4));
     }
 }
Esempio n. 8
0
        if ($from_encoding == 'UTF-8' && $to_encoding == 'HTML-ENTITIES') {
            return HTMLSpecialChars_Decode(UTF8_Decode(HTMLEntities($str, ENT_QUOTES, 'utf-8', False)));
        } else {
            return @IConv($from_encoding, $to_encoding, $str);
        }
    }
}
if (!Function_Exists('MB_StrPos')) {
    function MB_StrPos($haystack, $needle, $offset = 0)
    {
        return StrPos($haystack, $needle, $offset);
    }
}
if (!Function_Exists('MB_SubStr')) {
    function MB_SubStr($string, $start, $length = Null)
    {
        return SubStr($string, $start, $length);
    }
}
if (!Function_Exists('MB_StrLen')) {
    function MB_StrLen($string)
    {
        return StrLen($string);
    }
}
if (!Function_Exists('MB_StrToUpper')) {
    function MB_StrToUpper($string)
    {
        return StrToUpper($string);
    }
}
Esempio n. 9
0
	//MSIE browser
	ELSEIF(EregI("msie.[1-9]", $_SERVER['HTTP_USER_AGENT']))
		{SetCookie("brwsr_tp", "MSIE", $time); $_COOKIE['brwsr_tp'] = "MSIE";}
	//Netscape or mozilla
	ELSEIF(EregI("rv:1\.[1-9]|netscape", $_SERVER['HTTP_USER_AGENT']))
		{SetCookie("brwsr_tp", "Mozilla", $time); $_COOKIE['brwsr_tp'] = "Mozilla";}
	//Some other
	ELSE
		{SetCookie("brwsr_tp", "Other", $time); $_COOKIE['brwsr_tp'] = "Other";}
	}

IF(Function_Exists("mysqli_query")) {
	Include "lib/mysqli.php";
	Define("VA_MySQL", "MySQLi", 1);
	}
ELSEIF(Function_Exists("mysql_query")) {
	Include "lib/mysql.php";
	Define("VA_MySQL", "MySQL", 1);
	}
ELSE
	Die("No MySQL support extension. Check your PHP configuration");

//---------------------------------------------------------------------
//Return TRUE if index on $colum in table $table exists
FUNCTION Check_Index($link, $table, $colum) {
	$result = $link->Query("SHOW INDEX FROM ".$table);
	WHILE($row = $result->Fetch_Assoc()) {
		IF(StrToLower($row['Column_name']) == StrToLower($colum) && $row['Seq_in_index'] == 1) {
			RETURN TRUE;
			}
		}
Esempio n. 10
0
                }
            }
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
Debug(SPrintF('[JBs core]: запуск системы (%s)', Date('Y-m-d')));
Debug(SPrintF('[JBs core]: тип интерфейса сервера (%s)', PHP_SAPI_Name()));
Debug(SPrintF('[JBs core]: IP-адрес сервера (%s)', isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '127.0.0.1'));
Debug(SPrintF('[JBs core]: версия PHP интерпретатора (%s)', PhpVersion()));
Debug(SPrintF('[JBs core]: операционная система (%s)', Php_Uname()));
#-------------------------------------------------------------------------------
if (Function_Exists('posix_getpwuid')) {
    #-------------------------------------------------------------------------------
    $USER = Posix_GetPWUID(Posix_GetUID());
    #-------------------------------------------------------------------------------
    Debug(SPrintF('[JBs core]: система запущена от имени пользователя (%s)', $USER['name']));
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
Debug(SPrintF('[JBs core]: осуществлен запрос с адреса (%s)', @$_SERVER['REMOTE_ADDR']));
Debug(SPrintF('[JBs core]: REQUEST_URI=(%s)', @$_SERVER['REQUEST_URI']));
Debug(SPrintF('[JBs core]: HTTP_REFERER=(%s)', @$_SERVER['HTTP_REFERER']));
#******************************************************************************#
# ПОДСИСТЕМА ОТЛАДКИ
#******************************************************************************#
$__ERR_CODE = 100;
#-------------------------------------------------------------------------------
Esempio n. 11
0
<?php

if (!Defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!Function_Exists("__IRM_InitReservation")) {
    CComponentUtil::__IncludeLang(BX_PERSONAL_ROOT . "/components/bitrix/intranet.reserve_meeting", "init.php");
    function __IRM_InitReservation($iblockId)
    {
        $arResult = array();
        $arResult["ALLOWED_FIELDS"] = array("ID" => array("NAME" => GetMessage("INAF_F_ID"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "int", "IS_FIELD" => true), "NAME" => array("NAME" => GetMessage("INAF_F_NAME"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "string", "IS_FIELD" => true), "DESCRIPTION" => array("NAME" => GetMessage("INAF_F_DESCRIPTION"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "text", "IS_FIELD" => true), "UF_FLOOR" => array("NAME" => GetMessage("INAF_F_FLOOR"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PLACE" => array("NAME" => GetMessage("INAF_F_PLACE"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PHONE" => array("NAME" => GetMessage("INAF_F_PHONE"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "string", "IS_FIELD" => false));
        $arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_" . $iblockId . "_SECTION", 0, LANGUAGE_ID);
        $arKeys = Array_Keys($arResult["ALLOWED_FIELDS"]);
        foreach ($arKeys as $key) {
            if (!$arResult["ALLOWED_FIELDS"][$key]["IS_FIELD"]) {
                if (!Array_Key_Exists($key, $arUserFields)) {
                    $arFields = array("ENTITY_ID" => "IBLOCK_" . $iblockId . "_SECTION", "FIELD_NAME" => $key, "USER_TYPE_ID" => $arResult["ALLOWED_FIELDS"][$key]["TYPE"]);
                    $obUserField = new CUserTypeEntity();
                    $obUserField->Add($arFields);
                }
            }
        }
        $arResult["ALLOWED_ITEM_PROPERTIES"] = array("UF_PERSONS" => array("NAME" => GetMessage("INTASK_C29_UF_PERSONS"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "UF_PERSONS", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "UF_RES_TYPE" => array("NAME" => GetMessage("INTASK_C29_UF_RES_TYPE"), "ACTIVE" => "Y", "SORT" => 200, "CODE" => "UF_RES_TYPE", "PROPERTY_TYPE" => "L", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId, "VALUES" => array(array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEA"), "DEF" => "Y", "SORT" => 100, "XML_ID" => "A"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEB"), "DEF" => "N", "SORT" => 200, "XML_ID" => "B"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEC"), "DEF" => "N", "SORT" => 200, "XML_ID" => "C"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPED"), "DEF" => "N", "SORT" => 300, "XML_ID" => "D"))), "UF_PREPARE_ROOM" => array("NAME" => GetMessage("INTASK_C29_UF_PREPARE_ROOM"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "UF_PREPARE_ROOM", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "Y", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_TYPE" => array("NAME" => GetMessage("INTASK_C29_PERIOD_TYPE"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_TYPE", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "NONE", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_COUNT" => array("NAME" => GetMessage("INTASK_C29_PERIOD_COUNT"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_COUNT", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "EVENT_LENGTH" => array("NAME" => GetMessage("INTASK_C29_EVENT_LENGTH"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "EVENT_LENGTH", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_ADDITIONAL" => array("NAME" => GetMessage("INTASK_C29_PERIOD_ADDITIONAL"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_ADDITIONAL", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId));
        $dbIBlockProps = CIBlock::GetProperties($iblockId);
        while ($arIBlockProps = $dbIBlockProps->Fetch()) {
            if (Array_Key_Exists($arIBlockProps["CODE"], $arResult["ALLOWED_ITEM_PROPERTIES"])) {
                $arResult["ALLOWED_ITEM_PROPERTIES"][$arIBlockProps["CODE"]]["ID"] = $arIBlockProps["ID"];
            }
        }
        $keys = Array_Keys($arResult["ALLOWED_ITEM_PROPERTIES"]);
        foreach ($keys as $key) {
Esempio n. 12
0
<?php

/*
 * This work is hereby released into the Public Domain.
 * To view a copy of the public domain dedication,
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 */
if (!Function_Exists('ImageAntiAlias')) {
    function ImageAntiAlias()
    {
        return TRUE;
    }
}
/*
 * Get the minimum of an array and ignore non numeric values
 */
function array_min($array)
{
    if (is_array($array) and count($array) > 0) {
        do {
            $min = array_pop($array);
            if (is_numeric($min) === FALSE) {
                $min = NULL;
            }
        } while (count($array) > 0 and $min === NULL);
        if ($min !== NULL) {
            $min = (double) $min;
        }
        foreach ($array as $value) {
Esempio n. 13
0
function Image_Get_Size($Source)
{
    /****************************************************************************/
    $__args_types = array('string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    if (!Function_Exists('ImageCreateFromString')) {
        return ERROR | Trigger_Error('[Image_Get_Size]: модуль работы с изображениями не установлен');
    }
    #-----------------------------------------------------------------------------
    $Real = @ImageCreateFromString($Source);
    if (!Is_Resource($Real)) {
        return ERROR | @Trigger_Error("[Image_Get_Size]: не возможно создать изображение");
    }
    #-----------------------------------------------------------------------------
    $Sx = @ImageSx($Real);
    if (!$Sx) {
        return ERROR | @Trigger_Error("[Image_Get_Size]: не возможно получить ширину изображения");
    }
    #-----------------------------------------------------------------------------
    $Sy = @ImageSy($Real);
    if (!$Sy) {
        return ERROR | @Trigger_Error("[Image_Get_Size]: не возможно получить высоту изображения");
    }
    #-----------------------------------------------------------------------------
    return array('Width' => $Sx, 'Height' => $Sy);
}
Esempio n. 14
0
    if (!$IsHead) {
        #---------------------------------------------------------------------------
        $Comp = Comp_Load('Information', $Message, 'Notice');
        if (Is_Error($Comp)) {
            return ERROR | @Trigger_Error(500);
        }
        #---------------------------------------------------------------------------
        return $Comp;
    }
    #-----------------------------------------------------------------------------
    $Table->AddChild(new Tag('TR', new Tag('TD', array('colspan' => Count($Sequence), 'class' => 'TableSuperNoData'), $Message)));
    #-----------------------------------------------------------------------------
    return $Table;
}
#-------------------------------------------------------------------------------
if (!Function_Exists('Table_Super_Replace')) {
    #-----------------------------------------------------------------------------
    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);
            }
        }
Esempio n. 15
0
<?php

#-------------------------------------------------------------------------------
/** @author Бреславский А.В. (Joonte Ltd.) */
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!Defined('ERROR')) {
    #-------------------------------------------------------------------------------
    if (!Define('ERROR', 0xabcdef)) {
        exit("Can't define ERROR constant");
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!Function_Exists('Debug')) {
    #-------------------------------------------------------------------------------
    function Debug($Message)
    {
        /* echo $Message; */
    }
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
function HTTP_Query($Data, $Charset, $Hidden, $IsLogging = TRUE)
{
    /******************************************************************************/
    $__args_types = array('array', 'string', 'string', 'boolean');
    #-------------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
Esempio n. 16
0
    if (!$arMeeting) {
        $arResult["FatalError"] = GetMessage("INAF_MEETING_NOT_FOUND");
    }
}
if (StrLen($arResult["FatalError"]) <= 0) {
    $clearId = IntVal($_REQUEST["clear_id"]);
    if ($clearId > 0 && check_bitrix_sessid()) {
        $dbElements = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $arMeeting["IBLOCK_ID"], "SECTION_ID" => $arMeeting["ID"], "ID" => $clearId), false, false, array("ID", "IBLOCK_ID", "CREATED_BY"));
        if ($arElement = $dbElements->GetNext()) {
            if ($GLOBALS["USER"]->IsAuthorized() && ($GLOBALS["USER"]->IsAdmin() || Count(Array_Intersect($GLOBALS["USER"]->GetUserGroupArray(), $arParams["USERGROUPS_CLEAR"])) > 0 || $arElement["CREATED_BY"] == $GLOBALS["USER"]->GetID())) {
                CIBlockElement::Delete($arElement["ID"]);
            }
        }
    }
}
if (!Function_Exists("__RM_PrepateDate")) {
    function __RM_PrepateDate($time, $startTime, $endTime)
    {
        if ($time < $startTime) {
            $time = $startTime;
        }
        if ($time > $endTime) {
            $time = $endTime;
        }
        if ($time >= $endTime) {
            $timeDoW = 8;
        } else {
            $timeDoW = IntVal(Date("w", $time));
            if ($timeDoW == 0) {
                $timeDoW = 7;
            }
Esempio n. 17
0
<?
IF(Function_Exists("mysql_real_escape_string"))
	DEFINE("VA_REAL_ESCAPE", 1, 1);
ELSE
	DEFINE("VA_REAL_ESCAPE", 0, 1);

CLASS VA_MySQL {
	VAR $affected_rows;
	VAR $DB;
	VAR $mysql_queries;
	VAR $server_info;

//---------------------------------------------------------------------
	FUNCTION VA_MySQL($host, $user, $password, $database) {
		$this->DB = MySQL_Connect($host, $user, $password) OR Die(MySQL_Error());
		MySQL_Select_DB($database, $this->DB) OR Die(MySQL_Error());
		$this->mysql_queries += 2;
		$this->server_info = MySQL_Get_Server_info($this->DB);
		}
//---------------------------------------------------------------------
	FUNCTION Query($query) {
		$result = MySQL_Query($query, $this->DB) OR Die(VA_Message("MySQL Error #".MySQL_ErrNo()." :\n".MySQL_Error()."\n".$query, "bug"));
		$this->affected_rows = MySQL_Affected_Rows($this->DB);
		$this->mysql_queries++;

		RETURN NEW result($result);
		}
//---------------------------------------------------------------------
	FUNCTION Real_Escape_String($string) {
		IF(VA_REAL_ESCAPE)
			$string = MySQL_Real_Escape_String($string, $this->DB);
Esempio n. 18
0
            #-------------------------------------------------------------------------------
            if (Is_Error($Comp)) {
                return ERROR | @Trigger_Error(500);
            }
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
        break;
        #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!Function_Exists('Tidy_Repair_String')) {
    $__MESSAGES[] = 'Модуль для php - tidy не установлен. Возможность редактирования HTML страниц может работать не правильно. Пожалуйста, установите tidy: требуемые пакеты php-tidy.';
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if ($disable_functions = Ini_Get('disable_functions')) {
    $__MESSAGES[] = SPrintF('Внимание! В PHP выключены следюущие функции: <U>%s</U>. Возможно данные функции потребуются для работы системы. Найдите в файле php.ini опцию <U>disable_functions</U> и установите для нее пустое значение.', $disable_functions);
}
#-----------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Count($__MESSAGES)) {
    #-------------------------------------------------------------------------------
    $Rows = array();
    #-------------------------------------------------------------------------------
    foreach ($GLOBALS['__MESSAGES'] as $Error) {
        $Rows[] = array(new Tag('TD', array('class' => 'Standard', 'style' => 'background-color:#FFCCCC;'), $Error));
Esempio n. 19
0
 function Resample_Image()
 {
     if ($this->dst_height <= 0 && $this->dst_width <= 0) {
         return False;
     }
     # Setting defaults and meta
     $image = $this->image;
     $final_width = 0;
     $final_height = 0;
     # Get File Information
     if ($arr_image_size = GetImageSize($this->attachment_file)) {
         list($width_old, $height_old, $image_type) = $arr_image_size;
     } else {
         return False;
     }
     if ($this->crop) {
         $factor = Max($this->dst_width / $width_old, $this->dst_height / $height_old);
         $final_width = $this->dst_width;
         $final_height = $this->dst_height;
     } else {
         # Calculating proportionality
         if ($this->dst_width == 0) {
             $factor = $this->dst_height / $height_old;
         } elseif ($this->dst_height == 0) {
             $factor = $this->dst_width / $width_old;
         } else {
             $factor = Min($this->dst_width / $width_old, $this->dst_height / $height_old);
         }
         $final_width = $width_old * $factor;
         $final_height = $height_old * $factor;
     }
     # Resample the image
     if (!Function_Exists('ImageCreateTrueColor')) {
         return False;
     }
     if (!($this->image = ImageCreateTrueColor($final_width, $final_height))) {
         return False;
     }
     # Copy the Transparency properties
     if ($image_type == IMAGETYPE_GIF || $image_type == IMAGETYPE_PNG) {
         if ($image_type == IMAGETYPE_GIF && $transparency >= 0) {
             $transparency = ImageColorTransparent($image);
             list($r, $g, $b) = Array_Values(ImageColorsForIndex($image, $transparency));
             ImageColorAllocate($this->image, $r, $g, $b);
             Imagefill($this->image, 0, 0, $transparency);
             ImageColorTransparent($this->image, $transparency);
         } elseif ($image_type == IMAGETYPE_PNG) {
             ImageAlphaBlending($this->image, False);
             ImageSaveAlpha($this->image, True);
         }
     }
     if (!Function_Exists('ImageCopyResampled')) {
         return False;
     }
     if ($this->crop) {
         # Crop the image
         ImageCopyResampled($this->image, $image, 0, 0, ($width_old * $factor - $final_width) / (2 * $factor), ($height_old * $factor - $final_height) / (2 * $factor), $final_width, $final_height, $final_width / $factor, $final_height / $factor);
         // int $src_w , int $src_h
     } else {
         # Resample aspect ratio
         ImageCopyResampled($this->image, $image, 0, 0, 0, 0, $final_width, $final_height, $width_old, $height_old);
     }
     return True;
 }