Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Trying to install Kayako Fusion and I'm getting errors

Posted on 2014-10-11
6
556 Views
Last Modified: 2014-10-17
Hi.

I'm getting:

PHP Parse error: syntax error, unexpected T_STATIC in \\sambaa\sites\site.com\public_html\sitename\__swift\library\MVC\class.SWIFT_Model.php on line 101

The version of PHP installed on the server is 5.5 - which should be compatible. Any suggestions of settings in PHP that could be wrong?
0
Comment
Question by:EvertJor
  • 3
  • 3
6 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40374991
"Unexpected" usually means that something upstream in the script file is awry.  It can often be a missing paren, semi-colon or control structure.   Suggest you post the contents of that script in the code snippet here so we can see what it says.
0
 

Author Comment

by:EvertJor
ID: 40375517
<?php

/**
 * ###############################################
 *
 * SWIFT Framework
 * _______________________________________________
 *
 * @author         Varun Shoor
 *
 * @package        SWIFT
 * @copyright      Copyright (c) 2001-2012, Kayako
 * @license        http://www.kayako.com/license
 * @link           http://www.kayako.com
 *
 * ###############################################
 */

/**
 * The Core Model Management Class
 *
 * @author Varun Shoor
 */
class SWIFT_Model extends SWIFT_Base implements SWIFT_Model_Interface
{
	protected $_updatePool = array();
	protected $_dataStore = array();
	static protected $_updatePoolQueue = array();

	/**
	 * Constructor
	 *
	 * @author Varun Shoor
	 *
	 * @param SWIFT_Data|string|array $_SWIFT_DataObject (OPTIONAL) This has been kept optional for backward compatibility
	 *
	 * @throws SWIFT_Exception If the Model could not be Initialized
	 */
	public function __construct($_SWIFT_DataObject = null)
	{
		if (!$_SWIFT_DataObject instanceof SWIFT_Data && is_numeric($_SWIFT_DataObject)) {
			$_SWIFT_DataObject = new SWIFT_DataID($_SWIFT_DataObject);
		} else if (!$_SWIFT_DataObject instanceof SWIFT_Data && _is_array($_SWIFT_DataObject)) {
			$_SWIFT_DataObject = new SWIFT_DataStore($_SWIFT_DataObject);
		}

		if (!$this->Initialize()) {
			throw new SWIFT_Exception(SWIFT_CLASSNOTLOADED);
		} else if ($_SWIFT_DataObject instanceof SWIFT_Data && $_SWIFT_DataObject->GetIsClassLoaded()) {
			if (!$this->LoadData($_SWIFT_DataObject)) {
				throw new SWIFT_Exception('Failed to load ' . __CLASS__ . ' Object');
			}
		}

		parent::__construct();
	}

	/**
	 * Destructor
	 *
	 * @author Varun Shoor
	 * @return bool "true" on Success, "false" otherwise
	 */
	public function __destruct()
	{
		$this->ProcessUpdatePool();

		parent::__destruct();

		return true;
	}

	/**
	 * Retrieve the identifier for this model
	 *
	 * @author Varun Shoor
	 *
	 * @param $_id
	 *
	 * @return SWIFT_Model
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	static public function GetOnID($_id)
	{
		return new self(new SWIFT_DataID($_id));
	}

	/**
	 * Retrieve the identifier for this model
	 *
	 * @author Varun Shoor
	 * @return int
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	public function GetID()
	{
		if (!$this->GetIsClassLoaded()) {
			throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_CLASSNOTLOADED);
		}

		if (static::PRIMARY_KEY) {
			return $this->GetProperty($this->GetPrimaryKeyName());
		}

		return 0;
	}

	/**
	 * Retrieve the Table Name
	 *
	 * @author Varun Shoor
	 * @return string The Table Name
	 * @throws SWIFT_Exception If Invalid Data is Provided
	 */
	static public function GetTableName()
	{
		if (static::TABLE_NAME) {
			return static::TABLE_NAME;
		}

		return false;
	}

