Exemplo n.º 1
0
function judge($task)
{
    writelog($task);
    $path = Config::getInstance()->getVar('path');
    $original_cd = getcwd();
    chdir($path['task'] . $task['task_name']);
    $judge = new Judge($task['task_name'], $task['prob_name'], $task['source_file'], $task['language'], $task['return_url'], $task['public_key']);
    try {
        $result = $judge->compile();
        if ($result == 0) {
            $info = $judge->run();
            if (!is_array($info)) {
                writelog('ERROR: ' . $info);
                switch ($info) {
                    case 'testdata':
                    case 'checker':
                    default:
                        //Run failed
                        $info = array('fatal' => Judge::RESULT_EXECUTOR_ERROR, 'time' => 0, 'memory' => 0, 'score' => 0.0);
                }
            }
        } else {
            //Compile failed
            $info = array('fatal' => Judge::RESULT_COMILATION_ERROR, 'time' => 0, 'memory' => 0, 'score' => 0.0);
        }
        $judge->complete($info);
    } catch (Exception $e) {
        writelog("Stopped");
    }
    $judge->clear();
    chdir($original_cd);
}
Exemplo n.º 2
0
function get_nulagoon_btc_nbt($search_tolerance, $btc_usd)
{
    $url_wall = 'https://bitbucket.org/henry_nu/data/downloads/datetu.json';
    $content_wall = file_get_contents($url_wall);
    $wall_json = json_decode($content_wall, true);
    $url_price = 'https://bitbucket.org/henry_nu/data/downloads/rd.json';
    $content_price = file_get_contents($url_price);
    $price_json = json_decode($content_price, true);
    $ask_total = 0;
    $bid_total = 0;
    if (!check_value($wall_json["bal"]["NBT"]) && !check_value($price_json["ask"])) {
        writelog("nulagoon_btc_nbt", "querry_error", "unresolved");
    } else {
        $tolerance = $btc_usd * $search_tolerance / 100;
        $ask_price = $btc_usd + $tolerance;
        $bid_price = $btc_usd - $tolerance;
        $ask_value = $wall_json["bal"]["NBT"];
        $bid_value = $wall_json["bal"]["BTC"] * $btc_usd;
        $wall_price_ask = $price_json["ask"];
        $wall_price_bid = $price_json["bid"];
        if ($wall_price_ask <= $ask_price) {
            $ask_total = $ask_value;
        }
        if ($wall_price_bid >= $bid_price) {
            $bid_total = $bid_value;
        }
    }
    $total = $ask_total + $bid_total;
    $orderbook = array('tolerance' => $search_tolerance, 'ask_total' => $ask_total, 'bid_total' => $bid_total, 'total' => $total);
    return $orderbook;
}
Exemplo n.º 3
0
function logErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
{
    writelog('Error No: ' . $errno);
    writelog('Error String: ' . $errstr);
    writelog('Error File: ' . $errfile);
    writelog('Error Line: ' . $errline);
    return false;
}
Exemplo n.º 4
0
function error($message, $line, $save) //ToDo: $save=1 => error-saving
{
	writelog('error', $message.' in Zeile '.$line);
	if(!$save)
	{
		echo $message." in Zeile <b>".$line."</b><br>";
	}
}
Exemplo n.º 5
0
function creatlink($src, $dest)
{
    if (is_link($dest)) {
        unlink($dest);
    }
    if (symlink($src, $dest) === false) {
        writelog('Symbol link failed to create from ' . $src . ' to ' . $dest);
    }
}
Exemplo n.º 6
0
function errorlog($type, $message, $halt = 1)
{
    global $_G;
    $user = empty($_G['member']['username']) ? '' : $_G['member']['username'] . '<br />';
    $user .= $_G['clientip'] . '|' . $_SERVER['REMOTE_ADDR'];
    writelog('errorlog', htmlspecialchars(TIMESTAMP . "\t{$type}\t{$user}\t" . str_replace(array("\r", "\n"), array(' ', ' '), trim($message))));
    if ($halt) {
        exit;
    }
}
Exemplo n.º 7
0
 function getUserHash($username)
 {
     $queryStr = "select user_hash from users where user_name = '{$username}'";
     $user = $this->query($queryStr);
     writelog($queryStr);
     if ($user->num_rows > 0) {
         $row = $user->fetch_row();
         return $row[0];
     } else {
         return null;
     }
 }
