So, I am still working on this together with a great programmer
We have come to the conclusion that its not simply Evo, the majority of problems I have incurred arise from 3rd party code.
After removing all snippets and plugins that are not a necessity we have come up with the bare essentials to get a site back up and running - at least, the sites I am running as well as client sites.
The following modifications have been made on 7 sites, all running PHP5.4 - they all now work as they previously did.
Root Folder & Manager Folder
For problems with "timezone" we had to create a "php.ini" file with our time zone code in the root and the manager folder
e.g date.timezone = Europe/London
For a full list of European timezones
Click Here
For a full list of American timezones
Click Here
MANAGER Modifications:
File: manager/includes/extenders/dbapi.mysql.class.inc.php
Change:
function escape($s) {
if (function_exists('mysql_real_escape_string') && $this->conn) {
$s = mysql_real_escape_string($s, $this->conn);
} else {
$s = mysql_escape_string($s);
}
return $s;
}
To:
Updated code courtesy of
Bogdanio
function escape($s) {
if ($this->conn) {
$s = mysql_real_escape_string($s, $this->conn);
} else {
$s = mysql_real_escape_string($s);
}
return $s;
}
DITTO Modifications:
File: assets/snippets/ditto/classes/ditto.class.inc.php
Modification 1:
// ---------------------------------------------------
// Function: getAuthor
// Get the author name, or if not available the username
// ---------------------------------------------------
// Change to PHP5.4 public static function
// function getAuthor($createdby) {
public static function getAuthor($createdby) {
global $modx;
$user = false;
if ($createdby > 0) {
$user = $modx->getUserInfo($createdby);
} else {
$user = $modx->getWebUserInfo(abs($createdby));
}
if ($user === false) {
// get admin user name
$user = $modx->getUserInfo(1);
}
return ($user['fullname'] != "") ? $user['fullname'] : $user['username'];
}
Modification 2:
Updated code courtesy of
kp52
// ---------------------------------------------------
// Function: buildURL
// Build a URL with regard to Ditto ID
// ---------------------------------------------------
// Change to PHP5.4 public static function
// function buildURL($args,$id=false,$dittoIdentifier=false) {
public static function buildURL($args,$id=false,$dittoIdentifier=false) {
global $modx, $dittoID;
$dittoID = ($dittoIdentifier !== false) ? $dittoIdentifier : $dittoID;
$query = array();
foreach ($_GET as $param=>$value) {
if ($param != 'id' && $param != 'q') {
$query[htmlspecialchars($param, ENT_QUOTES)] = htmlspecialchars($value, ENT_QUOTES);
}
}
if (!is_array($args)) {
$args = explode("&",$args);
foreach ($args as $arg) {
$arg = explode("=",$arg);
$query[$dittoID.$arg[0]] = urlencode(trim($arg[1]));
}
} else {
foreach ($args as $name=>$value) {
$query[$dittoID.$name] = urlencode(trim($value));
}
}
$queryString = "";
foreach ($query as $param=>$value) {
$queryString .= '&'.$param.'='.(is_array($value) ? implode(",",$value) : $value);
}
$cID = ($id !== false) ? $id : $modx->documentObject['id'];
$url = $modx->makeURL(trim($cID), '', $queryString);
return ($modx->config['xhtml_urls']) ? $url : str_replace("&","&",$url);
}
File: assets/snippets/ditto/classes/template.class.inc.php
// ---------------------------------------------------
// Function: replace
// Replcae placeholders with their values
// ---------------------------------------------------
// Change to PHP5.4 public static function
// function replace( $placeholders, $tpl ) {
public static function replace( $placeholders, $tpl ) {
$keys = array();
$values = array();
foreach ($placeholders as $key=>$value) {
$keys[] = '[+'.$key.'+]';
$values[] = $value;
}
return str_replace($keys,$values,$tpl);
}
[ed. note: iusemodx last edited this post 11 years, 3 months ago.]