• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP logmsg函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中logmsg函数的典型用法代码示例。如果您正苦于以下问题:PHP logmsg函数的具体用法?PHP logmsg怎么用?PHP logmsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了logmsg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: parseItem

function parseItem($blog, $item, $ts)
{
    if ($ts != 0 && $item->pubdate <= $ts) {
        logmsg('Zatrzymanie na wpisie: %s', StringUtils::removeAccents($item->title));
        return false;
    }
    logmsg('  - Parsowanie wpisu: %s', StringUtils::removeAccents($item->title));
    $post = new Post();
    $post->setBlog($blog);
    foreach ($item->tags as $name) {
        $tag = TagPeer::retriveByName($name, true);
        if ($post->addTag($tag)) {
            logmsg('    - Znaleziono tag: %s', $name);
        }
    }
    if ($post->hasTags()) {
        $shortened = $post->setFullContent($item->content);
        $post->setLink(htmlspecialchars($item->link));
        $post->setTitle($item->title);
        $post->setCreatedAt($item->pubdate);
        $post->setShortened($shortened);
        $post->save();
    } else {
        logmsg('    - Nie znaleziono tagow');
    }
    return true;
}
开发者ID:noose,项目名称:Planeta,代码行数:27,代码来源:refresh.php


示例2: err

/** helper to output an error message. */
function err($string)
{
    // Annoying PHP: we need to import global variables here...
    global $title;
    require LIBWWWDIR . '/header.php';
    echo "<h2>Submit - error</h2>\n\n";
    echo '<div id="uploadstatus">';
    logmsg(LOG_WARNING, $string);
    echo '</div>';
    require LIBWWWDIR . '/footer.php';
    exit;
}
开发者ID:Surya97,项目名称:domjudge,代码行数:13,代码来源:upload.php


示例3: delete_file_and_edit_agreement

function delete_file_and_edit_agreement($var)
{
    $f = explode('_', $var);
    $fileid = $_POST['fileid_' . $f[1] . '_' . $f[2]];
    logmsg("deletefile {$var}; {$fileid}");
    save_agreement();
    $details = db_retrieve_file_details($fileid);
    $id = $_POST['0'];
    show_delete_file_form($fileid, $details[3], $details[4], array('ID' => $id));
    $aggr = db_retrieve_agreement_byID($id);
    addedit_agreement($aggr);
}
开发者ID:TIS-FMDP,项目名称:Erasmus,代码行数:12,代码来源:agreements.php


示例4: minecraft_sigterm

function minecraft_sigterm($signal)
{
    echo "terming\n";
    global $_STATE;
    logmsg("SIGTERM - stop");
    $_STATE['Running'] = false;
    fwrite($_STATE['Descriptors'][0], 'stop' . PHP_EOL);
    fflush($_STATE['Descriptors'][0]);
    if (isset($_CONFIG['Command_Pidfile']) && file_exists($_CONFIG['Command_Pidfile'])) {
        unlink($_CONFIG['Command_Pidfile']);
    }
}
开发者ID:haxney,项目名称:minecraft-config,代码行数:12,代码来源:daemonize_minecraft.php


示例5: dj_setcookie

/**
 * Wrapper around PHP setcookie function to automatically set some
 * DOMjudge specific defaults and check the return value.
 * - cookies are defined in a common path for all web interfaces
 */
function dj_setcookie($name, $value = null, $expire = 0, $path = null, $domain = null, $secure = false, $httponly = false)
{
    if (!isset($path)) {
        // KLUDGE: We want to find the DOMjudge base path, but this
        // information is not directly available as configuration, so
        // we extract it from the executed PHP script.
        $path = preg_replace('/(jury|public|team)\\/?$/', '', dirname($_SERVER['PHP_SELF']));
    }
    $ret = setcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
    if ($ret !== true) {
        warning("Cookie '{$name}' not set properly.");
    }
    logmsg(LOG_DEBUG, "Cookie set: {$name}={$value}, expire={$expire}, path={$path}");
    return $ret;
}
开发者ID:rohit-takhar,项目名称:domjudge,代码行数:20,代码来源:lib.wrappers.php


