summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-01-14 16:11:54 +0300
committerAndrew Dolgov <[email protected]>2010-01-14 16:11:54 +0300
commitb97e6e0267758351e24078f621ef313de0c747fb (patch)
tree33a64e7d72f362e1bd7d92a3248dc83cc6fdf6ea /functions.php
parentdce46cade3ef1d24a12cf6d27abad5d93de95373 (diff)
reorganize theme support; add some themeable icons; add neon theme
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php56
1 files changed, 31 insertions, 25 deletions
diff --git a/functions.php b/functions.php
index ab779d3e0..ace753b67 100644
--- a/functions.php
+++ b/functions.php
@@ -1592,6 +1592,12 @@
if (!$icon_file) $icon_file = getFeedIcon($feed_id);
+ $theme_path = get_user_theme_path($link);
+
+ if ($theme_path && strpos($icon_file, "images") !== false) {
+ $icon_file = $theme_path . $icon_file;
+ }
+
if (file_exists($icon_file) && filesize($icon_file) > 0) {
$feed_icon = "<img id=\"FIMG-$feed_id\" src=\"$icon_file\">";
} else {
@@ -1990,9 +1996,14 @@
function get_user_theme($link) {
if (get_schema_version($link) >= 63) {
- return get_pref($link, "_THEME_ID");
+ $theme_name = get_pref($link, "_THEME_ID");
+ if (is_dir("themes/$theme_name")) {
+ return $theme_name;
+ } else {
+ return '';
+ }
} else {
- return false;
+ return '';
}
}
@@ -2002,7 +2013,7 @@
if (get_schema_version($link) >= 63) {
$theme_name = get_pref($link, "_THEME_ID");
- if ($theme_name) {
+ if ($theme_name && is_dir("themes/$theme_name")) {
$theme_path = "themes/$theme_name/";
} else {
$theme_name = '';
@@ -2017,12 +2028,14 @@
function get_all_themes() {
$themes = glob("themes/*");
+ asort($themes);
+
$rv = array();
foreach ($themes as $t) {
if (is_file("$t/theme.ini")) {
$ini = parse_ini_file("$t/theme.ini", true);
- if ($ini['theme']['version']) {
+ if ($ini['theme']['version'] && !$ini['theme']['disabled']) {
$entry = array();
$entry["path"] = $t;
$entry["base"] = basename($t);
@@ -3042,7 +3055,7 @@
return "images/mark_set.png";
break;
case -2:
- return "images/pub_set.gif";
+ return "images/pub_set.png";
break;
case -3:
return "images/fresh.png";
@@ -4644,6 +4657,8 @@
$result = db_query($link, "SELECT rtl_content, always_display_enclosures FROM ttrss_feeds
WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
+ $theme_path = get_user_theme_path($link);
+
if (db_num_rows($result) == 1) {
$rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
$always_display_enclosures = sql_bool_to_bool(db_fetch_result($result, 0, "always_display_enclosures"));
@@ -4742,30 +4757,21 @@
if (!$entry_comments) $entry_comments = "&nbsp;"; # placeholder
print "<div style='float : right'>
- <img src='images/tag.png' class='tagsPic' alt='Tags' title='Tags'>&nbsp;";
+ <img src='${theme_path}images/tag.png' class='tagsPic' alt='Tags' title='Tags'>&nbsp;";
if (!$zoom_mode) {
print "<span id=\"ATSTR-$id\">$tags_str</span>
<a title=\"".__('Edit tags for this article')."\"
href=\"javascript:editArticleTags($id, $feed_id)\">(+)</a>";
- if (defined('_ENABLE_INLINE_VIEW')) {
-
- print "<img src=\"images/art-inline.png\" class='tagsPic'
- style=\"cursor : pointer\" style=\"cursor : pointer\"
- onclick=\"showOriginalArticleInline($id)\"
- alt='Inline' title='".__('Display original article content')."'>";
-
- }
-
- print "<img src=\"images/art-zoom.png\" class='tagsPic'
+ print "<img src=\"${theme_path}images/art-zoom.png\" class='tagsPic'
style=\"cursor : pointer\" style=\"cursor : pointer\"
onclick=\"zoomToArticle($id)\"
alt='Zoom' title='".__('Show article summary in new window')."'>";
$note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);
- print "<img src=\"images/art-pub-note.png\" class='tagsPic'
+ print "<img src=\"${theme_path}images/art-pub-note.png\" class='tagsPic'
style=\"cursor : pointer\" style=\"cursor : pointer\"
onclick=\"publishWithNote($id, '$note_escaped')\"
alt='PubNote' title='".__('Publish article with a note')."'>";
@@ -5047,6 +5053,8 @@
$fresh_intl = get_pref($link, "FRESH_ARTICLE_MAX_AGE") * 60 * 60;
+ $theme_path = get_user_theme_path($link);
+
while ($line = db_fetch_assoc($result)) {
$class = ($lnum % 2) ? "even" : "odd";
@@ -5076,7 +5084,7 @@
if (sql_bool_to_bool($line["unread"]) &&
time() - strtotime($line["updated_noms"]) < $fresh_intl) {
- $update_pic = "<img id='FUPDPIC-$id' src=\"images/fresh_sign.png\"
+ $update_pic = "<img id='FUPDPIC-$id' src=\"${theme_path}images/fresh_sign.png\"
alt=\"Fresh\">";
}
@@ -5089,21 +5097,21 @@
}
if ($line["marked"] == "t" || $line["marked"] == "1") {
- $marked_pic = "<img id=\"FMPIC-$id\" src=\"images/mark_set.png\"
+ $marked_pic = "<img id=\"FMPIC-$id\" src=\"${theme_path}images/mark_set.png\"
class=\"markedPic\"
alt=\"Unstar article\" onclick='javascript:tMark($id)'>";
} else {
- $marked_pic = "<img id=\"FMPIC-$id\" src=\"images/mark_unset.png\"
+ $marked_pic = "<img id=\"FMPIC-$id\" src=\"${theme_path}images/mark_unset.png\"
class=\"markedPic\"
alt=\"Star article\" onclick='javascript:tMark($id)'>";
}
if ($line["published"] == "t" || $line["published"] == "1") {
- $published_pic = "<img id=\"FPPIC-$id\" src=\"images/pub_set.gif\"
+ $published_pic = "<img id=\"FPPIC-$id\" src=\"${theme_path}images/pub_set.png\"
class=\"markedPic\"
alt=\"Unpublish article\" onclick='javascript:tPub($id)'>";
} else {
- $published_pic = "<img id=\"FPPIC-$id\" src=\"images/pub_unset.gif\"
+ $published_pic = "<img id=\"FPPIC-$id\" src=\"${theme_path}images/pub_unset.png\"
class=\"markedPic\"
alt=\"Publish article\" onclick='javascript:tPub($id)'>";
}
@@ -5494,10 +5502,8 @@
$tags_str = format_tags_string(get_article_tags($link, $id), $id);
-// print "<img src='images/tag.png' class='markedPic'>";
-
print "<span class='s1'>
- <img class='tagsPic' src='images/tag.png' alt='Tags' title='Tags'>
+ <img class='tagsPic' src='${theme_path}images/tag.png' alt='Tags' title='Tags'>
<span id=\"ATSTR-$id\">$tags_str</span>
<a title=\"".__('Edit tags for this article')."\"
href=\"javascript:editArticleTags($id, $feed_id, true)\">(+)</a>";