Alex (SirShurf) Frenkel's Blog

A web log of a PHP professional

WPML 3.1.8.x and the double slash problems continues.

leave a comment »

Well, after my previous post WPML have relised a new version 3.1.8.2, but it looks like this error gone unnoticed.

One other error with my solution was that on the homepage paging it had errors, so here is the revised version of the fix for WPML.

$arrUrl = parse_url($absolute_home_url);
if(!isset($arrUrl[‘path’])) $arrUrl[‘path’] = ‘/’;
$absolute_home_url = $arrUrl[‘scheme’].”://”.$arrUrl[‘host’].$arrUrl[‘path’];
if(isset($arrUrl[‘query’])) $absolute_home_url .= ‘?’.$arrUrl[‘query’];
if(isset($arrUrl[‘fragment’])) $absolute_home_url .= ‘#’.$arrUrl[‘fragment’];
unset($arrUrl);
$arrUrl = parse_url($this->settings[ ‘language_domains’ ][ $code ]);
if(!isset($arrUrl[‘path’])) $arrUrl[‘path’] = ‘/’;
$this->settings[ ‘language_domains’ ][ $code ] = $arrUrl[‘scheme’].”://”.$arrUrl[‘host’].$arrUrl[‘path’];
if(isset($arrUrl[‘query’])) $this->settings[ ‘language_domains’ ][ $code ] .= ‘?’.$arrUrl[‘query’];
if(isset($arrUrl[‘fragment’])) $this->settings[ ‘language_domains’ ][ $code ] .= ‘#’.$arrUrl[‘fragment’];
unset($arrUrl);
$arrUrl = parse_url($new_url);
if (!empty($arrUrl)){
if(!isset($arrUrl[‘path’])) $arrUrl[‘path’] = ‘/’;
$new_url = $arrUrl[‘scheme’].”://”.$arrUrl[‘host’].$arrUrl[‘path’];
if(isset($arrUrl[‘query’])) $new_url .= ‘?’.$arrUrl[‘query’];
if(isset($arrUrl[‘fragment’])) $new_url .= ‘#’.$arrUrl[‘fragment’];
}
unset($arrUrl);

 