示例6: retrieve_filter_exchange

function retrieve_filter_exchange()
{
    global $filter_url;
    logmsg("trsel: " . $_POST['travel_selection']);
    if (isset($_POST['travel_selection'])) {
        $filter_t = $_POST['travel_selection'];
    } else {
        $filter_t = $_GET['ft'];
    }
    if (strlen($filter_t) == 0) {
        $filter_t = $_POST['ft'];
    }
    if (strlen($filter_t) == 0) {
        $filter_t = db_get_first_travel();
    }
    $filter_url = '&ft=' . $filter_t;
    logmsg("ft: " . $filter_t);
    return $filter_t;
}
开发者ID:TIS-FMDP,项目名称:Erasmus,代码行数:19,代码来源:foreigncredits.php


示例7: process_fmfi_credits

function process_fmfi_credits()
{
    global $userrole;
    if ($userrole === "admin") {
        print '<b>Travel FMFI courses</b><br /><br />';
        $filter_exchange = retrieve_filter_exchange();
        show_exchange_filter($filter_exchange);
        $tcdata = NULL;
        if (isset($_GET['act'])) {
            if ($_POST['Edit'] === 'edit') {
                $tcdata = db_fmfi_courses_for_an_exchange($filter_exchange, TRUE);
                edit_fmfi_travel_course($tcdata);
            } else {
                if ($_POST['Add'] === 'add') {
                    add_fmfi_travel_course($filter_exchange);
                } else {
                    if ($_POST['Save'] === 'save') {
                        save_fmfi_travel_course($filter_exchange);
                    } else {
                        if ($_POST['Remove'] === 'remove') {
                            $tcdata = db_fmfi_courses_for_an_exchange($filter_exchange, TRUE);
                            remove_record($tcdata);
                        } else {
                            if ($_POST['Remove'] === 'yes') {
                                yes_remove_fmfi_travel_courses();
                            }
                        }
                    }
                }
            }
        }
        logmsg("retr");
        if ($tcdata == NULL) {
            $tcdata = db_fmfi_courses_for_an_exchange($filter_exchange, TRUE);
        }
        logmsg("ieve {$filter_exchange}");
        $tcf = format_travel_fmfi_courses($tcdata);
        show_table(array('ID', 'FMFI course', 'Grade'), $tcf);
    } else {
        return;
    }
}
开发者ID:TIS-FMDP,项目名称:Erasmus,代码行数:42,代码来源:fmficredits.php


示例8: logmsg

