Donate Share

lylina rss/atom aggregator

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

Patches for PHP 5 errors on v1.20

You are viewing a single message from this topic. View all messages.

  1. 2007-10-12 15:54:40 UTC
    I noted in this post (same forum) https://sourceforge.net/forum/forum.php?thread_id=1551048&forum_id=526567
    That the OP had a number of PHP errors thrown. Most, if not all, were related to conditional tests against variables/references that were not set. The newer error_reporting profiles in default for PHP 5+ tend to report more errors of this nature. The application generally works, but these errors are a nuisance. In some cases, however, the OP showed that the headers were being prematurely written to present the error message, which fouled up other headers and broke stuff. I've made patches to 4 files attached inline using "diff -u" format.

    The files in the 'upload/' folder are the original files from lylina v1.20
    The files in the '../docs/' folder are my mods
    Be sure to omit my "===================================" lines if you are applying these diffs!

    ======================================================================
    --- upload/index.php 2006-04-30 13:45:36.000000000 -0500
    +++ ../docs/index.php 2007-10-12 10:46:55.000000000 -0500
    @@ -46,7 +46,8 @@
    $UID = 0;

    if($conf['mode'] == 'normal' || $conf['mode'] == 'single' || ($conf['mode'] == 'login' && $UID != 0)) {
    - printItems($UID,$_REQUEST['hours']);
    + if (isset($_REQUEST['hours'])) {$hoursfix=$_REQUEST['hours'];} else {$hoursfix='';}
    + printItems($UID,$hoursfix);
    if($conf['sources'] == 'true') printSources($UID);
    }
    ==========================================================================
    --- upload/fetch.php 2006-04-30 13:52:12.000000000 -0500
    +++ ../docs/fetch.php 2007-10-10 17:57:11.000000000 -0500
    @@ -32,7 +32,7 @@
    // exit;
    //}

    -$fp = fopen('lockfile',w) or die($lang['lockdir']);
    +$fp = fopen('lockfile',"w") or die($lang['lockdir']);
    flock($fp,LOCK_EX) or die($lang['lockdir']);

    if (!extension_loaded('mysql')){
    @@ -68,10 +68,10 @@
    }

    foreach($rss->items as $item){
    - if(!$item['date_timestamp'])
    + if( (!isset($item['date_timestamp'])) || (!$item['date_timestamp']))
    $item['date_timestamp'] = time();

    - if(!$item['summary'])
    + if( (!isset($item['summary'])) || (!$item['summary']) )
    $item['summary'] = '';

    $sql = "INSERT IGNORE INTO lylina_items
    ==========================================================================
    --- upload/edit.php 2006-04-02 14:32:42.000000000 -0500
    +++ ../docs/edit.php 2007-10-10 13:09:34.000000000 -0500
    @@ -38,7 +38,8 @@

    html_head(false,"preferences");

    -switch($_REQUEST['do']) {
    +if (isset($_REQUEST['do'])) {
    + switch($_REQUEST['do']) {
    case 'user':
    removeUser($_REQUEST['ruid']);
    break;
    @@ -64,6 +65,7 @@
    feedSub($UID,$_REQUEST['fid']);
    break;
    default:
    + }
    }

    print '<div class="prefs">';
    @@ -89,14 +91,14 @@

    if($UID == 1 && $conf['mode'] != 'login' && $conf['mode'] != 'single') {
    print '<img src="img/view.png"> '.$lang['view'].': ';
    - if($main == 1)
    + if((isset($main)) && ($main == 1))
    print '<a href="edit.php">'.$lang['persfeeds'].'</a> <a href="edit.php?main=1"><strong>'.$lang['mainfeeds'].'</strong></a>';
    else
    print '<a href="edit.php"><strong>'.$lang['persfeeds'].'</strong></a> <a href="edit.php?main=1">'.$lang['mainfeeds'].'</a>';

    }

    -if($UID == 1 && $main == 1 && $conf['mode'] != 'login' || $conf['mode'] == 'single')
    +if($UID == 1 && (isset($main)) && $main == 1 && $conf['mode'] != 'login' || $conf['mode'] == 'single')
    listSubscribedFeeds(0);
    else
    listSubscribedFeeds($UID);
    ===========================================================
    --- upload/inc/auth.php 2006-03-30 21:42:14.000000000 -0600
    +++ ../docs/inc/auth.php 2007-10-12 10:21:56.000000000 -0500
    @@ -38,8 +38,11 @@
    }

    function checkAuthToken() {
    - $uid = $_COOKIE['lylina_uid'];
    - $rnd = $_COOKIE['lylina_auth'];
    + $uid='';
    + $rnd='';
    +
    + if (isset($_COOKIE['lylina_uid'])) { $uid = $_COOKIE['lylina_uid'];}
    + if (isset($_COOKIE['lylina_auth'])) { $rnd = $_COOKIE['lylina_auth'];}

    if(!$rnd || !$uid) return 0;

    @@ -55,9 +58,9 @@
    }

    function checkAuth($request) {
    - if($request['logout'])
    + if((isset($request['logout'])) && ($request['logout']))
    $UID = logout();
    - elseif($request['u'])
    + elseif( (isset($request['u'])) && ($request['u']) )
    $UID = login($request['u'],$request['p']);
    else
    $UID = checkAuthToken();
    ======================================================================



< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.