Show
Ignore:
Timestamp:
01/11/07 13:45:30 (14 years ago)
Author:
liq
Message:

liliq's feed syndication mod 1.5

Location:
dev/mods/feed_syndication
Files:
1 added
1 removed
3 modified

Legend:

Unmodified
Added
Removed
  • dev/mods/feed_syndication/feed_fetcher.php

    r170 r175  
    22        ////// 
    33//////  ////// 
    4 //////  liq's feed syndication mod v1.4 
     4//////  liq's feed syndication mod v1.5 
    55//////////// 
    66//////////// 
  • dev/mods/feed_syndication/readme.txt

    r170 r175  
    11        ////// 
    22//////  ////// 
    3 //////  liq's feed syndication mod v1.4 
     3//////  liq's feed syndication mod v1.5 
    44//////////// 
    55//////////// 
     
    1111//INSTALLATION: 
    1212 
    13 ### --> STANDALONE version: 
     13 
     14 
     15##### --> STANDALONE version: 
     16 
     17 
    14181. put all files in your /common directory 
    1519 
    16202. add the following line to common/admin_menu.php: 
    1721$menubox->addOption( "Feeds", "?a=admin_feed" ); 
    18 or if you use eve-dev kilboard version 1.2.0 and above (using smarty templates): 
     22OR if you use eve-dev kilboard version 1.2.0 and above (using smarty templates): 
    1923$menubox->addOption("link", "Feeds", "?a=admin_feed"); 
    2024 
     
    2428 
    2529 
    26 ### --> MOD version: 
    27 1. create directory mods/feed 
     30 
     31 
     32###### --> MOD version: 
     33 
     34 
     351. create directory mods/feed_syndication 
    2836 
    29372. put the files settings.php and feed_fetcher.php in /mods/feed_syndication directory. 
     
    37455. click 'Settings' in the 'Mods' menu to access the feed interface 
    3846 
    39 additionally you can add the following line to common/admin_menu.php for direct access: 
    40 $menubox->addOption( "Feeds", "?a=settings_feed" ); 
    41 or if you use eve-dev kilboard version 1.2.0 and above (using smarty templates): 
    42 $menubox->addOption("link", "Feeds", "?a=settings_feed"); 
     47additionally you can add the following line to common/admin_menu.php for faster access: 
     48$menubox->addOption( "Feeds", "?a=settings_feed_syndication" ); 
     49OR if you use eve-dev kilboard version 1.2.0 and above (using smarty templates): 
     50$menubox->addOption("link", "Feeds", "?a=settings_feed_syndication"); 
    4351 
    4452 
     
    5866-> enter feed urls in the format: http://killboard.eve-d2.com/?a=feed 
    5967 
     68-> if you enter a feed from a friendly corp/alliance have the 'friends' box checked else you will only be able to fetch friendly fire kills 
     69 
    6070-> a list of known feeds can be found here: http://myeve.eve-online.com/ingameboard.asp?a=topic&threadID=443506&page=1#2 
    6171 
     
    6979** be patient. don't close your browser, don't reload. after doing a full fetch first, weekly updates are totally sufficient to keep your board uptodate ** 
    7080 
    71  
    7281-> by default their kills aka. your losses get fetched unless you tick the 'get kills' 
    7382option in which case their losses aka. your kills get fetched 
    7483 
    7584-> GZip compression is enabled by default because the board automatically 
    76 checks and decides if a fetched stream supports GZip compression - if not it uses regular html/rss output. 
    77  
     85checks and decides if a fetched stream supports GZip compression - if not, it uses regular html/rss output. leave this enabled. 
    7886 
    7987-> if you are running a master killboard (eg. to supply and share killdata with other killboards) edit settings.php and set 'MASTER' to 1. 
     
    8795 
    8896 
     97 
    8998//VERSION CHANGES: 
     99//v1.5 
     100 
     101feed.php: 
     102- no changes 
     103 
     104feed_fetcher.php: 
     105- no changes 
     106 
     107admin_feed.php / settings.php 
     108- added a version check (checks my server for the actual version of the mod and gives you an update link if the versions differ) 
     109- added 'select all/none' boxes for the friends and fetch checkbox rows, pretty handy with large feedlists 
     110- fixed small bug with the timeframe selection options and a html bug 
    90111 
    91112 
  • dev/mods/feed_syndication/settings.php

    r170 r175  
    22        ////// 
    33//////  ////// 
    4 //////  liq's feed syndication mod v1.4 
     4//////  liq's feed syndication mod v1.5 
    55//////////// 
    66//////////// 
     
    1313define( MASTER, 0 ); 
    1414 
     15$version = "v1.5"; 
    1516@set_time_limit(0); 
    16 require_once( "feed_fetcher.php" ); 
    17 require_once( "common/class.page.php" ); 
    18 require_once( "common/admin_menu.php" ); 
     17require_once( 'feed_fetcher.php' ); 
     18require_once( 'common/class.page.php' ); 
     19require_once( 'common/admin_menu.php' ); 
    1920require_once( 'common/class.corp.php' ); 
    2021require_once( 'common/class.alliance.php' ); 
    2122 
    22         $page = new Page( "Administration - Feed Syndication v1.4" ); 
     23 
     24        $page = new Page( "Administration - Feed Syndication " . $version ); 
     25        $page->setCachable(false); 
    2326        $page->setAdmin(); 
    2427 
    2528        $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>"; 
    2630        $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>'; 
    2742 
    2843        if (getConfig('fetch_feed_count')) 
     
    3146                $feedcount = 3; 
    3247 
     48        //saving urls and options 
    3349        if ( $_POST['submit'] || $_POST['fetch']  ) { 
    3450                        if ( ctype_digit($_POST['fetch_feed_count']) && $_POST['fetch_feed_count'] > 0) { 
     
    5672                for ($i = 1; $i<=$feedcount; $i++) { 
    5773                        $url = "fetch_url_".$i; 
    58                         $friends = $_POST["friend_".$i]; 
    5974                        if ( preg_match($validurl ,$_POST[$url]) ) { 
     75                                if ( $_POST['friend'] && in_array ($i, $_POST['friend']) )  
     76                                         $friends = "on"; 
     77                                else $friends = ""; 
    6078                                setConfig($url, $_POST[$url].':::'.$time[$i].':::'.$friends); 
    6179                                $feed[$i] = $_POST[$url]; 
     
    7189                $feed[$i] = $tmp[0]; 
    7290                $time[$i] = $tmp[1]; 
    73                 $friend[$i] = $tmp[2]; 
     91                if ( $tmp[2] == "on") 
     92                  $friend[$i] = $tmp[2]; 
    7493        } 
     94         
     95        //building the request query and fetching of the feeds 
    7596        if ( $_POST['fetch'] ) { 
    7697         if (CORP_ID && !MASTER) { 
     
    85106                        $feedfetch = new Fetcher(); 
    86107                        $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']) ) { 
    88109                            $str = ''; 
    89110                                //if ($time[$i]) 
     
    114135                } 
    115136        } 
    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">'; 
    118139    $html .= "</table>"; 
    119140 
     
    123144        if ( $feed[$i] ) 
    124145           $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; 
    127149                if ( $friend[$i] ) 
    128150                        $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; 
    131154        if ( $feed[$i] ) 
    132155                        $html .= " checked=\"checked\""; 
     
    134157                $html .= "</td></tr>"; 
    135158        } 
    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         
    138164    $html .= "<table><tr><td height=20px width=150px><b>First week:</b></td>"; 
    139165        $html .= '<td><select name="range1">'; 
    140166        $now = date("W"); 
    141         for ($i = 1; $i<=52; $i++) { 
     167        for ($i = 1; $i<=52; $i++) {  
    142168                if ( $now == $i ) 
    143169                        $html .= '<option selected="selected "value="'.$i.'">'.$i.'</option>';   
     
    149175        $html .= "<tr><td height=20px width=150px><b>Last week:</b></td>"; 
    150176        $html .= '<td><select name="range2">'; 
    151         for ($i = 52; $i>=1; $i--) { 
     177        for ($i = 1; $i<=52; $i++) {  
    152178                if ( $now == $i ) 
    153179                        $html .= '<option selected="selected "value="'.$i.'">'.$i.'</option>';   
     
    160186        $html .= "<tr><td height=20px width=150px><b>Year:</b></td>"; 
    161187        $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>';  
    162192        $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>';  
    167193        $html .= '</select>';    
    168194    $html .= "</td></tr>"; 
     
    175201        $html .= "<div class=block-header2>Options</div><table>"; 
    176202        $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>"; 
    178204        $html .= "<tr><td height=50px width=150px><b>Comment for automatically parsed killmails?</b></td>"; 
    179205        $html .= "<td><input type=text size=50 class=password name=fetch_comment id=fetch_comment value=\"";