PHP Version Compatibility; removed deprecated constructors

Dieser Commit ist enthalten in:
Oldperl 2018-12-10 12:13:27 +00:00
Ursprung c0415492d2
Commit 3490184008
70 geänderte Dateien mit 5094 neuen und 6044 gelöschten Zeilen

Datei anzeigen

@ -34,12 +34,6 @@ class cApiActionCollection extends ItemCollection {
$this->_setItemClass("cApiAction");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function cApiActionCollection() {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
/**
*
* @param string $area
@ -99,11 +93,5 @@ class cApiAction extends Item {
// @todo Where is this used???
$this->_wantParameters = array();
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function cApiAction($mId = false) {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
}
?>

Datei anzeigen

@ -41,7 +41,7 @@ class Action {
* Constructor Function
* @param
*/
function Action() {
function __construct() {
// empty
} // end function

Datei anzeigen

@ -38,7 +38,7 @@ class ActiveUsers {
*
* @return
* */
function ActiveUsers($oDb, $oCfg, $oAuth) {
function __construct($oDb, $oCfg, $oAuth) {
$this->oCfg = $oCfg;
$this->oAuth = $oAuth;

Datei anzeigen

@ -38,7 +38,7 @@ class Area {
* Constructor Function
* @param
*/
function Area() {
function __construct() {
// empty
} // end function

Datei anzeigen

@ -38,7 +38,7 @@ class Art {
* Constructor Function
* @param
*/
function Art() {
function __construct() {
// empty
} // end function

Datei anzeigen

@ -145,12 +145,6 @@ class Article extends Item
$this->_getArticleContent();
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
function Article($idart, $client, $lang, $idartlang = 0) {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($idart, $client, $lang, $idartlang);
}
/**
* Getter for idartlang of article object
*
@ -498,13 +492,6 @@ class ArticleCollection
$this->_getArticlesByCatId($this->idcat);
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
function ArticleCollection($options)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($options);
}
/**
* Set the Object properties
*

Datei anzeigen

@ -46,13 +46,6 @@ class ArtSpecCollection extends ItemCollection
parent::__construct($cfg['tab']['art_spec'], "idartspec");
$this->_setItemClass("ArtSpecItem");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function ArtSpecCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
}
@ -73,13 +66,6 @@ class ArtSpecItem extends Item
$this->loadByPrimaryKey($mId);
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function ArtSpecItem($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
}
?>

Datei anzeigen

@ -72,7 +72,7 @@ class Contenido_Backend {
/**
* Constructor
*/
function Contenido_Backend() {
function __construct() {
# do nothing
} # end function

Datei anzeigen

@ -38,7 +38,7 @@ class Cat {
* Constructor Function
* @param
*/
function Cat() {
function __construct() {
// empty
} // end function

Datei anzeigen

@ -43,13 +43,6 @@ class CategoryCollection extends ItemCollection
parent::__construct($cfg["tab"]["cat"], "idcat");
$this->_setItemClass("CategoryItem");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function CategoryCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
}
@ -69,13 +62,6 @@ class CategoryItem extends Item
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function CategoryItem($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
public function loadByPrimaryKey($key)
{
if (parent::loadByPrimaryKey($key)) {
@ -101,13 +87,6 @@ class CategoryLanguageCollection extends ItemCollection
parent::__construct($cfg["tab"]["cat_lang"], "idcatlang");
$this->_setItemClass("CategoryLanguageItem");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function CategoryLanguageCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
}
@ -126,13 +105,4 @@ class CategoryLanguageItem extends Item
$this->loadByPrimaryKey($mId);
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function CategoryLanguageItem($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
}
?>

Datei anzeigen

@ -52,7 +52,7 @@ class cCharacterConverter
var $_aAliasCache;
var $_aCharCache;
function cCharacterConverter ()
function __construct ()
{
$this->_oDB = new DB_ConLite;
$this->_aAliasCache = array();
@ -155,4 +155,3 @@ class cCharacterConverter
return $sEncoding;
}
}
?>

Datei anzeigen

@ -131,7 +131,7 @@ class clDbBackup {
$data = "DROP TABLE IF EXISTS `$sTable`;\n";
$this->_oDb->query('SHOW CREATE TABLE `' . $sTable . '`');
$this->_oDb->next_record();
$row = $this->_oDb->toArray(); //@mysql_fetch_row($res);
$row = $this->_oDb->toArray();
$data .= $row[1] . ';' . "\n\n";
if (!$this->_noTableData($sTable)) {
$data .= "/*!40000 ALTER TABLE `$sTable` DISABLE KEYS */;\n";
@ -194,7 +194,7 @@ class clDbBackup {
if (!isset($rows[$column])) {
$insert.='NULL,';
} else if ($rows[$column] != '') {
$insert.='\'' . mysql_escape_string($rows[$column]) . '\',';
$insert.='\'' . $this->_oDb->escape($rows[$column]) . '\',';
} else {
$insert.='\'\',';
}

Datei anzeigen

@ -38,7 +38,7 @@ class Client {
* Constructor Function
* @param
*/
function Client() {
function __construct() {
// empty
} // end function

Datei anzeigen

@ -47,13 +47,6 @@ class CommunicationCollection extends ItemCollection
$this->_setItemClass("CommunicationItem");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function CommunicationCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
/**
* Creates a new communication item
*/
@ -91,13 +84,6 @@ class CommunicationItem extends Item
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function CommunicationItem($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
function store()
{
global $auth;
@ -107,5 +93,3 @@ class CommunicationItem extends Item
parent::store();
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -30,34 +31,23 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class DBFSCollection extends ItemCollection {
class DBFSCollection extends ItemCollection
{
/**
* Constructor Function
* @param none
*/
public function __construct()
{
public function __construct() {
global $cfg;
parent::__construct($cfg["tab"]["dbfs"], "iddbfs");
$this->_setItemClass("DBFSItem");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function DBFSCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
public function outputFile($path)
{
public function outputFile($path) {
global $client, $auth;
$path = Contenido_Security::escapeDB($path, null);
@ -95,23 +85,20 @@ class DBFSCollection extends ItemCollection
}
}
public function writeFromFile($localfile, $targetfile)
{
public function writeFromFile($localfile, $targetfile) {
$targetfile = $this->strip_path($targetfile);
$mimetype = mime_content_type($localfile);
$this->write($targetfile, file_get_contents($localfile), $mimetype);
}
public function writeToFile($sourcefile, $localfile)
{
public function writeToFile($sourcefile, $localfile) {
$sourcefile = $this->strip_path($sourcefile);
file_put_contents($localfile, $this->read($sourcefile));
}
public function write($file, $content = "", $mimetype = "")
{
public function write($file, $content = "", $mimetype = "") {
$file = $this->strip_path($file);
if (!$this->file_exists($file)) {
@ -120,8 +107,7 @@ class DBFSCollection extends ItemCollection
$this->setContent($file, $content);
}
public function hasFiles($path)
{
public function hasFiles($path) {
global $client;
$path = $this->strip_path($path);
@ -142,13 +128,11 @@ class DBFSCollection extends ItemCollection
}
}
public function read($file)
{
public function read($file) {
return ($this->getContent($file));
}
public function file_exists($path)
{
public function file_exists($path) {
global $client;
$path = $this->strip_path($path);
@ -169,8 +153,7 @@ class DBFSCollection extends ItemCollection
}
}
public function dir_exists($path)
{
public function dir_exists($path) {
global $client;
$path = $this->strip_path($path);
@ -189,15 +172,13 @@ class DBFSCollection extends ItemCollection
}
}
public function parent_dir($path)
{
public function parent_dir($path) {
$path = dirname($path);
return $path;
}
public function create($path, $mimetype = "", $content = "")
{
public function create($path, $mimetype = "", $content = "") {
global $client, $cfg, $auth;
$client = Contenido_Security::toInteger($client);
@ -254,8 +235,7 @@ class DBFSCollection extends ItemCollection
return ($item);
}
public function setContent($path, $content)
{
public function setContent($path, $content) {
global $client;
$client = Contenido_Security::toInteger($client);
@ -275,8 +255,7 @@ class DBFSCollection extends ItemCollection
}
}
public function getSize($path)
{
public function getSize($path) {
global $client;
$client = Contenido_Security::toInteger($client);
@ -294,8 +273,7 @@ class DBFSCollection extends ItemCollection
}
}
public function getContent($path)
{
public function getContent($path) {
global $client;
$client = Contenido_Security::toInteger($client);
@ -312,8 +290,7 @@ class DBFSCollection extends ItemCollection
}
}
public function remove($path)
{
public function remove($path) {
global $client;
$client = Contenido_Security::toInteger($client);
@ -331,8 +308,7 @@ class DBFSCollection extends ItemCollection
}
}
public function strip_path($path)
{
public function strip_path($path) {
if (substr($path, 0, 5) == "dbfs:") {
$path = substr($path, 5);
}
@ -349,8 +325,7 @@ class DBFSCollection extends ItemCollection
* @param datatype $sPath
* @return bool $bAvailable
*/
public function checkTimeManagement($sPath, $oProperties)
{
public function checkTimeManagement($sPath, $oProperties) {
global $contenido;
if ($contenido) {
return true;
@ -366,8 +341,7 @@ class DBFSCollection extends ItemCollection
$iNow = time();
if ($iNow < $this->dateToTimestamp($sStartDate) ||
($iNow > $this->dateToTimestamp($sEndDate) && (int)$this->dateToTimestamp($sEndDate) > 0)) {
if ($iNow < $this->dateToTimestamp($sStartDate) || ($iNow > $this->dateToTimestamp($sEndDate) && (int) $this->dateToTimestamp($sEndDate) > 0)) {
return false;
}
@ -379,21 +353,19 @@ class DBFSCollection extends ItemCollection
* @param string $sDate
* @return int $iTimestamp
*/
public function dateToTimestamp($sDate)
{
public function dateToTimestamp($sDate) {
return strtotime($sDate);
}
}
class DBFSItem extends Item {
class DBFSItem extends Item
{
/**
* Constructor Function
* @param mixed $mId Specifies the ID of item to load
*/
public function __construct($mId = false)
{
public function __construct($mId = false) {
global $cfg;
parent::__construct($cfg["tab"]["dbfs"], "iddbfs");
if ($mId !== false) {
@ -401,15 +373,7 @@ class DBFSItem extends Item
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function DBFSItem($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
public function store()
{
public function store() {
global $auth;
$this->set("modified", date("Y-m-d H:i:s"), false);
@ -418,8 +382,7 @@ class DBFSItem extends Item
parent::store();
}
public function setField($field, $value, $safe = true)
{
public function setField($field, $value, $safe = true) {
if ($field == "dirname" || $field == "filename" || $field == "mimetype") {
// Don't do safe encoding
$safe = false;
@ -430,6 +393,5 @@ class DBFSItem extends Item
parent::setField($field, $value, $safe);
}
}
?>
}

Datei anzeigen

@ -40,7 +40,7 @@ class ExcelWorksheet
var $_title;
var $_filename;
function ExcelWorksheet ($title, $filename)
function __construct ($title, $filename)
{
$this->_title = Contenido_Security::escapeDB($title, null);
$this->_filename = Contenido_Security::escapeDB($filename, null);

Datei anzeigen

@ -99,7 +99,7 @@ class Form {
* Constructor Function
* @param
*/
function Form() {
function __construct() {
// empty
} // end function
@ -279,7 +279,7 @@ class Form {
}
// FormField instance
$field = new FormField;
$field = new FormField();
// Get Code for one element
$tmp_replacements[] = $field->GenerateCode($this->fields[$i]);
@ -364,7 +364,7 @@ class Form {
foreach ($this->fields as $id => $element) {
$check = new FormCheck;
$check = new FormCheck();
switch (strtolower($element['checktype'])) {
@ -447,7 +447,7 @@ class FormField {
/**
* Constructor Function
*/
function FormField() {
function __construct() {
// do nothing
} // end function
@ -625,7 +625,7 @@ class FormCheck {
* Constructor function
* @access private
*/
function FormCheck () {
function __construct () {
// empty
} // end function
@ -679,5 +679,3 @@ class FormCheck {
} // end function
} // end class
?>

Datei anzeigen

@ -50,13 +50,6 @@ class FrontendGroupCollection extends ItemCollection
$this->_setItemClass("FrontendGroup");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function FrontendGroupCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
/**
* Creates a new group
* @param $groupname string Specifies the groupname
@ -122,13 +115,6 @@ class FrontendGroup extends Item
$this->loadByPrimaryKey($mId);
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function FrontendGroup($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
}
@ -150,13 +136,6 @@ class FrontendGroupMemberCollection extends ItemCollection
$this->_setItemClass("FrontendGroupMember");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function FrontendGroupMemberCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
/**
* Creates a new association
* @param $idfrontendgroup int specifies the frontend group
@ -237,13 +216,4 @@ class FrontendGroupMember extends Item
$this->loadByPrimaryKey($mId);
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function FrontendGroupMember($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
}
?>

Datei anzeigen

@ -54,13 +54,6 @@ class FrontendPermissionCollection extends ItemCollection
$this->_setItemClass("FrontendPermission");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function FrontendPermissionCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
/**
* Creates a new permission entry
* @param $group string Specifies the frontend group
@ -157,13 +150,4 @@ class FrontendPermission extends Item
$this->loadByPrimaryKey($mId);
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function FrontendPermission($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
}
?>

Datei anzeigen

@ -50,13 +50,6 @@ class FrontendUserCollection extends ItemCollection
$this->_setItemClass("FrontendUser");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function FrontendUserCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
/**
* Checks if a specific user already exists
* @param $sUsername string specifies the username to search for
@ -157,13 +150,6 @@ class FrontendUser extends Item
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function FrontendUser($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
/**
* Overridden setField method to md5 the password
* Sets the value of a specific field

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -29,7 +30,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -41,8 +41,7 @@ if(!defined('CON_FRAMEWORK')) {
* @version 1.0
* @copyright four for business AG 2003
*/
class Groups
{
class Groups {
/**
* Storage of the source table to use for the group informations
@ -63,8 +62,7 @@ class Groups
*
* @param string $table The table to use as information source
*/
function Groups($table = '')
{
function __construct($table = '') {
if ($table == '') {
global $cfg;
$this->table = $cfg['tab']['groups'];
@ -75,15 +73,13 @@ class Groups
$this->db = new DB_ConLite();
}
/**
* Removes the specified group from the database
*
* @param string $groupid Specifies the group ID
* @return bool True if the delete was successful
*/
function deleteGroupByID($groupid)
{
function deleteGroupByID($groupid) {
$sql = "DELETE FROM "
. $this->table .
" WHERE group_id = '" . Contenido_Security::escapeDB($groupid, $this->db) . "'";
@ -92,15 +88,13 @@ class Groups
return ($this->db->affected_rows() == 0) ? false : true;
}
/**
* Removes the specified group from the database.
*
* @param string $groupid Specifies the groupname
* @return bool True if the delete was successful
*/
function deleteGroupByGroupname($groupname)
{
function deleteGroupByGroupname($groupname) {
$sql = "DELETE FROM "
. $this->table .
" WHERE groupname = '" . Contenido_Security::escapeDB($groupname, $this->db) . "'";
@ -109,15 +103,13 @@ class Groups
return ($this->db->affected_rows() == 0) ? false : true;
}
/**
* Returns all groups which are accessible by the current group.
*
* @param array $perms
* @return array Array of group objects
*/
function getAccessibleGroups($perms)
{
function getAccessibleGroups($perms) {
global $cfg;
$clientclass = new Client();
@ -173,8 +165,7 @@ class Groups
* @version 1.0
* @copyright four for business 2003
*/
class Group
{
class Group {
/**
* Storage of the source table to use for the group informations
@ -209,8 +200,7 @@ class Group
*
* @param string $table The table to use as information source
*/
function Group($table = '')
{
function __construct($table = '') {
if ($table == '') {
global $cfg;
$this->table = $cfg['tab']['groups'];
@ -221,15 +211,13 @@ class Group
$this->db = new DB_ConLite();
}
/**
* Loads a group from the database by its groupname.
*
* @param string $groupname Specifies the groupname
* @return bool True if the load was successful
*/
function loadGroupByGroupname($groupname)
{
function loadGroupByGroupname($groupname) {
// SQL-Statement to select by groupname
$sql = "SELECT * FROM " .
$this->table
@ -246,15 +234,13 @@ class Group
$this->values = $this->db->toArray();
}
/**
* Loads a group from the database by its groupID.
*
* @param string $groupid Specifies the groupID
* @return bool True if the load was successful
*/
function loadGroupByGroupID($groupID)
{
function loadGroupByGroupID($groupID) {
// SQL-Statement to select by groupID
$sql = "SELECT * FROM " .
$this->table
@ -271,39 +257,33 @@ class Group
$this->values = $this->db->toArray();
}
/**
* Gets the value of a specific field.
*
* @param string $field Specifies the field to retrieve
* @return mixed Value of the field
*/
function getField($field)
{
function getField($field) {
return ($this->values[$field]);
}
/**
* Sets the value of a specific field.
*
* @param string $field Specifies the field to set
* @param string $value Specifies the value to set
*/
function setField($field, $value)
{
function setField($field, $value) {
$this->modifiedValues[$field] = true;
$this->values[$field] = $value;
}
/**
* Stores the modified group object to the database.
*
* @return bool
*/
function store()
{
function store() {
$sql = "UPDATE " . $this->table . " SET ";
$first = true;
@ -328,8 +308,7 @@ class Group
*
* @return bool
*/
function insert()
{
function insert() {
$sql = "INSERT INTO " . $this->table . " SET ";
$first = true;
@ -345,7 +324,6 @@ class Group
return ($this->db->query($sql));
}
/**
* Returns the group property
*
@ -353,8 +331,7 @@ class Group
* @param string $name Specifies the name of the property to retrieve
* @return string The value of the retrieved property
*/
function getGroupProperty($type, $name)
{
function getGroupProperty($type, $name) {
global $cfg;
$sql = "SELECT value FROM " . $cfg['tab']['group_prop'] . "
@ -370,7 +347,6 @@ class Group
}
}
/**
* Retrieves all available properties of the group.
*
@ -379,8 +355,7 @@ class Group
* - $arr[idgroupprop][type]
* - $arr[idgroupprop][value]
*/
function getGroupProperties()
{
function getGroupProperties() {
global $cfg;
$aProps = array();
@ -404,7 +379,6 @@ class Group
return $aProps;
}
/**
* Stores a property to the database.
*
@ -412,8 +386,7 @@ class Group
* @param string $name Specifies the name of the property to retrieve
* @param string $value Specifies the value to insert
*/
function setGroupProperty($type, $name, $value)
{
function setGroupProperty($type, $name, $value) {
global $cfg;
// Check if such an entry already exists
@ -435,15 +408,13 @@ class Group
}
}
/**
* Deletes a group property from the table.
*
* @param string $type Specifies the type (class, category etc) for the property to retrieve
* @param string $name Specifies the name of the property to retrieve
*/
function deleteGroupProperty($type, $name)
{
function deleteGroupProperty($type, $name) {
global $cfg;
// Check if such an entry already exists
@ -455,5 +426,3 @@ class Group
}
}
?>

Datei anzeigen

@ -93,7 +93,7 @@ class HtmlParser {
* Constructs an HtmlParser instance with
* the HTML text given.
*/
function HtmlParser ($aHtmlText) {
function __construct ($aHtmlText) {
$this->iHtmlText = $aHtmlText;
$this->iHtmlTextLength = strlen($aHtmlText);
}

Datei anzeigen

@ -34,7 +34,7 @@ class cHTMLValidator
var $nestingNodes;
var $_existingTags;
function cHTMLValidator()
function __construct()
{
$this->doubleTags = array ("form", "head", "body", "html", "td", "tr", "table", "a", "tbody", "title", "container", "span", "div");

Datei anzeigen

@ -128,7 +128,7 @@ class HttpInputValidator {
* @param string $sConfigPath
* @return HttpInputValidator
*/
function HttpInputValidator($sConfigPath) {
function __construct($sConfigPath) {
// check config and logging path
if (!empty($sConfigPath) && file_exists($sConfigPath)) {
$this->sConfigPath = realpath($sConfigPath);

Datei anzeigen

@ -66,7 +66,7 @@ class cIterator
* @param $aItems array Items to add
* @return none
*/
function cIterator ($aItems)
function __construct ($aItems)
{
if (is_array($aItems))
{

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -29,7 +30,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -43,21 +43,15 @@ if (!defined('CON_FRAMEWORK')) {
* @copyright four for business 2003
*/
class Languages extends cApiLanguageCollection {
/**
* Constructor
* @param none
*/
public function __construct()
{
public function __construct() {
parent::__construct();
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function Languages()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
}
/**
@ -69,12 +63,12 @@ class Languages extends cApiLanguageCollection {
* @copyright four for business 2003
*/
class Language extends cApiLanguage {
/**
* Constructor Function
* @param mixed $mId Specifies the ID of item to load
*/
public function __construct($mId = false)
{
public function __construct($mId = false) {
if ($mId === false) {
parent::__construct();
} else {
@ -82,11 +76,4 @@ class Language extends cApiLanguage {
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function Language($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
}
?>

Datei anzeigen

@ -70,7 +70,7 @@ class cMetaObject
var $_payloadObject;
function cMetaObject ($payload = false)
function __construct ($payload = false)
{
$this->_actions = array();
$this->_fields = array();

Datei anzeigen

@ -64,7 +64,7 @@ class Contenido_Navigation {
/**
* Constructor. Loads the XML language file using XML_Doc.
*/
function Contenido_Navigation() {
function __construct() {
global $cfg, $belang;
$this->xml = new XML_Doc();

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -28,27 +29,17 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class NoteCollection extends CommunicationCollection {
class NoteCollection extends CommunicationCollection
{
public function __construct()
{
public function __construct() {
parent::__construct();
$this->_setItemClass("NoteItem");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
function NoteCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
/**
* select: Selects one or more items from the database
*
@ -58,8 +49,7 @@ class NoteCollection extends CommunicationCollection
* @access public
* @see ItemCollection
*/
public function select($where = "", $group_by = "", $order_by = "", $limit = "")
{
public function select($where = "", $group_by = "", $order_by = "", $limit = "") {
if ($where == "") {
$where = "comtype='note'";
} else {
@ -80,8 +70,7 @@ class NoteCollection extends CommunicationCollection
* @return object The new item
* @access public
*/
public function create($itemtype, $itemid, $idlang, $message, $category = "")
{
public function create($itemtype, $itemid, $idlang, $message, $category = "") {
$item = parent::createNewItem();
$item->set("subject", "Note Item");
@ -102,30 +91,26 @@ class NoteCollection extends CommunicationCollection
}
class NoteItem extends CommunicationItem
{
class NoteItem extends CommunicationItem {
}
class NoteView extends cHTMLIFrame {
class NoteView extends cHTMLIFrame
{
public function NoteView($sItemType, $sItemId)
{
public function __construct($sItemType, $sItemId) {
global $sess, $cfg;
cHTMLIFrame::cHTMLIFrame();
parent::__construct();
$this->setSrc($sess->url("main.php?itemtype=$sItemType&itemid=$sItemId&area=note&frame=2"));
$this->setBorder(0);
$this->setStyleDefinition("border", "1px solid " . $cfg['color']['table_border']);
}
}
class NoteList extends cHTMLDiv {
class NoteList extends cHTMLDiv
{
public function NoteList($sItemType, $sItemId)
{
cHTMLDiv::cHTMLDiv();
public function __construct($sItemType, $sItemId) {
parent::__construct();
$this->_sItemType = $sItemType;
$this->_sItemId = $sItemId;
@ -133,13 +118,11 @@ class NoteList extends cHTMLDiv
$this->setStyleDefinition("width", "100%");
}
public function setDeleteable($bDeleteable)
{
public function setDeleteable($bDeleteable) {
$this->_bDeleteable = $bDeleteable;
}
public function toHTML()
{
public function toHTML() {
global $cfg, $lang;
$sItemType = $this->_sItemType;
@ -187,14 +170,13 @@ class NoteList extends cHTMLDiv
return ('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>' . $result . '</td></tr></table>');
}
}
class NoteListItem extends cHTMLDiv {
class NoteListItem extends cHTMLDiv
{
public function NoteListItem($sItemType, $sItemId, $iDeleteItem)
{
cHTMLDiv::cHTMLDiv();
public function __construct($sItemType, $sItemId, $iDeleteItem) {
parent::__construct();
$this->setStyleDefinition("padding", "2px");
$this->setBackground();
$this->setDeleteable(true);
@ -202,16 +184,13 @@ class NoteListItem extends cHTMLDiv
$this->_iDeleteItem = $iDeleteItem;
$this->_sItemType = $sItemType;
$this->_sItemId = $sItemId;
}
public function setDeleteable($bDeleteable)
{
public function setDeleteable($bDeleteable) {
$this->_bDeleteable = $bDeleteable;
}
public function setBackground($dark = false)
{
public function setBackground($dark = false) {
global $cfg;
if ($dark) {
@ -221,8 +200,7 @@ class NoteListItem extends cHTMLDiv
}
}
public function setAuthor($sAuthor)
{
public function setAuthor($sAuthor) {
if (strlen($sAuthor) == 32) {
$result = getGroupOrUserName($sAuthor);
@ -234,8 +212,7 @@ class NoteListItem extends cHTMLDiv
$this->_sAuthor = $sAuthor;
}
public function setDate($iDate)
{
public function setDate($iDate) {
$dateformat = getEffectiveSetting("backend", "timeformat", "Y-m-d H:i:s");
if (is_string($iDate)) {
@ -244,13 +221,11 @@ class NoteListItem extends cHTMLDiv
$this->_sDate = date($dateformat, $iDate);
}
public function setMessage($sMessage)
{
public function setMessage($sMessage) {
$this->_sMessage = $sMessage;
}
public function render()
{
public function render() {
global $cfg, $sess;
$itemtype = $this->_sItemType;
@ -283,8 +258,8 @@ class NoteListItem extends cHTMLDiv
}
class NoteLink extends cHTMLLink
{
class NoteLink extends cHTMLLink {
/**
* @var string Object type
* @access private
@ -321,9 +296,8 @@ class NoteLink extends cHTMLLink
* @return none
* @access public
*/
public function NoteLink($sItemType, $sItemID)
{
parent::cHTMLLink();
public function __construct($sItemType, $sItemID) {
parent::__construct();
$img = new cHTMLImage("images/note.gif");
$img->setStyle("padding-left: 2px; padding-right: 2px;");
@ -345,8 +319,7 @@ class NoteLink extends cHTMLLink
* @return none
* @access public
*/
public function enableHistory()
{
public function enableHistory() {
$this->_bShowHistory = true;
}
@ -356,8 +329,7 @@ class NoteLink extends cHTMLLink
* @return none
* @access public
*/
public function disableHistory()
{
public function disableHistory() {
$this->_bShowHistory = false;
}
@ -367,8 +339,7 @@ class NoteLink extends cHTMLLink
* @return none
* @access public
*/
public function enableHistoryDelete()
{
public function enableHistoryDelete() {
$this->_bDeleteHistoryItems = true;
}
@ -378,8 +349,7 @@ class NoteLink extends cHTMLLink
* @return none
* @access public
*/
public function disableHistoryDelete()
{
public function disableHistoryDelete() {
$this->_bDeleteHistoryItems = false;
}
@ -389,8 +359,7 @@ class NoteLink extends cHTMLLink
* @return none
* @access public
*/
public function render($return = false)
{
public function render($return = false) {
global $sess;
$itemtype = $this->_sItemType;
@ -399,6 +368,5 @@ class NoteLink extends cHTMLLink
$this->setEvent("click", 'javascript:window.open(' . "'" . $sess->url("main.php?area=note&frame=1&itemtype=$itemtype&itemid=$itemid") . "', 'todo', 'resizable=yes, scrollbars=yes, height=360, width=550');");
return parent::render($return);
}
}
?>
}

Datei anzeigen

@ -96,13 +96,6 @@ class PropertyCollection extends ItemCollection
$this->_setItemClass('PropertyItem');
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function PropertyCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
/**
* Creates a new property item.
*
@ -432,13 +425,6 @@ class PropertyItem extends Item
}
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function PropertyItem($mId = false)
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($mId);
}
/**
* Stores changed PropertyItem
*/

Datei anzeigen

@ -152,7 +152,7 @@ class RequestPassword {
* @param array $aCfg - The contenido configuration array
* @access public
*/
function RequestPassword ($oDb, $aCfg) {
function __construct ($oDb, $aCfg) {
//generate new dbobject, if it does not exist
if (!is_object($oDb)) {
$this->oDb = new DB_ConLite();

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -32,20 +33,18 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
/**
* Abstract base search class. Provides general properties and functions
* for child implementations.
*
* @author Murat Purc <murat@purc.de>
*/
abstract class SearchBaseAbstract
{
abstract class SearchBaseAbstract {
/**
* Contenido database object
* @var DB_ConLite
@ -82,8 +81,7 @@ abstract class SearchBaseAbstract
* @param DB_ConLite $oDB Optional database instance
* @param bool $bDebug Optional, flag to enable debugging
*/
protected function __construct($oDB = null, $bDebug = false)
{
protected function __construct($oDB = null, $bDebug = false) {
global $cfg, $lang, $client;
$this->cfg = $cfg;
@ -104,8 +102,7 @@ abstract class SearchBaseAbstract
*
* @param bool $bDebug
*/
public function setDebug($bDebug)
{
public function setDebug($bDebug) {
$this->bDebug = (bool) $bDebug;
}
@ -115,8 +112,7 @@ abstract class SearchBaseAbstract
* @param string $msg Some text
* @param mixed $var The variable to dump
*/
protected function _debug($msg, $var)
{
protected function _debug($msg, $var) {
if (!$this->bDebug) {
return;
}
@ -129,8 +125,8 @@ abstract class SearchBaseAbstract
$dump .= '</pre>' . "\n";
echo $dump;
}
}
}
/**
* Contenido API - Index Object
@ -162,11 +158,10 @@ abstract class SearchBaseAbstract
* Keep in mind that class Search and SearchResult uses an instance of object Index.
* Consider character tables in relation 'con_chartable'.
*/
cInclude('includes', 'functions.encoding.php');
class Index extends SearchBaseAbstract
{
class Index extends SearchBaseAbstract {
/**
* the content of the cms-types of an article
* @var array
@ -243,8 +238,7 @@ class Index extends SearchBaseAbstract
* @param DB_ConLite $oDB Contenido Database object
* @return void
*/
function Index($oDB = null)
{
function __construct($oDB = null) {
parent::__construct($oDB);
$this->setContentTypes();
@ -269,8 +263,7 @@ class Index extends SearchBaseAbstract
* @param array $aStopwords Array with words which should not be indexed.
* @return void
*/
function start($idart, $aContent, $place = 'auto', $cms_options = array(), $aStopwords = array())
{
function start($idart, $aContent, $place = 'auto', $cms_options = array(), $aStopwords = array()) {
if (!is_int((int) $idart) || $idart < 0) {
return null;
} else {
@ -310,8 +303,7 @@ class Index extends SearchBaseAbstract
* @param none
* @return void
*/
function createKeywords()
{
function createKeywords() {
$tmp_keys = array();
$replace = array('&nbsp;', '&amp;', '&lt;', '&gt;', '&quot;', '&#039;');
@ -361,8 +353,7 @@ class Index extends SearchBaseAbstract
* The index_string looks like "&12=2(CMS_HTMLHEAD-1,CMS_HTML-1)"
* @return void
*/
function saveKeywords()
{
function saveKeywords() {
$tmp_count = array();
foreach ($this->keywords as $keyword => $count) {
@ -406,8 +397,7 @@ class Index extends SearchBaseAbstract
* @param none
* @return void
*/
function deleteKeywords()
{
function deleteKeywords() {
foreach ($this->keywords_del as $key_del) {
$index_string = preg_replace("/&$this->idart=[0-9]+\([\w-,]+\)/", "", $this->keywords_old[$key_del]);
@ -430,8 +420,7 @@ class Index extends SearchBaseAbstract
* @param none
* @return void
*/
function getKeywords()
{
function getKeywords() {
$keys = implode("','", array_keys($this->keywords));
$sql = "SELECT
@ -458,8 +447,7 @@ class Index extends SearchBaseAbstract
* @param $key Keyword
* @return $key
*/
function removeSpecialChars($key)
{
function removeSpecialChars($key) {
$aSpecialChars = array(
"-", "_", "'", ".", "!", "\"", "#", "$", "%", "&", "(", ")", "*", "+", ",", "/",
":", ";", "<", "=", ">", "?", "@", "[", "\\", "]", "^", "`", "{", "|", "}", "~"
@ -508,8 +496,7 @@ class Index extends SearchBaseAbstract
* @param $key Keyword
* @return $key
*/
function addSpecialUmlauts($key)
{
function addSpecialUmlauts($key) {
$key = clHtmlEntities($key, null, getEncodingByLanguage($this->db, $this->lang, $this->cfg));
$aUmlautMap = array(
'ue' => '&Uuml;',
@ -534,8 +521,7 @@ class Index extends SearchBaseAbstract
* @param array $aStopwords
* @return void
*/
function setStopwords ($aStopwords)
{
function setStopwords($aStopwords) {
if (is_array($aStopwords) && count($aStopwords) > 0) {
$this->stopwords = $aStopwords;
}
@ -546,8 +532,7 @@ class Index extends SearchBaseAbstract
* @param none
* @return void
*/
function setContentTypes()
{
function setContentTypes() {
$sql = "SELECT type, idtype FROM " . $this->cfg['tab']['type'] . ' ';
$this->_debug('sql', $sql);
$this->db->query($sql);
@ -562,8 +547,7 @@ class Index extends SearchBaseAbstract
* @param none
* @return void
*/
function setCmsOptions($cms_options)
{
function setCmsOptions($cms_options) {
if (is_array($cms_options) && count($cms_options) > 0) {
foreach ($cms_options as $opt) {
$opt = strtoupper($opt);
@ -591,15 +575,13 @@ class Index extends SearchBaseAbstract
*
* @return bolean
*/
function checkCmsType($idtype)
{
function checkCmsType($idtype) {
$idtype = strtoupper($idtype);
return (in_array($idtype, $this->cms_options)) ? false : true;
}
}
/**
* Contenido API - Search Object
*
@ -703,9 +685,7 @@ class Index extends SearchBaseAbstract
* @author Willi Man
* @copyright four for business AG <www.4fb.de>
*/
class Search extends SearchBaseAbstract
{
class Search extends SearchBaseAbstract {
/**
* Instance of class Index
@ -803,8 +783,7 @@ class Search extends SearchBaseAbstract
* @param DB_ConLite $oDB Optional database instance
* @return void
*/
function Search($options, $oDB = null)
{
function __construct($options, $oDB = null) {
parent::__construct($oDB);
$this->index = new Index($oDB);
@ -835,8 +814,7 @@ class Search extends SearchBaseAbstract
* @param string $searchwords_exclude The words, which should be excluded from search
* @return void
*/
function searchIndex($searchwords, $searchwords_exclude = '')
{
function searchIndex($searchwords, $searchwords_exclude = '') {
if (strlen(trim($searchwords)) > 0) {
$this->search_words = $this->stripWords($searchwords);
} else {
@ -869,7 +847,8 @@ class Search extends SearchBaseAbstract
}
}
if(count($tmp_searchwords) == 0) return false;
if (count($tmp_searchwords) == 0)
return false;
if ($this->search_option == 'regexp') {
// regexp search
@ -946,7 +925,6 @@ class Search extends SearchBaseAbstract
}
}
}
}
}
}
@ -981,8 +959,7 @@ class Search extends SearchBaseAbstract
* @param $cms_options The cms-types (htmlhead, html, ...) which should explicitly be searched
* @return void
*/
function setCmsOptions($cms_options)
{
function setCmsOptions($cms_options) {
if (is_array($cms_options) && count($cms_options) > 0) {
$this->index->setCmsOptions($cms_options);
}
@ -992,8 +969,7 @@ class Search extends SearchBaseAbstract
* @param $searchwords The search-words
* @return Array of stripped search-words
*/
function stripWords($searchwords)
{
function stripWords($searchwords) {
$tmp_words = array();
$searchwords = stripslashes($searchwords); // remove backslash
$searchwords = strip_tags($searchwords); // remove html tags
@ -1020,8 +996,7 @@ class Search extends SearchBaseAbstract
* @return array Category Tree
* @todo This is not the job for search, should be oursourced...
*/
function getSubTree($cat_start)
{
function getSubTree($cat_start) {
$sql = "SELECT
B.idcat, B.parentid
FROM
@ -1065,8 +1040,7 @@ class Search extends SearchBaseAbstract
* @param array $search_range
* @return array Articles in specified search range
*/
function getSearchableArticles($search_range)
{
function getSearchableArticles($search_range) {
$cat_range = array();
if (array_key_exists('cat_tree', $search_range) && is_array($search_range['cat_tree'])) {
@ -1151,8 +1125,7 @@ class Search extends SearchBaseAbstract
*
* @return array Array of article specification Ids
*/
function getArticleSpecifications()
{
function getArticleSpecifications() {
$sql = "SELECT
idartspec
FROM
@ -1175,8 +1148,7 @@ class Search extends SearchBaseAbstract
* @param int $iArtspecID
* @return void
*/
function setArticleSpecification($iArtspecID)
{
function setArticleSpecification($iArtspecID) {
array_push($this->article_specs, $iArtspecID);
}
@ -1185,8 +1157,7 @@ class Search extends SearchBaseAbstract
* @param string $sArtSpecName
* @return void
*/
function addArticleSpecificationsByName($sArtSpecName)
{
function addArticleSpecificationsByName($sArtSpecName) {
if (!isset($sArtSpecName) || strlen($sArtSpecName) == 0) {
return false;
}
@ -1207,7 +1178,6 @@ class Search extends SearchBaseAbstract
}
/**
* Contenido API - SearchResult Object
*
@ -1241,9 +1211,8 @@ class Search extends SearchBaseAbstract
* @copyright four for business AG <www.4fb.de>
*
*/
class SearchResult extends SearchBaseAbstract {
class SearchResult extends SearchBaseAbstract
{
/**
* Instance of class Index
* @var object
@ -1310,8 +1279,7 @@ class SearchResult extends SearchBaseAbstract
* @param DB_ConLite $oDB Optional db instance
* @param bool $bDebug Optional flag to enable debugging
*/
function SearchResult($search_result, $result_per_page, $oDB = null, $bDebug = false)
{
function __construct($search_result, $result_per_page, $oDB = null, $bDebug = false) {
parent::__construct($oDB, $bDebug);
$this->index = new Index($oDB);
@ -1338,8 +1306,7 @@ class SearchResult extends SearchBaseAbstract
* @param $result_per_page
* @return void
*/
function setOrderedSearchResult($ranked_search, $result_per_page)
{
function setOrderedSearchResult($ranked_search, $result_per_page) {
asort($ranked_search);
$sorted_rank = array_reverse($ranked_search, true);
@ -1358,8 +1325,7 @@ class SearchResult extends SearchBaseAbstract
* @param $art_id Id of an article
* @return Content of an article, specified by it's content type
*/
function getContent($art_id, $cms_type, $id = 0)
{
function getContent($art_id, $cms_type, $id = 0) {
$article = new Article($art_id, $this->client, $this->lang);
return $article->getContent($cms_type, $id);
}
@ -1369,8 +1335,7 @@ class SearchResult extends SearchBaseAbstract
* @param $art_id Id of an article
* @return Content of an article in search result, specified by its type
*/
function getSearchContent($art_id, $cms_type, $cms_nr = NULL)
{
function getSearchContent($art_id, $cms_type, $cms_nr = NULL) {
$cms_type = strtoupper($cms_type);
if (strlen($cms_type) > 0) {
if (!stristr($cms_type, 'cms_')) {
@ -1430,7 +1395,6 @@ class SearchResult extends SearchBaseAbstract
$content[] = $cms_content;
}
}
} else {
// searchword was not found in cms_type
if (isset($cms_nr) && is_numeric($cms_nr)) {
@ -1453,8 +1417,7 @@ class SearchResult extends SearchBaseAbstract
* @param int $page_id
* @return array Artices in page $page_id
*/
function getSearchResultPage($page_id)
{
function getSearchResultPage($page_id) {
$this->result_page = $page_id;
$result_page = $this->ordered_search_result[$page_id - 1];
return $result_page;
@ -1464,8 +1427,7 @@ class SearchResult extends SearchBaseAbstract
* Returns number of result pages
* @return int
*/
function getNumberOfPages()
{
function getNumberOfPages() {
return $this->pages;
}
@ -1473,8 +1435,7 @@ class SearchResult extends SearchBaseAbstract
* Returns number of results
* @return int
*/
function getNumberOfResults()
{
function getNumberOfResults() {
return $this->results;
}
@ -1482,8 +1443,7 @@ class SearchResult extends SearchBaseAbstract
* @param $art_id Id of an article
* @return Similarity between searchword and matching word in article
*/
function getSimilarity($art_id)
{
function getSimilarity($art_id) {
return $this->search_result[$art_id]['similarity'];
}
@ -1491,8 +1451,7 @@ class SearchResult extends SearchBaseAbstract
* @param $art_id Id of an article
* @return Number of matching searchwords found in article
*/
function getOccurrence($art_id)
{
function getOccurrence($art_id) {
$aOccurence = $this->search_result[$art_id]['occurence'];
$iSumOfOccurence = 0;
for ($i = 0; $i < count($aOccurence); $i++) {
@ -1507,8 +1466,7 @@ class SearchResult extends SearchBaseAbstract
* @param string $rep2 The closing html-tag e.g. '</b>'
* @return void
*/
function setReplacement($rep1, $rep2)
{
function setReplacement($rep1, $rep2) {
if (strlen(trim($rep1)) > 0 && strlen(trim($rep2)) > 0) {
array_push($this->replacement, $rep1);
array_push($this->replacement, $rep2);
@ -1520,8 +1478,7 @@ class SearchResult extends SearchBaseAbstract
* @return Category Id
* @todo Is not job of search, should be outsourced!
*/
function getArtCat($artid)
{
function getArtCat($artid) {
$sql = "SELECT idcat FROM " . $this->cfg['tab']['cat_art'] . "
WHERE idart = " . Contenido_Security::toInteger($artid) . " ";
$this->db->query($sql);
@ -1531,18 +1488,3 @@ class SearchResult extends SearchBaseAbstract
}
}
/**
* @deprecated
* @since 2008-07-11
*
*/
class Search_helper {
var $oDb = NULL;
function search_helper ($oDb, $lang, $client) {
}
}
?>

Datei anzeigen

@ -74,7 +74,7 @@ class SMTP
* @access public
* @return void
*/
function SMTP() {
function __construct() {
$this->smtp_conn = 0;
$this->error = null;
$this->helo_rply = null;

Datei anzeigen

@ -38,7 +38,7 @@ class Structure {
* Constructor Function
* @param
*/
function Structure() {
function __construct() {
// empty
} // end function

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -28,7 +29,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -53,35 +53,30 @@ class Table {
*/
var $cell_spacing = '';
/**
* Table cell padding
* @var string
*/
var $cell_padding = '';
/**
* Table header color
* @var string
*/
var $header_color = '';
/**
* Table light row color
* @var string
*/
var $light_color = '';
/**
* Table dark row color
* @var string
*/
var $dark_color = '';
/**
* Internal dark/light row counter
* @var bool
@ -92,7 +87,6 @@ class Table {
* Internal table width counter
* @var int
*/
var $table_cols = 0;
/**
@ -116,7 +110,7 @@ class Table {
/**
* Constructor
*/
function Table($m_bordercolor = "#EEEEEE", $m_borderstyle = "solid", $m_cellspacing = "0", $m_cellpadding="2", $m_header_color = "#222222", $m_light_color = "#AAAAAA", $m_dark_color = "#777777", $m_fullborder = false, $m_directoutput = true) {
function __construct($m_bordercolor = "#EEEEEE", $m_borderstyle = "solid", $m_cellspacing = "0", $m_cellpadding = "2", $m_header_color = "#222222", $m_light_color = "#AAAAAA", $m_dark_color = "#777777", $m_fullborder = false, $m_directoutput = true) {
$this->border_color = $m_bordercolor;
$this->border_style = $m_borderstyle;
$this->cellspacing = $m_cellspacing;
@ -126,8 +120,9 @@ class Table {
$this->light_color = $m_light_color;
$this->fullborder = $m_fullborder;
$this->directoutput = $m_directoutput;
}
} # end function
# end function
/**
* Begins the new table
@ -136,24 +131,20 @@ class Table {
*/
function start_table() {
if (!$this->fullborder)
{
if (!$this->fullborder) {
$starttable = '<table style="border: 0px; border-left:1px; border-bottom: 1px; border-color: ' . $this->border_color . '; border-style: ' . $this->border_style . '" cellspacing="' . $this->cellspacing . '" cellpadding="' . $this->cellpadding . '">';
} else {
$starttable = '<table style="border: 1px; border-color: ' . $this->border_color . '; border-style: ' . $this->border_style . '" cellspacing="' . $this->cellspacing . '" cellpadding="' . $this->cellpadding . '">';
}
if ($this->directoutput)
{
if ($this->directoutput) {
echo $starttable . "\n";
} else {
return $starttable . "\n";
}
}
} # end function
# end function
/**
* Outputs a header row
@ -164,15 +155,14 @@ class Table {
$headerrow = '<tr class="textw_medium" style="background-color: ' . $this->header_color . '" ' . $additional . '>';
if ($this->directoutput)
{
if ($this->directoutput) {
echo $headerrow . "\n";
} else {
return $headerrow . "\n";
}
} # end function
}
# end function
/**
* Outputs a regular row
@ -180,8 +170,7 @@ class Table {
* @return void
*/
function row($id = '') {
if ($this->dark_row)
{
if ($this->dark_row) {
$bgColor = $this->light_color;
} else {
$bgColor = $this->dark_color;
@ -191,16 +180,14 @@ class Table {
$row = '<tr class="text_medium" style="background-color: ' . $bgColor . '" ' . $id . '>';
if ($this->directoutput)
{
if ($this->directoutput) {
echo $row . "\n";
} else {
return $row . "\n";
}
}
} # end function
# end function
/**
* Outputs a header cell
@ -213,24 +200,21 @@ class Table {
$header_cell = '<th class="textg_medium" valign="' . $valign . '" style="border: 0px; border-top:' . $borderTop . 'px; border-right:1px; border-color: ' . $this->border_color . '; border-style: ' . $this->border_style . '" align="' . $align . '"' . $additional . '>' . $content . '</th>';
if ($this->first_cell)
{
if ($this->first_cell) {
$this->table_cols = 0;
$this->first_cell = false;
}
$this->table_cols++;
if ($this->directoutput)
{
if ($this->directoutput) {
echo $header_cell . "\n";
} else {
return $header_cell . "\n";
}
}
} # end function
# end function
/**
* Outputs a regular cell
@ -241,8 +225,7 @@ class Table {
*/
function cell($content, $align = "center", $valign = "top", $additional = "", $bSetStyle = true) {
if (strlen($content) == 0)
{
if (strlen($content) == 0) {
$content = "&nbsp;";
}
$cell = '<td ' . $additional;
@ -261,22 +244,21 @@ class Table {
$cell .= '>' . $content . '</td>';
if ($this->first_cell)
{
if ($this->first_cell) {
$this->table_cols = 0;
$this->first_cell = false;
}
$this->table_cols++;
if ($this->directoutput)
{
if ($this->directoutput) {
echo $cell . "\n";
} else {
return $cell . "\n";
}
}
} # end function
# end function
/**
* Outputs a borderless cell
@ -287,29 +269,26 @@ class Table {
*/
function borderless_cell($content, $align = "center", $valign = "top", $additional = "") {
if (strlen($content) == 0)
{
if (strlen($content) == 0) {
$content = "&nbsp;";
}
$borderless_cell = '<td ' . $additional . ' valign="' . $valign . '" align="' . $align . '">' . $content . '</td>';
if ($this->first_cell)
{
if ($this->first_cell) {
$this->table_cols = 0;
$this->first_cell = false;
}
$this->table_cols++;
if ($this->directoutput)
{
if ($this->directoutput) {
echo $borderless_cell . "\n";
} else {
return $borderless_cell . "\n";
}
}
} # end function
# end function
/**
* Outputs a sum cell
@ -319,44 +298,37 @@ class Table {
*/
function sumcell($content, $align = "center", $valign = "top") {
if (strlen($content) == 0)
{
if (strlen($content) == 0) {
$content = "&nbsp;";
}
$sumcell = '<td colspan="' . $this->table_cols . '" valign="' . $valign . '" style="border: 0px; border-top:0px; border-right:1px; border-color: ' . $this->border_color . '; border-style: ' . $this->border_style . '" align="' . $align . '">' . $content . '</td>';
if ($this->directoutput)
{
if ($this->directoutput) {
echo $sumcell . "\n";
} else {
return $sumcell . "\n";
}
}
} # end function
# end function
/**
* Ends a row
* @param none
* @return void
*/
function end_row()
{
function end_row() {
$end_row = '</tr>';
$this->first_cell = true;
if ($this->directoutput)
{
if ($this->directoutput) {
echo $end_row . "\n";
} else {
return $end_row . "\n";
}
}
/**
* Ends a table
* @param none
@ -365,14 +337,15 @@ class Table {
function end_table() {
$end_table = '</table>';
if ($this->directoutput)
{
if ($this->directoutput) {
echo $end_table . "\n";
} else {
return $end_table . "\n";
}
} # end function
}
} # end class Table
# end function
}
# end class Table
?>

Datei anzeigen

@ -42,13 +42,6 @@ class TODOCollection extends CommunicationCollection
$this->_setItemClass("TODOItem");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function TODOCollection()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
public function select($where = "", $group_by = "", $order_by = "", $limit = "")
{
if ($where == "") {

Datei anzeigen

@ -129,7 +129,7 @@ class TreeItem
* @param string $id The unique ID of that item
* @param boolean $collapsed Is this item collapsed by default
*/
function TreeItem($name ="", $id="", $collapsed = false)
function __construct($name ="", $id="", $collapsed = false)
{
$this->name = $name;
$this->id = $id;

Datei anzeigen

@ -38,7 +38,7 @@ class UI_Left_Top {
var $link;
var $javascripts;
function UI_Left_Top() {
function __construct() {
}
@ -53,7 +53,7 @@ class UI_Left_Top {
function render() {
global $sess, $cfg;
$tpl = new Template;
$tpl = new Template();
$tpl->reset();
$tpl->set('s', 'SESSID', $sess->id);
@ -100,7 +100,7 @@ class UI_Menu {
var $show;
var $bgColor;
function UI_Menu() {
function __construct() {
$this->padding = 2;
$this->border = 0;
$this->rowmark = true;
@ -147,7 +147,7 @@ class UI_Menu {
function render($print = true) {
global $sess, $cfg;
$tpl = new Template;
$tpl = new Template();
$tpl->reset();
$tpl->set('s', 'SID', $sess->id);
@ -284,7 +284,7 @@ class UI_Table_Form {
var $accesskey;
var $width;
function UI_Table_Form($name, $action = "", $method = "post") {
function __construct($name, $action = "", $method = "post") {
global $sess, $cfg;
$this->formname = $name;
@ -635,7 +635,7 @@ class UI_Page {
var $content;
var $margin;
function UI_Page() {
function __construct() {
$this->margin = 10;
}
@ -674,7 +674,7 @@ class UI_Page {
function render($print = true) {
global $sess, $cfg;
$tpl = new Template;
$tpl = new Template();
$scripts = "";
@ -848,7 +848,7 @@ class UI_List {
var $solid;
var $width;
function UI_List() {
function __construct() {
$this->padding = 2;
$this->border = 0;
}
@ -897,8 +897,8 @@ class UI_List {
function render($print = false) {
global $sess, $cfg;
$tpl = new Template;
$tpl2 = new Template;
$tpl = new Template();
$tpl2 = new Template();
$tpl->reset();
$tpl->set('s', 'SID', $sess->id);
@ -1075,45 +1075,45 @@ class cScrollList {
*
* @param $defaultstyle boolean use the default style for object initializing?
*/
function cScrollList($defaultstyle = true, $action = "") {
function __construct($defaultstyle = true, $action = "") {
global $cfg, $area, $frame;
$this->resultsPerPage = 0;
$this->listStart = 1;
$this->sortable = false;
$this->objTable = new cHTMLTable;
$this->objTable = new cHTMLTable();
if ($defaultstyle == true) {
$this->objTable->setStyle('border-collapse:collapse;border: 1px; border-style: solid; border-top:0px;border-color: ' . $cfg["color"]["table_border"] . ';');
$this->objTable->updateAttributes(array("cellspacing" => 0, "cellpadding" => 2));
}
$this->objHeaderRow = new cHTMLTableRow;
$this->objHeaderRow = new cHTMLTableRow();
if ($defaultstyle == true) {
$this->objHeaderRow->setClass("text_medium");
$this->objHeaderRow->setStyle("background-color: #E2E2E2;white-space:nowrap;");
}
$this->objHeaderItem = new cHTMLTableHead;
$this->objHeaderItem = new cHTMLTableHead();
if ($defaultstyle == true) {
$this->objHeaderItem->setClass("textg_medium");
$this->objHeaderItem->setStyle('white-space:nowrap; border: 1px; border-style: solid;border-bottom: 0px;border-color: ' . $cfg["color"]["table_border"] . ';');
$this->objHeaderItem->updateAttributes(array("align" => "left"));
}
$this->objRow = new cHTMLTableRow;
$this->objRow = new cHTMLTableRow();
if ($defaultstyle == true) {
$this->objRow->setClass("text_medium");
}
$this->objItem = new cHTMLTableData;
$this->objItem = new cHTMLTableData();
if ($defaultstyle == true) {
$this->objItem->setStyle('white-space:nowrap; border: 1px; border-style: solid;border-top:0px;border-color: ' . $cfg["color"]["table_border"] . ';');
}
$this->sortlink = new cHTMLLink;
$this->sortlink = new cHTMLLink();
$this->sortlink->setStyle("color: #666666;");
$this->sortlink->setCLink($area, $frame, $action);
}
@ -1402,5 +1402,5 @@ class cScrollList {
echo $output;
}
}
}
?>

Datei anzeigen

@ -691,6 +691,7 @@ class Contenido_UpdateNotifier {
if ($this->sRSSContent != '') {
$oRss = simplexml_load_file($this->sCacheDirectory . $this->sRSSFile);
//echo $sFeedContent;
$iCnt = 0;
foreach ($oRss->channel->item as $aItem) {

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -32,13 +33,11 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class Users
{
class Users {
/**
* Storage of the source table to use for the user informations
@ -58,8 +57,7 @@ class Users
* Constructor Function
* @param string $table The table to use as information source
*/
function Users($table = '')
{
function __construct($table = '') {
if ($table == '') {
global $cfg;
$this->table = $cfg['tab']['phplib_auth_user_md5'];
@ -70,15 +68,13 @@ class Users
$this->db = new DB_ConLite();
}
/**
* Creates a new user by specifying its username.
*
* @param string $username Specifies the username
* @return int Userid of created user
*/
function create($username)
{
function create($username) {
$newuserid = md5($username);
$sql = "SELECT user_id FROM " . $this->table
. " WHERE user_id = '" . Contenido_Security::escapeDB($newuserid, $this->db) . "'";
@ -95,37 +91,32 @@ class Users
return $newuserid;
}
/**
* Removes the specified user from the database.
*
* @param string $userid Specifies the user ID
* @return bool True if the delete was successful
*/
function deleteUserByID($userid)
{
function deleteUserByID($userid) {
$sql = "DELETE FROM " . $this->table
. " WHERE user_id = '" . Contenido_Security::escapeDB($userid, $this->db) . "'";
$this->db->query($sql);
return ($this->db->affected_rows() == 0) ? false : true;
}
/**
* Removes the specified user from the database.
*
* @param string $userid Specifies the username
* @return bool True if the delete was successful
*/
function deleteUserByUsername($username)
{
function deleteUserByUsername($username) {
$sql = "DELETE FROM " . $this->table
. " WHERE username = '" . Contenido_Security::escapeDB($username, $this->db) . "'";
$this->db->query($sql);
return ($this->db->affected_rows() == 0) ? false : true;
}
/**
* Returns all users which are accessible by the current user.
*
@ -133,8 +124,7 @@ class Users
* @param bool $includeAdmins Flag to get admins (admin and sysadmin) too
* @return array Array of user objects
*/
function getAccessibleUsers($perms, $includeAdmins = false)
{
function getAccessibleUsers($perms, $includeAdmins = false) {
global $cfg;
$clientclass = new Client();
@ -186,8 +176,8 @@ class Users
return ($users);
}
}
}
/**
* Class User
@ -196,8 +186,7 @@ class Users
* @version 1.0
* @copyright four for business 2003
*/
class User
{
class User {
/**
* Storage of the source table to use for the user informations
@ -232,8 +221,7 @@ class User
*
* @param string $table The table to use as information source
*/
function User($table = '')
{
function __construct($table = '') {
if ($table == '') {
global $cfg;
$this->table = $cfg['tab']['phplib_auth_user_md5'];
@ -244,15 +232,13 @@ class User
$this->db = new DB_ConLite();
}
/**
* Loads a user from the database by its username.
*
* @param string $username Specifies the username
* @return bool True if the load was successful
*/
function loadUserByUsername($username)
{
function loadUserByUsername($username) {
// SQL-Statement to select by username
$sql = "SELECT * FROM " . $this->table
. " WHERE username = '" . Contenido_Security::escapeDB($username, $this->db) . "'";
@ -270,15 +256,13 @@ class User
return true;
}
/**
* Loads a user from the database by its userID.
*
* @param string $userid Specifies the userID
* @return bool True if the load was successful
*/
function loadUserByUserID($userID)
{
function loadUserByUserID($userID) {
// SQL-Statement to select by userID
$sql = "SELECT * FROM " . $this->table
. " WHERE user_id = '" . Contenido_Security::escapeDB($userID, $this->db) . "'";
@ -296,15 +280,13 @@ class User
return true;
}
/**
* Function returns effective perms for user including group rights as perm string.
*
* @author Timo Trautmann
* @return string Current users permissions
*/
function getEffectiveUserPerms()
{
function getEffectiveUserPerms() {
global $cfg, $perm;
//first get users own permissions and filter them into result array $aUserPerms
@ -336,38 +318,32 @@ class User
return implode(',', $aUserPerms);
}
/**
* Gets the value of a specific field.
*
* @param string $field Specifies the field to retrieve
* @return mixed Value of the field
*/
function getField($field)
{
function getField($field) {
return ($this->values[$field]);
}
/**
* Sets the value of a specific field.
*
* @param string $field Specifies the field to set
* @param string $value Specifies the value to set
*/
function setField($field, $value)
{
function setField($field, $value) {
$this->modifiedValues[$field] = true;
$this->values[$field] = $value;
}
/**
* Stores the modified user object to the database
* @return bool
*/
function store()
{
function store() {
$sql = "UPDATE " . $this->table . " SET ";
$first = true;
@ -391,7 +367,6 @@ class User
}
}
/**
* Stores the modified user object to the database
* @param string type Specifies the type (class, category etc) for the property to retrieve
@ -399,8 +374,7 @@ class User
* @param boolean group Specifies if this function should recursively search in groups
* @return string The value of the retrieved property
*/
function getUserProperty($type, $name, $group = false)
{
function getUserProperty($type, $name, $group = false) {
global $cfg, $perm;
if (!is_object($perm)) {
@ -444,7 +418,6 @@ class User
}
}
/**
* Stores the modified user object to the database
*
@ -452,8 +425,7 @@ class User
* @param boolean bGroup Specifies if this function should recursively search in groups
* @return array The value of the retrieved property
* */
function getUserPropertiesByType($sType, $bGroup = false)
{
function getUserPropertiesByType($sType, $bGroup = false) {
global $cfg, $perm;
if (!is_object($perm)) {
@ -491,7 +463,6 @@ class User
return $aResult;
}
/**
* Retrieves all available properties of the user
* @return array Assoziative properties list as follows:
@ -499,8 +470,7 @@ class User
* - $arr[iduserprop][type]
* - $arr[iduserprop][value]
*/
function getUserProperties()
{
function getUserProperties() {
global $cfg;
$aProps = array();
@ -524,22 +494,19 @@ class User
return $aProps;
}
/**
* Stores a property to the database
* @param string type Specifies the type (class, category etc) for the property to retrieve
* @param string name Specifies the name of the property to retrieve
* @param string value Specifies the value to insert
*/
function setUserProperty($type, $name, $value)
{
function setUserProperty($type, $name, $value) {
global $cfg;
$value = urlencode($value);
// Check if such an entry already exists
if ($this->getUserProperty($type, $name) !== false)
{
if ($this->getUserProperty($type, $name) !== false) {
$sql = "UPDATE " . $cfg['tab']['user_prop'] . "
SET value = '" . Contenido_Security::escapeDB($value, $this->db) . "'
WHERE user_id = '" . Contenido_Security::escapeDB($this->values['user_id'], $this->db) . "'
@ -557,14 +524,12 @@ class User
}
}
/**
* Deletes a user property from the table
* @param string type Specifies the type (class, category etc) for the property to retrieve
* @param string name Specifies the name of the property to retrieve
*/
function deleteUserProperty($type, $name)
{
function deleteUserProperty($type, $name) {
global $cfg;
// Delete record from table
@ -575,14 +540,12 @@ class User
$this->db->query($sql);
}
/**
* Returns all users available in the system
* @param string $sort SQL sort part
* @return array Array with id and name entries
*/
function getAvailableUsers($sort = 'ORDER BY realname ASC')
{
function getAvailableUsers($sort = 'ORDER BY realname ASC') {
global $cfg;
$db = new DB_ConLite();
@ -606,14 +569,12 @@ class User
return ($users);
}
/**
* Returns all system admins available in the system
* @param boolean $forceActive Is forceActive true return only activ Sysadmins
* @return array Array with id and name entries
*/
function getSystemAdmins($forceActive = false)
{
function getSystemAdmins($forceActive = false) {
global $cfg;
$db = new DB_ConLite();
@ -645,14 +606,12 @@ class User
return ($users);
}
/**
* Returns all system admins available in the system
* @param int $client
* @return array Array with id and name entries
*/
function getClientAdmins($client)
{
function getClientAdmins($client) {
global $cfg;
$db = new DB_ConLite();
@ -681,14 +640,12 @@ class User
return ($users);
}
/**
* Returns the username of the given userid
* @param int $userid
* @return string Username if found, or emptry string if not.
*/
function getUsername($userid)
{
function getUsername($userid) {
global $cfg;
$db = new DB_ConLite();
@ -705,15 +662,13 @@ class User
return ($db->f('username'));
}
/**
* Returns the realname of the given userid
* @param int $userid
* @param bool $bAllowFallbackOnUsername
* @return string Realname if found, or emptry string if not.
*/
function getRealname($userid, $bAllowFallbackOnUsername = false)
{
function getRealname($userid, $bAllowFallbackOnUsername = false) {
global $cfg;
$db = new DB_ConLite();
@ -735,14 +690,12 @@ class User
}
}
/**
* Returns the realname of the given username
* @param string $username
* @return string Realname if found, or emptry string if not.
*/
function getRealnameByUserName($username)
{
function getRealnameByUserName($username) {
global $cfg;
$db = new DB_ConLite();
@ -759,14 +712,12 @@ class User
return ($db->f('realname'));
}
/**
* Returns the groups a user is in
* @param int $userid
* @return array Real names of groups
*/
function getGroupsByUserID($userid)
{
function getGroupsByUserID($userid) {
global $cfg;
$db = new DB_ConLite();
@ -804,14 +755,12 @@ class User
return $arrGroups;
}
/**
* Returns the groups a user is in
* @param int $userid
* @return array Ids of groups
*/
function getGroupIDsByUserID($userid)
{
function getGroupIDsByUserID($userid) {
global $cfg;
$db = new DB_ConLite();
@ -838,5 +787,3 @@ class User
}
}
?>

Datei anzeigen

@ -41,7 +41,7 @@ class cWYSIWYGEditor
var $_sEditorContent;
var $_aSettings;
function cWYSIWYGEditor ($sEditorName, $sEditorContent)
function __construct ($sEditorName, $sEditorContent)
{
global $cfg;

Datei anzeigen

@ -83,7 +83,7 @@ class XML_doc {
/**
* Class Construcor
*/
function XML_doc() {
function __construct() {
global $encoding, $lang;
$this->sys_encoding = $encoding[$lang];

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -27,7 +28,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -91,8 +91,8 @@ if(!defined('CON_FRAMEWORK')) {
* @copyright four for business AG <www.4fb.de>
* @version 1.0
*/
class XmlParser
{
class XmlParser {
/**
* XML Parser autofree
*
@ -179,10 +179,8 @@ class XmlParser
* @param string $sEncoding Encoding used when parsing files (default: UTF-8, as in PHP5)
* @return void
*/
function XmlParser($sEncoding = false)
{
if (!$sEncoding)
{
function __construct($sEncoding = false) {
if (!$sEncoding) {
$sEncoding = "UTF-8";
}
@ -196,10 +194,8 @@ class XmlParser
* @param string $sEncoding Encoding used when parsing files (default: UTF-8, as in PHP5)
* @return void
*/
function _init($sEncoding = false)
{
if (!$sEncoding)
{
function _init($sEncoding = false) {
if (!$sEncoding) {
$sEncoding = "UTF-8";
}
// Create parser instance
@ -224,8 +220,7 @@ class XmlParser
* @return string XML Error message
* @access private
*/
function _error()
{
function _error() {
$this->error = "XML error: " . xml_error_string(xml_get_error_code($this->parser)) . " at line " . xml_get_current_line_number($this->parser);
return $this->error;
}
@ -259,27 +254,22 @@ class XmlParser
* @access public
* @return void
*/
function setEventHandlers($options = array(NULL))
{
function setEventHandlers($options = array(NULL)) {
$options = $this->_changeKeyCase($options);
if (array_key_exists('startelement', $options))
{
if (array_key_exists('startelement', $options)) {
$this->events['startelement'] = $options['startelement'];
}
if (array_key_exists('endelement', $options))
{
if (array_key_exists('endelement', $options)) {
$this->events['endelement'] = $options['endelement'];
}
if (array_key_exists('characterdata', $options))
{
if (array_key_exists('characterdata', $options)) {
$this->events['characterdata'] = $options['characterdata'];
}
if (array_key_exists('processinginstruction', $options))
{
if (array_key_exists('processinginstruction', $options)) {
$this->events['processinginstruction'] = $options['processinginstruction'];
}
@ -296,17 +286,13 @@ class XmlParser
* @return void
* @access private
*/
function _processingInstruction($parser, $target, $data)
{
function _processingInstruction($parser, $target, $data) {
$handler = $this->_getEventHandler('processinginstruction');
if ($handler)
{
if (is_array($handler))
{
if ($handler) {
if (is_array($handler)) {
$handler[0]->$handler[1]($target, $data);
} else
{
} else {
$handler($target, $data);
}
}
@ -321,12 +307,10 @@ class XmlParser
* @return array Array with lowercased keys
* @access private
*/
function _changeKeyCase($options = array())
{
function _changeKeyCase($options = array()) {
$tmp = array();
foreach ($options as $key => $value)
{
foreach ($options as $key => $value) {
$tmp[strtolower($key)] = $value;
}
@ -341,17 +325,14 @@ class XmlParser
* @return sring Event handler name
* @access private
*/
function _getEventHandler($event)
{
function _getEventHandler($event) {
// Standard events
if (array_key_exists($event, $this->events))
{
if (array_key_exists($event, $this->events)) {
return $this->events[$event];
}
// Paths events
if (array_key_exists($event, $this->events['paths']))
{
if (array_key_exists($event, $this->events['paths'])) {
return $this->events['paths'][$event];
}
@ -369,14 +350,11 @@ class XmlParser
* @return array Paths array
* @access private
*/
function _getDefinedPaths($options)
{
function _getDefinedPaths($options) {
$tmp = array();
foreach ($options as $key => $value)
{
if (strstr($key, '/'))
{
foreach ($options as $key => $value) {
if (strstr($key, '/')) {
$tmp[$key] = $value;
}
}
@ -391,8 +369,7 @@ class XmlParser
* @access private
* @return void
*/
function _addPath($depth, $name)
{
function _addPath($depth, $name) {
$this->paths[$depth] = $name;
}
@ -401,12 +378,10 @@ class XmlParser
*
* @access private
*/
function _getActivePath()
{
function _getActivePath() {
$tmp = array();
for ($i=0; $i<=$this->depth; $i++)
{
for ($i = 0; $i <= $this->depth; $i++) {
$tmp[] = $this->paths[$i];
}
@ -424,8 +399,7 @@ class XmlParser
* @return void
* @access private
*/
function _startElement($parser, $name, $attribs)
{
function _startElement($parser, $name, $attribs) {
// Increase depth
$this->depth ++;
@ -433,11 +407,9 @@ class XmlParser
$this->activenode = $name;
// Increase element counter
if ($this->activenode == $this->pathdata[$this->activepath][$this->count]['name'])
{
if ($this->activenode == $this->pathdata[$this->activepath][$this->count]['name']) {
$this->count ++;
} else
{
} else {
$this->count = 0;
}
@ -448,13 +420,10 @@ class XmlParser
$handler = $this->_getEventHandler('startelement');
// If a handler is defined call it
if ($handler)
{
if (is_array($handler))
{
if ($handler) {
if (is_array($handler)) {
$handler[0]->$handler[1]($name, $attribs);
} else
{
} else {
$handler($name, $attribs);
}
}
@ -475,11 +444,9 @@ class XmlParser
* @return void
* @access private
*/
function _characterData($parser, $data)
{
function _characterData($parser, $data) {
// Reset node count
if ($this->activenode != $this->pathdata[$this->activepath][$this->count]['name'])
{
if ($this->activenode != $this->pathdata[$this->activepath][$this->count]['name']) {
$this->count = 0;
}
@ -490,13 +457,10 @@ class XmlParser
$handler = $this->_getEventHandler('characterdata');
// If a handler is defined call it
if ($handler)
{
if (is_array($handler))
{
if ($handler) {
if (is_array($handler)) {
$handler[0]->$handler[1]($data);
} else
{
} else {
$handler($data);
}
}
@ -511,19 +475,15 @@ class XmlParser
* @return void
* @access private
*/
function _endElement($parser, $name)
{
function _endElement($parser, $name) {
// Get the handler for this event
$handler = $this->_getEventHandler('endelement');
// Call Element handler
if ($handler)
{
if (is_array($handler))
{
if ($handler) {
if (is_array($handler)) {
$handler[0]->$handler[1]($name);
} else
{
} else {
$handler($name);
}
}
@ -535,15 +495,12 @@ class XmlParser
$handler = $this->_getEventHandler($this->activepath);
// Call path handler
if ($handler)
{
if (is_array($handler))
{ // Handler is an object method
if ($handler) {
if (is_array($handler)) { // Handler is an object method
$handler[0]->$handler[1]($this->pathdata[$this->activepath][$this->count]['name'],
$this->pathdata[$this->activepath][$this->count]['attribs'],
$this->pathdata[$this->activepath][$this->count]['content']);
} else
{ // Handler is a function
} else { // Handler is a function
$handler($this->pathdata[$this->activepath][$this->count]['name'],
$this->pathdata[$this->activepath][$this->count]['attribs'],
$this->pathdata[$this->activepath][$this->count]['content']);
@ -562,17 +519,14 @@ class XmlParser
* @return bool
* @access public
*/
function parse($data, $final = false)
{
function parse($data, $final = false) {
$success = xml_parse($this->parser, trim($data), $final);
if ($final && $this->autofree)
{
if ($final && $this->autofree) {
xml_parser_free($this->parser);
}
if (!$success)
{
if (!$success) {
return $this->_error();
}
@ -587,30 +541,26 @@ class XmlParser
* @return bool
* @access public
*/
function parseFile($file)
{
if (!($fp = fopen($file, "rb")))
{
function parseFile($file) {
if (!($fp = fopen($file, "rb"))) {
}
while ($sData = fread($fp, 4096))
{
if (!xml_parse($this->parser, $sData, feof($fp)))
{
while ($sData = fread($fp, 4096)) {
if (!xml_parse($this->parser, $sData, feof($fp))) {
$this->_error();
return false;
}
}
if ($this->autofree)
{
if ($this->autofree) {
xml_parser_free($this->parser);
}
return true;
}
} // XML_Parser
}
// XML_Parser
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -28,7 +29,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -66,8 +66,8 @@ if(!defined('CON_FRAMEWORK')) {
* !! ALWAYS use '=&' with the addRoot and appendChild methods. !!
*
*/
class XmlTree
{
class XmlTree {
/**
* XML Version string
* @var string
@ -132,8 +132,7 @@ class XmlTree
*
* @return void
*/
function XmlTree($strXmlVersion = '1.0', $strXmlEncoding = 'UTF-8')
{
function __construct($strXmlVersion = '1.0', $strXmlEncoding = 'UTF-8') {
$this->_strXmlVersion = 'version="' . $strXmlVersion . '"';
$this->_strXmlEncoding = 'encoding="' . $strXmlEncoding . '"';
}
@ -147,10 +146,8 @@ class XmlTree
*
* @return object Reference to the root node object
*/
function &addRoot($strNodeName, $strNodeContent = '', $arrNodeAttribs = array())
{
if (!$strNodeName)
{
function &addRoot($strNodeName, $strNodeContent = '', $arrNodeAttribs = array()) {
if (!$strNodeName) {
return 'XmlTree::addRoot() -> No node name specified';
}
@ -165,10 +162,8 @@ class XmlTree
*
* @return string Tree XML
*/
function dump($bolReturn = false)
{
if (!is_object($this->_objRoot))
{
function dump($bolReturn = false) {
if (!is_object($this->_objRoot)) {
return 'XmlTree::dump() -> There is no root node';
}
@ -176,8 +171,7 @@ class XmlTree
$this->_strXml = sprintf("<?xml %s %s?>\n", $this->_strXmlVersion, $this->_strXmlEncoding);
$this->_strXml .= $this->_objRoot->toXml();
if ($bolReturn)
{
if ($bolReturn) {
return $this->_strXml;
}
@ -189,12 +183,13 @@ class XmlTree
* @param int level
* @return void
*/
function setIndent($string)
{
function setIndent($string) {
$this->_indentChar = $string;
}
} // XmlTree
}
// XmlTree
/**
* XmlNode Object
@ -206,8 +201,8 @@ class XmlTree
* !! ALWAYS use '=&' with the addRoot and appendChild methods. !!
*
*/
class XmlNode
{
class XmlNode {
/**
* Indenting character
* @var string
@ -285,10 +280,8 @@ class XmlNode
*
* @return void
*/
function XmlNode($strNodeName, $strNodeContent = '', $arrNodeAttribs = array(), $cdata = false)
{
if (!$strNodeName)
{
function __construct($strNodeName, $strNodeContent = '', $arrNodeAttribs = array(), $cdata = false) {
if (!$strNodeName) {
return $this->_throwError($this, '%s::Construtctor() : No node name specified.');
}
@ -306,8 +299,7 @@ class XmlNode
*
* @return void
*/
function setNodeName($strNodeName)
{
function setNodeName($strNodeName) {
$this->_strNodeName = $strNodeName;
}
@ -318,8 +310,7 @@ class XmlNode
*
* @return void
*/
function setNodeContent($strNodeContent)
{
function setNodeContent($strNodeContent) {
$this->_strNodeContent = $strNodeContent;
}
@ -330,8 +321,7 @@ class XmlNode
*
* @return void
*/
function setNodeAttribs($arrNodeAttribs)
{
function setNodeAttribs($arrNodeAttribs) {
$this->_arrNodeAttribs = $arrNodeAttribs;
}
@ -342,8 +332,7 @@ class XmlNode
*
* @return void
*/
function setNodeParent(&$objParent)
{
function setNodeParent(&$objParent) {
$this->parentNode = $objParent;
}
@ -354,8 +343,7 @@ class XmlNode
*
* @return void
*/
function addNodeContent($strNodeContent)
{
function addNodeContent($strNodeContent) {
$this->_strNodeContentAdded = $strNodeContent;
}
@ -364,8 +352,7 @@ class XmlNode
*
* @return boolean
*/
function hasChilds()
{
function hasChilds() {
return ($this->_intChildCount > 0) ? true : false;
}
@ -379,10 +366,8 @@ class XmlNode
*
* @return object Reference to the new node object
*/
function &appendChild($strNodeName, $strNodeContent = '', $arrNodeAttribs = array(), $cdata = false)
{
if (!$strNodeName)
{
function &appendChild($strNodeName, $strNodeContent = '', $arrNodeAttribs = array(), $cdata = false) {
if (!$strNodeName) {
return $this->_throwError($this, '%s::appendChild() : No node name specified');
}
@ -399,8 +384,7 @@ class XmlNode
*
* @see appendChild
*/
function &add($strNodeName, $strNodeContent = '', $arrNodeAttribs = array(), $cdata = false)
{
function &add($strNodeName, $strNodeContent = '', $arrNodeAttribs = array(), $cdata = false) {
return $this->appendChild($strNodeName, $strNodeContent, $arrNodeAttribs, $cdata);
}
@ -411,8 +395,7 @@ class XmlNode
* @return string XML String
* @access private
*/
function toXml($indent = 0)
{
function toXml($indent = 0) {
// Indent for nodes markub
$sp = $this->_getIndent($indent);
@ -426,37 +409,30 @@ class XmlNode
$maxNodes = count($this->childNodes);
if ($this->_strNodeContent != '' || $this->_strNodeContentAdded != '' || $maxNodes > 0)
{
if ($this->_strNodeContent != '' || $this->_strNodeContentAdded != '' || $maxNodes > 0) {
$this->_strXml .= ">";
if ($this->_cdata)
{
if ($this->_cdata) {
$this->_strXml .= "$csp<![CDATA[ ";
$content = $this->_strNodeContent . $this->_strNodeContentAdded;
$this->_strXml .= $content;
} else {
$content = $this->_strNodeContent . $this->_strNodeContentAdded;
$this->_strXml .= ($content != "") ? "$content" : $content;
}
if ($this->_cdata)
{
if ($this->_cdata) {
$this->_strXml .= " ]]>";
}
for ($i=0; $i<$maxNodes; $i++)
{
for ($i = 0; $i < $maxNodes; $i++) {
$this->childNodes[$i]->setIndent($this->_indentChar);
$this->_strXml .= $this->childNodes[$i]->toXml($indent);
}
$this->_strXml .= "$sp</" . $this->_strNodeName . ">\n";
} else
{
} else {
$this->_strXml .= "/>\n";
}
@ -471,14 +447,11 @@ class XmlNode
* @return string Attribute string
* @access private
*/
function _parseAttributes($arrAttributes = array())
{
function _parseAttributes($arrAttributes = array()) {
$strAttributes = '';
if (is_array($arrAttributes))
{
foreach ($arrAttributes as $name => $value)
{
if (is_array($arrAttributes)) {
foreach ($arrAttributes as $name => $value) {
$strAttributes .= ' ' . $name . '="' . $value . '"';
}
}
@ -491,8 +464,7 @@ class XmlNode
* @param int level
* @return string indent string
*/
function _getIndent($level)
{
function _getIndent($level) {
return $this->_strXml .= str_repeat($this->_indentChar, $level);
}
@ -501,11 +473,8 @@ class XmlNode
* @param int level
* @return void
*/
function setIndent($string = "")
{
function setIndent($string = "") {
$this->_indentChar = $string;
}
} // XmlNode
?>
}

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -27,7 +28,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -49,8 +49,8 @@ if(!defined('CON_FRAMEWORK')) {
* $html = $xslt->process();
*
*/
class XsltProcessor
{
class XsltProcessor {
/**
* XSML Processor auto-free
* @var bool
@ -118,8 +118,7 @@ class XsltProcessor
* Constructor
* @access private
*/
function XsltProcessor()
{
function __construct() {
$this->_init();
}
@ -128,10 +127,8 @@ class XsltProcessor
* @access private
* @return void
*/
function _init()
{
if (!function_exists("xslt_create"))
{
function _init() {
if (!function_exists("xslt_create")) {
die("Cannot instantiate XSLT Class \n XSLT not supported");
}
@ -151,13 +148,12 @@ class XsltProcessor
$literal2NumericEntity = array();
if (empty($literal2NumericEntity))
{
if (empty($literal2NumericEntity)) {
$transTbl = clGetHtmlTranslationTable(HTML_ENTITIES);
foreach ($transTbl as $char => $entity)
{
if (strpos('&"<>', $char) !== FALSE) continue;
foreach ($transTbl as $char => $entity) {
if (strpos('&"<>', $char) !== FALSE)
continue;
$literal2NumericEntity[$entity] = '&#' . ord($char) . ';';
}
}
@ -165,15 +161,13 @@ class XsltProcessor
return strtr($stringXml, $literal2NumericEntity);
}
/**
* Set the XML to be Transformed
* @param string The XML String
* @return void
* @access public
*/
function setXml($xml)
{
function setXml($xml) {
$this->arguments["/_xml"] = $this->literal2NumericEntities($xml);
}
@ -183,8 +177,7 @@ class XsltProcessor
* @return void
* @access public
*/
function setXsl($xsl)
{
function setXsl($xsl) {
$this->arguments["/_xsl"] = $this->literal2NumericEntities($xsl);
}
@ -194,8 +187,7 @@ class XsltProcessor
* @return void
* @access public
*/
function setXmlFile($file)
{
function setXmlFile($file) {
$xml = $this->readFromFile($file);
$this->arguments["/_xml"] = $this->literal2NumericEntities($xml);
}
@ -206,8 +198,7 @@ class XsltProcessor
* @return void
* @access public
*/
function setXslFile($file)
{
function setXslFile($file) {
$xsl = $this->readFromFile($file);
$this->arguments["/_xsl"] = $this->literal2NumericEntities($xsl);
}
@ -220,10 +211,8 @@ class XsltProcessor
* @return string File contents
* @access private
*/
function readFromFile($file)
{
if (file_exists($file))
{
function readFromFile($file) {
if (file_exists($file)) {
$data = file($file);
$data = join($data, "");
return $data;
@ -241,8 +230,7 @@ class XsltProcessor
* @param string Value
* @return void
*/
function setParam($name, $value)
{
function setParam($name, $value) {
$this->parameters[$name] = utf8_encode($value);
}
@ -282,8 +270,7 @@ class XsltProcessor
* @return void
* @access public
*/
function setSchemeHandlers($aHandlers)
{
function setSchemeHandlers($aHandlers) {
xslt_set_scheme_handlers($this->processor, $aHandlers);
}
@ -294,14 +281,12 @@ class XsltProcessor
* @return string Transformed data
* @access public
*/
function process()
{
function process() {
$this->result = xslt_process($this->processor, "arg:/_xml", "arg:/_xsl", NULL, $this->arguments, $this->parameters);
$this->error = xslt_error($this->processor);
$this->errno = xslt_errno($this->processor);
if ($this->autofree)
{
if ($this->autofree) {
xslt_free($this->processor);
}
@ -315,10 +300,8 @@ class XsltProcessor
* @return void
* @access public
*/
function printErrors()
{
if ($this->errno > 0)
{
function printErrors() {
if ($this->errno > 0) {
echo "<b>Error Number: </b><span style=\"color:red\">" . $this->errno . "</span> ";
echo "<b>Error Message: </b><span style=\"color:red\">" . $this->error . "</span>";
}
@ -328,12 +311,8 @@ class XsltProcessor
* Manual free of the parser
* @return void
*/
function free()
{
function free() {
xslt_free($this->processor);
}
} // XSLT_Processor
?>
}

Datei anzeigen

@ -37,12 +37,6 @@ class cApiModuleCollection extends ItemCollection {
$this->_setItemClass("cApiModule");
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function cApiModuleCollection() {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
/**
* Creates a new communication item
*/

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -23,7 +24,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -31,33 +31,28 @@ if(!defined('CON_FRAMEWORK')) {
define("cDatatypeCurrency_Left", 1);
define("cDatatypeCurrency_Right", 2);
class cDatatypeCurrency extends cDatatypeNumber
{
class cDatatypeCurrency extends cDatatypeNumber {
var $_cCurrencyLocation;
var $_sCurrencySymbol;
function cDatatypeCurrency ()
{
cDatatypeNumber::cDataTypeNumber();
function __construct() {
cDatatypeNumber::__construct();
$this->setCurrencySymbolLocation(cDatatypeCurrency_Right);
$this->setCurrencySymbol("<EFBFBD>");
}
function setCurrencySymbol ($sSymbol)
{
function setCurrencySymbol($sSymbol) {
$this->_sCurrencySymbol = $sSymbol;
}
function getCurrencySymbol ()
{
function getCurrencySymbol() {
return ($this->_sCurrencySymbol);
}
function setCurrencySymbolLocation ($cLocation)
{
switch ($cLocation)
{
function setCurrencySymbolLocation($cLocation) {
switch ($cLocation) {
case cDatatypeCurrency_Left:
case cDatatypeCurrency_Right:
$this->_cCurrencyLocation = $cLocation;
@ -69,12 +64,10 @@ class cDatatypeCurrency extends cDatatypeNumber
}
}
function render ()
{
function render() {
$value = parent::render();
switch ($this->_cCurrencyLocation)
{
switch ($this->_cCurrencyLocation) {
case cDatatypeCurrency_Left:
return sprintf("%s %s", $this->_sCurrencySymbol, $value);
break;
@ -85,4 +78,5 @@ class cDatatypeCurrency extends cDatatypeNumber
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,7 +26,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -61,14 +61,13 @@ define("cDateTime_Thursday", 4);
define("cDateTime_Friday", 5);
define("cDateTime_Saturday", 6);
class cDatatypeDateTime extends cDatatype
{
class cDatatypeDateTime extends cDatatype {
var $_iFirstDayOfWeek;
/* This datatype stores its date format in ISO */
function cDatatypeDateTime ()
{
function __construct() {
$this->setTargetFormat(cDateTime_Locale);
$this->setSourceFormat(cDateTime_UNIX);
@ -80,63 +79,51 @@ class cDatatypeDateTime extends cDatatype
$this->_iSecond = 0;
$this->setFirstDayOfWeek(cDateTime_Monday);
parent::cDatatype();
parent::__construct();
}
function setCustomTargetFormat ($targetFormat)
{
function setCustomTargetFormat($targetFormat) {
$this->_sCustomTargetFormat = $targetFormat;
}
function setCustomSourceFormat ($sourceFormat)
{
function setCustomSourceFormat($sourceFormat) {
$this->_sCustomSourceFormat = $sourceFormat;
}
function setSourceFormat ($cSourceFormat)
{
function setSourceFormat($cSourceFormat) {
$this->_cSourceFormat = $cSourceFormat;
}
function setTargetFormat ($cTargetFormat)
{
function setTargetFormat($cTargetFormat) {
$this->_cTargetFormat = $cTargetFormat;
}
function setYear ($iYear)
{
function setYear($iYear) {
$this->_iYear = $iYear;
}
function getYear ()
{
function getYear() {
return ($this->_iYear);
}
function setMonth ($iMonth)
{
function setMonth($iMonth) {
$this->_iMonth = $iMonth;
}
function getMonth ()
{
function getMonth() {
return ($this->_iMonth);
}
function setDay ($iDay)
{
function setDay($iDay) {
$this->_iDay = $iDay;
}
function getDay ()
{
function getDay() {
return ($this->_iDay);
}
function getMonthName ($iMonth)
{
switch ($iMonth)
{
function getMonthName($iMonth) {
switch ($iMonth) {
case 1: return i18n("January");
case 2: return i18n("February");
case 3: return i18n("March");
@ -152,10 +139,8 @@ class cDatatypeDateTime extends cDatatype
}
}
function getDayName ($iDayOfWeek)
{
switch ($iDayOfWeek)
{
function getDayName($iDayOfWeek) {
switch ($iDayOfWeek) {
case 0: return i18n("Sunday");
case 1: return i18n("Monday");
case 2: return i18n("Tuesday");
@ -168,8 +153,7 @@ class cDatatypeDateTime extends cDatatype
}
}
function getDayOrder ()
{
function getDayOrder() {
$aDays = array(0, 1, 2, 3, 4, 5, 6);
$aRemainderDays = array_splice($aDays, 0, $this->_iFirstDayOfWeek);
@ -178,52 +162,42 @@ class cDatatypeDateTime extends cDatatype
return ($aReturnDays);
}
function getNumberOfMonthDays ($iMonth = false, $iYear = false)
{
if ($iMonth === false)
{
function getNumberOfMonthDays($iMonth = false, $iYear = false) {
if ($iMonth === false) {
$iMonth = $this->_iMonth;
}
if ($iYear === false)
{
if ($iYear === false) {
$iYear = $this->_iYear;
}
return date("t", mktime(0, 0, 0, $iMonth, 1, $iYear));
}
function setFirstDayOfWeek ($iDay)
{
function setFirstDayOfWeek($iDay) {
$this->_iFirstDayOfWeek = $iDay;
}
function getFirstDayOfWeek ()
{
function getFirstDayOfWeek() {
return $this->_iFirstDayOfWeek;
}
function getLeapDay ()
{
function getLeapDay() {
return end($this->getDayOrder());
}
function set ($value, $iOverrideFormat = false)
{
if ($value == "")
{
function set($value, $iOverrideFormat = false) {
if ($value == "") {
return;
}
if ($iOverrideFormat !== false)
{
if ($iOverrideFormat !== false) {
$iFormat = $iOverrideFormat;
} else {
$iFormat = $this->_cSourceFormat;
}
switch ($iFormat)
{
switch ($iFormat) {
case cDateTime_UNIX:
$sTemporaryTimestamp = $value;
$this->_iYear = date("Y", $sTemporaryTimestamp);
@ -262,19 +236,15 @@ class cDatatypeDateTime extends cDatatype
$finalDate = array();
/* Map date entries to placeholders */
foreach ($placeholderRegs[0] as $key => $placeholderReg)
{
if (isset($dateRegs[$key]))
{
foreach ($placeholderRegs[0] as $key => $placeholderReg) {
if (isset($dateRegs[$key])) {
$finalDate[$placeholderReg] = $dateRegs[$key + 1];
}
}
/* Assign placeholders + data to the object's member variables */
foreach ($finalDate as $placeHolder => $value)
{
switch ($placeHolder)
{
foreach ($finalDate as $placeHolder => $value) {
switch ($placeHolder) {
case "d":
$this->_iDay = $value;
break;
@ -318,19 +288,15 @@ class cDatatypeDateTime extends cDatatype
$finalDate = array();
/* Map date entries to placeholders */
foreach ($placeholderRegs[0] as $key => $placeholderReg)
{
if (isset($dateRegs[$key]))
{
foreach ($placeholderRegs[0] as $key => $placeholderReg) {
if (isset($dateRegs[$key])) {
$finalDate[$placeholderReg] = $dateRegs[$key + 1];
}
}
/* Assign placeholders + data to the object's member variables */
foreach ($finalDate as $placeHolder => $value)
{
switch ($placeHolder)
{
foreach ($finalDate as $placeHolder => $value) {
switch ($placeHolder) {
case "%d":
$this->_iDay = $value;
break;
@ -350,18 +316,15 @@ class cDatatypeDateTime extends cDatatype
}
}
function get ($iOverrideFormat = false)
{
if ($iOverrideFormat !== false)
{
function get($iOverrideFormat = false) {
if ($iOverrideFormat !== false) {
$iFormat = $iOverrideFormat;
} else {
$iFormat = $this->_cSourceFormat;
}
switch ($iFormat)
{
switch ($iFormat) {
case cDateTime_ISO:
$sTemporaryTimestamp = mktime($this->_iHour, $this->_iMinute, $this->_iSecond, $this->_iMonth, $this->_iDay, $this->_iYear);
return date("Y-m-d H:i:s", $sTemporaryTimestamp);
@ -383,17 +346,14 @@ class cDatatypeDateTime extends cDatatype
}
}
function render ($iOverrideFormat = false)
{
if ($iOverrideFormat !== false)
{
function render($iOverrideFormat = false) {
if ($iOverrideFormat !== false) {
$iFormat = $iOverrideFormat;
} else {
$iFormat = $this->_cTargetFormat;
}
switch ($iFormat)
{
switch ($iFormat) {
case cDateTime_Locale_TimeOnly:
$sTimeformat = getEffectiveSetting("backend", "timeformat_time", "H:i:s");
@ -412,16 +372,13 @@ class cDatatypeDateTime extends cDatatype
break;
}
}
function parse ($value)
{
if ($value == "")
{ return;
function parse($value) {
if ($value == "") {
return;
}
switch ($this->_cTargetFormat)
{
switch ($this->_cTargetFormat) {
case cDateTime_ISO:
$sTemporaryTimestamp = strtotime($value);
$this->_iYear = date("Y", $sTemporaryTimestamp);
@ -448,19 +405,15 @@ class cDatatypeDateTime extends cDatatype
$finalDate = array();
/* Map date entries to placeholders */
foreach ($placeholderRegs[0] as $key => $placeholderReg)
{
if (isset($dateRegs[$key]))
{
foreach ($placeholderRegs[0] as $key => $placeholderReg) {
if (isset($dateRegs[$key])) {
$finalDate[$placeholderReg] = $dateRegs[$key + 1];
}
}
/* Assign placeholders + data to the object's member variables */
foreach ($finalDate as $placeHolder => $value)
{
switch ($placeHolder)
{
foreach ($finalDate as $placeHolder => $value) {
switch ($placeHolder) {
case "d":
$this->_iDay = $value;
break;
@ -494,19 +447,15 @@ class cDatatypeDateTime extends cDatatype
$finalDate = array();
/* Map date entries to placeholders */
foreach ($placeholderRegs[0] as $key => $placeholderReg)
{
if (isset($dateRegs[$key]))
{
foreach ($placeholderRegs[0] as $key => $placeholderReg) {
if (isset($dateRegs[$key])) {
$finalDate[$placeholderReg] = $dateRegs[$key + 1];
}
}
/* Assign placeholders + data to the object's member variables */
foreach ($finalDate as $placeHolder => $value)
{
switch ($placeHolder)
{
foreach ($finalDate as $placeHolder => $value) {
switch ($placeHolder) {
case "%d":
$this->_iDay = $value;
break;
@ -540,19 +489,15 @@ class cDatatypeDateTime extends cDatatype
$finalDate = array();
/* Map date entries to placeholders */
foreach ($placeholderRegs[0] as $key => $placeholderReg)
{
if (isset($dateRegs[$key]))
{
foreach ($placeholderRegs[0] as $key => $placeholderReg) {
if (isset($dateRegs[$key])) {
$finalDate[$placeholderReg] = $dateRegs[$key + 1];
}
}
/* Assign placeholders + data to the object's member variables */
foreach ($finalDate as $placeHolder => $value)
{
switch ($placeHolder)
{
foreach ($finalDate as $placeHolder => $value) {
switch ($placeHolder) {
case "%d":
$this->_iDay = $value;
break;
@ -571,6 +516,7 @@ class cDatatypeDateTime extends cDatatype
break;
}
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,20 +26,17 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cDatatypeNumber extends cDatatype {
class cDatatypeNumber extends cDatatype
{
var $_iPrecision;
var $_sThousandSeparatorCharacter;
var $_sDecimalPointCharacter;
function cDatatypeNumber ()
{
function __construct() {
global $i18nLanguage;
/* Try to find out the current locale settings */
@ -47,48 +45,39 @@ class cDatatypeNumber extends cDatatype
$this->setDecimalPointCharacter($aLocaleSettings["mon_decimal_point"]);
$this->setThousandSeparatorCharacter($aLocaleSettings["mon_thousands_sep"]);
cDatatype::cDatatype();
cDatatype::__construct();
}
function set ($value)
{
function set($value) {
$this->_mValue = floatval($value);
}
function get ()
{
function get() {
return $this->_mValue;
}
function setPrecision ($iPrecision)
{
function setPrecision($iPrecision) {
$this->_iPrecision = $iPrecision;
}
function setDecimalPointCharacter ($sCharacter)
{
function setDecimalPointCharacter($sCharacter) {
$this->_sDecimalPointCharacter = $sCharacter;
}
function getDecimalPointCharacter ()
{
function getDecimalPointCharacter() {
return ($this->_sDecimalPointCharacter);
}
function setThousandSeparatorCharacter ($sCharacter)
{
function setThousandSeparatorCharacter($sCharacter) {
$this->_sThousandSeparatorCharacter = $sCharacter;
}
function getThousandSeparatorCharacter ()
{
function getThousandSeparatorCharacter() {
return($this->_sThousandSeparatorCharacter);
}
function parse ($value)
{
if ($this->_sDecimalPointCharacter == $this->_sThousandSeparatorCharacter)
{
function parse($value) {
if ($this->_sDecimalPointCharacter == $this->_sThousandSeparatorCharacter) {
cWarning(__FILE__, __LINE__, "Decimal point character cannot be the same as the thousand separator character. Current decimal point character is '{$this->_sDecimalPointCharacter}', current thousand separator character is '{$this->_sThousandSeparatorCharacter}'");
return;
}
@ -100,9 +89,10 @@ class cDatatypeNumber extends cDatatype
$this->_mValue = floatval($value);
}
function render ()
{
function render() {
return number_format($this->_mValue, $this->_iPrecision, $this->_sDecimalPointCharacter, $this->_sThousandSeparatorCharacter);
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,46 +26,46 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cDatatype
{
class cDatatype {
/* Effective value */
var $_mValue;
/* Displayed value */
var $_mDisplayedValue;
function cDatatype ()
{
function __construct() {
}
/* Sets this datatype to a specific value */
function set ($value)
{
function set($value) {
}
/* Parses the given value to transfer into the datatype's format */
function parse ($value)
{
function parse($value) {
}
/* Returns the effective value */
function get ()
{
function get() {
}
/* Renders the displayed value */
function render ()
{
function render() {
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* class.template.php
*
@ -20,7 +21,6 @@
* @link http://www.contenido.org
* @since file available since contenido release <= 4.6
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -36,6 +36,7 @@ if(!defined('CON_FRAMEWORK')) {
* @version 1.0
*/
class Template {
/**
* Needles (static)
* @var array
@ -77,7 +78,6 @@ class Template {
* @var string
*/
protected $_sDomain = "conlite";
var $array_registeredParsers = array();
/**
@ -103,17 +103,6 @@ class Template {
new clIfFunctionParser()
);
}
} // end function
/**
* Old deprecated constructor
*
* @deprecated since version 2.0 Beta
* @param array $tags
*/
public function Template($tags = false) {
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct($tags);
}
/**
@ -238,7 +227,6 @@ class Template {
array_shift($pieces);
$content = "";
//now combine pieces together
//start block
$content .= str_replace($this->needles, $this->replacements, $pieces[0][0]);
unset($pieces[0][0]);
@ -285,7 +273,9 @@ class Template {
} else {
echo $content;
}
} # end function
}
# end function
/**
* replacei18n()
@ -336,5 +326,8 @@ class Template {
}
}
}
} # end class
}
# end class
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,26 +26,22 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
/**
* class cTree
*
*/
class cTree extends cTreeItem
{
class cTree extends cTreeItem {
var $_treeIcon;
function cTree ($name = "")
{
function __construct($name = "") {
/* The root item currently has to be a "0".
* This is a bug, feel free to fix it. */
cTreeItem::cTreeItem(0,$name);
cTreeItem::__construct(0, $name);
}
/**
@ -54,16 +51,14 @@ class cTree extends cTreeItem
* @return void
* @access public
*/
function setTreeName( $name )
{
function setTreeName($name) {
$this->setName($name);
} // end of member function setTreeName
}
function setIcon ( $path )
{
// end of member function setTreeName
function setIcon($path) {
$this->_treeIcon = $path;
}
} // end of cTree
?>
}

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,18 +26,16 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
/**
* class cTreeItem
*
*/
class cTreeItem
{
class cTreeItem {
/**
* Sub Items for this tree item
* @var array
@ -91,9 +90,7 @@ class cTreeItem
*/
var $_previous;
function cTreeItem ($id = "", $name = "", $collapsed = false)
{
function __construct($id = "", $name = "", $collapsed = false) {
$this->_id = $id;
$this->_name = $name;
$this->_collapsed = $collapsed;
@ -103,6 +100,7 @@ class cTreeItem
$this->_previous = false;
$this->_attributes = array();
}
/**
* Imports a table from an array of arrays. Array format:
* array(
@ -115,62 +113,52 @@ class cTreeItem
* @return void
* @access public
*/
function importTable( $flat_array )
{
function importTable($flat_array) {
$lastobj[0] = $this->_id;
$currentlevel = 1;
if (!is_array($flat_array))
{
if (!is_array($flat_array)) {
return false;
}
foreach ($flat_array as $item)
{
foreach ($flat_array as $item) {
$mitem[$item["id"]] = new cTreeItem($item["id"], $item["name"]);
if ($item["level"] > $currentlevel)
{
if ($item["level"] > $currentlevel) {
$currentlevel++;
}
if ($item["level"] < $currentlevel)
{
if ($item["level"] < $currentlevel) {
$currentlevel = $item["level"];
}
if (is_array($item["attributes"]))
{
if (is_array($item["attributes"])) {
$mitem[$item["id"]]->setAttributes($item["attributes"]);
}
if (array_key_exists("collapsed", $item))
{
if (array_key_exists("collapsed", $item)) {
$mitem[$item["id"]]->setCollapsed($item["collapsed"]);
}
/* Set payload object */
if (array_key_exists("payload", $item))
{
if (array_key_exists("payload", $item)) {
$mitem[$item["id"]]->setPayloadObject($item["payload"]);
}
if (is_object($mitem[$lastobj[$currentlevel-1]]))
{
if (is_object($mitem[$lastobj[$currentlevel - 1]])) {
$mitem[$lastobj[$currentlevel - 1]]->addItem($mitem[$item["id"]]);
} else {
$this->addItemToID($lastobj[$currentlevel - 1], $mitem[$item["id"]]);
}
$lastobj[$currentlevel] = $item["id"];
}
}
} // end of member function importTree
// end of member function importTree
function importStructuredArray ($array)
{
function importStructuredArray($array) {
$i = array();
$lastid = 1;
@ -180,50 +168,43 @@ class cTreeItem
$this->importTable($i);
}
function _flattenArray ($sourcearray, &$destarray, &$lastid, &$level)
{
if ($lastid == false)
{
function _flattenArray($sourcearray, &$destarray, &$lastid, &$level) {
if ($lastid == false) {
$lastid = 1;
}
if ($level == false)
{
if ($level == false) {
$level = 1;
}
if (!is_array($sourcearray))
{
if (!is_array($sourcearray)) {
return false;
}
foreach ($sourcearray as $id => $item)
{
foreach ($sourcearray as $id => $item) {
$lastid++;
$destarray[$lastid]["id"] = $item["class"] . "." . $id;
/* Name should be fetched via the meta object */
$meta = $item["object"]->getMetaObject();
if (is_object($meta))
{
if (is_object($meta)) {
$destarray[$lastid]["name"] = $meta->getName();
}
$destarray[$lastid]["level"] = $level;
$destarray[$lastid]["payload"] = $item["object"];
if (count($item["items"]) > 0)
{
if (count($item["items"]) > 0) {
$level++;
$this->_flattenArray($item["items"], $destarray, $lastid, $level);
$level--;
}
}
}
/**
* Exports a tree as an array of arrays. Array format:
* array(
@ -233,12 +214,13 @@ class cTreeItem
* @return array
* @access public
*/
function exportTree( )
{
function exportTree() {
/* TODO: Function can't work... work in progress...
$myobj->traverse($objlist);
*/
} // end of member function exportTree
}
// end of member function exportTree
/**
* adds an item as a subitem to the current item
@ -247,18 +229,18 @@ class cTreeItem
* @return void
* @access public
*/
function addItem( &$item )
{
function addItem(&$item) {
/* Update last item */
if ($lastitem = end($this->_subitems) !== false)
{
if ($lastitem = end($this->_subitems) !== false) {
$this->_subitems[key($this->_subitems)]->_next = $item->_id;
}
$this->_subitems[count($this->_subitems)] = &$item;
$item->_parent = $this->_id;
$item->_previous = $lastitem->_id;
} // end of member function addItem
}
// end of member function addItem
/**
* adds an item to a specific ID
@ -268,14 +250,11 @@ class cTreeItem
* @return void
* @access public
*/
function addItemToID( $id, &$item )
{
if ($this->_id == $id)
{
function addItemToID($id, &$item) {
if ($this->_id == $id) {
/* Update last item */
if ($lastitem = end($this->_subitems) !== false)
{
if ($lastitem = end($this->_subitems) !== false) {
$this->_subitems[key($this->_subitems)]->_next = $item->_id;
}
@ -283,22 +262,20 @@ class cTreeItem
$item->_parent = $this->_id;
$item->_previous = $lastitem->_id;
return true;
} else {
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$result = $this->_subitems[$key]->addItemToID($id, $item);
if ($result == true)
{
if ($result == true) {
return true;
}
}
}
return false;
}
} // end of member function addItemToID
// end of member function addItemToID
/**
* moves an item to another object
@ -308,10 +285,11 @@ class cTreeItem
* @return void
* @access public
*/
function moveItem( $targetItem, $itemToMove )
{
function moveItem($targetItem, $itemToMove) {
} // end of member function moveItem
}
// end of member function moveItem
/**
* deletes a subitem
@ -320,12 +298,9 @@ class cTreeItem
* @return deleted object
* @access public
*/
function deleteItem( $id )
{
foreach (array_keys($this->_subitems) as $key)
{
if ($this->_subitems[$key]->_id == $id)
{
function deleteItem($id) {
foreach (array_keys($this->_subitems) as $key) {
if ($this->_subitems[$key]->_id == $id) {
/* Fetch next item, reset to current item */
$nextitem = next($this->_subitems);
$nkey = key($this->_subitems);
@ -336,18 +311,14 @@ class cTreeItem
next($this->_subitems);
if ($nextitem !== false)
{
if ($previtem !== false)
{
if ($nextitem !== false) {
if ($previtem !== false) {
$this->_subitems[$nkey]->_previous = $this->_subitems[$pkey]->_id;
}
}
if ($previtem !== false)
{
if ($nextitem !== false)
{
if ($previtem !== false) {
if ($nextitem !== false) {
$this->_subitems[$pkey]->_next = $this->_subitems[$nkey]->_id;
}
}
@ -360,7 +331,9 @@ class cTreeItem
$this->_subitems[$key]->deleteItem($id);
}
}
} // end of member function deleteItem
}
// end of member function deleteItem
/**
* Retrieves a specific item by its ID. Note that this
@ -370,24 +343,22 @@ class cTreeItem
* @return cTreeItem
* @access public
*/
function &getItemByID( $id )
{
if ($this->_id == $id)
{
function &getItemByID($id) {
if ($this->_id == $id) {
return ($this);
} else {
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$retObj = &$this->_subitems[$key]->getItemByID($id);
if ($retObj->_id == $id)
{
if ($retObj->_id == $id) {
return ($retObj);
}
}
}
return false;
} // end of member function getItemByID
}
// end of member function getItemByID
/**
* sets a custom attribute for this TreeItem
@ -397,10 +368,11 @@ class cTreeItem
* @return void
* @access public
*/
function setAttribute( $attributeName, $attributeValue )
{
function setAttribute($attributeName, $attributeValue) {
$this->_attributes[$attributeName] = $attributeValue;
} // end of member function setAttribute
}
// end of member function setAttribute
/**
* sets a bunch of attributes
@ -410,10 +382,11 @@ class cTreeItem
* @return void
* @access public
*/
function setAttributes( $aAttributeArray )
{
function setAttributes($aAttributeArray) {
$this->_attributes = array_merge($aAttributeArray, $this->_attributes);
} // end of member function setAttribute
}
// end of member function setAttribute
/**
* returns an attribute
@ -422,15 +395,15 @@ class cTreeItem
* @return mixed
* @access public
*/
function getAttribute( $attributeName )
{
if (array_key_exists($attributeName, $this->_attributes))
{
function getAttribute($attributeName) {
if (array_key_exists($attributeName, $this->_attributes)) {
return ($this->_attributes[$attributeName]);
} else {
return false;
}
} // end of member function getAttribute
}
// end of member function getAttribute
/**
* deletes an attribute
@ -439,33 +412,27 @@ class cTreeItem
* @return void
* @access public
*/
function deleteAttribute( $attributeName )
{
if (array_key_exists($attributeName, $this->_attributes))
{
function deleteAttribute($attributeName) {
if (array_key_exists($attributeName, $this->_attributes)) {
unset($this->_attributes[$attributeName]);
return true;
} else {
return false;
}
} // end of member function deleteAttribute
}
function hasAttribute ($attributeName, $bRecursive = false)
{
if (array_key_exists($attributeName, $this->_attributes))
{
// end of member function deleteAttribute
function hasAttribute($attributeName, $bRecursive = false) {
if (array_key_exists($attributeName, $this->_attributes)) {
return true;
} else {
if ($bRecursive == true)
{
if (count($this->_subitems) > 0)
{
foreach ($this->_subitems as $oSubitem)
{
if ($bRecursive == true) {
if (count($this->_subitems) > 0) {
foreach ($this->_subitems as $oSubitem) {
$bFound = $oSubitem->hasAttribute($attributeName, true);
if ($bFound == true)
{
if ($bFound == true) {
return true;
}
}
@ -477,6 +444,7 @@ class cTreeItem
}
}
}
/**
*
*
@ -484,32 +452,28 @@ class cTreeItem
* @return void
* @access public
*/
function setExpanded( $id )
{
if (is_array($id))
{
if (in_array($this->_id, $id, true))
{
function setExpanded($id) {
if (is_array($id)) {
if (in_array($this->_id, $id, true)) {
$this->_collapsed = false;
}
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->setExpanded($id);
}
} else {
if ($this->_id === $id)
{
if ($this->_id === $id) {
$this->_collapsed = false;
return true;
} else {
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->setExpanded($id);
}
}
}
} // end of member function setExpanded
}
// end of member function setExpanded
/**
*
@ -518,32 +482,28 @@ class cTreeItem
* @return void
* @access public
*/
function setCollapsed( $id )
{
if (is_array($id))
{
if (in_array($this->_id, $id, true))
{
function setCollapsed($id) {
if (is_array($id)) {
if (in_array($this->_id, $id, true)) {
$this->_collapsed = true;
}
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->setCollapsed($id);
}
} else {
if ($this->_id === $id)
{
if ($this->_id === $id) {
$this->_collapsed = true;
return true;
} else {
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->setCollapsed($id);
}
}
}
} // end of member function setCollapsed
}
// end of member function setCollapsed
/**
*
@ -552,20 +512,19 @@ class cTreeItem
* @return void
* @access public
*/
function expandBelowLevel ($leveloffset)
{
if ($leveloffset > 0)
{
function expandBelowLevel($leveloffset) {
if ($leveloffset > 0) {
$leveloffset--;
} else {
$this->_collapsed = false;
}
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->expandBelowLevel($leveloffset);
}
} // end of member function expandBelowLevel
}
// end of member function expandBelowLevel
/**
*
@ -574,21 +533,19 @@ class cTreeItem
* @return void
* @access public
*/
function collapseBelowLevel ($leveloffset)
{
if ($leveloffset > 0)
{
function collapseBelowLevel($leveloffset) {
if ($leveloffset > 0) {
$leveloffset--;
} else {
$this->_collapsed = true;
}
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->collapseBelowLevel($leveloffset);
}
} // end of member function expandBelowLevel
}
// end of member function expandBelowLevel
/**
*
@ -597,24 +554,22 @@ class cTreeItem
* @return void
* @access public
*/
function expandBelowID ($id, $found = false)
{
if ($found === true)
{
function expandBelowID($id, $found = false) {
if ($found === true) {
$this->_collapsed = false;
}
if ($this->_id == $id)
{
if ($this->_id == $id) {
$found = true;
$this->_collapsed = false;
}
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->expandBelowID($id, $found);
}
} // end of member function expandBelowLevel
}
// end of member function expandBelowLevel
/**
*
@ -623,44 +578,38 @@ class cTreeItem
* @return void
* @access public
*/
function collapseBelowID ($id, $found = false)
{
if ($found === true)
{
function collapseBelowID($id, $found = false) {
if ($found === true) {
$this->_collapsed = true;
}
if ($this->_id == $id)
{
if ($this->_id == $id) {
$found = true;
$this->_collapsed = true;
}
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->collapseBelowID($id, $found);
}
} // end of member function expandBelowLevel
}
// end of member function expandBelowLevel
/**
* getCollapsedList
* Returns all items (as ID array) which are collapsed.
* @param array $list Contains the list with all collapsed items
*/
function getCollapsedList (&$list)
{
if (!is_array($list))
{
function getCollapsedList(&$list) {
if (!is_array($list)) {
$list = array();
}
if ($this->_collapsed == true)
{
if ($this->_collapsed == true) {
$list[] = $this->_id;
}
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->getCollapsedList($list);
}
}
@ -670,20 +619,16 @@ class cTreeItem
* Returns all items (as ID array) which are expanded.
* @param array $list Contains the list with all expanded items
*/
function getExpandedList (&$list)
{
if (!is_array($list))
{
function getExpandedList(&$list) {
if (!is_array($list)) {
$list = array();
}
if ($this->_collapsed == false && !in_array($this->_id, $list))
{
if ($this->_collapsed == false && !in_array($this->_id, $list)) {
$list[] = $this->_id;
}
foreach (array_keys($this->_subitems) as $key)
{
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->getExpandedList($list);
}
}
@ -695,10 +640,11 @@ class cTreeItem
* @return void
* @access public
*/
function setPayloadObject ($payload)
{
function setPayloadObject($payload) {
$this->payload = $payload;
} // end of member function setPayloadObject
}
// end of member function setPayloadObject
/**
* unsets a payload object
@ -706,11 +652,11 @@ class cTreeItem
* @return object
* @access public
*/
function unsetPayloadObject( )
{
function unsetPayloadObject() {
} // end of member function unsetPayloadObject
}
// end of member function unsetPayloadObject
/**
* traverse
@ -719,19 +665,15 @@ class cTreeItem
* @param object $objects all found objects
* @param integer $level Level to start on
*/
function traverse (&$objects, $level = 0)
{
function traverse(&$objects, $level = 0) {
$objects[count($objects)] = &$this;
$this->_level = $level;
if ($this->_collapsed == false)
{
foreach (array_keys($this->_subitems) as $key)
{
if ($this->_collapsed == false) {
foreach (array_keys($this->_subitems) as $key) {
$this->_subitems[$key]->traverse($objects, $level + 1);
}
}
}
/**
@ -741,21 +683,17 @@ class cTreeItem
* @param object $objects all found objects
* @param integer $level Level to start on
*/
function flatTraverse ($level = 0)
{
function flatTraverse($level = 0) {
$objects[] = &$this;
$this->_level = $level;
if ($this->_collapsed == false)
{
foreach (array_keys($this->_subitems) as $key)
{
if ($this->_collapsed == false) {
foreach (array_keys($this->_subitems) as $key) {
$objects = array_merge($objects, $this->_subitems[$key]->flatTraverse($level + 1));
}
}
return $objects;
}
/**
@ -764,11 +702,11 @@ class cTreeItem
* @param string $name New name for this item
* @return none
*/
function setName ($name)
{
function setName($name) {
$this->_name = $name;
}
}
} // end of cTreeItem
// end of cTreeItem
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,28 +26,28 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cViewAdvancedMenu {
function __construct() {
class cViewAdvancedMenu
{
function cViewAdvancedMenu ()
{
}
function render ()
{
}
function render() {
}
}
class cViewItems extends cHTMLIFrame {
function __construct() {
class cViewItems extends cHTMLIFrame
{
function cViewItems()
{
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -26,7 +27,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -42,9 +42,7 @@ define("QUESTIONACTION_YESNO" , "yesno");
* their constructors; on-the-fly-implementations should call it directly after
* creating an object instance.
*/
class cApiClickableAction extends cApiAction
{
class cApiClickableAction extends cApiAction {
/* * * Attributes: ** */
/**
@ -65,9 +63,7 @@ class cApiClickableAction extends cApiAction
*/
private $_img;
public function __construct()
{
public function __construct() {
global $area;
parent::__construct();
@ -86,26 +82,17 @@ class cApiClickableAction extends cApiAction
$this->setEnabled();
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function cApiClickableAction()
{
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
$this->__construct();
}
/**
* Sets the action icon for this action.
*
* @param string icon Path to the icon. Relative to the backend, if not passed as absolute path.
* @return void
*/
public function setIcon($icon)
{
public function setIcon($icon) {
$this->_img->setSrc($icon);
}
public function getIcon()
{
public function getIcon() {
return $this->_img;
}
@ -116,10 +103,8 @@ class cApiClickableAction extends cApiAction
* using it, otherwise, this method will fail.
* @return void
*/
public function setNamedAction($actionName)
{
if ($this->loadBy("name", $actionName) !== false)
{
public function setNamedAction($actionName) {
if ($this->loadBy("name", $actionName) !== false) {
$a = new cApiArea;
$a->loadByPrimaryKey($this->get("idarea"));
@ -131,36 +116,32 @@ class cApiClickableAction extends cApiAction
}
}
public function setDisabled()
{
public function setDisabled() {
$this->_enabled = false;
$this->_onDisable();
}
public function setEnabled()
{
public function setEnabled() {
$this->_enabled = true;
$this->_onEnable();
}
protected function _onDisable()
{
protected function _onDisable() {
}
protected function _onEnable()
{
protected function _onEnable() {
}
/**
* Change linked area
*/
public function changeArea($sArea)
{
public function changeArea($sArea) {
$this->_area = $sArea;
}
public function wantParameter($parameter)
{
public function wantParameter($parameter) {
$this->_wantParameters[] = $parameter;
$this->_wantParameters = array_unique($this->_wantParameters);
@ -172,29 +153,24 @@ class cApiClickableAction extends cApiAction
* @param string helptext The helptext to apply
* @return void
*/
public function setHelpText($helptext)
{
public function setHelpText($helptext) {
$this->_helpText = $helptext;
}
public function getHelpText()
{
public function getHelpText() {
return $this->_helpText;
}
public function setParameter($name, $value)
{
public function setParameter($name, $value) {
$this->_parameters[$name] = $value;
}
public function process($parameters)
{
public function process($parameters) {
echo "Process should be overridden";
return false;
}
public function render()
{
public function render() {
$this->_img->setAlt($this->_helpText);
foreach ($this->_parameters as $name => $value) {
@ -229,41 +205,29 @@ class cApiClickableAction extends cApiAction
return ($this->_helpText);
}
}
}
class cApiClickableQuestionAction extends cApiClickableAction {
class cApiClickableQuestionAction extends cApiClickableAction
{
public function __construct()
{
public function __construct() {
parent::__construct();
}
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
public function cApiClickableQuestionAction()
{
$this->__construct();
}
public function setQuestionMode($mode)
{
public function setQuestionMode($mode) {
$this->_mode = $mode;
}
public function setQuestion($question)
{
public function setQuestion($question) {
$this->_question = $question;
}
public function setResultVar($var)
{
public function setResultVar($var) {
$this->_resultVar = $var;
}
public function render()
{
switch ($this->_mode)
{
public function render() {
switch ($this->_mode) {
case QUESTIONACTION_PROMPT:
$this->_link->attachEventDefinition("_" . get_class($this) . rand(), "onclick", 'var answer = prompt("' . clHtmlSpecialChars($this->_question) . '");if (answer == null) {return false;} else { this.href = this.href + "&' . $this->_resultVar . '="+answer; return true;}');
break;
@ -275,6 +239,5 @@ class cApiClickableQuestionAction extends cApiClickableAction
return parent::render();
}
}
?>
}

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,25 +26,22 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cWidgetMenuActionList extends cFoldingRow
{
function cWidgetMenuActionList($uuid, $title, $dataClassName)
{
class cWidgetMenuActionList extends cFoldingRow {
function __construct($uuid, $title, $dataClassName) {
global $cfg;
if (!class_exists($dataClassName))
{
if (!class_exists($dataClassName)) {
cWarning(__FILE__, __LINE__, "Could not instanciate class [$dataClassName] for use in class " . get_class($this));
return false;
} else {
$dataClass = new $dataClassName;
if (!is_subclass_of($dataClass, "Item"))
{
if (!is_subclass_of($dataClass, "Item")) {
cWarning(__FILE__, __LINE__, "Passed class [$dataClassName] should be a subclass of [Item]. Parent class is " . get_parent_class($dataClass));
return;
}
@ -68,8 +66,7 @@ class cWidgetMenuActionList extends cFoldingRow
$row = array();
foreach ($actions as $action)
{
foreach ($actions as $action) {
$row[] = $this->buildAction($action);
}
$t = new cHTMLTable;
@ -77,15 +74,12 @@ class cWidgetMenuActionList extends cFoldingRow
$t->setWidth("100%");
$this->_contentData->setContent($t);
}
function buildAction ($action)
{
function buildAction($action) {
global $cfg;
if (class_exists($action))
{
if (class_exists($action)) {
$this->_dark = !$this->_dark;
$class = $this->_metaClass->getAction($action);
@ -101,8 +95,7 @@ class cWidgetMenuActionList extends cFoldingRow
$r->setHeight(18);
$r->setWidth("100%");
if ($this->_dark)
{
if ($this->_dark) {
$l->setBackgroundColor($cfg["color"]["table_dark"]);
$r->setBackgroundColor($cfg["color"]["table_dark"]);
} else {
@ -113,12 +106,7 @@ class cWidgetMenuActionList extends cFoldingRow
$row->setContent(array($l, $r));
return $row;
}
}
}
?>

Datei anzeigen

@ -60,9 +60,9 @@ class cWidgetButton extends cHTMLSpan
* @param $alt string Alternative text
* @param $link string Link
*/
function cWidgetButton ($img, $alt, $link)
function __construct ($img, $alt, $link)
{
cHTMLSpan::cHTMLSpan();
cHTMLSpan::__construct();
$this->_img = new cHTMLImage($img);
$this->_link = new cHTMLLink($link);
@ -167,9 +167,9 @@ class cWidgetToggleButton extends cWidgetButton
* @param $uplink string Link when the button is turned off (=up)
* @param $downlink string Link when the button is turned on (=down)
*/
function cWidgetToggleButton ($img, $alt, $uplink, $downlink)
function __construct ($img, $alt, $uplink, $downlink)
{
cHTMLSpan::cHTMLSpan();
cHTMLSpan::__construct();
$this->_img = new cHTMLImage($img);
$this->_link = new cHTMLLink("#");
@ -243,9 +243,9 @@ class cWidgetMultiToggleButton extends cWidgetButton
* @param $alt string Alternative text
* @param $lnik string Link to call when the button is clicked
*/
function cWidgetMultiToggleButton ($img, $alt, $link)
function __construct ($img, $alt, $link)
{
cHTMLSpan::cHTMLSpan();
cHTMLSpan::__construct();
$this->_img = new cHTMLImage($img);
$this->_link = new cHTMLLink($link);

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,19 +26,16 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cCalendarControl extends cHTMLTable {
class cCalendarControl extends cHTMLTable
{
var $_oDate;
function cCalendarControl ($initDate = false)
{
parent::cHTMLTable();
function __construct($initDate = false) {
parent::__construct();
$this->_initFormatting();
$this->_oDate = new cDatatypeDateTime;
@ -45,25 +43,20 @@ class cCalendarControl extends cHTMLTable
/* Development: Set today's date */
$this->_oDate->setSourceFormat(cDateTime_ISO);
if ($initDate === false)
{
if ($initDate === false) {
$this->_oDate->set(date("Y-m-d H:i:s"));
} else {
$this->_oDate->set($initDate);
}
}
function _initFormatting ()
{
function _initFormatting() {
$this->setClass("calendar");
$this->setCellSpacing(0);
$this->setCellPadding(0);
}
function _renderHead ()
{
function _renderHead() {
$oHead = new cHTMLTableHeader;
$aDayOrder = $this->_oDate->getDayOrder();
@ -72,8 +65,7 @@ class cCalendarControl extends cHTMLTable
$aData = array();
foreach ($aDayOrder as $iDay)
{
foreach ($aDayOrder as $iDay) {
$oData = new cHTMLTableData;
$oData->setContent(substr($this->_oDate->getDayName($iDay), 0, 2));
@ -86,8 +78,7 @@ class cCalendarControl extends cHTMLTable
return ($oHead);
}
function _renderBody ()
{
function _renderBody() {
$iRows = 6;
$iDaysPerWeek = 7;
@ -95,14 +86,12 @@ class cCalendarControl extends cHTMLTable
$aRowData = array();
for ($iRow = 0; $iRow < $iRows; $iRow++)
{
for ($iRow = 0; $iRow < $iRows; $iRow++) {
$oRow = new cHTMLTableRow;
$aData = array();
$aDayOrder = $this->_oDate->getDayOrder();
foreach ($aDayOrder as $iDay)
{
foreach ($aDayOrder as $iDay) {
$oData = new cHTMLTableData;
$oData->setContent('&nbsp;');
$oData->setStyle("border: 1px solid white");
@ -118,8 +107,7 @@ class cCalendarControl extends cHTMLTable
return ($oHead);
}
function _renderJS ()
{
function _renderJS() {
$this->_oDate->setSourceFormat(cDateTime_UNIX);
$oScript = new cHTMLScript;
@ -401,14 +389,12 @@ class cCalendarControl extends cHTMLTable
return $oScript;
}
function _renderMonthDropdown ()
{
function _renderMonthDropdown() {
$oMonthSelect = new cHTMLSelectElement($this->getId() . "_monthselect");
$oMonthSelect->setId($this->getId() . "_monthselect");
$aMonths = array();
for ($i=1;$i<13;$i++)
{
for ($i = 1; $i < 13; $i++) {
$aMonths[$i] = $this->_oDate->getMonthName($i);
}
@ -418,8 +404,7 @@ class cCalendarControl extends cHTMLTable
return ($oMonthSelect);
}
function _renderMonthPrev ()
{
function _renderMonthPrev() {
$oMonthLeft = new cHTMLImage;
$oMonthLeft->setSrc("images/month_prev.gif");
$oMonthLeft->setStyle("border: 0px solid black; cursor: pointer;");
@ -427,8 +412,7 @@ class cCalendarControl extends cHTMLTable
return $oMonthLeft;
}
function _renderMonthNext ()
{
function _renderMonthNext() {
$oMonthLeft = new cHTMLImage;
$oMonthLeft->setSrc("images/month_next.gif");
$oMonthLeft->setStyle("border: 0px solid black; cursor: pointer;");
@ -436,8 +420,7 @@ class cCalendarControl extends cHTMLTable
return $oMonthLeft;
}
function _renderYearControl ()
{
function _renderYearControl() {
$oYear = new cHTMLTextbox($this->getId() . "_yearbox", "", 4, 4);
$oYear->setId($this->getId() . "_yearbox");
$oYear->setEvent("change", $this->getId() . "_setCalendar(this.value, " . $this->getId() . "_currentMonth);");
@ -445,8 +428,7 @@ class cCalendarControl extends cHTMLTable
return $oYear;
}
function render ()
{
function render() {
$this->setContent(array($this->_renderHead(), $this->_renderBody(), $this->_renderJS()));
$oSpan = new cHTMLSpan;
@ -460,5 +442,7 @@ class cCalendarControl extends cHTMLTable
return '<table><tr><td align="middle">' . $oSpan->render() . '</td></tr><tr><td align="middle">' . parent::render() . '</td></tr></table>';
}
}
?>

Datei anzeigen

@ -5,8 +5,8 @@
* cDataTextWidget generates a textbox widget
* for use with the data objects.
*/
class cDataTextWidget extends cHTMLTextbox
{
class cDataTextWidget extends cHTMLTextbox {
/**
* cDataTextWidget: Creates a text box widget
*
@ -19,15 +19,14 @@ class cDataTextWidget extends cHTMLTextbox
* @return void
* @access public
*/
function cDataTextWidget ($name, $parameters)
{
cHTMLTextbox::cHTMLTextbox($name);
function __construct($name, $parameters) {
parent::__construct($name);
if (array_key_exists("default", $parameters))
{
if (array_key_exists("default", $parameters)) {
$this->setValue($parameters["default"]);
}
}
}
/**
@ -35,8 +34,8 @@ class cDataTextWidget extends cHTMLTextbox
* cDataTextareaWidget generates a textarea widget for use with the data objects.
*
*/
class cDataTextareaWidget extends cHTMLTextarea
{
class cDataTextareaWidget extends cHTMLTextarea {
/**
* cDataTextareaWidget: Creates a text area widget
*
@ -49,24 +48,22 @@ class cDataTextareaWidget extends cHTMLTextarea
* @return void
* @access public
*/
function cDataTextareaWidget ($name, $parameters)
{
cHTMLTextarea::cHTMLTextarea($name);
function __construct($name, $parameters) {
parent::__construct($name);
if (array_key_exists("default", $parameters))
{
if (array_key_exists("default", $parameters)) {
$this->setValue($parameters["default"]);
}
}
}
/**
* class cDataCodeTextareaWidget
* cDataCodeTextareaWidget generates a textarea widget for use with the data objects.
*/
class cDataCodeTextareaWidget extends cHTMLTextarea
{
class cDataCodeTextareaWidget extends cHTMLTextarea {
/**
* cDataTextareaWidget: Creates a text area widget
* which can be used for entering code
@ -81,12 +78,10 @@ class cDataCodeTextareaWidget extends cHTMLTextarea
* @return void
* @access public
*/
function cDataCodeTextareaWidget ($name, $parameters)
{
cHTMLTextarea::cHTMLTextarea($name);
function __construct($name, $parameters) {
parent::__construct($name);
if (array_key_exists("default", $parameters))
{
if (array_key_exists("default", $parameters)) {
$this->setValue($parameters["default"]);
}
@ -95,27 +90,26 @@ class cDataCodeTextareaWidget extends cHTMLTextarea
$this->setWidth(100);
$this->setHeight(20);
if (array_key_exists("notes", $parameters))
{
if (array_key_exists("notes", $parameters)) {
$this->_notes = $parameters["notes"];
}
}
function render ()
{
function render() {
$out = parent::render();
$out .= $this->_notes;
return ($out);
}
}
/**
* class cDataDropdownWidget
* cDataDropdownWidget generates a dropdown widget for use with the data objects.
*/
class cDataDropdownWidget extends cHTMLSelectElement
{
class cDataDropdownWidget extends cHTMLSelectElement {
/**
* cDataDropdownWidget: Creates a dropdown widget
* with specific entries
@ -130,25 +124,24 @@ class cDataDropdownWidget extends cHTMLSelectElement
* @return void
* @access public
*/
function cDataDropdownWidget ($name, $parameters)
{
cHTMLSelectElement::cHTMLSelectElement($name);
function __construct($name, $parameters) {
parent::__construct($name);
$this->autoFill($parameters["choices"]);
if (array_key_exists("default", $parameters))
{
if (array_key_exists("default", $parameters)) {
$this->setDefault($parameters["default"]);
}
}
}
/**
* class cDataForeignTableDropdownWidget
* cDataForeignTableDropdownWidget generates a dropdown widget out of a foreign table.
*/
class cDataForeignTableDropdownWidget extends cHTMLSelectElement
{
class cDataForeignTableDropdownWidget extends cHTMLSelectElement {
/**
* cDataForeignTableDropdownWidget: Creates a dropdown widget
* which fetches its entries from a foreign, linked table
@ -163,39 +156,35 @@ class cDataForeignTableDropdownWidget extends cHTMLSelectElement
* @return void
* @access public
*/
function cDataForeignTableDropdownWidget ($name, $parameters)
{
cHTMLSelectElement::cHTMLSelectElement($name);
function __construct($name, $parameters) {
parent::__construct($name);
$c = new $parameters["foreignClass"];
$c->query();
while ($i = $c->next())
{
while ($i = $c->next()) {
$meta = $i->getMetaObject();
if (is_object($meta))
{
if (is_object($meta)) {
$data[$i->get($i->primaryKey)] = $meta->getName();
}
}
$this->autoFill($data);
if (array_key_exists("default", $parameters))
{
if (array_key_exists("default", $parameters)) {
$this->setDefault($parameters["default"]);
}
}
}
/**
* class cDataCheckboxWidget
* cDataCheckboxWidget generates a checkbox for use with the dataobjects
*/
class cDataCheckboxWidget extends cHTMLCheckbox
{
class cDataCheckboxWidget extends cHTMLCheckbox {
/**
* cDataCheckboxWidget: Creates a checkbox widget
*
@ -209,12 +198,10 @@ class cDataCheckboxWidget extends cHTMLCheckbox
* @return void
* @access public
*/
function cDataCheckboxWidget ($name, $parameters)
{
cHTMLCheckbox::cHTMLCheckbox($name."_stub", "1");
function __construct($name, $parameters) {
parent::__construct($name . "_stub", "1");
if ($parameters["title"] != "")
{
if ($parameters["title"] != "") {
$this->setLabelText($parameters["title"]);
} else {
$this->setLabelText(" ");
@ -226,13 +213,13 @@ class cDataCheckboxWidget extends cHTMLCheckbox
$this->setEvent("click", "if (this.checked == true) { document.getElementById('" . $this->_hfield->getId() . "').value = '1'; } else { document.getElementById('" . $this->_hfield->getId() . "').value = '0'; }");
}
function render ()
{
function render() {
$out = $this->_hfield->render();
$out .= parent::render();
return ($out);
}
}
/**
@ -240,8 +227,8 @@ class cDataCheckboxWidget extends cHTMLCheckbox
* cDataMultiTextboxWidget generates a multi-line textbox widget
*/
class cDataMultiTextboxWidget extends cHTMLTable
{
class cDataMultiTextboxWidget extends cHTMLTable {
/**
* cDataMultiTextboxWidget: Creates a multi-line textbox widget
*
@ -255,21 +242,17 @@ class cDataMultiTextboxWidget extends cHTMLTable
* @return void
* @access public
*/
function cDataMultiTextboxWidget ($name, $parameters)
{
cHTMLTable::cHTMLTable();
function __construct($name, $parameters) {
parent::__construct();
$this->name = $name;
if (array_key_exists("title", $parameters))
{
if (array_key_exists("title", $parameters)) {
$rows[] = $this->addTitle($parameters["title"]);
}
if (is_array($parameters["default"]))
{
foreach ($parameters["default"] as $i)
{
if (is_array($parameters["default"])) {
foreach ($parameters["default"] as $i) {
$rows[] = $this->addRow($i);
}
}
@ -280,11 +263,9 @@ class cDataMultiTextboxWidget extends cHTMLTable
$this->setPadding(1);
$this->setContent($rows);
}
function addTitle ($title)
{
function addTitle($title) {
$row = new cHTMLTableRow;
$data = new cHTMLTableData;
$data->setColSpan(2);
@ -294,8 +275,7 @@ class cDataMultiTextboxWidget extends cHTMLTable
return ($row);
}
function addRow ($data)
{
function addRow($data) {
$row = new cHTMLTableRow;
$l = new cHTMLTableData;
$r = new cHTMLTableData;
@ -327,7 +307,5 @@ class cDataMultiTextboxWidget extends cHTMLTable
return ($row);
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,21 +26,18 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cDateChooser extends cDatefield {
class cDateChooser extends cDatefield
{
var $_oCalendar;
var $_oImage;
var $_oButton;
function cDateChooser ($name, $initValue = false)
{
parent::cDatefield($name, "");
function __construct($name, $initValue = false) {
parent::__construct($name, "");
$this->_oImage = new cHTMLImage;
$this->_oImage->setSrc("images/pfeil_runter.gif");
@ -51,8 +49,7 @@ class cDateChooser extends cDatefield
$this->_oDate->setSourceFormat(cDateTime_ISO);
$this->_oDate->setTargetFormat(cDateTime_Locale_DateOnly);
if ($initValue === false)
{
if ($initValue === false) {
$this->_oDate->set(date("Y-m-d H:i:s"));
} else {
$this->_oDate->set($initValue);
@ -61,28 +58,22 @@ class cDateChooser extends cDatefield
$this->_aSelectIDs = array();
}
function setSelectsToHide ($aSelectIDs)
{
if (!is_array($aSelectIDs))
{
function setSelectsToHide($aSelectIDs) {
if (!is_array($aSelectIDs)) {
return;
}
foreach ($aSelectIDs as $key => $data)
{
foreach ($aSelectIDs as $key => $data) {
$aSelectIDs[$key] = '"' . $data . '"';
}
$this->_aSelectIDs = $aSelectIDs;
}
function setReadOnly ($bReadOnly = true)
{
function setReadOnly($bReadOnly = true) {
$this->_bReadOnly = $bReadOnly;
}
function render ()
{
if ($this->_bReadOnly)
{
function render() {
if ($this->_bReadOnly) {
$this->updateAttributes(array("readonly" => "readonly"));
}
@ -201,8 +192,6 @@ class cDateChooser extends cDatefield
$final = str_replace("{did}", $div->getId(), $final);
return ($final);
}
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,32 +26,25 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cDatefield extends cHTMLTextbox {
class cDatefield extends cHTMLTextbox
{
var $_oDate;
function cDatefield ($name, $initvalue, $width = 10)
{
function __construct($name, $initvalue, $width = 10) {
$this->_oDate = new cDatatypeDateTime;
$this->_oDate->set($initvalue);
parent::cHTMLTextbox($name, $initvalue, $width);
parent::__construct($name, $initvalue, $width);
}
function render ()
{
if ($this->_oDate->get(cDateTime_ISO) != "1970-01-01")
{
if ($this->_oDate->_cTargetFormat == cDateTime_Custom)
{
function render() {
if ($this->_oDate->get(cDateTime_ISO) != "1970-01-01") {
if ($this->_oDate->_cTargetFormat == cDateTime_Custom) {
parent::setValue($this->_oDate->render());
} else {
parent::setValue($this->_oDate->render(cDateTime_Locale_DateOnly));
@ -61,4 +55,3 @@ class cDatefield extends cHTMLTextbox
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,14 +26,11 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cDropdownDateSelect
{
class cDropdownDateSelect {
/**
* Day, month and year selectors
@ -50,23 +48,20 @@ class cDropdownDateSelect
*/
var $_order;
function cDropdownDateSelect ($prefix)
{
function __construct($prefix) {
$this->_daySelect = new cHTMLSelectElement($prefix . "_day");
$this->_monthSelect = new cHTMLSelectElement($prefix . "_month");
$this->_yearSelect = new cHTMLSelectElement($prefix . "_year");
/* Fill days */
for ($day = 1; $day < 32; $day++)
{
for ($day = 1; $day < 32; $day++) {
$days[sprintf("%02d", $day)] = $day;
}
$this->_daySelect->autoFill($days);
/* Fill months */
for ($month = 1; $month < 13; $month++)
{
for ($month = 1; $month < 13; $month++) {
$months[sprintf("%02d", $month)] = getCanonicalMonth($month);
}
@ -74,8 +69,7 @@ class cDropdownDateSelect
/* Fill years */
$currentYear = date("Y");
for ($year = $currentYear-20; $year < $currentYear +20; $year++)
{
for ($year = $currentYear - 20; $year < $currentYear + 20; $year++) {
$years[$year] = $year;
}
@ -84,23 +78,19 @@ class cDropdownDateSelect
$this->setTimestamp(time());
/* Apply old values */
if (isset($_POST[$prefix."_day"]))
{
if (isset($_POST[$prefix . "_day"])) {
$this->_daySelect->setDefault($_POST[$prefix . "_day"]);
}
if (isset($_POST[$prefix."_month"]))
{
if (isset($_POST[$prefix . "_month"])) {
$this->_monthSelect->setDefault($_POST[$prefix . "_month"]);
}
if (isset($_POST[$prefix."_year"]))
{
if (isset($_POST[$prefix . "_year"])) {
$this->_yearSelect->setDefault($_POST[$prefix . "_year"]);
}
$this->setOrder("dmy");
}
/**
@ -108,8 +98,7 @@ class cDropdownDateSelect
*
* @param $timestamp int Timestamp to set
*/
function setTimestamp ($timestamp)
{
function setTimestamp($timestamp) {
$day = date("d", $timestamp);
$month = date("m", $timestamp);
$year = date("Y", $timestamp);
@ -117,7 +106,6 @@ class cDropdownDateSelect
$this->_daySelect->setDefault($day);
$this->_monthSelect->setDefault($month);
$this->_yearSelect->setDefault($year);
}
/**
@ -128,8 +116,7 @@ class cDropdownDateSelect
*
* @param $id string Prefix ID to set
*/
function setId ($id)
{
function setId($id) {
$this->_daySelect->setId($id . "_day");
$this->_monthSelect->setId($id . "_month");
$this->_yearSelect->setId($id . "_year");
@ -140,23 +127,18 @@ class cDropdownDateSelect
*
* @param $timestamp int Timestamp to set
*/
function getTimestamp ($prefix = false)
{
if (!is_object($this->_daySelect))
{
function getTimestamp($prefix = false) {
if (!is_object($this->_daySelect)) {
/* Called statically */
if (isset($_POST[$prefix."_day"]))
{
if (isset($_POST[$prefix . "_day"])) {
$day = $_POST[$prefix . "_day"];
}
if (isset($_POST[$prefix."_month"]))
{
if (isset($_POST[$prefix . "_month"])) {
$month = $_POST[$prefix . "_month"];
}
if (isset($_POST[$prefix."_year"]))
{
if (isset($_POST[$prefix . "_year"])) {
$year = $_POST[$prefix . "_year"];
}
} else {
@ -178,8 +160,7 @@ class cDropdownDateSelect
*
* @param $order string Order with the keys "d", "m" and "y"
*/
function setOrder ($order)
{
function setOrder($order) {
$this->_order = $order;
}
@ -188,8 +169,7 @@ class cDropdownDateSelect
*
* @param none
*/
function setDisabled ($disabled)
{
function setDisabled($disabled) {
$this->_daySelect->setDisabled($disabled);
$this->_monthSelect->setDisabled($disabled);
$this->_yearSelect->setDisabled($disabled);
@ -200,19 +180,19 @@ class cDropdownDateSelect
*
* @param none
*/
function render ()
{
function render() {
$output = "";
for ($char = 0; $char < strlen($this->_order); $char++)
{
for ($char = 0; $char < strlen($this->_order); $char++) {
$mychar = substr($this->_order, $char, 1);
switch ($mychar)
{
case "d": $output .= $this->_daySelect->render(); break;
case "m": $output .= $this->_monthSelect->render(); break;
case "y": $output .= $this->_yearSelect->render(); break;
switch ($mychar) {
case "d": $output .= $this->_daySelect->render();
break;
case "m": $output .= $this->_monthSelect->render();
break;
case "y": $output .= $this->_yearSelect->render();
break;
default: break;
}
}
@ -220,7 +200,4 @@ class cDropdownDateSelect
return ($output);
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,14 +26,12 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cFoldingRow extends cHTML {
class cFoldingRow extends cHTML
{
/**
* Table row with the header
* @var array
@ -74,7 +73,7 @@ class cFoldingRow extends cHTML
* @param type $link_id
* @param type $bExpanded
*/
public function cFoldingRow($uuid, $caption = "", $link_id = "", $bExpanded = null) {
public function __construct($uuid, $caption = "", $link_id = "", $bExpanded = null) {
global $auth;
$this->setCaption($caption);
@ -107,10 +106,8 @@ class cFoldingRow extends cHTML
if ($bExpanded == null) {
/* Check for expandstate */
if (!$user->virgin)
{
if ($user->getProperty("expandstate", $uuid) == "true")
{
if (!$user->virgin) {
if ($user->getProperty("expandstate", $uuid) == "true") {
$this->setExpanded($user->getProperty("expandstate", $uuid));
}
}
@ -123,10 +120,8 @@ class cFoldingRow extends cHTML
}
}
function setExpanded ($expanded = false)
{
if ($expanded == true)
{
function setExpanded($expanded = false) {
if ($expanded == true) {
$this->_foldingImage->setSrc("images/widgets/foldingrow/expanded.gif");
$this->_foldingImage->updateAttributes(array("data-folding-row" => "expanded", "alt" => ""));
$this->_contentRow->setStyle("display: ;");
@ -140,33 +135,27 @@ class cFoldingRow extends cHTML
$this->_expanded = $expanded;
}
function setCaption ($caption)
{
function setCaption($caption) {
$this->_caption = $caption;
}
function setHelpContext ($context = false)
{
function setHelpContext($context = false) {
$this->_helpContext = $context;
}
function setIndent ($indent = 0)
{
function setIndent($indent = 0) {
$this->_indent = $indent;
}
function setContentData ($content)
{
function setContentData($content) {
$this->_contentData->setContent($content);
}
function render ()
{
function render() {
/* Build the expand/collapse link */
$this->_link->setClass("foldingrow");
if($this->_linkId != NULL)
{
if ($this->_linkId != NULL) {
$this->_link->setID($this->_linkId);
}
@ -190,5 +179,3 @@ class cFoldingRow extends cHTML
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,7 +26,6 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -34,13 +34,12 @@ if(!defined('CON_FRAMEWORK')) {
cInclude("plugins", "general/classes/class.datatype.number.php");
cInclude("plugins", "general/classes/class.datatype.currency.php");
class cNominalNumberField extends cHTMLTextbox
{
class cNominalNumberField extends cHTMLTextbox {
var $_oNumber;
var $_bRealtimeNominalFormat;
function cNominalNumberField ($name, $initvalue, $width)
{
function __construct($name, $initvalue, $width) {
global $belang;
$this->_oNumber = new cDatatypeNumber;
@ -48,25 +47,21 @@ class cNominalNumberField extends cHTMLTextbox
$this->disableRealtimeNominalFormat();
parent::cHTMLTextbox($name, $initvalue, $width);
parent::__construct($name, $initvalue, $width);
}
function enableRealtimeNominalFormat ()
{
function enableRealtimeNominalFormat() {
$this->_bRealtimeNominalFormat = true;
}
function disableRealtimeNominalFormat ()
{
function disableRealtimeNominalFormat() {
$this->_bRealtimeNominalFormat = false;
}
function render ()
{
function render() {
parent::setValue($this->_oNumber->render());
if ($this->_bRealtimeNominalFormat)
{
if ($this->_bRealtimeNominalFormat) {
$decimalChar = $this->_oNumber->getDecimalPointCharacter();
$thousandChar = $this->_oNumber->getThousandSeparatorCharacter();
@ -76,42 +71,34 @@ class cNominalNumberField extends cHTMLTextbox
return parent::render();
}
}
class cNominalCurrencyField extends cNominalNumberField
{
class cNominalCurrencyField extends cNominalNumberField {
var $_oNumber;
var $_bRealtimeNominalFormat;
function cNominalCurrencyField ($name, $initvalue, $width)
{
parent::cNominalNumberField($name, $initvalue, $width);
function __construct($name, $initvalue, $width) {
parent::__construct($name, $initvalue, $width);
$this->_oNumber = new cDatatypeCurrency;
$this->_oNumber->set($initvalue);
$this->disableRealtimeNominalFormat();
}
function enableRealtimeNominalFormat ()
{
function enableRealtimeNominalFormat() {
$this->_bRealtimeNominalFormat = true;
}
function disableRealtimeNominalFormat ()
{
function disableRealtimeNominalFormat() {
$this->_bRealtimeNominalFormat = false;
}
function render ()
{
function render() {
parent::setValue($this->_oNumber->render());
if ($this->_bRealtimeNominalFormat)
{
if ($this->_bRealtimeNominalFormat) {
$decimalChar = $this->_oNumber->getDecimalPointCharacter();
$thousandChar = $this->_oNumber->getThousandSeparatorCharacter();
@ -122,6 +109,4 @@ class cNominalCurrencyField extends cNominalNumberField
return parent::render();
}
}
?>

Datei anzeigen

@ -374,7 +374,7 @@ class cPageLeftTop extends cPage {
*
* @param $showCloser boolean True if the closer should be shown (default)
*/
function cPageLeftTop($showCloser = true) {
function __construct($showCloser = true) {
$this->showCloser($showCloser);
}
@ -390,11 +390,11 @@ class cPageLeftTop extends cPage {
function render($print = true) {
global $cfg;
$tpl = new Template;
$tpl = new Template();
$tpl->set('s', 'CONTENT', $content);
$this->setContent($tpl->generate($cfg['path']['contenido'] . $cfg['path']['templates'] . $cfg['templates']['widgets']['left_top'], true));
cPage::render($print);
parent::render($print);
}
}
@ -429,10 +429,10 @@ class cPageLeftTopMultiPane extends cPageLeftTop {
*
* @param $items array All items passed as multi array (see constructor description)
*/
function cPageLeftTopMultiPane($items) {
function __construct($items) {
$this->_items = $items;
cPageLeftTop::cPageLeftTop();
parent::__construct();
}
/**
@ -494,21 +494,21 @@ class cPageLeftTopMultiPane extends cPageLeftTop {
$tpl->set('s', 'CONTENT', $content);
$this->setContent($tpl->generate($cfg['path']['templates'] . $cfg['templates']['widgets']['left_top'], true));
cPage::render();
parent::render();
}
}
class cNewPageLeftTopMultiPane extends cPageLeftTopMultiPane {
function cNewPageLeftTopMultiPane($items) {
cPageLeftTopMultiPane::cPageLeftTopMultiPane($items);
function __construct($items) {
parent::__construct($items);
}
function render($print = true) {
global $cfg;
$infodiv = new cHTMLDiv;
$infodiv = new cHTMLDiv();
if (count($this->_items) > 0) {
foreach ($this->_items as $item) {
@ -549,5 +549,3 @@ class cNewPageLeftTopMultiPane extends cPageLeftTopMultiPane {
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,45 +26,36 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cObjectPager extends cFoldingRow {
class cObjectPager extends cFoldingRow
{
var $_pagerLink;
var $_parameterToAdd;
function cObjectPager ($uuid, $items, $itemsperpage, $currentpage, $link, $parameterToAdd, $id='')
{
function __construct($uuid, $items, $itemsperpage, $currentpage, $link, $parameterToAdd, $id = '') {
if ((int) $currentpage == 0) {
$currentpage = 1;
}
if($id == '')
{
cFoldingRow::cFoldingRow($uuid, i18n("Paging"));
}
else
{
cFoldingRow::cFoldingRow($uuid, i18n("Paging"), $id);
if ($id == '') {
parent::__construct($uuid, i18n("Paging"));
} else {
parent::__construct($uuid, i18n("Paging"), $id);
}
if (!is_object($link))
{
if (!is_object($link)) {
cError(__FILE__, __LINE__, "Parameter link is not an object");
return false;
}
$this->_cPager = new cPager($items, $itemsperpage, $currentpage);
$this->_pagerLink = $link;
$this->_parameterToAdd = $parameterToAdd;
}
function render ($bContentOnly = 0)
{
function render($bContentOnly = 0) {
#Do not display Page navigation if there is only one Page and we are not in newsletter section
if ($this->_cPager->getMaxPages() == 1) {
$this->_headerRow->setStyle("display:none");
@ -78,8 +70,7 @@ class cObjectPager extends cFoldingRow
$output = '';
if (!$this->_cPager->isFirstPage())
{
if (!$this->_cPager->isFirstPage()) {
$img = new cHTMLImage("images/paging/first.gif");
$link->setAlt(i18n("First page"));
@ -100,24 +91,23 @@ class cObjectPager extends cFoldingRow
$output .= '<img src="images/spacer.gif" width="8" alt=""> ';
$output .= '<img src="images/spacer.gif" width="8" alt="">';
}
foreach ($items as $key => $item)
{
foreach ($items as $key => $item) {
$link->setContent($key);
$link->setAlt(sprintf(i18n("Page %s"), $key));
$link->setCustom($this->_parameterToAdd, $key);
switch ($item)
{
case "|": $output .= "..."; break;
case "current": $output .= '<span class="cpager_currentitem">'.$key."</span>"; break;
switch ($item) {
case "|": $output .= "...";
break;
case "current": $output .= '<span class="cpager_currentitem">' . $key . "</span>";
break;
default: $output .= $link->render();
}
$output .= " ";
}
if (!$this->_cPager->isLastPage())
{
if (!$this->_cPager->isLastPage()) {
$img = new cHTMLImage("images/paging/next.gif");
$link->setAlt(i18n("Next page"));
$link->setContent($img);
@ -152,11 +142,11 @@ class cObjectPager extends cFoldingRow
if ($bContentOnly) {
return $output;
} else {
return cFoldingRow::render();
return parent::render();
}
}
}
}
/**
* cPager
@ -164,8 +154,8 @@ class cObjectPager extends cFoldingRow
*
* @author Timo A. Hummel <timo.hummel@4fb.de>
*/
class cPager
{
class cPager {
/**
* Amount of items
* @var integer
@ -216,8 +206,7 @@ class cPager
* @param $itemsPerPage int Items displayed per page
* @param $currentPage int Defines the current page
*/
function cPager ($items, $itemsPerPage, $currentPage)
{
function __construct($items, $itemsPerPage, $currentPage) {
$this->_items = $items;
$this->_itemsPerPage = $itemsPerPage;
@ -234,10 +223,8 @@ class cPager
*
* @return boolean True if we're on the first page.
*/
function isFirstPage ()
{
if ($this->_currentPage == 1)
{
function isFirstPage() {
if ($this->_currentPage == 1) {
return true;
}
@ -249,10 +236,8 @@ class cPager
*
* @return boolean True if we're on the last page.
*/
function isLastPage ()
{
if ($this->_currentPage == $this->getMaxPages())
{
function isLastPage() {
if ($this->_currentPage == $this->getMaxPages()) {
return true;
}
@ -264,8 +249,7 @@ class cPager
*
* @return int Page count
*/
function getMaxPages ()
{
function getMaxPages() {
if ($this->_items == 0) {
return 1;
} else if ($this->_itemsPerPage == 0) {
@ -284,50 +268,39 @@ class cPager
*
* @return array Pager structure
*/
function getPagesInRange ()
{
function getPagesInRange() {
$items = array();
$maxPages = $this->getMaxPages();
if (($this->_itemPadding * 3) + $this->_previousItems + $this->_nextItems > $maxPages)
{
if (($this->_itemPadding * 3) + $this->_previousItems + $this->_nextItems > $maxPages) {
/* Disable item padding */
for ($i = 1; $i < $this->getMaxPages() + 1; $i++)
{
for ($i = 1; $i < $this->getMaxPages() + 1; $i++) {
$items[$i] = $i;
}
} else {
for ($i=1;$i<$this->_previousItems+1; $i++)
{
if ($i <= $maxPages && $i >= 1)
{
for ($i = 1; $i < $this->_previousItems + 1; $i++) {
if ($i <= $maxPages && $i >= 1) {
$items[$i] = $i;
}
if ($i+1 <= $maxPages && $i >= 2)
{
if ($i + 1 <= $maxPages && $i >= 2) {
$items[$i + 1] = "|";
}
}
for ($i = $this->_currentPage - $this->_itemPadding; $i< $this->_currentPage + $this->_itemPadding + 1; $i++)
{
if ($i <= $maxPages && $i >= 1)
{
for ($i = $this->_currentPage - $this->_itemPadding; $i < $this->_currentPage + $this->_itemPadding + 1; $i++) {
if ($i <= $maxPages && $i >= 1) {
$items[$i] = $i;
}
if ($i+1 <= $maxPages && $i >= 2)
{
if ($i + 1 <= $maxPages && $i >= 2) {
$items[$i + 1] = "|";
}
}
for ($i=($this->getMaxPages()-$this->_nextItems)+1; $i < $this->getMaxPages()+1; $i++)
{
if ($i <= $maxPages && $i >= 2)
{
for ($i = ($this->getMaxPages() - $this->_nextItems) + 1; $i < $this->getMaxPages() + 1; $i++) {
if ($i <= $maxPages && $i >= 2) {
$items[$i] = $i;
}
}
@ -339,4 +312,3 @@ class cPager
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,21 +26,18 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cSwitchableDateChooser extends cDateChooser {
class cSwitchableDateChooser extends cDateChooser
{
var $_oCheckBox;
var $_bReadOnly;
var $_bDisabled;
function cSwitchableDateChooser ($name, $initValue = false)
{
parent::cDateChooser($name, $initValue);
function __construct($name, $initValue = false) {
parent::__construct($name, $initValue);
$this->_oCheckBox = new cHTMLCheckbox($this->getID() . "_check", "true");
$this->_oCheckBox->setLabelText("");
@ -49,8 +47,7 @@ class cSwitchableDateChooser extends cDateChooser
$this->enable();
}
function disable ()
{
function disable() {
$this->_bDisabled = true;
$this->setDisabled(true);
$this->_oCheckBox->setChecked(false);
@ -58,24 +55,22 @@ class cSwitchableDateChooser extends cDateChooser
$this->_oImage->setStyle("margin-left: 2px; cursor: pointer; visibility: hidden;");
}
function enable ()
{
function enable() {
$this->_bDisabled = false;
$this->setDisabled(false);
$this->_oCheckBox->setChecked(true);
$this->setClass("textbox");
}
function render ()
{
function render() {
$sRender = parent::render();
$oAlignmentTable = new cHTMLAlignmentTable($this->_oCheckBox->toHtml(false), $sRender);
if ($this->_bDisabled)
{
if ($this->_bDisabled) {
$addscript = 'document.getElementById("' . $this->getId() . '").value = "";';
}
return $oAlignmentTable->render() . '<script language="JavaScript">' . $addscript . 'x_oldvalue_' . $this->getID() . ' = "' . $this->_oDate->render() . '";</script>';
}
}

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -25,30 +26,27 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
class cWidgetTableEdit {
class cWidgetTableEdit
{
function cWidgetTableEdit ($metaobject, $title)
{
function __construct($metaobject, $title) {
$this->_metaobject = $metaobject;
$this->_title = $title;
if ($_GET["edit"] == get_class($this->_metaobject->_payloadObject))
{
if ($_GET["edit"] == get_class($this->_metaobject->_payloadObject)) {
$this->_metaobject->processEdit();
}
}
function render ()
{
function render() {
global $cfg, $sess, $action, $area, $frame;
if ($this->_metaobject->_objectInvalid) { return; }
if ($this->_metaobject->_objectInvalid) {
return;
}
$this->_metaobject->defineFields();
$form = new cHTMLForm;
@ -72,15 +70,12 @@ class cWidgetTableEdit
$out = "";
if (count($this->_metaobject->_fields) == 1)
{
foreach ($this->_metaobject->_fields as $key => $value)
{
if (count($this->_metaobject->_fields) == 1) {
foreach ($this->_metaobject->_fields as $key => $value) {
$out .= $this->renderRows($key, $this->_iconWidth + 6);
}
} else {
foreach ($this->_metaobject->_fields as $key => $value)
{
foreach ($this->_metaobject->_fields as $key => $value) {
$out .= $this->renderGroup($key);
}
}
@ -95,16 +90,14 @@ class cWidgetTableEdit
return ($form->render());
}
function renderHeader ()
{
function renderHeader() {
global $cfg;
$td = new cHTMLTableData;
$td->setColSpan(2);
$td->setVerticalAlignment("middle");
/* Check for icon */
if ($this->_metaobject->getIcon() != "")
{
if ($this->_metaobject->getIcon() != "") {
$img = new cHTMLImage;
$img->setSrc($this->_metaobject->getIcon());
$img->applyDimensions();
@ -121,21 +114,16 @@ class cWidgetTableEdit
$td->setBackgroundColor($cfg['color']['table_header']);
return ($td);
}
function renderGroup ($group)
{
function renderGroup($group) {
return renderRows($group);
}
function renderRows ($group, $padding = 2)
{
function renderRows($group, $padding = 2) {
global $cfg;
foreach ($this->_metaobject->_fields[$group] as $field => $parameters)
{
foreach ($this->_metaobject->_fields[$group] as $field => $parameters) {
$this->_darkShading = !$this->_darkShading;
$c = new cHTMLTableRow;
@ -153,8 +141,7 @@ class cWidgetTableEdit
$r->setStyle("padding: 2px; border-top: 1px solid " . $cfg["color"]["table_border"]);
$l->setStyle("padding: 4px; padding-left: {$padding}px; border-top: 1px solid " . $cfg["color"]["table_border"] . "; border-right: 1px solid " . $cfg["color"]["table_border"]);
$l->setVerticalAlignment("top");
if ($this->_darkShading)
{
if ($this->_darkShading) {
$l->setBackgroundColor($cfg["color"]["table_dark"]);
$r->setBackgroundColor($cfg["color"]["table_dark"]);
} else {
@ -170,8 +157,7 @@ class cWidgetTableEdit
return $out;
}
function renderButtons ()
{
function renderButtons() {
global $cfg;
$c = new cHTMLTableRow;
@ -192,7 +178,6 @@ class cWidgetTableEdit
$c->setContent($b);
return ($c->render());
}
}
}
?>

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/* * ***************************************
* File : $RCSfile: class.widgets.treeview.php,v $
* Project : Contenido
@ -21,15 +22,12 @@ define("TREEVIEW_BACKGROUND_SHADED", "shaded");
define("TREEVIEW_MOUSEOVER_NONE", "none");
define("TREEVIEW_MOUSEOVER_MARK", "mark");
/**
* class cWidgetTreeView
* cWidgetTreeView is a visual representation of a cTree. It supports folding,
* optional gridline marks and item icons.
*/
class cWidgetTreeView extends cTree
{
class cWidgetTreeView extends cTree {
/* * * Attributes: ** */
/**
@ -61,55 +59,43 @@ class cWidgetTreeView extends cTree
* @access private
*/
var $_unsetAttributeActions;
var $_baseLink;
function cWidgetTreeView ($uuid, $treename = false)
{
function __construct($uuid, $treename = false) {
global $cfg, $auth;
cTree::cTree();
parent::__construct();
$this->_uuid = $uuid;
//$this->setGridlineMode(TREEVIEW_GRIDLINE_DOTTED);
if ($treename != false)
{
if ($treename != false) {
$this->setTreeName($treename);
}
$this->setBackgroundColors(array($cfg['color']['table_light'], $cfg['color']['table_dark']));
$this->_user = new cApiUser($auth->auth["uid"]);
}
function processParameters ()
{
if (($items = $this->_user->getUserProperty("expandstate", $this->_uuid)) !== false)
{
function processParameters() {
if (($items = $this->_user->getUserProperty("expandstate", $this->_uuid)) !== false) {
$list = unserialize($items);
foreach ($list as $litem)
{
foreach ($list as $litem) {
$this->setCollapsed($litem);
}
}
if (!empty($this->_name))
{
if (!empty($this->_name)) {
$treename = $this->_name . "_";
}
if (array_key_exists($treename."collapse",$_GET))
{
if (array_key_exists($treename . "collapse", $_GET)) {
$this->setCollapsed($_GET[$treename . "collapse"]);
}
if (array_key_exists($treename."expand",$_GET))
{
if (array_key_exists($treename . "expand", $_GET)) {
$this->setExpanded($_GET[$treename . "expand"]);
}
@ -127,10 +113,11 @@ class cWidgetTreeView extends cTree
* @return void
* @access public
*/
function applyGlobalAction( $action )
{
function applyGlobalAction($action) {
} // end of member function applyGlobalAction
}
// end of member function applyGlobalAction
/**
* removes the action from all treeitems.
@ -139,10 +126,11 @@ class cWidgetTreeView extends cTree
* @return void
* @access public
*/
function removeGlobalAction( $action )
{
function removeGlobalAction($action) {
} // end of member function removeGlobalAction
}
// end of member function removeGlobalAction
/**
* flushes all actions
@ -150,10 +138,11 @@ class cWidgetTreeView extends cTree
* @return void
* @access public
*/
function flushGlobalActions( )
{
function flushGlobalActions() {
} // end of member function flushGlobalActions
}
// end of member function flushGlobalActions
/**
* sets an action to a specific item.
@ -163,10 +152,11 @@ class cWidgetTreeView extends cTree
* @return void
* @access public
*/
function applyItemAction( $item, $action )
{
function applyItemAction($item, $action) {
} // end of member function applyItemAction
}
// end of member function applyItemAction
/**
* unsets an action from a specific item. Note that you can unset global actions
@ -177,10 +167,11 @@ class cWidgetTreeView extends cTree
* @return void
* @access public
*/
function removeItemAction( $item, $action )
{
function removeItemAction($item, $action) {
} // end of member function removeItemAction
}
// end of member function removeItemAction
/**
* flushes all actions for a specific item
@ -189,10 +180,11 @@ class cWidgetTreeView extends cTree
* @return void
* @access public
*/
function flushItemActions( $item )
{
function flushItemActions($item) {
} // end of member function flushItemActions
}
// end of member function flushItemActions
/**
* Applies an action to all items with a certain attribute set.
@ -203,10 +195,11 @@ entries are connected with "AND".
* @return void
* @access public
*/
function applyActionByItemAttribute( $attributes, $action )
{
function applyActionByItemAttribute($attributes, $action) {
} // end of member function applyActionByItemAttribute
}
// end of member function applyActionByItemAttribute
/**
* Removes an action from all items with a certain attribute set.
@ -217,10 +210,11 @@ entries are connected with "AND".
* @return void
* @access public
*/
function removeActionByItemAttribute( $attributes, $action )
{
function removeActionByItemAttribute($attributes, $action) {
} // end of member function removeActionByItemAttribute
}
// end of member function removeActionByItemAttribute
/**
* Removes all actions for items with specific attributes
@ -230,10 +224,11 @@ entries are connected with "AND".
* @return void
* @access public
*/
function flushActionByItemAttribute( $attributes )
{
function flushActionByItemAttribute($attributes) {
} // end of member function flushActionByItemAttribute
}
// end of member function flushActionByItemAttribute
/**
*
@ -247,23 +242,21 @@ entries are connected with "AND".
* @return void
* @access public
*/
function setGridlineMode( $mode )
{
function setGridlineMode($mode) {
$this->_gridlineMode = $mode;
} // end of member function setGridlineMode
}
function setBackgroundMode ($mode)
{
// end of member function setGridlineMode
function setBackgroundMode($mode) {
$this->_backgroundMode = $mode;
}
function setMouseoverMode ($mode)
{
function setMouseoverMode($mode) {
$this->_mouseoverMode = $mode;
}
function setBackgroundColors ($colors)
{
function setBackgroundColors($colors) {
$this->_backgroundColors = $colors;
}
@ -273,12 +266,10 @@ entries are connected with "AND".
* @return void
* @access public
*/
function render ($with_root = true)
{
function render($with_root = true) {
$objects = $this->flatTraverse(0);
if ($with_root == false)
{
if ($with_root == false) {
unset($objects[0]);
}
@ -309,14 +300,12 @@ entries are connected with "AND".
$r_actioncell->setAlignment("right");
$r_actioncell->setWidth("1%");
if (!is_object($this->_baseLink))
{
if (!is_object($this->_baseLink)) {
$this->_baseLink = new cHTMLLink;
}
$lastitem = array();
foreach ($objects as $key => $object)
{
foreach ($objects as $key => $object) {
$img->setAlt("");
$r_table->advanceID();
$r_rightcell->advanceID();
@ -324,14 +313,10 @@ entries are connected with "AND".
$r_row->advanceID();
$r_actioncell->advanceID();
for ($level = 1; $level < $object->_level + 1; $level++)
{
if ($object->_level == $level)
{
if ($object->_next === false)
{
if (count($object->_subitems) > 0)
{
for ($level = 1; $level < $object->_level + 1; $level++) {
if ($object->_level == $level) {
if ($object->_next === false) {
if (count($object->_subitems) > 0) {
$link = $this->_setExpandCollapseLink($this->_baseLink, $object);
$link->advanceID();
$img->setSrc($this->_getExpandCollapseIcon($object));
@ -339,8 +324,7 @@ entries are connected with "AND".
$link->setContent($img);
$out .= $link->render();
} else {
if ($level == 1 && $with_root == false)
{
if ($level == 1 && $with_root == false) {
$out .= $img_spacer->render();
} else {
$img->setSrc($this->_buildImagePath("grid_linedownrightend.gif"));
@ -350,8 +334,7 @@ entries are connected with "AND".
}
$lastitem[$level] = true;
} else {
if (count($object->_subitems) > 0)
{
if (count($object->_subitems) > 0) {
$link = $this->_setExpandCollapseLink($this->_baseLink, $object);
$link->advanceID();
$img->setSrc($this->_getExpandCollapseIcon($object));
@ -359,8 +342,7 @@ entries are connected with "AND".
$link->setContent($img);
$out .= $link->render();
} else {
if ($level == 1 && $with_root == false)
{
if ($level == 1 && $with_root == false) {
$out .= $img_spacer->render();
} else {
$img->setSrc($this->_buildImagePath("grid_linedownright.gif"));
@ -371,12 +353,10 @@ entries are connected with "AND".
$lastitem[$level] = false;
}
} else {
if ($lastitem[$level] == true)
{
if ($lastitem[$level] == true) {
$out .= $img_spacer->render();
} else {
if ($level == 1 && $with_root == false)
{
if ($level == 1 && $with_root == false) {
$out .= $img_spacer->render();
} else {
$img->setSrc($this->_buildImagePath("/grid_linedown.gif"));
@ -388,13 +368,11 @@ entries are connected with "AND".
}
/* Fetch Render icon from the meta object */
if (is_object($object->payload))
{
if (is_object($object->payload)) {
/* Fetch payload object */
$meta = $object->payload->getMetaObject();
if (is_object($meta))
{
if (is_object($meta)) {
$icon = $meta->getIcon();
$actions = $meta->getActions();
@ -404,8 +382,7 @@ entries are connected with "AND".
$img->advanceID();
/* Check if we've got an edit link */
if (count($meta->_editAction) > 0)
{
if (count($meta->_editAction) > 0) {
$meta->defineActions();
$edit = $meta->getAction($meta->_editAction);
@ -424,15 +401,13 @@ entries are connected with "AND".
}
}
} else {
if (isset($object->_attributes["icon"]))
{
if (isset($object->_attributes["icon"])) {
$img->setSrc($object->_attributes["icon"]);
$renderedIcon = $img->render();
$renderedName = $object->_name;
} else {
/* Fetch tree icon */
if ($object->_id == 0)
{
if ($object->_id == 0) {
$icon = $object->_treeIcon;
$img->setSrc($icon);
$renderedIcon = $img->render();
@ -446,10 +421,8 @@ entries are connected with "AND".
}
}
if ($this->_backgroundMode == TREEVIEW_BACKGROUND_SHADED)
{
if (current($this->_backgroundColors) === false)
{
if ($this->_backgroundMode == TREEVIEW_BACKGROUND_SHADED) {
if (current($this->_backgroundColors) === false) {
reset($this->_backgroundColors);
}
@ -475,30 +448,27 @@ entries are connected with "AND".
}
return ('<table cellspacing="0" cellpadding="0" width="100%" border="0"><tr><td>' . $result . '</td></tr></table>');
} // end of member function render
}
function _getExpandCollapseIcon ($object)
{
if ($object->_collapsed == true)
{
// end of member function render
function _getExpandCollapseIcon($object) {
if ($object->_collapsed == true) {
return ($this->_buildImagePath("grid_expand.gif"));
} else {
return ($this->_buildImagePath("grid_collapse.gif"));
}
}
function _setExpandCollapseLink ($link, $object)
{
if (!empty($this->_name))
{
function _setExpandCollapseLink($link, $object) {
if (!empty($this->_name)) {
$treename = $this->_name . "_";
}
unset($link->_custom[$treename . "expand"]);
unset($link->_custom[$treename . "collapse"]);
if ($object->_collapsed == true)
{
if ($object->_collapsed == true) {
$link->setCustom($treename . "expand", $object->_id);
} else {
$link->setCustom($treename . "collapse", $object->_id);
@ -507,16 +477,12 @@ entries are connected with "AND".
return ($link);
}
function _buildImagePath($image)
{
function _buildImagePath($image) {
return ("./images/" . $this->_gridlineMode . "/" . $image);
}
function setBaseLink ($link)
{
function setBaseLink($link) {
$this->_baseLink = $link;
}
} // end of cWidgetTreeView
?>
}

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* Project:
* Contenido Content Management System
@ -26,45 +27,37 @@
* }}
*
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
/**
* Contenido Table view
*
* @author Timo A. Hummel <timo.hummel@4fb.de>
*/
class cTableView
{
class cTableView {
var $items;
var $captions;
var $id;
var $rownames;
var $formname;
var $formmethod;
var $formaction;
var $formvars;
var $tableid;
var $tablebordercolor;
var $header;
var $cancelLink;
var $submitjs;
function UI_Table_Form ($name, $action = "", $method = "post")
{
function UI_Table_Form($name, $action = "", $method = "post") {
global $sess, $cfg;
$this->formname = $name;
if ($action == "")
{
if ($action == "") {
$this->formaction = "main.php";
} else {
$this->formaction = $action;
@ -78,23 +71,17 @@ class cTableView
$this->custom = array();
$this->setActionButton("submit", "images/but_ok.gif", i18n("Save changes"), "s");
}
function setVar ($name, $value)
{
function setVar($name, $value) {
$this->formvars[$name] = $value;
}
function add ($caption, $field, $rowname = "")
{
if (is_array($field))
{
function add($caption, $field, $rowname = "") {
if (is_array($field)) {
foreach ($field as $value)
{
if (is_object($value) && method_exists($value, "render"))
{
foreach ($field as $value) {
if (is_object($value) && method_exists($value, "render")) {
$n .= $value->render();
} else {
$n .= $value;
@ -103,18 +90,15 @@ class cTableView
$field = $n;
}
if (is_object($field) && method_exists($field, "render"))
{
if (is_object($field) && method_exists($field, "render")) {
$n = $field->render();
$field = $n;
}
if ($field == "")
{
if ($field == "") {
$field = "&nbsp;";
}
if ($caption == "")
{
if ($caption == "") {
$caption = "&nbsp;";
}
@ -122,41 +106,34 @@ class cTableView
$this->items[$this->id] = $field;
$this->captions[$this->id] = $caption;
if ($rowname == "")
{
if ($rowname == "") {
$rowname = $this->id;
}
$this->rownames[$this->id] = $rowname;
}
function addCancel ($link)
{
function addCancel($link) {
$this->cancelLink = $link;
}
function addHeader ($header)
{
function addHeader($header) {
$this->header = $header;
}
function setSubmitJS ($js)
{
function setSubmitJS($js) {
$this->submitjs = $js;
}
function setAccessKey ($key)
{
function setAccessKey($key) {
$this->accessKey = $key;
}
function setActionEvent ($id, $event)
{
function setActionEvent($id, $event) {
$this->custom[$id]["event"] = $event;
}
function setActionButton ($id, $image, $description = "", $accesskey = false, $action = false)
{
function setActionButton($id, $image, $description = "", $accesskey = false, $action = false) {
$this->custom[$id]["image"] = $image;
$this->custom[$id]["type"] = "actionsetter";
$this->custom[$id]["action"] = $action;
@ -165,14 +142,11 @@ class cTableView
$this->custom[$id]["event"] = "";
}
function unsetActionButton ($id)
{
function unsetActionButton($id) {
unset($this->custom[$id]);
}
function render ($return = true)
{
function render($return = true) {
global $sess, $cfg;
$tpl = new Template;
@ -183,16 +157,13 @@ class cTableView
$form = '<form enctype="multipart/form-data" style="margin:0px" name="' . $this->formname . '" method="' . $this->formmethod . '" action="' . $this->formaction . '">' . "\n";
$this->formvars["contenido"] = $sess->id;
if (is_array($this->formvars))
{
foreach ($this->formvars as $key => $value)
{
if (is_array($this->formvars)) {
foreach ($this->formvars as $key => $value) {
$form .= '<input type="hidden" name="' . $key . '" value="' . $value . '">' . "\n";
}
}
if (!array_key_exists("action", $this->formvars))
{
if (!array_key_exists("action", $this->formvars)) {
$form .= '<input type="hidden" name="action" value="">';
}
@ -200,8 +171,7 @@ class cTableView
$tpl->set('s', 'ID', $this->tableid);
$tpl->set('s', 'BORDERCOLOR', $this->tablebordercolor);
if ($this->header != "")
{
if ($this->header != "") {
$header = '<tr class="text_medium" style="background-color: ' . $cfg["color"]["table_header"] . ';">';
$header .= '<td colspan="2" valign="top" style="border: 0px; border-top:1px; border-right:1px;border-color: ' . $cfg["color"]["table_border"] . '; border-style: solid;">' . $this->header . '</td></tr>';
}
@ -210,10 +180,8 @@ class cTableView
$dark = false;
if (is_array($this->items))
{
foreach ($this->items as $key => $value)
{
if (is_array($this->items)) {
foreach ($this->items as $key => $value) {
$tpl->set('d', 'CATNAME', $this->captions[$key]);
$tpl->set('d', 'CATFIELD', $value);
$tpl->set('d', 'ROWNAME', $this->rownames[$key]);
@ -233,8 +201,7 @@ class cTableView
$tpl->set('s', 'CONTENIDOPATH', $cfg["path"]["contenido_fullhtml"]);
if ($this->cancelLink != "")
{
if ($this->cancelLink != "") {
$img = '<img src="' . $cfg["path"]["contenido_fullhtml"] . 'images/but_cancel.gif" border="0">';
$tpl->set('s', 'CANCELLINK', '<a href="' . $this->cancelLink . '">' . $img . '</a>');
@ -242,13 +209,11 @@ class cTableView
$tpl->set('s', 'CANCELLINK', '');
}
if ($this->submitjs != "")
{
if ($this->submitjs != "") {
$extra .= 'onclick="' . $this->submitjs . '"';
}
if ($this->accesskey != "")
{
if ($this->accesskey != "") {
$tpl->set('s', 'KEY', $this->accesskey);
} else {
$tpl->set('s', 'KEY', '');
@ -258,23 +223,19 @@ class cTableView
$custombuttons = "";
foreach ($this->custom as $key => $value)
{
if ($value["accesskey"] != "")
{
foreach ($this->custom as $key => $value) {
if ($value["accesskey"] != "") {
$accesskey = 'accesskey="' . $value["accesskey"] . '"';
} else {
$accesskey = "";
}
$onclick = "";
if ($value["action"] !== false)
{
if ($value["action"] !== false) {
$onclick = 'document.forms[\'' . $this->formname . '\'].elements[\'action\'].value = \'' . $value["action"] . '\';';
}
if ($value["event"] != "")
{
if ($value["event"] != "") {
$onclick .= $value["event"];
}
@ -285,12 +246,11 @@ class cTableView
$rendered = $tpl->generate($cfg["path"]["contenido"] . $cfg['path']['templates'] . $cfg['templates']['generic_table_form'], true);
if ($return == true)
{
if ($return == true) {
return ($rendered);
} else {
echo $rendered;
}
}
}
?>