Arrow Home arrow Forums
larger font smaller font default font Fixed screen resolution Auto adjust screen size

Joomlapolis Forums  


<< Start < Prev 1 2 3 4 5 6 Next > End >>
Re:PHP5 fatal error when editing profile
Date: 2007/11/20 11:25 By: beat Status: Admin  
Karma: 242  
Admin

Posts: 4063
graphgraph
That's the code for next CB version, working around that Zend bug in php 5.2.4:

Code:

 /**  * Translates text strings from CB and core cms ('_UE_....') into current language  *  * @param  string  $text  * @return string  */ function getLangDefinition($text) {     // check for '::' as a workaround of bug #42770 in PHP 5.2.4 with optimizers:     if ( ( strpos$text'::' ) === false ) && defined$text ) ) {         $returnText        =    constant$text );      } else {         $returnText        =    $text;     }     return $returnText; }


Beat - Developer on Community Builder core Team
- If you like CB and this forum, you will love Nick's CB 1.1 reference manual ! : Click here to Get it now
- Would like to help us move faster ? Get it, and/or help us spend more time coding by helping others in this forum, many thanks
Click here to see the profile of this user The administrator has disabled public write access.

Re:PHP5 fatal error when editing profile
Date: 2007/11/22 16:05 By: bobepine Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 1
graphgraph
Yes your code worked !!! Thanks for the rewrite of that function it helped me to find where was the semi column

it ended up being my new french language file for the plug_cbprofilegallery plugin ! wich had a line sayin
DEFINE("_pg_TotalAllowedQuotaItems","Quota:");

and was displayed as Quota:: on the user profile edit page !

Hmmm... those semi column !! lol

I left the code in my administrator/components/com_comprofiler/plugin.foundation.php

is there anywhere else I should put this code to prevent any future bugs ?

Thanks a lot !!!
Click here to see the profile of this user The administrator has disabled public write access.

Re:PHP5 fatal error when editing profile
Date: 2007/11/23 01:26 By: beat Status: Admin  
Karma: 242  
Admin

Posts: 4063
graphgraph
it's the only place.

However, you should ask your hoster to update the Zend Optimizer so it doesn't have that bug in that PHP 5.2.4 release...don't know if sams old Zend Optimizer is also affected in php 5.2.5.
Beat - Developer on Community Builder core Team
- If you like CB and this forum, you will love Nick's CB 1.1 reference manual ! : Click here to Get it now
- Would like to help us move faster ? Get it, and/or help us spend more time coding by helping others in this forum, many thanks
Click here to see the profile of this user The administrator has disabled public write access.

Re:PHP5 fatal error when editing profile
Date: 2007/11/25 09:38 By: tkapower Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 4
graphgraph
Where should i put the code
my plugin.foundation.php

look like this and this and no go

"
<?php
/**
* Joomla/Mambo Community Builder
* @version $Id: plugin.foundation.php 610 2006-12-13 17:33:44Z beat $
* @package Community Builder
* @subpackage plugin.foundation.php
* @author JoomlaJoe and Beat
* @copyright (C) JoomlaJoe and Beat, www.joomlapolis.com
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2
*/

// ensure this file is being included by a parent file
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

function getLangDefinition($text) {
if(defined($text)) $returnText = constant($text);
else $returnText = $text;
return $returnText;
}

/**
* Translates text strings from CB and core cms ('_UE_....') into current language
*
* @param string $text
* @return string
*/
function getLangDefinition($text) {
// check for '::' as a workaround of bug #42770 in PHP 5.2.4 with optimizers:
if ( ( strpos( $text, '::' ) === false ) && defined( $text ) ) {
$returnText = constant( $text );
} else {
$returnText = $text;
}
return $returnText;
}

/**
* includes CB stuff
* --- usage: cbimport('cb.xml.simplexml');
*
* @param string $path
*/
function cbimport( $lib ) {
global $mainframe;
static $imported = array();

if ( ! isset( $imported[$lib] ) ) {
$imported[$lib] = true;

$liblow = strtolower( $lib );
$pathAr = explode( '.', $liblow );
array_pop( $pathAr );
$filepath = implode( '/', $pathAr ) . '/' . $liblow . '.php';

require_once( $mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/library/' . $filepath );
}
}

/**
* Parameters handler
* @package Joomla/Mambo Community Builder
*/
class cbParamsBase {
/** @var object */
var $_params = null;
/** @var string The raw params string */
var $_raw = null;
/**
* Constructor
* @param string The raw parms text
* @param string Path to the xml setup file
* @param string The type of setup file
*/
function cbParamsBase( $paramsValues ) {
$this->_params = $this->parse( $paramsValues );
$this->_raw = $paramsValues;
}
/**
* Loads from the plugins database.
* @param string The plugin element name
* @return boolean true: could load, false: query error.
*/
function loadFromDB( $element ) {
global $_CB_database;

$_CB_database->setQuery("SELECT params FROM `#__comprofiler_plugin` WHERE element = '" . $_CB_database->getEscaped( $element ) . "'" );
$text = $_CB_database->loadResult();
$this->_params = $this->parse( $text );
$this->_raw = $text;
return ( $text !== null );
}
/**
* @param string The name of the param
* @param string The value of the parameter
* @return string The set value
*/
function set( $key, $value='' ) {
$this->_params->$key = $value;
return $value;
}
/**
* Sets a default value if not alreay assigned
* @param string The name of the param
* @param string The value of the parameter
* @return string The set value
*/
function def( $key, $value='' ) {
return $this->set( $key, $this->get( $key, $value ) );
}
/**
* @param string The name of the param
* @param mixed The default value if not found
* @return string
*/
function get( $key, $default=null ) {
if ( isset( $this->_params->$key ) ) {
if (is_array( $default ) ) {
return explode( '|*|', $this->_params->$key );
} else {
return $this->_params->$key;
}
} else {
return $default;
}
}
/**
* Parse an .ini string, based on phpDocumentor phpDocumentor_parse_ini_file function
* @param mixed The ini string or array of lines
* @param boolean add an associative index for each section [in brackets]
* @return object
*/
function parse( $txt, $process_sections = false, $asArray = false ) {
if (is_string( $txt )) {
$lines = explode( "n", $txt );
} else if (is_array( $txt )) {
$lines = $txt;
} else {
$lines = array();
}
$obj = $asArray ? array() : new stdClass();

$sec_name = '';
$unparsed = 0;
if (!$lines) {
return $obj;
}
foreach ($lines as $line) {
// ignore comments
if ($line && $line[0] == ';') {
continue;
}
$line = trim( $line );

if ($line == '') {
continue;
}
if ($line && $line[0] == '[' && $line[strlen($line) - 1] == ']') {
$sec_name = substr( $line, 1, strlen($line) - 2 );
if ($process_sections) {
if ($asArray) {
$obj[$sec_name] = array();
} else {
$obj->$sec_name = new stdClass();
}
}
} else {
if ($pos = strpos( $line, '=' )) {
$property = trim( substr( $line, 0, $pos ) );

if (substr($property, 0, 1) == '"' && substr($property, -1) == '"') {
$property = stripcslashes(substr($property,1,count($property) - 2));
}
$value = trim( substr( $line, $pos + 1 ) );
if ($value == 'false') {
$value = false;
}
if ($value == 'true') {
$value = true;
}
if (substr( $value, 0, 1 ) == '"' && substr( $value, -1 ) == '"') {
$value = stripcslashes( substr( $value, 1, count( $value ) - 2 ) );
}

if ($process_sections) {
$value = str_replace( array( 'n', 'r' ), array( "n", "r" ), $value );
if ($sec_name != '') {
if ($asArray) {
$obj[$sec_name][$property] = $value;
} else {
$obj->$sec_name->$property = $value;
}
} else {
if ($asArray) {
$obj[$property] = $value;
} else {
$obj->$property = $value;
}
}
} else {
$value = str_replace( array( 'n', 'r' ), array( "n", "r" ), $value );
if ($asArray) {
$obj[$property] = $value;
} else {
$obj->$property = $value;
}
}
} else {
if ($line && trim($line[0]) == ';') {
continue;
}
if ($process_sections) {
$property = '__invalid' . $unparsed++ . '__';
if ($process_sections) {
if ($sec_name != '') {
if ($asArray) {
$obj[$sec_name][$property] = trim($line);
} else {
$obj->$sec_name->$property = trim($line);
}
} else {
if ($asArray) {
$obj[$property] = trim($line);
} else {
$obj->$property = trim($line);
}
}
} else {
if ($asArray) {
$obj[$property] = trim($line);
} else {
$obj->$property = trim($line);
}
}
}
}
}
}
return $obj;
}
}

?>
"
Click here to see the profile of this user The administrator has disabled public write access.

Re:[FIX] PHP5.2.4+Zend fatal error editing profile
Date: 2008/01/22 21:41 By: Xantoz Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 1
graphgraph
I got: Fatal error: Class 'Bruger ID' not found in /home/www/digifora.dk/administrator/components/com_comprofiler/plugin.foundation.php on line 16

This error only occurs when I install the danish translation package (com_comprofiler_1.1_da-DK_Language24-08-07), so it seems the translation plugin could be the problem. I get the error when I try to edit or create a user profile from the CB user manager.
Click here to see the profile of this user The administrator has disabled public write access.

Re:[FIX] PHP5.2.4+Zend fatal error editing profile
Date: 2008/02/08 11:20 By: grawsom Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 1
graphgraph
I had the same problem - fixed it by removeing the :

in language file.

This was in file.

DEFINE('_UE_EMAIL','Email:');
DEFINE('_UE_UNAME','Bruger ID:');
DEFINE('_UE_PASS','Adgangskode:');


Changed it to

DEFINE('_UE_EMAIL','Email');
DEFINE('_UE_UNAME','Bruger ID');
DEFINE('_UE_PASS','Adgangskode');


I dont know much about coding but it worked for me, I belive the : is in another file, because they are still there when you go to user editing.
Click here to see the profile of this user The administrator has disabled public write access.

<< Start < Prev 1 2 3 4 5 6 Next > End >>

Documentation

Documentation Subscription Service
(updated for CB 1.2 RC2)

What?

Why?

Where?

Just click here for answers!

Click here for a yearly subscription: subscribe now

Download Latest Release

The latest stable Community Builder Release is version 1.1 for Joomla 1.0 and Mambo.
You need to be a registered member of Joomlapolis to download.

The latest release candidate of Community Builder is version 1.2 RC3, native for Joomla 1.0, 1.5 and Mambo.
It is available as "thank you" to all CB documentation subscribers at this time.

CB Login