Exemplo n.º 8
0
function checkmailvalid($to, $title, $body)
{
    $a = checkuser();
    $username = $a[0];
    if ($username == "") {
        echo '-15';
        exit;
    }
    $time = time();
    date_default_timezone_set('Asia/Shanghai');
    writelog("[" . date("r", $time) . "][E-mail send to {$to} from {$username}] [Title: {$title}] {$body}\n");
}
Exemplo n.º 9
0
 private function sendBack($post_result)
 {
     if ($this->checkStop()) {
         throw new Exception('stop');
     }
     $return_url = $this->return_url;
     $public_key = $this->public_key;
     writelog('Sending back to ' . $return_url);
     writelog($post_result);
     $client = new BFL_RemoteAccess_Client($return_url, $public_key, 0);
     $client->writeRecord($post_result);
 }
Exemplo n.º 10
0
function get_nulagoon_btc_nbt()
{
    $url_price = 'https://bitbucket.org/henry_nu/data/downloads/rd.json';
    $content_price = file_get_contents($url_price);
    $price_json = json_decode($content_price, true);
    if (!check_value($price_json["24vol"][0])) {
        writelog("nulagoon_btc_nbt", "querry_error", "unresolved");
        $nulagoon_btc_nbt_24 = "-1";
    } else {
        $nulagoon_btc_nbt_24 = $price_json["24vol"][0];
    }
    return $nulagoon_btc_nbt_24;
}
Exemplo n.º 11
0
/**
 * Funktion verschriebt Dateien in in eine geparste Ordnerhierarchie
 *
 * @author Jens Kohl <*****@*****.**>
 * @param string Dateiname
 * @param string Verzeichnisname
 * @return string Statusnachricht
 */
function move_file($in_file, $dir)
{
    if (preg_match('/(.*?)(S(\\d{1,2})E(\\d{1,2})|(\\d{1,2})x(\\d{1,2})).*?\\.(avi|divx|mkv|mov|wmv)$/i', $in_file, $treffer)) {
        //var_dump($treffer);
        global $config, $microbloging;
        $title = $treffer[1];
        $title = preg_replace('/(\\.|-|_)/i', ' ', $title);
        $title = ucwords(trim($title));
        $season = $treffer[3] ? (int) $treffer[3] : (int) $treffer[5];
        $episode = $treffer[4] ? (int) $treffer[4] : (int) $treffer[6];
        $extension = $treffer[7];
        if (RENAME_DIVX && preg_match('/xvid/i', $in_file)) {
            $extension = 'divx';
        }
        $moved = false;
        $filesize = filesize($dir . '/' . $in_file);
        foreach ($config->sorter->destination->directory as $thisDest) {
            if (disk_free_space($thisDest) < $filesize) {
                # Ziellaufwerk zu klein
                writelog($thisDest . ' verfügt nicht über genügend Platz für ' . $in_file, WARN);
            } else {
                # Make the directory
                if (!file_exists($thisDest . '/' . $title . '/Season ' . $season)) {
                    if (!file_exists($thisDest . '/' . $title)) {
                        mkdir($thisDest . '/' . $title);
                    }
                    mkdir($thisDest . '/' . $title . '/Season ' . $season);
                }
                $new_file = $thisDest . '/' . $title . "/Season " . $season . "/" . sprintf("%02dx%02d", $season, $episode) . " - {$title}.{$extension}";
                rename($dir . '/' . $in_file, $new_file);
                writelog("{$title} {$season} x {$episode} nach {$thisDest} verschoben.", INFO);
                $moved = true;
                if (LOGGING) {
                    // Logfile schreiben
                    global $SDorHD;
                    $logfile = $config->sorter->destination->directory[0] . "/moviesorter.log";
                    if ($extension == 'mkv') {
                        $SDorHD = ' HD';
                    }
                    $logline = '[' . strftime("%Y-%m-%d %H:%M") . "] {$title} ({$season}x{$episode}){$SDorHD}\n";
                    file_put_contents($logfile, $logline, FILE_APPEND | FILE_TEXT);
                }
                $microbloging->send($title . ' S' . sprintf('%02d', $season) . 'E' . sprintf('%02d', $episode) . $SDorHD . ' fertig heruntergeladen. #tvdl');
                return "Moved {$title} ({$season} x {$episode})\n";
            }
            if (!$moved) {
                writelog('Kein Platz für ' . $in_file . " vorhanden.", FAIL);
            }
        }
    }
}
Exemplo n.º 12
0
function w_rlog($string, $t = 'day')
{
    if (is_array($string)) {
        $string = json_encode($string);
    }
    $timestamp = time();
    if ($t == 'day') {
        $f = date('Ymd', $timestamp);
        $filename = DATAPATH . 'log/wlog/' . $f . '.log';
    }
    $logtime = date('Y/m/d H:i:s', $timestamp);
    $record = $logtime . ' - ' . $string . "\n";
    writelog($filename, $record, 'ab');
}
Exemplo n.º 13
0
 public function getAllMedias()
 {
     header('Content-type:text/json');
     $page = empty($_POST['page']) ? 0 : intval(trim(strip_tags($_POST['page'])));
     $pageSize = empty($_POST['pageSize']) ? 20 : intval(trim(strip_tags($_POST['pageSize'])));
     $logStr = "page : " . $_POST['page'] . "\r\n";
     $logStr .= "page2 : " . $page . "\r\n";
     $logStr .= "pageSize : " . $_POST['pageSize'] . "\r\n";
     $logStr .= "pageSize2 : " . $pageSize . "\r\n";
     $logStr .= "version : " . $_POST['version'] . "\r\n";
     writelog($logStr);
     $json = array('medias' => getAllMedias($page, "", "", $pageSize));
     echo proverb_encode($json);
 }
