当前位置: 首页>>代码示例>>PHP>>正文


PHP globalconf函数代码示例

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


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

示例1: filedownload

function filedownload($oid, $fname, $msg = '')
{
    $cf = globalconf();
    $if = rawurlencode(encryptData($fname, session_id() . $cf['key'], false));
    $p = myhash($oid . $fname . $msg . session_id() . $cf["key"]);
    $str = "oid=" . $oid . "&filename=" . $if . "&check=" . $p;
    if ($msg != '') {
        $str .= "&msg=" . rawurlencode($msg);
    }
    return $str;
}
开发者ID:guirighetto,项目名称:BOCA_PROTEUM,代码行数:11,代码来源:globals.php

示例2: DBCreateTaskTable

function DBCreateTaskTable()
{
    $c = DBConnect();
    $conf = globalconf();
    if ($conf["dbuser"] == "") {
        $conf["dbuser"] = "bocauser";
    }
    $r = DBExec($c, "\nCREATE TABLE \"tasktable\" (\n\"contestnumber\" int4 NOT NULL,\t\t\t-- (id do concurso)\n\"sitenumber\" int4 NOT NULL,\t\t\t-- (id do site)\n\"usernumber\" int4 NOT NULL,\t\t\t-- (id do usuario requisitando a tarefa)\n\"tasknumber\" int4 NOT NULL,\t\t\t-- (id do problema)\n\"taskstaffnumber\" int4,\t\t\t\t-- (id do usuario executando a tarefa)\n\"taskstaffsite\" int4,\t\t\t\t-- (id do usuario executando a tarefa)\n\"taskdate\" int4 NOT NULL,\t\t-- (dia/hora da submissao no local de origem)\n\"taskdatediff\" int4 NOT NULL,\t-- (diferenca entre inicio da competicao e dia/hora da submissao em seg)\n\"taskdatediffans\" int4 NOT NULL, -- (diferenca entre inicio da competicao e dia/hora da correcao em seg)\n\"taskdesc\" varchar(200),\t\t\t-- (descricao da tarefa)\n\"taskfilename\" varchar(100),\t\t\t-- (nome do arquivo)\n\"taskdata\" oid,\t\t\t\t\t-- (apontador para o arquivo)\n\"tasksystem\" bool NOT NULL,\t\t-- (tarefa de sistema?)\n\"taskstatus\" varchar(20) NOT NULL,\t\t-- (status da tarefa: opentask, processing, done)\n\"colorname\" varchar(100) DEFAULT '',     -- nome da cor do problema\n\"color\" varchar(6) DEFAULT '',           -- cor do problema, formato html (RGB hexadecimal)\n\"updatetime\" int4 DEFAULT EXTRACT(EPOCH FROM now()) NOT NULL, -- (indica a ultima atualizacao no registro)\n-- (tabela com tarefas para os staffs. Dentre elas podemos citar baloes e impressoes)\nCONSTRAINT \"task_pkey\" PRIMARY KEY (\"contestnumber\", \"sitenumber\", \"tasknumber\"),\nCONSTRAINT \"user_fk\" FOREIGN KEY (\"contestnumber\", \"sitenumber\", \"usernumber\")\n\tREFERENCES \"usertable\" (\"contestnumber\", \"usersitenumber\", \"usernumber\")\n\tON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE\n)", "DBCreateTaskTable(create table)");
    $r = DBExec($c, "REVOKE ALL ON \"tasktable\" FROM PUBLIC", "DBCreateTaskTable(revoke public)");
    $r = DBExec($c, "GRANT ALL ON \"tasktable\" TO \"" . $conf["dbuser"] . "\"", "DBCreateTaskTable(grant bocauser)");
    $r = DBExec($c, "CREATE UNIQUE INDEX \"task_index\" ON \"tasktable\" USING btree " . "(\"contestnumber\" int4_ops, \"sitenumber\" int4_ops, \"tasknumber\" int4_ops)", "DBCreateTaskTable(create index)");
}
开发者ID:sbaldrich,项目名称:boca,代码行数:12,代码来源:ftask.php

示例3: DBCreateAnswerTable