logmsg("Loading signals file: \"" . $_CONFIG['Signals'] . "\"");
logmsg("Working Directory: \"" . $_CONFIG['WorkingDirectory'] . "\"");
logmsg("");
for (;;) {
    // Start the command
    logmsg("Starting command");
    commandStart();
    // Block until it quits
    logmsg("Monitoring");
    commandMonitor();
    // Clean up descriptors and stuff
    logmsg("Died - Cleaning up");
    commandCleanup();
    // If we're shutting down, break out of the loop.
    if ($_STATE['Running'] == false) {
        logmsg("Saying goodnight - remember to tip your waitress!");
        break;
    }
}
if (isset($_CONFIG['Monitor_Pidfile'])) {
    unlink($_CONFIG['Monitor_Pidfile']);
}
/* Functions */
function logmsg($str)
{
    global $_CONFIG, $_STATE;
    $str = '[' . date('Y-m-d H:i:s') . '] ' . $str;
    if ($_CONFIG['Interactive'] == true) {
        echo $str . PHP_EOL;
    }
    if (!isset($_STATE['LogHandle'])) {
开发者ID:haxney,项目名称:minecraft-config,代码行数:31,代码来源:daemonize.php


示例9: explode

                     $arr = explode(':', $v);
                     $calendar_name = trim($arr[1]);
                     break;
                 }
             }
             $calendar_name = isset($calendar_name) ? $calendar_name : 'default';
             if (isset($_SERVER['PATH_INFO'])) {
                 preg_match("/\\/([ A-Za-z0-9.]*).ics/i", $_SERVER['PATH_INFO'], $matches);
                 $calendar_name = $matches[1];
             }
             // write to file
             if ($fp = fopen($calendar_path . $calendar_name . '.ics', 'w+')) {
                 fputs($fp, $data, strlen($data));
                 @fclose($fp);
             } else {
                 logmsg('couldnt open file ' . $calendar_path . $calendar_name . '.ics');
             }
         }
     }
     if ($_SERVER['REQUEST_METHOD'] == 'GET') {
         if (isset($_SERVER['PATH_INFO'])) {
             preg_match("/\\/([ A-Za-z0-9._]*).ics/i", $_SERVER['PATH_INFO'], $matches);
             $icsfile = $matches[1];
             // get calendar data
             if (file_exists($calendar_path . $icsfile . '.ics') && is_readable($calendar_path . $icsfile . '.ics') && is_file($calendar_path . $icsfile . '.ics')) {
                 echo file_get_contents($calendar_path . $icsfile . '.ics');
             } else {
             }
         }
     }
 }
开发者ID:jbogota,项目名称:blog-king,代码行数:31,代码来源:publish.mozilla.php


示例10: retrieve_first_checked_record

function retrieve_first_checked_record($data)
{
    foreach ($data as $r) {
        if (isset($_POST[$r[0]])) {
            return $r;
        }
    }
    logmsg("no item checked");
    return NULL;
}
开发者ID:TIS-FMDP,项目名称:Erasmus,代码行数:10,代码来源:submissions.php


