Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RN Bug Reports - Other Issues
Author Message
ozbutcher
Worker
Worker



Joined: Jan 17, 2007
Posts: 170

PostPosted: Tue Apr 17, 2007 11:45 pm Reply with quote

I haven't used this feature since 2.02 but today when I checked my journal using RN 2.10 this error shows in the box where as user replied to my journal:

Code:
Warning: stripos() expects parameter 1 to be string, array given in /mounted-storage/home---/----/----/burnt-clan.com/mainfile.php on line 117
 
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Wed Apr 18, 2007 5:22 am Reply with quote

and when you upgraded did you also uploaded all files etc related to journal ?
 
View user's profile Send private message
ozbutcher







PostPosted: Wed Apr 18, 2007 5:26 am Reply with quote

yes I did. the replies are visible but this error message is also mixed into it. I checked a bit further and other regular journal posts also show this message.
 
hitwalker







PostPosted: Wed Apr 18, 2007 5:28 am Reply with quote

well its not a known issue with rn.
i searched on that...
does the journal work ?
postings etc...?

do you have error report ON by any chance ?
if so...turn it OFF.
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Wed Apr 18, 2007 6:58 am Reply with quote

There were some changes made to the Journal to get it to work properly with the advanced editor, so two things to try:

1) Use the advanced editor if you are not already (it really IS nice). You turn this on in rnconfig.php

2) If 1) does not work (let us know if it does), then remove your modules/Journal directory completely and re-upload the files from RN2.10.00.

There were files that were removed and I am not sure if maybe there are some negative interactions that leaving them around might cause.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6437

PostPosted: Wed Apr 18, 2007 4:49 pm Reply with quote

I tested the changes to Journal that were made for the editor, and I don't remember seeing that...

_________________
I search, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
p17blo
Regular
Regular



Joined: Jul 27, 2007
Posts: 77

PostPosted: Thu Aug 09, 2007 9:26 am Reply with quote

Was this ever progress?

I hadn't enabled my Journal before today as I am sytematically going through my system enabling and configuring little bits before progress.

I too have this error - Mine was a clean install of RN 2.1 and I am using the FCKEditor

Paul
 
View user's profile Send private message
montego







PostPosted: Fri Aug 24, 2007 6:06 am Reply with quote

<bump>
 
montego







PostPosted: Wed Oct 31, 2007 6:22 am Reply with quote

BTW, I have re-written some of the Journal module code (needed to get it XHTML compliant anyways) and there were some bugs along the way. Please try it out on http://www.ravennuke.com and let me know what you think.
 
fade2gray
Regular
Regular



Joined: Mar 26, 2006
Posts: 87
Location: UK

PostPosted: Tue Dec 18, 2007 4:32 am Reply with quote

rn2.10.01/php5.2.5

I was getting a similar error being reported @ mainfile.php line 116.

Fixed it with:-
Code:


//$return = stripos($haystack, $needle, $offset=0);
$return = stripos('$haystack', $needle, $offset=0);


Not sure if this is the correct remedy though. Confused
 
View user's profile Send private message Visit poster's website
montego







PostPosted: Tue Dec 18, 2007 6:18 am Reply with quote

No, this is definitely not a remedy. In fact, if you do this, you are basically breaking the function completely because it will never find the $needle within the literal string '$haystack'. This could end up breaking many different uses of this function with RN.

2.2 is due out the first week in Jan, but please, would someone test this issue on http://www.ravennuke.com? Thanks!
 
fade2gray







PostPosted: Wed Dec 19, 2007 4:45 pm Reply with quote

motego wrote:
would someone test this issue on http://www.ravennuke.com? Thanks!
No apparent problem, but is it running on php>=5?

Ok, you prompted me to dig a little deeper.
speedtype
If you're running php>=5, the mainfile.php function check_html() will call for stripos(). The problem is, the parameter passed to stripos(), '$AllowableHTML', is defined as a multidimensional array in config.php.

