Changeset 175 for dev/mods/feed_syndication/settings.php
- Timestamp:
- 01/11/07 13:45:30 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/mods/feed_syndication/settings.php
r170 r175 2 2 ////// 3 3 ////// ////// 4 ////// liq's feed syndication mod v1. 44 ////// liq's feed syndication mod v1.5 5 5 //////////// 6 6 //////////// … … 13 13 define( MASTER, 0 ); 14 14 15 $version = "v1.5"; 15 16 @set_time_limit(0); 16 require_once( "feed_fetcher.php");17 require_once( "common/class.page.php");18 require_once( "common/admin_menu.php");17 require_once( 'feed_fetcher.php' ); 18 require_once( 'common/class.page.php' ); 19 require_once( 'common/admin_menu.php' ); 19 20 require_once( 'common/class.corp.php' ); 20 21 require_once( 'common/class.alliance.php' ); 21 22 22 $page = new Page( "Administration - Feed Syndication v1.4" ); 23 24 $page = new Page( "Administration - Feed Syndication " . $version ); 25 $page->setCachable(false); 23 26 $page->setAdmin(); 24 27 25 28 $validurl = "/^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}((:[0-9]{1,5})?\/.*)?$/i"; 29 $html .= "<script language=\"JavaScript\">function checkAll(checkname, exby) {for (i = 0; i < checkname.length; i++)checkname[i].checked = exby.checked? true:false}</script>"; 26 30 $html .= "<table class=kb-subtable>"; 31 32 //checking for updated versions 33 $versionserver = "http://tomx.org/feed/version.txt"; 34 if ( fopen($versionserver, "r") ) { 35 $versionfile = fopen($versionserver, "r"); 36 $remoteversion = fread($versionfile, 4); 37 fclose($versionfile); 38 if ( $remoteversion != $version ) 39 $html .= '<div class="kl-loss"><b>Your version ('.$version.') is outdated! </b></div><br>There is a newer version ('.$remoteversion.') available <a href="http://tomx.org/feed/mod_feed_'.$remoteversion.'.zip"><b>here</b></a>. <br>Please update!<br><br>'; 40 } else 41 $html .= '<div class="kl-loss">Cant retrieve version information from: '.$versionserver.'</div><br><br>'; 27 42 28 43 if (getConfig('fetch_feed_count')) … … 31 46 $feedcount = 3; 32 47 48 //saving urls and options 33 49 if ( $_POST['submit'] || $_POST['fetch'] ) { 34 50 if ( ctype_digit($_POST['fetch_feed_count']) && $_POST['fetch_feed_count'] > 0) { … … 56 72 for ($i = 1; $i<=$feedcount; $i++) { 57 73 $url = "fetch_url_".$i; 58 $friends = $_POST["friend_".$i];59 74 if ( preg_match($validurl ,$_POST[$url]) ) { 75 if ( $_POST['friend'] && in_array ($i, $_POST['friend']) ) 76 $friends = "on"; 77 else $friends = ""; 60 78 setConfig($url, $_POST[$url].':::'.$time[$i].':::'.$friends); 61 79 $feed[$i] = $_POST[$url]; … … 71 89 $feed[$i] = $tmp[0]; 72 90 $time[$i] = $tmp[1]; 73 $friend[$i] = $tmp[2]; 91 if ( $tmp[2] == "on") 92 $friend[$i] = $tmp[2]; 74 93 } 94 95 //building the request query and fetching of the feeds 75 96 if ( $_POST['fetch'] ) { 76 97 if (CORP_ID && !MASTER) { … … 85 106 $feedfetch = new Fetcher(); 86 107 $cfg = "fetch_url_".$i; 87 if ( preg_match($validurl , $feed[$i]) && $_POST["fetch_feed_".$i]) {108 if ( preg_match($validurl , $feed[$i]) && $_POST['fetch_feed'] && in_array ($i, $_POST['fetch_feed']) ) { 88 109 $str = ''; 89 110 //if ($time[$i]) … … 114 135 } 115 136 } 116 117 $html .= "<form id=options name=options method=post action=?a=settings_feed_syndication>";137 //generating the html 138 $html .= '<form id="options" name="options" method="post" action="?a=settings_feed_syndication">'; 118 139 $html .= "</table>"; 119 140 … … 123 144 if ( $feed[$i] ) 124 145 $html .= $feed[$i]; 125 $html .= "\"> "; 126 $html .= "<input type=checkbox name=friend_".$i." id=friend_".$i; 146 $html .= "\"></td>"; 147 148 $html .= "<td><input type=checkbox name=friend[] id=friend value=".$i; 127 149 if ( $friend[$i] ) 128 150 $html .= " checked=\"checked\""; 129 $html .= "><b>Friend?</b>"; 130 $html .= "<input type=checkbox name=fetch_feed_".$i." id=fetch_feed_".$i; 151 $html .= "><b>Friend?</b></td>"; 152 153 $html .= "<td><input type=checkbox name=fetch_feed[] id=fetch value=".$i; 131 154 if ( $feed[$i] ) 132 155 $html .= " checked=\"checked\""; … … 134 157 $html .= "</td></tr>"; 135 158 } 136 $html .= "</table><i>Example: http://killboard.eve-d2.com/?a=feed</i><br><br><br>"; 137 159 $html .= '<tr><td colspan=2><i>Example: http://killboard.eve-d2.com/?a=feed</i></td><td>'; 160 $html .= '<input type="checkbox" name="all" onclick="checkAll(this.form.friend,this)"><i>all/none</i></td><td>'; 161 $html .= '<input type="checkbox" name="all" onclick="checkAll(this.form.fetch,this)"><i>all/none</i>'; 162 $html .= "</td></tr><br></table><br><br><br>"; 163 138 164 $html .= "<table><tr><td height=20px width=150px><b>First week:</b></td>"; 139 165 $html .= '<td><select name="range1">'; 140 166 $now = date("W"); 141 for ($i = 1; $i<=52; $i++) { 167 for ($i = 1; $i<=52; $i++) { 142 168 if ( $now == $i ) 143 169 $html .= '<option selected="selected "value="'.$i.'">'.$i.'</option>'; … … 149 175 $html .= "<tr><td height=20px width=150px><b>Last week:</b></td>"; 150 176 $html .= '<td><select name="range2">'; 151 for ($i = 52; $i>=1; $i--) {177 for ($i = 1; $i<=52; $i++) { 152 178 if ( $now == $i ) 153 179 $html .= '<option selected="selected "value="'.$i.'">'.$i.'</option>'; … … 160 186 $html .= "<tr><td height=20px width=150px><b>Year:</b></td>"; 161 187 $html .= '<td><select name="year">'; 188 $html .= '<option "value="2005">2005</option>'; 189 $html .= '<option "value="2006">2006</option>'; 190 $html .= '<option selected="selected "value="2007">2007</option>'; 191 $html .= '<option "value="2008">2008</option>'; 162 192 $html .= '<option "value="2009">2009</option>'; 163 $html .= '<option "value="2008">2008</option>';164 $html .= '<option selected="selected "value="">2007</option>';165 $html .= '<option "value="2006">2006</option>';166 $html .= '<option "value="2005">2005</option>';167 193 $html .= '</select>'; 168 194 $html .= "</td></tr>"; … … 175 201 $html .= "<div class=block-header2>Options</div><table>"; 176 202 $html .= "<tr><td height=30px width=150px><b>Number of feeds:</b></td>"; 177 $html .= "<td><input type=text name=fetch_feed_count size=2 maxlength=2 class=password value=\"".$feedcount."\" </td></tr>";203 $html .= "<td><input type=text name=fetch_feed_count size=2 maxlength=2 class=password value=\"".$feedcount."\"></td></tr>"; 178 204 $html .= "<tr><td height=50px width=150px><b>Comment for automatically parsed killmails?</b></td>"; 179 205 $html .= "<td><input type=text size=50 class=password name=fetch_comment id=fetch_comment value=\"";