Changeset 1393 for branches

Show
Ignore:
Timestamp:
03/24/06 20:14:37 (3 years ago)
Author:
spetersen
Message:

bring PostgreSQL in sync with trunk changeset 1388

Location:
branches/postgresql
Files:
94 added
25 removed
41 modified

Legend:

Unmodified
Added
Removed
  • branches/postgresql/INSTALL

    r1262 r1393  
    6666     
    6767     
    68    7.   Point your browser to the URL corresponding the install location 
    69     and click "Admin". You can start adding feeds by pasting URLs of 
    70     RSS or RDF feeds into the "Add a feed" field. Alternatively you 
    71     can import a whole structure of items using the OPML import 
    72     feature. 
     68   7.   Point your browser to the URL corresponding the install 
     69    location and click "Admin". After selecting a new password, 
     70    you can start adding feeds by pasting URLs of RSS or RDF feeds 
     71    into the "Add a feed" field. Alternatively you can import a 
     72    list of feeds using the OPML import feature. 
    7373    
    74    8.   You may wish to password-protect the administration section of 
    75     your fresh gregarius installation, to prevent unauthorized users 
    76     from messing with your subscriptions and breaking stuff.  
     74   8.   This version of Gregarius comes with default password 
     75    protection, however you may wish to to strengthen it by using 
     76    a .htaccess file.  
    7777         
    78     See http://wiki.gregarius.net/index.php/Password_Protection for 
    79     this purpose. 
     78    See http://wiki.gregarius.net/index.php/Password_Protection 
     79    for this purpose. 
  • branches/postgresql/admin/channels.php

    r1284 r1393  
    240240    case 'LBL_ADMIN_ADD': 
    241241    case 'Add': 
    242  
    243         $label = trim($_REQUEST['new_channel']); 
    244         $fid = trim(sanitize($_REQUEST['add_channel_to_folder'], RSS_SANITIZER_SIMPLE_SQL | RSS_SANITIZER_NO_SPACES)); 
     242     
     243        $label  = trim(sanitize($_REQUEST['new_channel'], RSS_SANITIZER_URL)); 
     244        $fid        = trim(sanitize($_REQUEST['add_channel_to_folder'], RSS_SANITIZER_SIMPLE_SQL | RSS_SANITIZER_NO_SPACES)); 
    245245        list($flabel) = rss_fetch_row(rss_query( 
    246246          "select name from " . getTable('folders') . " where id=$fid")); 
     
    431431 
    432432 
    433         if (array_key_exists('opml',$_REQUEST) && strlen(trim($_REQUEST['opml'])) > 7) { 
    434             $url = trim( sanitize($_REQUEST['opml'],RSS_SANITIZER_NO_SPACES) ); 
     433        if (array_key_exists('opml',$_POST) && strlen(trim($_POST['opml'])) > 7) { 
     434            $url = trim( sanitize($_POST['opml'],RSS_SANITIZER_NO_SPACES) ); 
    435435        } 
    436436        elseif (array_key_exists('opmlfile',$_FILES) && $_FILES['opmlfile']['tmp_name']) { 
     
    451451 
    452452 
    453         if (array_key_exists('opml_import_option',$_REQUEST)) { 
    454             $import_opt = $_REQUEST['opml_import_option']; 
     453        if (array_key_exists('opml_import_option',$_POST)) { 
     454            $import_opt = $_POST['opml_import_option']; 
    455455        } else { 
    456456            $import_opt = CST_ADMIN_OPML_IMPORT_MERGE; 
     
    458458 
    459459        if ($import_opt == CST_ADMIN_OPML_IMPORT_FOLDER) { 
    460             $opmlfid = sanitize($_REQUEST['opml_import_to_folder'], RSS_SANITIZER_NUMERIC); 
     460            $opmlfid = sanitize($_POST['opml_import_to_folder'], RSS_SANITIZER_NUMERIC); 
    461461        } else { 
    462462            $opmlfid = getRootFolder(); 
     
    481481                $fid = $opmlfid; 
    482482 
    483                 $prev_folder = rss_fetch_row(rss_query( 
     483                list($prev_folder) = rss_fetch_row(rss_query( 
    484484                                                 "select name from " .getTable('folders') 
    485485                                                 ." where id= $opmlfid ")); 
     
    494494            while (list($folder,$items) = each ($opml)) { 
    495495                if ($folder != $prev_folder && $import_opt != CST_ADMIN_OPML_IMPORT_FOLDER) { 
    496                     $fid = create_folder($folder, false); 
    497                     $prev_folder = $folder; 
     496                    $fid = create_folder(strip_tags($folder), false); 
     497                    $prev_folder = strip_tags($folder); 
    498498                } 
     499 
    499500 
    500501                for ($i=0;$i<sizeof($opml[$folder]);$i++) { 
     
    508509                    $descr_ = isset($opml[$folder][$i]['DESCRIPTION'])? 
    509510                              trim($opml[$folder][$i]['DESCRIPTION']):null; 
    510                     if ($url_) { 
    511                         echo "<li><p>" . sprintf(LBL_ADMIN_OPML_IMPORT_FEED_INFO,$title_,$prev_folder); 
     511                               
     512                    $t__ = strip_tags($title_); 
     513                    $d__ = strip_tags($descr_); 
     514                    $f__ = strip_tags($prev_folder); 
     515                    $u__ = sanitize($url_,RSS_SANITIZER_URL); 
     516 
     517                    if ($u__) { 
     518 
     519                        echo "<li><p>" . sprintf(LBL_ADMIN_OPML_IMPORT_FEED_INFO,$t__,$f__); 
    512520                        flush(); 
    513                         list($retcde, $retmsg) = add_channel($url_, $fid, $title_, $descr_); 
     521                        list($retcde, $retmsg) = add_channel($u__, $fid, $t__, $d__); 
    514522                        echo ($retcde<0 ?$retmsg:" OK")."</p></li>\n"; 
    515523                        flush(); 
     
    535543        rss_plugin_hook('rss.plugins.admin.feed.properties.submit', null); 
    536544        // TBD 
    537         $title= rss_real_escape_string(real_strip_slashes($_POST['c_name'])); 
     545        $title= strip_tags(rss_real_escape_string(real_strip_slashes($_POST['c_name']))); 
    538546        $url= rss_real_escape_string($_POST['c_url']); 
    539547        $siteurl= rss_real_escape_string($_POST['c_siteurl']); 
    540548        $parent= rss_real_escape_string($_POST['c_parent']); 
    541         $descr= rss_real_escape_string(real_strip_slashes($_POST['c_descr'])); 
     549        $descr= strip_tags(rss_real_escape_string(real_strip_slashes($_POST['c_descr']))); 
    542550        $icon = rss_real_escape_string($_POST['c_icon']); 
    543551        $priv = (array_key_exists('c_private',$_POST) && $_POST['c_private'] == '1'); 
  • branches/postgresql/admin/config.php

    r1284 r1393  
    3232    ."<div id=\"admin_config\" class=\"trigger\">\n"; 
    3333 
    34     echo "<table id=\"configtable\">\n" 
    35     ."<tr>\n" 
     34    config_table_header(); 
     35 
     36    $sql = "select * from " .getTable("config") ." where key_ like 
     37           'rss.%' order by key_ asc"; 
     38 
     39    $res = rss_query($sql); 
     40    $cntr = 0; 
     41    while ($row = rss_fetch_assoc($res)) { 
     42        // Don't show old/moved config keys in the main config list 
     43        if ($row['key_'] == 'rss.config.plugins' or 
     44                $row['key_'] == 'rss.output.theme' or 
     45                $row['key_'] == 'rss.output.barefrontpage' or 
     46                $row['key_'] == 'rss.output.noreaditems' or 
     47                $row['key_'] == 'rss.output.cachedir' or 
     48                $row['key_'] == 'rss.config.showdevloglink' or 
     49                $row['key_'] == 'rss.output.numitemsonpage') { 
     50            continue; 
     51        } 
     52 
     53        $class_ = (($cntr++ % 2 == 0)?"even":"odd"); 
     54        config_table_row($row, $class_, CST_ADMIN_DOMAIN_CONFIG); 
     55    } 
     56 
     57    config_table_footer(); 
     58    echo "</div>\n"; 
     59} 
     60 
     61function config_table_header($caption=null) { 
     62    echo "<table id=\"configtable\">\n"; 
     63    if ($caption !== null) { 
     64        echo "<caption>$caption</caption>\n"; 
     65    } 
     66    echo "<tr>\n" 
    3667    ."\t<th>". LBL_ADMIN_CHANNELS_HEADING_KEY ."</th>\n" 
    3768    ."\t<th>". LBL_ADMIN_CHANNELS_HEADING_VALUE ."</th>\n" 
     
    3970    ."\t<th class=\"cntr\">". LBL_ADMIN_CHANNELS_HEADING_ACTION ."</th>\n" 
    4071    ."</tr>\n"; 
    41  
    42     $sql = "select * from " .getTable("config") ." where key_ like 
    43            'rss.%' order by key_ asc"; 
    44  
    45     $res = rss_query($sql); 
    46     $cntr = 0; 
    47     while ($row = rss_fetch_assoc($res)) { 
    48         $value =  real_strip_slashes($row['value_']); 
    49         $class_ = (($cntr++ % 2 == 0)?"even":"odd"); 
    50  
    51         // Fix for #279. Plugins have their own section. 
    52         if ($row['key_'] == 'rss.config.plugins' or $row['key_'] == 
    53                 'rss.output.theme' or $row['key_'] == 'rss.output.barefrontpage' 
    54                 or $row['key_'] == 'rss.output.noreaditems' or $row['key_'] == 'rss.output.numitemsonpage') { 
    55             continue; 
    56         } 
    57  
    58         echo "<tr class=\"$class_\">\n" 
    59         ."\t<td>".$row['key_']."</td>\n"; 
    60  
    61         echo "\t<td>"; 
    62  
    63         switch($row['key_']) { 
    64  
    65             //specific handling per key 
    66         case 'rss.config.dateformat': 
    67             echo $value 
    68             . " (" 
    69             . preg_replace('/ /','&nbsp;',date($value)) 
    70             .")"; 
    71             break; 
    72         case 'rss.input.allowed': 
    73  
     72} 
     73 
     74function config_table_footer() { 
     75    echo "</table>"; 
     76} 
     77 
     78function config_table_row($row, $class_, $adminDomain, $extraLinkText='') { 
     79    $value =  real_strip_slashes($row['value_']); 
     80 
     81    echo "<tr class=\"$class_\">\n" 
     82    ."\t<td>".$row['key_']."</td>\n"; 
     83 
     84    echo "\t<td>"; 
     85 
     86    switch($row['key_']) { 
     87 
     88        //specific handling per key 
     89    case 'rss.config.dateformat': 
     90        echo $value 
     91        . " (" 
     92        . preg_replace('/ /','&nbsp;',date($value)) 
     93        .")"; 
     94        break; 
     95    case 'rss.input.allowed': 
     96 
     97        $arr = unserialize($value); 
     98        echo admin_kses_to_html($arr); 
     99 
     100        break; 
     101    case 'rss.config.plugins': 
     102    case 'rss.output.theme': 
     103        continue; 
     104        break; 
     105 
     106    case 'rss.output.lang': 
     107        $arr = getLanguages(); 
     108        echo $arr[getConfig('rss.output.lang')]; 
     109        break; 
     110    case 'rss.config.tzoffset': 
     111        echo $value 
     112        . " (your local time: " 
     113        . preg_replace('/ /','&nbsp;',date("g:i A",mktime()+$value*3600)) 
     114        .")"; 
     115        break; 
     116    default: 
     117 
     118        // generic handling per type: 
     119        switch ($row['type_']) { 
     120        case 'string': 
     121        case 'num': 
     122        case 'boolean': 
     123        default: 
     124            echo $value; 
     125            break; 
     126        case 'enum': 
     127            $arr = explode(',',$value); 
     128 
     129            echo admin_enum_to_html($arr); 
     130 
     131            break; 
     132        case 'array': 
    74133            $arr = unserialize($value); 
    75             echo admin_kses_to_html($arr); 
    76  
    77             break; 
    78         case 'rss.config.plugins': 
    79         case 'rss.output.theme': 
    80             continue; 
    81             break; 
    82  
    83         case 'rss.output.lang': 
    84             $arr = getLanguages(); 
    85             echo $arr[getConfig('rss.output.lang')]; 
    86             break; 
    87         case 'rss.config.tzoffset': 
    88             echo $value 
    89             . " (your local time: " 
    90             . preg_replace('/ /','&nbsp;',date("g:i A",mktime()+$value*3600)) 
    91             .")"; 
    92             break; 
    93         case 'rss.output.cachedir': 
    94             echo $value; 
    95             if (!is_writable($value)) { 
    96                 echo "<br />" 
    97                 ."<span class=\"error\">Warning: this isn't a writable directory!</span>"; 
     134            echo "<ul>\n"; 
     135            foreach($arr as $av) { 
     136                echo "\t<li>$av</li>\n"; 
    98137            } 
    99             break; 
    100         default: 
    101  
    102             // generic handling per type: 
    103             switch ($row['type_']) { 
    104             case 'string': 
    105             case 'num': 
    106             case 'boolean': 
    107             default: 
    108                 echo $value; 
    109                 break; 
    110             case 'enum': 
    111                 $arr = explode(',',$value); 
    112                 echo admin_enum_to_html($arr); 
    113  
    114                 break; 
    115             case 'array': 
    116                 $arr = unserialize($value); 
    117                 echo "<ul>\n"; 
    118                 foreach($arr as $av) { 
    119                     echo "\t<li>$av</li>\n"; 
    120                 } 
    121                 echo "</ul>\n"; 
    122             } 
    123             break; 
    124         } 
    125  
    126         echo "</td>\n"; 
    127  
    128         echo "\t<td>" . 
    129         // source: http://ch2.php.net/manual/en/function.preg-replace.php 
    130         preg_replace('/\s(\w+:\/\/)(\S+)/', 
    131                      ' <a href="\\1\\2">\\1\\2</a>', 
    132                      $row['desc_']) 
    133         . "</td>\n"; 
    134  
    135         echo "\t<td class=\"cntr\">" 
    136         ."<a href=\"".$_SERVER['PHP_SELF']. "?".CST_ADMIN_DOMAIN."=". CST_ADMIN_DOMAIN_CONFIG 
    137         ."&amp;action=". CST_ADMIN_EDIT_ACTION. "&amp;key=".$row['key_'] 
    138         ."&amp;".CST_ADMIN_VIEW."=". CST_ADMIN_DOMAIN_CONFIG 
    139         ."\">" . LBL_ADMIN_EDIT 
     138            echo "</ul>\n"; 
     139        } 
     140        break; 
     141    } 
     142 
     143    echo "</td>\n"; 
     144 
     145    echo "\t<td>" . 
     146    // source: http://ch2.php.net/manual/en/function.preg-replace.php 
     147    preg_replace('/\s(\w+:\/\/)(\S+)/', 
     148                 ' <a href="\\1\\2">\\1\\2</a>', 
     149                 $row['desc_']) 
     150    . "</td>\n"; 
     151 
     152    echo "\t<td class=\"cntr\">" 
     153    ."<a href=\"".$_SERVER['PHP_SELF']. "?".CST_ADMIN_DOMAIN."=". $adminDomain 
     154    ."&amp;action=". CST_ADMIN_EDIT_ACTION. "&amp;key=".$row['key_'] 
     155    ."&amp;".CST_ADMIN_VIEW."=". $adminDomain 
     156    ."$extraLinkText\">" . LBL_ADMIN_EDIT 
     157    ."</a>"; 
     158 
     159    if ($row['value_'] != $row['default_'] && $row['key_'] != 'rss.config.plugins') { 
     160        echo "|" 
     161 
     162        ."<a href=\"".$_SERVER['PHP_SELF']. "?".CST_ADMIN_DOMAIN."=". $adminDomain 
     163        ."&amp;action=". CST_ADMIN_DEFAULT_ACTION. "&amp;key=".$row['key_']."$extraLinkText\">" . LBL_ADMIN_DEFAULT 
    140164        ."</a>"; 
    141  
    142         if ($row['value_'] != $row['default_'] && $row['key_'] != 'rss.config.plugins') { 
    143             echo "|" 
    144  
    145             ."<a href=\"".$_SERVER['PHP_SELF']. "?".CST_ADMIN_DOMAIN."=". CST_ADMIN_DOMAIN_CONFIG 
    146             ."&amp;action=". CST_ADMIN_DEFAULT_ACTION. "&amp;key=".$row['key_']."\">" . LBL_ADMIN_DEFAULT 
    147             ."</a>"; 
    148         } 
    149  
    150         echo "</td>\n" 
    151         ."</tr>\n"; 
    152  
    153     } 
    154     echo "</table>"; 
    155     echo "</div>\n"; 
     165    } 
     166 
     167    echo "</td>\n" 
     168    ."</tr>\n"; 
    156169} 
    157170 
     
    185198        } 
    186199 
    187         switch ($type) { 
    188         case 'enum': 
    189             $html_default = admin_enum_to_html(explode(',',$default)); 
    190             break; 
    191         case 'array': 
    192             $html_default = admin_kses_to_html(unserialize($default)); 
    193             break; 
    194         default: 
    195             $html_default = $default; 
    196             break; 
    197         } 
    198  
    199200        if (array_key_exists(CST_ADMIN_CONFIRMED,$_POST) && $_POST[CST_ADMIN_CONFIRMED] == LBL_ADMIN_YES) { 
    200201            rss_query("update " . getTable('config') ." set value_=default_ where key_='$key'" ); 
     
    205206        } 
    206207        else { 
    207  
    208             echo "<form class=\"box\" method=\"post\" action=\"" .$_SERVER['PHP_SELF'] ."\">\n" 
    209             ."<p class=\"error\">"; 
    210             printf(LBL_ADMIN_ARE_YOU_SURE_DEFAULT,$key,$html_def