function format_answers($entry) { global $max_thread_size; global $max_answer_number; $answer_number = count($entry->answers); if ($answer_number <= $max_thread_size) { $html = thread($entry, $entry->answers, $max_thread_size - $answer_number); } else { $levelinfo[0] = $answer_number; $topics['topics'] = topics($entry, $entry->answers, $levelinfo, $max_answer_number - $answer_number); $html = new tmpl('topics.html', $topics); } return $html; }
require "../../php/site.php"; site_header(NAV_HOWDOI, "Hack the Browser: How Do I", COLS_1, AJAX_JS); function topics() { global $HOWDOI_DIR; $str = "<div id=\"topics\" class=\"topics\">\n<ol>\n\n"; $json = json_decode(file_get_contents($HOWDOI_DIR . "/topics.json"), true); foreach ($json as $t) { $str .= " <li><a class=\"atopic\" id=\"{$t['file']}\" href=\"#\">{$t['question']}</a></li>\n"; $str .= " <div id=\"a_{$t['file']}\" class=\"answer\"></div>\n\n"; } $str .= "</ol>\n</div>\n"; return $str; } echo "<h1>How Do I ...</h1>"; echo topics(); ?> <script> (function() { var YE = YAHOO.util.Event, YD = YAHOO.util.Dom, BeenThere = {}; function handleSuccess(o) { id = o.argument.id; BeenThere[id] = 1; if(o.responseText !== undefined){ YD.get("a_"+id).innerHTML = o.responseText; }
} if ($_SERVER['REQUEST_METHOD'] == "GET") { $topics = topics(); html($topics); } else { if ($_SERVER['REQUEST_METHOD'] == "POST") { $qid = $_POST['selected'][0]; $stmt = $dbo->prepare("SELECT `text`, topic_id, answer, choice FROM questions, choices, topics WHERE qid=:qid AND qid=question_id AND toid = topic_id"); $stmt->bindParam(':qid', $qid); $stmt->execute(); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); $ctexts = array(); foreach ($rows as $row) { foreach ($row as $key => $value) { ${$key} = $value; if ($choice != "" && !in_array($choice, $ctexts)) { $ctexts[] = $choice; } } } $topics = topics($topic_id); $hidden = "<input type='hidden' name='qid' value='{$qid}'>"; $choices = null; foreach ($ctexts as $value) { $choices .= "<input type='text' name='ch1' value='{$value}'><br>"; } html($topics, $hidden, $text, $choices, $answer); } else { throw new Exception("Unknown request method!"); } }
function topics($options) { return topics($this->company_sfnid, $options); }
exit; } if (isset($_GET["msg_footer"])) { msg_footer_save(); exit; } if (isset($_GET["nondigests"])) { nondigests(); exit; } if (isset($_GET["contentfiltering"])) { content_filtering(); exit; } if (isset($_GET["topics"])) { topics(); exit; } if (isset($_GET["add_language"])) { language_add(); exit; } if (isset($_GET["delete_available_languages"])) { language_del(); exit; } if (isset($_GET["available_languages"])) { echo available_languages(); exit; } if (isset($_GET["privacy"])) {
} return $hiddens; } if ($_SERVER['REQUEST_METHOD'] == "GET") { //edit $ws_id = $_GET['id']; $stmt = $dbo->prepare("SELECT * FROM worksheets WHERE wid = :id"); $stmt->bindParam(':id', $ws_id); $stmt->execute(); $wsheets = $stmt->fetch(); foreach ($wsheets as $key => $value) { ${$key} = $value; } $questions = explode(',', $questions); $topics = topics($wtoid); $hiddens = hiddens($questions); $types[${type}] = 'checked'; $grades[${grade}] = 'selected'; $tests[${testno}] = 'selected'; html($topics, $hiddens, $types, $wname, $grades, $tests); } else { if ($_SERVER['REQUEST_METHOD'] == "POST") { //empty page for creating new ws $options = topics(); //data posted from index $hiddens = hiddens($_POST['selected']); html($options, $hiddens); } else { throw new Exception("Unknown request method!"); } }
echo "<tr>"; echo "<td>"; echo $book->ahref; echo " <i class='ac_read {$book->ac_read}'></i> {$book->ready}"; echo "<br />" . Yii::app()->params["book_types"][$book->typ] . " "; echo "[ "; if ($book->typ == "S") { echo "<a href='http://www.imdb.com/find?q=" . urlencode($book->s_title) . "&s=tt' target='_blank'>IMDb</a> | "; echo "<a href='http://www.kinopoisk.ru/index.php?first=no&what=&kp_query=" . urlencode($book->s_title) . "&s=tt' target='_blank'>КП</a> | "; } else { } echo "<a href='/search/?t=" . urlencode($book->s_title) . "' target='_blank'>NB</a>"; echo " ] "; echo "</td>"; echo "<td>"; echo topics($book); echo "</td>"; echo "<td>"; echo "<select name='cat_id[{$book->id}]'>"; echo "<option value='0'></option>"; echo "<option value='-1'>Вне каталога</option>"; foreach ($categories[$book->typ] as $cat) { echo "<option value='{$cat->id}'" . ($cat->id == $book->cat_id ? " selected" : "") . (!$cat->available ? " disabled" : "") . ">{$cat->title}</option>"; } echo "</select>"; if ($i) { echo " <a href='#' onclick='return T.copy(this)' title='Как у предыдущего'>↑</a>"; } echo "</td>"; echo "</tr>"; }
function main() { $action = $_REQUEST["action"]; if ($action == "topics") { $data = topics(); } else { if ($action == "types") { $data = types(); } else { if ($action == "people") { $data = people(); } else { $data = projects(); } } } header("Content-Type: application/json"); header("Access-Control-Allow-Origin: *"); echo json_encode($data); }
<?php /* * This file is part of Infoschool - a web based school intranet. * Copyright (C) 2006 Maikel Linke */ include 'var.php'; include 'class_entry_new.php'; $output->secure(); $entry = new entry_new(); $entry->load_new(); $answer_number = count($entry->answers); $levelinfo[0] = $answer_number; $topics['topics'] = topics($entry, $entry->answers, $levelinfo, $max_answer_number - $answer_number); $content = new tmpl('topics.html', $topics); $forum_new_entries =& $entry; $output->out($content);