function showBar() { $page = new page(); $cookie = md5(100000 * $this->rnd()); if (!$_COOKIE["voteID"][$this->id]) { setcookie("voteID[" . $this->id . "]", $cookie, time() + 60 * 60 * 24 * 90, "/"); } for ($i = $this->grade["min"]; $i <= $this->grade["max"]; $i++) { eval('$bar.="' . $page->template("modules/voteTr") . '";'); } $color = $this->color; eval('$vote.="' . $page->template("modules/voteMain") . '";'); return $vote; }
function content() { $db = new sql(); $db->connect(); if (time() < 1098388800) { $res = $db->query("select projects.id, name, company, category, sum(IF(grade is null,0, grade))/count(IF(grade is null,0, grade)) as gsum, count(grade) as gcount FROM projects left join votes on projects.id=votes.id group by projects.id, name, company, category order by gsum desc"); } else { $res = $db->query("select projects.id, name, company, category, sum(IF(grade is null,0, grade))/count(IF(grade is null,0, grade)) as gsum, count(grade) as gcount FROM projects left join votes on projects.id=votes.id where grade>0 group by projects.id, name, company, category order by gsum desc"); } $cats = array(1 => "A", "C", "Y"); $tr = ""; while ($data = $db->fetch_array($res)) { $res1 = $db->query("select * from categories where category_id={$data['category']}"); $data1 = $db->fetch_array($res1); $url = "/projects/" . $cats[$data1["category_id"]] . "/"; eval('$tr.="' . page::template("modules/resultTR") . '";'); } if (!$tr) { $tr = "<p style=\"font-size: 0.85em;\">В настоящее время в данной номинации заявок не подано.</p><p style=\"font-size: 0.85em;\"><a href=\"/request/\">Заявки</a> принимаются до 15 октября 2004 года</p>"; } $resultTr .= $tr; if ($resultTr) { eval('$projectsMain.="' . page::template("modules/resultMain") . '";'); } $resultTr = ""; if (time() < 1098388800) { $text = "<p>Здесь размещены текущие результаты голосования, обновляющиеся в режиме реального времени.</p><p>Для того, чтобы проголосовать за проект надо перейти на его страницу.</p><p>Вы можете поставить свою оценку каждому из 22 представленных проектов, но можете сделать это только 1 раз за весь период голосования.</p><p>Голосование открыто до 0:00 22 октября 2004 года.</p>"; } else { $text = "<h3>Голование закрыто в 0:00 22 октября 2004 года.</h3><p><i>При анализе хода голосования за проекты в интернете, Оргкомитет конкурса М2. Новый Дом 2004. обнаружил многочисленные случаи злоупотребления при выставлении оценки 0 баллов. В целях повышения релевантности итогов голосования, Оргкомитет принял решение не учитывать оценки 0 баллов, выставленные за весь период голосования в интернете.</i></p>"; } $this->elements["content"] = $text . $projectsMain; }
<?php $dr = preg_replace("'/\$'", "", getenv("DOCUMENT_ROOT")); include_once $dr . "/lib/streams.php"; include_once $dr . "/lib/gettext.php"; include_once $dr . "/lib/l10n.php"; include_once $dr . "/lib/db.conf.php"; include_once $dr . "/lib/mysql.class.php"; include_once $dr . "/lib/page.class.php"; $page = new page(); $page->parseURI(); $page->findPath(); $page->sendHeader(); $page->getElements(); $page->getConfig(); if ($page->get["version"] == "forprint") { $template_name = "mainPr"; } elseif ($page->dirs["id"][$page->dirs["count"] - 1] != 1) { $template_name = "second"; } else { $template_name = "main"; } $main = $page->template($template_name, $page); echo $main;
function content() { if ($this->url) { $this->db->connect(); if ($this->dirs[1]) { $where = " and DATE_FORMAT(FROM_UNIXTIME(time),\"%c\")='" . $this->dirs[1] . "'"; } $res = $this->db->query("select * from (events left join events_types on events.type=events_types.type_id) left join events_formats on events.format=events_formats.format_id where DATE_FORMAT(FROM_UNIXTIME(time),\"%Y\")='" . $this->dirs[0] . "'{$where} order by time desc"); while ($data = $this->db->fetch_array($res)) { $count = !$count; if ($count) { $color = "#F0F0F0"; } else { $color = "#FFFFFF"; } $data["date"] = date("d.m.Y", $data["time"]); eval('$eventsTR.="' . page::template("modules/eventsTR") . '";'); $data1 = $data; } $this->properties["year"] = $data1["year"]; if ($this->dirs[1]) { $this->properties["month"] = $data1["month"]; $this->properties["ruMonth"] = $this->ruMonths[$data1["month"]]; } } elseif ($this->query) { parse_str($this->query, $query); if ($query["action"] == "edit") { $eventsTR = "<tr><td>!</td></tr>"; } } else { $this->db->connect(); $res = $this->db->query("select * from (events left join events_types on events.type=events_types.type_id) left join events_formats on events.format=events_formats.format_id order by time desc"); while ($data = $this->db->fetch_array($res)) { $count = !$count; if ($count) { $color = "#F0F0F0"; } else { $color = "#FFFFFF"; } $data["date"] = date("d.m.Y", $data["time"]); eval('$eventsTR.="' . page::template("modules/eventsTR") . '";'); } } $_SESSION["HTTP_REFERER"] = ""; if ($query["action"] == "edit") { $header = "–едактирование"; $_SESSION["HTTP_REFERER"] = $_SERVER["HTTP_REFERER"]; $action = "edit"; $this->db->connect(); $res = $this->db->query("select * from events where id={$query['id']}"); $data = $this->db->fetch_array($res); $data["date"] = date("d.m.Y H:i", $data["time"]); if ($data["time_end"] > 0) { $data["date_end"] = date("d.m.Y H:i", $data["time_end"]); } $res_type = $this->db->query("select * from events_types order by type_name"); while ($type = $this->db->fetch_array($res_type)) { $select_type .= "<option value=\"" . $type["type_id"] . "\"" . ($data["type"] == $type["type_id"] ? " selected" : "") . ">" . $type["type_name"] . "</option>"; } $res_format = $this->db->query("select * from events_formats order by format_name"); while ($format = $this->db->fetch_array($res_format)) { $select_format .= "<option value=\"" . $format["format_id"] . "\"" . ($data["format"] == $format["format_id"] ? " selected" : "") . ">" . $format["format_name"] . "</option>"; } $data["text"] = str_replace("<br>", "\r", $data["text"]); $data["place"] = str_replace("<br>", "\r", $data["place"]); eval('$content="' . page::template("modules/eventsAdd") . '";'); } elseif ($query["action"] == "add") { $header = "ƒобавление"; $_SESSION["HTTP_REFERER"] = $_SERVER["HTTP_REFERER"]; $action = "add"; $this->db->connect(); $data["date"] = date("d.m.Y H:i:s", time()); $res_type = $this->db->query("select * from events_types order by type_name"); while ($type = $this->db->fetch_array($res_type)) { $select_type .= "<option value=\"" . $type["type_id"] . "\"" . ($data["type"] == $type["type_id"] ? " selected" : "") . ">" . $type["type_name"] . "</option>"; } $res_format = $this->db->query("select * from events_formats order by format_name"); while ($format = $this->db->fetch_array($res_format)) { $select_format .= "<option value=\"" . $format["format_id"] . "\"" . ($data["format"] == $format["format_id"] ? " selected" : "") . ">" . $format["format_name"] . "</option>"; } $data["add_person"] = $_SESSION["user"]; eval('$content="' . page::template("modules/eventsAdd", "FORMPOST", array("fields[name]" => "EXISTS")) . '";'); } else { eval('$content="' . page::template("modules/eventsMain") . '";'); } $this->elements["content"] = $content; }