コード例 #1
1
ファイル: updateDb.php プロジェクト: bdensmore/dita-docs
 function updateDb()
 {
     $params = array();
     $toReturn = array();
     $toReturn['updated'] = true;
     $toReturn['message'] = "";
     $db = new RecordSet($this->dbConnectionInfo, false, true);
     $rows = $db->Open("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA =  '" . $this->dbConnectionInfo['dbName'] . "' AND TABLE_NAME =  'webhelp'");
     if ($rows > 0) {
         $db->Open("SELECT * FROM webhelp;");
         while ($db->MoveNext()) {
             $assoc = $db->getAssoc();
             $params[$db->Field("parameter")] = $db->Field("value");
         }
         $db->Close();
         if ($params['databaseVersion'] != '1') {
             $toReturn['updated'] = false;
             $toReturn['message'] = "Incompatible database version found!";
         }
     } else {
         $toReturn['updated'] = false;
         $toReturn['message'] = "Database structure does not exist! In order to create a compatible database structure you must check option <strong>\"Create new database structure\"</strong> from previous instalation page.";
     }
     return $toReturn;
 }
コード例 #2
0
ファイル: Product.php プロジェクト: bdensmore/dita-docs
 /**
  * @return array all products that share comments with this one
  */
 function getSharedWith()
 {
     $toReturn = array();
     $db = new RecordSet($this->dbConnectionInfo, false, true);
     $query = "Select product,value from webhelp where parameter='name' and version='" . $db->sanitize($this->version) . "' ";
     if (defined('__SHARE_WITH__')) {
         $query .= "AND product in (";
         $shareArray = explode(",", __SHARE_WITH__);
         foreach ($shareArray as $key => $value) {
             $query .= "'" . $db->sanitize($value) . "', ";
         }
         $query = substr($query, 0, -2) . ");";
     }
     error_log($query);
     $prds = $db->Open($query);
     if ($prds > 0) {
         while ($db->MoveNext()) {
             $product = $db->Field('product');
             $value = $db->Field('value');
             $toReturn[$product] = $value;
         }
     }
     $db->close();
     return $toReturn;
 }
コード例 #3
0
ファイル: contest.php プロジェクト: thezawad/Sicily
/**
 * Generate new pid
 * @global type $conn
 * @return int new unused pid
 */
function gen_new_pid()
{
    global $conn;
    $rs = new RecordSet($conn);
    $rs->Query("SELECT max(pid)+1 FROM problems");
    $rs->MoveNext();
    return (int) $rs->Fields[0];
}
コード例 #4
0
function getBaseUrl($product, $version)
{
    global $dbConnectionInfo;
    $toReturn = __BASE_URL__;
    $db = new RecordSet($dbConnectionInfo, false, true);
    $rows = $db->Open("SELECT value FROM webhelp WHERE parameter='path' AND product='" . $product . "' AND version='" . $version . "';");
    if ($rows == 1) {
        $db->MoveNext();
        $toReturn = $db->Field('value');
    }
    $db->Close();
    return $toReturn;
}
コード例 #5
0
 /**
  * @return array all products that share comments with this one
  */
 function getSharedWith()
 {
     $toReturn = array();
     $db = new RecordSet($this->dbConnectionInfo, false, true);
     $prds = $db->Open("Select product,value from webhelp where parameter='name' and version='" . $this->version . "' " . (defined('__SHARE_WITH__') ? "AND product in (" . __SHARE_WITH__ . ")" : '') . ";");
     if ($prds > 0) {
         while ($db->MoveNext()) {
             $product = $db->Field('product');
             $value = $db->Field('value');
             $toReturn[$product] = $value;
         }
     }
     $db->close();
     return $toReturn;
 }
コード例 #6
0
 private function getEmails()
 {
     global $dbConnectionInfo;
     $this->to = array();
     if (defined('__ADMIN_EMAIL__') && strlen(trim(__ADMIN_EMAIL__)) > 0) {
         $this->to[] = __ADMIN_EMAIL__;
     }
     if (defined("__SEND_ERRORS__") && __SEND_ERRORS__) {
         try {
             $ds = new RecordSet($dbConnectionInfo, false, true);
             $ds->open("SELECT email FROM users WHERE level='admin';");
             while ($ds->MoveNext()) {
                 $this->to[] = $ds->Field('email');
             }
             $ds->close();
         } catch (Exception $e) {
             // ignore
             $msg = date("Y-m-d H:i:s") . ": Error:[" . $e->getCode() . "] message:[" . $e->getMessage() . "]\tfile:[" . $e->getFile() . "] line:[" . $e->getLine() . "]";
             $this->bag .= "[" . $this->getRealIpAddr() . "] - " . $msg . "<br/>";
             $this->count++;
             $this->sendInternal(false);
         }
     }
 }
