[44] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | /* ----- Access validation ----- */
|
---|
| 4 |
|
---|
| 5 | if ($user_level < 6) die ( __('Cheatin’ uh?') );
|
---|
| 6 |
|
---|
| 7 | if(!defined('PBA_DIRECTORY')) {
|
---|
| 8 | echo "<h1>Parteibuch Aggregator</h1><br><br>Please <a href='plugins.php'>activate</a> the Parteibuch RSS Aggregator plugin before trying to use it";
|
---|
| 9 | return false;
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | /* ----- Admin functions and initialisation ----- */
|
---|
| 13 |
|
---|
| 14 | function bdpSetFeed($sitelist='')
|
---|
| 15 | {
|
---|
| 16 | global $bdprss_db;
|
---|
| 17 |
|
---|
| 18 | $sitelist = trim($sitelist);
|
---|
| 19 | if($sitelist == '')
|
---|
| 20 | return '<div class="wrap"><h3>Warning</h3>No RSS site was specified\n</div>';
|
---|
| 21 |
|
---|
| 22 | $sites = preg_split("'[ \n\t\r]+'", $sitelist, -1, PREG_SPLIT_NO_EMPTY); // space separated list
|
---|
| 23 |
|
---|
| 24 | // we start at two so that $bdprss_db->clastpolltime != $bdprss_db->cupdatetime
|
---|
| 25 | $count = 2;
|
---|
| 26 |
|
---|
| 27 | // add to the site list
|
---|
| 28 | foreach($sites as $s)
|
---|
| 29 | {
|
---|
| 30 | $s = trim($s);
|
---|
| 31 |
|
---|
| 32 | if(!$s) continue;
|
---|
| 33 |
|
---|
| 34 | if(!$bdprss_db->is_in_sitetable($s))
|
---|
| 35 | {
|
---|
| 36 | $result = $bdprss_db->insert_in_sitetable($s, $count);
|
---|
| 37 | $count++;
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 | return FALSE;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | function bdpSetFrequency($freq='')
|
---|
| 44 | {
|
---|
| 45 | if(!$freq || !is_int($freq) || $freq<1 || $freq>999)
|
---|
| 46 | $freq = 60; // 60 minutes is the default
|
---|
| 47 | update_option('bdprss_update_frequency', $freq);
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | function bdpDisplayCode($text)
|
---|
| 51 | {
|
---|
| 52 | // Stored in DB Displayed Note
|
---|
| 53 | // -----------------------------------------------------------
|
---|
| 54 | // > > close tag
|
---|
| 55 | // > &gt; right angle bracket
|
---|
| 56 | // " " double quotation mark --> "
|
---|
| 57 | // &nbsp; non breaking space
|
---|
| 58 |
|
---|
| 59 | $text = mb_ereg_replace(''', "'", $text);
|
---|
| 60 | $text = mb_ereg_replace('"', '"', $text);
|
---|
| 61 |
|
---|
| 62 | $text = mb_ereg_replace('&', '&', $text);
|
---|
| 63 |
|
---|
| 64 | $text = mb_ereg_replace("'", ''', $text);
|
---|
| 65 | $text = mb_ereg_replace('"', '"', $text);
|
---|
| 66 | $text = mb_ereg_replace('<', '<', $text);
|
---|
| 67 | $text = mb_ereg_replace('>', '>', $text);
|
---|
| 68 |
|
---|
| 69 | return ($text);
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | global $bdprss_db;
|
---|
| 73 |
|
---|
| 74 | if(!(int) get_option('bdprss_update_frequency')) bdpSetFrequency(); // initialise polling frequency
|
---|
| 75 | if(!(int) get_option('bdprss_keep_howlong')) {
|
---|
| 76 | update_option('bdprss_keep_howlong', 0); // storage in months, 0 = forever
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 |
|
---|
| 80 | /* ----- Capture and process form variables ----- */
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | if( isset($_POST['bdprss_add_feed_button']) )
|
---|
| 84 | {
|
---|
| 85 | $r = bdpSetFeed($_POST['bdprss_new_feed_name']);
|
---|
| 86 | if($r) echo $r;
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | if( isset($_POST['bdprss_change_frequency_button']) )
|
---|
| 90 | {
|
---|
| 91 | bdpSetFrequency((int) $_POST['bdprss_new_frequency']);
|
---|
| 92 |
|
---|
| 93 | $howlong = (int) $_POST['bdprss_keep_howlong'];
|
---|
| 94 | if($howlong <= 0 || $howlong > 999) $howlong = 0; // months, zero default means forever
|
---|
| 95 | update_option('bdprss_keep_howlong', $howlong);
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | if( isset($_POST['pba_edit_options_button']) ){
|
---|
| 99 | $bdprss_db->check_cache($bdprss_db->serverstatus);
|
---|
| 100 | $bdprss_db->check_rewriting($bdprss_db->serverstatus);
|
---|
| 101 | $optionsarray = array();
|
---|
| 102 | if(isset($_POST['pba_options_enable_caching'])){
|
---|
| 103 |
|
---|
| 104 | if($_POST['pba_options_enable_caching'] == 'Y' ) {
|
---|
| 105 | $optionsarray['enable_caching']=array('type' => 'string', 'value' => 'Y', 'notice' => 'user request');
|
---|
| 106 | }elseif($_POST['pba_options_enable_caching'] == 'N' ){
|
---|
| 107 | $optionsarray['enable_caching']=array('type' => 'string', 'value' => 'N', 'notice' => 'user request');
|
---|
| 108 | }elseif($_POST['pba_options_enable_caching'] == 'auto' ){
|
---|
| 109 | $optionsarray['enable_caching']=array('type' => 'string', 'value' => 'auto', 'notice' => 'user request');
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | if($_POST['pba_options_link_rewriting'] == 'Y' ) {
|
---|
| 113 | $optionsarray['enable_rewriting']=array('type' => 'string', 'value' => 'Y', 'notice' => 'user request');
|
---|
| 114 | }elseif($_POST['pba_options_link_rewriting'] == 'N' ){
|
---|
| 115 | $optionsarray['enable_rewriting']=array('type' => 'string', 'value' => 'N', 'notice' => 'user request');
|
---|
| 116 | }elseif($_POST['pba_options_link_rewriting'] == 'auto' ){
|
---|
| 117 | $optionsarray['enable_rewriting']=array('type' => 'string', 'value' => 'auto', 'notice' => 'user request');
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | if(isset($_POST['pba_full_cache_time'])) {
|
---|
| 121 | $optionsarray['full_cache_time']=array('type' => 'int', 'value' => abs(intval($_POST['pba_full_cache_time'])), 'notice' => 'user request');
|
---|
| 122 | }
|
---|
| 123 | if(isset($_POST['pba_kalenderquery_cache_time'])) {
|
---|
| 124 | $optionsarray['kalenderquery_cache_time']=array('type' => 'int', 'value' => abs(intval($_POST['pba_kalenderquery_cache_time'])), 'notice' => 'user request');
|
---|
| 125 | }
|
---|
| 126 | if(isset($_POST['pba_feedlistquery_cache_time'])) {
|
---|
| 127 | $optionsarray['feedlistquery_cache_time']=array('type' => 'int', 'value' => abs(intval($_POST['pba_feedlistquery_cache_time'])), 'notice' => 'user request');
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | if(isset($_POST['pba_options_enable_memtables']) && isset($_POST['old_pba_options_enable_memtables'])) {
|
---|
| 131 |
|
---|
| 132 | if($_POST['pba_options_enable_memtables'] != $_POST['old_pba_options_enable_memtables']
|
---|
| 133 | && $_POST['pba_options_enable_memtables'] != 'auto'){
|
---|
| 134 |
|
---|
| 135 | $memtables=array(
|
---|
| 136 | $bdprss_db->mtablestatus => $bdprss_db->detect_memtable($bdprss_db->mtablestatus),
|
---|
| 137 | $bdprss_db->mitemtable => $bdprss_db->detect_memtable($bdprss_db->mitemtable),
|
---|
| 138 | $bdprss_db->msitetable => $bdprss_db->detect_memtable($bdprss_db->msitetable)
|
---|
| 139 | );
|
---|
| 140 | $tables_need_recreation = false;
|
---|
| 141 | foreach($memtables as $memtablename => $isreallymemtable){
|
---|
| 142 | if($_POST['pba_options_enable_memtables'] == 'Y' && !$isreallymemtable){
|
---|
| 143 | $bdprss_db->droptable($memtablename);
|
---|
| 144 | $try_memtable_creation=true; //try recreate as memtable,
|
---|
| 145 | $tables_need_recreation = true;
|
---|
| 146 | }elseif($_POST['pba_options_enable_memtables'] == 'N' && $isreallymemtable){
|
---|
| 147 | $bdprss_db->droptable($memtablename);
|
---|
| 148 | $try_memtable_creation=false; //recreate as plaintable,
|
---|
| 149 | $tables_need_recreation = true;
|
---|
| 150 | }
|
---|
| 151 | }
|
---|
| 152 | if($tables_need_recreation){
|
---|
| 153 | $bdprss_db->create($try_memtable_creation);
|
---|
| 154 | $bdprss_db->prefill_memtables();
|
---|
| 155 | }
|
---|
| 156 | }
|
---|
| 157 | if($_POST['pba_options_enable_memtables'] == 'Y' ) {
|
---|
| 158 | $optionsarray['enable_memtables']=array('type' => 'string', 'value' => 'Y', 'notice' => 'user request');
|
---|
| 159 | }elseif($_POST['pba_options_enable_memtables'] == 'N' ){
|
---|
| 160 | $optionsarray['enable_memtables']=array('type' => 'string', 'value' => 'N', 'notice' => 'user request');
|
---|
| 161 | }elseif($_POST['pba_options_enable_memtables'] == 'auto' ){
|
---|
| 162 | $optionsarray['enable_memtables']=array('type' => 'string', 'value' => 'auto', 'notice' => 'user request');
|
---|
| 163 | }
|
---|
| 164 | }
|
---|
| 165 |
|
---|
| 166 | if(isset($_POST['pba_options_enable_loaddetection'])) {
|
---|
| 167 | if($_POST['pba_options_enable_loaddetection'] == 'Y' ) {
|
---|
| 168 | $optionsarray['enable_loaddetection']=array('type' => 'string', 'value' => 'Y', 'notice' => 'user request');
|
---|
| 169 | }elseif($_POST['pba_options_enable_loaddetection'] == 'N' ){
|
---|
| 170 | $optionsarray['enable_loaddetection']=array('type' => 'string', 'value' => 'N', 'notice' => 'user request');
|
---|
| 171 | }elseif($_POST['pba_options_enable_loaddetection'] == 'auto' ){
|
---|
| 172 | $optionsarray['enable_loaddetection']=array('type' => 'string', 'value' => 'auto', 'notice' => 'user request');
|
---|
| 173 | }
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | if(isset($_POST['pba_highloadthreshold'])) {
|
---|
| 177 | $pba_checkedhighloadthreshold=abs(intval($_POST['pba_highloadthreshold']));
|
---|
| 178 | if($pba_checkedhighloadthreshold > 0) $optionsarray['highloadthreshold']=array('type' => 'int', 'value' => $pba_checkedhighloadthreshold, 'notice' => 'user request');
|
---|
| 179 | }
|
---|
| 180 |
|
---|
| 181 | if(isset($_POST['pba_clear_cache_now'])) {
|
---|
| 182 | $dummy1="";
|
---|
| 183 | $dummy2="";
|
---|
| 184 | $cachedeletecounter=PBALIB::pba_cache($dummy1, $dummy2, 'clear', '', 'mixed', 180, 'OK');
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | $optionsarray['delete_alldata']=array('type' => 'string', 'value' => 'N', 'notice' => 'user request');
|
---|
| 188 | if(isset($_POST['pba_delete_alldata'])) {
|
---|
| 189 | if($_POST['pba_delete_alldata'] == 'Y' ) {
|
---|
| 190 | $optionsarray['delete_alldata']=array('type' => 'string', 'value' => 'Y', 'notice' => 'user request');
|
---|
| 191 | }
|
---|
| 192 | }
|
---|
| 193 |
|
---|
| 194 | }
|
---|
| 195 | $success=$bdprss_db->setoptions($optionsarray);
|
---|
| 196 | $bdprss_db->check_options($bdprss_db->serverstatus);
|
---|
| 197 | $bdprss_db->check_cache($bdprss_db->serverstatus);
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 |
|
---|
| 201 | if( isset($_POST['bdprss_poll_all_button']) )
|
---|
| 202 | {
|
---|
| 203 | $bdprss_db->updateAll();
|
---|
| 204 | }
|
---|
| 205 |
|
---|
| 206 | if( isset($_POST['bdprss_edit_site_button']) )
|
---|
| 207 | {
|
---|
| 208 | $siteArray = array();
|
---|
| 209 |
|
---|
| 210 | $siteArray['csitenameoverride'] = 'N';
|
---|
| 211 | if(isset($_POST['bdprss_csitenameoverride'])
|
---|
| 212 | && $_POST['bdprss_csitenameoverride'] == 'Y'
|
---|
| 213 | ) $siteArray['csitenameoverride'] = 'Y';
|
---|
| 214 |
|
---|
| 215 | $siteArray['cidentifier'] = $_POST['bdprss_cidentifier'];
|
---|
| 216 | $siteArray['csitename'] = BDPFeed::title_recode($_POST['bdprss_csitename']);
|
---|
| 217 | $siteArray['csiteurl'] = BDPFeed::title_recode($_POST['bdprss_csiteurl']);
|
---|
| 218 | $siteArray['cdescription'] = mb_substr(BDPFeed::title_recode($_POST['bdprss_cdescription']), 0, 250);
|
---|
| 219 | $siteArray['csitelicense'] = mb_substr(BDPFeed::title_recode($_POST['bdprss_csitelicense']), 0, 250);
|
---|
| 220 | $siteArray['cgmtadjust'] = floatval($_POST['bdprss_cgmtadjust']);
|
---|
| 221 |
|
---|
| 222 | $cpollingfreqmins = intval($_POST['bdprss_cpollingfreqmins']);
|
---|
| 223 | if($cpollingfreqmins < 0 || $cpollingfreqmins > 1000000) $cpollingfreqmins = 0;
|
---|
| 224 | $siteArray['cpollingfreqmins'] = $cpollingfreqmins ;
|
---|
| 225 |
|
---|
| 226 | if(isset($_POST['pba_cnewnextpolltime'])
|
---|
| 227 | && $_POST['pba_cnewnextpolltime'] =! "") {
|
---|
| 228 | $siteArray['cnextpolltime'] = abs(intval($_POST['pba_cnewnextpolltime']));
|
---|
| 229 | if( $siteArray['cnextpolltime'] > 2147483647 ) unset($siteArray['cnextpolltime']);
|
---|
| 230 | }
|
---|
| 231 |
|
---|
| 232 | //do we want to change he feed url?
|
---|
| 233 | if(isset($_POST['bdprss_cnewfeedurl'])
|
---|
| 234 | && isset($_POST['bdprss_coldfeedurl'])
|
---|
| 235 | && $_POST['bdprss_cnewfeedurl'] != ""
|
---|
| 236 | && $_POST['bdprss_cnewfeedurl'] != $_POST['bdprss_coldfeedurl']
|
---|
| 237 | ) {
|
---|
| 238 | $pba_change_feed_to=$_POST['bdprss_cnewfeedurl'];
|
---|
| 239 | $pba_do_feedurlupdate=$bdprss_db->update_feedurl($siteArray['cidentifier'], $pba_change_feed_to);
|
---|
| 240 | if($pba_do_feedurlupdate) $siteArray['cfeedurl'] = $pba_change_feed_to;
|
---|
| 241 | }
|
---|
| 242 |
|
---|
| 243 | $bdprss_db->updateTable($bdprss_db->sitetable, $siteArray, 'cidentifier');
|
---|
| 244 | //mem table
|
---|
| 245 | $bdprss_db->updateTable($bdprss_db->msitetable, $siteArray, 'cidentifier');
|
---|
| 246 |
|
---|
| 247 |
|
---|
| 248 | //add or remove this site to or from lists
|
---|
| 249 | $listresult = $bdprss_db->get_all_lists();
|
---|
| 250 | if($listresult) {
|
---|
| 251 | foreach($listresult as $list) {
|
---|
| 252 | $listArray = array();
|
---|
| 253 | $listid = $list->{$bdprss_db->lidentifier};
|
---|
| 254 | $lurllist= ',' . $list->{$bdprss_db->lurls} . ',';
|
---|
| 255 | if(isset($_POST['pba_site_included_in_list_'.$listid])
|
---|
| 256 | && $_POST['pba_site_included_in_list_'.$listid] == 'Y'
|
---|
| 257 | ){
|
---|
| 258 | //make sure this site is included in the list
|
---|
| 259 | if(!strstr($lurllist, ','.$siteArray['cidentifier'].',')){
|
---|
| 260 | //adding this site to this list needed
|
---|
| 261 | $listArray['lidentifier'] = $listid;
|
---|
| 262 | $listArray['lurls'] = trim($list->{$bdprss_db->lurls} . ',' . $siteArray['cidentifier'],',');
|
---|
| 263 | }
|
---|
| 264 | }else{
|
---|
| 265 | //make sure this site is not included in the list
|
---|
| 266 | if(strstr($lurllist, ','.$siteArray['cidentifier'].',')){
|
---|
| 267 | //removing this site from this list needed
|
---|
| 268 | $listArray['lidentifier'] = $listid;
|
---|
| 269 | $listArray['lurls'] = trim(str_replace(','.$siteArray['cidentifier'].',',',',$lurllist),',');
|
---|
| 270 | }
|
---|
| 271 | } // end if(isset($_POST['pba_site_included
|
---|
| 272 | if(isset($listArray['lidentifier'])) $bdprss_db->updateTable($bdprss_db->listtable, $listArray, 'lidentifier');
|
---|
| 273 |
|
---|
| 274 | } // end foreach($listresult as $list)
|
---|
| 275 | } // end if($listresult)
|
---|
| 276 | } // end if( isset($_POST['bdprss_edit_site_button']) )
|
---|
| 277 |
|
---|
| 278 | if( isset($_POST['bdprss_edit_list_button']) )
|
---|
| 279 | {
|
---|
| 280 | $listArray = array();
|
---|
| 281 |
|
---|
| 282 | $listArray['lidentifier'] = $_POST['bdprss_lidentifier'];
|
---|
| 283 | $listArray['lname'] = htmlspecialchars($_POST['bdprss_lname']);
|
---|
| 284 |
|
---|
| 285 | // booleans
|
---|
| 286 | $llistall = 'N';
|
---|
| 287 | if(isset($_POST['bdprss_llistall'])) $llistall = $_POST['bdprss_llistall'];
|
---|
| 288 | if($llistall != 'Y') $llistall = 'N';
|
---|
| 289 | $listArray['llistall'] = $llistall;
|
---|
| 290 |
|
---|
| 291 | $lurls = '';
|
---|
| 292 | $result = $bdprss_db->get_all_sites();
|
---|
| 293 | if($result)
|
---|
| 294 | {
|
---|
| 295 | $subsequent = false;
|
---|
| 296 | foreach($result as $r)
|
---|
| 297 | {
|
---|
| 298 | $id = $r->{$bdprss_db->cidentifier};
|
---|
| 299 | $url = $r->{$bdprss_db->cfeedurl};
|
---|
| 300 |
|
---|
| 301 | $feed = 'bdprss_feed_' . $id;
|
---|
| 302 | if( isset($_POST[$feed]) )
|
---|
| 303 | {
|
---|
| 304 | if($subsequent) $lurls .= ',';
|
---|
| 305 | $subsequent = true;
|
---|
| 306 | $lurls .= $id;
|
---|
| 307 | }
|
---|
| 308 | }
|
---|
| 309 | }
|
---|
| 310 | $listArray['lurls'] = $lurls;
|
---|
| 311 |
|
---|
| 312 | $bdprss_db->updateTable($bdprss_db->listtable, $listArray, 'lidentifier');
|
---|
| 313 | }
|
---|
| 314 |
|
---|
| 315 | if( isset($_POST['pba_edit_output_button']) )
|
---|
| 316 | {
|
---|
| 317 | //Format: $pbaoutputArray['bdprssdb: this->table_column_namedefinition']= $_POST['name of field in form'];
|
---|
| 318 |
|
---|
| 319 | $pbaoutputArray = array();
|
---|
| 320 | $pbaoutputArray['pbaoidentifier'] = $_POST['pbaoidentifier'];
|
---|
| 321 | $pbaoutputArray['pbaoname'] = htmlspecialchars($_POST['pbaoname']);
|
---|
| 322 | $pbaoutputArray['pbaopage2hookin'] = abs(intval($_POST['pbaopage2hookin']));
|
---|
| 323 |
|
---|
| 324 | //item formatting
|
---|
| 325 | $pbaoutputArray['pbaodefaultlist'] = $_POST['pbaodefaultlist'];
|
---|
| 326 | $pbaoutputArray['pbaomaxitems'] = $_POST['pbaomaxitems'];
|
---|
| 327 | $pbaoutputArray['pbaoformattype'] = $_POST['pbaoformattype'];
|
---|
| 328 |
|
---|
| 329 | $pbaoutputArray['pbaotemplate_ticker'] = $_POST['pbaotemplate_ticker'];
|
---|
| 330 |
|
---|
| 331 | //if set to N, php will throw out a notice, because $_POST['pbaoappend_extra_link'] does not exist
|
---|
| 332 | $pbaoutputArray['pbaoappend_extra_link'] = $_POST['pbaoappend_extra_link'];
|
---|
| 333 | if($pbaoutputArray['pbaoappend_extra_link'] != 'Y') $pbaoutputArray['pbaoappend_extra_link'] = 'N';
|
---|
| 334 |
|
---|
| 335 | $pbaoutputArray['pbaoappend_cache_link'] = 'Y';
|
---|
| 336 | if(!isset($_POST['pbaoappend_cache_link']) || $pbaoutputArray['pbaoappend_cache_link'] != 'Y') $pbaoutputArray['pbaoappend_cache_link'] = 'N';
|
---|
| 337 |
|
---|
| 338 | $pbaoutputArray['pbaoadd_social_bookmarks'] = 'Y';
|
---|
| 339 | if(!isset($_POST['pbaoadd_social_bookmarks']) || $pbaoutputArray['pbaoadd_social_bookmarks'] != 'Y') $pbaoutputArray['pbaoadd_social_bookmarks'] = 'N';
|
---|
| 340 |
|
---|
| 341 | $pbaoutputArray['pbaosidebarwidget'] = $_POST['pbaosidebarwidget'];
|
---|
| 342 |
|
---|
| 343 | $pbaoutputArray['pbaomaxlength'] = abs(intval($_POST['pbaomaxlength']));
|
---|
| 344 | $pbaoutputArray['pbaomaxwordlength'] = abs(intval($_POST['pbaomaxwordlength']));
|
---|
| 345 | $pbaoutputArray['pbaoitem_date_format'] = $_POST['pbaoitem_date_format'];
|
---|
| 346 |
|
---|
| 347 | // $bdprssTagSet is declared in bdp-rss-aggregator before including this file
|
---|
| 348 | $pbaoallowablexhtmltags = '';
|
---|
| 349 | $first = TRUE;
|
---|
| 350 | foreach($bdprssTagSet as $key => $value)
|
---|
| 351 | {
|
---|
| 352 | $tag = BDPRSS2::tagalise($key);
|
---|
| 353 | if(isset($_POST[$tag]))
|
---|
| 354 | {
|
---|
| 355 | if(!$first) $pbaoallowablexhtmltags .= ',';
|
---|
| 356 | $pbaoallowablexhtmltags .= $key;
|
---|
| 357 | $first = FALSE;
|
---|
| 358 | }
|
---|
| 359 | }
|
---|
| 360 | $pbaoutputArray['pbaoallowablexhtmltags'] = $pbaoallowablexhtmltags;
|
---|
| 361 |
|
---|
| 362 | //cache
|
---|
| 363 | $pbaoutputArray['pbaoiscachable'] = $_POST['pbaoiscachable'];
|
---|
| 364 | $pbaoutputArray['otemplate_cache'] = $_POST['pba_otemplate_cache'];
|
---|
| 365 | $pbaoutputArray['pbaocacheviewpage'] = $_POST['pbaocacheviewpage'];
|
---|
| 366 |
|
---|
| 367 | //feed
|
---|
| 368 | $pbaoutputArray['pba_channel_title'] = $_POST['pba_channel_title'];
|
---|
| 369 | $pbaoutputArray['pba_channel_link'] = $_POST['pba_channel_link'];
|
---|
| 370 | $pbaoutputArray['pba_channel_description'] = $_POST['pba_channel_description'];
|
---|
| 371 | $pbaoutputArray['pba_channel_language'] = $_POST['pba_channel_language'];
|
---|
| 372 | $pbaoutputArray['pba_channel_copyright'] = $_POST['pba_channel_copyright'];
|
---|
| 373 |
|
---|
| 374 | //kalender
|
---|
| 375 | $pbaoutputArray['otemplate_kalender'] = $_POST['pba_otemplate_kalender'];
|
---|
| 376 | $pbaoutputArray['oarchive_date_format'] = $_POST['pba_oarchive_date_format'];
|
---|
| 377 | $pbaoutputArray['okalendermonthslist'] = $_POST['pba_okalendermonthslist'];
|
---|
| 378 | $pbaoutputArray['okalenderboxtablecaption'] = $_POST['pba_okalenderboxtablecaption'];
|
---|
| 379 | $pbaoutputArray['okalender_last'] = $_POST['pba_okalender_last'];
|
---|
| 380 | $pbaoutputArray['okalender_next'] = $_POST['pba_okalender_next'];
|
---|
| 381 | $pbaoutputArray['okalenderboxdaysofweeklist'] = $_POST['pba_okalenderboxdaysofweeklist'];
|
---|
| 382 |
|
---|
| 383 | $pbaoutputArray['pbao_superparameter'] = $_POST['pbao_superparameter'];
|
---|
| 384 |
|
---|
| 385 | $bdprss_db->updateTable($bdprss_db->pbaoutputtable, $pbaoutputArray, 'pbaoidentifier');
|
---|
| 386 | }
|
---|
| 387 |
|
---|
| 388 | /* ----- Capture and process calling arguments ----- */
|
---|
| 389 |
|
---|
| 390 | $argumentSet = array('action', 'rss', 'list', 'pboutput');
|
---|
| 391 | for ($i = 0; $i < count($argumentSet); $i++)
|
---|
| 392 | {
|
---|
| 393 | $variable = $argumentSet[$i];
|
---|
| 394 | if (!isset($$variable)) // don't override if already set
|
---|
| 395 | {
|
---|
| 396 | if (!empty($_POST[$variable]))
|
---|
| 397 | $$variable = $_POST[$variable];
|
---|
| 398 | elseif (!empty($_GET[$variable]))
|
---|
| 399 | $$variable = $_GET[$variable];
|
---|
| 400 | else
|
---|
| 401 | $$variable = '';
|
---|
| 402 | }
|
---|
| 403 | }
|
---|
| 404 |
|
---|
| 405 | $editpbaoutput=false;
|
---|
| 406 | $editlist = false;
|
---|
| 407 | $editfeed = false;
|
---|
| 408 | $errorlist = false;
|
---|
| 409 | $options = false;
|
---|
| 410 | $status = false;
|
---|
| 411 |
|
---|
| 412 | switch($action)
|
---|
| 413 | {
|
---|
| 414 | case 'update':
|
---|
| 415 | $r = $bdprss_db->get_site_by_id($rss);
|
---|
| 416 | if($r) BDPRSS2::update($r);
|
---|
| 417 | break;
|
---|
| 418 |
|
---|
| 419 | case 'delete':
|
---|
| 420 | $bdprss_db->deleteFeed($rss);
|
---|
| 421 | break;
|
---|
| 422 |
|
---|
| 423 | case 'createlist':
|
---|
| 424 | if($list){
|
---|
| 425 | $list = abs(intval($list));
|
---|
| 426 | $list = $bdprss_db->createlist($list);
|
---|
| 427 | }else{
|
---|
| 428 | $list = $bdprss_db->createlist();
|
---|
| 429 | }
|
---|
| 430 | $editlist = true;
|
---|
| 431 | // no break - flows into editlist
|
---|
| 432 |
|
---|
| 433 | case 'editlist':
|
---|
| 434 | $editlist = true;
|
---|
| 435 | break;
|
---|
| 436 |
|
---|
| 437 | case 'createpbaoutput':
|
---|
| 438 | if($pboutput){
|
---|
| 439 | $pboutput = abs(intval($pboutput));
|
---|
| 440 | $pboutput = $bdprss_db->createpbaoutput($pboutput);
|
---|
| 441 | }else{
|
---|
| 442 | $pboutput = $bdprss_db->createpbaoutput();
|
---|
| 443 | }
|
---|
| 444 | $editpbaoutput = true;
|
---|
| 445 | // no break - flows into editpbaoutput
|
---|
| 446 |
|
---|
| 447 | case 'editpbaoutput':
|
---|
| 448 | $editpbaoutput = true;
|
---|
| 449 | break;
|
---|
| 450 |
|
---|
| 451 | case 'errorlist':
|
---|
| 452 | $errorlist = true;
|
---|
| 453 | break;
|
---|
| 454 |
|
---|
| 455 | case 'errordelete':
|
---|
| 456 | $bdprss_db->deleteErrorTable($rss);
|
---|
| 457 | break;
|
---|
| 458 |
|
---|
| 459 | case 'editfeed':
|
---|
| 460 | $editfeed = true;
|
---|
| 461 | break;
|
---|
| 462 |
|
---|
| 463 | case 'dellist':
|
---|
| 464 | if($list) $bdprss_db->deletelist($list);
|
---|
| 465 | break;
|
---|
| 466 |
|
---|
| 467 | case 'delpbaoutput':
|
---|
| 468 | if($pboutput) $bdprss_db->deletepbaoutput($pboutput);
|
---|
| 469 | break;
|
---|
| 470 |
|
---|
| 471 | case 'options':
|
---|
| 472 | $options = true;
|
---|
| 473 | break;
|
---|
| 474 |
|
---|
| 475 | case 'status':
|
---|
| 476 | $status = true;
|
---|
| 477 | break;
|
---|
| 478 | }
|
---|
| 479 |
|
---|
| 480 | $selfreference = get_option('siteurl') . '/wp-admin/edit.php?page=' .PBA_DIRECTORY. '/bdp-rssadmin.php';
|
---|
| 481 |
|
---|
| 482 | /* ----- Drop in the appropriate administration page ----- */
|
---|
| 483 |
|
---|
| 484 | echo "<div class='wrap'>\n";
|
---|
| 485 |
|
---|
| 486 | if ($editpbaoutput && $pboutput)
|
---|
| 487 | {
|
---|
| 488 | include (dirname(__FILE__)."/pba-admin-output.php");
|
---|
| 489 | }
|
---|
| 490 | elseif ($editlist && $list)
|
---|
| 491 | {
|
---|
| 492 | include (dirname(__FILE__)."/bdp-rssadmin-edit.php");
|
---|
| 493 | }
|
---|
| 494 | elseif ($editfeed && $rss)
|
---|
| 495 | {
|
---|
| 496 | include (dirname(__FILE__)."/bdp-rssadmin-sno.php");
|
---|
| 497 | }
|
---|
| 498 | elseif ($errorlist)
|
---|
| 499 | {
|
---|
| 500 | include (dirname(__FILE__)."/bdp-rssadmin-error.php");
|
---|
| 501 | }
|
---|
| 502 | elseif ($options)
|
---|
| 503 | {
|
---|
| 504 | include (dirname(__FILE__)."/pba-admin-options.php");
|
---|
| 505 | }
|
---|
| 506 | elseif ($status)
|
---|
| 507 | {
|
---|
| 508 | include (dirname(__FILE__)."/pba-admin-status.php");
|
---|
| 509 | }
|
---|
| 510 | else
|
---|
| 511 | include (dirname(__FILE__)."/bdp-rssadmin-general.php");
|
---|
| 512 |
|
---|
| 513 | echo '<p align="center"> <br />This page was brought to you by the<br />'.
|
---|
| 514 | '<a href="http://www.mein-parteibuch.com/blog/parteibuch-aggregator/">'.
|
---|
| 515 | '<strong>' .PBA_PRODUCT. ' version ' .PBA_VERSION. "</strong></a></p>\n";
|
---|
| 516 |
|
---|
| 517 | echo "</div>\n";
|
---|
| 518 | ?>
|
---|