function DBCreateAnswerTable()
{
    $c = DBConnect();
    $conf = globalconf();
    if ($conf["dbuser"] == "") {
        $conf["dbuser"] = "bocauser";
    }
    $r = DBExec($c, "\nCREATE TABLE \"answertable\" (\n\"contestnumber\" int4 NOT NULL,\t\t-- (id do concurso)\n\"answernumber\" int4 NOT NULL,\t\t\t-- (id da reposta)\n\"runanswer\" varchar(50) NOT NULL,\t\t-- (reposta dada no julgamento)\n\"yes\" bool DEFAULT 'f' NOT NULL,\t\t-- (flag para indicar se conta ponto)\n\"fake\" bool DEFAULT 'f' NOT NULL,\t\t-- (flag para indicar se eh resposta valida)\n\"updatetime\" int4 DEFAULT EXTRACT(EPOCH FROM now()) NOT NULL, -- (indica a ultima atualizacao no registro)\n-- (tipos possiveis de respostas dos juizes. O flag eh para indicar se a resposta eh YES ou NO.)\nCONSTRAINT \"answer_pkey\" PRIMARY KEY (\"contestnumber\", \"answernumber\"),\nCONSTRAINT \"contest_fk\" FOREIGN KEY (\"contestnumber\") REFERENCES \"contesttable\" (\"contestnumber\") \n\tON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE\n)", "DBCreateAnswerTable(create table)");
    $r = DBExec($c, "REVOKE ALL ON \"answertable\" FROM PUBLIC", "DBCreateAnswerTable(revoke public)");
    $r = DBExec($c, "GRANT ALL ON \"answertable\" TO \"" . $conf["dbuser"] . "\"", "DBCreateAnswerTable(grant bocauser)");
    $r = DBExec($c, "CREATE UNIQUE INDEX \"answer_index\" ON \"answertable\" USING btree " . "(\"contestnumber\" int4_ops, \"answernumber\" int4_ops)", "DBCreateAnswerTable(create index)");
}
开发者ID:sbaldrich,项目名称:boca,代码行数:12,代码来源:fanswer.php

示例4: DBCreateRunTable

