Changeset 1685
- Timestamp:
- 02/05/07 11:51:37 (21 months ago)
- Files:
-
- 1 modified
-
trunk/gregarius/util.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gregarius/util.php
r1672 r1685 30 30 31 31 function getLastModif() { 32 return getProperty('__meta__','meta.lastupdate');32 return getProperty('__meta__','meta.lastupdate'); 33 33 } 34 34 … … 316 316 if (array_key_exists('enclosure@url', $item) ) { 317 317 $enclosure = $item['enclosure@url']; 318 // If the enclosure is an image, append it to the content 319 if ($enclosure && array_key_exists('enclosure@type', $item) && preg_match('#image/(png|gif|jpe?g)#', $item['enclosure@type'])) { 320 $description = '<img src="'.$enclosure.'" alt="" />' . $description; 321 $enclosure = ''; 322 } 318 323 } else { 319 324 $enclosure = ""; … … 460 465 } 461 466 elseif (is_object($rss) && array_key_exists('title#', $rss->channel)) { 462 if (array_key_exists('title', $rss->channel)) {463 $title = rss_real_escape_string($rss->channel['title']);467 if (array_key_exists('title', $rss->channel)) { 468 $title = rss_real_escape_string($rss->channel['title']); 464 469 } else { 465 $title = " ";470 $title = " "; 466 471 } 467 472 } … … 521 526 $mode |= RSS_MODE_PRIVATE_STATE; 522 527 } 523 528 524 529 $sql = "insert into ".getTable("channels") 525 530 ." (title, url, siteurl, parent, descr, dateadded, icon, position, mode, daterefreshed)" … … 534 539 } 535 540 536 if($tags != "") {541 if($tags != "") { 537 542 __exp__submitTag($newid,$tags,"'channel'"); 538 543 } … … 638 643 $ret = substr($ret, 0, strlen($ret) - strlen(RSS_FILE_LOCATION)); 639 644 } 640 if (substr($ret, -1) == "\\") { // Take off trailing backslash645 if (substr($ret, -1) == "\\") { // Take off trailing backslash 641 646 $ret = substr($ret, 0, -1); 642 }647 } 643 648 if (substr($ret, -1) != "/") { // Add a frontslash 644 649 $ret .= "/"; … … 846 851 847 852 function showViewForm($args) { //$curValue, $show_private) { 848 list($curValue, $show_private) = $args;853 list($curValue, $show_private) = $args; 849 854 850 855 // post back to self, we should be able to handle the request, shouldn't we. … … 856 861 ."</select>" 857 862 ."</p>\n"; 858 /*859 if(isLoggedIn()) {860 echo "<p><label for=\"chkPrivate\">".__('Show Private:')."</label>\n"861 ."<input type=\"checkbox\" name=\"chkPrivate\" id=\"chkPrivate\" value=\"1\" onchange=\"if(false == document.getElementById('chkPrivate').checked) { document.getElementById('chkPrivate').value = 0; document.getElementById('chkPrivate').checked = true; } document.getElementById('frmShow').submit();\"" . (1 == $show_private ? " checked" : "") . ">\n"862 ."</p>\n";863 }864 */865 echo "</form>\n";863 /* 864 if(isLoggedIn()) { 865 echo "<p><label for=\"chkPrivate\">".__('Show Private:')."</label>\n" 866 ."<input type=\"checkbox\" name=\"chkPrivate\" id=\"chkPrivate\" value=\"1\" onchange=\"if(false == document.getElementById('chkPrivate').checked) { document.getElementById('chkPrivate').value = 0; document.getElementById('chkPrivate').checked = true; } document.getElementById('frmShow').submit();\"" . (1 == $show_private ? " checked" : "") . ">\n" 867 ."</p>\n"; 868 } 869 */ 870 echo "</form>\n"; 866 871 } 867 872 … … 965 970 // moved from ajax.php 966 971 function __exp__submitTag($id,$tags,$type = "'item'") { 967 $tags = strip_tags($tags);972 $tags = strip_tags($tags); 968 973 $ftags = utf8_encode( preg_replace(ALLOWED_TAGS_REGEXP,'', trim($tags))); 969 974 $tarr = array_slice(explode(" ",$ftags),0,MAX_TAGS_PER_ITEM); … … 981 986 continue; 982 987 } 983 $ttag = sanitize($ttag,984 RSS_SANITIZER_NO_SPACES | RSS_SANITIZER_SIMPLE_SQL985 );986 988 $ttag = sanitize($ttag, 989 RSS_SANITIZER_NO_SPACES | RSS_SANITIZER_SIMPLE_SQL 990 ); 991 987 992 rss_query( "insert into ". getTable('tag') 988 993 . " (tag) values ('$ttag')", false ); … … 1068 1073 return ("echo stripslashes(\"".addslashes($arr[1])."\");"); 1069 1074 } 1070 1075 1071 1076 function eval_mixed($string) { 1072 1077 $string = "<? ?>".$string."<? ?>"; … … 1094 1099 1095 1100 function cacheFavicon($icon) { 1096 // Make sure only real favicons get fetched into the DB1097 if (! preg_match('#^https?://.+$#',$icon)) {1098 return false;1099 }1100 1101 // Make sure only real favicons get fetched into the DB 1102 if (! preg_match('#^https?://.+$#',$icon)) { 1103 return false; 1104 } 1105 1101 1106 $icon_ = rss_real_escape_string($icon); 1102 1107 $binIcon = getUrl($icon); … … 1144 1149 1145 1150 function hidePrivate() { 1146 $ret = 0;1147 1148 if(isLoggedIn()) {1149 $ret = rss_user_show_private();1150 }1151 1152 return !$ret;1151 $ret = 0; 1152 1153 if(isLoggedIn()) { 1154 $ret = rss_user_show_private(); 1155 } 1156 1157 return !$ret; 1153 1158 } 1154 1159 1155 1160 function isLoggedIn() { 1156 if (!isset($GLOBALS['rssuser'])) {1157 require_once('cls/user.php');1158 }1159 1160 return rss_user_check_user_level(RSS_USER_LEVEL_PRIVATE);1161 } 1162 1163 // Send a crappy 404 (to save bandwidth) for webbots 1161 if (!isset($GLOBALS['rssuser'])) { 1162 require_once('cls/user.php'); 1163 } 1164 1165 return rss_user_check_user_level(RSS_USER_LEVEL_PRIVATE); 1166 } 1167 1168 // Send a crappy 404 (to save bandwidth) for webbots 1164 1169 function rss_404() { 1165 header("HTTP/1.1 404 Not Found");1166 echo "404 Page Not Found\n";1170 header("HTTP/1.1 404 Not Found"); 1171 echo "404 Page Not Found\n"; 1167 1172 } 1168 1173 1169 1174 function rss_uri($title, $sep=RSS_URI_SEPARATOR) { 1170 return utf8_uri_encode(preg_replace('#[ \#%&/\+\'"\?]#',$sep,$title));1175 return utf8_uri_encode(preg_replace('#[ \#%&/\+\'"\?]#',$sep,$title)); 1171 1176 } 1172 1177 ?>