コード例 #7
0
ファイル: User.php プロジェクト: bdensmore/dita-docs
 /**
  * Get allproduct for witch this user is valid 
  * 
  * @return multitype:Strign productId=>Name
  */
 function getSharedProducts()
 {
     $toReturn = array();
     $db = new RecordSet($this->dbConnectionInfo, false, true);
     $prds = $db->Open("SELECT product,value FROM webhelp WHERE parameter='name' ;");
     if ($prds > 0) {
         while ($db->MoveNext()) {
             $product = $db->Field('product');
             $value = $db->Field('value');
             $toReturn[$product] = $value;
         }
     }
     $db->close();
     return $toReturn;
 }
コード例 #8
0
ファイル: courses.php プロジェクト: thezawad/Sicily
echo _("Teacher");
?>
</th>
            <th width="100"><?php 
echo _("Registrant No.");
?>
</th>
            <th> <?php 
echo _("Status");
?>
 </th>
        </tr>
    </thead>
    <tbody>
		<?php 
while ($rs->MoveNext()) {
    $course_id = $rs->Fields["course_id"];
    $name = htmlspecialchars($rs->Fields["name"]);
    $teacher = htmlspecialchars($rs->Fields["teacher"]);
    ?>
			<tr>
				<td> <?php 
    echo $course_id;
    ?>
 </td>
				<td> <a href="course_detail.php?course_id=<?php 
    echo $course_id;
    ?>
"><?php 
    echo $name;
    ?>
コード例 #9
0
ファイル: Comment.php プロジェクト: hphelion/tools
 function deleteRecursive($ids)
 {
     if (count($ids) > 0) {
         $db = new RecordSet($this->dbConnectionInfo, false, true);
         $toDelete = array();
         $idsS = implode(", ", $ids);
         $db->open("SELECT commentId FROM comments WHERE referedComment in (" . $idsS . ");");
         while ($db->MoveNext()) {
             $toDelete[] = $db->Field("commentId");
         }
         $query = "DELETE FROM comments WHERE commentId in (" . $idsS . ");";
         $toReturn = $db->Run($query);
         $db->close();
         if (count($toDelete) > 0) {
             $this->deleteRecursive($toDelete);
         }
     }
 }
コード例 #10
0
ファイル: stdprogram.php プロジェクト: thezawad/Sicily
</b></td>
                    <td width="10%"><b><?php 
    echo _("Code Length");
    ?>
</b></td>
                    <td width="18%"><b><?php 
    echo _("Submit Time");
    ?>
</b></td>		  
                </tr>
            </thead>
            <?php 
    global $conn;
    $rs = new RecordSet($conn);
    $rs->query("SELECT * FROM status WHERE sid={$problem['stdsid']}");
    if ($rs->MoveNext()) {
        $user_id = $rs->Fields["uid"];
        global $login_uid;
        if ($user_id == $login_uid) {
            $username = $login_username;
        } else {
            $user = new UserTbl($user_id);
            if ($user->Get()) {
                $username = $user->detail['username'];
            } else {
                $username = '******';
            }
        }
        $problem_id = $rs->Fields["pid"];
        $language = $rs->Fields["language"];
        $status = $rs->Fields["status"];
コード例 #11
0
ファイル: share.php プロジェクト: aidanreilly/documentation
Copyright (c) 1998-2014 Syncro Soft SRL, Romania.  All rights reserved.
Licensed under the terms stated in the license file EULA_Webhelp.txt 
available in the base directory of this Oxygen Webhelp plugin.
*/
$baseDir0 = dirname(dirname(__FILE__));
include $baseDir0 . '/oxygen-webhelp/resources/php/init.php';
$version = "@PRODUCT_VERSION@";
if (isset($_POST['host']) && isset($_POST['user']) && isset($_POST['passwd']) && isset($_POST['db'])) {
    $dbConnectionInfo = array('dbHost' => $_POST['host'], 'dbName' => $_POST['db'], 'dbPassword' => $_POST['passwd'], 'dbUser' => $_POST['user']);
    try {
        $db = new RecordSet($dbConnectionInfo, false, true);
        $prds = $db->Open("Select product,value from webhelp where parameter='name' and version='" . $version . "'; ");
        if ($prds > 0) {
            echo "<div class=\"title\">Display comments from</div>\n\t\t\t<div class=\"desc\">Share other products comments (having the same version) with this one. You must select one or more products from the list. Hold down the Ctrl (windows) / Command (Mac) button to select multiple options. </div>\n\t\t\t<table>\n\t\t\t<tr>\n\t\t\t<td>Existing products sharing the same database\n\t\t\t</td>\n\t\t\t<td>";
            echo "<select multiple=\"multiple\" name=\"shareWith[]\" size=\"5\">";
            while ($db->MoveNext()) {
                $product = $db->Field('product');
                $name = $db->Field('value');
                echo "<option value=\"" . $product . "\">" . $name . "</option>";
            }
            echo "</select>";
            echo "</td>\n\t\t\t</tr></table></div>";
        }
    } catch (Exception $ex) {
        echo "<br/>Could not connect to database using specified informations:";
        echo "<table class=\"info\">";
        echo "<tr><td>Host </td><td>" . $dbConnectionInfo['dbHost'] . "</td></tr>";
        echo "<tr><td>Database </td><td>" . $dbConnectionInfo['dbName'] . "</td></tr>";
        echo "<tr><td>User </td><td>" . $dbConnectionInfo['dbUser'] . "</td></tr>";
        echo "</table>";
        echo "<br/>The error was:<br/>", $ex->getMessage(), "<br/>", $ex->getTraceAsString();
コード例 #12
0
ファイル: action.php プロジェクト: thezawad/Sicily
function QueryStatus(&$arg)
{
    $sid = intval(safefetch($arg, 'sid', "Fail"));
    global $conn;
    $rs = new RecordSet($conn);
    $rs->Query("SELECT sid, uid, status, run_time, run_memory, failcase FROM status WHERE sid = {$sid}");
    if (!$rs->MoveNext()) {
        Fail("Invalid run id");
    }
    Output("status", $rs->Fields["status"]);
    Output("run_time", $rs->Fields["run_time"]);
    Output("run_memory", $rs->Fields["run_memory"]);
    Output("case_num", $rs->Fields["failcase"]);
    Output("uid", $rs->Fields["uid"]);
    Output("sid", $rs->Fields["sid"]);
    $rs->Query("select count(*) from queue");
    $rs->MoveNext();
    Output("queue_size", intval($rs->Fields[0]) + 1);
    $rs->free_result();
}
コード例 #13
0
ファイル: status.php プロジェクト: thezawad/Sicily
					<br>
					<table width="95%" border="0" cellpadding="4" cellspacing="2">
						<tr align="center" bgcolor="#0071BD" class="white"> 
							<td width="8%" height="20"><b>Run ID</b></td>
							<td><b>User Name</b></td>
							<td width="10%"><b>Problem</b></td>
							<td width="10%"><b>Language</b></td>
							<td width="16%"><b>Status</b></td>
							<td width="10%"><b>Run Time</b></td>
							<td width="10%"><b>Run Memory</b></td>
							<td width="18%"><b>Submit Time</b></td>
							<td width="10%"><b>Rejudge</b></td>
							<td width="10%"><b>Source</b></td>
						</tr>
						<?php 
if ($rs->MoveNext()) {
    $i = 0;
    do {
        printf("<tr bgcolor=\"#%s\">\n", $i % 2 ? "EEEEEE" : "FCFCFC");
        $user_id = $rs->Fields["uid"];
        $username = $rs->Fields["username"];
        $problem_id = $rs->Fields["pid"];
        $language = $rs->Fields["language"];
        $status = $rs->Fields["status"];
        $run_time = $rs->Fields["run_time"];
        $run_memory = $rs->Fields["run_memory"];
        if ($run_time == NULL) {
            $run_time = "N/A";
        }
        if ($run_memory == NULL) {
            $run_memory = "N/A";
コード例 #14
0
ファイル: process.php プロジェクト: thezawad/Sicily
function ExportSource(&$arg)
{
    $cid = safefetch($arg, 'cid');
    $contest = new ContestsTbl($cid);
    $contest->Get() or error('Invalid Contest ID');
    if (!is_contest_modifiable($cid)) {
        error("Permission Denied");
    }
    $contest = $contest->detail;
    $zip = new ZipArchive();
    $filename = tempnam(sys_get_temp_dir(), "cnt") . '.zip';
    if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) {
        error("cannot Create file <{$filename}>");
    }
    $cpid_hash = get_cpids($cid);
    global $conn;
    $rs = new RecordSet($conn);
    $rs->Query("SELECT * FROM status WHERE contest = '{$cid}'");
    while ($rs->MoveNext()) {
        $ret = $rs->Fields;
        $sid = $ret['sid'];
        $pid = $ret['pid'];
        if (array_key_exists($pid, $cpid_hash)) {
            $pid = $cpid_hash[$pid];
        }
        $uid = $ret['uid'];
        $user = new UserTbl($uid);
        $user->Get();
        $user = $user->detail;
        $src_code = $ret['sourcecode'];
        $status = $ret['status'];
        $lang = $ret['language'];
        $ext_hash = array('C++' => '.cpp', 'C' => '.c', 'Pascal' => '.pas', 'Java' => '.java');
        $ext = $ext_hash[$lang];
        // multiple catalog
        // by pid
        if (!$zip->addFromString('pid/' . $pid . '/' . $sid . $ext, $src_code)) {
            error("Fail to write file for submit [{$sid}]\n");
        }
        // by uid
        if (!$zip->addFromString('uid/' . $user['username'] . '/' . $pid . '_' . $sid . $ext, $src_code)) {
            error("Fail to write file for submit [{$sid}]\n");
        }
    }
    $zip->close();
    output_file($filename, "export_contest{$cid}.zip");
}
コード例 #15
0
ファイル: problems.php プロジェクト: thezawad/Sicily
					<td width="10%">Copy</td>
				</tr>
				<?php 
if ($rs->MoveNext()) {
    $i = 0;
    do {
        $i++;
        printf("<tr bgcolor=\"#%s\">\n", $i % 2 ? "EEEEEE" : "FCFCFC");
        $pid = $rs->Fields['pid'];
        ?>
						<td height=25 align="center">
							<?php 
        if ($cid) {
            $rs1 = new RecordSet($conn);
            $rs1->Query("SELECT accepted FROM ranklist WHERE cid='{$cid}' AND uid='{$login_uid}' AND pid='{$pid}'");
            if ($rs1->MoveNext()) {
                if ($rs1->Fields['accepted'] == 1) {
                    echo "<img src=\"images/yes.gif\" width=\"20\" height=\"20\">";
                } else {
                    echo "<img src=\"images/no.gif\" width=\"20\" height=\"20\">";
                }
            }
        }
        //	if ($rs->Fields['list'][$rs->Fields['pid'] - 1000] == 1) echo "<img src=\"images/no.gif\" width=\"20\" height=\"20\">";
        //	if ($rs->Fields['list'][$rs->Fields['pid'] - 1000] == 2) echo "<img src=\"images/yes.gif\" width=\"20\" height=\"20\">";
        ?>
						</td>
						<td align="center"><?php 
        echo $pid;
        ?>
</td>
コード例 #16
0
ファイル: contest_create.php プロジェクト: thezawad/Sicily
<?php

require "./navigation.php";
include_once "./FCKeditor/fckeditor.php";
$course_id = tryget('course_id', '');
$courseTbl = new CourseTbl($course_id);
if ($course_id && !$courseTbl->Get()) {
    error("Course not found");
}
$course = $courseTbl->detail;
$rs = new RecordSet($conn);
$rs->Query("SELECT max(cid) FROM contests");
$rs->MoveNext();
$cid = $rs->Fields[0];
$rs->Query("SELECT * FROM contests");
?>

<script type="text/javascript">
    function pad0(num) {
        if (num < 10) return "0" + num;
        return num;
    }
    
    function calc_during() {
        if ($("#starttime").val().length == 0) {
            alert("Please set start time first!!");
            return;
        }
        var during = Date.parse($("#endtime").val()) - Date.parse($("#starttime").val());
        during = during / 1000;
        var s = during % 60;