function DBCreateRunTable()
{
    $c = DBConnect();
    $conf = globalconf();
    if ($conf["dbuser"] == "") {
        $conf["dbuser"] = "bocauser";
    }
    $r = DBExec($c, "\nCREATE TABLE \"runtable\" (\n\"contestnumber\" int4 NOT NULL,\t-- (id do concurso)\n\"runsitenumber\" int4 NOT NULL,\t-- (local de origem da submissao)\n\"runnumber\" int4 NOT NULL,\t\t-- (numero da submissao)\n\"usernumber\" int4 NOT NULL,\t\t-- (numero do time)\n\"rundate\" int4 NOT NULL,\t\t-- (dia/hora da submissao no local de origem)\n\"rundatediff\" int4 NOT NULL,\t\t-- (diferenca entre inicio da competicao e dia/hora da submissao em seg)\n\"rundatediffans\" int4 NOT NULL,\t-- (diferenca entre inicio da competicao e dia/hora da correcao em seg)\n\"runproblem\" int4 NOT NULL,\t\t-- (id do problema)\n\"runfilename\" varchar(200) NOT NULL,\t-- (nome do arquivo submetido)\n\"rundata\" oid NOT NULL,\t\t-- (codigo fonte do arquivo submetido)\n\"runanswer\" int4 DEFAULT 0 NOT NULL,\t-- (resposta dada no julgamento)\n\"runstatus\" varchar(20) NOT NULL,\t-- (status da submissao: openrun, judging, judged, deleted, judged+)\n\"runjudge\" int4 DEFAULT NULL,\t\t-- (juiz que esta julgando)\n\"runjudgesite\" int4 DEFAULT NULL,\t-- (juiz que esta julgando)\n\"runanswer1\" int4 DEFAULT 0 NOT NULL, -- (resposta dada no julgamento)                                                    \n\"runjudge1\" int4 DEFAULT NULL,                -- (juiz que esta julgando)                                                 \n\"runjudgesite1\" int4 DEFAULT NULL,    -- (juiz que esta julgando)                                                         \n\"runanswer2\" int4 DEFAULT 0 NOT NULL, -- (resposta dada no julgamento)                                                    \n\"runjudge2\" int4 DEFAULT NULL,                -- (juiz que esta julgando)                                                 \n\"runjudgesite2\" int4 DEFAULT NULL,    -- (juiz que esta julgando)                                                         \n\"runlangnumber\" int4 NOT NULL,\t-- (linguagem do codigo fonte)\n\n\"autoip\" varchar(20) DEFAULT '',  -- os campos auto... sao para a correcao automatica\n\"autobegindate\" int4 DEFAULT NULL,\n\"autoenddate\" int4 DEFAULT NULL,\n\"autoanswer\" text DEFAULT '',\n\"autostdout\" oid DEFAULT NULL,\n\"autostderr\" oid DEFAULT NULL,\n\n\"updatetime\" int4 DEFAULT EXTRACT(EPOCH FROM now()) NOT NULL, -- (indica a ultima atualizacao no registro)\nCONSTRAINT \"run_pkey\" PRIMARY KEY (\"contestnumber\", \"runsitenumber\", \"runnumber\"),\nCONSTRAINT \"user_fk\" FOREIGN KEY (\"contestnumber\", \"runsitenumber\", \"usernumber\")\n\tREFERENCES \"usertable\" (\"contestnumber\", \"usersitenumber\", \"usernumber\")\n\tON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE,\nCONSTRAINT \"problem_fk\" FOREIGN KEY (\"contestnumber\", \"runproblem\")\n\tREFERENCES \"problemtable\" (\"contestnumber\", \"problemnumber\")\n\tON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE,\nCONSTRAINT \"answer_fk\" FOREIGN KEY (\"contestnumber\", \"runanswer\")\n\tREFERENCES \"answertable\" (\"contestnumber\", \"answernumber\")\n\tON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE,\nCONSTRAINT \"lang_fk\" FOREIGN KEY (\"contestnumber\", \"runlangnumber\")\n\tREFERENCES \"langtable\" (\"contestnumber\", \"langnumber\")\n\tON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE\n)", "DBCreateRunTable(create table)");
    $r = DBExec($c, "REVOKE ALL ON \"runtable\" FROM PUBLIC", "DBCreateRunTable(revoke public)");
    $r = DBExec($c, "GRANT ALL ON \"runtable\" TO \"" . $conf["dbuser"] . "\"", "DBCreateRunTable(grant bocauser)");
    $r = DBExec($c, "CREATE UNIQUE INDEX \"run_index\" ON \"runtable\" USING btree " . "(\"contestnumber\" int4_ops, \"runsitenumber\" int4_ops, \"runnumber\" int4_ops)", "DBCreateRunTable(create run_index)");
    $r = DBExec($c, "CREATE INDEX \"run_index2\" ON \"runtable\" USING btree " . "(\"contestnumber\" int4_ops, \"runsitenumber\" int4_ops, \"usernumber\" int4_ops)", "DBCreateRunTable(create run_index2)");
}
开发者ID:sbaldrich,项目名称:boca,代码行数:13,代码来源:frun.php

示例5: DBCreateLangTable

function DBCreateLangTable()
{
    $c = DBConnect();
    $conf = globalconf();
    if ($conf["dbuser"] == "") {
        $conf["dbuser"] = "bocauser";
    }
    $r = DBExec($c, "\nCREATE TABLE \"langtable\" (\n        \"contestnumber\" int4 NOT NULL,\n        \"langnumber\" int4 NOT NULL,\n        \"langname\" varchar(50) NOT NULL,\n        \"langextension\" varchar(20) NOT NULL,\n        \"updatetime\" int4 DEFAULT EXTRACT(EPOCH FROM now()) NOT NULL, -- (indica a ultima atualizacao no registro)\n        CONSTRAINT \"lang_pkey\" PRIMARY KEY (\"contestnumber\", \"langnumber\"),\n        CONSTRAINT \"contest_fk\" FOREIGN KEY (\"contestnumber\") REFERENCES \"contesttable\" (\"contestnumber\")\n                ON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE\n)", "DBCreateLangTable(create table)");
    $r = DBExec($c, "REVOKE ALL ON \"langtable\" FROM PUBLIC", "DBCreateLangTable(revoke public)");
    $r = DBExec($c, "GRANT ALL ON \"langtable\" TO \"" . $conf["dbuser"] . "\"", "DBCreateLangTable(grant bocauser)");
    $r = DBExec($c, "CREATE INDEX \"lang_index\" ON \"langtable\" USING btree " . "(\"contestnumber\" int4_ops, \"langnumber\" int4_ops)", "DBCreateLangTable(create lang_index)");
    $r = DBExec($c, "CREATE INDEX \"lang_index2\" ON \"langtable\" USING btree " . "(\"contestnumber\" int4_ops, \"langname\" varchar_ops)", "DBCreateLangTable(create lang_index2)");
}
开发者ID:sbaldrich,项目名称:boca,代码行数:13,代码来源:flanguage.php