示例11: logmsg

                @fclose($dataout);
            } else {
                logmsg('could not open file ' . $calendar_path . $calendar_name . '.ics');
            }
        } else {
            logmsg('PUT ERROR - No data supplied.');
        }
        break;
    case 'GET':
        if (isset($_SERVER['PATH_INFO'])) {
            preg_match("/\\/([ A-Za-z0-9._]*).ics/i", $_SERVER['PATH_INFO'], $matches);
            $icsfile = urldecode($matches[1]);
            // get calendar data
            if (file_exists($calendar_path . $icsfile . '.ics') && is_readable($calendar_path . $icsfile . '.ics') && is_file($calendar_path . $icsfile . '.ics')) {
                echo file_get_contents($calendar_path . $icsfile . '.ics');
                logmsg('downloaded calendar ' . $icsfile);
            }
        }
}
if (defined('PHPICALENDAR_LOG_PUBLISHING') && PHPICALENDAR_LOG_PUBLISHING == 1) {
    fclose($logfile);
}
header('HTTP/1.1 200 OK');
exit;
// for logging
function logmsg($str)
{
    global $logfile;
    if (defined('PHPICALENDAR_LOG_PUBLISHING') && PHPICALENDAR_LOG_PUBLISHING == 1) {
        if ($_SERVER['PHP_AUTH_USER']) {
            $user = $_SERVER['PHP_AUTH_USER'];
开发者ID:bilsan,项目名称:schedule-generator,代码行数:31,代码来源:publish.php


示例12: warning

/**
 * Log a warning at level LOG_WARNING.
 */
function warning($string)
{
    logmsg(LOG_WARNING, "warning: {$string}");
}
开发者ID:nya3jp,项目名称:domjudge,代码行数:7,代码来源:lib.error.php


示例13: err_log

/**
 * Zapise do logu, ktery je definovan v globalnim nastaveni.
 * @deprecated pouzijte radeji metodu logmsg($message, $level)
 * @param string $message Zprava, ktera se ma vypsat do logu
 * @param int $level level logu - PEAR_LOG_EMERG, PEAR_LOG_ALERT, PEAR_LOG_CRIT, PEAR_LOG_ERR,
 * PEAR_LOG_WARNING, PEAR_LOG_NOTICE, PEAR_LOG_INFO, PEAR_LOG_DEBUG
 * PEAR_LOG_DEBUG je defaultni
 */
function err_log($message, $level = PEAR_LOG_DEBUG)
{
    logmsg($message, $level);
}
开发者ID:klofac,项目名称:combros,代码行数:12,代码来源:functions.php


示例14: save_student

function save_student()
{
    $id = $_POST['0'];
    $firstname = htmlspecialchars($_POST['1']);
    $middlename = htmlspecialchars($_POST['2']);
    $lastname = htmlspecialchars($_POST['3']);
    $born = htmlspecialchars($_POST['4']);
    $studentID = htmlspecialchars($_POST['5']);
    $gender = $_POST['6'];
    $citizenship = $_POST['7'];
    $email = htmlspecialchars($_POST['8']);
    $year = htmlspecialchars($_POST['10']);
    logmsg("year: {$year}");
    db_save_student($id, $firstname, $middlename, $lastname, $born, $studentID, $gender, $citizenship, $email, $year);
}
开发者ID:TIS-FMDP,项目名称:Erasmus,代码行数:15,代码来源:students.php


示例15: execute

 private function execute($query)
 {
     $query = trim($query);
     list($micros, $secs) = explode(' ', microtime());
     $res = @mysqli_query($this->_connection, $query);
     list($micros2, $secs2) = explode(' ', microtime());
     $elapsed_ms = round(1000 * ($secs2 - $secs + ($micros2 - $micros)));
     if (DEBUG & DEBUG_SQL) {
         global $DEBUG_NUM_QUERIES;
         $DEBUG_NUM_QUERIES++;
         if (isset($_SERVER['REMOTE_ADDR'])) {
             if (defined('DOMJUDGE_API_VERSION')) {
                 logmsg(LOG_DEBUG, "SQL: {$this->database}: {$query} ({$elapsed_ms}ms)\n");
             } else {
                 printf("<p>SQL: {$this->database}: <kbd>%s</kbd> ({$elapsed_ms}ms)</p>\n", specialchars($query));
             }
         } else {
             printf("SQL: {$this->database}: %s ({$elapsed_ms}ms)\n", $query);
         }
     }
     if ($res) {
         return $res;
     }
     if (DEBUG) {
         $backtrace = debug_backtrace();
         $callsite = ' file: ' . $backtrace[2]['file'] . ', ' . ' line: ' . $backtrace[2]['line'] . ', ';
     } else {
         $callsite = '';
     }
     // switch error message depending on errornr.
     switch (mysqli_errno($this->_connection)) {
         case 1062:
             // duplicate key
             throw new UnexpectedValueException("Item with this key already" . " exists.\n" . $callsite . mysqli_error($this->_connection));
         case 1217:
             // foreign key constraint
             throw new UnexpectedValueException("This operation would have" . " brought the database in an inconsistent state,\n" . $callsite . mysqli_error($this->_connection));
         case 2006:
             // MySQL server has gone away
             throw new RuntimeException("MySQL server has gone away");
         default:
             throw new RuntimeException("SQL error, " . $callsite . "Error#" . mysqli_errno($this->_connection) . ": " . mysqli_error($this->_connection) . ", query: '{$query}'");
     }
 }
开发者ID:bertptrs,项目名称:domjudge,代码行数:44,代码来源:lib.database.php


示例16: get_input

         echo "Updated Portlet Group Permissions for the template user";
     }
     break;
 case "portlet_user_perm":
     $user = get_input('user');
     $portlets = get_input('portlets');
     $pieces = explode(",", $portlets);
     foreach ($pieces as $portlet) {
         $header = str_replace("_", " ", $portlet);
         $value = preg_replace('/.*=(.*)/', '$1', $portlet);
         $header = preg_replace('/(.*)=.*/', '$1', $header);
         $group = getgroup($user);
         if ($header !== "Assign Permissions") {
             // Button name comes through because it's an "input" type
             if ($value == 'true') {
                 logmsg("---\nHeader = {$header}\nValue = {$value}");
                 $sql = "UPDATE ui_layout SET group_access='{$group}' WHERE header='{$header}' and userid=(SELECT id FROM users WHERE username='{$user}')";
                 $result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
                 // logmsg("MySQL Affected Rows = " .mysql_affected_rows() . "\n");
                 if (mysql_affected_rows() != 1) {
                     // User doesn't have an entry (they are probably a new user who hasn't logged in yet)
                     // so we need to insert permissions for them.
                     $sql = "REPLACE INTO ui_layout (userid, pagename, col, header, group_access, content) SELECT (SELECT id FROM users WHERE username='{$user}'),(SELECT DISTINCT pagename from ui_layout where header='{$header}' AND userid=0), (SELECT DISTINCT col from ui_layout where header='{$header}' AND userid=0), '{$header}', '{$group}', (SELECT DISTINCT content from ui_layout where header='{$header}' and userid=0)";
                     perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
                 }
             } else {
                 $sql = "DELETE FROM ui_layout WHERE group_access='{$group}' AND header='{$header}' and userid=(SELECT id FROM users WHERE username='{$user}')";
                 // echo "Removed $header access for $user<br>";
                 $result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
             }
         }
开发者ID:Russell-IO,项目名称:php-syslog-ng,代码行数:31,代码来源:json.useradmin.php


示例17: judge

function judge($row)
{
    global $EXITCODES, $myhost, $options, $workdirpath;
    // Set configuration variables for called programs
    putenv('USE_CHROOT=' . (USE_CHROOT ? '1' : ''));
    putenv('SCRIPTTIMELIMIT=' . dbconfig_get_rest('script_timelimit'));
    putenv('SCRIPTMEMLIMIT=' . dbconfig_get_rest('script_memory_limit'));
    putenv('SCRIPTFILELIMIT=' . dbconfig_get_rest('script_filesize_limit'));
    putenv('MEMLIMIT=' . $row['memlimit']);
    putenv('FILELIMIT=' . $row['outputlimit']);
    putenv('PROCLIMIT=' . dbconfig_get_rest('process_limit'));
    $cpuset_opt = "";
    if (isset($options['daemonid'])) {
        $cpuset_opt = "-n {$options['daemonid']}";
    }
    // create workdir for judging
    $workdir = "{$workdirpath}/c{$row['cid']}-s{$row['submitid']}-j{$row['judgingid']}";
    logmsg(LOG_INFO, "Working directory: {$workdir}");
    // If a database gets reset without removing the judging
    // directories, we might hit an old directory: rename it.
    if (file_exists($workdir)) {
        $oldworkdir = $workdir . '-old-' . getmypid() . '-' . strftime('%Y-%m-%d_%H:%M');
        if (!rename($workdir, $oldworkdir)) {
            error("Could not rename stale working directory to '{$oldworkdir}'");
        }
        @chmod($oldworkdir, 0700);
        warning("Found stale working directory; renamed to '{$oldworkdir}'");
    }
    system("mkdir -p '{$workdir}/compile'", $retval);
    if ($retval != 0) {
        error("Could not create '{$workdir}/compile'");
    }
    // Make sure the workdir is accessible for the domjudge-run user.
    // Will be revoked again after this run finished.
    chmod($workdir, 0755);
    if (!chdir($workdir)) {
        error("Could not chdir to '{$workdir}'");
    }
    // Get the source code from the DB and store in local file(s)
    $sources = request('submission_files', 'GET', 'id=' . urlencode($row['submitid']));
    $sources = dj_json_decode($sources);
    $files = array();
    foreach ($sources as $source) {
        $srcfile = "{$workdir}/compile/{$source['filename']}";
        $files[] = "'{$source['filename']}'";
        if (file_put_contents($srcfile, base64_decode($source['content'])) === FALSE) {
            error("Could not create {$srcfile}");
        }
    }
    if (empty($row['compile_script'])) {
        error("No compile script specified for language " . $row['langid'] . ".");
    }
    $execrunpath = fetch_executable($workdirpath, $row['compile_script'], $row['compile_script_md5sum']);
    // Compile the program.
    system(LIBJUDGEDIR . "/compile.sh {$cpuset_opt} '{$execrunpath}' '{$workdir}' " . implode(' ', $files), $retval);
    // what does the exitcode mean?
    if (!isset($EXITCODES[$retval])) {
        alert('error');
        error("Unknown exitcode from compile.sh for s{$row['submitid']}: {$retval}");
    }
    $compile_success = $EXITCODES[$retval] != 'compiler-error';
    // pop the compilation result back into the judging table
    request('judgings/' . urlencode($row['judgingid']), 'PUT', 'judgehost=' . urlencode($myhost) . '&compile_success=' . $compile_success . '&output_compile=' . rest_encode_file($workdir . '/compile.out'));
    // compile error: our job here is done
    if (!$compile_success) {
        // revoke readablity for domjudge-run user to this workdir
        chmod($workdir, 0700);
        logmsg(LOG_NOTICE, "Judging s{$row['submitid']}/j{$row['judgingid']}: compile error");
        return;
    }
    // Optionally create chroot environment
    if (USE_CHROOT && CHROOT_SCRIPT) {
        logmsg(LOG_INFO, "executing chroot script: '" . CHROOT_SCRIPT . " start'");
        system(LIBJUDGEDIR . '/' . CHROOT_SCRIPT . ' start', $retval);
        if ($retval != 0) {
            error("chroot script exited with exitcode {$retval}");
        }
    }
    $totalcases = 0;
    while (TRUE) {
        // get the next testcase
        $testcase = request('testcases', 'GET', 'judgingid=' . urlencode($row['judgingid']));
        $tc = dj_json_decode($testcase);
        // empty means: no more testcases for this judging.
        if (empty($tc)) {
            break;
        }
        $totalcases++;
        logmsg(LOG_DEBUG, "Running testcase {$tc['rank']}...");
        $testcasedir = $workdir . "/testcase" . sprintf('%03d', $tc['rank']);
        // Get both in- and output files, only if we didn't have them already.
        $tcfile = array();
        $fetched = array();
        foreach (array('input', 'output') as $inout) {
            $tcfile[$inout] = "{$workdirpath}/testcase/testcase.{$tc['probid']}.{$tc['rank']}." . $tc['md5sum_' . $inout] . "." . substr($inout, 0, -3);
            if (!file_exists($tcfile[$inout])) {
                $content = request('testcase_files', 'GET', 'testcaseid=' . urlencode($tc['testcaseid']) . '&' . $inout);
                $content = base64_decode(dj_json_decode($content));
                if (file_put_contents($tcfile[$inout] . ".new", $content) === FALSE) {
                    error("Could not create {$tcfile[$inout]}.new");
//.........这里部分代码省略.........
开发者ID:reduanrafi,项目名称:domjudge,代码行数:101,代码来源:judgedaemon.main.php


示例18: db_delete_files

function db_delete_files($ids)
{
    global $link;
    mysqli_set_charset($link, "utf8");
    $stm = $link->stmt_init();
    $stm->prepare('DELETE FROM FILES WHERE ID=?');
    foreach ($ids as $id) {
        logmsg("del file " . $id);
        $stm->bind_param('i', $id);
        $stm->execute();
        db_append_to_log('FILES', $id, 'remove', 'file removed', $id);
    }
    $stm->close();
    if (count($ids) > 0) {
        recycle_files($ids);
    }
}
开发者ID:TIS-FMDP,项目名称:Erasmus,代码行数:17,代码来源:db.php


示例19: judging_runs_POST

/**
 * Judging_Runs
 */
function judging_runs_POST($args)
{
    global $DB, $api;
    checkargs($args, array('judgingid', 'testcaseid', 'runresult', 'runtime', 'output_run', 'output_diff', 'output_error', 'output_system', 'judgehost'));
    $results_remap = dbconfig_get('results_remap');
    $results_prio = dbconfig_get('results_prio');
    if (array_key_exists($args['runresult'], $results_remap)) {
        logmsg(LOG_INFO, "Testcase {$args['testcaseid']} remapping result " . $args['runresult'] . " -> " . $results_remap[$args['runresult']]);
        $args['runresult'] = $results_remap[$args['runresult']];
    }
    $DB->q('INSERT INTO judging_run (judgingid, testcaseid, runresult,
	        runtime, output_run, output_diff, output_error, output_system)
	        VALUES (%i, %i, %s, %f, %s, %s, %s, %s)', $args['judgingid'], $args['testcaseid'], $args['runresult'], $args['runtime'], base64_decode($args['output_run']), base64_decode($args['output_diff']), base64_decode($args['output_error']), base64_decode($args['output_system']));
    // result of this judging_run has been stored. now check whether
    // we're done or if more testcases need to be judged.
    $probid = $DB->q('VALUE SELECT probid FROM testcase
	                  WHERE testcaseid = %i', $args['testcaseid']);
    $runresults = $DB->q('COLUMN SELECT runresult
	                      FROM judging_run LEFT JOIN testcase USING(testcaseid)
	                      WHERE judgingid = %i ORDER BY rank', $args['judgingid']);
    $numtestcases = $DB->q('VALUE SELECT count(*) FROM testcase WHERE probid = %i', $probid);
    $allresults = array_pad($runresults, $numtestcases, null);
    $before = $DB->q('VALUE SELECT result FROM judging WHERE judgingid = %i', $args['judgingid']);
    if (($result = getFinalResult($allresults, $results_prio)) !== NULL) {
        // Lookup global lazy evaluation of results setting and
        // possible problem specific override.
        $lazy_eval = dbconfig_get('lazy_eval_results', true);
        $prob_lazy = $DB->q('MAYBEVALUE SELECT cp.lazy_eval_results
		                     FROM judging j
		                     LEFT JOIN submission s USING(submitid)
		                     LEFT JOIN contestproblem cp ON (cp.cid=j.cid AND cp.probid=s.probid)
		                     WHERE judgingid = %i', $args['judgingid']);
        if (isset($prob_lazy)) {
            $lazy_eval = (bool) $prob_lazy;
        }
        if (count($runresults) == $numtestcases || $lazy_eval) {
            // NOTE: setting endtime here determines in testcases_GET
            // whether a next testcase will be handed out.
            $DB->q('UPDATE judging SET result = %s, endtime = %s
			        WHERE judgingid = %i', $result, now(), $args['judgingid']);
        } else {
            $DB->q('UPDATE judging SET result = %s
			        WHERE judgingid = %i', $result, $args['judgingid']);
        }
        // Only update if the current result is different from what we
        // had before. This should only happen when the old result was
        // NULL.
        if ($before !== $result) {
            if ($before !== NULL) {
                error('internal bug: the evaluated result changed during judging');
            }
            $row = $DB->q('TUPLE SELECT s.cid, s.teamid, s.probid, s.langid, s.submitid
			               FROM judging
			               LEFT JOIN submission s USING(submitid)
			               WHERE judgingid = %i', $args['judgingid']);
            calcScoreRow($row['cid'], $row['teamid'], $row['probid']);
            // We call alert here before possible validation. Note
            // that this means that these alert messages should be
            // treated as confidential information.
            alert($result === 'correct' ? 'accept' : 'reject', "submission {$row['submitid']}, judging {$args['judgingid']}: {$result}");
            // log to event table if no verification required
            // (case of verification required is handled in www/jury/verify.php)
            if (!dbconfig_get('verification_required', 0)) {
                $DB->q('INSERT INTO event (eventtime, cid, teamid, langid, probid,
				        submitid, judgingid, description)
				        VALUES(%s, %i, %i, %s, %i, %i, %i, "problem judged")', now(), $row['cid'], $row['teamid'], $row['langid'], $row['probid'], $row['submitid'], $args['judgingid']);
                if ($result == 'correct') {
                    // prevent duplicate balloons in case of multiple correct submissions
                    $numcorrect = $DB->q('VALUE SELECT count(submitid)
					                      FROM balloon
					                      LEFT JOIN submission USING(submitid)
					                      WHERE valid = 1 AND probid = %i
					                      AND teamid = %i AND cid = %i', $row['probid'], $row['teamid'], $row['cid']);
                    if ($numcorrect == 0) {
                        $balloons_enabled = (bool) $DB->q("VALUE SELECT process_balloons\n\t\t\t\t\t\t                                  FROM contest WHERE cid = %i", $row['cid']);
                        if ($balloons_enabled) {
                            $DB->q('INSERT INTO balloon (submitid) VALUES(%i)', $row['submitid']);
                        }
                    }
                }
            }
            auditlog('judging', $args['judgingid'], 'judged', $result, $args['judgehost']);
        }
    }
    $DB->q('UPDATE judgehost SET polltime = %s WHERE hostname = %s', now(), $args['judgehost']);
    return '';
}
开发者ID:retnan,项目名称:domjudge,代码行数:90,代码来源:index.php


示例20: saveParticipants

function saveParticipants($participants)
{
    global $participants_file_path;
    global $sites;
    // list of sites allow for this user
    // create a list of sites to save
    $sitesToSave = array();
    foreach ($participants as $key => $participant) {
        // if this participant contains a site key and
        // the site name is not already in sitesToSave and
        // the site name is in the list of allowed sites
        if (isset($participant['site']) && !in_array($participant['site'], $sitesToSave) && in_array($participant['site'], $sites)) {
            $sitesToSave[] = $participant['site'];
            // append the site name to sitesToSave
        }
    }
    for ($i = 0; $i < count($sitesToSave); $i++) {
        $participants_file = $participants_file_path . $sites[$i] . "/participants.json";
        // create a list of events for this site
        $d = array();
        foreach ($participants as $key => &$participant) {
            // if this participant contains a site key and
            // the site name is the same as the current site
            if (isset($participant['site']) && $participant['site'] == $sitesToSave[$i]) {
                unset($participant['site']);
                // remove the site key
                $d[] = $participant;
            }
        }
        // parse permissions
        if (!file_exists($participants_file)) {
            echo 'error: participants file ' . $participants_file . ' does not exist';
            return;
        }
        if (!is_writable($participants_file)) {
            echo 'error: cannot write participants file (' . $participants_file . ')';
            return;
        }
        // lets sort the participants alphabetically first
        //sort($participants);
        //echo ("{ \"message\": \"save these values: " . join($participants) . "\"}");
        // be more careful here, we need to write first to a new file, make sure that this
        // works and copy the result over to the pw_file
        $testfn = $participants_file . '_test';
        file_put_contents($testfn, json_encode($participants, JSON_PRETTY_PRINT));
        if (filesize($testfn) > 0) {
            // seems to have worked, now rename this file to pw_file
            rename($testfn, $participants_file);
        } else {
            logmsg("Error: could not write file to " . $testfn);
            syslog(LOG_EMERG, 'error: could not write file into ' . $testfn);
        }
    }
}
开发者ID:ABCD-STUDY,项目名称:enroll,代码行数:54,代码来源:updateRadReviewServer.php



注:本文中的logmsg函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP logo函数代码示例发布时间:2022-05-15
下一篇:
PHP logit函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap