本文整理汇总了PHP中T_sprintf函数的典型用法代码示例。如果您正苦于以下问题:PHP T_sprintf函数的具体用法?PHP T_sprintf怎么用?PHP T_sprintf使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了T_sprintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
$similarity = (double) db_escape_string($_POST["similarity"]);
$min_title_length = (int) db_escape_string($_POST["min_title_length"]);
$enable_globally = checkbox_to_sql_bool($_POST["enable_globally"]) == "true";
if ($similarity < 0) {
$similarity = 0;
}
if ($similarity > 1) {
$similarity = 1;
}
if ($min_title_length < 0) {
$min_title_length = 0;
}
$similarity = sprintf("%.2f", $similarity);
$this->host->set($this, "similarity", $similarity);
$this->host->set($this, "min_title_length", $min_title_length);
$this->host->set($this, "enable_globally", $enable_globally);
echo T_sprintf("Data saved (%s, %d)", $similarity, $enable_globally);
}
示例2: perform_data_import
//.........这里部分代码省略.........
$data = @gzdecode($contents);
}
if ($data) {
$doc = DOMDocument::loadXML($data);
}
}
if ($doc) {
$xpath = new DOMXpath($doc);
$container = $doc->firstChild;
if ($container && $container->hasAttribute('schema-version')) {
$schema_version = $container->getAttribute('schema-version');
if ($schema_version != SCHEMA_VERSION) {
print "<p>" . __("Could not import: incorrect schema version.") . "</p>";
return;
}
} else {
print "<p>" . __("Could not import: unrecognized document format.") . "</p>";
return;
}
$articles = $xpath->query("//article");
foreach ($articles as $article_node) {
if ($article_node->childNodes) {
$ref_id = 0;
$article = array();
foreach ($article_node->childNodes as $child) {
if ($child->nodeName != 'label_cache') {
$article[$child->nodeName] = db_escape_string($child->nodeValue);
} else {
$article[$child->nodeName] = $child->nodeValue;
}
}
//print_r($article);
if ($article['guid']) {
++$num_processed;
//db_query($link, "BEGIN");
//print 'GUID:' . $article['guid'] . "\n";
$result = db_query($link, "SELECT id FROM ttrss_entries\n\t\t\t\t\t\t\tWHERE guid = '" . $article['guid'] . "'");
if (db_num_rows($result) == 0) {
$result = db_query($link, "INSERT INTO ttrss_entries\n\t\t\t\t\t\t\t\t\t(title,\n\t\t\t\t\t\t\t\t\tguid,\n\t\t\t\t\t\t\t\t\tlink,\n\t\t\t\t\t\t\t\t\tupdated,\n\t\t\t\t\t\t\t\t\tcontent,\n\t\t\t\t\t\t\t\t\tcontent_hash,\n\t\t\t\t\t\t\t\t\tno_orig_date,\n\t\t\t\t\t\t\t\t\tdate_updated,\n\t\t\t\t\t\t\t\t\tdate_entered,\n\t\t\t\t\t\t\t\t\tcomments,\n\t\t\t\t\t\t\t\t\tnum_comments,\n\t\t\t\t\t\t\t\t\tauthor)\n\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t('" . $article['title'] . "',\n\t\t\t\t\t\t\t\t\t'" . $article['guid'] . "',\n\t\t\t\t\t\t\t\t\t'" . $article['link'] . "',\n\t\t\t\t\t\t\t\t\t'" . $article['updated'] . "',\n\t\t\t\t\t\t\t\t\t'" . $article['content'] . "',\n\t\t\t\t\t\t\t\t\t'" . sha1($article['content']) . "',\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t\t'0',\n\t\t\t\t\t\t\t\t\t'')");
$result = db_query($link, "SELECT id FROM ttrss_entries\n\t\t\t\t\t\t\t\tWHERE guid = '" . $article['guid'] . "'");
if (db_num_rows($result) != 0) {
$ref_id = db_fetch_result($result, 0, "id");
}
} else {
$ref_id = db_fetch_result($result, 0, "id");
}
//print "Got ref ID: $ref_id\n";
if ($ref_id) {
$feed_url = $article['feed_url'];
$feed_title = $article['feed_title'];
$feed = 'NULL';
if ($feed_url && $feed_title) {
$result = db_query($link, "SELECT id FROM ttrss_feeds\n\t\t\t\t\t\t\t\t\tWHERE feed_url = '{$feed_url}' AND owner_uid = '{$owner_uid}'");
if (db_num_rows($result) != 0) {
$feed = db_fetch_result($result, 0, "id");
} else {
// try autocreating feed in Uncategorized...
$result = db_query($link, "INSERT INTO ttrss_feeds (owner_uid,\n\t\t\t\t\t\t\t\t\t\tfeed_url, title) VALUES ({$owner_uid}, '{$feed_url}', '{$feed_title}')");
$result = db_query($link, "SELECT id FROM ttrss_feeds\n\t\t\t\t\t\t\t\t\t\tWHERE feed_url = '{$feed_url}' AND owner_uid = '{$owner_uid}'");
if (db_num_rows($result) != 0) {
++$num_feeds_created;
$feed = db_fetch_result($result, 0, "id");
}
}
}
if ($feed != 'NULL') {
$feed_qpart = "feed_id = {$feed}";
} else {
$feed_qpart = "feed_id IS NULL";
}
//print "$ref_id / $feed / " . $article['title'] . "\n";
$result = db_query($link, "SELECT int_id FROM ttrss_user_entries\n\t\t\t\t\t\t\t\tWHERE ref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' AND {$feed_qpart}");
if (db_num_rows($result) == 0) {
$marked = bool_to_sql_bool(sql_bool_to_bool($article['marked']));
$published = bool_to_sql_bool(sql_bool_to_bool($article['published']));
$score = (int) $article['score'];
$tag_cache = $article['tag_cache'];
$label_cache = db_escape_string($article['label_cache']);
$note = $article['note'];
//print "Importing " . $article['title'] . "<br/>";
++$num_imported;
$result = db_query($link, "INSERT INTO ttrss_user_entries\n\t\t\t\t\t\t\t\t\t(ref_id, owner_uid, feed_id, unread, last_read, marked,\n\t\t\t\t\t\t\t\t\t\tpublished, score, tag_cache, label_cache, uuid, note)\n\t\t\t\t\t\t\t\t\tVALUES ({$ref_id}, {$owner_uid}, {$feed}, false,\n\t\t\t\t\t\t\t\t\t\tNULL, {$marked}, {$published}, {$score}, '{$tag_cache}',\n\t\t\t\t\t\t\t\t\t\t\t'{$label_cache}', '', '{$note}')");
$label_cache = json_decode($label_cache, true);
if (is_array($label_cache) && $label_cache["no-labels"] != 1) {
foreach ($label_cache as $label) {
label_create($link, $label[1], $label[2], $label[3], $owner_uid);
label_add_article($link, $ref_id, $label[1], $owner_uid);
}
}
//db_query($link, "COMMIT");
}
}
}
}
}
print "<p>" . T_sprintf("Finished: %d articles processed, %d imported, %d feeds created.", $num_processed, $num_imported, $num_feeds_created) . "</p>";
} else {
print "<p>" . __("Could not load XML document.") . "</p>";
}
}
示例3: add
function add()
{
$savemode = db_escape_string($_REQUEST["savemode"]);
$regexp = db_escape_string(trim($_REQUEST["reg_exp"]));
$filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
$feed_id = db_escape_string($_REQUEST["feed_id"]);
$cat_id = db_escape_string($_REQUEST["cat_id"]);
$action_id = db_escape_string($_REQUEST["action_id"]);
$action_param = db_escape_string($_REQUEST["action_param"]);
$action_param_label = db_escape_string($_REQUEST["action_param_label"]);
$inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"]));
$cat_filter = checkbox_to_sql_bool(db_escape_string($_REQUEST["cat_filter"]));
# for the time being, no other filters use params anyway...
$filter_param = db_escape_string($_REQUEST["filter_date_modifier"]);
if (!$regexp) {
return;
}
if (!$feed_id) {
$feed_id = 'NULL';
} else {
$feed_id = sprintf("'%s'", db_escape_string($feed_id));
}
if (!$cat_id) {
$cat_id = 'NULL';
} else {
$cat_id = sprintf("'%d'", db_escape_string($cat_id));
}
/* When processing 'assign label' filters, action_param_label dropbox
* overrides action_param */
if ($action_id == 7) {
$action_param = $action_param_label;
}
if ($action_id == 6) {
$action_param = (int) str_replace("+", "", $action_param);
}
if ($savemode != "test") {
$result = db_query($this->link, "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id,\n\t\t\t\t\taction_id, action_param, inverse, filter_param, cat_id, cat_filter)\n\t\t\t\tVALUES\n\t\t\t\t\t('{$regexp}', '{$filter_type}','" . $_SESSION["uid"] . "',\n\t\t\t\t\t{$feed_id}, '{$action_id}', '{$action_param}', {$inverse},\n\t\t\t\t\t'{$filter_param}', {$cat_id}, {$cat_filter})");
if (db_affected_rows($this->link, $result) != 0) {
print T_sprintf("Created filter <b>%s</b>", htmlspecialchars($regexp));
}
} else {
$this->filter_test($filter_type, $regexp, $action_id, $action_param, $filter_param, sql_bool_to_bool($inverse), (int) $_REQUEST["feed_id"], (int) $_REQUEST['cat_id'], sql_bool_to_bool($cat_filter));
print "<div align='center'>";
print "<button dojoType=\"dijit.form.Button\"\n\t\t\t\tonclick=\"return dijit.byId('filterTestDlg').hide()\">" . __('Close this window') . "</button>";
print "</div>";
}
}
示例4: while
while (!feof($fp)) {
$query = trim(getline($fp, ";"));
if ($query != "") {
print "<p class='query'>{$query}</p>";
db_query($link, $query);
}
}
}
fclose($fp);
print "<p>" . __("Checking version... ");
$result = db_query($link, "SELECT schema_version FROM ttirc_version");
$version = db_fetch_result($result, 0, "schema_version");
if ($version == $v) {
print __("OK!");
} else {
print "<b>" . __("ERROR!") . "</b>";
return;
}
$num_updates++;
}
}
print "<p>" . T_sprintf("Finished. Performed <b>%d</b> update(s) up to schema\n\t\t\tversion <b>%d</b>.", $num_updates, $version) . "</p>";
print "<form method=\"GET\" action=\"logout.php\">\n\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t</form>";
}
}
?>
</body>
</html>
示例5: resetUserPassword
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);
}
}
}
示例6: subscribe2
function subscribe2()
{
$feed_url = $this->dbh->escape_string(trim($_REQUEST["feed_url"]));
$cat_id = $this->dbh->escape_string($_REQUEST["cat_id"]);
$from = $this->dbh->escape_string($_REQUEST["from"]);
$feed_urls = array();
/* only read authentication information from POST */
$auth_login = $this->dbh->escape_string(trim($_POST["auth_login"]));
$auth_pass = $this->dbh->escape_string(trim($_POST["auth_pass"]));
$rc = subscribe_to_feed($feed_url, $cat_id, $auth_login, $auth_pass);
switch ($rc) {
case 1:
print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url));
break;
case 2:
print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url));
break;
case 3:
print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url));
break;
case 0:
print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url));
break;
case 4:
print_notice(__("Multiple feed URLs found."));
$contents = @fetch_file_contents($url, false, $auth_login, $auth_pass);
if (is_html($contents)) {
$feed_urls = get_feeds_from_html($url, $contents);
}
break;
case 5:
print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url));
break;
}
if ($feed_urls) {
print "<form action=\"backend.php\">";
print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">";
print "<input type=\"hidden\" name=\"quiet\" value=\"1\">";
print "<input type=\"hidden\" name=\"method\" value=\"add\">";
print "<select name=\"feed_url\">";
foreach ($feed_urls as $url => $name) {
$url = htmlspecialchars($url);
$name = htmlspecialchars($name);
print "<option value=\"{$url}\">{$name}</option>";
}
print "<input type=\"submit\" value=\"" . __("Subscribe to selected feed") . "\">";
print "</form>";
}
$tp_uri = get_self_url_prefix() . "/prefs.php";
$tt_uri = get_self_url_prefix();
if ($rc <= 2) {
$result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE\n\t\t\t\tfeed_url = '{$feed_url}' AND owner_uid = " . $_SESSION["uid"]);
$feed_id = $this->dbh->fetch_result($result, 0, "id");
} else {
$feed_id = 0;
}
print "<p>";
if ($feed_id) {
print "<form method=\"GET\" style='display: inline'\n\t\t\t\taction=\"{$tp_uri}\">\n\t\t\t\t<input type=\"hidden\" name=\"tab\" value=\"feedConfig\">\n\t\t\t\t<input type=\"hidden\" name=\"method\" value=\"editFeed\">\n\t\t\t\t<input type=\"hidden\" name=\"methodparam\" value=\"{$feed_id}\">\n\t\t\t\t<input type=\"submit\" value=\"" . __("Edit subscription options") . "\">\n\t\t\t\t</form>";
}
print "<form style='display: inline' method=\"GET\" action=\"{$tt_uri}\">\n\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t</form></p>";
print "</body></html>";
}
示例7: format_headlines_list
//.........这里部分代码省略.........
}
$labels_str = "<span class=\"HLLCTR-{$id}\">";
$labels_str .= format_article_labels($labels, $id);
$labels_str .= "</span>";
if (count($topmost_article_ids) < 3) {
array_push($topmost_article_ids, $id);
}
$class = "";
if (sql_bool_to_bool($line["unread"])) {
$class .= " Unread";
++$num_unread;
}
if (sql_bool_to_bool($line["marked"])) {
$marked_pic = "<img\n\t\t\t\t\t\tsrc=\"images/mark_set.png\"\n\t\t\t\t\t\tclass=\"markedPic\" alt=\"Unstar article\"\n\t\t\t\t\t\tonclick='toggleMark({$id})'>";
$class .= " marked";
} else {
$marked_pic = "<img\n\t\t\t\t\t\tsrc=\"images/mark_unset.png\"\n\t\t\t\t\t\tclass=\"markedPic\" alt=\"Star article\"\n\t\t\t\t\t\tonclick='toggleMark({$id})'>";
}
if (sql_bool_to_bool($line["published"])) {
$published_pic = "<img src=\"images/pub_set.png\"\n\t\t\t\t\t\tclass=\"pubPic\"\n\t\t\t\t\t\t\talt=\"Unpublish article\" onclick='togglePub({$id})'>";
$class .= " published";
} else {
$published_pic = "<img src=\"images/pub_unset.png\"\n\t\t\t\t\t\tclass=\"pubPic\"\n\t\t\t\t\t\talt=\"Publish article\" onclick='togglePub({$id})'>";
}
# $content_link = "<a target=\"_blank\" href=\"".$line["link"]."\">" .
# $line["title"] . "</a>";
# $content_link = "<a
# href=\"" . htmlspecialchars($line["link"]) . "\"
# onclick=\"view($id,$feed_id);\">" .
# $line["title"] . "</a>";
# $content_link = "<a href=\"javascript:viewContentUrl('".$line["link"]."');\">" .
# $line["title"] . "</a>";
$updated_fmt = make_local_datetime($line["updated"], false);
$date_entered_fmt = T_sprintf("Imported at %s", make_local_datetime($line["date_entered"], false));
$score = $line["score"];
$score_pic = "images/" . get_score_pic($score);
/* $score_title = __("(Click to change)");
$score_pic = "<img class='hlScorePic' src=\"images/$score_pic\"
onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">"; */
$score_pic = "<img class='hlScorePic' score='{$score}' onclick='changeScore({$id}, this)' src=\"{$score_pic}\"\n\t\t\t\t\ttitle=\"{$score}\">";
if ($score > 500) {
$hlc_suffix = "high";
} else {
if ($score < -100) {
$hlc_suffix = "low";
} else {
$hlc_suffix = "";
}
}
$entry_author = $line["author"];
if ($entry_author) {
$entry_author = " — {$entry_author}";
}
$has_feed_icon = feed_has_icon($feed_id);
if ($has_feed_icon) {
$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"" . ICONS_URL . "/{$feed_id}.ico\" alt=\"\">";
} else {
$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/pub_set.png\" alt=\"\">";
}
$entry_site_url = $line["site_url"];
//setting feed headline background color, needs to change text color based on dark/light
$fav_color = $line['favicon_avg_color'];
require_once "colors.php";
if ($fav_color && $fav_color != 'fail') {
if (!isset($rgba_cache[$feed_id])) {
$rgba_cache[$feed_id] = join(",", _color_unpack($fav_color));
示例8: module_pref_labels
//.........这里部分代码省略.........
} else {
db_query($link, "UPDATE ttrss_labels2 SET\n\t\t\t\t\t\tfg_color = '{$fg}', bg_color = '{$bg}' WHERE id = '{$id}'\n\t\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]);
}
$caption = db_escape_string(label_find_caption($link, $id, $_SESSION["uid"]));
/* Remove cached data */
db_query($link, "UPDATE ttrss_user_entries SET label_cache = ''\n\t\t\t\t\tWHERE label_cache LIKE '%{$caption}%' AND owner_uid = " . $_SESSION["uid"]);
}
return;
}
if ($subop == "color-reset") {
$ids = split(',', db_escape_string($_REQUEST["ids"]));
foreach ($ids as $id) {
db_query($link, "UPDATE ttrss_labels2 SET\n\t\t\t\t\tfg_color = '', bg_color = '' WHERE id = '{$id}'\n\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]);
$caption = db_escape_string(label_find_caption($link, $id, $_SESSION["uid"]));
/* Remove cached data */
db_query($link, "UPDATE ttrss_user_entries SET label_cache = ''\n\t\t\t\t\tWHERE label_cache LIKE '%{$caption}%' AND owner_uid = " . $_SESSION["uid"]);
}
}
if ($subop == "save") {
$id = db_escape_string($_REQUEST["id"]);
$caption = db_escape_string(trim($_REQUEST["caption"]));
db_query($link, "BEGIN");
$result = db_query($link, "SELECT caption FROM ttrss_labels2\n\t\t\t\tWHERE id = '{$id}' AND owner_uid = " . $_SESSION["uid"]);
if (db_num_rows($result) != 0) {
$old_caption = db_fetch_result($result, 0, "caption");
$result = db_query($link, "SELECT id FROM ttrss_labels2\n\t\t\t\t\tWHERE caption = '{$caption}' AND owner_uid = " . $_SESSION["uid"]);
if (db_num_rows($result) == 0) {
if ($caption) {
$result = db_query($link, "UPDATE ttrss_labels2 SET\n\t\t\t\t\t\t\tcaption = '{$caption}' WHERE id = '{$id}' AND\n\t\t\t\t\t\t\towner_uid = " . $_SESSION["uid"]);
/* Update filters that reference label being renamed */
$old_caption = db_escape_string($old_caption);
db_query($link, "UPDATE ttrss_filters SET\n\t\t\t\t\t\t\taction_param = '{$caption}' WHERE action_param = '{$old_caption}'\n\t\t\t\t\t\t\tAND action_id = 7\n\t\t\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]);
print $_REQUEST["value"];
} else {
print $old_caption;
}
} else {
print $old_caption;
}
}
db_query($link, "COMMIT");
return;
}
if ($subop == "remove") {
$ids = split(",", db_escape_string($_REQUEST["ids"]));
foreach ($ids as $id) {
label_remove($link, $id, $_SESSION["uid"]);
}
}
if ($subop == "add") {
$caption = db_escape_string($_REQUEST["caption"]);
$output = db_escape_string($_REQUEST["output"]);
if ($caption) {
if (label_create($link, $caption)) {
if (!$output) {
print T_sprintf("Created label <b>%s</b>", htmlspecialchars($caption));
}
}
if ($output == "select") {
header("Content-Type: text/xml");
print "<rpc-reply><payload>";
print_label_select($link, "select_label", $caption, "");
print "</payload></rpc-reply>";
}
}
return;
}
$sort = db_escape_string($_REQUEST["sort"]);
if (!$sort || $sort == "undefined") {
$sort = "caption";
}
$label_search = db_escape_string($_REQUEST["search"]);
if (array_key_exists("search", $_REQUEST)) {
$_SESSION["prefs_label_search"] = $label_search;
} else {
$label_search = $_SESSION["prefs_label_search"];
}
print "<div id=\"pref-label-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">";
print "<div id=\"pref-label-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">";
print "<div id=\"pref-label-toolbar\" dojoType=\"dijit.Toolbar\">";
print "<div dojoType=\"dijit.form.DropDownButton\">" . "<span>" . __('Select') . "</span>";
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
print "<div onclick=\"dijit.byId('labelTree').model.setAllChecked(true)\" \n\t\t\tdojoType=\"dijit.MenuItem\">" . __('All') . "</div>";
print "<div onclick=\"dijit.byId('labelTree').model.setAllChecked(false)\" \n\t\t\tdojoType=\"dijit.MenuItem\">" . __('None') . "</div>";
print "</div></div>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return addLabel()\">" . __('Create label') . "</button dojoType=\"dijit.form.Button\"> ";
print "<button dojoType=\"dijit.form.Button\" onclick=\"removeSelectedLabels()\">" . __('Remove') . "</button dojoType=\"dijit.form.Button\"> ";
print "<button dojoType=\"dijit.form.Button\" onclick=\"labelColorReset()\">" . __('Clear colors') . "</button dojoType=\"dijit.form.Button\">";
print "</div>";
#toolbar
print "</div>";
#pane
print "<div id=\"pref-label-content\" dojoType=\"dijit.layout.ContentPane\" region=\"center\">";
print "<div id=\"labellistLoading\">\n\t\t<img src='images/indicator_tiny.gif'>" . __("Loading, please wait...") . "</div>";
print "<div dojoType=\"dojo.data.ItemFileWriteStore\" jsId=\"labelStore\" \n\t\t\turl=\"backend.php?op=pref-labels&subop=getlabeltree\">\n\t\t</div>\n\t\t<div dojoType=\"lib.CheckBoxStoreModel\" jsId=\"labelModel\" store=\"labelStore\"\n\t\tquery=\"{id:'root'}\" rootId=\"root\"\n\t\t\tchildrenAttrs=\"items\" checkboxStrict=\"false\" checkboxAll=\"false\">\n\t\t</div>\n\t\t<div dojoType=\"fox.PrefLabelTree\" id=\"labelTree\" \n\t\t\tmodel=\"labelModel\" openOnClick=\"true\">\n\t\t<script type=\"dojo/method\" event=\"onLoad\" args=\"item\">\n\t\t\tElement.hide(\"labellistLoading\");\n\t\t</script>\n\t\t<script type=\"dojo/method\" event=\"onClick\" args=\"item\">\n\t\t\tvar id = String(item.id);\n\t\t\tvar bare_id = id.substr(id.indexOf(':')+1);\n\n\t\t\tif (id.match('LABEL:')) {\n\t\t\t\teditLabel(bare_id);\n\t\t\t}\t\t\t\n\t\t</script>\n\t\t</div>";
print "</div>";
#pane
print "</div>";
#container
}
示例9: opml_import
function opml_import($owner_uid)
{
if (!$owner_uid) {
return;
}
$debug = isset($_REQUEST["debug"]);
$doc = false;
# if ($debug) $doc = DOMDocument::load("/tmp/test.opml");
if ($_FILES['opml_file']['error'] != 0) {
print_error(T_sprintf("Upload failed with error code %d", $_FILES['opml_file']['error']));
return;
}
$tmp_file = false;
if (is_uploaded_file($_FILES['opml_file']['tmp_name'])) {
$tmp_file = tempnam(CACHE_DIR . '/upload', 'opml');
$result = move_uploaded_file($_FILES['opml_file']['tmp_name'], $tmp_file);
if (!$result) {
print_error(__("Unable to move uploaded file."));
return;
}
} else {
print_error(__('Error: please upload OPML file.'));
return;
}
if (is_file($tmp_file)) {
$doc = new DOMDocument();
$doc->load($tmp_file);
unlink($tmp_file);
} else {
if (!$doc) {
print_error(__('Error: unable to find moved OPML file.'));
return;
}
}
if ($doc) {
$this->opml_import_category($doc, false, $owner_uid, false);
} else {
print_error(__('Error while parsing document.'));
}
}
示例10: resetPass
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>";
}
示例11: dataImport
function dataImport()
{
header("Content-Type: text/html");
# required for iframe
print "<div style='text-align : center'>";
if ($_FILES['export_file']['error'] != 0) {
print_error(T_sprintf("Upload failed with error code %d", $_FILES['export_file']['error']));
return;
}
$tmp_file = false;
if (is_uploaded_file($_FILES['export_file']['tmp_name'])) {
$tmp_file = tempnam(CACHE_DIR . '/upload', 'export');
$result = move_uploaded_file($_FILES['export_file']['tmp_name'], $tmp_file);
if (!$result) {
print_error(__("Unable to move uploaded file."));
return;
}
} else {
print_error(__('Error: please upload OPML file.'));
return;
}
if (is_file($tmp_file)) {
$this->perform_data_import($tmp_file, $_SESSION['uid']);
unlink($tmp_file);
} else {
print_error(__('No file uploaded.'));
return;
}
print "<button dojoType=\"dijit.form.Button\"\n\t\t\tonclick=\"dijit.byId('dataImportDlg').hide()\">" . __('Close this window') . "</button>";
print "</div>";
}
示例12: module_popup_dialog
//.........这里部分代码省略.........
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>";
示例13: fclose
fclose($fp);
print "<p>" . __("Checking version... ");
$result = db_query($link, "SELECT schema_version FROM ttrss_version");
$version = db_fetch_result($result, 0, "schema_version");
if ($version == $v) {
print __("OK!");
} else {
print "<b>" . __("ERROR!") . "</b>";
return;
}
$num_updates++;
}
}
print "<p>" . T_sprintf("Finished. Performed <b>%d</b> update(s) up to schema\n\t\t\tversion <b>%d</b>.", $num_updates, $version) . "</p>";
print "<form method=\"GET\" action=\"backend.php\">\n\t\t\t<input type=\"hidden\" name=\"op\" value=\"logout\">\n\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t</form>";
} else {
if ($version >= $latest_version) {
print_error(__("Your database schema is from a newer version of Tiny Tiny RSS."));
print "<p>" . T_sprintf("Found schema version: <b>%d</b>, required: <b>%d</b>.", $version, $latest_version) . "</p>";
print "<p>" . __("Schema upgrade impossible. Please update Tiny Tiny RSS files to the newer version and continue.") . "</p>";
print "<form method=\"GET\" action=\"backend.php\">\n\t\t\t<input type=\"hidden\" name=\"op\" value=\"logout\">\n\t\t\t<input type=\"submit\" value=\"" . __("Return to Tiny Tiny RSS") . "\">\n\t\t\t</form>";
}
}
}
}
?>
</body>
</html>
示例14: queryFeedHeadlines
//.........这里部分代码省略.........
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
} else {
if ($feed <= LABEL_BASE_INDEX) {
// labels
$label_id = feed_to_label_id($feed);
$query_strategy_part = "label_id = '{$label_id}' AND\n\t\t\t\t\tttrss_labels2.id = ttrss_user_labels2.label_id AND\n\t\t\t\t\tttrss_user_labels2.article_id = ref_id";
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
$ext_tables_part = "ttrss_labels2,ttrss_user_labels2,";
$allow_archived = true;
} else {
$query_strategy_part = "true";
}
}
}
}
}
}
}
}
}
}
$order_by = "score DESC, date_entered DESC, updated DESC";
if ($override_order) {
$order_by = $override_order;
}
if ($override_strategy) {
$query_strategy_part = $override_strategy;
}
if ($override_vfeed) {
$vfeed_query_part = $override_vfeed;
}
$feed_title = "";
if ($search) {
$feed_title = T_sprintf("Search results: %s", $search);
} else {
if ($cat_view) {
$feed_title = getCategoryTitle($feed);
} else {
if (is_numeric($feed) && $feed > 0) {
$result = db_query("SELECT title,site_url,last_error,last_updated\n\t\t\t\t\t\t\tFROM ttrss_feeds WHERE id = '{$feed}' AND owner_uid = {$owner_uid}");
$feed_title = db_fetch_result($result, 0, "title");
$feed_site_url = db_fetch_result($result, 0, "site_url");
$last_error = db_fetch_result($result, 0, "last_error");
$last_updated = db_fetch_result($result, 0, "last_updated");
} else {
$feed_title = getFeedTitle($feed);
}
}
}
$content_query_part = "content, ";
if ($limit_query_part) {
$offset_query_part = "OFFSET {$offset}";
} else {
$offset_query_part = "";
}
if (is_numeric($feed)) {
// proper override_order applied above
if ($vfeed_query_part && !$ignore_vfeed_group && get_pref('VFEED_GROUP_BY_FEED', $owner_uid)) {
if (!$override_order) {
$order_by = "ttrss_feeds.title, {$order_by}";
} else {
$order_by = "ttrss_feeds.title, {$override_order}";
}
}
if (!$allow_archived) {
$from_qpart = "{$ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id),ttrss_feeds";
示例15: getRuleName
private function getRuleName($rule)
{
if (!$rule) {
$rule = json_decode($_REQUEST["rule"], true);
}
$feed_id = $rule["feed_id"];
if (strpos($feed_id, "CAT:") === 0) {
$feed_id = (int) substr($feed_id, 4);
$feed = getCategoryTitle($feed_id);
} else {
$feed_id = (int) $feed_id;
if ($rule["feed_id"]) {
$feed = getFeedTitle((int) $rule["feed_id"]);
} else {
$feed = __("All feeds");
}
}
$result = $this->dbh->query("SELECT description FROM ttrss_filter_types\n\t\t\tWHERE id = " . (int) $rule["filter_type"]);
$filter_type = $this->dbh->fetch_result($result, 0, "description");
return T_sprintf("%s on %s in %s %s", strip_tags($rule["reg_exp"]), $filter_type, $feed, isset($rule["inverse"]) ? __("(inverse)") : "");
}