The solution is to reduce the '$AllowableHTML' array to a simple string.

The following works for me and I believe it to to be a suitable remedy. Wink

Insert these two functions before the closing '?>' at the bottom of mainfile.php:-
Code:
function multi_array_keys($array) {

  foreach($array as $key => $value) {
    $keys[] = $key;
    if (is_array($array[$key])) {
      if (is_array(multi_array_keys($array[$key])))
      $keys = array_merge($keys, multi_array_keys($array[$key]));
    }
  }
  return $keys;
}

function array_to_string($array1,$array2)
{
return $array1 . " " . $array2;
}

Find in mainfile.php:-
Code:
    function stripos_clone($haystack, $needle, $offset=0) {

        $return = stripos($haystack, $needle, $offset=0);
        if ($return === false) {
            return false;
        } else {
            return true;
        }
    }

Replace with:-
Code:
    function stripos_clone($haystack, $needle, $offset=0) {

        if (is_array($haystack))
            $haystack = array_reduce(multi_array_keys($haystack), "array_to_string");
        $return = stripos($haystack, $needle, $offset=0);
        if ($return === false) {
            return false;
        } else {
            return true;
        }
    }

A couple of observations regarding the Journal module:-

In modules/Journal/functions.php, the actions performed by the function ADVT_stripslashes() are performed by mainfile.php/check_html () anyway.

In modules/Journal/language/lang-english.php, the defined constant, '_YOUMUSTBEMEMBER', misspells 'modules.php' as 'module.php', breaking the link to the registration form.

HTH
 
montego







PostPosted: Wed Dec 19, 2007 5:28 pm Reply with quote

What I do not understand is why it works for me just fine on PHP5 and not you. I'll need to look into that function some more. I don't want to have to do this if it is not necessary.

As mentioned above, I have recoded the Journal module for 2.20.00. I got rid of the ADVT- garbage and modified everything to us the nukeWYSIWYG and core mainfile functions.

I'll look into the constant too, just in case I missed that.

THANKS!
 
montego







PostPosted: Wed Dec 19, 2007 5:30 pm Reply with quote

fade2gray, are you running PHP in STRICT mode by chance? Is there anything else that you can tell me about your PHP set up that might be relevant. Feel free to PM me if you would rather. Thanks!
 
fade2gray







PostPosted: Wed Dec 19, 2007 6:50 pm Reply with quote

montego wrote:
fade2gray, are you running PHP in STRICT mode by chance? Is there anything else that you can tell me about your PHP set up that might be relevant. Feel free to PM me if you would rather. Thanks!

