We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41614
    • 4 Posts
    Hello All,

    I was checking a site today and found it down. I was not the original developer of this site, and have little experience with ModX specifically, but do have working knowledge of PHP and other frameworks. Any advice would be appreciated.

    Here's the error message:


    « MODx Parse Error »

    MODx encountered the following error while attempting to parse the requested resource:

    « PHP Parse Error »

    PHP error debug

    Error: Call-time pass-by-reference has been deprecated
    Error type/ Nr.: - 8192
    File: /mnt/stor2-wc1-dfw1/393145/510784/www.tlmassociates.com/web/content/_/modx/plugin.custom_prerender.php
    Line: 7
    Line 7 source: $o = Plugin_Prerender::execute(&$modx->documentOutput);

    Parser timing

    MySQL: 0.2355 s (17 Requests)
    PHP: 0.6666 s
    Total: 0.9021 s
      • 31912 MODX Staff
      • 95 Posts
      Do you know what version of MODX is running on the site? Maybe a recent hosting change, such as a PHP upgrade, broke the install and upgrading to a more recent version will fix it.

      And make sure if this is an Evolution site (not a 2.x) to upgrade to 1.0.6 and not Revolution 2.2.5. There is not an easy/direct upgrade path between the two. [ed. note: waldus68 last edited this post 14 years ago.]
        • 41614
        • 4 Posts
        I'm on the Evolution platform, v 1.0.5.

        I have a feeling that upgrading to 1.0.6 could potentially fix this, I have never performed a ModX upgrade though. I'll give it a try and see what I get. Thanks for replying.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          No, this problem is due to an upgrade of the server's PHP version. You need to go to that file on that line and remove the &.

          That looks like some kind of custom plugin; it's not part of any version of Evo or Revo that I have, anyway. A MODx upgrade certainly won't hurt anything, but it won't help your problem. [ed. note: sottwell last edited this post 14 years ago.]
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 33238
            • 388 Posts
            Quote from: sottwell at Oct 08, 2012, 06:46 PM
            That looks like some kind of custom plugin; it's not part of any version of Evo or Revo that I have, anyway. A MODx upgrade certainly won't hurt anything, but it won't help your problem.

            Yes, in my case the solution was disable the plugins and check which one was the traitor! tongue

            and i found it, it was one to redirect target:_blank the weblinks to point to external url.
            Just check on disable, and everything works perfect!


            /**
             * RC Link Redirector
             * 
             * Plugin that replaces external links to encrypted internal links
             *
             * @category 	plugin
             * @version 	0.8.2+
             * @license 	http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
             * @author      Roland Chanishvili, additions by Temus
             * @internal	@properties &rcr_comment_text=Convert link text;list;true,false;true;&rcr_comment_text_val=Link text;text;[link];&rcr_blank=Add target;list;true,false;true;&rcr_nofollow=Add nofollow;list;true,false;true;&rcr_relink_val=Base link;text;ext;&rcr_noindex=Add noindex;list;true,false;false;&rcr_rel_stop=Use stop rel;list;true,false;false;&rcr_rel_val=Rel;text;&rcr_class_stop=Use stop class;list;true,false;false;&rcr_class_val=Class;text;&rcr_stop=Use stop list;list;true,false;true;&rcr_stop_list=Stop list;textarea;yandex.ru,google.com;
             * @internal	@events OnWebPagePrerender 
             * @internal	@modx_category SEO
             */
            
            /*
            Plugin: RC Link Redirector 0.8.2+
            Created By: Roland Chanishvili (http://chanishvili.org/)
            Adaptation for MODx: Temus ([email protected])
            Events: OnWebPagePrerender
            Configuration:
            &rcr_comment_text=Convert link text;list;true,false;true;
            &rcr_comment_text_val=Link text;text;[link];
            &rcr_blank=Add target;list;true,false;true;
            &rcr_nofollow=Add nofollow;list;true,false;true;
            &rcr_relink_val=Base link;text;ext;
            &rcr_noindex=Add noindex;list;true,false;false;
            &rcr_rel_stop=Use stop rel;list;true,false;false;
            &rcr_rel_val=Rel;text;
            &rcr_class_stop=Use stop class;list;true,false;false;
            &rcr_class_val=Class;text;
            &rcr_stop=Use stop list;list;true,false;true;
            &rcr_stop_list=Stop list;textarea;yandex.ru,google.com;
            */
            
            global $rcr_opt;
            $rcr_opt = array(
            	'rcr_comment_text' => isset($rcr_comment_text)&&($rcr_comment_text=='false') ? 0 : 1, //change link text to comment text
            	'rcr_comment_text_val' => isset($rcr_comment_text_val) ? $rcr_comment_text_val : "[link]", 
            	'rcr_blank' => isset($rcr_blank)&&($rcr_blank=='false') ? 0 : 1, //add target=_blank (except files)
            	'rcr_nofollow' => isset($rcr_nofollow)&&($rcr_nofollow=='false') ? 0 : 1, //add rel=nofollow
            	'rcr_relink_val' => isset($rcr_relink_val) ? $rcr_relink_val : "ext", //base link for redirect
            	'rcr_noindex' => isset($rcr_noindex)&&($rcr_noindex=='true') ? 1 : 0, //add noindex
            	'rcr_rel_stop' => isset($rcr_rel_stop)&&($rcr_rel_stop=='true') ? 1 : 0, //use stop rel value
            	'rcr_rel_val' => isset($rcr_rel_val) ? $rcr_rel_val : "", 
            	'rcr_class_stop' => isset($rcr_class_stop)&&($rcr_class_stop=='true') ? 1 : 0, //use stop CSS class
            	'rcr_class_val' => isset($rcr_class_val) ? $rcr_class_val : "",
            	'rcr_stop' => isset($rcr_stop)&&($rcr_stop=='false') ? 0 : 1, //use stop list
            	'rcr_stop_list' => isset($rcr_stop_list) ? $rcr_stop_list : "yandex.ru,google.com" // stop list
            );
            
            ############### PHP4 compatibility ###############
            if (!function_exists("stripos")) {
            	function stripos($str,$needle,$offset=0)
            	{
            		return strpos(strtolower($str),strtolower($needle),$offset);
            	}
            }
            
            #################### FUNCTIONS ###################
            function rcr_redirect()
            {
            	global $rcr_opt,$modx;
            	$url=$_SERVER['REQUEST_URI'];
            	if(($url[0]!='/') and ($url[strlen($url)]!='/'))return;
            	$uarr=explode("/",$url);
            	if(!isset($rcr_opt['rcr_relink_val'])) return;
            	$incr = 0;
            	foreach ($uarr as $chpu) {
            		if ($chpu == $rcr_opt['rcr_relink_val']) {
            			$todo = '/^.*' . $chpu . '\//';
            			$link = preg_replace($todo,'',$url);
            			$link = str_replace("==/",'==',$link);
            			$rederectlink = html_entity_decode(rcr_crypt(base64_decode($link)));
            			if (preg_match('/^(https:|http:|ftp:)/i', $rederectlink)) $modx->sendRedirect($rederectlink,0,'REDIRECT_HEADER','HTTP/1.1 302 Found');
            			else $modx->sendRedirect($modx->config['site_url'].md5($rederectlink),0,'REDIRECT_HEADER','HTTP/1.0 404 Not Found');
            			exit;
            		}
            	$incr++;
            	}
            }
            
            function rcr_crypt($str)
            {
            	global $rcr_opt;
            	if(empty($rcr_opt['secreet'])) return $str;
            	$key=str_pad('', strlen($str), $rcr_opt['secreet'], STR_PAD_RIGHT);
            	for($i=0;$i<strlen($str);$i++){
            		$str[$i] = chr(ord($str[$i]) ^ ord($key[$i]));
            	}
            	return $str;
            }
            
            function rcr_isstopwords($data)
            {
            	global  $rcr_opt;
            	if($rcr_opt['rcr_stop']){
            	$list = explode(",",$rcr_opt['rcr_stop_list']);
            	foreach($list as $sw)
            		if(stripos($data, trim($sw))!==false) return true;
            	}
            	return false;
            }
            
            function rcr_isstoprel($data)
            {
            	global $rcr_opt;
            	if($rcr_opt['rcr_rel_stop']){
            		$needle = "rel=\"".$rcr_opt['rcr_rel_val']."\"";
            		if(stripos($data, $needle)!==false) return true;
            		$needle = "rel='".$rcr_opt['rcr_rel_val']."'";
            		if(stripos($data, $needle)!==false) return true;
            	}
            	if($rcr_opt['rcr_class_stop']){
            		$needle = "class=\"".$rcr_opt['rcr_class_val']."\"";
            		if(stripos($data, $needle)!==false) return true;
            		$needle = "class='".$rcr_opt['rcr_class_val']."'";
            		if(stripos($data, $needle)!==false) return true;
            	}
            	return false;
            }
            
            function rcr_iscanblank($data)
            {
            	global $rcr_opt;
            	if (!$rcr_opt['rcr_blank']) return false;
            	if ((stripos($data, '.exe')!==false) or (stripos($data, '.zip')!==false) or
            		(stripos($data, '.rar')!==false) or (stripos($data, '.msi')!==false)) return false;
            	return true;
            
            }
            
            function rcr_encode($data)
            {
            	global $rcr_opt, $modx;
            	$home = $modx->config['site_url'];
            	preg_match_all('#<a(?:.*?)href(?:\s*)=(?:\s*)[\"\']((https?|ftp):\/\/\S*?)[\"\']([^>]*)>(.*?)<\/a>#im',$data,$arr);
            	for ($i=0; $i<count($arr[0]); $i++) {
            		if(stripos($arr[1][$i],$home)!==0){
            			if(rcr_isstoprel($arr[0][$i])==false){
            				if(rcr_isstopwords($arr[1][$i])==false){
            					if (!stristr($arr[0][$i], 'javascript:')) {
            						$tmp = $arr[0][$i];
            						if($rcr_opt['rcr_comment_text']==true){
            							if(strpos($arr[4][$i],'<img')===false){
            								if (preg_match('/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]/im', $arr[4][$i])) $tmp = str_replace('>'.$arr[4][$i].'<','>'.$rcr_opt['rcr_comment_text_val'].'<',$tmp);
            							}
            						}
            						//$tmp = str_replace($arr[1][$i],$home.$rcr_opt['rcr_relink_val'].'/'.base64_encode(rcr_crypt($arr[1][$i])).'/',$tmp);
            						//Temus: broken external images
            						$tmp = substr_replace($tmp, $home.$rcr_opt['rcr_relink_val'].'/'.base64_encode(rcr_crypt($arr[1][$i])).'/', strpos($tmp, $arr[1][$i]), strlen($arr[1][$i]));
            						if(rcr_iscanblank($arr[0][$i])) {
            							$tmp = preg_replace('/target=["\'][^\'".]+["\']/', '', $tmp);
            							$tmp = str_replace('<a','<a target="_blank"',$tmp);
            						}
            						if($rcr_opt['rcr_nofollow']){
            							$tmp = preg_replace('/rel=["\'][^\'".]+["\']/', '', $tmp);
            							$tmp = str_replace('<a','<a rel="nofollow"',$tmp);
            						}
            						if($rcr_opt['rcr_noindex']){
            							$tmp = str_replace('</a>','</a></noindex>',$tmp);
            							$tmp = str_replace('<a','<noindex><a',$tmp);
            						}
            						$data = str_replace($arr[0][$i],$tmp,$data);
            					}
            				}
            			}else {
            				$tmp = preg_replace('/rel=["\'][^\'".]+["\']/', '', $arr[0][$i]);
            				$data = str_replace($arr[0][$i],$tmp,$data);
            			}
            		}
            	}
            return $data;
            }
            
            ################################################
            
            switch($modx->Event->name) {
            	case 'OnWebPagePrerender' :
            		rcr_redirect();
            		$modx->documentOutput = rcr_encode(&$modx->documentOutput);
            	break;
            }
            
              --
              ysanmiguel.com
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              You can do the same thing by putting the target="_blank" in the weblink's Link Attributes field, and making sure that your rowTpl has the [[+wf.attributes]] placeholder in the a tags.

              <li[+wf.id+][+wf.classes+]>
                <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
                [+wf.wrapper+]
              </li>


              The &useWeblinkUrl might also be useful - the default is 1, so if you want your page's URL displayed instead of the URL of the remote page, set it to 0.
              When set to 1, the link specified in a weblink document will be output to the placeholder [wf.link] instead of the link to the weblink.
              http://rtfm.modx.com/display/ADDON/Wayfinder#Wayfinder-GeneralParameters
              [ed. note: sottwell last edited this post 13 years, 3 months ago.]
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 33238
                • 388 Posts
                Yes sottwell thank you very much, i made a post about that when i realise that [+wf.attributes+] exists!
                that change my life hahaha!

                Cheers!
                  --
                  ysanmiguel.com
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Or you could remove the "&" from the "&$modx" around line 180 of the plugin's code - at least that's the only one I spotted with a quick look at it. I'm not quite sure just what that plugin is supposed to do; it seems awfully convoluted. I generally try to avoid using things when I don't understand what it's doing. Anyway, PHP fairly recently changed the way it handles object references so that you don't need to specify the by-reference operator; objects are now called by reference by default.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org