Changeset 1654
- Timestamp:
- 01/03/07 09:36:49 (21 months ago)
- Files:
-
- 1 modified
-
trunk/gregarius/admin/channels.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gregarius/admin/channels.php
r1644 r1654 46 46 echo "<label for=\"add_channel_to_folder\">". __('to folder:') . "</label>\n"; 47 47 echo rss_toolkit_folders_combo('add_channel_to_folder'); 48 echo "<label for=\"channel_tags\">" . __('Categories') . ":</label>\n";49 echo "<input type=\"text\" name=\"channel_tags\" id=\"channel_tags\" />\n";48 echo "<label for=\"channel_tags\">" . __('Categories') . ":</label>\n"; 49 echo "<input type=\"text\" name=\"channel_tags\" id=\"channel_tags\" />\n"; 50 50 echo "<input type=\"hidden\" name=\"". CST_ADMIN_METAACTION ."\" value=\"ACT_ADMIN_ADD\" />\n"; 51 51 echo "<input type=\"submit\" name=\"action\" value=\"". __('Add') ."\" /></p>\n"; … … 66 66 ."//<!--\n" 67 67 ."if (navigator && typeof(navigator.registerContentHandler) == 'function'){\n" 68 ."\tdocument.write('<p style=\"font-size:small\">" 69 . __('Register as Feed Handler [<a href="http://www.bengoodger.com/software/mb/feeds/feed-handling.html">?</a>]:') 68 ."\tdocument.write('<p style=\"font-size:small\">" 69 . __('Register as Feed Handler [<a href="http://www.bengoodger.com/software/mb/feeds/feed-handling.html">?</a>]:') 70 70 . " <a class=\"bookmarklet\" href=\"$feedhandler_url\">" 71 71 .__('Register Gregarius!')."</a></p>');\n" … … 149 149 } 150 150 } 151 152 if(NULL == $daterefreshed) {153 $dead = true;154 } else {155 $dead = (time() - strtotime($daterefreshed) > getConfig('rss.config.deadthreshhold')*60*60 ? true : false);156 }151 152 if(NULL == $daterefreshed) { 153 $dead = true; 154 } else { 155 $dead = (time() - strtotime($daterefreshed) > getConfig('rss.config.deadthreshhold')*60*60 ? true : false); 156 } 157 157 158 158 $fmode = array(); … … 162 162 if ($mode & RSS_MODE_DELETED_STATE) { 163 163 $fmode[] = "D"; 164 $dead = false;164 $dead = false; 165 165 } 166 166 … … 262 262 263 263 case __('Add'): 264 case 'ACT_ADMIN_ADD':265 case 'Add':266 267 $label = trim(sanitize($_REQUEST['new_channel'], RSS_SANITIZER_URL));264 case 'ACT_ADMIN_ADD': 265 case 'Add': 266 267 $label = trim(sanitize($_REQUEST['new_channel'], RSS_SANITIZER_URL)); 268 268 $fid = trim(sanitize($_REQUEST['add_channel_to_folder'], RSS_SANITIZER_NUMERIC)); 269 269 list($flabel) = rss_fetch_row(rss_query( 270 "select name from " . getTable('folders') . " where id=$fid"));270 "select name from " . getTable('folders') . " where id=$fid")); 271 271 272 272 // handle "feed:" urls 273 if (substr($label, 0,5) == 'feed:') {273 if (substr($label, 0,5) == 'feed:') { 274 274 275 275 if (substr($label, 0, 11 ) == "feed://http") { … … 453 453 454 454 case __('Import'): 455 case 'ACT_ADMIN_IMPORT':456 457 458 if (array_key_exists('opml',$_POST) && strlen(trim($_POST['opml'])) > 7) {459 $url = trim( sanitize($_POST['opml'],RSS_SANITIZER_NO_SPACES) );460 }455 case 'ACT_ADMIN_IMPORT': 456 457 458 if (array_key_exists('opml',$_POST) && strlen(trim($_POST['opml'])) > 7) { 459 $url = trim( sanitize($_POST['opml'],RSS_SANITIZER_NO_SPACES) ); 460 } 461 461 elseif (array_key_exists('opmlfile',$_FILES) && $_FILES['opmlfile']['tmp_name']) { 462 462 if (is_uploaded_file($_FILES['opmlfile']['tmp_name'])) { … … 507 507 508 508 list($prev_folder) = rss_fetch_row(rss_query( 509 "select name from " .getTable('folders')510 ." where id= $opmlfid "));509 "select name from " .getTable('folders') 510 ." where id= $opmlfid ")); 511 511 512 512 } else { … … 540 540 $f__ = strip_tags($prev_folder); 541 541 $u__ = sanitize($url_,RSS_SANITIZER_URL); 542 $c__ =preg_replace(ALLOWED_TAGS_REGEXP,' ',$cats_);542 $c__ = $cats_; //preg_replace(ALLOWED_TAGS_REGEXP,' ',$cats_); 543 543 if ($u__) { 544 544 545 545 echo "<li><p>" . sprintf(__('Adding %s to %s... '),$t__,$f__); 546 546 flush(); 547 547 548 list($retcde, $retmsg) = add_channel($u__, $fid, $t__, $d__); 548 549 if ($retcde && count($c__)) { 549 __exp__submitTag($retcde,utf_encode($c__),"'channel'");550 __exp__submitTag($retcde,utf8_encode($c__),"'channel'"); 550 551 } 551 552 echo ($retcde<0 ?$retmsg:" OK")."</p></li>\n"; … … 753 754 break; 754 755 755 case 'dump': 756 // Make sure this is a POST 757 if(!isset($_POST['dumpact'])) { 758 die('Sorry, you can\'t access this via a GET'); 759 } 760 $tbl = array('"','"'); 761 error_reporting(E_ALL); 762 rss_require('schema.php'); 763 $tables=getExpectedTables(); 764 unset($tables['cache']); 765 //$tables=array('channels','tag','config'); 766 $bfr=''; 767 $bfr .= '<'.'?xml version="1.0" encoding="UTF-8"?'.'>'."\n"; 768 $bfr .= '<dump prefix="'.getTable('').'" date="'.date('r').'">'."\n"; 769 foreach($tables as $table => $prefixed) { 770 $rs = rss_query("select * from $prefixed"); 771 $bfr .="<$table>\n"; 772 while($row=rss_fetch_assoc($rs)) { 773 $r="<row "; 774 foreach($row as $key => $val) { 775 $val=htmlspecialchars($val); 776 $r.=" $key=\"$val\" "; 777 } 778 $r .= "/>\n"; 779 $bfr .=$r; 780 } 781 $bfr .="</$table>\n"; 782 } 783 $bfr .='</dump>'."\n"; 784 $gzdata = gzencode($bfr, 9); 785 786 787 // Delete the output buffer. This is probably a bad thing to do, if the ob'ing is turned off. 788 // e.g. data was already sent to the brwoser. 789 while (@ob_end_clean()); 790 791 // Send the dump to the browser: 792 header("Pragma: public"); // required 793 header("Expires: 0"); 794 header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 795 header("Connection: close"); 796 header("Content-Transfer-Encoding: binary"); 797 header("Content-Length: " . strlen($gzdata)); 798 header('Content-type: application/x-gzip'); 799 header('Content-disposition: inline; filename="gregarius.dump.'.date('MjSY').'.xml.gz"'); 800 801 die($gzdata); 802 803 break; 756 case 'dump': 757 // Make sure this is a POST 758 if(!isset($_POST['dumpact'])) { 759 die('Sorry, you can\'t access this via a GET'); 760 } 761 $tbl = array('"','"'); 762 error_reporting(E_ALL); 763 rss_require('schema.php'); 764 $tables=getExpectedTables(); 765 unset($tables['cache']); 766 //$tables=array('channels','tag','config'); 767 $bfr=''; 768 $bfr .= '<'.'?xml version="1.0" encoding="UTF-8"?'.'>'."\n"; 769 $bfr .= '<dump prefix="'.getTable('').'" date="'.date('r').'">'."\n"; 770 foreach($tables as $table => $prefixed) { 771 $rs = rss_query("select * from $prefixed"); 772 $bfr .="<$table>\n"; 773 while($row=rss_fetch_assoc($rs)) { 774 $r="<row "; 775 foreach($row as $key => $val) { 776 $val=htmlspecialchars($val); 777 $r.=" $key=\"$val\" "; 778 } 779 $r .= "/>\n"; 780 $bfr .=$r; 781 } 782 $bfr .="</$table>\n"; 783 } 784 $bfr .='</dump>'."\n"; 785 $gzdata = gzencode($bfr, 9); 786 787 788 // Delete the output buffer. This is probably a bad thing to do, if the ob'ing is turned off. 789 // e.g. data was already sent to the brwoser. 790 while (@ob_end_clean()) 791 ; 792 793 // Send the dump to the browser: 794 header("Pragma: public"); // required 795 header("Expires: 0"); 796 header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 797 header("Connection: close"); 798 header("Content-Transfer-Encoding: binary"); 799 header("Content-Length: " . strlen($gzdata)); 800 header('Content-type: application/x-gzip'); 801 header('Content-disposition: inline; filename="gregarius.dump.'.date('MjSY').'.xml.gz"'); 802 803 die($gzdata); 804 805 break; 804 806 default: 805 807 break; … … 813 815 list ($id, $title, $url, $siteurl, $parent, $descr, $icon, $mode, $daterefreshed, $dateadded) = rss_fetch_row($res); 814 816 // get tags 815 $sql = "select t.tag from " . getTable('tag')." t " 816 . " inner join " . getTable('metatag') . " m "817 . " on m.tid = t.id "818 . "where m.ttype = 'channel' and m.fid = $cid";817 $sql = "select t.tag from " . getTable('tag')." t " 818 . " inner join " . getTable('metatag') . " m " 819 . " on m.tid = t.id " 820 . "where m.ttype = 'channel' and m.fid = $cid"; 819 821 $res = rss_query($sql); 820 822 $tags = ""; … … 830 832 // Timestamps 831 833 if(!empty($daterefreshed)) { 832 echo "<p><label>" . __('Added') . ": " . date("M-d-Y H:i", strtotime($dateadded)) . "</label></p>"833 ."<p><label>" . __('Last Update') . ": ".date("M-d-Y H:i", strtotime($daterefreshed))."</label></p>\n";834 echo "<p><label>" . __('Added') . ": " . date("M-d-Y H:i", strtotime($dateadded)) . "</label></p>" 835 ."<p><label>" . __('Last Update') . ": ".date("M-d-Y H:i", strtotime($daterefreshed))."</label></p>\n"; 834 836 } else { 835 echo "<p><label>" . __('Added') . ": " . date("M-d-Y H:i", strtotime($dateadded)) . "</label></p>"836 ."<p><label>" . __('Last Update') . ": " . __('Never') . "</label></p>\n";837 echo "<p><label>" . __('Added') . ": " . date("M-d-Y H:i", strtotime($dateadded)) . "</label></p>" 838 ."<p><label>" . __('Last Update') . ": " . __('Never') . "</label></p>\n"; 837 839 } 838 840 // Item name