	/**
	 * Retrieve the Primary Key Name
	 *
	 * @author Varun Shoor
	 * @return string The Primary Key Name
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	static public function GetPrimaryKeyName()
	{
		if (static::PRIMARY_KEY) {
			return static::PRIMARY_KEY;
		}

		return false;
	}

	/**
	 * Processes the Update Pool Data
	 *
	 * @author Varun Shoor
	 * @return bool "true" on Success, "false" otherwise
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	public function ProcessUpdatePool()
	{
		if (!$this->GetIsClassLoaded()) {
			return false;
		} else if (!_is_array($this->GetUpdatePool()) || self::GetTableName() === false || self::GetPrimaryKeyName() === false) {
			return false;
		}

		$this->Database->AutoExecute(TABLE_PREFIX . self::GetTableName(), $this->GetUpdatePool(), 'UPDATE', self::GetPrimaryKeyName() . " = '" . intval($this->GetProperty(self::GetPrimaryKeyName())) . "'");

		$this->ClearUpdatePool();

		return true;
	}

	/**
	 * Call a custom function
	 *
	 * @author Varun Shoor
	 *
	 * @param string $_functionName
	 * @param array  $_argumentContainer
	 *
	 * @return bool "true" on Success, "false" otherwise
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	public function __call($_functionName, $_argumentContainer)
	{
		if (!$this->GetIsClassLoaded()) {
			throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_CLASSNOTLOADED);
		}

		$_baseFunctionName = mb_strtolower($_functionName);

		// Get{PROPERTY}
		if (strtolower(substr($_baseFunctionName, 0, strlen('get')) == 'get')) {
			$_propertyName = mb_strtolower(trim(substr($_baseFunctionName, 3)));
			if (!isset($this->_dataStore[$_propertyName])) {
				throw new SWIFT_Exception($_functionName . ' failed, property "' . $_propertyName . '" not found in datastore.');
			}

			return $this->GetProperty($_propertyName);
			// Set{PROPERTY}
		} else if (strtolower(substr($_baseFunctionName, 0, strlen('set')) == 'set')) {
			$_propertyName = mb_strtolower(trim(substr($_baseFunctionName, 3)));
			if (!isset($this->_dataStore[$_propertyName])) {
				throw new SWIFT_Exception($_functionName . ' failed, property "' . $_propertyName . '" not found in datastore.');
			} else if (!isset($_argumentContainer[0])) {
				throw new SWIFT_Exception($_functionName . ' failed, no value specified.');
			}

			$this->SetProperty($_propertyName, $_argumentContainer[0]);

			return true;
		}

		return true;
	}

	/**
	 * Retrieve a datastore property
	 *
	 * @author Varun Shoor
	 *
	 * @param string $_propertyName
	 *
	 * @return bool "true" on Success, "false" otherwise
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	public function __get($_propertyName)
	{
		if (!$this->GetIsClassLoaded()) {
			throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_CLASSNOTLOADED);
		} else if (!isset($this->_dataStore[$_propertyName])) {
			throw new SWIFT_Exception('Property retrieval failed, "' . $_propertyName . '" not found in datastore.');
		}

		return $this->GetProperty($_propertyName);
	}

	/**
	 * Check to see if the property is set
	 *
	 * @author Varun Shoor
	 *
	 * @param string $_propertyName
	 *
	 * @return bool "true" on Success, "false" otherwise
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	public function __isset($_propertyName)
	{
		return isset($this->_dataStore[$_propertyName]);
	}

	/**
	 * Returns the Data Store Array
	 *
	 * @author Varun Shoor
	 * @return mixed "_dataStore" Array on Success, "false" otherwise
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	public function GetDataStore()
	{
		if (!$this->GetIsClassLoaded()) {
			throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_CLASSNOTLOADED);
		}

		return $this->_dataStore;
	}

	/**
	 * Retrieves a Property Value from Data Store
	 *
	 * @author Varun Shoor
	 *
	 * @param string $_propertyName
	 *
	 * @return mixed
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	public function Get($_propertyName)
	{
		if (!$this->GetIsClassLoaded()) {
			throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_CLASSNOTLOADED);
		}

		return $this->GetProperty($_propertyName);
	}

	/**
	 * Retrieves a Property Value from Data Store
	 *
	 * @author Varun Shoor
	 *
	 * @param string $_propertyName The Property Name
	 *
	 * @return mixed Property Data on Success, "false" otherwise
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	public function GetProperty($_propertyName)
	{
		if (!$this->GetIsClassLoaded()) {
			throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_CLASSNOTLOADED);
		} else if (!isset($this->_dataStore[$_propertyName])) {
			throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_INVALIDDATA);
		}

		$_propertyName = mb_strtolower($_propertyName);

		return $this->_dataStore[$_propertyName];
	}

	/**
	 * Update Property
	 *
	 * @author Varun Shoor
	 *
	 * @param string $_propertyName
	 * @param string $_propertyValue
	 *
	 * @return bool "true" on Success, "false" otherwise
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	public function SetProperty($_propertyName, $_propertyValue)
	{
		if (!$this->GetIsClassLoaded()) {
			throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_CLASSNOTLOADED);
		} else if (!isset($this->_dataStore[$_propertyName])) {
			throw new SWIFT_Exception('Property update failed, "' . $_propertyName . '" not found in datastore.');
		}

		$_propertyName = mb_strtolower($_propertyName);

		$this->_dataStore[$_propertyName] = $_propertyValue;

		$this->UpdatePool($_propertyName, $_propertyValue);

		return true;
	}

	/**
	 * Load the Data
	 *
	 * @author Varun Shoor
	 *
	 * @param object $_SWIFT_DataObject The SWIFT_Data Object
	 *
	 * @return bool "true" on Success, "false" otherwise
	 * @throws SWIFT_Exception If Invalid Data is Provided
	 */
	protected function LoadData($_SWIFT_DataObject)
	{
		$_SWIFT = SWIFT::GetInstance();


		// Is it a ID?
		if ($_SWIFT_DataObject instanceof SWIFT_DataID && $_SWIFT_DataObject->GetIsClassLoaded()) {
			$_query     = "SELECT * FROM " . TABLE_PREFIX . self::GetTableName() . " WHERE " . self::GetPrimaryKeyName() . " = '" . intval($_SWIFT_DataObject->GetDataID()) . "'";
			$_dataStore = $_SWIFT->Database->QueryFetch($_query);
			if (isset($_dataStore[self::GetPrimaryKeyName()]) && !empty($_dataStore[self::GetPrimaryKeyName()])) {
				$this->_dataStore = $_dataStore;

				return true;
			} else {
				return false;
			}
			// Is it a Store?
		} else if ($_SWIFT_DataObject instanceof SWIFT_DataStore && $_SWIFT_DataObject->GetIsClassLoaded()) {
			$this->_dataStore = $_SWIFT_DataObject->GetDataStore();

			if (!isset($this->_dataStore[self::GetPrimaryKeyName()]) || empty($this->_dataStore[self::GetPrimaryKeyName()])) {
				throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_INVALIDDATA);
			}

			return true;
		}

		throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_INVALIDDATA);
	}

	/**
	 * Delete the record
	 *
	 * @author Varun Shoor
	 * @return bool "true" on Success, "false" otherwise
	 * @throws SWIFT_Exception If the Class is not Loaded
	 */
	public function Delete()
	{
		if (!$this->GetIsClassLoaded()) {
			throw new SWIFT_Exception(__CLASS__ . ':  ' . SWIFT_CLASSNOTLOADED);
		} else if (self::GetPrimaryKeyName() === false) {
			return false;
		}

		self::DeleteList(array($this->GetProperty(self::GetPrimaryKeyName())));

		$this->SetIsClassLoaded(false);

		return true;
	}

	/**
	 * Delete a list of records
	 *
	 * @author Varun Shoor
	 *
	 * @param array $_idList
	 *
	 * @return bool "true" on Success, "false" otherwise
	 */
	static public function DeleteList($_idList)
	{
		$_SWIFT = SWIFT::GetInstance();

		if (!_is_array($_idList)) {
			return false;
		}

		$_SWIFT->Database->Query("DELETE FROM " . TABLE_PREFIX . self::GetTableName() . " WHERE " . self::GetPrimaryKeyName() . " IN (" . BuildIN($_idList) . ")");

		return true;
	}

	/**
	 * Add an entry into the update pool
	 *
	 * @param string $_key   The key
	 * @param string $_value The value
	 *
	 * @return bool True on success, false otherwise
	 */
	public function UpdatePool($_key, $_value)
	{
		if (!$this->GetIsClassLoaded()) {
			return false;
		}

		// Do we have a data store?
		$this->_dataStore[$_key] = $_value;

		$this->_updatePool[$_key] = $_value;

		$this->QueueUpdatePool();

		return true;
	}

	/**
	 * Retrieves the update pool
	 *
	 * @return array The update pool
	 */
	public function GetUpdatePool()
	{
		if (!$this->GetIsClassLoaded()) {
			return false;
		}

		return $this->_updatePool;
	}

	/**
	 * Clears the Update Pool
	 *
	 * @return bool True on success, false otherwise
	 */
	public function ClearUpdatePool()
	{
		if (!$this->GetIsClassLoaded()) {
			return false;
		}

		$this->_updatePool = array();

		$_keyName = get_class($this) . '_' . $this->GetInstanceID();

		// Clear shutdown queue if set
		if (isset(self::$_updatePoolQueue[$_keyName])) {
			unset(self::$_updatePoolQueue[$_keyName]);
		}

		return true;
	}

	/**
	 * Queue the processing of the update pool for this object
	 *
	 * @author Varun Shoor
	 * @return bool "true" on Success, "false" otherwise
	 */
	public function QueueUpdatePool()
	{
		if (!$this->GetIsClassLoaded()) {
			return false;
		}

		$_keyName = get_class($this) . '_' . $this->GetInstanceID();

		if (!isset(self::$_updatePoolQueue[$_keyName])) {
			self::$_updatePoolQueue[$_keyName] = $this;
		}

		return true;
	}

	/**
	 * Process the pending update pools before shutdown
	 *
	 * @author Varun Shoor
	 * @return bool "true" on Success, "false" otherwise
	 */
	static public function ProcessShutdownUpdatePool()
	{
		if (!_is_array(self::$_updatePoolQueue)) {
			return false;
		}

		foreach (self::$_updatePoolQueue as $_ModelObject) {
			if ($_ModelObject instanceof SWIFT_Model && $_ModelObject->GetIsClassLoaded() && method_exists($_ModelObject, 'ProcessUpdatePool')) {
				$_ModelObject->ProcessUpdatePool();
			}
		}

		self::$_updatePoolQueue = array();

		return true;
	}
}

Open in new window

0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40375750
That's really strange; I don't get a parse error at  PHP 5.4.33.  I don't see anything wrong with the code.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Accepted Solution

by:
EvertJor earned 0 total points
ID: 40375858
Hi.

I solved it by using phpMyAdmin with my host and played around with the language strings (UTF8 etc.) and suddenly it worked when I switched back to the original setting (something stuck?).
I also stuied line 101 and could not see anything odd.

Best regards,
Evert
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40375872
Something else was wrong.  Language settings cannot cause a parse error.
0
 

Author Closing Comment

by:EvertJor
ID: 40386223
I solved it myself.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question