示例6: DBCreateClarTable

function DBCreateClarTable()
{
    $c = DBConnect();
    $conf = globalconf();
    if ($conf["dbuser"] == "") {
        $conf["dbuser"] = "bocauser";
    }
    $r = DBExec($c, "\nCREATE TABLE clartable (\ncontestnumber int4 NOT NULL, \t\t-- (id do concurso)\nclarsitenumber int4 NOT NULL,\t\t-- (local de origem da pergunta)\nclarnumber int4 NOT NULL,\t\t-- (id da pergunta)\nusernumber int4 NOT NULL,\t\t-- (id do usuario)\nclardate int4 NOT NULL,\t\t-- (dia/hora da pergunta no local de origem)\nclardatediff int4 NOT NULL,\t\t-- (diferenca entre inicio da competicao e dia/hora da pergunta em seg)\nclardatediffans int4 NOT NULL,\t-- (diferenca entre inicio da competicao e dia/hora da resposta em seg)\nclarproblem int4 NOT NULL,\t\t-- (id do problema)\nclardata text NOT NULL,\t\t-- (texto da pergunta)\nclaranswer text,\t\t\t-- (resposta dada aa pergunta)\nclarstatus varchar(20) NOT NULL,\t-- (status da submissao: openclar, answering, answered, \n\t\t\t\t\t--  answeredsite, answeredall, deleted)\nclarjudge int4 DEFAULT NULL,\t\t-- (juiz que esta julgando)\nclarjudgesite int4 DEFAULT NULL,\t-- (juiz que esta julgando)\nupdatetime int4 DEFAULT EXTRACT(EPOCH FROM now()) NOT NULL, -- (indica a ultima atualizacao no registro)\nCONSTRAINT clar_pkey PRIMARY KEY (contestnumber, clarsitenumber, clarnumber),\nCONSTRAINT user_fk FOREIGN KEY (contestnumber, clarsitenumber, usernumber)\n\tREFERENCES usertable (contestnumber, usersitenumber, usernumber)\n\tON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE,\nCONSTRAINT problem_fk FOREIGN KEY (contestnumber, clarproblem)\n\tREFERENCES problemtable (contestnumber, problemnumber)\n\tON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE\n)", "DBCreateClarTable(create table)");
    $r = DBExec($c, "REVOKE ALL ON clartable FROM PUBLIC", "DBCreateClarTable(revoke public)");
    $r = DBExec($c, "GRANT ALL ON clartable TO \"" . $conf["dbuser"] . "\"", "DBCreateClarTable(grant bocauser)");
    $r = DBExec($c, "CREATE UNIQUE INDEX clar_index ON clartable USING btree " . "(contestnumber int4_ops, clarsitenumber int4_ops, clarnumber int4_ops)", "DBCreateClarTable(create clar_index)");
    $r = DBExec($c, "CREATE INDEX clar_index2 ON clartable USING btree " . "(contestnumber int4_ops, clarsitenumber int4_ops, usernumber int4_ops)", "DBCreateClarTable(create clar_index2)");
}
开发者ID:sbaldrich,项目名称:boca,代码行数:13,代码来源:fclar.php

示例7: DBCreateBkpTable

