Файл: adultscript-2.0.3-pro/files/libraries/framework/log.php
Строк: 16
<?php
defined('_VALID') or die('Restricted Access!');
class VLog
{
private static $logging = NULL;
private static $file = NULL;
public static function write($msg, $file=NULL)
{
if (!isset(self::$logging)) {
self::$logging = (VF::cfg_item('log') == '1') ? TRUE : FALSE;
}
if (self::$logging === FALSE) {
return;
}
if (!isset(self::$file)) {
self::$file = (isset($file)) ? $file : date('Y-M-d').'_'.md5(VF::cfg_item('secret')).'.log';
}
$log_file = TMP_DIR.'/logs/'.self::$file;
file_put_contents($log_file,'['.date('Y-m-d h:i:s').']: '.$msg."n", FILE_APPEND);
if (substr(sprintf('%o', fileperms($log_file)), -4) != '0777') {
chmod($log_file, 0777);
}
}
public static function add($msg, $file = null)
{
static::write($msg, $file);
}
}