source: trunk/www.guidonia.net/wp/wp-content/plugins/parteibuch-aggregator/pba-admin-status.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 8.1 KB
Line 
1<?php
2
3if ($user_level < 6) die ( __('Cheatin&#8217; uh?') );
4
5global $bdprss_db, $bdprss_search;
6
7$pbastartconfig=0;
8if(isset($_POST['pbstart'])){
9 $pbastartconfig=abs(intval($_POST['pbstart']));
10}elseif(isset($_GET['pbstart'])){
11 $pbastartconfig=abs(intval($_GET['pbstart']));
12}
13
14
15//let's check if basic functionality is working
16$pba_wp_pages=$bdprss_db->get_wp_published_pages();
17$pba_all_outputs=$bdprss_db->get_all_pbaoutputs();
18
19if(isset($pba_all_outputs[0]->page2hookin)) {
20 $pba_page_hooked_in['id']=$pba_all_outputs[0]->page2hookin;
21 //echo '<br>We hooked into page: ' . $pba_page_hooked_in['id'];
22 if($pba_page_hooked_in['id'] > 0){
23 //let's get some more information about that page
24 foreach($pba_wp_pages as $page_index => $pba_wp_page){
25 //print_r($pba_wp_page);
26 if($pba_wp_page->ID == $pba_page_hooked_in['id']){
27 $pba_page_hooked_in['title']=preg_replace(array('/"/',"/'/"), array('&quot;','&#39;'), $pba_wp_page->post_title);
28 //echo '<br>Title of that page is: ' . $pba_page_hooked_in['title'];
29 $pba_page_hooked_in['guid']=$pba_wp_page->guid;
30 //echo '<br>guid of that page is: ' . $pba_page_hooked_in['guid'];
31 }
32 }
33 if(function_exists('get_page_link')) {
34 $pba_page_href = get_page_link($pba_page_hooked_in['id']);
35 //echo '<br>href to that page is: ' . $pba_page_href;
36 }elseif(isset($pba_page_hooked_in['guid'])){
37 $pba_page_href = $pba_page_hooked_in['guid'];
38 }
39 }// end if isset($pba_all_outputs[0]->page2hookin)
40 //check if we get output
41 $pba_whileloopcounter=1;
42 while ($pba_whileloopcounter <= 3) {
43 $pba_whileloopcounter++;
44 $pba_config['outputid']=$pba_all_outputs[0]->identifier;
45 $pba_config["maxitems"]=1;
46 if($pbastartconfig==0) $pba_config['listid']=0;
47 $pba_result=@PBA::outputwrapper($pba_config);
48 $pba_found_items=$pba_result['founditems'];
49 if($pba_found_items > 1){
50 //echo "You have already " . $pba_found_items . " items in your Aggregator.";
51 break;
52 }else{
53 echo '<p>Please be patient for a minute. The Parteibuch Aggregator tries to poll some feeds for you.</p>';
54 flush();
55 $bdprss_db->updateAll();
56 }
57 }// end while loop
58} // end if isset($pba_all_outputs[0]->page2hookin)
59
60if($pbastartconfig == 1 && $pba_found_items > 0){
61 $bdprss_db->process_new();
62 echo '<h2>Congratulations!</h2>';
63}else{
64 echo '<h2>Programmer&#39;s hell - Status page of the <a href="edit.php?page=parteibuch-aggregator/bdp-rssadmin.php">Parteibuch Aggregator</a> plugin</h2>';
65}
66
67echo '<table width="100%" cellspacing="2" cellpadding="5" class="editform">';
68
69if($pbastartconfig == 1 && $pba_found_items > 0){
70
71 echo '<tr valign="top">
72 <td align="left" colspan="2"><h4>You successfully managed to install and configure the <a href="edit.php?page=parteibuch-aggregator/bdp-rssadmin.php">Parteibuch Aggregator</a> plugin.</h4>';
73
74 echo '<br><br>Your Parteibuch Aggregator aggregated already ' . $pba_found_items . ' items.';
75
76 echo '<br><br><b>So what&#39;s next?</b>';
77
78 if(isset($pba_page_href)){
79 echo '<br><br>Maybe you want to see your RSS page "'.$pba_page_hooked_in['title'].'"? So check it out <a target="_blank" title="Opens in new window: &quot;'.$pba_page_hooked_in['title'].'&quot;with output collected by the Parteibuch Aggregator" href="'.$pba_page_href.'">here</a>. Does it fit your likings? Fine.
80
81 <br><br>Or do you want to change the layout of the output? If so, go into <a title="Modify configuration of output #1" href="edit.php?page=parteibuch-aggregator/bdp-rssadmin.php&action=editpbaoutput&pboutput=1">additional parameters of the output</a> and modify it.';
82 }
83 if(isset($pba_all_outputs[0])){
84 echo '<br><br>Maybe you want to show RSS headlines in the sidebar of your blog? So just <a title="Put a RSS Aggregator widget into your sidebar" href="widgets.php">take the RSS Aggregator widget</a>.';
85
86 echo "<br><br>Maybe you don't use widgets and you want to add the Parteibuch Aggregator sidebar code manually to your sidebar? <br/>
87 So here is the code to add to your sidebar:<br/><br/>
88 \$pba_config['outputid']=1; <br/>
89 \$pba_config['show_sidebarwidget'] = 'Y'; <br/>
90 \$pba_return=@PBA::outputwrapper(\$pba_config); <br/>
91 echo \$pba_return['result'];";
92 }
93
94 echo '<br><br>Maybe you want to add your favorite feeds to your aggregator or find out about the options of your aggregator? So just go to your <a title="Go to Parteibuch Aggregator management page" href="edit.php?page=parteibuch-aggregator/bdp-rssadmin.php">Parteibuch Aggregator management page</a>.';
95
96//print_r($pba_all_outputs);
97//print_r($pba_wp_pages);
98
99 echo '</td>
100 </tr>';
101} elseif($pbastartconfig == 1) {
102 echo '<tr valign="top">';
103 echo '<td align="left" colspan="2"><h2>Oops, what&#39;s going on here?</h2>';
104 echo '<br><br>You successfully installed the Parteibuch Aggregator, but we can&#39;t find any aggregated items. It may happen that the feed we tried to poll is just not available or not readable at the moment. We recommend <a title="Add your favorite feeds to your RSS Aggregator" href="edit.php?page=parteibuch-aggregator/bdp-rssadmin.php#addfeeds">to add your favorite feeds</a> or just wait for some hours until the preinstalled feed become readable again.';
105 echo '</td>
106 </tr>';
107
108}else{
109 echo '<tr valign="top">';
110 echo '<td align="left" colspan="2"><h4>Some basic information</h4>';
111 echo '</td>
112 </tr>';
113
114echo '<tr valign="top">
115 <td width="40%" align="right">
116 Available items:&nbsp;
117 </td>
118 <td>
119 '.$pba_found_items .'
120 </td>
121 </tr>';
122
123 echo '<tr valign="top">';
124 echo '<td align="left" colspan="2"><h4>Information on hooked pages</h4>';
125 echo '</td>
126 </tr>';
127
128 foreach($pba_all_outputs as $pba_output_index => $pba_all_output){
129 $pageshookedin[$pba_all_output->page2hookin]=$pba_all_output->identifier;
130 }
131
132 foreach($pba_wp_pages as $page_index => $pba_wp_page){
133 if(isset($pageshookedin[$pba_wp_page->ID])){
134 echo '<tr valign="top">
135 <td width="40%" align="right">
136 Page '.$pba_wp_page->ID.':&nbsp;
137 </td>
138 <td>
139 hooked by Output ID '.$pageshookedin[$pba_wp_page->ID] .'
140 </td>
141 </tr>';
142 } //end if isset($pageshookedin[$pba_wp_page->ID])
143 } // end foreach($pba_wp_pages as $page_index => $pba_wp_page)
144
145 echo '<tr valign="top">';
146 echo '<td align="left" colspan="2"><h4>Information about serverstatus variable</h4>';
147 echo '</td>
148 </tr>';
149
150 foreach($bdprss_db->serverstatus as $stproperty => $stvalue){
151 echo '<tr valign="top">
152 <td width="40%" align="right">
153 &quot;'.$stproperty.'&quot;:&nbsp;
154 </td>
155 <td>
156 '.PBALIB::get_r($stvalue) .'
157 </td>
158 </tr>';
159 }
160
161 echo '<tr valign="top">';
162 echo '<td align="left" colspan="2"><h4>Information from options table</h4>';
163 echo '</td>
164 </tr>';
165
166 foreach($bdprss_db->get_all_options() as $optionkey => $optionvalue){
167 foreach($optionvalue as $optionkey => $optionvaltmp){
168 if($optionkey != 'name') $optionvaltmp2[$optionkey] = $optionvaltmp;
169 }
170 echo '<tr valign="top">
171 <td width="40%" align="right">
172 Option &quot;'.$optionvalue->name.'&quot;:&nbsp;
173 </td>
174 <td>
175 '.PBALIB::get_r($optionvaltmp2) .'
176 </td>
177 </tr>';
178 } // end foreach($bdprss_db->get_all_options() as $optionkey => $optionvalue)
179
180 echo '<tr valign="top">';
181 echo '<td align="left" colspan="2"><h4>Information about the Parteibuch Aggregator database tables</h4>';
182 echo '</td>
183 </tr>';
184
185 $pba_tables=$bdprss_db->list_all_tables();
186 foreach($pba_tables as $pba_table => $dummy){
187 $tablestatus=$bdprss_db->get_mysql_tablestatus($pba_table);
188 echo '<tr valign="top">
189 <td width="40%" align="right">
190 Table &quot;'.$pba_table.'&quot;:&nbsp;
191 </td>
192 <td>
193 '.PBALIB::get_r($tablestatus) .'
194 </td>
195 </tr>';
196 }//end foreach pba tables
197
198 echo '<tr valign="top">';
199 echo '<td align="left" colspan="2"><h4>Information on wordpress rewrite rules option setting</h4>';
200 echo '</td>
201 </tr>';
202
203 echo '<tr valign="top">';
204 echo '<td align="left" colspan="2">';
205 echo "This blog's wordpress option rewrite_rules is set to: " . str_replace("\n",'<br>',PBALIB::get_r(get_option('rewrite_rules')));
206 echo '</td>
207 </tr>';
208
209
210 echo '<tr valign="top">';
211 echo '<td align="left" colspan="2"><br><br><b>I have seen enough about this hell, let me out here going <a href="' . $selfreference . '">back to the Parteibuch Aggregator admin page</a></b>';
212 echo '</td>
213 </tr>';
214
215}//end no pbstart
216
217echo '</table>';
218
219//echo 'pbastartconfig is: ' . $pbastartconfig;
220
221?>
Note: See TracBrowser for help on using the repository browser.