function emailArticle() { $param = db_escape_string($_REQUEST['param']); require_once "lib/MiniTemplator.class.php"; $tpl = new MiniTemplator(); $tpl_t = new MiniTemplator(); $tpl->readTemplateFromFile("templates/email_article_template.txt"); $tpl->setVariable('USER_NAME', $_SESSION["name"], true); $tpl->setVariable('USER_EMAIL', $user_email, true); $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true); $result = db_query("SELECT DISTINCT link, content, title\n\t\t\tFROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND\n\t\t\tid IN ({$param}) AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) > 1) { $subject = __("[Forwarded]") . " " . __("Multiple articles"); } while ($line = db_fetch_assoc($result)) { if (!$subject) { $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); } $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"])); $tpl->addBlock('article'); } $tpl->addBlock('email'); $content = ""; $tpl->generateOutputToString($content); $mailto_link = htmlspecialchars("mailto: ?subject=" . rawurlencode($subject) . "&body=" . rawurlencode($content)); print __("Clicking the following link to invoke your mail client:"); print "<div class=\"tagCloudContainer\">"; print "<a target=\"_blank\" href=\"{$mailto_link}\">" . __("Forward selected article(s) by email.") . "</a>"; print "</div>"; print __("You should be able to edit the message before sending in your mail client."); print "<p>"; print "<div style='text-align : center'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">" . __('Close this dialog') . "</button>"; print "</div>"; //return; }
function resetPass() { $uid = db_escape_string($_REQUEST["id"]); $result = db_query($this->link, "SELECT login,email\n\t\t\t\tFROM ttrss_users WHERE id = '{$uid}'"); $login = db_fetch_result($result, 0, "login"); $email = db_fetch_result($result, 0, "email"); $salt = db_fetch_result($result, 0, "salt"); $new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250); $tmp_user_pwd = make_password(8); $pwd_hash = encrypt_password($tmp_user_pwd, $new_salt, true); db_query($this->link, "UPDATE ttrss_users SET pwd_hash = '{$pwd_hash}', salt = '{$new_salt}'\n\t\t\t\tWHERE id = '{$uid}'"); print T_sprintf("Changed password of user <b>%s</b>\n\t\t\t\t to <b>%s</b>", $login, $tmp_user_pwd); require_once 'lib/phpmailer/class.phpmailer.php'; if ($email) { print " "; print T_sprintf("Notifying <b>%s</b>.", $email); require_once "lib/MiniTemplator.class.php"; $tpl = new MiniTemplator(); $tpl->readTemplateFromFile("templates/resetpass_template.txt"); $tpl->setVariable('LOGIN', $login); $tpl->setVariable('NEWPASS', $tmp_user_pwd); $tpl->addBlock('message'); $message = ""; $tpl->generateOutputToString($message); $mail = new PHPMailer(); $mail->PluginDir = "lib/phpmailer/"; $mail->SetLanguage("en", "lib/phpmailer/language/"); $mail->CharSet = "UTF-8"; $mail->From = SMTP_FROM_ADDRESS; $mail->FromName = SMTP_FROM_NAME; $mail->AddAddress($email, $login); if (SMTP_HOST) { $mail->Host = SMTP_HOST; $mail->Mailer = "smtp"; $mail->SMTPAuth = SMTP_LOGIN != ''; $mail->Username = SMTP_LOGIN; $mail->Password = SMTP_PASSWORD; } $mail->IsHTML(false); $mail->Subject = __("[tt-rss] Password change notification"); $mail->Body = $message; $rc = $mail->Send(); if (!$rc) { print_error($mail->ErrorInfo); } } print "</div>"; }
<!-- submitted by Annette Reid s3297925 Assignment 1 CPT375 --> <?php /* Initialise data for the search values on search.php*/ require_once 'config.php'; require_once DATA_PATH . 'MiniTemplator.class.php'; require_once DATA_PATH . 'answerHelper.php'; $resultsTable = new MiniTemplator(); $resultsTable->readTemplateFromFile("views/templates/results.htm"); $outputString = ''; $region_name = $_SESSION['region_name']; $grape_variety = $_SESSION['grape_variety']; $wine_name = escape($_SESSION['wine_name']); $winery_name = escape($_SESSION['winery_name']); $minCost = escape($_SESSION['minCost']); $maxCost = escape($_SESSION['maxCost']); $minInputYear = escape($_SESSION['minInputYear']); $maxInputYear = escape($_SESSION['maxInputYear']); $minStock = escape($_SESSION['minStock']); $minOrdered = escape($_SESSION['minOrdered']); global $handler; $query = buildInitialQuery(); if ($_SESSION['search'] == "") { $queryValues = searchQueryValues($query, $wine_name, $winery_name, $region_name, $grape_variety, $minCost, $maxCost, $minInputYear, $maxInputYear, $minStock, $minOrdered); $searchQuery = $handler->prepare($query); $searchQuery->execute($queryValues); while ($r = $searchQuery->fetch(PDO::FETCH_OBJ)) { global $resultsTable; $grapeVariety = getGrapeVariety($r->wineId, $handler); $totalWineSold = getTotalWIneSold($r->wineId, $handler);
<?php require_once "Templates/MiniTemplator.class.php"; $Content = new MiniTemplator(); $Content->readTemplateFromFile("Templates/LoginPageTemplate.htm"); $Content->generateOutput(); ?>
static function resetUserPassword($uid, $show_password) { $result = db_query("SELECT login,email\n\t\t\t\tFROM ttrss_users WHERE id = '{$uid}'"); $login = db_fetch_result($result, 0, "login"); $email = db_fetch_result($result, 0, "email"); $salt = db_fetch_result($result, 0, "salt"); $new_salt = substr(bin2hex(get_random_bytes(125)), 0, 250); $tmp_user_pwd = make_password(8); $pwd_hash = encrypt_password($tmp_user_pwd, $new_salt, true); db_query("UPDATE ttrss_users SET pwd_hash = '{$pwd_hash}', salt = '{$new_salt}', otp_enabled = false\n\t\t\t\tWHERE id = '{$uid}'"); if ($show_password) { print T_sprintf("Changed password of user <b>%s</b> to <b>%s</b>", $login, $tmp_user_pwd); } else { print_notice(T_sprintf("Sending new password of user <b>%s</b> to <b>%s</b>", $login, $email)); } require_once 'classes/ttrssmailer.php'; if ($email) { require_once "lib/MiniTemplator.class.php"; $tpl = new MiniTemplator(); $tpl->readTemplateFromFile("templates/resetpass_template.txt"); $tpl->setVariable('LOGIN', $login); $tpl->setVariable('NEWPASS', $tmp_user_pwd); $tpl->addBlock('message'); $message = ""; $tpl->generateOutputToString($message); $mail = new ttrssMailer(); $rc = $mail->quickMail($email, $login, __("[tt-rss] Password change notification"), $message, false); if (!$rc) { print_error($mail->ErrorInfo); } } }
private function generate_syndicated_feed($owner_uid, $feed, $is_cat, $limit, $offset, $search, $search_mode, $view_mode = false, $format = 'atom', $order = false, $orig_guid = false) { require_once "lib/MiniTemplator.class.php"; $note_style = "background-color : #fff7d5;\n\t\t\tborder-width : 1px; " . "padding : 5px; border-style : dashed; border-color : #e7d796;" . "margin-bottom : 1em; color : #9a8c59;"; if (!$limit) { $limit = 60; } $date_sort_field = "date_entered DESC, updated DESC"; if ($feed == -2) { $date_sort_field = "last_published DESC"; } else { if ($feed == -1) { $date_sort_field = "last_marked DESC"; } } switch ($order) { case "title": $date_sort_field = "ttrss_entries.title"; break; case "date_reverse": $date_sort_field = "date_entered, updated"; break; case "feed_dates": $date_sort_field = "updated DESC"; break; } $qfh_ret = queryFeedHeadlines($feed, 1, $view_mode, $is_cat, $search, $search_mode, $date_sort_field, $offset, $owner_uid, false, 0, false, true); $result = $qfh_ret[0]; if ($this->dbh->num_rows($result) != 0) { $ts = strtotime($this->dbh->fetch_result($result, 0, "date_entered")); if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $ts) { header('HTTP/1.0 304 Not Modified'); return; } $last_modified = gmdate("D, d M Y H:i:s", $ts) . " GMT"; header("Last-Modified: {$last_modified}", true); } $qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $is_cat, $search, $search_mode, $date_sort_field, $offset, $owner_uid, false, 0, false, true); $result = $qfh_ret[0]; $feed_title = htmlspecialchars($qfh_ret[1]); $feed_site_url = $qfh_ret[2]; $last_error = $qfh_ret[3]; $feed_self_url = get_self_url_prefix() . "/public.php?op=rss&id={$feed}&key=" . get_feed_access_key($feed, false, $owner_uid); if (!$feed_site_url) { $feed_site_url = get_self_url_prefix(); } if ($format == 'atom') { $tpl = new MiniTemplator(); $tpl->readTemplateFromFile("templates/generated_feed.txt"); $tpl->setVariable('FEED_TITLE', $feed_title, true); $tpl->setVariable('VERSION', VERSION, true); $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true); if (PUBSUBHUBBUB_HUB && $feed == -2) { $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true); $tpl->addBlock('feed_hub'); } $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true); $line["content_preview"] = truncate_string(strip_tags($line["content_preview"]), 100, '...'); while ($line = $this->dbh->fetch_assoc($result)) { foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { $line = $p->hook_query_headlines($line); } $tpl->setVariable('ARTICLE_ID', htmlspecialchars($orig_guid ? $line['link'] : get_self_url_prefix() . "/public.php?url=" . urlencode($line['link'])), true); $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true); $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true); $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true); $content = sanitize($line["content"], false, $owner_uid); if ($line['note']) { $content = "<div style=\"{$note_style}\">Article note: " . $line['note'] . "</div>" . $content; $tpl->setVariable('ARTICLE_NOTE', htmlspecialchars($line['note']), true); } $tpl->setVariable('ARTICLE_CONTENT', $content, true); $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', strtotime($line["updated"])), true); $tpl->setVariable('ARTICLE_UPDATED_RFC822', date(DATE_RFC822, strtotime($line["updated"])), true); $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true); $tpl->setVariable('ARTICLE_SOURCE_LINK', htmlspecialchars($line['site_url']), true); $tpl->setVariable('ARTICLE_SOURCE_TITLE', htmlspecialchars($line['feed_title']), true); $tags = get_article_tags($line["id"], $owner_uid); foreach ($tags as $tag) { $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true); $tpl->addBlock('category'); } $enclosures = get_article_enclosures($line["id"]); foreach ($enclosures as $e) { $type = htmlspecialchars($e['content_type']); $url = htmlspecialchars($e['content_url']); $length = $e['duration']; $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true); $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true); $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true); $tpl->addBlock('enclosure'); } $tpl->addBlock('entry'); } $tmp = ""; $tpl->addBlock('feed'); $tpl->generateOutputToString($tmp); if (@(!$_REQUEST["noxml"])) { header("Content-Type: text/xml; charset=utf-8"); } else { header("Content-Type: text/plain; charset=utf-8"); } print $tmp; } else { if ($format == 'json') { $feed = array(); $feed['title'] = $feed_title; $feed['version'] = VERSION; $feed['feed_url'] = $feed_self_url; if (PUBSUBHUBBUB_HUB && $feed == -2) { $feed['hub_url'] = PUBSUBHUBBUB_HUB; } $feed['self_url'] = get_self_url_prefix(); $feed['articles'] = array(); while ($line = $this->dbh->fetch_assoc($result)) { $line["content_preview"] = truncate_string(strip_tags($line["content_preview"]), 100, '...'); foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { $line = $p->hook_query_headlines($line, 100); } $article = array(); $article['id'] = $line['link']; $article['link'] = $line['link']; $article['title'] = $line['title']; $article['excerpt'] = $line["content_preview"]; $article['content'] = sanitize($line["content"], false, $owner_uid); $article['updated'] = date('c', strtotime($line["updated"])); if ($line['note']) { $article['note'] = $line['note']; } if ($article['author']) { $article['author'] = $line['author']; } $tags = get_article_tags($line["id"], $owner_uid); if (count($tags) > 0) { $article['tags'] = array(); foreach ($tags as $tag) { array_push($article['tags'], $tag); } } $enclosures = get_article_enclosures($line["id"]); if (count($enclosures) > 0) { $article['enclosures'] = array(); foreach ($enclosures as $e) { $type = $e['content_type']; $url = $e['content_url']; $length = $e['duration']; array_push($article['enclosures'], array("url" => $url, "type" => $type, "length" => $length)); } } array_push($feed['articles'], $article); } header("Content-Type: text/json; charset=utf-8"); print json_encode($feed); } else { header("Content-Type: text/plain; charset=utf-8"); print json_encode(array("error" => array("message" => "Unknown format"))); } } }
<?php session_start(); // Assignment 1 Web Database Appliactions // By Christopher Noble s3082661 // SP 2 2015 require_once "php/Template/MiniTemplator.class.php"; require_once "php/db.php"; $t = new MiniTemplator(); $ok = $t->readTemplateFromFile("html/search.html"); if (!$ok) { die("MiniTemplator.readTemplateFromFile failed."); } // Check for error messages. Should only occur when form has been submitted with incorrect input // and has been redirected back to search page with sessionerrors set. foreach ($_SESSION['formInputError'] as $key => $errMessage) { $t->setVariable($key, $errMessage); $t->setVariable("display{$key}", "has-error"); } // unset sessions so that input validation on form submit can start afresh session_unset(); try { // Try database connection using PDO, catch any errors $dsn = DB_ENGINE . ':host=' . DB_HOST . ';dbname=' . DB_NAME; $db = new PDO($dsn, DB_USER, DB_PW); // Query and forloop for wine region dropdown values $regionQuery = "select region_name from region"; foreach ($db->query($regionQuery) as $row) { $regionName = $row['region_name']; $t->setVariable("regionName", $regionName);
<?php session_start(); // start session to retreive searched database data // Assignment 1 Web Database Appliactions // By Christopher Noble s3082661 // SP 2 2015 require_once "php/Template/MiniTemplator.class.php"; //using mini templator as the template $t = new MiniTemplator(); $ok = $t->readTemplateFromFile("html/results.html"); if (!$ok) { die("MiniTemplator.readTemplateFromFile failed."); } $queryData = $_SESSION['Data']; //queryied database data from answers.php foreach ($queryData as $row) { // Get data from secific row $wineNane = $row['wine_name']; $regionName = $row['region_name']; $variety = $row['types']; $wineryName = $row['winery_name']; $cost = $row['GROUP_CONCAT(DISTINCT inventory.cost)']; $year = $row['year']; $onHand = $row['Current Stock']; $qtySold = $row['Sold']; $salesRev = $row['sum(items.price)']; // Set variables for use by template and results.html $t->setVariable("wineName", $wineNane); $t->setVariable("region", $regionName);
function module_pref_users($link) { global $access_level_names; if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) { print __("Your access level is insufficient to open this tab."); return; } $subop = $_REQUEST["subop"]; if ($subop == "user-details") { $uid = sprintf("%d", $_REQUEST["id"]); print "<div id=\"infoBoxTitle\">" . __('User details') . "</div>"; print "<div class='infoBoxContents'>"; $result = db_query($link, "SELECT login,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_login,1,16) AS last_login,\n\t\t\t\taccess_level,\n\t\t\t\t(SELECT COUNT(int_id) FROM ttrss_user_entries \n\t\t\t\t\tWHERE owner_uid = id) AS stored_articles,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(created,1,16) AS created\n\t\t\t\tFROM ttrss_users \n\t\t\t\tWHERE id = '{$uid}'"); if (db_num_rows($result) == 0) { print "<h1>" . __('User not found') . "</h1>"; return; } // print "<h1>User Details</h1>"; $login = db_fetch_result($result, 0, "login"); print "<table width='100%'>"; $last_login = date(get_pref($link, 'LONG_DATE_FORMAT'), strtotime(db_fetch_result($result, 0, "last_login"))); $created = date(get_pref($link, 'LONG_DATE_FORMAT'), strtotime(db_fetch_result($result, 0, "created"))); $access_level = db_fetch_result($result, 0, "access_level"); $stored_articles = db_fetch_result($result, 0, "stored_articles"); print "<tr><td>" . __('Registered') . "</td><td>{$created}</td></tr>"; print "<tr><td>" . __('Last logged in') . "</td><td>{$last_login}</td></tr>"; $result = db_query($link, "SELECT COUNT(id) as num_feeds FROM ttrss_feeds\n\t\t\t\tWHERE owner_uid = '{$uid}'"); $num_feeds = db_fetch_result($result, 0, "num_feeds"); print "<tr><td>" . __('Subscribed feeds count') . "</td><td>{$num_feeds}</td></tr>"; print "</table>"; print "<h1>" . __('Subscribed feeds') . "</h1>"; $result = db_query($link, "SELECT id,title,site_url FROM ttrss_feeds\n\t\t\t\tWHERE owner_uid = '{$uid}' ORDER BY title"); print "<ul class=\"userFeedList\">"; $row_class = "odd"; while ($line = db_fetch_assoc($result)) { $icon_file = ICONS_URL . "/" . $line["id"] . ".ico"; if (file_exists($icon_file) && filesize($icon_file) > 0) { $feed_icon = "<img class=\"tinyFeedIcon\" src=\"{$icon_file}\">"; } else { $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">"; } print "<li class=\"{$row_class}\">{$feed_icon} <a href=\"" . $line["site_url"] . "\">" . $line["title"] . "</a></li>"; $row_class = toggleEvenOdd($row_class); } if (db_num_rows($result) < $num_feeds) { // FIXME - add link to show ALL subscribed feeds here somewhere print "<li><img \n\t\t\t\t\tclass=\"tinyFeedIcon\" src=\"images/blank_icon.gif\"> ...</li>"; } print "</ul>"; print "<div align='center'>\n\t\t\t\t<button onclick=\"closeInfoBox()\">" . __("Close this window") . "</button></div>"; print "</div>"; return; } if ($subop == "edit") { $id = db_escape_string($_REQUEST["id"]); print "<div id=\"infoBoxTitle\">" . __('User Editor') . "</div>"; print "<div class=\"infoBoxContents\">"; print "<form id=\"user_edit_form\" onsubmit='return false'>"; print "<input type=\"hidden\" name=\"id\" value=\"{$id}\">"; print "<input type=\"hidden\" name=\"op\" value=\"pref-users\">"; print "<input type=\"hidden\" name=\"subop\" value=\"editSave\">"; $result = db_query($link, "SELECT * FROM ttrss_users WHERE id = '{$id}'"); $login = db_fetch_result($result, 0, "login"); $access_level = db_fetch_result($result, 0, "access_level"); $email = db_fetch_result($result, 0, "email"); $sel_disabled = $id == $_SESSION["uid"] ? "disabled" : ""; print "<div class=\"dlgSec\">" . __("User") . "</div>"; print "<div class=\"dlgSecCont\">"; if ($sel_disabled) { print "<input type=\"hidden\" name=\"login\" value=\"{$login}\">"; print "<input size=\"30\" style=\"font-size : 16px\" \n\t\t\t\t\tonkeypress=\"return filterCR(event, userEditSave)\" {$sel_disabled}\n\t\t\t\t\tvalue=\"{$login}\">"; } else { print "<input size=\"30\" style=\"font-size : 16px\" \n\t\t\t\t\tonkeypress=\"return filterCR(event, userEditSave)\" {$sel_disabled}\n\t\t\t\t\tname=\"login\" value=\"{$login}\">"; } print "</div>"; print "<div class=\"dlgSec\">" . __("Authentication") . "</div>"; print "<div class=\"dlgSecCont\">"; print __('Access level: ') . " "; if (!$sel_disabled) { print_select_hash("access_level", $access_level, $access_level_names, $sel_disabled); } else { print_select_hash("", $access_level, $access_level_names, $sel_disabled); print "<input type=\"hidden\" name=\"access_level\" value=\"{$access_level}\">"; } print "<br/>"; print __('Change password to') . " <input size=\"20\" onkeypress=\"return filterCR(event, userEditSave)\"\n\t\t\t\tname=\"password\">"; print "</div>"; print "<div class=\"dlgSec\">" . __("Options") . "</div>"; print "<div class=\"dlgSecCont\">"; print __('E-mail: ') . " <input size=\"30\" name=\"email\" onkeypress=\"return filterCR(event, userEditSave)\"\n\t\t\t\tvalue=\"{$email}\">"; print "</div>"; print "</table>"; print "</form>"; print "<div class=\"dlgButtons\">\n\t\t\t\t<button onclick=\"return userEditSave()\">" . __('Save') . "</button>\n\t\t\t\t<button onclick=\"return userEditCancel()\">" . __('Cancel') . "</button></div>"; print "</div>"; return; } if ($subop == "editSave") { if (!WEB_DEMO_MODE && $_SESSION["access_level"] >= 10) { $login = db_escape_string(trim($_REQUEST["login"])); $uid = db_escape_string($_REQUEST["id"]); $access_level = (int) $_REQUEST["access_level"]; $email = db_escape_string(trim($_REQUEST["email"])); $password = db_escape_string(trim($_REQUEST["password"])); if ($password) { $pwd_hash = encrypt_password($password, $login); $pass_query_part = "pwd_hash = '{$pwd_hash}', "; print_notice(T_sprintf('Changed password of user <b>%s</b>.', $login)); } else { $pass_query_part = ""; } db_query($link, "UPDATE ttrss_users SET {$pass_query_part} login = '******', \n\t\t\t\t\taccess_level = '{$access_level}', email = '{$email}' WHERE id = '{$uid}'"); } } else { if ($subop == "remove") { if ($_SESSION["access_level"] >= 10) { $ids = split(",", db_escape_string($_REQUEST["ids"])); foreach ($ids as $id) { if ($id != $_SESSION["uid"]) { db_query($link, "DELETE FROM ttrss_tags WHERE owner_uid = '{$id}'"); db_query($link, "DELETE FROM ttrss_feeds WHERE owner_uid = '{$id}'"); db_query($link, "DELETE FROM ttrss_users WHERE id = '{$id}'"); } } } } else { if ($subop == "add") { if ($_SESSION["access_level"] >= 10) { $login = db_escape_string(trim($_REQUEST["login"])); $tmp_user_pwd = make_password(8); $pwd_hash = encrypt_password($tmp_user_pwd, $login); $result = db_query($link, "SELECT id FROM ttrss_users WHERE \n\t\t\t\t\tlogin = '******'"); if (db_num_rows($result) == 0) { db_query($link, "INSERT INTO ttrss_users \n\t\t\t\t\t\t(login,pwd_hash,access_level,last_login,created)\n\t\t\t\t\t\tVALUES ('{$login}', '{$pwd_hash}', 0, null, NOW())"); $result = db_query($link, "SELECT id FROM ttrss_users WHERE \n\t\t\t\t\t\tlogin = '******' AND pwd_hash = '{$pwd_hash}'"); if (db_num_rows($result) == 1) { $new_uid = db_fetch_result($result, 0, "id"); print_notice(T_sprintf("Added user <b>%s</b> with password <b>%s</b>", $login, $tmp_user_pwd)); initialize_user($link, $new_uid); } else { print_warning(T_sprintf("Could not create user <b>%s</b>", $login)); } } else { print_warning(T_sprintf("User <b>%s</b> already exists.", $login)); } } } else { if ($subop == "resetPass") { if (!WEB_DEMO_MODE && $_SESSION["access_level"] >= 10) { $uid = db_escape_string($_REQUEST["id"]); $result = db_query($link, "SELECT login,email \n\t\t\t\t\tFROM ttrss_users WHERE id = '{$uid}'"); $login = db_fetch_result($result, 0, "login"); $email = db_fetch_result($result, 0, "email"); $tmp_user_pwd = make_password(8); $pwd_hash = encrypt_password($tmp_user_pwd, $login); db_query($link, "UPDATE ttrss_users SET pwd_hash = '{$pwd_hash}'\n\t\t\t\t\tWHERE id = '{$uid}'"); print_notice(T_sprintf("Changed password of user <b>%s</b>\n\t\t\t\t\t to <b>%s</b>", $login, $tmp_user_pwd)); if ($email) { print_notice(T_sprintf("Notifying <b>%s</b>.", $email)); require_once "lib/MiniTemplator.class.php"; $tpl = new MiniTemplator(); $tpl->readTemplateFromFile("templates/resetpass_template.txt"); $tpl->setVariable('LOGIN', $login); $tpl->setVariable('NEWPASS', $tmp_user_pwd); $tpl->addBlock('message'); $message = ""; $tpl->generateOutputToString($message); $mail = new PHPMailer(); $mail->PluginDir = "lib/phpmailer/"; $mail->SetLanguage("en", "lib/phpmailer/language/"); $mail->CharSet = "UTF-8"; $mail->From = DIGEST_FROM_ADDRESS; $mail->FromName = DIGEST_FROM_NAME; $mail->AddAddress($email, $login); if (DIGEST_SMTP_HOST) { $mail->Host = DIGEST_SMTP_HOST; $mail->Mailer = "smtp"; $mail->SMTPAuth = DIGEST_SMTP_LOGIN != ''; $mail->Username = DIGEST_SMTP_LOGIN; $mail->Password = DIGEST_SMTP_PASSWORD; } $mail->IsHTML(false); $mail->Subject = __("[tt-rss] Password change notification"); $mail->Body = $message; $rc = $mail->Send(); if (!$rc) { print_error($mail->ErrorInfo); } /* mail("$login <$email>", "Password reset notification", "Hi, $login.\n". "\n". "Your password for this TT-RSS installation was reset by". " an administrator.\n". "\n". "Your new password is $tmp_user_pwd, please remember". " it for later reference.\n". "\n". "Sincerely, TT-RSS Mail Daemon.", "From: " . MAIL_FROM); */ } print "</div>"; } } } } } set_pref($link, "_PREFS_ACTIVE_TAB", "userConfig"); $user_search = db_escape_string($_REQUEST["search"]); if (array_key_exists("search", $_REQUEST)) { $_SESSION["prefs_user_search"] = $user_search; } else { $user_search = $_SESSION["prefs_user_search"]; } print "<div style='float : right'>\n\t\t\t<input id=\"user_search\" size=\"20\" type=\"search\"\n\t\t\t\tonfocus=\"javascript:disableHotkeys();\" \n\t\t\t\tonblur=\"javascript:enableHotkeys();\"\n\t\t\t\tonchange=\"javascript:updateUsersList()\" value=\"{$user_search}\">\n\t\t\t<button onclick=\"javascript:updateUsersList()\">" . __('Search') . "</button>\n\t\t\t</div>"; $sort = db_escape_string($_REQUEST["sort"]); if (!$sort || $sort == "undefined") { $sort = "login"; } print "<button onclick=\"javascript:addUser()\">" . __('Create user') . "</button>"; print "\n\t\t\t<button onclick=\"javascript:selectedUserDetails()\">" . __('Details') . "</button>\n\t\t\t<button onclick=\"javascript:editSelectedUser()\">" . __('Edit') . "</button>\n\t\t\t<button onclick=\"javascript:removeSelectedUsers()\">" . __('Remove') . "</button>\n\t\t\t<button onclick=\"javascript:resetSelectedUserPass()\">" . __('Reset password') . "</button>"; print "</div>"; if ($user_search) { $user_search = split(" ", $user_search); $tokens = array(); foreach ($user_search as $token) { $token = trim($token); array_push($tokens, "(UPPER(login) LIKE UPPER('%{$token}%'))"); } $user_search_query = "(" . join($tokens, " AND ") . ") AND "; } else { $user_search_query = ""; } $result = db_query($link, "SELECT \n\t\t\t\tid,login,access_level,email,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_login,1,16) as last_login,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(created,1,16) as created\n\t\t\tFROM \n\t\t\t\tttrss_users\n\t\t\tWHERE\n\t\t\t\t{$user_search_query}\n\t\t\t\tid > 0\n\t\t\tORDER BY {$sort}"); if (db_num_rows($result) > 0) { // print "<div id=\"infoBoxShadow\"><div id=\"infoBox\">PLACEHOLDER</div></div>"; print "<p><table width=\"100%\" cellspacing=\"0\" \n\t\t\tclass=\"prefUserList\" id=\"prefUserList\">"; print "<tr><td class=\"selectPrompt\" colspan=\"8\">\n\t\t\t\t" . __('Select:') . " \n\t\t\t\t\t<a href=\"javascript:selectPrefRows('user', true)\">" . __('All') . "</a>,\n\t\t\t\t\t<a href=\"javascript:selectPrefRows('user', false)\">" . __('None') . "</a>\n\t\t\t\t</td</tr>"; print "<tr class=\"title\">\n\t\t\t\t\t<td align='center' width=\"5%\"> </td>\n\t\t\t\t\t<td width=''><a href=\"javascript:updateUsersList('login')\">" . __('Login') . "</a></td>\n\t\t\t\t\t<td width='20%'><a href=\"javascript:updateUsersList('access_level')\">" . __('Access Level') . "</a></td>\n\t\t\t\t\t<td width='20%'><a href=\"javascript:updateUsersList('created')\">" . __('Registered') . "</a></td>\n\t\t\t\t\t<td width='20%'><a href=\"javascript:updateUsersList('last_login')\">" . __('Last login') . "</a></td></tr>"; $lnum = 0; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $uid = $line["id"]; $edit_uid = $_REQUEST["id"]; if ($subop == "edit" && $uid != $edit_uid) { $class .= "Grayed"; $this_row_id = ""; } else { $this_row_id = "id=\"UMRR-{$uid}\""; } print "<tr class=\"{$class}\" {$this_row_id}>"; $line["login"] = htmlspecialchars($line["login"]); # $line["last_login"] = date(get_pref($link, 'SHORT_DATE_FORMAT'), # strtotime($line["last_login"])); if (get_pref($link, 'HEADLINES_SMART_DATE')) { $line["last_login"] = smart_date_time(strtotime($line["last_login"])); $line["created"] = smart_date_time(strtotime($line["created"])); } else { $line["last_login"] = date(get_pref($link, 'SHORT_DATE_FORMAT'), strtotime($line["last_login"])); $line["created"] = date(get_pref($link, 'SHORT_DATE_FORMAT'), strtotime($line["created"])); } print "<td align='center'><input onclick='toggleSelectPrefRow(this, \"user\");' \n\t\t\t\ttype=\"checkbox\" id=\"UMCHK-{$uid}\"></td>"; $onclick = "onclick='editUser({$uid})' title='" . __('Click to edit') . "'"; print "<td {$onclick}>" . $line["login"] . "</td>"; if (!$line["email"]) { $line["email"] = " "; } print "<td {$onclick}>" . $access_level_names[$line["access_level"]] . "</td>"; print "<td {$onclick}>" . $line["created"] . "</td>"; print "<td {$onclick}>" . $line["last_login"] . "</td>"; print "</tr>"; ++$lnum; } print "</table>"; } else { print "<p>"; if (!$user_search) { print_warning(__('No users defined.')); } else { print_warning(__('No matching users found.')); } print "</p>"; } }
<!-- submitted by Annette Reid s3297925 Assignment 1 CPT375 --> <?php /* initialising drop down lists for year range selection */ require_once DATA_PATH . 'initialData.php'; $wineYears = new MiniTemplator(); $wineYears->readTemplateFromFile(YEARS_TEMPLATE); while ($r = $wine_years->fetch(PDO::FETCH_OBJ)) { $wineYears->setVariable("minYear", $r->minYear); $wineYears->setVariable("maxYear", $r->maxYear); $wineYears->addBlock("block1"); }
private function generate_syndicated_feed($owner_uid, $feed, $is_cat, $limit, $search, $search_mode, $match_on, $view_mode = false) { require_once "lib/MiniTemplator.class.php"; $note_style = "background-color : #fff7d5;\n\t\t\tborder-width : 1px; " . "padding : 5px; border-style : dashed; border-color : #e7d796;" . "margin-bottom : 1em; color : #9a8c59;"; if (!$limit) { $limit = 30; } if (get_pref($this->link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) { $date_sort_field = "updated"; } else { $date_sort_field = "date_entered"; } $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $is_cat, $search, $search_mode, $match_on, "{$date_sort_field} DESC", 0, $owner_uid); $result = $qfh_ret[0]; $feed_title = htmlspecialchars($qfh_ret[1]); $feed_site_url = $qfh_ret[2]; $last_error = $qfh_ret[3]; $feed_self_url = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($this->link, -2, false, $owner_uid); if (!$feed_site_url) { $feed_site_url = get_self_url_prefix(); } $tpl = new MiniTemplator(); $tpl->readTemplateFromFile("templates/generated_feed.txt"); $tpl->setVariable('FEED_TITLE', $feed_title, true); $tpl->setVariable('VERSION', VERSION, true); $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true); if (PUBSUBHUBBUB_HUB && $feed == -2) { $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true); $tpl->addBlock('feed_hub'); } $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true); while ($line = db_fetch_assoc($result)) { $tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true); $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true); $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true); $tpl->setVariable('ARTICLE_EXCERPT', truncate_string(strip_tags($line["content_preview"]), 100, '...'), true); $content = sanitize($this->link, $line["content_preview"], false, $owner_uid); if ($line['note']) { $content = "<div style=\"{$note_style}\">Article note: " . $line['note'] . "</div>" . $content; } $tpl->setVariable('ARTICLE_CONTENT', $content, true); $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', strtotime($line["updated"])), true); $tpl->setVariable('ARTICLE_UPDATED_RFC822', date(DATE_RFC822, strtotime($line["updated"])), true); $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true); $tags = get_article_tags($this->link, $line["id"], $owner_uid); foreach ($tags as $tag) { $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true); $tpl->addBlock('category'); } $enclosures = get_article_enclosures($this->link, $line["id"]); foreach ($enclosures as $e) { $type = htmlspecialchars($e['content_type']); $url = htmlspecialchars($e['content_url']); $length = $e['duration']; $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true); $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true); $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true); $tpl->addBlock('enclosure'); } $tpl->addBlock('entry'); } $tmp = ""; $tpl->addBlock('feed'); $tpl->generateOutputToString($tmp); print $tmp; }
<!-- submitted by Annette Reid s3297925 Assignment 1 CPT375 --> <?php /* initiating wine name list for search box in search.php*/ require_once DATA_PATH . 'initialData.php'; $regionNames = new MiniTemplator(); $regionNames->readTemplateFromFile(REGION_TEMPLATE); while ($r = $region_name->fetch(PDO::FETCH_OBJ)) { $regionNames->setVariable("regionName", $r->region_name); $regionNames->addBlock("block1"); }
<?php session_start(); require_once "Templates/MiniTemplator.class.php"; $t = new MiniTemplator(); $t->readTemplateFromFile("Templates/RegisterPageTemplate.htm"); $t->setVariable("Error", $_SESSION["Error"]); $t->addBlock("Error"); $t->generateOutput(); ?>
header("Location: LoginPage.php"); } if ($_SESSION["ActiveUserTypeID"] == 3) { $_SESSION['MessageHead'] = "Oops only Approved Members can access this page!"; $_SESSION['MessageBody'] = "Your membership is currently pending. Please contact an Administrator if you have been waiting longer than 1 day for approval."; $_SESSION['RedirectTo'] = "Home.php"; header("Location: MessagePage.php"); } if ($_SESSION["ActiveUserTypeID"] != 1) { $_SESSION['MessageHead'] = "Oops only Administrators can access this page!"; $_SESSION['MessageBody'] = "If you believe you require Administrator access please contact a current Administrator. Allow us to redirect you!"; $_SESSION['RedirectTo'] = "LoginHome.php"; header("Location: MessagePage.php"); } $t = new MiniTemplator(); $t->readTemplateFromFile("Templates/MembersTemplate.htm"); $pdo = new PDO('mysql:host=localhost;dbname=Apptous', 'root', 'password'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Create base query. $query = 'SELECT UserID, UserUserName, UserTypeDescription from User, UserType where User.UserTypeID = UserType.UserTypeID and User.UserTypeID != 1'; $result = $pdo->prepare($query); $result->execute(); // store query in an array $MyArray = $result->fetchAll(); foreach ($MyArray as $key => $row) { $t->setVariable("UserID", $row['UserID']); $t->setVariable("UserUserName", $row['UserUserName']); $t->setVariable("UserTypeDescription", $row['UserTypeDescription']); $t->addBlock("TableRow"); } $query = 'SELECT * from UserType';
<?php session_start(); require_once "Templates/MiniTemplator.class.php"; $Content = new MiniTemplator(); $Content->readTemplateFromFile("Templates/MessagePageTemplate.htm"); $Content->setVariable("MessageHead", $_SESSION['MessageHead']); $Content->setVariable("MessageBody", $_SESSION['MessageBody']); $Content->addBlock("Message"); $Content->generateOutput(); unset($_SESSION['MessageHead']); unset($_SESSION['MessageBody']); // wait 10 seconds and redirect :) echo sprintf("<meta http-equiv=\"refresh\" content=\"5;url=%s\"/>", $_SESSION['RedirectTo']); ?>
<?php require_once "Templates/MiniTemplator.class.php"; $Content = new MiniTemplator(); $Content->readTemplateFromFile("Templates/HomeTemplate.htm"); $Content->generateOutput(); ?>
<?php session_start(); if (!isset($_SESSION["ActiveUserID"])) { header("Location: LoginPage.php"); } if ($_SESSION["ActiveUserTypeID"] == 3) { $_SESSION['MessageHead'] = "Oops only Approved Members can access this page!"; $_SESSION['MessageBody'] = "Your membership is currently pending. Please contact an Administrator if you have been waiting longer than 1 day for approval."; $_SESSION['RedirectTo'] = "Home.php"; header("Location: MessagePage.php"); } require_once "Templates/MiniTemplator.class.php"; $t = new MiniTemplator(); $t->readTemplateFromFile("Templates/LoginHomeTemplate.htm"); $pdo = new PDO('mysql:host=localhost;dbname=Apptous', 'root', 'password'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Create base query. $query = 'SELECT ApplicationID, ApplicationData, ApplicationDate, ApplicationStatusDescription FROM Application, ApplicationStatus where Application.ApplicationStatusID = ApplicationStatus.ApplicationStatusID ORDER BY ApplicationDate Desc'; $result = $pdo->prepare($query); $result->execute(); // store query in an array $MyArray = $result->fetchAll(); foreach ($MyArray as $key => $row) { $ApplicationData = unserialize($row['ApplicationData']); $t->setVariable("ApplicationID", $row['ApplicationID']); $t->setVariable("ApplicationStatus", $row['ApplicationStatusDescription']); $t->setVariable("Character", $ApplicationData['Character']); $t->setVariable("Armoury", $ApplicationData['Armoury']);
function create_page() { global $_CAMILA; require_once CAMILA_LIB_DIR . 'xml-2-pdf/Xml2Pdf.php'; require_once CAMILA_LIB_DIR . 'minitemplator/MiniTemplator.class.php'; $xmlfile = CAMILA_TMPL_DIR . '/' . $_CAMILA['lang'] . '/' . $_REQUEST['camila_xml2pdf']; $xml = ''; $t = new MiniTemplator(); $t->readTemplateFromFile($xmlfile); if ($_REQUEST['camila_xml2pdf_checklist_options_0'] != 'y') { $format = camila_get_locale_date_adodb_format(); $text = date($format); $t->setVariable(camila_get_translation('camila.export.template.date'), isUTF8($text) ? utf8_decode($text) : $text, true); $text = date($format . ' H:i'); $t->setVariable(camila_get_translation('camila.export.template.timestamp'), isUTF8($text) ? utf8_decode($text) : $text, true); } $i = 0; while (isset($this->element[$i])) { $page_element = $this->element[$i]; switch ($page_element->get_elementtype()) { case HAW_FORM: $i = 0; while (isset($page_element->element[$i])) { $form_element = $page_element->element[$i]; $form_fieldname = substr($form_element->name, strlen($_CAMILA['datagrid_form']->name) + 1); $form_label = $_CAMILA['datagrid_form']->fields[$form_fieldname]->title; switch ($form_element->get_elementtype()) { //case HAW_IMAGE: //case HAW_RADIO: //case HAW_RULE: case HAW_HIDDEN: case HAW_INPUT: case HAW_TEXTAREA: $text = html_entity_decode($form_element->value); for ($ii = 0; $ii < $form_element->br - 1; $ii++) { $text .= "\n"; } $t->setVariable($form_element->label, isUTF8($text) ? utf8_decode($text) : $text, true); $t->setVariable($form_label, isUTF8($text) ? utf8_decode($text) : $text, true); break; case HAW_SELECT: foreach ($form_element->options as $key => $value) { if ($value['value'] == $form_element->value) { $text = $value['label']; } } $text = html_entity_decode($text); $t->setVariable($form_element->label, isUTF8($text) ? utf8_decode($text) : $text, true); $t->setVariable($form_label, isUTF8($text) ? utf8_decode($text) : $text, true); break; case HAW_CHECKBOX: if (!$form_element->is_checked()) { break; } //$text = html_entity_decode($form_element->label); $nl = 1; if ($form_element->br > 0) { $nl = $form_element->br; } for ($ii = 0; $ii < $nl; $ii++) { $text .= "\n"; } $t->setVariable($form_element->name, isUTF8($text) ? utf8_decode($text) : $text, true); $t->setVariable($form_label, isUTF8($text) ? utf8_decode($text) : $text, true); break; case HAW_PLAINTEXT: break; } $i++; } $t->addBlock('form'); break; case HAW_PLAINTEXT: if ($this->element[$i]->text == camila_get_translation('camila.nodatafound') && $_CAMILA['datagrid_nodata'] == 1) { $rowsperpage = 0; if ($t->blockExists('row1')) { $rowsperpage = 1; while ($t->blockExists('row' . ($rowsperpage + 1))) { $rowsperpage++; } if ($rowsperpage > 0) { for ($ii = 0; $ii < $rowsperpage; $ii++) { $t->addBlock('row' . ($ii + 1)); } $t->addBlock('table'); } } } break; case HAW_LINK: $link = $this->element[$i]; for ($ii = 0; $ii < $link->br; $ii++) { $suffix .= "\n"; } //$this->pdf_text(isUTF8($link->label) ? utf8_decode($link->label).$suffix : $link->label.$suffix); break; case HAW_TABLE: $table = $this->element[$i]; $cols = array(); $rowsperpage = 0; $rownum = 1; $pagnum = 1; $multitable = false; if ($t->blockExists('row1')) { $multitable = true; $rowsperpage = 1; while ($t->blockExists('row' . ($rowsperpage + 1))) { $rowsperpage++; } } if ($_REQUEST['camila_xml2pdf_checklist_options_0'] != 'y') { $row = $table->row[0]; for ($b = 0; $b < $row->number_of_columns; $b++) { $column = $row->column[$b]; $cols[$b] = strtolower($column->text); } $t->setVariable(camila_get_translation('camila.xml2pdf.table.totalrows'), intval($table->number_of_rows) - 1); for ($a = 1; $a < $table->number_of_rows; $a++) { $row = $table->row[$a]; for ($b = 0; $b < $row->number_of_columns; $b++) { $column = $row->column[$b]; if (is_object($column) && $column->get_elementtype() == HAW_PLAINTEXT) { $text = $column->get_text(); } if (is_object($column) && $column->get_elementtype() == HAW_LINK) { $text = $column->get_label(); } $t->setVariable($cols[$b], isUTF8($text) ? utf8_decode($text) : $text, true); $t->setVariable(camila_get_translation('camila.xml2pdf.table.row.num'), $a); } if (!$multitable) { $t->addBlock('row'); } else { $t->addBlock('row' . $rownum); } $rownum++; if ($rownum > $rowsperpage) { $rownum = 1; $pagnum++; $t->addBlock('table'); } } if (!$multitable || $rownum > 1 && $rownum <= $rowsperpage || $multitable && $pagnum == 1) { $t->addBlock('table'); } } else { if ($rowsperpage > 0) { for ($ii = 0; $ii < $rowsperpage; $ii++) { $t->addBlock('row' . ($ii + 1)); } $t->addBlock('table'); } } $a = 1; $row = $table->row[$a]; for ($b = 0; $b < $row->number_of_columns; $b++) { $column = $row->column[$b]; if (is_object($column) && $column->get_elementtype() == HAW_PLAINTEXT) { $text = $column->get_text(); } if (is_object($column) && $column->get_elementtype() == HAW_LINK) { $text = $column->get_label(); } $t->setVariable($cols[$b], isUTF8($text) ? utf8_decode($text) : $text, true); $t->setVariable(camila_get_translation('camila.xml2pdf.table.row.num'), $a); } break; } $i++; } $t->generateOutputToString($xml); $obj = new Xml2Pdf($xml); $pdf = $obj->render(); $pdf->Output($this->title . '.pdf', 'D'); }
function forgotpass() { startup_gettext(); @($hash = $_REQUEST["hash"]); header('Content-Type: text/html; charset=utf-8'); print "<html><head><title>Tiny Tiny RSS</title>\n\t\t<link rel=\"shortcut icon\" type=\"image/png\" href=\"images/favicon.png\">\n\t\t<link rel=\"icon\" type=\"image/png\" sizes=\"72x72\" href=\"images/favicon-72px.png\">"; echo stylesheet_tag("css/utility.css"); echo javascript_tag("lib/prototype.js"); print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n\t\t\t</head><body id='forgotpass'>"; print '<div class="floatingLogo"><img src="images/logo_small.png"></div>'; print "<h1>" . __("Password recovery") . "</h1>"; print "<div class='content'>"; @($method = $_POST['method']); if ($hash) { $login = $_REQUEST["login"]; if ($login) { $result = $this->dbh->query("SELECT id, resetpass_token FROM ttrss_users\n\t\t\t\t\tWHERE login = '******'"); if ($this->dbh->num_rows($result) != 0) { $id = $this->dbh->fetch_result($result, 0, "id"); $resetpass_token_full = $this->dbh->fetch_result($result, 0, "resetpass_token"); list($timestamp, $resetpass_token) = explode(":", $resetpass_token_full); if ($timestamp && $resetpass_token && $timestamp >= time() - 15 * 60 * 60 && $resetpass_token == $hash) { $result = $this->dbh->query("UPDATE ttrss_users SET resetpass_token = NULL\n\t\t\t\t\t\t\t\tWHERE id = {$id}"); Pref_Users::resetUserPassword($id, true); print "<p>" . "Completed." . "</p>"; } else { print_error("Some of the information provided is missing or incorrect."); } } else { print_error("Some of the information provided is missing or incorrect."); } } else { print_error("Some of the information provided is missing or incorrect."); } print "<form method=\"GET\" action=\"index.php\">\n\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t</form>"; } else { if (!$method) { print_notice(__("You will need to provide valid account name and email. A password reset link will be sent to your email address.")); print "<form method='POST' action='public.php'>"; print "<input type='hidden' name='method' value='do'>"; print "<input type='hidden' name='op' value='forgotpass'>"; print "<fieldset>"; print "<label>" . __("Login:"******"</label>"; print "<input type='text' name='login' value='' required>"; print "</fieldset>"; print "<fieldset>"; print "<label>" . __("Email:") . "</label>"; print "<input type='email' name='email' value='' required>"; print "</fieldset>"; print "<fieldset>"; print "<label>" . __("How much is two plus two:") . "</label>"; print "<input type='text' name='test' value='' required>"; print "</fieldset>"; print "<p/>"; print "<button type='submit'>" . __("Reset password") . "</button>"; print "</form>"; } else { if ($method == 'do') { $login = $this->dbh->escape_string($_POST["login"]); $email = $this->dbh->escape_string($_POST["email"]); $test = $this->dbh->escape_string($_POST["test"]); if ($test != 4 && $test != 'four' || !$email || !$login) { print_error(__('Some of the required form parameters are missing or incorrect.')); print "<form method=\"GET\" action=\"public.php\">\n\t\t\t\t\t<input type=\"hidden\" name=\"op\" value=\"forgotpass\">\n\t\t\t\t\t<input type=\"submit\" value=\"" . __("Go back") . "\">\n\t\t\t\t\t</form>"; } else { print_notice("Password reset instructions are being sent to your email address."); $result = $this->dbh->query("SELECT id FROM ttrss_users\n\t\t\t\t\tWHERE login = '******' AND email = '{$email}'"); if ($this->dbh->num_rows($result) != 0) { $id = $this->dbh->fetch_result($result, 0, "id"); if ($id) { $resetpass_token = sha1(get_random_bytes(128)); $resetpass_link = get_self_url_prefix() . "/public.php?op=forgotpass&hash=" . $resetpass_token . "&login="******"lib/MiniTemplator.class.php"; $tpl = new MiniTemplator(); $tpl->readTemplateFromFile("templates/resetpass_link_template.txt"); $tpl->setVariable('LOGIN', $login); $tpl->setVariable('RESETPASS_LINK', $resetpass_link); $tpl->addBlock('message'); $message = ""; $tpl->generateOutputToString($message); $mail = new ttrssMailer(); $rc = $mail->quickMail($email, $login, __("[tt-rss] Password reset request"), $message, false); if (!$rc) { print_error($mail->ErrorInfo); } $resetpass_token_full = $this->dbh->escape_string(time() . ":" . $resetpass_token); $result = $this->dbh->query("UPDATE ttrss_users\n\t\t\t\t\t\t\tSET resetpass_token = '{$resetpass_token_full}'\n\t\t\t\t\t\t\tWHERE login = '******' AND email = '{$email}'"); //Pref_Users::resetUserPassword($id, false); print "<p>"; print "<p>" . "Completed." . "</p>"; } else { print_error("User ID not found."); } print "<form method=\"GET\" action=\"index.php\">\n\t\t\t\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t\t\t\t</form>"; } else { print_error(__("Sorry, login and email combination not found.")); print "<form method=\"GET\" action=\"public.php\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"op\" value=\"forgotpass\">\n\t\t\t\t\t\t<input type=\"submit\" value=\"" . __("Go back") . "\">\n\t\t\t\t\t\t</form>"; } } } } } print "</div>"; print "</body>"; print "</html>"; }
private function generate_syndicated_feed($owner_uid, $feed, $is_cat, $limit, $offset, $search, $search_mode, $match_on, $view_mode = false, $format = 'atom') { require_once "lib/MiniTemplator.class.php"; $note_style = "background-color : #fff7d5;\n\t\t\tborder-width : 1px; " . "padding : 5px; border-style : dashed; border-color : #e7d796;" . "margin-bottom : 1em; color : #9a8c59;"; if (!$limit) { $limit = 100; } if (get_pref($this->link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) { $date_sort_field = "updated"; } else { $date_sort_field = "date_entered"; } if ($feed == -2) { $date_sort_field = "last_read"; } $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $is_cat, $search, $search_mode, $match_on, "{$date_sort_field} DESC", $offset, $owner_uid, false, 0, false, true); $result = $qfh_ret[0]; $feed_title = htmlspecialchars($qfh_ret[1]); $feed_site_url = $qfh_ret[2]; $last_error = $qfh_ret[3]; $feed_self_url = get_self_url_prefix() . "/public.php?op=rss&id=-2&key=" . get_feed_access_key($this->link, -2, false, $owner_uid); if (!$feed_site_url) { $feed_site_url = get_self_url_prefix(); } if ($format == 'atom') { $tpl = new MiniTemplator(); $tpl->readTemplateFromFile("templates/generated_feed.txt"); $tpl->setVariable('FEED_TITLE', $feed_title, true); $tpl->setVariable('VERSION', VERSION, true); $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true); if (PUBSUBHUBBUB_HUB && $feed == -2) { $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true); $tpl->addBlock('feed_hub'); } $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true); while ($line = db_fetch_assoc($result)) { $tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true); $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true); $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true); $tpl->setVariable('ARTICLE_EXCERPT', truncate_string(strip_tags($line["content_preview"]), 100, '...'), true); $content = sanitize($this->link, $line["content_preview"], false, $owner_uid); if ($line['note']) { $content = "<div style=\"{$note_style}\">Article note: " . $line['note'] . "</div>" . $content; } $tpl->setVariable('ARTICLE_CONTENT', $content, true); $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', strtotime($line["updated"])), true); $tpl->setVariable('ARTICLE_UPDATED_RFC822', date(DATE_RFC822, strtotime($line["updated"])), true); $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true); $tags = get_article_tags($this->link, $line["id"], $owner_uid); foreach ($tags as $tag) { $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true); $tpl->addBlock('category'); } $enclosures = get_article_enclosures($this->link, $line["id"]); foreach ($enclosures as $e) { $type = htmlspecialchars($e['content_type']); $url = htmlspecialchars($e['content_url']); $length = $e['duration']; $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true); $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true); $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true); $tpl->addBlock('enclosure'); } $tpl->addBlock('entry'); } $tmp = ""; $tpl->addBlock('feed'); $tpl->generateOutputToString($tmp); if (@(!$_REQUEST["noxml"])) { header("Content-Type: text/xml; charset=utf-8"); } else { header("Content-Type: text/plain; charset=utf-8"); } print $tmp; } else { if ($format == 'json') { $feed = array(); $feed['title'] = $feed_title; $feed['version'] = VERSION; $feed['feed_url'] = $feed_self_url; if (PUBSUBHUBBUB_HUB && $feed == -2) { $feed['hub_url'] = PUBSUBHUBBUB_HUB; } $feed['self_url'] = get_self_url_prefix(); $feed['articles'] = array(); while ($line = db_fetch_assoc($result)) { $article = array(); $article['id'] = $line['link']; $article['link'] = $line['link']; $article['title'] = $line['title']; $article['excerpt'] = truncate_string(strip_tags($line["content_preview"]), 100, '...'); $article['content'] = sanitize($this->link, $line["content_preview"], false, $owner_uid); $article['updated'] = date('c', strtotime($line["updated"])); if ($line['note']) { $article['note'] = $line['note']; } if ($article['author']) { $article['author'] = $line['author']; } $tags = get_article_tags($this->link, $line["id"], $owner_uid); if (count($tags) > 0) { $article['tags'] = array(); foreach ($tags as $tag) { array_push($article['tags'], $tag); } } $enclosures = get_article_enclosures($this->link, $line["id"]); if (count($enclosures) > 0) { $article['enclosures'] = array(); foreach ($enclosures as $e) { $type = $e['content_type']; $url = $e['content_url']; $length = $e['duration']; array_push($article['enclosures'], array("url" => $url, "type" => $type, "length" => $length)); } } array_push($feed['articles'], $article); } header("Content-Type: text/json; charset=utf-8"); print json_encode($feed); } else { header("Content-Type: text/plain; charset=utf-8"); print json_encode(array("error" => array("message" => "Unknown format"))); } } }
function prepare_headlines_digest($link, $user_id, $days = 1, $limit = 1000) { require_once "lib/MiniTemplator.class.php"; $tpl = new MiniTemplator(); $tpl_t = new MiniTemplator(); $tpl->readTemplateFromFile("templates/digest_template_html.txt"); $tpl_t->readTemplateFromFile("templates/digest_template.txt"); $user_tz_string = get_pref($link, 'USER_TIMEZONE', $user_id); $local_ts = convert_timestamp(time(), 'UTC', $user_tz_string); $tpl->setVariable('CUR_DATE', date('Y/m/d', $local_ts)); $tpl->setVariable('CUR_TIME', date('G:i', $local_ts)); $tpl_t->setVariable('CUR_DATE', date('Y/m/d', $local_ts)); $tpl_t->setVariable('CUR_TIME', date('G:i', $local_ts)); $affected_ids = array(); if (DB_TYPE == "pgsql") { $interval_query = "ttrss_entries.date_updated > NOW() - INTERVAL '{$days} days'"; } else { if (DB_TYPE == "mysql") { $interval_query = "ttrss_entries.date_updated > DATE_SUB(NOW(), INTERVAL {$days} DAY)"; } } $result = db_query($link, "SELECT ttrss_entries.title,\n\t\t\t\tttrss_feeds.title AS feed_title,\n\t\t\t\tCOALESCE(ttrss_feed_categories.title, '" . __('Uncategorized') . "') AS cat_title,\n\t\t\t\tdate_updated,\n\t\t\t\tttrss_user_entries.ref_id,\n\t\t\t\tlink,\n\t\t\t\tscore,\n\t\t\t\tcontent,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\tFROM\n\t\t\t\tttrss_user_entries,ttrss_entries,ttrss_feeds\n\t\t\tLEFT JOIN\n\t\t\t\tttrss_feed_categories ON (cat_id = ttrss_feed_categories.id)\n\t\t\tWHERE\n\t\t\t\tref_id = ttrss_entries.id AND feed_id = ttrss_feeds.id\n\t\t\t\tAND include_in_digest = true\n\t\t\t\tAND {$interval_query}\n\t\t\t\tAND ttrss_user_entries.owner_uid = {$user_id}\n\t\t\t\tAND unread = true\n\t\t\t\tAND score >= 0\n\t\t\tORDER BY ttrss_feed_categories.title, ttrss_feeds.title, score DESC, date_updated DESC\n\t\t\tLIMIT {$limit}"); $cur_feed_title = ""; $headlines_count = db_num_rows($result); $headlines = array(); while ($line = db_fetch_assoc($result)) { array_push($headlines, $line); } for ($i = 0; $i < sizeof($headlines); $i++) { $line = $headlines[$i]; array_push($affected_ids, $line["ref_id"]); $updated = make_local_datetime($link, $line['last_updated'], false, $user_id); /* if ($line["score"] != 0) { if ($line["score"] > 0) $line["score"] = '+' . $line["score"]; $line["title"] .= " (".$line['score'].")"; } */ if (get_pref($link, 'ENABLE_FEED_CATS', $user_id)) { $line['feed_title'] = $line['cat_title'] . " / " . $line['feed_title']; } $tpl->setVariable('FEED_TITLE', $line["feed_title"]); $tpl->setVariable('ARTICLE_TITLE', $line["title"]); $tpl->setVariable('ARTICLE_LINK', $line["link"]); $tpl->setVariable('ARTICLE_UPDATED', $updated); $tpl->setVariable('ARTICLE_EXCERPT', truncate_string(strip_tags($line["content"]), 300)); // $tpl->setVariable('ARTICLE_CONTENT', // strip_tags($article_content)); $tpl->addBlock('article'); $tpl_t->setVariable('FEED_TITLE', $line["feed_title"]); $tpl_t->setVariable('ARTICLE_TITLE', $line["title"]); $tpl_t->setVariable('ARTICLE_LINK', $line["link"]); $tpl_t->setVariable('ARTICLE_UPDATED', $updated); // $tpl_t->setVariable('ARTICLE_EXCERPT', // truncate_string(strip_tags($line["excerpt"]), 100)); $tpl_t->addBlock('article'); if ($headlines[$i]['feed_title'] != $headlines[$i + 1]['feed_title']) { $tpl->addBlock('feed'); $tpl_t->addBlock('feed'); } } $tpl->addBlock('digest'); $tpl->generateOutputToString($tmp); $tpl_t->addBlock('digest'); $tpl_t->generateOutputToString($tmp_t); return array($tmp, $headlines_count, $affected_ids, $tmp_t); }
function prepare_headlines_digest($link, $user_id, $days = 1, $limit = 100) { require_once "lib/MiniTemplator.class.php"; $tpl = new MiniTemplator(); $tpl_t = new MiniTemplator(); $tpl->readTemplateFromFile("templates/digest_template_html.txt"); $tpl_t->readTemplateFromFile("templates/digest_template.txt"); $tpl->setVariable('CUR_DATE', date('Y/m/d')); $tpl->setVariable('CUR_TIME', date('G:i')); $tpl_t->setVariable('CUR_DATE', date('Y/m/d')); $tpl_t->setVariable('CUR_TIME', date('G:i')); $affected_ids = array(); if (DB_TYPE == "pgsql") { $interval_query = "ttrss_entries.date_entered > NOW() - INTERVAL '{$days} days'"; } else { if (DB_TYPE == "mysql") { $interval_query = "ttrss_entries.date_entered > DATE_SUB(NOW(), INTERVAL {$days} DAY)"; } } $result = db_query($link, "SELECT ttrss_entries.title,\n\t\t\t\tttrss_feeds.title AS feed_title,\n\t\t\t\tdate_entered,\n\t\t\t\tttrss_user_entries.ref_id,\n\t\t\t\tlink,\n\t\t\t\tSUBSTRING(content, 1, 120) AS excerpt,\n\t\t\t\t" . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated\n\t\t\tFROM \n\t\t\t\tttrss_user_entries,ttrss_entries,ttrss_feeds \n\t\t\tWHERE \n\t\t\t\tref_id = ttrss_entries.id AND feed_id = ttrss_feeds.id \n\t\t\t\tAND include_in_digest = true\n\t\t\t\tAND {$interval_query}\n\t\t\t\tAND ttrss_user_entries.owner_uid = {$user_id}\n\t\t\t\tAND unread = true \n\t\t\tORDER BY ttrss_feeds.title, date_entered DESC\n\t\t\tLIMIT {$limit}"); $cur_feed_title = ""; $headlines_count = db_num_rows($result); $headlines = array(); while ($line = db_fetch_assoc($result)) { array_push($headlines, $line); } for ($i = 0; $i < sizeof($headlines); $i++) { $line = $headlines[$i]; array_push($affected_ids, $line["ref_id"]); $updated = smart_date_time(strtotime($line["last_updated"])); $tpl->setVariable('FEED_TITLE', $line["feed_title"]); $tpl->setVariable('ARTICLE_TITLE', $line["title"]); $tpl->setVariable('ARTICLE_LINK', $line["link"]); $tpl->setVariable('ARTICLE_UPDATED', $updated); $tpl->setVariable('ARTICLE_EXCERPT', truncate_string(strip_tags($line["excerpt"]), 100)); $tpl->addBlock('article'); $tpl_t->setVariable('FEED_TITLE', $line["feed_title"]); $tpl_t->setVariable('ARTICLE_TITLE', $line["title"]); $tpl_t->setVariable('ARTICLE_LINK', $line["link"]); $tpl_t->setVariable('ARTICLE_UPDATED', $updated); // $tpl_t->setVariable('ARTICLE_EXCERPT', // truncate_string(strip_tags($line["excerpt"]), 100)); $tpl_t->addBlock('article'); if ($headlines[$i]['feed_title'] != $headlines[$i + 1]['feed_title']) { $tpl->addBlock('feed'); $tpl_t->addBlock('feed'); } } $tpl->addBlock('digest'); $tpl->generateOutputToString($tmp); $tpl_t->addBlock('digest'); $tpl_t->generateOutputToString($tmp_t); return array($tmp, $headlines_count, $affected_ids, $tmp_t); }
<!-- submitted by Annette Reid s3297925 Assignment 1 CPT375 --> <?php /* initialising grape_variety for drop down list */ require_once DATA_PATH . 'initialData.php'; $grapeVarieties = new MiniTemplator(); $grapeVarieties->readTemplateFromFile(GRAPE_VARIETY_TEMPLATE); while ($r = $grape_variety->fetch(PDO::FETCH_OBJ)) { $grapeVarieties->setVariable("grapeName", $r->variety); $grapeVarieties->addBlock("block2"); }
function emailArticle() { $param = db_escape_string($_REQUEST['param']); $secretkey = sha1(uniqid(rand(), true)); $_SESSION['email_secretkey'] = $secretkey; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"secretkey\" value=\"{$secretkey}\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"mail\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"sendEmail\">"; $result = db_query($this->link, "SELECT email, full_name FROM ttrss_users WHERE\n\t\t\tid = " . $_SESSION["uid"]); $user_email = htmlspecialchars(db_fetch_result($result, 0, "email")); $user_name = htmlspecialchars(db_fetch_result($result, 0, "full_name")); if (!$user_name) { $user_name = $_SESSION['name']; } $_SESSION['email_replyto'] = $user_email; $_SESSION['email_fromname'] = $user_name; require_once "lib/MiniTemplator.class.php"; $tpl = new MiniTemplator(); $tpl_t = new MiniTemplator(); $tpl->readTemplateFromFile("templates/email_article_template.txt"); $tpl->setVariable('USER_NAME', $_SESSION["name"]); $tpl->setVariable('USER_EMAIL', $user_email); $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"]); $result = db_query($this->link, "SELECT link, content, title\n\t\t\tFROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND\n\t\t\tid IN ({$param}) AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) > 1) { $subject = __("[Forwarded]") . " " . __("Multiple articles"); } while ($line = db_fetch_assoc($result)) { if (!$subject) { $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); } $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"])); $tpl->addBlock('article'); } $tpl->addBlock('email'); $content = ""; $tpl->generateOutputToString($content); print "<table width='100%'><tr><td>"; print __('From:'); print "</td><td>"; print "<input dojoType=\"dijit.form.TextBox\" disabled=\"1\" style=\"width : 30em;\"\n\t\t\t\tvalue=\"{$user_name} <{$user_email}>\">"; print "</td></tr><tr><td>"; print __('To:'); print "</td><td>"; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"\n\t\t\t\tstyle=\"width : 30em;\"\n\t\t\t\tname=\"destination\" id=\"emailArticleDlg_destination\">"; print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\"\n\t\t\t\tstyle=\"z-index: 30; display : none\"></div>"; print "</td></tr><tr><td>"; print __('Subject:'); print "</td><td>"; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"\n\t\t\t\tstyle=\"width : 30em;\"\n\t\t\t\tname=\"subject\" value=\"{$subject}\" id=\"subject\">"; print "</td></tr>"; print "<tr><td colspan='2'><textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 100%' rows=\"20\"\n\t\t\tname='content'>{$content}</textarea>"; print "</td></tr></table>"; print "<div class='dlgButtons'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').execute()\">" . __('Send e-mail') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; //return; }
function module_popup_dialog($link) { $id = $_REQUEST["id"]; $param = db_escape_string($_REQUEST["param"]); print "<dlg id=\"{$id}\">"; if ($id == "importOpml") { print "<div class=\"prefFeedOPMLHolder\">"; header("Content-Type: text/html"); # required for iframe $owner_uid = $_SESSION["uid"]; db_query($link, "BEGIN"); /* create Imported feeds category just in case */ $result = db_query($link, "SELECT id FROM\n\t\t\t\tttrss_feed_categories WHERE title = 'Imported feeds' AND\n\t\t\t\towner_uid = '{$owner_uid}' LIMIT 1"); if (db_num_rows($result) == 0) { db_query($link, "INSERT INTO ttrss_feed_categories\n\t\t\t\t\t(title,owner_uid)\n\t\t\t\t\t\tVALUES ('Imported feeds', '{$owner_uid}')"); } db_query($link, "COMMIT"); /* Handle OPML import by DOMXML/DOMDocument */ if (function_exists('domxml_open_file')) { print "<ul class='nomarks'>"; print "<li>" . __("Importing using DOMXML.") . "</li>"; require_once "opml_domxml.php"; opml_import_domxml($link, $owner_uid); print "</ul>"; } else { if (PHP_VERSION >= 5) { print "<ul class='nomarks'>"; print "<li>" . __("Importing using DOMDocument.") . "</li>"; require_once "opml_domdoc.php"; opml_import_domdoc($link, $owner_uid); print "</ul>"; } else { print_error(__("DOMXML extension is not found. It is required for PHP versions below 5.")); } } print "</div>"; print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('opmlImportDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; print "</div>"; //return; } if ($id == "editPrefProfiles") { print "<div dojoType=\"dijit.Toolbar\">"; # TODO: depends on selectTableRows() being broken for this list # print "<div dojoType=\"dijit.form.DropDownButton\">". # "<span>" . __('Select')."</span>"; # print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">"; # print "<div onclick=\"selectTableRows('prefFeedProfileList', 'all')\" # dojoType=\"dijit.MenuItem\">".__('All')."</div>"; # print "<div onclick=\"selectTableRows('prefFeedProfileList', 'none')\" # dojoType=\"dijit.MenuItem\">".__('None')."</div>"; # print "</div></div>"; # print "<div style='float : right'>"; print "<input name=\"newprofile\" dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\trequired=\"1\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('profileEditDlg').addProfile()\">" . __('Create profile') . "</button></div>"; # print "</div>"; $result = db_query($link, "SELECT title,id FROM ttrss_settings_profiles\n\t\t\t\tWHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY title"); print "<div class=\"prefFeedCatHolder\">"; print "<form id=\"profile_edit_form\" onsubmit=\"return false\">"; print "<table width=\"100%\" class=\"prefFeedProfileList\"\n\t\t\t\tcellspacing=\"0\" id=\"prefFeedProfileList\">"; print "<tr class=\"\" id=\"FCATR-0\">"; #odd print "<td width='5%' align='center'><input\n\t\t\t\tonclick='toggleSelectRow2(this);'\n\t\t\t\tdojoType=\"dijit.form.CheckBox\"\n\t\t\t\ttype=\"checkbox\"></td>"; if (!$_SESSION["profile"]) { $is_active = __("(active)"); } else { $is_active = ""; } print "<td><span>" . __("Default profile") . " {$is_active}</span></td>"; print "</tr>"; $lnum = 1; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $profile_id = $line["id"]; $this_row_id = "id=\"FCATR-{$profile_id}\""; print "<tr class=\"\" {$this_row_id}>"; $edit_title = htmlspecialchars($line["title"]); print "<td width='5%' align='center'><input\n\t\t\t\t\tonclick='toggleSelectRow2(this);'\n\t\t\t\t\tdojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\ttype=\"checkbox\"></td>"; if ($_SESSION["profile"] == $line["id"]) { $is_active = __("(active)"); } else { $is_active = ""; } print "<td><span dojoType=\"dijit.InlineEditBox\"\n\t\t\t\t\twidth=\"300px\" autoSave=\"false\"\n\t\t\t\t\tprofile-id=\"{$profile_id}\">" . $edit_title . "<script type=\"dojo/method\" event=\"onChange\" args=\"item\">\n\t\t\t\t\t\tvar elem = this;\n\t\t\t\t\t\tdojo.xhrPost({\n\t\t\t\t\t\t\turl: 'backend.php',\n\t\t\t\t\t\t\tcontent: {op: 'rpc', subop: 'saveprofile',\n\t\t\t\t\t\t\t\tvalue: this.value,\n\t\t\t\t\t\t\t\tid: this.srcNodeRef.getAttribute('profile-id')},\n\t\t\t\t\t\t\t\tload: function(response) {\n\t\t\t\t\t\t\t\t\telem.attr('value', response);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\t\t</span> {$is_active}</td>"; print "</tr>"; ++$lnum; } print "</table>"; print "</form>"; print "</div>"; print "<div class='dlgButtons'>\n\t\t\t\t<div style='float : left'>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">" . __('Remove selected profiles') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').activateProfile()\">" . __('Activate profile') . "</button>\n\t\t\t\t</div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; } if ($id == "pubOPMLUrl") { print "<title>" . __('Public OPML URL') . "</title>"; print "<content><![CDATA["; $url_path = opml_publish_url($link); print __("Your Public OPML URL is:"); print "<div class=\"tagCloudContainer\">"; print "<a id='pub_opml_url' href='{$url_path}' target='_blank'>{$url_path}</a>"; print "</div>"; print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">" . __('Generate new URL') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "]]></content>"; //return; } if ($id == "explainError") { print "<title>" . __('Notice') . "</title>"; print "<content><![CDATA["; print "<div class=\"errorExplained\">"; if ($param == 1) { print __("Update daemon is enabled in configuration, but daemon process is not running, which prevents all feeds from updating. Please start the daemon process or contact instance owner."); $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); } if ($param == 3) { print __("Update daemon is taking too long to perform a feed update. This could indicate a problem like crash or a hang. Please check the daemon process or contact instance owner."); $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); } print "</div>"; print "<div align='center'>"; print "<button onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "]]></content>"; //return; } if ($id == "quickAddFeed") { print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"addfeed\">"; print "<div class=\"dlgSec\">" . __("Feed") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input style=\"font-size : 16px; width : 20em;\"\n\t\t\t\tplaceHolder=\"" . __("Feed URL") . "\"\n\t\t\t\tdojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"feed\" id=\"feedDlg_feedUrl\">"; print "<hr/>"; if (get_pref($link, 'ENABLE_FEED_CATS')) { print __('Place in category:') . " "; print_feed_cat_select($link, "cat", false, 'dojoType="dijit.form.Select"'); } print "</div>"; print '<div id="feedDlg_feedsContainer" style="display : none"> <div class="dlgSec">' . __('Available feeds') . '</div> <div class="dlgSecCont">' . '<select id="feedDlg_feedContainerSelect" dojoType="dijit.form.Select" size="3"> <script type="dojo/method" event="onChange" args="value"> dijit.byId("feedDlg_feedUrl").attr("value", value); </script> </select>' . '</div></div>'; print "<div id='feedDlg_loginContainer' style='display : none'>\n\n\t\t\t\t\t<div class=\"dlgSec\">" . __("Authentication") . "</div>\n\t\t\t\t\t<div class=\"dlgSecCont\">" . " <input dojoType=\"dijit.form.TextBox\" name='login'\"\n\t\t\t\t\t\tplaceHolder=\"" . __("Login") . "\"\n\t\t\t\t\t\tstyle=\"width : 10em;\"> " . " <input\n\t\t\t\t\t\tplaceHolder=\"" . __("Password") . "\"\n\t\t\t\t\t\tdojoType=\"dijit.form.TextBox\" type='password'\n\t\t\t\t\t\tstyle=\"width : 10em;\" name='pass'\">\n\t\t\t\t</div></div>"; print "<div style=\"clear : both\">\n\t\t\t\t<input type=\"checkbox\" dojoType=\"dijit.form.CheckBox\" id=\"feedDlg_loginCheck\"\n\t\t\t\t\t\tonclick='checkboxToggleElement(this, \"feedDlg_loginContainer\")'>\n\t\t\t\t\t<label for=\"feedDlg_loginCheck\">" . __('This feed requires authentication.') . "</div>"; print "</form>"; print "<div class=\"dlgButtons\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').execute()\">" . __('Subscribe') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return feedBrowser()\">" . __('More feeds') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedAddDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t\t</div>"; //return; } if ($id == "feedBrowser") { $browser_search = db_escape_string($_REQUEST["search"]); # print "<form onsubmit='return false;' display='inline' # name='feed_browser' id='feed_browser'>"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"updateFeedBrowser\">"; print "<div dojoType=\"dijit.Toolbar\">\n\t\t\t\t<div style='float : right'>\n\t\t\t\t<img style='display : none'\n\t\t\t\t\tid='feed_browser_spinner' src='" . theme_image($link, 'images/indicator_white.gif') . "'>\n\t\t\t\t<input name=\"search\" dojoType=\"dijit.form.TextBox\" size=\"20\" type=\"search\"\n\t\t\t\t\tonchange=\"dijit.byId('feedBrowserDlg').update()\" value=\"{$browser_search}\">\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').update()\">" . __('Search') . "</button>\n\t\t\t</div>"; print " <select name=\"mode\" dojoType=\"dijit.form.Select\" onchange=\"dijit.byId('feedBrowserDlg').update()\">\n\t\t\t\t<option value='1'>" . __('Popular feeds') . "</option>\n\t\t\t\t<option value='2'>" . __('Feed archive') . "</option>\n\t\t\t\t</select> "; print __("limit:"); print " <select dojoType=\"dijit.form.Select\" name=\"limit\" onchange=\"dijit.byId('feedBrowserDlg').update()\">"; foreach (array(25, 50, 100, 200) as $l) { $issel = $l == $limit ? "selected=\"1\"" : ""; print "<option {$issel} value=\"{$l}\">{$l}</option>"; } print "</select> "; print "</div>"; $owner_uid = $_SESSION["uid"]; print "<ul class='browseFeedList' id='browseFeedList'>"; print make_feed_browser($link, $search, 25); print "</ul>"; print "<div align='center'>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').execute()\">" . __('Subscribe') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" style='display : none' id='feed_archive_remove' onclick=\"dijit.byId('feedBrowserDlg').removeFromArchive()\">" . __('Remove') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('feedBrowserDlg').hide()\" >" . __('Cancel') . "</button></div>"; } if ($id == "search") { $params = explode(":", db_escape_string($_REQUEST["param"]), 2); $active_feed_id = sprintf("%d", $params[0]); $is_cat = $params[1] != "false"; print "<div class=\"dlgSec\">" . __('Look for') . "</div>"; print "<div class=\"dlgSecCont\">"; if (!SPHINX_ENABLED) { print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\tstyle=\"font-size : 16px; width : 12em;\"\n\t\t\t\t\trequired=\"1\" name=\"query\" type=\"search\" value=''>"; print " " . __('match on') . " "; $search_fields = array("title" => __("Title"), "content" => __("Content"), "both" => __("Title or content")); print_select_hash("match_on", 3, $search_fields, 'dojoType="dijit.form.Select"'); } else { print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t\tstyle=\"font-size : 16px; width : 20em;\"\n\t\t\t\t\trequired=\"1\" name=\"query\" type=\"search\" value=''>"; } print "<hr/>" . __('Limit search to:') . " "; print "<select name=\"search_mode\" dojoType=\"dijit.form.Select\">\n\t\t\t\t<option value=\"all_feeds\">" . __('All feeds') . "</option>"; $feed_title = getFeedTitle($link, $active_feed_id); if (!$is_cat) { $feed_cat_title = getFeedCatTitle($link, $active_feed_id); } else { $feed_cat_title = getCategoryTitle($link, $active_feed_id); } if ($active_feed_id && !$is_cat) { print "<option selected=\"1\" value=\"this_feed\">{$feed_title}</option>"; } else { print "<option disabled=\"1\" value=\"false\">" . __('This feed') . "</option>"; } if ($is_cat) { $cat_preselected = "selected=\"1\""; } if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { print "<option {$cat_preselected} value=\"this_cat\">{$feed_cat_title}</option>"; } else { //print "<option disabled>".__('This category')."</option>"; } print "</select>"; print "</div>"; print "<div class=\"dlgButtons\">"; if (!SPHINX_ENABLED) { print "<div style=\"float : left\">\n\t\t\t\t\t<a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/redmine/wiki/tt-rss/SearchSyntax\">Search syntax</a>\n\t\t\t\t\t</div>"; } print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">" . __('Search') . "</button>\n\t\t\t<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">" . __('Cancel') . "</button>\n\t\t\t</div>"; } if ($id == "quickAddFilter") { $active_feed_id = db_escape_string($_REQUEST["param"]); print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"quiet\" value=\"1\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"add\">"; $result = db_query($link, "SELECT id,description\n\t\t\t\tFROM ttrss_filter_types ORDER BY description"); $filter_types = array(); while ($line = db_fetch_assoc($result)) { //array_push($filter_types, $line["description"]); $filter_types[$line["id"]] = __($line["description"]); } print "<div class=\"dlgSec\">" . __("Match") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<span id=\"filterDlg_dateModBox\" style=\"display : none\">"; $filter_params = array("before" => __("before"), "after" => __("after")); print_select_hash("filter_date_modifier", "before", $filter_params, 'dojoType="dijit.form.Select"'); print " </span>"; print "<input dojoType=\"dijit.form.ValidationTextBox\"\n\t\t\t\t required=\"true\" id=\"filterDlg_regExp\"\n\t\t\t\t style=\"font-size : 16px\"\n\t\t\t\t name=\"reg_exp\" value=\"{$reg_exp}\"/>"; print "<span id=\"filterDlg_dateChkBox\" style=\"display : none\">"; print " <button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return filterDlgCheckDate()\">" . __('Check it') . "</button>"; print "</span>"; print "<hr/>" . __("on field") . " "; print_select_hash("filter_type", 1, $filter_types, 'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"'); print "<hr/>"; print __("in") . " "; print_feed_select($link, "feed_id", $active_feed_id, 'dojoType="dijit.form.FilteringSelect"'); print "</div>"; print "<div class=\"dlgSec\">" . __("Perform Action") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<select name=\"action_id\" dojoType=\"dijit.form.Select\"\n\t\t\t\tonchange=\"filterDlgCheckAction(this)\">"; $result = db_query($link, "SELECT id,description FROM ttrss_filter_actions\n\t\t\t\tORDER BY name"); while ($line = db_fetch_assoc($result)) { printf("<option value='%d'>%s</option>", $line["id"], __($line["description"])); } print "</select>"; print "<span id=\"filterDlg_paramBox\" style=\"display : none\">"; print " " . __("with parameters:") . " "; print "<input dojoType=\"dijit.form.TextBox\"\n\t\t\t\tid=\"filterDlg_actionParam\"\n\t\t\t\tname=\"action_param\">"; print_label_select($link, "action_param_label", $action_param, 'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"'); print "</span>"; print " "; // tiny layout hack print "</div>"; print "<div class=\"dlgSec\">" . __("Options") . "</div>"; print "<div class=\"dlgSecCont\">"; print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" checked=\"1\">\n\t\t\t\t\t<label for=\"enabled\">" . __('Enabled') . "</label><hr/>"; print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\">\n\t\t\t\t<label for=\"inverse\">" . __('Inverse match') . "</label>"; print "</div>"; print "<div class=\"dlgButtons\">"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').test()\">" . __('Test') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">" . __('Create') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; //return; } if ($id == "inactiveFeeds") { if (DB_TYPE == "pgsql") { $interval_qpart = "NOW() - INTERVAL '3 months'"; } else { $interval_qpart = "DATE_SUB(NOW(), INTERVAL 3 MONTH)"; } $result = db_query($link, "SELECT ttrss_feeds.title, ttrss_feeds.site_url,\n\t\t\t \t\tttrss_feeds.feed_url, ttrss_feeds.id, MAX(updated) AS last_article\n\t\t\t\tFROM ttrss_feeds, ttrss_entries, ttrss_user_entries WHERE\n\t\t\t\t\t(SELECT MAX(updated) FROM ttrss_entries, ttrss_user_entries WHERE\n\t\t\t\t\t\tttrss_entries.id = ref_id AND\n\t\t\t\t\t\t\tttrss_user_entries.feed_id = ttrss_feeds.id) < {$interval_qpart}\n\t\t\t\tAND ttrss_feeds.owner_uid = " . $_SESSION["uid"] . " AND\n\t\t\t\t\tttrss_user_entries.feed_id = ttrss_feeds.id AND\n\t\t\t\t\tttrss_entries.id = ref_id\n\t\t\t\tGROUP BY ttrss_feeds.title, ttrss_feeds.id, ttrss_feeds.site_url, ttrss_feeds.feed_url\n\t\t\t\tORDER BY last_article"); print __("These feeds have not been updated with new content for 3 months (oldest first):"); print "<div class=\"inactiveFeedHolder\">"; print "<table width=\"100%\" cellspacing=\"0\" id=\"prefInactiveFeedList\">"; $lnum = 1; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $feed_id = $line["id"]; $this_row_id = "id=\"FUPDD-{$feed_id}\""; print "<tr class=\"\" {$this_row_id}>"; $edit_title = htmlspecialchars($line["title"]); print "<td width='5%' align='center'><input\n\t\t\t\t\tonclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\ttype=\"checkbox\"></td>"; print "<td>"; print "<a class=\"visibleLink\" href=\"#\" " . "title=\"" . __("Click to edit feed") . "\" " . "onclick=\"editFeed(" . $line["id"] . ")\">" . htmlspecialchars($line["title"]) . "</a>"; print "</td><td class=\"insensitive\" align='right'>"; print make_local_datetime($link, $line['last_article'], false); print "</td>"; print "</tr>"; ++$lnum; } print "</table>"; print "</div>"; print "<div class='dlgButtons'>"; print "<div style='float : left'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').removeSelected()\">" . __('Unsubscribe from selected feeds') . "</button> "; print "</div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('inactiveFeedsDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; } if ($id == "feedsWithErrors") { # print "<title>".__('Feeds with update errors')."</title>"; # print "<content><![CDATA["; print __("These feeds have not been updated because of errors:"); $result = db_query($link, "SELECT id,title,feed_url,last_error,site_url\n\t\t\tFROM ttrss_feeds WHERE last_error != '' AND owner_uid = " . $_SESSION["uid"]); print "<div class=\"inactiveFeedHolder\">"; print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">"; $lnum = 1; while ($line = db_fetch_assoc($result)) { $class = $lnum % 2 ? "even" : "odd"; $feed_id = $line["id"]; $this_row_id = "id=\"FUPDD-{$feed_id}\""; print "<tr class=\"\" {$this_row_id}>"; $edit_title = htmlspecialchars($line["title"]); print "<td width='5%' align='center'><input\n\t\t\t\t\tonclick='toggleSelectRow2(this);' dojoType=\"dijit.form.CheckBox\"\n\t\t\t\t\ttype=\"checkbox\"></td>"; print "<td>"; print "<a class=\"visibleLink\" href=\"#\" " . "title=\"" . __("Click to edit feed") . "\" " . "onclick=\"editFeed(" . $line["id"] . ")\">" . htmlspecialchars($line["title"]) . "</a>: "; print "<span class=\"insensitive\">"; print htmlspecialchars($line["last_error"]); print "</span>"; print "</td>"; print "</tr>"; ++$lnum; } print "</table>"; print "</div>"; print "<div class='dlgButtons'>"; print "<div style='float : left'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').removeSelected()\">" . __('Unsubscribe from selected feeds') . "</button> "; print "</div>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; } if ($id == "editArticleTags") { # print "<form id=\"tag_edit_form\" onsubmit='return false'>"; print __("Tags for this article (separated by commas):") . "<br>"; $tags = get_article_tags($link, $param); $tags_str = join(", ", $tags); print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"{$param}\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"setArticleTags\">"; print "<table width='100%'><tr><td>"; print "<textarea dojoType=\"dijit.form.SimpleTextarea\" rows='4'\n\t\t\t\tstyle='font-size : 12px; width : 100%' id=\"tags_str\"\n\t\t\t\tname='tags_str'>{$tags_str}</textarea>\n\t\t\t<div class=\"autocomplete\" id=\"tags_choices\"\n\t\t\t\t\tstyle=\"display:none\"></div>"; print "</td></tr></table>"; # print "</form>"; print "<div class='dlgButtons'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('editTagsDlg').execute()\">" . __('Save') . "</button> "; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('editTagsDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; } if ($id == "printTagCloud") { print "<title>" . __('Tag Cloud') . "</title>"; print "<content><![CDATA["; # print __("Showing most popular tags ")." (<a # href='javascript:toggleTags(true)'>".__('more tags')."</a>):<br/>"; print "<div class=\"tagCloudContainer\">"; printTagCloud($link); print "</div>"; print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "]]></content>"; } if ($id == 'printTagSelect') { print "<title>" . __('Select item(s) by tags') . "</title>"; print "<content><![CDATA["; print __("Match:") . " " . "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" checked value=\"any\" name=\"tag_mode\"> Any "; print "<input class=\"noborder\" dojoType=\"dijit.form.RadioButton\" type=\"radio\" value=\"all\" name=\"tag_mode\"> All "; print " tags."; print "<select id=\"all_tags\" name=\"all_tags\" title=\"" . __('Which Tags?') . "\" multiple=\"multiple\" size=\"10\" style=\"width : 100%\">"; $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags WHERE owner_uid = " . $_SESSION['uid'] . "\n\t\t\t\tAND LENGTH(tag_name) <= 30 ORDER BY tag_name ASC"); while ($row = db_fetch_assoc($result)) { $tmp = htmlspecialchars($row["tag_name"]); print "<option value=\"" . str_replace(" ", "%20", $tmp) . "\">{$tmp}</option>"; } print "</select>"; print "<div align='right'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"viewfeed(get_all_tags(\$('all_tags')),\n\t\t\t\tget_radio_checked(\$('tag_mode')));\">" . __('Display entries') . "</button>"; print " "; print "<button dojoType=\"dijit.form.Button\"\n\t\t\tonclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "]]></content>"; } if ($id == "emailArticle") { $secretkey = sha1(uniqid(rand(), true)); $_SESSION['email_secretkey'] = $secretkey; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"secretkey\" value=\"{$secretkey}\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"sendEmail\">"; $result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE\n\t\t\t\tid = " . $_SESSION["uid"]); $user_email = htmlspecialchars(db_fetch_result($result, 0, "email")); $user_name = htmlspecialchars(db_fetch_result($result, 0, "full_name")); if (!$user_name) { $user_name = $_SESSION['name']; } $_SESSION['email_replyto'] = $user_email; $_SESSION['email_fromname'] = $user_name; require_once "lib/MiniTemplator.class.php"; $tpl = new MiniTemplator(); $tpl_t = new MiniTemplator(); $tpl->readTemplateFromFile("templates/email_article_template.txt"); $tpl->setVariable('USER_NAME', $_SESSION["name"]); $tpl->setVariable('USER_EMAIL', $user_email); $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"]); // $tpl->addBlock('header'); $result = db_query($link, "SELECT link, content, title\n\t\t\t\tFROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND\n\t\t\t\tid IN ({$param}) AND owner_uid = " . $_SESSION["uid"]); if (db_num_rows($result) > 1) { $subject = __("[Forwarded]") . " " . __("Multiple articles"); } while ($line = db_fetch_assoc($result)) { if (!$subject) { $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]); } $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"])); $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"])); $tpl->addBlock('article'); } $tpl->addBlock('email'); $content = ""; $tpl->generateOutputToString($content); print "<table width='100%'><tr><td>"; print __('From:'); print "</td><td>"; print "<input dojoType=\"dijit.form.TextBox\" disabled=\"1\" style=\"width : 30em;\"\n\t\t\t\t\tvalue=\"{$user_name} <{$user_email}>\">"; print "</td></tr><tr><td>"; print __('To:'); print "</td><td>"; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"\n\t\t\t\t\tstyle=\"width : 30em;\"\n\t\t\t\t\tname=\"destination\" id=\"emailArticleDlg_destination\">"; print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\"\n\t\t\t\t\tstyle=\"z-index: 30; display : none\"></div>"; print "</td></tr><tr><td>"; print __('Subject:'); print "</td><td>"; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"\n\t\t\t\t\tstyle=\"width : 30em;\"\n\t\t\t\t\tname=\"subject\" value=\"{$subject}\" id=\"subject\">"; print "</td></tr>"; print "<tr><td colspan='2'><textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 100%' rows=\"20\"\n\t\t\t\tname='content'>{$content}</textarea>"; print "</td></tr></table>"; print "<div class='dlgButtons'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').execute()\">" . __('Send e-mail') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; //return; } if ($id == "generatedFeed") { print "<title>" . __('View as RSS') . "</title>"; print "<content><![CDATA["; $params = explode(":", $param, 3); $feed_id = db_escape_string($params[0]); $is_cat = (bool) $params[1]; $key = get_feed_access_key($link, $feed_id, $is_cat); $url_path = htmlspecialchars($params[2]) . "&key=" . $key; print __("You can view this feed as RSS using the following URL:"); print "<div class=\"tagCloudContainer\">"; print "<a id='gen_feed_url' href='{$url_path}' target='_blank'>{$url_path}</a>"; print "</div>"; print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('{$feed_id}', '{$is_cat}')\">" . __('Generate new URL') . "</button> "; print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">" . __('Close this window') . "</button>"; print "</div>"; print "]]></content>"; //return; } if ($id == "newVersion") { $version_data = check_for_update($link); $version = $version_data['version']; $id = $version_data['version_id']; print "<div class='tagCloudContainer'>"; print T_sprintf("New version of Tiny Tiny RSS is available (%s).", "<b>{$version}</b>"); print "</div>"; $details = "http://tt-rss.org/redmine/versions/show/{$id}"; $download = "http://tt-rss.org/#Download"; print "<div style='text-align : center'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return window.open('{$details}')\">" . __("Details") . "</button>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return window.open('{$download}')\">" . __("Download") . "</button>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return dijit.byId('newVersionDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; } if ($id == "customizeCSS") { $value = get_pref($link, "USER_STYLESHEET"); $value = str_replace("<br/>", "\n", $value); print T_sprintf("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here. <a target=\"_blank\" class=\"visibleLink\" href=\"%s\">This file</a> can be used as a baseline.", "tt-rss.css"); print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"setpref\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">"; print "<table width='100%'><tr><td>"; print "<textarea dojoType=\"dijit.form.SimpleTextarea\"\n\t\t\t\tstyle='font-size : 12px; width : 100%; height: 200px;'\n\t\t\t\tplaceHolder='body#ttrssMain { font-size : 14px; };'\n\t\t\t\tname='value'>{$value}</textarea>"; print "</td></tr></table>"; print "<div class='dlgButtons'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('cssEditDlg').execute()\">" . __('Save') . "</button> "; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('cssEditDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; } if ($id == "editArticleNote") { $result = db_query($link, "SELECT note FROM ttrss_user_entries WHERE\n\t\t\t\tref_id = '{$param}' AND owner_uid = " . $_SESSION['uid']); $note = db_fetch_result($result, 0, "note"); print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"{$param}\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"setNote\">"; print "<table width='100%'><tr><td>"; print "<textarea dojoType=\"dijit.form.SimpleTextarea\"\n\t\t\t\tstyle='font-size : 12px; width : 100%; height: 100px;'\n\t\t\t\tplaceHolder='body#ttrssMain { font-size : 14px; };'\n\t\t\t\tname='note'>{$note}</textarea>"; print "</td></tr></table>"; print "<div class='dlgButtons'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('editNoteDlg').execute()\">" . __('Save') . "</button> "; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"dijit.byId('editNoteDlg').hide()\">" . __('Cancel') . "</button>"; print "</div>"; } if ($id == "about") { print "<table width='100%'><tr><td align='center'>"; print "<img src=\"images/logo_big.png\">"; print "</td>"; print "<td width='70%'>"; print "<h1>Tiny Riny RSS</h1>\n\t\t\t\t<strong>Version " . VERSION . "</strong>\n\t\t\t\t<p>Copyright © 2005-" . date('Y') . "\n\t\t\t\t<a target=\"_blank\" class=\"visibleLink\"\n\t\t\t\thref=\"http://fakecake.org/\">Andrew Dolgov</a>\n\t\t\t\tand other contributors.</p>\n\t\t\t\t<p class=\"insensitive\">Licensed under GNU GPL version 2.</p>"; print "<p class=\"insensitive\">\n\t\t\t\t<a class=\"visibleLink\" target=\"_blank\"\n\t\t\t\t\thref=\"http://tt-rss.org/\">Official site</a> —\n\t\t\t\t<a href=\"http://tt-rss.org/redmine/wiki/tt-rss/Donate\"\n\t\t\t\ttarget=\"_blank\" class=\"visibleLink\">\n\t\t\t\tSupport the project.</a></p>"; print "</td></tr>"; print "</table>"; print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\ttype=\"submit\">" . __('Close this window') . "</button>"; print "</div>"; } if ($id == "addInstance") { print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-instances\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"add\">"; print "<div class=\"dlgSec\">" . __("Instance") . "</div>"; print "<div class=\"dlgSecCont\">"; /* URL */ print __("URL:") . " "; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"\n\t\t\t\tplaceHolder=\"" . __("Instance URL") . "\"\n\t\t\t\tregExp='^(http|https)://.*'\n\t\t\t\tstyle=\"font-size : 16px; width: 20em\" name=\"access_url\">"; print "<hr/>"; $access_key = sha1(uniqid(rand(), true)); /* Access key */ print __("Access key:") . " "; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\"\n\t\t\t\tplaceHolder=\"" . __("Access key") . "\" regExp='\\w{40}'\n\t\t\t\tstyle=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\"\n\t\t\t\tvalue=\"{$access_key}\">"; print "<p class='insensitive'>" . __("Use one access key for both linked instances."); print "</div>"; print "<div class=\"dlgButtons\">\n\t\t\t\t<div style='float : left'>\n\t\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\t\tonclick=\"return dijit.byId('instanceAddDlg').regenKey()\">" . __('Generate new key') . "</button>\n\t\t\t\t</div>\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"return dijit.byId('instanceAddDlg').execute()\">" . __('Create link') . "</button>\n\t\t\t\t<button dojoType=\"dijit.form.Button\"\n\t\t\t\t\tonclick=\"return dijit.byId('instanceAddDlg').hide()\"\">" . __('Cancel') . "</button></div>"; return; } if ($id == "shareArticle") { $result = db_query($link, "SELECT uuid, ref_id FROM ttrss_user_entries WHERE int_id = '{$param}'\n\t\t\t\tAND owner_uid = " . $_SESSION['uid']); if (db_num_rows($result) == 0) { print "Article not found."; } else { $uuid = db_fetch_result($result, 0, "uuid"); $ref_id = db_fetch_result($result, 0, "ref_id"); if (!$uuid) { $uuid = db_escape_string(sha1(uniqid(rand(), true))); db_query($link, "UPDATE ttrss_user_entries SET uuid = '{$uuid}' WHERE int_id = '{$param}'\n\t\t\t\t\t\tAND owner_uid = " . $_SESSION['uid']); } print __("You can share this article by the following unique URL:"); $url_path = get_self_url_prefix(); $url_path .= "/public.php?op=share&key={$uuid}"; print "<div class=\"tagCloudContainer\">"; print "<a id='pub_opml_url' href='{$url_path}' target='_blank'>{$url_path}</a>"; print "</div>"; /* if (!label_find_id($link, __('Shared'), $_SESSION["uid"])) label_create($link, __('Shared'), $_SESSION["uid"]); label_add_article($link, $ref_id, __('Shared'), $_SESSION['uid']); */ } print "<div align='center'>"; print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('shareArticleDlg').hide()\">" . __('Close this window') . "</button>"; print "</div>"; return; } print "</dlg>"; }
function create_script_from_template($id) { global $_CAMILA; $this->menuitems_script = ''; $this->formulas = 'Array('; $this->queries = 'Array('; $resultTable = $this->db->Execute('select * from ' . CAMILA_TABLE_WORKT . ' where id=' . $this->db->qstr($id)); if ($resultTable === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg()); } $result = $this->db->Execute('select * from ' . CAMILA_TABLE_WORKC . ' where (wt_id=' . $this->db->qstr($id) . ' and is_deleted<>' . $this->db->qstr('y') . ') order by sequence'); if ($result === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg()); } require_once CAMILA_LIB_DIR . 'minitemplator/MiniTemplator.class.php'; $t = new MiniTemplator(); $t->readTemplateFromFile(CAMILA_DIR . 'templates/worktable.inc.php'); $report_fields = 'id,'; if (CAMILA_WORKTABLE_SPECIAL_ICON_ENABLED) { $report_fields .= 'cf_bool_is_special,'; } if (CAMILA_WORKTABLE_SELECTED_ICON_ENABLED) { $report_fields .= 'cf_bool_is_selected,'; } $default_fields = 'cf_bool_is_special,cf_bool_is_selected,'; $mapping = $this->get_translation('camila.worktable.sysfields.mapping') . '#'; $mappingAbbrev = $this->get_translation('camila.worktable.sysfields.mapping') . '#'; $order_field = $resultTable->fields['order_field']; $order_dir = $resultTable->fields['order_dir']; $canupdate = $resultTable->fields['canupdate'] == 'y' ? 'true' : 'false'; $caninsert = $resultTable->fields['caninsert'] == 'y' ? 'true' : 'false'; $candelete = $resultTable->fields['candelete'] == 'y' ? 'true' : 'false'; $rcount = 0; $vcount = 0; $fcount = 0; $qcount = 0; while (!$result->EOF) { if ($vcount > 0) { $default_fields .= ','; } if ($rcount > 0) { $report_fields .= ','; $mapping .= '#'; $mappingAbbrev .= '#'; } else { if ($order_field == '') { $order_field = $result->fields['col_name']; } } if ($result->fields['type'] != 'formula' && $result->fields['type'] != 'query') { $report_fields .= $result->fields['col_name']; } else { if ($result->fields['type'] == 'query') { $report_fields .= $result->fields['col_name'] . ' as cf_query_' . $result->fields['col_name']; if ($qcount > 0) { $this->queries .= ','; } $this->queries .= '\'' . 'cf_query_' . $result->fields['col_name'] . '\'=>\'' . $result->fields['field_options'] . '\''; $qcount++; } else { $report_fields .= $result->fields['col_name'] . ' as cf_formula_' . $result->fields['col_name']; if ($fcount > 0) { $this->formulas .= ','; } $this->formulas .= '\'' . 'cf_formula_' . $result->fields['col_name'] . '\'=>\'' . $result->fields['field_options'] . '\''; $fcount++; } } if ($result->fields['visible'] == 'y') { if ($result->fields['type'] != 'formula' && $result->fields['type'] != 'query') { $default_fields .= $result->fields['col_name']; } else { if ($result->fields['type'] == 'query') { $default_fields .= $result->fields['col_name'] . ' as cf_query_' . $result->fields['col_name']; } else { $default_fields .= $result->fields['col_name'] . ' as cf_formula_' . $result->fields['col_name']; } } $vcount++; } if ($result->fields['type'] != 'formula' && $result->fields['type'] != 'query') { $mappingAbbrev .= $result->fields['col_name'] . '=' . $this->escape($result->fields['name_abbrev']); $mapping .= $result->fields['col_name'] . '=' . $this->escape($result->fields['name']); } else { if ($result->fields['type'] == 'query') { $mappingAbbrev .= 'cf_query_' . $result->fields['col_name'] . '=' . $this->escape($result->fields['name_abbrev']); $mappingAbbrev .= '#' . $result->fields['col_name'] . ' as cf_query_' . $result->fields['col_name'] . '=' . $this->escape($result->fields['name_abbrev']); $mapping .= 'cf_formula_' . $result->fields['col_name'] . '=' . $this->escape($result->fields['name']); $mapping .= '#' . $result->fields['col_name'] . 'as cf_query_' . $result->fields['col_name'] . '=' . $this->escape($result->fields['name']); } else { $mappingAbbrev .= 'cf_formula_' . $result->fields['col_name'] . '=' . $this->escape($result->fields['name_abbrev']); $mappingAbbrev .= '#' . $result->fields['col_name'] . ' as cf_formula_' . $result->fields['col_name'] . '=' . $this->escape($result->fields['name_abbrev']); $mapping .= 'cf_formula_' . $result->fields['col_name'] . '=' . $this->escape($result->fields['name']); $mapping .= '#' . $result->fields['col_name'] . 'as cf_formula_' . $result->fields['col_name'] . '=' . $this->escape($result->fields['name']); } } $rcount++; $t->setVariable('form_element', $this->get_form_element($result->fields)); $t->addBlock('element'); $result->MoveNext(); } $report_fields .= ',created,created_by,created_by_surname,created_by_name,last_upd,last_upd_by,last_upd_by_surname,last_upd_by_name,mod_num'; foreach ($this->requires as $value) { $t->setVariable('form_require', $value); $t->addBlock('require'); } $result = $this->db->Execute('select distinct autosuggest_wt_name from ' . CAMILA_TABLE_WORKC . ' where (wt_id=' . $this->db->qstr($id) . ' and is_deleted<>' . $this->db->qstr('y') . ')'); if ($result === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg()); } while (!$result->EOF) { $tablename = $result->fields['autosuggest_wt_name']; if ($tablename != '') { $result2 = $this->db->Execute('select id, tablename from ' . CAMILA_TABLE_WORKT . ' where short_title=' . $this->db->qstr($tablename)); if ($result2 === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg()); } $extid = $result2->fields['id']; $table = $result2->fields['tablename']; $exttable = false; if (substr($tablename, 0, 1) == '[') { $exttable = true; $table = substr($tablename, 1, -1); } $result2 = $this->db->Execute('select sequence,col_name, autosuggest_wt_colname from ' . CAMILA_TABLE_WORKC . ' where (autosuggest_wt_name=' . $this->db->qstr($tablename) . ' and wt_id=' . $this->db->qstr($id) . ' and is_deleted<>' . $this->db->qstr('y') . ')'); if ($result2 === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg()); } while (!$result2->EOF) { $field = $result2->fields['col_name']; $sequence = $result2->fields['sequence']; $suggcolname = $result2->fields['autosuggest_wt_colname']; //search for col_names $result3 = $this->db->Execute('select col_name from ' . CAMILA_TABLE_WORKC . ' where (name=' . $this->db->qstr($suggcolname) . ' and wt_id=' . $this->db->qstr($extid) . ' and is_deleted<>' . $this->db->qstr('y') . ')'); if ($result3 === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg()); } $col_name = $result3->fields['col_name']; if ($exttable) { $col_name = $suggcolname; } $suggfield = $col_name; $infofields = ''; $destfields = ''; $query1 = 'select col_name, autosuggest_wt_colname from ' . CAMILA_TABLE_WORKC . ' where (autosuggest_wt_name=' . $this->db->qstr($tablename) . ' and autosuggest_wt_colname <>' . $this->db->qstr($suggcolname) . ' and wt_id=' . $this->db->qstr($id) . ' and is_deleted<>' . $this->db->qstr('y') . ' and sequence >= ' . $sequence . ' ) order by sequence'; $query2 = 'select col_name, autosuggest_wt_colname from ' . CAMILA_TABLE_WORKC . ' where (autosuggest_wt_name=' . $this->db->qstr($tablename) . ' and autosuggest_wt_colname <>' . $this->db->qstr($suggcolname) . ' and wt_id=' . $this->db->qstr($id) . ' and is_deleted<>' . $this->db->qstr('y') . ' and sequence < ' . $sequence . ' ) order by sequence'; $result4 = $this->db->Execute($query1); if ($result4 === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg()); } while (!$result4->EOF) { $suggcolname = $result4->fields['autosuggest_wt_colname']; $result3 = $this->db->Execute('select col_name from ' . CAMILA_TABLE_WORKC . ' where (name=' . $this->db->qstr($suggcolname) . ' and wt_id=' . $this->db->qstr($extid) . ' and (is_deleted<>' . $this->db->qstr('y') . ' or is_deleted is null))'); if ($result3 === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg()); } $col_name = $result3->fields['col_name']; $dest_col_name = $result4->fields['col_name']; if ($dest_col_name != '') { $destfields .= ',' . $dest_col_name; } if ($col_name != '') { $infofields .= ',' . $col_name; } if ($exttable) { $infofields .= ',' . $suggcolname; } $result4->MoveNext(); } $result4 = $this->db->Execute($query2); if ($result4 === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg()); } while (!$result4->EOF) { $suggcolname = $result4->fields['autosuggest_wt_colname']; $result3 = $this->db->Execute('select col_name from ' . CAMILA_TABLE_WORKC . ' where (name=' . $this->db->qstr($suggcolname) . ' and wt_id=' . $this->db->qstr($extid) . ' and (is_deleted<>' . $this->db->qstr('y') . ' or is_deleted is null))'); if ($result3 === false) { camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $this->db->ErrorMsg()); } $col_name = $result3->fields['col_name']; $dest_col_name = $result4->fields['col_name']; if ($dest_col_name != '') { $destfields .= ',' . $dest_col_name; } if ($col_name != '') { $infofields .= ',' . $col_name; } if ($exttable) { $infofields .= ',' . $suggcolname; } $result4->MoveNext(); } $script .= "if (is_object(\$form->fields['{$field}']))\n"; $script .= "{\n"; $script .= "\$form->fields['{$field}']->autosuggest_table = '" . $table . "';\n"; $script .= "\$form->fields['{$field}']->autosuggest_field = '" . $suggfield . "';\n"; $script .= "\$form->fields['{$field}']->autosuggest_idfield = '" . id . "';\n"; $script .= "\$form->fields['{$field}']->autosuggest_infofields = '" . substr($infofields, 1) . "';\n"; $script .= "\$form->fields['{$field}']->autosuggest_pickfields = '" . substr($infofields, 1) . "';\n"; $script .= "\$form->fields['{$field}']->autosuggest_destfields = '" . substr($destfields, 1) . "';\n"; $script .= "}\n"; $result2->MoveNext(); } } $result->MoveNext(); } $this->formulas .= ');'; $this->queries .= ');'; $t->setVariable('menuitems_script', $this->menuitems_script); $t->setVariable('formulas', $this->formulas); $t->setVariable('queries', $this->queries); $t->setVariable('autosuggest_script', $script); $t->setVariable('table', CAMILA_TABLE_WORKP . $id); $t->setVariable('report_fields', $report_fields); $t->setVariable('default_fields', $default_fields); $t->setVariable('mapping', $mapping); $t->setVariable('mapping_abbrev', $mappingAbbrev); $t->setVariable('order_field', $order_field); $t->setVariable('order_dir', $order_dir); $t->setVariable('canupdate', $canupdate); $t->setVariable('caninsert', $caninsert); $t->setVariable('candelete', $candelete); $t->generateOutputToString($output); //$t->generateOutputToFile(CAMILA_WORKTABLES_DIR . '/' . CAMILA_TABLE_WORKP . $id . '.inc.php'); $trans = new Latin1UTF8(); $fh = fopen(CAMILA_WORKTABLES_DIR . '/' . CAMILA_TABLE_WORKP . $id . '.inc.php', 'wb'); fwrite($fh, $trans->mixed_to_utf8($output)); fclose($fh); $record = array(); $record['visible'] = 'yes'; $record['active'] = 'yes'; $success3 = true; $updateSQL = $this->db->AutoExecute(CAMILA_TABLE_PAGES, $record, 'UPDATE', 'url=' . $this->db->qstr($resultTable->fields['scriptname'])); if (!$updateSQL) { camila_information_text(camila_get_translation('camila.worktable.db.error')); $success3 = false; } return $success3; }
if (!isset($_SESSION["{$myApplicationID}"])) { $mystr = $_SERVER['QUERY_STRING']; $_SESSION["{$myApplicationID}"] = ltrim($mystr, "ApplicationID="); header("Location: http://52.64.94.20/src/ReviewPage.php"); } else { if (!isset($_SESSION["ActiveUserID"])) { header("Location: LoginPage.php"); } if ($_SESSION["ActiveUserTypeID"] == 3) { $_SESSION['MessageHead'] = "Oops only Approved Members can access this page!"; $_SESSION['MessageBody'] = "Your membership is currently pending. Please contact an Administrator if you have been waiting longer than 1 day for approval."; $_SESSION['RedirectTo'] = "Home.php"; header("Location: MessagePage.php"); } $t = new MiniTemplator(); $t->readTemplateFromFile("Templates/ReviewPageTemplate.htm"); $pdo = new PDO('mysql:host=localhost;dbname=Apptous', 'root', 'password'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Create base query. $query = sprintf("SELECT ApplicationID, ApplicationData, ApplicationDate, ApplicationStatusDescription FROM Application, ApplicationStatus\n where Application.ApplicationStatusID = ApplicationStatus.ApplicationStatusID and ApplicationID = %u", $_SESSION["{$myApplicationID}"]); $result = $pdo->prepare($query); $result->execute(); $MyResult = $result->fetch(PDO::FETCH_ASSOC); $ApplicationData = unserialize($MyResult['ApplicationData']); $t->setVariable("ApplicationStatus", $MyResult['ApplicationStatusDescription']); $t->setVariable("Character", $ApplicationData['Character']); $t->setVariable("Armoury", $ApplicationData['Armoury']); $t->setVariable("Class", $ApplicationData['CharacterClass']); $t->setVariable("iLvl", $ApplicationData['iLvl']); $t->setVariable("ApplicationDate", $MyResult['ApplicationDate']); $t->setVariable("Age", $ApplicationData['Age']);