示例#1
0
            $err++;
            echo "Insert error: " . var_export(array($pgdb->errorInfo(), $table, $fields, $row), true) . "\nResume with {$argv[0]} --resume {$table} {$crow}\n";
            exit;
        } else {
            $n++;
        }
        $crow++;
        if ($crow % 10 == 0 || $crow == $nrows) {
            echo "TABLE: {$table} [{$c} fields]  {$crow}/{$nrows}    (" . number_format($crow / $nrows * 100, 2) . "%)";
        }
    }
    $res->closeCursor();
    echo "\n";
}
echo "Done with {$err} errors and {$n} inserts.\n";
if ($err) {
    echo "Migration had errors. Aborting.\n";
    exit;
}
run_sql('install/migrate_mypg_fixseq.sql', $pgdb, $err, $n);
echo "Sequences updated with {$err} errors and {$n} inserts.\n";
if ($err) {
    exit;
}
$r = ask_question("Everything successful. Once you connect up the pg database there is no going back. Do you want to make it live (N,y)?", array('y', 'n'), 'n');
if ($r == 'n') {
    echo "You can make active by renaming .htconfig.php-pgsql to .htconfig.php, or start over by renaming .htconfig.php-mysql to .htconfig.php\n";
    exit;
}
rename('.htconfig.php-pgsql', '.htconfig.php');
echo "Done. {$W}Red{$M}(#){$W}Matrix{$N} now running on postgres.\n";
示例#2
0
<?php

//Course week page template
$uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : 0;
if (isset($_SESSION['rid'])) {
    print !course_belonged($cid, $_SESSION['uid']) && $cid != 0 && $rid != 1 || isset($course['Course_Allowed']) && $course['Course_Allowed'] != 1 && $rid != 3 || !is_allowed($_SESSION['uid']) && $rid != 1 && $rid != 3 ? '' : ask_question($_SESSION['rid'], $course_week['cid'], $course_week['week']);
    print '<div id="feeds">';
    print view_course_week($course_week['cid'], $course_week['week'], 10, $uid, 'sort_post_date_descend');
    print '</div>';
} else {
    print !course_belonged($cid, $_SESSION['uid']) && $cid != 0 && $rid != 1 || isset($course['Course_Allowed']) && $course['Course_Allowed'] != 1 && $rid != 3 || !is_allowed($_SESSION['uid']) && $rid != 1 && $rid != 3 ? '' : ask_question(0, $course_week['cid'], $course_week['week']);
    print '<div id="feeds">';
    print view_course_week($course_week['cid'], $course_week['week'], 10, $uid, 'sort_post_date_descend');
    print '</div>';
}
?>
<script>
setInterval(function(){
	$("#feeds").load("triggers/feeds_update.php",{feeds_type:"course_week"});
},1000*60*5);
</script>
示例#3
0
<?php

//Week page template
$rid = isset($_SESSION['rid']) ? $_SESSION['rid'] : 0;
$uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : 0;
print ask_question($rid, 0, $week);
print '<div id="feeds">';
print view_week($week, 10, $uid, 'sort_post_date_descend');
print '</div>';
?>
<script>
setInterval(function(){
	$("#feeds").load("triggers/feeds_update.php",{feeds_type:"week"});
},1000*60*5);
</script>
示例#4
0
<?php

//Front page template
$rid = isset($_SESSION['rid']) ? $_SESSION['rid'] : 0;
$uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : 0;
print ask_question($rid, 0, 0);
print $uid != 0 ? '<label for="option">Filter: </label>' . select_front_page_filter('option') : '';
print '<div id="feeds">';
print front_page_listing(10, $uid, 'sort_post_date_descend', 'All courses');
print '</div>';
?>
<script>
setInterval(function(){
	$("#feeds").load("triggers/feeds_update.php",{feeds_type:"front"});
},1000*60*5);
</script>
示例#5
0
function login_and_ask($device_id, $username, $password, $question_body, $musername)
{
    $details = login($device_id, $username, $password);
    $id = $details['id'];
    $token = $details['access_token'];
    $question_detail = ask_question($question_body, false, $musername, $device_id, $token);
    return $question_detail;
}