Exemplo n.º 14
0
function rplog($data, $redata, $sec, $t = 'day')
{
    $timestamp = time();
    if ($t == 'day') {
        $f = date('Ymd', $timestamp);
        $filename = BASEDIRS . 'data/rplogs/rplog' . $f . '.php';
    } elseif ($t == 'month') {
        $f = date('Ym', $timestamp);
        $filename = BASEDIRS . 'data/rplogs/rplog' . $f . '.php';
    }
    $logtime = date('Y-m-d H:i:s', $timestamp);
    $reqdata = $data['commandInfo'] ? json_encode($data['commandInfo']) : 'null';
    $redata = $redata ? json_encode($redata) : 'null';
    $record = "<?die;?> {$logtime} - {$data['command']} - {$reqdata} - {$sec} - {$redata}\n";
    writelog($filename, $record, 'ab');
}
Exemplo n.º 15
0
 public function login()
 {
     global $_G;
     $validate_error = array();
     //数据验证
     $validate_error_rules = $this->rules();
     if ($validate_error_rules !== true) {
         return $validate_error_rules;
     }
     require_once libfile('function/member');
     $input_email = $_POST['email'];
     $input_password = $_POST['password'];
     $input_rememberme = $_POST['rememberme'];
     if (!($_G['member_loginperm'] = logincheck($input_email))) {
         $validate_error['password'] = '******';
         return $validate_error;
     }
     $result = userlogin($input_email, $input_password, 0, 0, 'email', $_G['clientip']);
     if ($result['status'] <= 0) {
         $password = preg_replace("/^(.{" . round(strlen($input_password) / 4) . "})(.+?)(.{" . round(strlen($input_password) / 6) . "})\$/s", "\\1***\\3", $input_password);
         $errorlog = dhtmlspecialchars(TIMESTAMP . "\t" . ($result['ucresult']['username'] ? $result['ucresult']['username'] : $input_email) . "\t" . $password . "\t" . "Ques #" . intval($_GET['questionid']) . "\t" . $_G['clientip']);
         writelog('illegallog', $errorlog);
         loginfailed($input_email);
         failedip();
         if ($_G['member_loginperm'] > 1) {
             $loginperm = $_G['member_loginperm'] - 1;
             $validate_error['password'] = '******' . $loginperm . ' 次';
             return $validate_error;
         } elseif ($_G['member_loginperm'] == -1) {
             $validate_error['password'] = '******';
             return $validate_error;
         } else {
             $validate_error['password'] = '******';
             return $validate_error;
         }
     } else {
         setloginstatus($result['member'], $_GET['rememberme'] ? 2592000 : 0);
         //是否记住密码,自动登录
         if ($_G['member']['lastip'] && $_G['member']['lastvisit']) {
             dsetcookie('lip', $_G['member']['lastip'] . ',' . $_G['member']['lastvisit']);
         }
         C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'port' => $_G['remoteport'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP));
         $ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : '';
         //是否Ucenter同步登录
         return true;
     }
 }
Exemplo n.º 16
0
function db_open()
{
    //$dbase = mysqli_connect (DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME);
    $dbconn = mysql_pconnect(DB_SERVER, DB_USER, DB_PASSWORD);
    if ($dbconn === FALSE) {
        require_once 'mod_file.php';
        writelog('error.log', "Connect failed : dbconn === FALSE ( " . mysql_error() . " )");
        return null;
    }
    $dbase = mysql_select_db(DB_NAME);
    if ($dbase === FALSE) {
        require_once 'mod_file.php';
        writelog('error.log', "Select DB failed : dbase === FALSE");
        return null;
    }
    return $dbconn;
}
Exemplo n.º 17
0
function die_err($code = 500, $message = null)
{
    //с помощью этой функции прерывается исполнение кода,
    //если дальше исполнять смысла нет, т.е. если явно не работает что-то базовое.
    //заодно в заголовке отдаем правильный код
    $status_codes = array(100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 426 => 'Upgrade Required', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 509 => 'Bandwidth Limit Exceeded', 510 => 'Not Extended');
    if (!in_array($code, $status_codes)) {
        $code = 500;
    }
    $status_string = $code . ' ' . $status_codes[$code];
    header($_SERVER['SERVER_PROTOCOL'] . ' ' . $status_string, true, $code);
    if (empty($message)) {
        $message = $status_string;
    }
    writelog('ERROR: ' . $code . ' > ' . $message);
    die($message);
}
Exemplo n.º 18
0
 function delete($u_arr)
 {
     if (empty($u_arr)) {
         return false;
     }
     require_once R_P . 'require/writelog.php';
     global $admin_name, $timestamp, $onlineip;
     $udb = array();
     $userService = $this->_getUserService();
     foreach ($userService->getByUserIds($u_arr) as $rt) {
         $log = array('type' => 'deluser', 'username1' => $rt['username'], 'username2' => $admin_name, 'field1' => 0, 'field2' => $rt['groupid'], 'field3' => '', 'descrip' => 'deluser_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip);
         writelog($log);
         $udb[] = $rt['uid'];
     }
     $this->delUserByIds($udb);
     require_once R_P . 'uc_client/uc_client.php';
     uc_user_delete($u_arr);
 }
Exemplo n.º 19
0
 function delete($u_arr)
 {
     if (empty($u_arr)) {
         return false;
     }
     require_once R_P . 'uc_client/uc_client.php';
     uc_user_delete($u_arr);
     require_once R_P . 'require/writelog.php';
     global $admin_name, $timestamp, $onlineip;
     $udb = array();
     $query = $this->db->query("SELECT m.uid,m.username,m.groupid FROM pw_members m LEFT JOIN pw_memberdata md ON md.uid=m.uid WHERE m.uid IN(" . pwImplode($u_arr) . ")");
     while ($rt = $this->db->fetch_array($query)) {
         $log = array('type' => 'deluser', 'username1' => $rt['username'], 'username2' => $admin_name, 'field1' => 0, 'field2' => $rt['groupid'], 'field3' => '', 'descrip' => 'deluser_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip);
         writelog($log);
         $udb[] = $rt['uid'];
     }
     $this->delUserByIds($udb);
 }
Exemplo n.º 20
0
function getDbTime()
{
    $dbase = db_open($dbase);
    if (!$dbase) {
        echo "<font class='error'>ERROR</font> : cannot open DB<br>";
        exit;
    }
    $sql = "SELECT UNIX_TIMESTAMP( CONVERT_TZ(now(),@@time_zone,'+0:00') )";
    $res = mysqli_query($dbase, $sql);
    if (!@$res) {
        writelog("error.log", "Wrong query : \" {$sql} \"");
        echo "<font class='error'>ERROR</font> : Wrong query : {$sql}<br><br>";
        exit;
    }
    list($date) = mysqli_fetch_row($res);
    db_close($dbase);
    return $date;
}
Exemplo n.º 21
0
function sig_handle($signal)
{
    global $TERMINATE;
    switch ($signal) {
        case SIGTERM:
            writelog("Got SIGTERM");
            $TERMINATE = true;
            break;
        case SIGINT:
            writelog("User pressed Ctrl+C - Got SIGINT");
            $TERMINATE = true;
            break;
        case SIGHUP:
            writelog("Got SIGHUP");
            $TERMINATE = false;
            $RELOAD = true;
            break;
    }
}
Exemplo n.º 22
0
 /**
  * Constructor: __construct
  * Allow for CORS, assemble and pre-process the data
  */
 public function __construct($request)
 {
     writelog('API.php');
     writelog($_GET);
     writelog('-----------');
     header("Access-Control-Allow-Orgin: *");
     header("Access-Control-Allow-Methods: *");
     header("Content-Type: application/json");
     $this->args = explode('/', rtrim($request, '/'));
     $this->endpoint = array_shift($this->args);
     if (array_key_exists(0, $this->args) && !is_numeric($this->args[0])) {
         $this->verb = array_shift($this->args);
     }
     $this->method = $_SERVER['REQUEST_METHOD'];
     if ($this->method == 'POST' && array_key_exists('HTTP_X_HTTP_METHOD', $_SERVER)) {
         if ($_SERVER['HTTP_X_HTTP_METHOD'] == 'DELETE') {
             $this->method = 'DELETE';
         } else {
             if ($_SERVER['HTTP_X_HTTP_METHOD'] == 'PUT') {
                 $this->method = 'PUT';
             } else {
                 throw new Exception("Unexpected Header");
             }
         }
     }
     $this->headers = getallheaders();
     switch ($this->method) {
         case 'DELETE':
         case 'POST':
             $this->request = $this->_cleanInputs($_REQUEST);
             break;
         case 'GET':
             $this->request = $this->_cleanInputs($_GET);
             break;
         case 'PUT':
             $this->request = $this->_cleanInputs($_GET);
             $this->file = file_get_contents("php://input");
             break;
         default:
             $this->_response('Invalid Method', 405);
             break;
     }
 }
Exemplo n.º 23
0
Arquivo: router.php Projeto: web3d/tch
 /**
  * 根据请求调度相应的控制器动作
  * @param string $ctrl 控制器
  * @param string $act 动作
  * @return void 
  * @throws Exception
  */
 public function run($ctrl = null, $act = null)
 {
     if ($ctrl) {
         $this->ctrl = $ctrl;
     }
     if ($act) {
         $this->act = $act;
     }
     $ac_class = $this->getControlClass($this->ctrl);
     if (!class_exists($ac_class)) {
         writelog('tch.core', "control {$this->ctrl} : {$ac_class} not found.");
         throw new Exception("control {$this->ctrl} not found.", 404);
     }
     $obj = new $ac_class($this);
     if (!method_exists($obj, $this->act)) {
         writelog('tch.core', "action {$this->act} not found.");
         throw new Exception("action {$this->act} not found.", 404);
     }
     call_user_method($this->act, $obj);
 }
Exemplo n.º 24
0
function checksmsvalid($phone, $text)
{
    $a = checkuser();
    $username = $a[0];
    if ($username == "") {
        echo '-15';
        exit;
    }
    dbconnect();
    $time = time();
    $statement = "select number from capubbs.sms where username='******' && {$time}-timestamp<1800";
    $results = mysql_query($statement);
    if (mysql_num_rows($results) >= 2) {
        echo '-22';
        exit;
    }
    $ip = @$_SERVER['REMOTE_ADDR'];
    $statement = "insert into capubbs.sms values (null,'{$username}','{$phone}','{$text}','{$ip}',{$time})";
    mysql_query($statement);
    writelog("[SMS send to {$phone}] {$text}\n");
}
Exemplo n.º 25
0
 function on_login()
 {
     global $_G;
     empty($mrefreshtime) && ($mrefreshtime = 2000);
     if ($_G['uid']) {
         $ucsynlogin = uc_user_synlogin($_G['uid']);
         $param = array('username' => $_G['member']['username'], 'ucsynlogin' => $ucsynlogin, 'uid' => $_G['member']['uid']);
         showmessage('login_succeed', dreferer(), $param, array('showdialog' => 1, 'locationtime' => 1));
     }
     if (!($_G['member_loginperm'] = logincheck())) {
         showmessage('login_strike');
     }
     if (!submitcheck('loginsubmit', 1)) {
         $_G['referer'] = dreferer();
         $cookietimecheck = !empty($_G['cookie']['cookietime']) ? 'checked="checked"' : '';
         $username = !empty($_G['cookie']['loginuser']) ? htmlspecialchars($_G['cookie']['loginuser']) : '';
         include template('member/login');
     } else {
         $_G['uid'] = $_G['member']['uid'] = 0;
         $_G['username'] = $_G['member']['username'] = $_G['member']['password'] = '';
         $result = userlogin($_G['gp_username'], $_G['gp_password'], null, null, 'auto');
         if ($result['status'] > 0) {
             setloginstatus($result['member'], $_G['gp_cookietime'] ? 2592000 : 0);
             $ucsynlogin = uc_user_synlogin($_G['uid']);
             $message = 1;
             $param = array('username' => $_G['member']['username'], 'ucsynlogin' => $ucsynlogin, 'uid' => $_G['uid']);
             showmessage('login_succeed', dreferer(), $param, array('showdialog' => 1, 'locationtime' => 1));
         } else {
             $password = preg_replace("/^(.{" . round(strlen($_G['gp_password']) / 4) . "})(.+?)(.{" . round(strlen($_G['gp_password']) / 6) . "})\$/s", "\\1***\\3", $_G['gp_password']);
             $errorlog = dhtmlspecialchars(TIMESTAMP . "\t" . ($result['ucresult']['username'] ? $result['ucresult']['username'] : dstripslashes($_G['gp_username'])) . "\t" . $password . "\t" . "Ques #" . intval($_G['gp_questionid']) . "\t" . $_G['clientip']);
             writelog('illegallog', $errorlog);
             loginfailed($_G['member_loginperm']);
             $fmsg = $result['ucresult']['uid'] == '-3' ? empty($_G['gp_questionid']) || $answer == '' ? 'login_question_empty' : 'login_question_invalid' : 'login_invalid';
             showmessage($fmsg, '', array('loginperm' => $_G['member_loginperm']));
         }
     }
 }
Exemplo n.º 26
0
    $credit->setMdata($authorid, 'postnum', -1);
    $credit->runsql();
    if ($db_guestread) {
        require_once R_P . 'require/guestfunc.php';
        clearguestcache($tid, $rs['replies']);
    }
    P_unlink(D_P . 'data/bbscache/c_cache.php');
    require_once R_P . 'require/updateforum.php';
    updateforum($fid);
    if ($rs['topped']) {
        updatetop();
    }
    $msg_delrvrc = floor($msg_delrvrc / 10);
    require_once R_P . 'require/writelog.php';
    $log = array('type' => 'delete', 'username1' => $author, 'username2' => $windid, 'field1' => $fid, 'field2' => '', 'field3' => '', 'descrip' => $deltype . '_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $tid, 'forum' => $pwforum->foruminfo['name'], 'subject' => $deltitle, 'affect' => "{$db_rvrcname}:-{$msg_delrvrc},{$db_moneyname}:-{$msg_delmoney}", 'reason' => 'edit delete article!');
    writelog($log);
    if ($pwforum->foruminfo['allowhtm'] && $article <= $db_readperpage) {
        $StaticPage = L::loadClass('StaticPage');
        $StaticPage->update($tid);
    }
    if ($deltype == 'delrp') {
        refreshto("read.php?tid={$tid}", 'enter_thread');
    } else {
        refreshto("thread.php?fid={$fid}", 'enter_thread');
    }
} elseif ($_POST['step'] == 2) {
    InitGP(array('atc_title', 'atc_content'), 'P', 0);
    InitGP(array('replayorder', 'atc_anonymous', 'atc_newrp', 'atc_tags', 'atc_hideatt', 'magicid', 'magicname', 'atc_enhidetype', 'atc_credittype', 'flashatt'), 'P');
    InitGP(array('atc_iconid', 'atc_hide', 'atc_requireenhide', 'atc_rvrc', 'atc_requiresell', 'atc_money', 'atc_usesign', 'atc_html', 'p_type', 'p_sub_type', 'atc_convert', 'atc_autourl'), 'P', 2);
    require_once R_P . 'require/bbscode.php';
    if ($postmodify->type == 'topic') {
Exemplo n.º 27
0
            foreach (C::t('forum_ratelog')->fetch_all_by_pid($_GET['pid']) as $ratelog) {
                if (in_array($ratelog['uid'] . ' ' . $ratelog['extcredits'] . ' ' . $ratelog['dateline'], $_GET['logidarray'])) {
                    $rate += $ratelog['score'] = -$ratelog['score'];
                    $ratetimes += ceil(max(abs($rating['min']), abs($rating['max'])) / 5);
                    updatemembercount($post['authorid'], array($ratelog['extcredits'] => $ratelog['score']));
                    C::t('common_credit_log')->delete_by_uid_operation_relatedid($post['authorid'], 'PRC', $_GET['pid']);
                    C::t('forum_ratelog')->delete_by_pid_uid_extcredits_dateline($_GET['pid'], $ratelog['uid'], $ratelog['extcredits'], $ratelog['dateline']);
                    $logs[] = dhtmlspecialchars("{$_G['timestamp']}\t{$_G[member][username]}\t{$_G['adminid']}\t{$ratelog['username']}\t{$ratelog['extcredits']}\t{$ratelog['score']}\t{$_G['tid']}\t{$thread['subject']}\t{$reason}\tD");
                    if ($sendreasonpm) {
                        $ratescore .= $slash . $_G['setting']['extcredits'][$ratelog['extcredits']]['title'] . ' ' . ($ratelog['score'] > 0 ? '+' . $ratelog['score'] : $ratelog['score']) . ' ' . $_G['setting']['extcredits'][$ratelog['extcredits']]['unit'];
                        $slash = ' / ';
                    }
                }
            }
            C::t('forum_postcache')->delete($_GET['pid']);
            writelog('ratelog', $logs);
            if ($sendreasonpm) {
                sendreasonpm($post, 'rate_removereason', array('tid' => $thread['tid'], 'pid' => $_GET['pid'], 'subject' => $thread['subject'], 'ratescore' => $ratescore, 'reason' => $reason, 'from_id' => 0, 'from_idtype' => 'removerate'));
            }
            C::t('forum_post')->increase_rate_by_pid('tid:' . $_G['tid'], $_GET['pid'], $rate, $ratetimes);
            if ($post['first']) {
                $threadrate = @intval(@($post['rate'] + $rate) / abs($post['rate'] + $rate));
                C::t('forum_thread')->update($_G['tid'], array('rate' => $threadrate));
            }
        }
        showmessage('thread_rate_removesucceed', dreferer());
    }
} elseif ($_GET['action'] == 'viewratings' && $_GET['pid']) {
    $loglist = $logcount = array();
    $post = C::t('forum_post')->fetch('tid:' . $_G['tid'], $_GET['pid']);
    if ($post['invisible'] != 0) {
Exemplo n.º 28
0
require_once 'mod_time.php';
require_once 'mod_dbase.php';
require_once 'mod_strenc.php';
$dbase = db_open();
$sql = 'SELECT *' . '  FROM rep1' . " WHERE bot_guid = '{$guid}'" . ' LIMIT 1';
$res = mysqli_query($dbase, $sql);
if (!@$res) {
    writelog("error.log", "Wrong query : \" {$sql} \"");
    db_close($dbase);
    exit;
}
if (!mysqli_num_rows($res)) {
    $sql = 'SELECT *' . '  FROM rep1' . " WHERE bot_guid = '{$guid2}' OR bot_guid = '{$guid3}'" . ' LIMIT 1';
    $res = mysqli_query($dbase, $sql);
    if (!@$res) {
        writelog("error.log", "Wrong query : \" {$sql} \"");
        db_close($dbase);
        exit;
    }
    if (!mysqli_num_rows($res)) {
        $content = "<center><font class='error'>ERROR</font> : cannot find info bot this bot : <b>{$guid}</b> or <b>{$guid2}</b> or <b>{$guid3}</b></center>";
        require_once 'frm_skelet.php';
        echo get_skelet('Detail info for selected bot', $content);
        exit;
    }
}
list($id, $ip, $bot_guid, $bot_version, $local_time, $timezone, $tick_time, $os_version, $language_id, $date_rep) = mysqli_fetch_row($res);
$content .= "<table width='430' border='1' cellspacing='0' cellpadding='3' style='border: 1px solid lightgray; font-size: 9px; border-collapse: collapse; background-color: rgb(255, 255, 255);'>";
$content .= "<tr><td width='100px'><b>id</b></td><td>{$id}</td></tr>";
$content .= "<tr><td width='100px'><b>ip</b></td><td>{$ip}</td></tr>";
$content .= "<tr><td width='100px'><b>bot_guid</b></td><td>{$bot_guid}</td></tr>";
Exemplo n.º 29
0
         $f = fopen($INSERTFILE, "a") or die("can't open file {$INSERTFILE}");
         fwrite($f, $query);
         fwrite($f, "\n");
         fclose($f);
     }
 } else {
     // on a trouvé le joueur
     $data = $data[0];
     $id_player = $data['id'];
     $this_id_capgeek = $data['id_capgeek'];
     $query = "select id_capgeek from nhl_players\n                                                   where id = {$id_player}\n                                                       and date_expiration = '2099-12-31'";
     $data = DB::dbSelect($query);
     $data = $data[0];
     $this_id_capgeek = $data['id_capgeek'];
     if ($this_id_capgeek != $id_capgeek) {
         writelog($logFile, "info", "Joueur {$full_name_corr} ({$id_player}): id_capgeek différent (3)");
         $query = "update nhl_players set id_capgeek={$id_capgeek} where id = {$id_player} and date_expiration = '2099-12-31';";
         $f = fopen($INSERTFILE, "a") or die("can't open file {$INSERTFILE}");
         fwrite($f, $query);
         fwrite($f, "\n");
         fclose($f);
     }
     # ajout/update dans la table de corr.
     $query = "select 1 from nhl_players_corr where id = {$id_player}";
     $data = DB::dbSelect($query);
     if (count($data) == 1) {
         $query = "update nhl_players_corr set capgeek=\"{$full_name_corr}\" where id = {$id_player};";
         $f = fopen($INSERTFILE, "a") or die("can't open file {$INSERTFILE}");
         fwrite($f, $query);
         fwrite($f, "\n");
         fclose($f);
Exemplo n.º 30
0
    case 'plugin':
        $script = 'plugin';
        break;
    default:
        $_G['gp_action'] = $script = 'home';
        $modtpl = 'modcp_home';
}
$script = empty($script) ? 'noperm' : $script;
$modtpl = empty($modtpl) ? !empty($script) ? 'modcp_' . $script : '' : $modtpl;
$modtpl = 'forum/' . $modtpl;
$op = isset($op) ? trim($op) : '';
if ($script != 'log') {
    include libfile('function/misc');
    $extra = implodearray(array('GET' => $_GET, 'POST' => $_POST), array('cppwd', 'formhash', 'submit', 'addsubmit'));
    $modcplog = array(TIMESTAMP, $_G['username'], $_G['adminid'], $_G['clientip'], $_G['gp_action'], $op, $_G['fid'], $extra);
    writelog('modcp', implode("\t", clearlogstring($modcplog)));
}
require DISCUZ_ROOT . './source/include/modcp/modcp_' . $script . '.php';
$reportnum = $modpostnum = $modthreadnum = $modforumnum = 0;
$modforumnum = count($modforums['list']);
if ($modforumnum) {
    $modnum = ($_G['group']['allowmodpost'] ? getcountofposts(DB::table('forum_post'), "invisible='-2' AND first='0' and fid IN({$modforums['fids']})") + DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_thread') . " WHERE fid IN({$modforums['fids']}) AND displayorder='-2'") : 0) + ($_G['group']['allowmoduser'] ? DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member_validate') . " WHERE status='0'") : 0);
}
switch ($_G['adminid']) {
    case 1:
        $access = '1,2,3,4,5,6,7';
        break;
    case 2:
        $access = '2,3,6,7';
        break;
    default: