Exemplo n.º 1
0
$Result = array();
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Config = Config();
#-------------------------------------------------------------------------------
$Settings = $Config['Interface']['Administrator']['Notes']['Tasks'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!$Settings['ShowUnExecuted']) {
    return $Result;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Marker = SPrintF('%s/hosts/%s/tmp/TaskLastExecute.txt', SYSTEM_PATH, HOST_ID);
#-------------------------------------------------------------------------------
if (Is_Readable($Marker)) {
    #-------------------------------------------------------------------------------
    $LastExecuted = File_Get_Contents($Marker);
    #-------------------------------------------------------------------------------
    $LastExecuted = StrToTime($LastExecuted);
    #-------------------------------------------------------------------------------
    Debug(SPrintF('[comp/Notes/Administrator/CheckCronRun]: LastExecuted = %s', Date('Y-m-d H:i:s', $LastExecuted)));
    #-------------------------------------------------------------------------------
    if ($LastExecuted < Time() - $Settings['CronDownTime']) {
        $Array = array('Message' => SPrintF('Последнее задание было выполнено <B>%s в %s</B>', Date('Y-m-d', $LastExecuted), Date('H:i:s', $LastExecuted)));
    }
} else {
    #-------------------------------------------------------------------------------
    $Array = array('Message' => SPrintF('Планировщик ни разу не запускался в штатном режиме, или, отсутствует доступ к файлу <BR /><B>%s</B>', $Marker));
    #-------------------------------------------------------------------------------
}
Exemplo n.º 2
0
function __Error_Handler__($Number, $Error, $File, $Line)
{
    #-------------------------------------------------------------------------------
    $Message = SPrintF('[!!%s]-%s в линии %s файла %s', $Number, $Error, $Line, $File);
    #-------------------------------------------------------------------------------
    $__ERR_CODE =& $GLOBALS['__ERR_CODE'];
    #-------------------------------------------------------------------------------
    if ((int) $Error && $__ERR_CODE == 100) {
        $__ERR_CODE = $Error;
    }
    #-------------------------------------------------------------------------------
    Debug(SPrintF('[!] %s', $Message));
    //Debug(SPrintF('[!] %s',debug_print_backtrace()));
    #-------------------------------------------------------------------------------
    //Error_Reporting(E_ALL);
    #-------------------------------------------------------------------------------
    if (Error_Reporting()) {
        #-------------------------------------------------------------------------------
        $JBsErrorID = SPrintF('%s[%s]', HOST_ID, Md5(Implode(':', array($Number, $Error, $Line, $File))));
        #-------------------------------------------------------------------------------
        $__SYSLOG =& $GLOBALS['__SYSLOG'];
        #-------------------------------------------------------------------------------
        $Log = Implode("\n", $__SYSLOG);
        #-------------------------------------------------------------------------------
        Report($JBsErrorID, $JBsErrorID);
        #-------------------------------------------------------------------------------
        foreach (array(SYSTEM_PATH, '/tmp') as $Folder) {
            #-------------------------------------------------------------------------------
            $Path = SPrintF('%s/jbs-errors.log', $Folder);
            #-------------------------------------------------------------------------------
            if (File_Exists($Path)) {
                if (FileSize($Path) > 1024 * 1024) {
                    UnLink($Path);
                }
            }
            #-------------------------------------------------------------------------------
            umask(077);
            #-------------------------------------------------------------------------------
            if (!@File_Put_Contents($Path, SPrintF("%s\n\n%s\n\n", $JBsErrorID, $Log), FILE_APPEND)) {
                #-------------------------------------------------------------------------------
                Debug(SPrintF('[__Error_Handler__]: не удалось осуществить запись ошибки в системный лог (%s)', $Path));
                #-------------------------------------------------------------------------------
                continue;
                #-------------------------------------------------------------------------------
            }
            #-------------------------------------------------------------------------------
            break;
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
        if (File_Exists(SPrintF('%s/DEBUG.OUT', SYSTEM_PATH)) || !isset($_SERVER["REMOTE_PORT"])) {
            #-------------------------------------------------------------------------------
            exit($Log);
        } else {
            #-------------------------------------------------------------------------------
            $Errors = array(100 => 'Ошибка выполнения', 101 => 'Неизвестный результат', 201 => 'Неверные параметры', 400 => 'Ошибка данных', 500 => 'Системная ошибка', 600 => 'Ошибка политики безопасности', 601 => 'Неверный реферер', 602 => 'Отсутствует реферер', 603 => 'Неверный ключ CSRF', 700 => 'Нарушение политики прав');
            #-------------------------------------------------------------------------------
            $FilePath = SPrintF('%s/hosts/root/templates/modules/Trigger.Error.html', SYSTEM_PATH);
            #-------------------------------------------------------------------------------
            if (Is_Readable($FilePath)) {
                #-------------------------------------------------------------------------------
                $Result = @File_Get_Contents($FilePath);
                #-------------------------------------------------------------------------------
            } else {
                #-------------------------------------------------------------------------------
                $Result = SPrintF("Cannot read error file: %s<BR />\nError: %%s<BR />\n<!--%%s-->\nErrorID: %%s\n<!--%%s-->", $FilePath);
                #-------------------------------------------------------------------------------
            }
            #-------------------------------------------------------------------------------
            $String = SPrintF('%s (%s)', $Errors[$__ERR_CODE], $__ERR_CODE);
            #-------------------------------------------------------------------------------
            @Header(SPrintF('JBs-ErrorID: %s', $JBsErrorID));
            #-------------------------------------------------------------------------------
            if (isset($_POST['XMLHttpRequest'])) {
                #-------------------------------------------------------------------------------
                $Answer = array('Error' => array('CodeID' => $__ERR_CODE, 'String' => $String), 'Status' => 'Error');
                #-------------------------------------------------------------------------------
                exit(JSON_Encode($Answer));
                #-------------------------------------------------------------------------------
            } else {
                #-------------------------------------------------------------------------------
                exit(SPrintF($Result, $String, $String, $JBsErrorID, Date('Y', Time())));
                #-------------------------------------------------------------------------------
            }
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
}
Exemplo n.º 3
0
 public function Get_Template_Properties($template_file)
 {
     # Check if this is a file
     if (!($template_file && Is_File($template_file) && Is_Readable($template_file))) {
         return False;
     }
     # Read meta data from the template
     $arr_properties = Array_Merge(Get_File_Data($template_file, array('name' => 'Fancy Gallery Template', 'description' => 'Description', 'author' => 'Author', 'author_uri' => 'Author URI', 'author_email' => 'Author E-Mail', 'version' => 'Version')), array('file' => $template_file));
     # Check if there is a name for this template
     if (empty($arr_properties['name'])) {
         return False;
     } else {
         return $arr_properties;
     }
 }