I've got a test rig running 5.2.5 locally via xampp 1.6.5 beta 1 - I'm still a real novice regarding php, but would 'mbstring.strict_detection' have anything to do with strict mode (it's OFF by default)?

Edit: xampp security reports 'PHP is NOT running in "safe mode"'. Does that imply not strict mode?
 
montego







PostPosted: Thu Dec 20, 2007 7:56 am Reply with quote

That sure is odd. This is exactly the environment that I re-wrote the Journal module in and I do not see the issue with the check_html(). May I send you all the Journal code and have you test it on your local setup? Just PM me your email address.

No, mbstring is for multi-byte string conversions / functions, so that I don't think has anything to do with it. Your last comment regarding "safe mode" I also believe does not imply strict.

Let us see if the new journal code works better for you... Wink
 
montego







PostPosted: Thu Dec 20, 2007 5:56 pm Reply with quote

On its way...
 
fade2gray







PostPosted: Fri Dec 21, 2007 8:57 pm Reply with quote

No error with the module you sent, but can be replicated. Here's the source of the original problem.

Old display.php
$jbodytext = check_html(ADVT_stripslashes($jbodytext), $AllowableHTML);

Wheras new display.php
$jbodytext = check_html($jbodytext, '');

As mentioned previously, '$AllowableHTML', is defined as a multidimensional array in config.php. It should have either been defined as an empty string (html on) or 'nohtml' (html off).

I've made a small mod allowing journal html to be switched on or off by altering the content of a variable in modules/Journal/functions.php, and if the html is switched off, smilies will be removed from the form.

Shall I post my edits back to you?
 
montego







PostPosted: Fri Dec 21, 2007 10:24 pm Reply with quote

I am confused. You are no longer seeing the error, so I am not clear by what you mean by "but can be replicated"???? Confused

The code in mainfile.php for check_html is:

Code:


function check_html ($string, $allowed_html = '', $allowed_protocols = array('http', 'https', 'ftp', 'news', 'nntp', 'gopher', 'mailto'))
{
    $stop = FALSE;
    if(!function_exists('kses_no_null'))
    {
        @include_once(INCLUDE_PATH.'includes/kses/kses.php');
    }
    if (get_magic_quotes_gpc() == 1)
    {
        $string = stripslashes($string);
    }
    $hotHtml = 'nohtml';
    $Zstrip = stripos_clone($allowed_html, $hotHtml);
    if ($Zstrip === false)
    {
        global $AllowableHTML;
        $allowed_html = $AllowableHTML;
    } else {
        $allowed_html = array('<null>');
    }
    $string = kses_no_null($string);
    $string = kses_js_entities($string);
    $string = kses_normalize_entities($string);
    $string = kses_hook($string);
    $allowed_html_fixed = kses_array_lc($allowed_html);
    return kses_split($string, $allowed_html_fixed, $allowed_protocols);
}


If you look at it closely, it is doing stripos_clone on $allowed_html, which is a string and not an array.

After that if, it becomes an array for the purpose of being passed into the kses functions.

This is perfectly appropriate and works just fine, so i am not getting what the problem is here.
 
fade2gray







PostPosted: Sat Dec 22, 2007 4:14 am Reply with quote

Sorry. What I meant to indicate was that I could reproduce the error by reintroducing the variable $AllowableHTML as the second parameter.

$jbodytext = check_html($jbodytext, '');

$jbodytext = check_html($jbodytext, $AllowableHTML);
 
montego







PostPosted: Sat Dec 22, 2007 8:41 am Reply with quote

Ah, ok, but there is no need to do that. In RN, check_html() decides what to do based on the string value that is passed into that function. It is not intended to pass in an array. I suppose, though, we could trap for that and stop that wrong usage from occurring, but none of the code within RN should be passing an array into that parameter.
 
fade2gray







PostPosted: Sat Dec 22, 2007 10:43 am Reply with quote

fade2gray wrote:
I've made a small mod allowing journal html to be switched on or off by altering the content of a variable in modules/Journal/functions.php, and if the html is switched off, smilies will be removed from the form.

Shall I post my edits back to you?

Not interested?

Looks like Only registered users can see links on this board! Get registered or login!.
 
Gremmie
Former Moderator in Good Standing



Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Sat Dec 22, 2007 10:55 am Reply with quote

check_html gets at the AllowableHTML array by accessing it as a global variable (d'oh). By convention (and a very poor one if you ask me), you are supposed to either pass in '' or 'nohtml' as the second parameter. None of this is documented of course. Did I mention I hate that function? Wink

_________________
Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module 
View user's profile Send private message
montego







PostPosted: Sat Dec 22, 2007 7:42 pm Reply with quote

fade2gray wrote:
fade2gray wrote:
I've made a small mod allowing journal html to be switched on or off by altering the content of a variable in modules/Journal/functions.php, and if the html is switched off, smilies will be removed from the form.

Shall I post my edits back to you?

Not interested?


Fade, feel free to post it in the forums here if you like, although, I would not do so in this thread as I do not feel that it is relevant to this topic (an error that is). But, I have a feeling that what you have suggested is a personal preference and that most folks using RavenNuke would prefer to use the WYSIWYG editor and emoticons. So, not sure about incorporating the feature within RN.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RN Bug Reports - Other Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©