function DBCreateBkpTable()
{
    $c = DBConnect();
    $conf = globalconf();
    if ($conf["dbuser"] == "") {
        $conf["dbuser"] = "bocauser";
    }
    $r = DBExec($c, "\nCREATE TABLE \"bkptable\" (\n\"contestnumber\" int4 NOT NULL,\t-- (id do concurso)\n\"sitenumber\" int4 NOT NULL,\t-- (local de origem da submissao)\n\"bkpnumber\" int4 NOT NULL,\t\t-- (numero da submissao)\n\"usernumber\" int4 NOT NULL,\t\t-- (numero do time)\n\"bkpdate\" int4 NOT NULL,\t\t-- (dia/hora da submissao no local de origem)\n\"bkpfilename\" varchar(200) NOT NULL,\t-- (nome do arquivo submetido)\n\"bkpdata\" oid NOT NULL,\t\t-- (codigo fonte do arquivo submetido)\n\"bkpstatus\" varchar(50) NOT NULL,\n\"bkpsize\" int4 NOT NULL,\n\"updatetime\" int4 DEFAULT EXTRACT(EPOCH FROM now()) NOT NULL, -- (indica a ultima atualizacao no registro)\nCONSTRAINT \"bkp_pkey\" PRIMARY KEY (\"contestnumber\", \"sitenumber\", \"bkpnumber\"),\nCONSTRAINT \"user_fk\" FOREIGN KEY (\"contestnumber\", \"sitenumber\", \"usernumber\")\n\tREFERENCES \"usertable\" (\"contestnumber\", \"usersitenumber\", \"usernumber\")\n\tON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)", "DBCreateBkpTable(create table)");
    $r = DBExec($c, "REVOKE ALL ON \"bkptable\" FROM PUBLIC", "DBCreateBkpTable(revoke public)");
    $r = DBExec($c, "GRANT ALL ON \"bkptable\" TO \"" . $conf["dbuser"] . "\"", "DBCreateBkpTable(grant bocauser)");
    $r = DBExec($c, "CREATE UNIQUE INDEX \"bkp_index\" ON \"bkptable\" USING btree " . "(\"contestnumber\" int4_ops, \"sitenumber\" int4_ops, \"bkpnumber\" int4_ops)", "DBCreateBkpTable(create bkp_index)");
    $r = DBExec($c, "CREATE INDEX \"bkp_index2\" ON \"bkptable\" USING btree " . "(\"contestnumber\" int4_ops, \"sitenumber\" int4_ops, \"usernumber\" int4_ops)", "DBCreateBkpTable(create bkp_index2)");
}
开发者ID:sbaldrich,项目名称:boca,代码行数:13,代码来源:fbkp.php

示例8: DBCreateLogTable

function DBCreateLogTable()
{
    $c = DBConnect();
    $conf = globalconf();
    if ($conf["dbuser"] == "") {
        $conf["dbuser"] = "bocauser";
    }
    $r = DBExec($c, "\nCREATE TABLE \"logtable\" (\n        \"lognumber\" serial,                     -- (serial para o log)\n        \"contestnumber\" int4 NOT NULL,          -- (id do concurso)\n        \"sitenumber\" int4 NOT NULL,             -- (id do site local)\n        \"loguser\" int4,                         -- (usuario envolvido com o log)\n        \"logip\" varchar(20) NOT NULL,           -- (numero do site do usuario envolvido)\n        \"logdate\" int4 NOT NULL,                -- (dia/hora da criacao deste registro)\n        \"logtype\" varchar(20) NOT NULL,         -- (tipo de registro: error, warn, info, debug)\n        \"logdata\" text NOT NULL,                -- (descricao do registro)\n        \"logstatus\" varchar(20) DEFAULT '',     -- (status do registro)\n        CONSTRAINT \"log_pkey\" PRIMARY KEY (\"lognumber\"),\n        CONSTRAINT \"site_fk\" FOREIGN KEY (\"contestnumber\", \"sitenumber\")\n                REFERENCES \"sitetable\" (\"contestnumber\", \"sitenumber\")\n                ON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE,\n        CONSTRAINT \"loguser\" FOREIGN KEY (\"contestnumber\", \"loguser\", \"sitenumber\")\n                REFERENCES \"usertable\" (\"contestnumber\", \"usernumber\", \"usersitenumber\")\n                ON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE\n)", "DBCreateLogTable(create table)");
    $r = DBExec($c, "REVOKE ALL ON \"logtable\" FROM PUBLIC", "DBCreateLogTable(revoke public)");
    $r = DBExec($c, "GRANT INSERT, SELECT ON \"logtable\" TO \"" . $conf["dbuser"] . "\"", "DBCreateLogTable(grant bocauser)");
    $r = DBExec($c, "CREATE INDEX \"log_index\" ON \"logtable\" USING btree " . "(\"contestnumber\" int4_ops, \"sitenumber\" int4_ops, \"logdate\" int4_ops)", "DBCreateLogTable(create log_index)");
    $r = DBExec($c, "CREATE INDEX \"log_index2\" ON \"logtable\" USING btree " . "(\"contestnumber\" int4_ops, \"loguser\" int4_ops, \"sitenumber\" int4_ops)", "DBCreateLogTable(create log_index2)");
    $r = DBExec($c, "REVOKE ALL ON \"logtable_lognumber_seq\" FROM PUBLIC", "DBCreateLogTable(revoke public seq)");
    $r = DBExec($c, "GRANT ALL ON \"logtable_lognumber_seq\" TO \"" . $conf["dbuser"] . "\"", "DBCreateLogTable(grant bocauser seq)");
}
开发者ID:justomiguel,项目名称:boca,代码行数:15,代码来源:flog.php

