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"); $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 * @param string $area
@ -99,11 +93,5 @@ class cApiAction extends Item {
// @todo Where is this used??? // @todo Where is this used???
$this->_wantParameters = array(); $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 * Constructor Function
* @param * @param
*/ */
function Action() { function __construct() {
// empty // empty
} // end function } // end function

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -145,12 +145,6 @@ class Article extends Item
$this->_getArticleContent(); $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 * Getter for idartlang of article object
* *
@ -498,13 +492,6 @@ class ArticleCollection
$this->_getArticlesByCatId($this->idcat); $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 * Set the Object properties
* *

Datei anzeigen

@ -46,13 +46,6 @@ class ArtSpecCollection extends ItemCollection
parent::__construct($cfg['tab']['art_spec'], "idartspec"); parent::__construct($cfg['tab']['art_spec'], "idartspec");
$this->_setItemClass("ArtSpecItem"); $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); $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 * Constructor
*/ */
function Contenido_Backend() { function __construct() {
# do nothing # do nothing
} # end function } # end function

Datei anzeigen

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

Datei anzeigen

@ -43,13 +43,6 @@ class CategoryCollection extends ItemCollection
parent::__construct($cfg["tab"]["cat"], "idcat"); parent::__construct($cfg["tab"]["cat"], "idcat");
$this->_setItemClass("CategoryItem"); $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) public function loadByPrimaryKey($key)
{ {
if (parent::loadByPrimaryKey($key)) { if (parent::loadByPrimaryKey($key)) {
@ -101,13 +87,6 @@ class CategoryLanguageCollection extends ItemCollection
parent::__construct($cfg["tab"]["cat_lang"], "idcatlang"); parent::__construct($cfg["tab"]["cat_lang"], "idcatlang");
$this->_setItemClass("CategoryLanguageItem"); $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); $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 $_aAliasCache;
var $_aCharCache; var $_aCharCache;
function cCharacterConverter () function __construct ()
{ {
$this->_oDB = new DB_ConLite; $this->_oDB = new DB_ConLite;
$this->_aAliasCache = array(); $this->_aAliasCache = array();
@ -155,4 +155,3 @@ class cCharacterConverter
return $sEncoding; return $sEncoding;
} }
} }
?>

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -47,13 +47,6 @@ class CommunicationCollection extends ItemCollection
$this->_setItemClass("CommunicationItem"); $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 * 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() function store()
{ {
global $auth; global $auth;
@ -107,5 +93,3 @@ class CommunicationItem extends Item
parent::store(); parent::store();
} }
} }
?>

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -50,13 +50,6 @@ class FrontendGroupCollection extends ItemCollection
$this->_setItemClass("FrontendGroup"); $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 * Creates a new group
* @param $groupname string Specifies the groupname * @param $groupname string Specifies the groupname
@ -122,13 +115,6 @@ class FrontendGroup extends Item
$this->loadByPrimaryKey($mId); $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"); $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 * Creates a new association
* @param $idfrontendgroup int specifies the frontend group * @param $idfrontendgroup int specifies the frontend group
@ -237,13 +216,4 @@ class FrontendGroupMember extends Item
$this->loadByPrimaryKey($mId); $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"); $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 * Creates a new permission entry
* @param $group string Specifies the frontend group * @param $group string Specifies the frontend group
@ -157,13 +150,4 @@ class FrontendPermission extends Item
$this->loadByPrimaryKey($mId); $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"); $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 * Checks if a specific user already exists
* @param $sUsername string specifies the username to search for * @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 * Overridden setField method to md5 the password
* Sets the value of a specific field * Sets the value of a specific field

Datei anzeigen

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

Datei anzeigen

