function System_Load($Name) { /****************************************************************************/ $__args_types = array('string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $Paths = Func_Get_Args(); if (!Count($Paths)) { return ERROR | @Trigger_Error('[System_Load]: не передан ни один путь к системному компоненту'); } #----------------------------------------------------------------------------- $Loaded =& Link_Get('System', 'array'); #----------------------------------------------------------------------------- foreach ($Paths as $Path) { #--------------------------------------------------------------------------- if (System_IsLoaded($Path)) { continue; } #--------------------------------------------------------------------------- $Loaded[] = $Path; #--------------------------------------------------------------------------- $Path = System_Element(SPrintF('system/%s', $Path)); if (Is_Error($Path)) { return ERROR | @Trigger_Error('[System_Load]: включение не найдено'); } #--------------------------------------------------------------------------- if (Is_Error(Load($Path))) { return ERROR | @Trigger_Error('[System_Load]: не удалось загрузить включение'); } #--------------------------------------------------------------------------- Debug(SPrintF('[System_Load]: компонент системы (%s) был загружен', $Path)); } }
private function _AddCLEditor($Sender) { // Turn off safestyles so the inline styles get applied to comments $Config = Gdn::Factory(Gdn::AliasConfig); $Config->Set('Garden.Html.SafeStyles', FALSE); // Add the CLEditor to the form $Options = array('ie' => 'gt IE 6', 'notie' => TRUE); // Exclude IE6 $Sender->RemoveJsFile('jquery.autogrow.js'); $Sender->AddJsFile('jquery.cleditor' . (Debug() ? '' : '.min') . '.js', 'plugins/cleditor', $Options); $Sender->AddCssFile('jquery.cleditor.css', 'plugins/cleditor', $Options); $Sender->Head->AddString(' <style type="text/css"> a.PreviewButton { display: none !important; } </style> <script type="text/javascript"> jQuery(document).ready(function($) { // Make sure the removal of autogrow does not break anything jQuery.fn.autogrow = function(o) { return; } // Attach the editor to comment boxes jQuery("#Form_Body").livequery(function() { var frm = $(this).parents("div.CommentForm"); ed = jQuery(this).cleditor({width:"100%", height:"100%"})[0]; this.editor = ed; // Support other plugins! jQuery(frm).bind("clearCommentForm", {editor:ed}, function(e) { frm.find("textarea").hide(); e.data.editor.clear(); }); }); }); </script>'); }
public function getByURL(string $url_string) : Url { $this->cache_name .= str_replace('/', ':', $url_string); $serialized = get_instance()->cache->file->get($this->cache_name); if ($serialized != FALSE) { $url = unserialize($serialized); debug($url, '$url from cache'); if ($url instanceof Url) { return $url; } } $this->db->group_start(); $this->db->where('short_url', $url_string)->or_where('long_url', $url_string); $this->db->group_end(); $query = $this->db->get(); if ($query != FALSE) { $result = $query->custom_result_object('Model\\Data\\Urls\\Url'); Debug($result, '$result'); if (isset($result[0])) { $saveCache = get_instance()->cache->file->save($this->cache_name, serialize($result[0]), 3600); return $result[0]; } return new Url(); } else { throw new \Exception('404 - URL Not Found!'); } }
/** * Add Debugger info to every page. * * @param $Sender */ public function base_afterBody_handler($Sender) { $Session = Gdn::session(); if (!Debug() && !$Session->checkPermission('Plugins.Debugger.View')) { return; } require $Sender->fetchViewLocation('Debug', '', 'plugins/Debugger'); }
function dbLog($sql, $update = false) { global $dbLogLevel; $noExecute = $update && $dbLogLevel >= DB_LOG_DEBUG; if ($dbLogLevel > DB_LOG_OFF) { Debug("SQL-LOG: {$sql}" . ($noExecute ? " (not executed)" : "")); } return $noExecute; }
public function getParams() { Debug(print_r($this->params, true)); $Service = DB_Select('Services', array('ID', 'Code', 'Name', 'NameShort'), array('UNIQ', 'ID' => $this->params['ServiceID'])); if (!Is_Array($Service)) { return ERROR | @Trigger_Error(500); } $this->params['Service'] = $Service; return $this->params; }
/** * Add Debugger info to dashboard after content asset. * * @param $sender * @param $args */ public function base_afterRenderAsset_handler($sender, $args) { if (val('AssetName', $args) == 'Content' && $sender->MasterView == 'admin') { $session = Gdn::session(); if (!Debug() || !$session->checkPermission('Plugins.Debugger.View')) { return; } require $sender->fetchViewLocation('Debug', '', 'plugins/Debugger'); } }
private function respond() { if ($this->responded == false) { $this->output->set_content_type('application/json'); $this->output->set_output($this->response); Debug($this->response, '$this->response'); $this->responded = true; } return $this->responded; }
/** * DB_Insert * ------------------------- **/ public function DB_Insert() { $F = ['type', 'time', 'send_date', 'email', 'status', 'error', 'bounce', 'jobid', 'domain', 'ip', 'longip', 'server']; if (!empty($this->V)) { $this->DB->PUT('LOGS.logs.pmta_' . strtoupper(hostname), $F, $this->V, 'DELAYED'); file_put_contents(LOGS . 'apps/logger/db_insert.log', Debug($this->DB)); $this->V = []; $this->i = 0; } }
/** * Parsing view content * * @param string $source * * @return mixed */ public function parse($source) { $this->resetParser(); preg_match_all($this->ionize_pattern, $source, $matches); Debug($matches, '$matches'); require_once "Tag.php"; foreach ($matches[0] as $index => $src) { $sourceCompiled = FALSE; Debug($src, '$source'); // If the tag is a closing tag then close the parent if (strpos($src, '</') !== FALSE) { $parent = $this->getParent(); if ($parent != NULL) { $this->compile[] = [$src => $parent->getNativeCodeClosing()]; $sourceCompiled = TRUE; } $this->closeParent(); } // Creating the tag from the source if ($sourceCompiled == FALSE) { $parent = $this->getParent(); //Debug($parent, '$parent'); $tag = new Tag($src, $parent); //Debug($tag, '$tag'); $this->compile[] = [$src => $tag->getNativeCodeOpening()]; $this->tags[] = $tag; $this->openParent(); } // If the tag closed in one line then close the parent if (strpos($src, '/>') !== FALSE) { $parent = $this->getParent(); if ($parent != NULL) { $closingCode = $parent->getNativeCodeClosing(); if (!empty($closingCode)) { $this->compile[] = [$src => $closingCode]; } } $this->closeParent(); } } Debug('Compiler contents:'); $parsed = $source; foreach ($this->compile as $index => $task) { $sourceCode = key($task); Debug($sourceCode, '$sourceCode'); $nativeCode = $task[$sourceCode]; Debug($nativeCode, '$nativeCode'); $preg_search = '/' . preg_quote($sourceCode, '/') . '/im'; Debug($preg_search, '$preg_search'); $parsed = preg_replace($preg_search, $nativeCode, $parsed, 1); } //$parsed = str_replace(array_keys($this->compile), array_values($this->compile), $source); Debug($parsed, '$parsed'); return $parsed; }
/** * Constructor. * * @param <type> $CodeID * @param <type> $String * @param <type> $Parent * @return <type> */ function __construct($CodeID, $String, $Parent = NULL) { $__args_types = array('string', 'string', 'NULL,object'); $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); Debug(SPrintF('[Exception]: [%s]=(%s)', $CodeID, $String)); $this->CodeID = $CodeID; $this->String = $String; $this->Parent = $Parent; return $this; }
public function get($key) { // Check args. $__args_types = array('string'); $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); $result = apc_fetch($key); if (!$result) { Debug(SPrintF('[APCCache::get]: не удалось извлечь объект [key=%s]', $key)); } return $result; }
function getOutput() { /* foreach($this->xml->channel->item as $item) { Debug($item); } */ for ($i = 0; $i < sizeof($this->articles); $i++) { Debug($this->articles[$i], $i); } }
public function __construct($attributes = NULL, $parent = NULL) { $ionize = \Ionize::getInstance(); Debug($ionize, '$ionize'); if (count($ionize->contents) > 0) { $this->output = TRUE; } foreach ($ionize->contents as $content) { $this->addItem(new Article($content)); } Info(get_class() . ' Initialized'); }
function DNSmanager4_Get_Users($Settings) { /******************************************************************************/ $__args_types = array('array'); #------------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /******************************************************************************/ $authinfo = SPrintF('%s:%s', $Settings['Login'], $Settings['Password']); #------------------------------------------------------------------------------- $HTTP = array('Address' => $Settings['Address'], 'Port' => $Settings['Port'], 'Host' => $Settings['Address'], 'Protocol' => $Settings['Protocol'], 'Hidden' => $authinfo, 'IsLogging' => $Settings['Params']['IsLogging']); #------------------------------------------------------------------------------- $Response = HTTP_Send('/manager/dnsmgr', $HTTP, array(), array('authinfo' => $authinfo, 'out' => 'xml', 'func' => 'user')); if (Is_Error($Response)) { return new gException('NOT_CONNECTED_TO_SERVER', 'Не удалось соедениться с сервером'); } #------------------------------------------------------------------------------- $Response = Trim($Response['Body']); #------------------------------------------------------------------------------- $XML = String_XML_Parse($Response); if (Is_Exception($XML)) { return new gException('WRONG_SERVER_ANSWER', $Response, $XML); } #------------------------------------------------------------------------------- $XML = $XML->ToArray('elem'); #------------------------------------------------------------------------------- $Users = $XML['doc']; #------------------------------------------------------------------------------- if (isset($Users['error'])) { return new gException('GET_USERS_ERROR', $Users['error']); } #------------------------------------------------------------------------------- Debug(SprintF('[system/libs/DNSmanager4.php]: Users = %s', print_r($Users, true))); $Result = array(); #------------------------------------------------------------------------------- foreach ($Users as $User) { #------------------------------------------------------------------------------- if (!isset($User['name'])) { continue; } #------------------------------------------------------------------------------- #if(!IsSet($User['owner'])) # continue; #------------------------------------------------------------------------------- #if($User['owner'] == $Settings['Login']) $Result[] = $User; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- return $Result; #------------------------------------------------------------------------------- }
public function Base_AfterBody_Handler($Sender) { $Session = Gdn::Session(); if (!Debug() && !$Session->CheckPermission('Plugins.Debugger.View')) { return; } if (!$Sender->Head) { $Sender->Head = new HeadModule($Sender); } $Sender->Head->AddCss('/plugins/Debugger/style.css'); //$Session = Gdn::Session(); //if ($Session->CheckPermission('Plugins.Debugger.View')) { $String = '<div id="Sql" class="DebugInfo">'; $String .= '<h2>' . T('Debug Information') . '</h2>'; // Add the canonical Url. if (method_exists($Sender, 'CanonicalUrl')) { $CanonicalUrl = htmlspecialchars($Sender->CanonicalUrl(), ENT_COMPAT, 'UTF-8'); $String .= '<div class="CanonicalUrl"><b>' . T('Canonical Url') . "</b>: <a href=\"{$CanonicalUrl}\">{$CanonicalUrl}</a></div>"; } $Database = Gdn::Database(); $SQL = $Database->SQL(); if (!is_null($Database)) { $Queries = $Database->Queries(); $QueryTimes = $Database->QueryTimes(); $String .= '<h3>' . count($Queries) . ' queries in ' . $Database->ExecutionTime() . 's</h3>'; foreach ($Queries as $Key => $QueryInfo) { $Query = $QueryInfo['Sql']; // this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0". if (isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) { $tmp = $QueryInfo['Parameters']; $Query = $SQL->ApplyParameters($Query, $tmp); } $String .= $QueryInfo['Method'] . '<small>' . @number_format($QueryTimes[$Key], 6) . 's</small>' . (isset($QueryInfo['Cache']) ? '<div><b>Cache:</b> ' . var_export($QueryInfo['Cache'], TRUE) . '</div>' : '') . '<pre>' . htmlspecialchars($Query) . ';</pre>'; } } $String .= '<h3>Controller Data</h3><pre>'; $String .= self::FormatData($Sender->Data); $String .= '</pre>'; global $Start; $String .= '<h3>Page completed in ' . round(Now() - $_SERVER['REQUEST_TIME'], 4) . 's</h3>'; /* <div> <strong>Application:</strong> ' . $Sender->ApplicationFolder . '; <strong>Controller:</strong> ' . $Sender->ClassName . '; <strong>Method:</strong> ' . $Sender->RequestMethod . '; </div> </div>'; */ $String .= '</div>'; echo $String; //} }
public function FindSystem($ExtraIPOrderID, $OrderType, $DependOrderID) { /****************************************************************************/ $__args_types = array('integer', 'string', 'integer'); $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ /* find server */ Debug(SPrintF('[system/classes/ExtraIPServer]: OrderType = %s', $OrderType)); #------------------------------------------------------------------------------- $Columns = array(SPrintF('(SELECT `ServerID` FROM `OrdersOwners` WHERE `OrdersOwners`.`ID` = `%sOrdersOwners`.`OrderID`) AS `ServerID`', $OrderType), 'Login'); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $OrderServer = DB_Select(SPrintF('%sOrdersOwners', $OrderType), $Columns, array('UNIQ', 'ID' => $DependOrderID)); switch (ValueOf($OrderServer)) { case 'error': return ERROR | @Trigger_Error('[Server->Select]: ошибка поиска зависимого заказа'); case 'exception': return new gException('DEPEND_ORDER_NOT_FOUND', 'Не найден заказ к которому необходимо добавить/удалить IP адрес'); case 'array': #------------------------------------------------------------------------------- $SysInfo = DB_Select('Servers', '*', array('UNIQ', 'ID' => $OrderServer['ServerID'])); switch (ValueOf($SysInfo)) { case 'error': return ERROR | @Trigger_Error('[Server->Select]: не удалось выбрать сервер'); case 'exception': return new gException('SERVER_NOT_FOUND', 'Указаный сервер не найден'); case 'array': /* find server info */ #------------------------------------------------------------------------- # add User Login on server $SysInfo['UserLogin'] = $OrderServer['Login']; Debug(SPrintF('[system/classes/ExtraIPServer]: OrderType = %s', $OrderType)); Debug(SPrintF('[system/classes/ExtraIPServer]: found ICS: %s', $SysInfo['Params']['SystemID'])); $this->SystemID = $SysInfo['Params']['SystemID']; $this->Settings = $SysInfo; if (Is_Error(System_Load(SPrintF('libs/%s.php', $this->SystemID)))) { @Trigger_Error('[Server->Select]: не удалось загрузить целевую библиотеку'); } // + надо загрузить собсно либу для работы с IP адресами #------------------------------------------------------------------------------- return TRUE; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } default: return ERROR | @Trigger_Error(101); } }
public function getParams() { #------------------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $this->params['ServerID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { #------------------------------------------------------------------------------- case 'error': return ERROR | @Trigger_Error(500); case 'true': #------------------------------------------------------------------------------- // For RegRu only if ($Server->Settings['Params']['SystemID'] == 'RegRu' && In_Array($this->params['Name'], array('ru', 'su', 'рф'))) { #------------------------------------------------------------------------------- $Domain = SprintF("%s.%s", $this->params['DomainName'], $this->params['Name']); #------------------------------------------------------------------------------- $Result = $Server->GetUploadID($Domain); #------------------------------------------------------------------------------- switch (ValueOf($Result)) { case 'error': return ERROR | @Trigger_Error(500); case 'array': #------------------------------------------------------------------------------- $UploadID = $Result['UploadID']; #------------------------------------------------------------------------------- $this->params['UploadID'] = $UploadID; #------------------------------------------------------------------------------- Debug(SPrintF('[system/classes/DomainOrdersOnRegisterMsg.class.php]: UploadID = %s', $UploadID)); #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- return $this->params; #------------------------------------------------------------------------------- }
public function disconnect() { if ($this->mbox) { $this->expungeDeletedMessages(); $errors = imap_errors(); if ($errors) { foreach ($errors as $error) { #trigger_error($error); Debug(SPrintF('[system/classes/ImapMailbox]: %s', Trim($error))); } } imap_close($this->mbox); $this->mbox = null; } }
function dbquery($query, $mute = FALSE) { global $query_counter, $query_log, $db_connect; $query_counter++; $query_log .= $query . "<br>\n"; $result = @mysql_query($query, $db_connect); if (!$result && $mute == FALSE) { echo "{$query} <br>"; echo mysql_error($db_connect); Debug(mysql_error($db_connect) . "<br>" . $query . "<br>" . BackTrace()); return false; } else { return $result; } }
public function Gdn_Form_UploadBox_Create($Form) { $FieldName =& $Form->EventArguments[0]; $Attributes =& $Form->EventArguments[1]; $Result = $Form->TextBox($FieldName, $Attributes); $Folder = GetValue('Folder', $Attributes, '', True); $AddYear = GetValue('AddYear', $Attributes, '', True); $AddMonth = GetValue('AddMonth', $Attributes, '', True); if (!$Folder) { $Folder = GetValue('UploadTo', $Attributes, '', True); if (Debug() && $Folder) { trigger_error("You should use 'Folder' instead of 'UploadTo'.", E_USER_DEPRECATED); } } if (CheckPermission('Plugins.Morf.Upload.Allow')) { $Data = compact('Folder', 'AddYear', 'AddMonth'); $Result .= $Form->Hidden($FieldName . 'UploadBox', array('value' => json_encode($Data))); } return $Result; }
public function asset() { $contentFile = FALSE; $segments = explode('.', $this->url_string); $extension = end($segments); $fileName = $this->url_string; if ($extension == 'random') { $this->load->helper('directory'); $path = str_replace('.random', '', $this->url_string); $map_theme = directory_map($this->assets_path . $path, 1); if (empty($map_theme)) { $map_theme = array(); } Debug($map_theme, '$map_theme'); $map_ionize = directory_map(APPPATH . 'assets' . DS . $path, 1); if (empty($map_ionize)) { $map_ionize = array(); } Debug($map_ionize, '$map_ionize'); $map = array_merge($map_theme, $map_ionize); Debug($map, '$map'); if (count($map) > 0) { shuffle($map); $fileName = str_replace('.random', $map[0], $fileName); Debug($fileName, '$fileName'); } } if (file_exists($this->assets_path . $fileName)) { $contentFile = $this->assets_path . $fileName; } elseif (file_exists(APPPATH . 'assets' . DS . $fileName)) { $contentFile = APPPATH . 'assets' . DS . $fileName; } if ($contentFile != FALSE) { $content = file_get_contents($contentFile); $this->output->set_content_type($extension); $this->output->set_output($content); } else { show_404(); } }
// Make sure that we have something to check first if ($this->filename != '') { Debug('CheckData(), Checking File data for errors.'); // Check to see if the dirstory is writable if (!is_writable($this->directory)) { // Try to make it writable $path = ''; foreach (explode('/', $this->directory) as $data) { $path .= $data . '/'; if (!file_exists($path)) { umask(00); mkdir($path, 0775); } } } if (!is_writable($this->directory)) { $error[] = 'Directory is not writable, please check with the systems administrator'; } // Check file types if (!in_array($this->type, $acceptedTypes)) { $error[] = 'This type of file is not permitted, Please try again'; } else { if ($this->size == 0) { $error[] = 'The filesize is zero, Please try again';
public function render() { // Get instance of the urls handler class $this->urls = Model\Data\Urls\Urls::getInstance(); // Get the related contents from the URL and language $url = $this->urls->setBaseURL($this->base_url)->setLanguage($this->language)->getByURL($this->url_string); if ($url->id_url != NULL) { // Get instance of the contents handler class $this->contents = Model\Data\Contents\Contents::getInstance(); // Get the related contents from the URL and language $content = $this->contents->setLanguage($this->language)->getByID($url->id_content); // Load Theme handler class $ionize = Ionize::getInstance(); // Add conttents data to the Ionize $ionize->setContent($content); // Render the webpage $output = $ionize->render(); Debug($output, '$output'); // Set the output $this->output->set_output($output); } else { show_404(); } }
public function getByID(int $id_content) : Content { $this->cache_name .= '#' . $id_content; $serializedContent = get_instance()->cache->file->get($this->cache_name); if ($serializedContent != FALSE) { $content = unserialize($serializedContent); debug($content, '$content from cache'); if ($content instanceof Content) { return $content; } } $this->db->group_start(); $this->db->where('id_content', $id_content); $this->db->group_end(); $query = $this->db->get(); if ($query != FALSE) { $result = $query->custom_result_object('Model\\Data\\Contents\\Content'); Debug($result, '$result'); $saveCache = get_instance()->cache->file->save($this->cache_name, serialize($result[0]), 3600); return $result[0]; } else { throw new \Exception('404 - Content Not Found!'); } }
function operationOnTorrentFiles($torrent, &$base_path, $base_file, $is_multy_file, $dest_path, $fileop_type) { global $autodebug_enabled; $ret = false; if ($is_multy_file) { $sub_dir = rtAddTailSlash($base_file); } else { $sub_dir = ''; } // $base_file - is really a file $base_path .= $sub_dir; $dest_path .= $sub_dir; Debug("Operation " . $fileop_type); Debug("from " . $base_path); Debug("to " . $dest_path); $files = array(); $info = $torrent->info; if (isset($info['files'])) { foreach ($info['files'] as $key => $file) { $files[] = implode('/', $file['path']); } } else { $files[] = $info['name']; } if ($base_path != $dest_path && is_dir($base_path)) { if (rtOpFiles($files, $base_path, $dest_path, $fileop_type, $autodebug_enabled)) { if ($fileop_type == "Move" && $sub_dir != '') { Debug("clean " . $base_path); rtRemoveDirectory($base_path, false); } $ret = true; } } $base_path = $dest_path; return $ret; }
public static function run(string $class_name) : bool { if (!class_exists($class_name)) { if (self::$ci == NULL) { self::$ci =& get_instance(); } Debug($class_name, 'IO_Autoloader::run'); $segments = explode('\\', $class_name); if (count($segments) < 2) { Debug(debug_backtrace(), 'Backtrace'); } $class_type = strtolower($segments[0]); unset($segments[0]); $class_name = end($segments); $endIndex = key($segments); foreach ($segments as $idx => $segment) { if ($endIndex != $idx) { $segments[$idx] = strtolower($segment); } } $filename = implode(DIRECTORY_SEPARATOR, $segments); if ($class_type == 'model') { Debug($filename, 'include model'); self::$ci->load->model($filename, FALSE); } if ($class_type == 'libraries' || $class_type == 'ionize') { if ($class_type == 'ionize') { $filename = 'ionize' . DIRECTORY_SEPARATOR . $filename; } Debug($filename, 'include library'); self::$ci->load->library($filename, FALSE); } return TRUE; } return FALSE; }
if (Is_Error($PostingID)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Event = array('UserID' => $Invoice['UserID'], 'PriorityID' => 'Billing', 'IsReaded' => FALSE, 'Text' => SPrintF('Осуществлён автоматический возврат средств по счёту #%u, процессинговый центр прислал статус "%s"', $Number, $Args['Status'])); $Event = Comp_Load('Events/EventInsert', $Event); if (!$Event) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: #------------------------------------------------------------------------------- Debug(SPrintF('[comp/Invoices/PaymentSystems/Uniteller]: статус "%s", счёт #%u проигнорирован', $Args['Status'], $Args['Order_ID'])); return "OK\n"; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'Invoices', 'StatusID' => $StatusID, 'RowsIDs' => $InvoiceID, 'Comment' => $Comment)); #------------------------------------------------------------------------------- switch (ValueOf($Comp)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default:
#------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Config = System_XML('config/Config.xml', array(HOST_ID)); if (Is_Error($Config)) { return new gException('ERROR_TEMPLATE_LOAD', 'Ошибка загрузки шаблона'); } #------------------------------------------------------------------------------- $Params = Array_ToLine($Config); #------------------------------------------------------------------------------- foreach (Array_Keys($Params) as $Key) { #------------------------------------------------------------------------------- if (!In_Array($Key, $ShareConfigsParams)) { #------------------------------------------------------------------------------- Debug(SPrintF('[comp/Tasks/GC/CheckConfigParams]: в конфигурационном файле обнаружен не используемый параметр: %s', $Key)); #------------------------------------------------------------------------------- if ($Settings['IsEvent']) { #------------------------------------------------------------------------------- $Event = array('IsReaded' => FALSE, 'PriorityID' => 'System', 'Text' => SPrintF('Обнаружен неиспользуемый параметр конфигурационного файла: %s, со значением (%s). Удалите его, или отключите задачу поиска неиспользуемых параметров. При удалении, будте аккуратны и внимательны, сохраняйте бэкап конфигурационного файла.', $Key, $Params[$Key])); $Event = Comp_Load('Events/EventInsert', $Event); if (!$Event) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #-------------------------------------------------------------------------------
/** * Adds an error to the errors collection and optionally relates it to the * specified FieldName. Errors added with this method can be rendered with * $this->Errors(). * * @param mixed $ErrorCode * - <b>string</b>: The translation code that represents the error to display. * - <b>Exception</b>: The exception to display the message for. * @param string $FieldName The name of the field to relate the error to. */ public function AddError($Error, $FieldName = '') { if (is_string($Error)) { $ErrorCode = $Error; } elseif (is_a($Error, 'Gdn_UserException')) { $ErrorCode = '@' . $Error->getMessage(); } elseif (is_a($Error, 'Exception')) { // Strip the extra information out of the exception. $Parts = explode('|', $Error->getMessage()); $Message = $Parts[0]; if (count($Parts) >= 3) { $FileSuffix = ": {$Parts[1]}->{$Parts[2]}(...)"; } else { $FileSuffix = ""; } if (Debug()) { $ErrorCode = '@<pre>' . $Message . "\n" . '## ' . $Error->getFile() . '(' . $Error->getLine() . ")" . $FileSuffix . "\n" . $Error->getTraceAsString() . '</pre>'; } else { $ErrorCode = '@' . strip_tags($Error->getMessage()); } } if ($FieldName == '') { $FieldName = '<General Error>'; } if (!is_array($this->_ValidationResults)) { $this->_ValidationResults = array(); } if (!array_key_exists($FieldName, $this->_ValidationResults)) { $this->_ValidationResults[$FieldName] = array($ErrorCode); } else { if (!is_array($this->_ValidationResults[$FieldName])) { $this->_ValidationResults[$FieldName] = array($this->_ValidationResults[$FieldName], $ErrorCode); } else { $this->_ValidationResults[$FieldName][] = $ErrorCode; } } }