示例9: strpos

			</div>
		</div>
	</nav>
	<div class="alert alert-info" role="alert">
		Balloons: 
		<?php 
$ds = DIRECTORY_SEPARATOR;
if ($ds == "") {
    $ds = "/";
}
$runtmp = $_SESSION["locr"] . $ds . "private" . $ds . "runtmp" . $ds . "run-contest" . $_SESSION["usertable"]["contestnumber"] . "-site" . $_SESSION["usertable"]["usersitenumber"] . "-user" . $_SESSION["usertable"]["usernumber"] . ".php";
$doslow = true;
if (file_exists($runtmp)) {
    if (($strtmp = file_get_contents($runtmp, FALSE, NULL, -1, 1000000)) !== FALSE) {
        $postab = strpos($strtmp, "\t");
        $conf = globalconf();
        $strcolors = decryptData(substr($strtmp, $postab + 1, strpos($strtmp, "\n") - $postab - 1), $conf['key'], '');
        $doslow = false;
        $rn = explode("\t", $strcolors);
        $n = count($rn);
        for ($i = 1; $i < $n - 1; $i++) {
            echo "<img alt=\"" . $rn[$i] . "\" width=\"10\" " . "src=\"" . balloonurl($rn[$i + 1]) . "\" />\n";
            $i++;
        }
    } else {
        unset($strtmp);
    }
}
if ($doslow) {
    $run = DBUserRunsYES($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"], $_SESSION["usertable"]["usernumber"]);
    $n = count($run);
开发者ID:joffilyfe,项目名称:boca,代码行数:31,代码来源:header.php

示例10: DBNewSite

function DBNewSite($contest, $c = null, $param = array())
{
    $cw = false;
    if ($c == null) {
        $cw = true;
        $c = DBConnect();
        DBExec($c, "begin work");
    }
    $ct = DBContestInfo($contest, $c);
    if ($ct == null) {
        return false;
    }
    if (isset($param['sitenumber']) && !isset($param['number'])) {
        $param['number'] = $param['sitenumber'];
    }
    $ac = array('number', 'siteip', 'sitename', 'sitescorelevel', 'updatetime', 'startdate', 'duration');
    $type = array();
    $type['startdate'] = 1;
    $type['duration'] = 1;
    $type['number'] = 1;
    $type['sitescorelevel'] = 1;
    $type['updatetime'] = 1;
    foreach ($ac as $key) {
        if (isset($param[$key]) && (!isset($type[$key]) || is_numeric($param[$key]))) {
            ${$key} = sanitizeText($param[$key]);
        } else {
            ${$key} = "";
        }
    }
    if ($number == "") {
        $a = DBGetRow("select max(sitenumber) as site from sitetable where contestnumber={$contest}", 0, $c);
        if ($a == null) {
            $n = 1;
        } else {
            $n = $a["site"] + 1;
        }
        $number = $n;
    } else {
        $a = DBGetRow("select * from sitetable where contestnumber={$contest} and sitenumber={$number}", 0, $c);
        if ($a != null) {
            return 1;
        }
    }
    if ($duration == '') {
        $duration = $ct["contestduration"];
    }
    if ($startdate == '') {
        $startdate = $ct["conteststartdate"];
    }
    if ($siteip == "") {
        $siteip = "127.0.0.1/boca";
    }
    if ($sitename == "") {
        $sitename = "Site";
    }
    if ($sitescorelevel == "") {
        $sitescorelevel = 3;
    }
    $t = time();
    if ($updatetime == "") {
        $updatetime = $t;
    }
    DBExec($c, "insert into sitetable (contestnumber, sitenumber, siteip, sitename, siteactive, sitepermitlogins, " . "sitelastmileanswer, sitelastmilescore, siteduration, siteautoend, sitejudging, sitetasking, " . "siteglobalscore, sitescorelevel, " . "sitenextuser, sitenextclar, sitenextrun, sitenexttask, sitemaxtask, updatetime) values " . "({$contest}, {$number}, '{$siteip}', '{$sitename}', 't', 't', " . $ct["contestlastmileanswer"] . "," . $ct["contestlastmilescore"] . ", {$duration}, 't', '{$number}', '{$number}', '{$number}', {$sitescorelevel}, 0, 0, 0, 0, 10, {$updatetime})");
    $cf = globalconf();
    $admpass = myhash($cf["basepass"]);
    DBExec($c, "insert into usertable " . "(contestnumber, usersitenumber, usernumber, username, userfullname, " . "userdesc, usertype, userenabled, usermultilogin, userpassword, userip, userlastlogin, " . "usersession, usersessionextra, userlastlogout, userpermitip, updatetime) values " . "({$contest}, {$number}, 1000, 'admin', 'Administrator', NULL, 'admin', " . "'t', 't', '{$admpass}', NULL, NULL, '', '', NULL, NULL, {$updatetime})");
    $param = array();
    $param['contest'] = $contest;
    $param['site'] = $number;
    $param['start'] = $startdate;
    DBRenewSiteTime($param, $c);
    if ($cw) {
        DBExec($c, "commit work");
    }
    LOGLevel("User " . $_SESSION["usertable"]["username"] . "/" . $_SESSION["usertable"]["usersitenumber"] . " created site {$number} on contest {$contest}.", 2);
    return 2;
}
开发者ID:sbaldrich,项目名称:boca,代码行数:77,代码来源:fcontest.php

示例11: ob_start

ob_start();
session_start();
require_once "globals.php";
if (!ValidSession()) {
    echo "<html><head><title>View Page</title>";
    InvalidSession("filewindow.php");
    echo "<script>window.close();</script></html>";
    exit;
}
if (!isset($_GET["oid"]) || !is_numeric($_GET["oid"]) || !isset($_GET["filename"]) || !isset($_GET["check"]) || $_GET["check"] == "") {
    echo "<html><head><title>View Page</title>";
    IntrusionNotify("Bad parameters in filewindow.php");
    echo "<script>window.close();</script></html>";
    exit;
}
$cf = globalconf();
$fname = decryptData(rawurldecode($_GET["filename"]), session_id() . $cf["key"]);
$msg = '';
if (isset($_GET["msg"])) {
    $msg = rawurldecode($_GET["msg"]);
}
$p = myhash($_GET["oid"] . $fname . $msg . session_id() . $cf["key"]);
if ($p != $_GET["check"]) {
    echo "<html><head><title>View Page</title>";
    IntrusionNotify("Parameters modified in filewindow.php");
    echo "<script>window.close();</script></html>";
    exit;
}
require_once "db.php";
if ($_GET["oid"] >= 0) {
    $c = DBConnect();
开发者ID:sbaldrich,项目名称:boca,代码行数:31,代码来源:filewindow.php

示例12: DBCreateDatabase

function DBCreateDatabase()
{
    $conf = globalconf();
    if ($conf["dblocal"] == "true") {
        $conn = pg_connect("connect_timeout=10 dbname=template1 user=" . $conf["dbsuperuser"] . " password=" . $conf["dbsuperpass"]);
    } else {
        $conn = pg_connect("connect_timeout=10 host=" . $conf["dbhost"] . " port=" . $conf["dbport"] . " dbname=template1 user=" . $conf["dbsuperuser"] . " password=" . $conf["dbsuperpass"]);
    }
    if (!$conn) {
        MSGError("Unable to connect to xtemplate1 as " . $conf["dbsuperuser"]);
        exit;
    }
    if (isset($conf["dbencoding"])) {
        $r = DBExec($conn, "create database {$conf["dbname"]} with encoding = '{$conf["dbencoding"]}'", "DBCreateDatabase(create)");
    } else {
        $r = DBExec($conn, "create database {$conf["dbname"]} with encoding = 'UTF8'", "DBCreateDatabase(create)");
    }
}
开发者ID:joffilyfe,项目名称:boca,代码行数:18,代码来源:db.php

示例13: DBGetFullProblemData

function DBGetFullProblemData($contestnumber, $freeproblems = false)
{
    $c = DBConnect();
    DBExec($c, "begin work", "GetFullProblemData");
    $r = DBExec($c, "select p.problemnumber as number, p.problemname as name, p.problemfullname as fullname, " . "p.problembasefilename as basefilename, p.fake as fake, " . "p.problemcolor as color, p.problemcolorname as colorname, " . "p.probleminputfilename as inputfilename, p.probleminputfile as inputoid, p.probleminputfilehash as inputhash " . " from problemtable as p " . "where p.contestnumber={$contestnumber} order by p.problemnumber", "DBGetFullProblemData(get problem)");
    // and p.problemfullname !~ '(DEL)'
    $n = DBnlines($r);
    if ($n == 0) {
        LOGLevel("No problems defined in the database ({$contestnumber})", 1);
    }
    $cf = globalconf();
    $a = array();
    $ds = DIRECTORY_SEPARATOR;
    if ($ds == "") {
        $ds = "/";
    }
    for ($i = 0; $i < $n; $i++) {
        $a[$i] = array_merge(array(), DBRow($r, $i));
        if (strpos($a[$i]['fullname'], '(DEL)') !== false) {
            continue;
        }
        $nn = $a[$i]['number'];
        $ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "contest" . $contestnumber . "-problem" . $nn;
        $ck = myshorthash('');
        if (is_readable($ptmp . ".hash")) {
            $ck = trim(file_get_contents($ptmp . ".hash"));
        }
        if ($ck != $a[$i]['inputhash']) {
            @unlink($ptmp . ".name");
            @unlink($ptmp . ".hash");
            $a[$i]['basefilename'] = '';
            $a[$i]['descfilename'] = '';
            $a[$i]['fullname'] = '';
        }
        if ($freeproblems && $a[$i]['fake'] != 't') {
            if (is_readable($ptmp . ".name")) {
                $a[$i]['descfilename'] = trim(file_get_contents($ptmp . ".name"));
                if ($a[$i]['descfilename'] != '') {
                    $a[$i]['descoid'] = -1;
                }
            } else {
                @unlink($ptmp . ".name");
                @unlink($ptmp . ".hash");
                $randnum = session_id() . "_" . rand();
                $dir = $ptmp . '-' . $randnum;
                @mkdir($dir, 0770, true);
                $failed = 0;
                if (($ret = DB_lo_export($contestnumber, $c, $a[$i]["inputoid"], $dir . $ds . "tmp.zip")) === false) {
                    LogError("FreeProblems: Unable to read problem package from database (problem={$nn}, contest={$contestnumber})");
                    $failed = 1;
                }
                if (!$failed) {
                    $zip = new ZipArchive();
                    if ($zip->open($dir . $ds . "tmp.zip") === true) {
                        $zip->extractTo($dir);
                        $zip->close();
                        if (($info = @parse_ini_file($dir . $ds . "description" . $ds . 'problem.info')) === false) {
                            $failed = 2;
                        }
                        if (!$failed) {
                            $descfile = '';
                            if (isset($info['descfile'])) {
                                $descfile = trim(sanitizeText($info['descfile']));
                            }
                            $basename = trim(sanitizeText($info['basename']));
                            $fullname = trim(sanitizeText($info['fullname']));
                            if ($basename == '' || $fullname == '') {
                                $failed = 3;
                            }
                        }
                    } else {
                        $failed = 4;
                    }
                    if (!$failed) {
                        @mkdir($ptmp);
                        if ($descfile != '') {
                            if (file_put_contents($ptmp . $ds . $descfile, encryptData(file_get_contents($dir . $ds . "description" . $ds . $descfile), $cf['key']), LOCK_EX) === FALSE) {
                                $failed = 5;
                            }
                            if (!$failed) {
                                file_put_contents($ptmp . ".name", $ptmp . $ds . $descfile);
                                file_put_contents($ptmp . ".hash", $a[$i]['inputhash']);
                                if (is_readable($ptmp . ".name")) {
                                    $a[$i]['descfilename'] = trim(file_get_contents($ptmp . ".name"));
                                    if ($a[$i]['descfilename'] != '') {
                                        $a[$i]['descoid'] = -1;
                                    }
                                }
                            }
                        } else {
                            @unlink($ptmp . ".name");
                            @unlink($ptmp . ".hash");
                        }
                        if (!$failed) {
                            DBExec($c, "update problemtable set problemfullname='{$fullname}', problembasefilename='{$basename}' where problemnumber={$nn} and contestnumber={$contestnumber}", "DBGetFullProblemData(free problem)");
                            $a[$i]['basefilename'] = $basename;
                            $a[$i]['fullname'] = $fullname;
                        }
                    }
                }
//.........这里部分代码省略.........
开发者ID:sbaldrich,项目名称:boca,代码行数:101,代码来源:fproblem.php


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