The fix goes into sitepress.class.php on between lines 6463 and 6464:

                        $this->settings[ ‘language_domains’ ][ $default_language ] = $wpdb->get_var( “SELECT option_value FROM $wpdb->options WHERE option_name = ‘siteurl'”);
$new_url = str_replace( $absolute_home_url, $this->settings[ ‘language_domains’ ][ $code ], $new_url );

Written by Alex (Shurf) Frenkel

October 28, 2014 at 2:12 pm

Posted in Plugin, Wordpress, wpml

WPML makes the user logged out on 3.1.8.1 upgrade

with one comment

WPML rolled out an update to their plugin version 3.1.8.1.

But since the update you cannot work in the admin panel any more, each url will have more then one slash in it.

Here is my fix for the problem (until thy will issue an update).

The problem is in the sitepress.class.php file on line 6464, and created by in the addition of line 6463.

In line 6463 they have added a selection of site_url paramtere from the global parameter set of wordpress:

$this->settings[ ‘language_domains’ ][ $default_language ] = $wpdb->get_var( “SELECT option_value FROM $wpdb->options WHERE option_name = ‘siteurl'”);

This selection have an url of the website WITH the trailing slash in it.

And this data is sent to the next line: 6464

$new_url = str_replace( $absolute_home_url, $this->settings[ ‘language_domains’ ][ $code ], $new_url );

What this creates is a URL with next features:http://localhost//wp-admin/?lang=frAnd the double slash created the logout problem.By addint my lines of code, the error can be managed, untill a more permanent fix will be applied by WPML team:Simple add next code between 6463 and 6464 (inclusive)

                        $this->settings[ ‘language_domains’ ][ $default_language ] = $wpdb->get_var( “SELECT option_value FROM $wpdb->options WHERE option_name = ‘siteurl'”);
$arrUrl = parse_url($absolute_home_url);
if(!isset($arrUrl[‘path’])) $arrUrl[‘path’] = ‘/’;
$absolute_home_url = $arrUrl[‘scheme’].”://”.$arrUrl[‘host’].$arrUrl[‘path’];
if(!isset($arrUrl[‘query’])) $absolute_home_url .= ‘?’.$arrUrl[‘query’];
if(!isset($arrUrl[‘fragment’])) $absolute_home_url .= ‘#’.$arrUrl[‘fragment’];

$arrUrl = parse_url($this->settings[ ‘language_domains’ ][ $code ]);
if(!isset($arrUrl[‘path’])) $arrUrl[‘path’] = ‘/’;
$this->settings[ ‘language_domains’ ][ $code ] = $arrUrl[‘scheme’].”://”.$arrUrl[‘host’].$arrUrl[‘path’];
if(!isset($arrUrl[‘query’])) $this->settings[ ‘language_domains’ ][ $code ] .= ‘?’.$arrUrl[‘query’];
if(!isset($arrUrl[‘fragment’])) $this->settings[ ‘language_domains’ ][ $code ] .= ‘#’.$arrUrl[‘fragment’];

$new_url = str_replace( $absolute_home_url, $this->settings[ ‘language_domains’ ][ $code ], $new_url );

Written by Alex (Shurf) Frenkel

October 26, 2014 at 11:03 am

Posted in Wordpress, wpml

Tagged with

WordPress gone Green – 3.4 is out!

leave a comment »

The latest point release of WordPress was just launched to the masses a few hours ago.

We’re most excited about all the nifty new theme customization tools.

Written by Alex (Shurf) Frenkel

June 14, 2012 at 7:51 am

Posted in Uncategorized

Tagged with

How to fix Zend Server on Ubuntu 12.04 Precise

with 10 comments

After a long battle a solution is here!

Many thanks to Alex Sherman @AlxShr  from BelleRon Technologieswww.belleron.com.

Disclaimer: Use at your own risk! Worked on clean 12.04 install.

First of all we used a script taken from: http://ubuntuforums.org/showthread.php?t=636724&page=2

#!/bin/bash
#modded by japzone

if [[ -z "$1" ]]; then
  echo "Syntax: $0 debfile"
  exit 1
fi

DEBFILE="$1"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modfied.deb

if [[ -e "$OUTPUT" ]]; then
  echo "$OUTPUT exists."
  rm -r "$TMPDIR"
  exit 1
fi

dpkg-deb -x "$DEBFILE" "$TMPDIR"
dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN

if [[ ! -e "$TMPDIR"/DEBIAN/control ]]; then
  echo DEBIAN/control not found.

  rm -r "$TMPDIR"
  exit 1
fi

CONTROL="$TMPDIR"/DEBIAN/control

MOD=`stat -c "%y" "$CONTROL"`
gedit "$CONTROL"
read -p "Press any key once you've finished editing and saved"

if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
  echo Not modfied.
else
  echo Building new deb...
  dpkg -b "$TMPDIR" "$OUTPUT"
fi

rm -r "$TMPDIR"

The script above saved as debedit.sh and given execute permissions by

chmod u+x debedit.sh

Packages downloaded by:

apt-get download libpq4  php-5.3-imap-zend-server

Then edited dependencies by:

./debedit.sh libpq4_8.1.17-0etch1_amd64.deb
./debedit.sh php-5.3-imap-zend-server_5.3.9+b260_amd64.deb

In the “Depends” line of each of them changed libkrb53 to libkrb5-3

After that installed each of the modified packages:

dpkg -i libpq4_8.1.17-0etch1_amd64.modfied.deb
dpkg -i php-5.3-imap-zend-server_5.3.9+b260_amd64.modfied.deb

And then, finally, installed the zend server by:

apt-get install zend-server-ce-php-5.3

WOW! It Works!!!

This is continued from: Zend Server broken on Ubuntu 12.04

Written by Alex (Shurf) Frenkel

May 1, 2012 at 2:42 pm

Zend Server on Ubuntu 12.04 Precise – @Zend responded “NO ETA”

with one comment

I have contacted Zend founder Zeev and a friend of mine who have 2 servers running Zend Server Enterprise contacted Zend support.

The official response right now it: There is no ETA but because of the big interest we are looking at it.

I have checked the fix provided on Zend Forums (link) and using it it works, but you can not use imap any more, so if you have an applicaiton that uses it, dont install it.

But what I did found interesting is that the problem only occurs when you re enable Zend repositories after the upgrade, so if you made the upgrade to Ubuntu Precise with Zend Server installed you can continue to use it, just leave the repositories off.

In any case my advice is NOT to update to the new Ubuntu untill this is sorted out or to switch to a different LAMP stack.

 

Written by Alex (Shurf) Frenkel

April 30, 2012 at 11:16 pm

A hack to temporary fix Zend Server on Ubuntu 12.04

with 2 comments

User brinleyang on Zend forums has posted a temporary fix for the bug Zend introduced in their server on Ubuntu 12.04.

What he did is he created a quick hack and removed the dependency on libkrb in libpq and php-5.3-imap-zend-server deb packages and manually installed the packages after which installing zend server ce should work.

However, this will most likely break postgres and imap zend modules so it may not be the solution for people who require those modules.

You can follow the post here:
http://forums.zend.com/viewtopic.php?f=44&t=49693&hilit=ubuntu+12.04&sid=2435e3c7c2ebea1d4e4f3342f4148753&start=10

Written by Alex (Shurf) Frenkel

April 29, 2012 at 10:03 pm

Zend Server broken on Ubuntu 12.04

with 3 comments

To all of us using Zend Server on Ubuntu DONT update to the latest version 12.04 (at least until they will fix it!).

As of now, although they have this posted as a bug from January it’s impossible to use Zend Server 5.6 on Ubuntu 12.04 LTS.

The following packages have unmet dependencies:
zend-server-php-5.3 : Depends: php-5.3-common-extensions-zend-server but it is not going to be installed

The problem is seams is in libkrb53 which was a dummy for libkrb5-3 in previous versions and is no longer supported.

There is no known overrides as of now.

Written by Alex (Shurf) Frenkel

April 29, 2012 at 4:38 pm

Posted in PHP, Ubuntu

Tagged with , , ,

Follow

Get every new post delivered to your Inbox.

Join 57 other followers