@ -34,7 +34,7 @@ class cHTMLValidator
var $nestingNodes; var $nestingNodes;
var $_existingTags; var $_existingTags;
function cHTMLValidator() function __construct()
{ {
$this->doubleTags = array ("form", "head", "body", "html", "td", "tr", "table", "a", "tbody", "title", "container", "span", "div"); $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 * @param string $sConfigPath
* @return HttpInputValidator * @return HttpInputValidator
*/ */
function HttpInputValidator($sConfigPath) { function __construct($sConfigPath) {
// check config and logging path // check config and logging path
if (!empty($sConfigPath) && file_exists($sConfigPath)) { if (!empty($sConfigPath) && file_exists($sConfigPath)) {
$this->sConfigPath = realpath($sConfigPath); $this->sConfigPath = realpath($sConfigPath);

Datei anzeigen

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

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -29,7 +30,6 @@
* }} * }}
* *
*/ */
if (!defined('CON_FRAMEWORK')) { if (!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
@ -43,21 +43,15 @@ if (!defined('CON_FRAMEWORK')) {
* @copyright four for business 2003 * @copyright four for business 2003
*/ */
class Languages extends cApiLanguageCollection { class Languages extends cApiLanguageCollection {
/** /**
* Constructor * Constructor
* @param none * @param none
*/ */
public function __construct() public function __construct() {
{
parent::__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 * @copyright four for business 2003
*/ */
class Language extends cApiLanguage { class Language extends cApiLanguage {
/** /**
* Constructor Function * Constructor Function
* @param mixed $mId Specifies the ID of item to load * @param mixed $mId Specifies the ID of item to load
*/ */
public function __construct($mId = false) public function __construct($mId = false) {
{
if ($mId === false) { if ($mId === false) {
parent::__construct(); parent::__construct();
} else { } 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; var $_payloadObject;
function cMetaObject ($payload = false) function __construct ($payload = false)
{ {
$this->_actions = array(); $this->_actions = array();
$this->_fields = array(); $this->_fields = array();

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -96,13 +96,6 @@ class PropertyCollection extends ItemCollection
$this->_setItemClass('PropertyItem'); $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. * 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 * Stores changed PropertyItem
*/ */

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -129,7 +129,7 @@ class TreeItem
* @param string $id The unique ID of that item * @param string $id The unique ID of that item
* @param boolean $collapsed Is this item collapsed by default * @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->name = $name;
$this->id = $id; $this->id = $id;

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -37,12 +37,6 @@ class cApiModuleCollection extends ItemCollection {
$this->_setItemClass("cApiModule"); $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 * Creates a new communication item
*/ */

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -25,19 +26,16 @@
* }} * }}
* *
*/ */
if (!defined('CON_FRAMEWORK')) { if (!defined('CON_FRAMEWORK')) {
die('Illegal call'); die('Illegal call');
} }
class cCalendarControl extends cHTMLTable {
class cCalendarControl extends cHTMLTable
{
var $_oDate; var $_oDate;
function cCalendarControl ($initDate = false) function __construct($initDate = false) {
{ parent::__construct();
parent::cHTMLTable();
$this->_initFormatting(); $this->_initFormatting();
$this->_oDate = new cDatatypeDateTime; $this->_oDate = new cDatatypeDateTime;
@ -45,25 +43,20 @@ class cCalendarControl extends cHTMLTable
/* Development: Set today's date */ /* Development: Set today's date */
$this->_oDate->setSourceFormat(cDateTime_ISO); $this->_oDate->setSourceFormat(cDateTime_ISO);
if ($initDate === false) if ($initDate === false) {
{
$this->_oDate->set(date("Y-m-d H:i:s")); $this->_oDate->set(date("Y-m-d H:i:s"));
} else { } else {
$this->_oDate->set($initDate); $this->_oDate->set($initDate);
} }
} }
function _initFormatting() {
function _initFormatting ()
{
$this->setClass("calendar"); $this->setClass("calendar");
$this->setCellSpacing(0); $this->setCellSpacing(0);
$this->setCellPadding(0); $this->setCellPadding(0);
} }
function _renderHead () function _renderHead() {
{
$oHead = new cHTMLTableHeader; $oHead = new cHTMLTableHeader;
$aDayOrder = $this->_oDate->getDayOrder(); $aDayOrder = $this->_oDate->getDayOrder();
@ -72,8 +65,7 @@ class cCalendarControl extends cHTMLTable
$aData = array(); $aData = array();
foreach ($aDayOrder as $iDay) foreach ($aDayOrder as $iDay) {
{
$oData = new cHTMLTableData; $oData = new cHTMLTableData;
$oData->setContent(substr($this->_oDate->getDayName($iDay), 0, 2)); $oData->setContent(substr($this->_oDate->getDayName($iDay), 0, 2));
@ -86,8 +78,7 @@ class cCalendarControl extends cHTMLTable
return ($oHead); return ($oHead);
} }
function _renderBody () function _renderBody() {
{
$iRows = 6; $iRows = 6;
$iDaysPerWeek = 7; $iDaysPerWeek = 7;
@ -95,14 +86,12 @@ class cCalendarControl extends cHTMLTable
$aRowData = array(); $aRowData = array();
for ($iRow = 0; $iRow < $iRows; $iRow++) for ($iRow = 0; $iRow < $iRows; $iRow++) {
{
$oRow = new cHTMLTableRow; $oRow = new cHTMLTableRow;
$aData = array(); $aData = array();
$aDayOrder = $this->_oDate->getDayOrder(); $aDayOrder = $this->_oDate->getDayOrder();
foreach ($aDayOrder as $iDay) foreach ($aDayOrder as $iDay) {
{
$oData = new cHTMLTableData; $oData = new cHTMLTableData;
$oData->setContent('&nbsp;'); $oData->setContent('&nbsp;');
$oData->setStyle("border: 1px solid white"); $oData->setStyle("border: 1px solid white");
@ -118,8 +107,7 @@ class cCalendarControl extends cHTMLTable
return ($oHead); return ($oHead);
} }
function _renderJS () function _renderJS() {
{
$this->_oDate->setSourceFormat(cDateTime_UNIX); $this->_oDate->setSourceFormat(cDateTime_UNIX);
$oScript = new cHTMLScript; $oScript = new cHTMLScript;
@ -401,14 +389,12 @@ class cCalendarControl extends cHTMLTable
return $oScript; return $oScript;
} }
function _renderMonthDropdown () function _renderMonthDropdown() {
{
$oMonthSelect = new cHTMLSelectElement($this->getId() . "_monthselect"); $oMonthSelect = new cHTMLSelectElement($this->getId() . "_monthselect");
$oMonthSelect->setId($this->getId() . "_monthselect"); $oMonthSelect->setId($this->getId() . "_monthselect");
$aMonths = array(); $aMonths = array();
for ($i=1;$i<13;$i++) for ($i = 1; $i < 13; $i++) {
{
$aMonths[$i] = $this->_oDate->getMonthName($i); $aMonths[$i] = $this->_oDate->getMonthName($i);
} }
@ -418,8 +404,7 @@ class cCalendarControl extends cHTMLTable
return ($oMonthSelect); return ($oMonthSelect);
} }
function _renderMonthPrev () function _renderMonthPrev() {
{
$oMonthLeft = new cHTMLImage; $oMonthLeft = new cHTMLImage;
$oMonthLeft->setSrc("images/month_prev.gif"); $oMonthLeft->setSrc("images/month_prev.gif");
$oMonthLeft->setStyle("border: 0px solid black; cursor: pointer;"); $oMonthLeft->setStyle("border: 0px solid black; cursor: pointer;");
@ -427,8 +412,7 @@ class cCalendarControl extends cHTMLTable
return $oMonthLeft; return $oMonthLeft;
} }
function _renderMonthNext () function _renderMonthNext() {
{
$oMonthLeft = new cHTMLImage; $oMonthLeft = new cHTMLImage;
$oMonthLeft->setSrc("images/month_next.gif"); $oMonthLeft->setSrc("images/month_next.gif");
$oMonthLeft->setStyle("border: 0px solid black; cursor: pointer;"); $oMonthLeft->setStyle("border: 0px solid black; cursor: pointer;");
@ -436,8 +420,7 @@ class cCalendarControl extends cHTMLTable
return $oMonthLeft; return $oMonthLeft;
} }
function _renderYearControl () function _renderYearControl() {
{
$oYear = new cHTMLTextbox($this->getId() . "_yearbox", "", 4, 4); $oYear = new cHTMLTextbox($this->getId() . "_yearbox", "", 4, 4);
$oYear->setId($this->getId() . "_yearbox"); $oYear->setId($this->getId() . "_yearbox");
$oYear->setEvent("change", $this->getId() . "_setCalendar(this.value, " . $this->getId() . "_currentMonth);"); $oYear->setEvent("change", $this->getId() . "_setCalendar(this.value, " . $this->getId() . "_currentMonth);");
@ -445,8 +428,7 @@ class cCalendarControl extends cHTMLTable
return $oYear; return $oYear;
} }
function render () function render() {
{
$this->setContent(array($this->_renderHead(), $this->_renderBody(), $this->_renderJS())); $this->setContent(array($this->_renderHead(), $this->_renderBody(), $this->_renderJS()));
$oSpan = new cHTMLSpan; $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>'; 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 * cDataTextWidget generates a textbox widget
* for use with the data objects. * for use with the data objects.
*/ */
class cDataTextWidget extends cHTMLTextbox class cDataTextWidget extends cHTMLTextbox {
{
/** /**
* cDataTextWidget: Creates a text box widget * cDataTextWidget: Creates a text box widget
* *
@ -19,15 +19,14 @@ class cDataTextWidget extends cHTMLTextbox
* @return void * @return void
* @access public * @access public
*/ */
function cDataTextWidget ($name, $parameters) function __construct($name, $parameters) {
{ parent::__construct($name);
cHTMLTextbox::cHTMLTextbox($name);
if (array_key_exists("default", $parameters)) if (array_key_exists("default", $parameters)) {
{
$this->setValue($parameters["default"]); $this->setValue($parameters["default"]);
} }
} }
} }
/** /**
@ -35,8 +34,8 @@ class cDataTextWidget extends cHTMLTextbox
* cDataTextareaWidget generates a textarea widget for use with the data objects. * 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 * cDataTextareaWidget: Creates a text area widget
* *
@ -49,24 +48,22 @@ class cDataTextareaWidget extends cHTMLTextarea
* @return void * @return void
* @access public * @access public
*/ */
function cDataTextareaWidget ($name, $parameters) function __construct($name, $parameters) {
{ parent::__construct($name);
cHTMLTextarea::cHTMLTextarea($name);
if (array_key_exists("default", $parameters)) if (array_key_exists("default", $parameters)) {
{
$this->setValue($parameters["default"]); $this->setValue($parameters["default"]);
} }
} }
} }
/** /**
* class cDataCodeTextareaWidget * class cDataCodeTextareaWidget
* cDataCodeTextareaWidget generates a textarea widget for use with the data objects. * 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 * cDataTextareaWidget: Creates a text area widget
* which can be used for entering code * which can be used for entering code
@ -81,12 +78,10 @@ class cDataCodeTextareaWidget extends cHTMLTextarea
* @return void * @return void
* @access public * @access public
*/ */
function cDataCodeTextareaWidget ($name, $parameters) function __construct($name, $parameters) {
{ parent::__construct($name);
cHTMLTextarea::cHTMLTextarea($name);
if (array_key_exists("default", $parameters)) if (array_key_exists("default", $parameters)) {
{
$this->setValue($parameters["default"]); $this->setValue($parameters["default"]);
} }
@ -95,27 +90,26 @@ class cDataCodeTextareaWidget extends cHTMLTextarea
$this->setWidth(100); $this->setWidth(100);
$this->setHeight(20); $this->setHeight(20);
if (array_key_exists("notes", $parameters)) if (array_key_exists("notes", $parameters)) {
{
$this->_notes = $parameters["notes"]; $this->_notes = $parameters["notes"];
} }
} }
function render () function render() {
{
$out = parent::render(); $out = parent::render();
$out .= $this->_notes; $out .= $this->_notes;
return ($out); return ($out);
} }
} }
/** /**
* class cDataDropdownWidget * class cDataDropdownWidget
* cDataDropdownWidget generates a dropdown widget for use with the data objects. * cDataDropdownWidget generates a dropdown widget for use with the data objects.
*/ */
class cDataDropdownWidget extends cHTMLSelectElement class cDataDropdownWidget extends cHTMLSelectElement {
{
/** /**
* cDataDropdownWidget: Creates a dropdown widget * cDataDropdownWidget: Creates a dropdown widget
* with specific entries * with specific entries
@ -130,25 +124,24 @@ class cDataDropdownWidget extends cHTMLSelectElement
* @return void * @return void
* @access public * @access public
*/ */
function cDataDropdownWidget ($name, $parameters) function __construct($name, $parameters) {
{ parent::__construct($name);
cHTMLSelectElement::cHTMLSelectElement($name);
$this->autoFill($parameters["choices"]); $this->autoFill($parameters["choices"]);
if (array_key_exists("default", $parameters)) if (array_key_exists("default", $parameters)) {
{
$this->setDefault($parameters["default"]); $this->setDefault($parameters["default"]);
} }
} }
} }
/** /**
* class cDataForeignTableDropdownWidget * class cDataForeignTableDropdownWidget
* cDataForeignTableDropdownWidget generates a dropdown widget out of a foreign table. * cDataForeignTableDropdownWidget generates a dropdown widget out of a foreign table.
*/ */
class cDataForeignTableDropdownWidget extends cHTMLSelectElement class cDataForeignTableDropdownWidget extends cHTMLSelectElement {
{
/** /**
* cDataForeignTableDropdownWidget: Creates a dropdown widget * cDataForeignTableDropdownWidget: Creates a dropdown widget
* which fetches its entries from a foreign, linked table * which fetches its entries from a foreign, linked table
@ -163,39 +156,35 @@ class cDataForeignTableDropdownWidget extends cHTMLSelectElement
* @return void * @return void
* @access public * @access public
*/ */
function cDataForeignTableDropdownWidget ($name, $parameters) function __construct($name, $parameters) {
{ parent::__construct($name);
cHTMLSelectElement::cHTMLSelectElement($name);
$c = new $parameters["foreignClass"]; $c = new $parameters["foreignClass"];
$c->query(); $c->query();
while ($i = $c->next()) while ($i = $c->next()) {
{
$meta = $i->getMetaObject(); $meta = $i->getMetaObject();
if (is_object($meta)) if (is_object($meta)) {
{
$data[$i->get($i->primaryKey)] = $meta->getName(); $data[$i->get($i->primaryKey)] = $meta->getName();
} }
} }
$this->autoFill($data); $this->autoFill($data);
if (array_key_exists("default", $parameters)) if (array_key_exists("default", $parameters)) {
{
$this->setDefault($parameters["default"]); $this->setDefault($parameters["default"]);
} }
} }
} }
/** /**
* class cDataCheckboxWidget * class cDataCheckboxWidget
* cDataCheckboxWidget generates a checkbox for use with the dataobjects * cDataCheckboxWidget generates a checkbox for use with the dataobjects
*/ */
class cDataCheckboxWidget extends cHTMLCheckbox class cDataCheckboxWidget extends cHTMLCheckbox {
{
/** /**
* cDataCheckboxWidget: Creates a checkbox widget * cDataCheckboxWidget: Creates a checkbox widget
* *
@ -209,12 +198,10 @@ class cDataCheckboxWidget extends cHTMLCheckbox
* @return void * @return void
* @access public * @access public
*/ */
function cDataCheckboxWidget ($name, $parameters) function __construct($name, $parameters) {
{ parent::__construct($name . "_stub", "1");
cHTMLCheckbox::cHTMLCheckbox($name."_stub", "1");
if ($parameters["title"] != "") if ($parameters["title"] != "") {
{
$this->setLabelText($parameters["title"]); $this->setLabelText($parameters["title"]);
} else { } else {
$this->setLabelText(" "); $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'; }"); $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 = $this->_hfield->render();
$out .= parent::render(); $out .= parent::render();
return ($out); return ($out);
} }
} }
/** /**
@ -240,8 +227,8 @@ class cDataCheckboxWidget extends cHTMLCheckbox
* cDataMultiTextboxWidget generates a multi-line textbox widget * cDataMultiTextboxWidget generates a multi-line textbox widget
*/ */
class cDataMultiTextboxWidget extends cHTMLTable class cDataMultiTextboxWidget extends cHTMLTable {
{
/** /**
* cDataMultiTextboxWidget: Creates a multi-line textbox widget * cDataMultiTextboxWidget: Creates a multi-line textbox widget
* *
@ -255,21 +242,17 @@ class cDataMultiTextboxWidget extends cHTMLTable
* @return void * @return void
* @access public * @access public
*/ */
function cDataMultiTextboxWidget ($name, $parameters) function __construct($name, $parameters) {
{ parent::__construct();
cHTMLTable::cHTMLTable();
$this->name = $name; $this->name = $name;
if (array_key_exists("title", $parameters)) if (array_key_exists("title", $parameters)) {
{
$rows[] = $this->addTitle($parameters["title"]); $rows[] = $this->addTitle($parameters["title"]);
} }
if (is_array($parameters["default"])) if (is_array($parameters["default"])) {
{ foreach ($parameters["default"] as $i) {
foreach ($parameters["default"] as $i)
{
$rows[] = $this->addRow($i); $rows[] = $this->addRow($i);
} }
} }
@ -280,11 +263,9 @@ class cDataMultiTextboxWidget extends cHTMLTable
$this->setPadding(1); $this->setPadding(1);
$this->setContent($rows); $this->setContent($rows);
} }
function addTitle ($title) function addTitle($title) {
{
$row = new cHTMLTableRow; $row = new cHTMLTableRow;
$data = new cHTMLTableData; $data = new cHTMLTableData;
$data->setColSpan(2); $data->setColSpan(2);
@ -294,8 +275,7 @@ class cDataMultiTextboxWidget extends cHTMLTable
return ($row); return ($row);
} }
function addRow ($data) function addRow($data) {
{
$row = new cHTMLTableRow; $row = new cHTMLTableRow;
$l = new cHTMLTableData; $l = new cHTMLTableData;
$r = new cHTMLTableData; $r = new cHTMLTableData;
@ -327,7 +307,5 @@ class cDataMultiTextboxWidget extends cHTMLTable
return ($row); return ($row);
} }
} }
?>

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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