usr/share/pear/CCMS-DEV/0040755000000000000000000000000010220047430013553 5ustar rootrootusr/share/pear/CCMS-DEV/Data_Types/0040755000000000000000000000000010225510763015621 5ustar rootrootusr/share/pear/CCMS-DEV/Data_Types/CCMS_Data_Type.php0100644000000000000000000002573610226524422021021 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_String */ /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the a generic CCMS_Data_Type * * The generic CCMS_Data_Type class is the parent class used by the Circus Content Management System * to outline various types of data. This class outlines the structure of child CCMS_Data_Type classes. * All functions in this parent class should normally be rewritten in child implementations. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @since Class available since Release 1.0.0 */ class CCMS_Data_Type{ /** * The value represented in this data type * * This value is mixed, and should be explicitly specified in child classes * * @var string * @access private */ var $_value; var $_label; /** * The id attribute of the html form field and GPC data * * This value is generated by the calling class, but then stored locally. * * @var string * @access private */ var $_id; /** * Any array of options for this data type * * The format of the array should be Array("optionName"=>"optionValue") * There are no currently supported options for the parent CCMS_Data_Type class * * * @var array * @access private */ var $_options; var $_defs; /** * An array (treated as a stack) that contains errors thrown by this class. * * This array contains objects of type Error, member functions return 0 on error and put details into this stack * * @var array * @access private * @see Error, CCMS_Data_Type::getError */ var $_arrError; /** * Constructor for a CCMS_Data_Type object * * @param mixed $value the value to be stored / manipulated * @param array $options an array of the options (mainly used in output) for this data type * * @return int returns true on success * @throws CCMS_Error CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * * @access public * @static * @since Method available since Release 1.0.0 */ function CCMS_Data_Type($options = Array(), $defs = Array()) { $this->_defs = $defs; $this->_options = $options; $this->_arrError = Array(); return true; } function setLabel($label){ $this->_label = $label; } /** * Returns the HTML form field needed to get a user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_String $elementId the id/name attribute for the HTML element * @return CCMS_String a CCMS_String containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * * @access public * @since Method available since Release 1.0.0 */ function getFormElement($elementId) { //returns html form fields (no tables) required to add / edit this CCMS_Data_Type $ret = "_value . "\" " . $opt . ">"; //save the form id to the instace of this class $this->_id = $elementId; return $ret; } /** * Returns the SQL value of the data * * This function will return the value of the data with any conversions necessary so that the data can be inserted into an SQL-style database (such as addslashes) * The data value of this class instance should always be un-escaped data (slashes are striped at input if necessary). * * @return CCMS_String a CCMS_String containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * @see CCMS_String::setValue, IO::process * * @access public * @since Method available since Release 1.0.0 */ function getSqlValue() { //this->_value should always contain un-escaped data return addslashes($this->_value); } function getClass(){ if(isset($this->_options["cssClass"])){ return $this->_options["cssClass"]; }else{ return "_CCMS_DEFAULT_TEXT"; } } function getOption($option){ if(is_array($this->_options) && isset($this->_options[$option])) { return $this->_options[$option]; } else { return false; } } function loadFromGPC($gpcId = null){ if (!isset($gpcId)) { $gpcId = $this->_id; } if (!isset($_POST[$gpcId])) { $value = null; } else { if (get_magic_quotes_gpc()) { $value = stripslashes($_POST[$gpcId]); } else { $value = $_POST[$gpcId]; } } return $value; } /** * Returns the value (human-readable) of the data * * This function will return the value of the data in its human readable / manageable form. * * @return CCMS_String a CCMS_String containing the value element ready to be printed / displayed * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * * @access public * @since Method available since Release 1.0.0 */ function getValue() { //returns the text (human readable) value for this object return $this->_value; } /** * Returns the value (human-readable) of the data * * This function will return the value of the data in its human readable / manageable form. * * @return CCMS_String a CCMS_String containing the value element ready to be printed / displayed * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * * @access public * @since Method available since Release 1.0.0 */ function getValuePreview() { //returns the text (human readable) value for this object return $this->_value; } function getHTMLValue() { //returns the text (human readable) value for this object return $this->_value; } function getFormValue() { //returns the text (human readable) value for this object return $this->_value; } /** * Sets the value of the data * * This function sets the value of the data * * @return CCMS_String a CCMS_String containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * @see CCMS_String::setValue * * @access public * @since Method available since Release 1.0.0 */ function setValue($val) { $this->_value = $val; return true; } /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * @see CCMS_String::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { //check options $errors = 0; if ($errors) { return false; } else { return true; } } /** * This function gets called after all data has been validated and saved into the database * * This function is useful if actions need to be carried out once ALL data is validated (like copying a file) * * @return bool returns true on sucess * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * @see CCMS_Error * * @access public * @since Method available since Release 1.0.0 */ function cleanup(){ //this function gets called after all data has been validated and saved to database return true; } /** * Returns an error (if any) from the internal Error stack * * This function shifts a CCMS_Error object off the internal Error array and returns it * * @return CCMS_Error returns a CCMS_Error object, if no Error objects are on the internal error stack, the function returns false * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * @see CCMS_Error * * @access public * @since Method available since Release 1.0.0 */ function getError() { if (sizeof($this->_arrError) > 0) { return array_shift($this->_arrError); } else { return false; } } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_Date.php0100644000000000000000000002442410226527113020015 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_DateTime */ /** * Require CCMS_Data_Type class * */ require_once 'Data_Types/CCMS_String.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_DateTime' CCMS_Data_Type * * The CCMS_DateTime CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_Date extends CCMS_String{ var $_month; var $_day; var $_year; /* var $_hour; var $_minute; var $_ante; */ var $_id; /** * Returns the HTML form field needed to get a CCMS_DateTime from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_DateTime $elementId the id/name attribute for the HTML element * @return CCMS_DateTime a CCMS_DateTime containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_DateTime, and error type * * @access public * @since Method available since Release 1.0.0 */ function getFormElement($elementId) { //returns html form fields (no tables) required to add / edit this CCMS_Data_Type $opt = ""; $opt .= (isset($this->_options["cssClass"])) ? " class=\"" . $this->_options["cssClass"] . "\" " : "class=\"CCMS_DATETIME\""; $width = (isset($this->_options["width"])) ? " style=\"width:" . $this->_options["width"] . "\" " : ""; $borderClass = (isset($this->_options["borderClass"])) ? "class=\"" . $this->_options["borderClass"] . "\" " : "class=\"CCMS_DATETIME_BORDER\""; $ret = "
\n"; $ret .= "_month . "\" " . $opt . ">"; $ret .= "/_day . "\" " . $opt . ">"; $ret .= "/_year . "\" " . $opt . ">\n"; /* $ret .= " "; $ret .= ":\n"; $ret .= "\n"; */ $ret .= "
\n"; $ret .= "_value . "\" " . $opt . ">"; //save the form id to the instace of this class $this->_id = $elementId; return $ret; } /** * Returns the value (human-readable) of the data * * This function will return the value of the data in its human readable / manageable form. * The value of this function is stored in SQL DateTime format YYYY-MM-DD HH:MM:SS * * @return CCMS_DateTime a CCMS_DateTime containing the value element ready to be printed / displayed * @throws CCMS_Error contains information about the error such as error number, error CCMS_DateTime, and error type * * @access public * @since Method available since Release 1.0.0 */ function getValue() { //returns the text (human readable) value for this object $dateVal = strtotime($this->_value); if($dateVal != -1){ return date("m/d/Y", $dateVal); } return $this->_value; } /** * Sets the value of the data * * This function sets the value of the data * * @return CCMS_DateTime a CCMS_DateTime containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_DateTime, and error type * @see CCMS_DateTime::setValue * * @access public * @since Method available since Release 1.0.0 */ function setValue($val) { //match time off current value preg_match("/(\d+)-(\d+)-(\d+) (\d+):(\d+):.*/", $val, $matches); $this->_year = $matches[1]; $this->_month = $matches[2]; $this->_day = $matches[3]; // $this->_hour = $matches[4]; // $this->_minute = $matches[5]; //LOAD DATE, IF DATE GETS LOADED, LOAD TIME if(isset($_POST[$this->_id . ":MONTH"]) && isset($_POST[$this->_id . ":DAY"]) && isset($_POST[$this->_id . ":YEAR"])){ $this->_year = intval($_POST[$this->_id . ":YEAR"]); $this->_month = intval($_POST[$this->_id . ":MONTH"]); $this->_day = intval($_POST[$this->_id . ":DAY"]); //check to see if GPC values are valid if (checkdate($this->_month, $this->_day, $this->_year)) { $val = sprintf("%04d-%02d-%02d", $this->_year, $this->_month, $this->_day); $val .= " 00:00:01"; } } $this->_value = $val; return true; } /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_DateTime, and error type * @see CCMS_DateTime::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { //check options $errors = 0; if (($this->_options["required"]) && ((!isset($this->_value)) || (strlen($this->_value) == 0))){ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00101", "Required field (Cannot be left blank)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["maxLength"])) && (strlen($this->_value) > $this->_options["maxLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00102", "Maximum Length Exceeded (" . $this->_options["maxLength"] . " Characters Max)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["minLength"])) && (strlen($this->_value) < $this->_options["minLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00103", "Minimum Length Not Met (Must be atleast " . $this->_options["minLength"] . " Characters)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if (!is_int($this->_month) || !is_int($this->_day) || !is_int($this->_year) || !checkdate($this->_month, $this->_day, $this->_year)) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00108", $this->_label . ": Invalid Date Entered", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ($errors) { return false; } else { return true; } } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_DateTime.php0100644000000000000000000003035610226527127020642 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_DateTime */ /** * Require CCMS_Data_Type class * */ require_once 'Data_Types/CCMS_String.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_DateTime' CCMS_Data_Type * * The CCMS_DateTime CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_DateTime extends CCMS_String{ var $_month; var $_day; var $_year; var $_hour; var $_minute; var $_ante; var $_id; /** * Returns the HTML form field needed to get a CCMS_DateTime from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_DateTime $elementId the id/name attribute for the HTML element * @return CCMS_DateTime a CCMS_DateTime containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_DateTime, and error type * * @access public * @since Method available since Release 1.0.0 */ function getFormElement($elementId) { //returns html form fields (no tables) required to add / edit this CCMS_Data_Type $opt = ""; $opt .= (isset($this->_options["cssClass"])) ? " class=\"" . $this->_options["cssClass"] . "\" " : "class=\"CCMS_DATETIME\""; $borderClass = (isset($this->_options["borderClass"])) ? "class=\"" . $this->_options["borderClass"] . "\" " : "class=\"CCMS_DATETIME_BORDER\""; //$opt .= (isset($this->_options["useTime"])) ? " asdf=\"" . $this->_options["maxLength"] . "\" " : ""; $hour = (strtoupper($this->_ante) == "PM") ? ($this->_hour - 12) : $this->_hour; if($this->_hour == 0 || $this->_hour == 12){ $hour = 12; } $minute = $this->_minute; $ret = "
\n"; $ret .= "_month . "\" " . $opt . ">"; $ret .= "/_day . "\" " . $opt . ">"; $ret .= "/_year . "\" " . $opt . ">\n"; $ret .= " "; $ret .= ":\n"; $ret .= "\n"; $ret .= "
\n"; $ret .= "_value . "\" " . $opt . ">"; //save the form id to the instace of this class $this->_id = $elementId; return $ret; } /** * Returns the value (human-readable) of the data * * This function will return the value of the data in its human readable / manageable form. * The value of this function is stored in SQL DateTime format YYYY-MM-DD HH:MM:SS * * @return CCMS_DateTime a CCMS_DateTime containing the value element ready to be printed / displayed * @throws CCMS_Error contains information about the error such as error number, error CCMS_DateTime, and error type * * @access public * @since Method available since Release 1.0.0 */ function getValue() { //returns the text (human readable) value for this object $dateVal = strtotime($this->_value); if($dateVal != -1){ return date("m/d/Y", $dateVal); } return $this->_value; } /** * Sets the value of the data * * This function sets the value of the data * * @return CCMS_DateTime a CCMS_DateTime containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_DateTime, and error type * @see CCMS_DateTime::setValue * * @access public * @since Method available since Release 1.0.0 */ function setValue($val) { //match time off current value preg_match("/(\d+)-(\d+)-(\d+) (\d+):(\d+):.*/", $val, $matches); $this->_year = $matches[1]; $this->_month = $matches[2]; $this->_day = $matches[3]; $this->_hour = $matches[4]; $this->_minute = $matches[5]; if($this->_hour < 12){ $this->_ante = "AM"; } else { $this->_ante = "PM"; } //LOAD DATE, IF DATE GETS LOADED, LOAD TIME if(isset($_POST[$this->_id . ":MONTH"]) && isset($_POST[$this->_id . ":DAY"]) && isset($_POST[$this->_id . ":YEAR"])){ $this->_year = intval($_POST[$this->_id . ":YEAR"]); $this->_month = intval($_POST[$this->_id . ":MONTH"]); $this->_day = intval($_POST[$this->_id . ":DAY"]); //check to see if GPC values are valid if (checkdate($this->_month, $this->_day, $this->_year)) { $val = sprintf("%04d-%02d-%02d", $this->_year, $this->_month, $this->_day); //LOAD TIME if(isset($_POST[$this->_id . ":HOUR"]) && isset($_POST[$this->_id . ":MINUTE"]) && isset($_POST[$this->_id . ":ANTE"])){ $this->_hour = intval($_POST[$this->_id . ":HOUR"]); $this->_minute = intval($_POST[$this->_id . ":MINUTE"]); $this->_ante = $_POST[$this->_id . ":ANTE"]; //check to see if GPC values are valid if ($this->_hour == 12) { $this->_hour = (strtoupper($this->_ante) == "AM") ? 0 : 12; } else if(strtoupper($this->_ante) == "PM") { $this->_hour+=12; } //check limits if ($this->_hour > 23) { $this->_hour = 0; } if ($this->_hour < 0) { $this->_hour = 0; } if ($this->_minute > 59) { $this->_minute = 59; } if ($this->_minute < 0) { $this->_minute = 0; } $val .= sprintf(" %02d:%02d:01", $this->_hour, $this->_minute); } } } $this->_value = $val; return true; } /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_DateTime, and error type * @see CCMS_DateTime::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { //check options $errors = 0; if (($this->_options["required"]) && ((!isset($this->_value)) || (strlen($this->_value) == 0))){ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00101", "Required field (Cannot be left blank)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["maxLength"])) && (strlen($this->_value) > $this->_options["maxLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00102", "Maximum Length Exceeded (" . $this->_options["maxLength"] . " Characters Max)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["minLength"])) && (strlen($this->_value) < $this->_options["minLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00103", "Minimum Length Not Met (Must be atleast " . $this->_options["minLength"] . " Characters)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if (!is_int($this->_month) || !is_int($this->_day) || !is_int($this->_year) || !checkdate($this->_month, $this->_day, $this->_year)) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00108", $this->_label . ": Invalid Date Entered", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ($errors) { return false; } else { return true; } } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_Email.php0100644000000000000000000001060510226527143020166 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_Email */ /** * Require CCMS_Data_Type class * */ require_once 'Data_Types/CCMS_String.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_Email' CCMS_Data_Type * * The CCMS_Email CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_Email extends CCMS_String{ /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_Email, and error type * @see CCMS_Email::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { //check options $errors = 0; if (($this->_options["required"]) && ((!isset($this->_value)) || (strlen($this->_value) == 0))){ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00101", "Required field (Cannot be left blank)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["maxLength"])) && (strlen($this->_value) > $this->_options["maxLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00102", "Maximum Length Exceeded (" . $this->_options["maxLength"] . " Characters Max)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["minLength"])) && (strlen($this->_value) < $this->_options["minLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00103", "Minimum Length Not Met (Must be atleast " . $this->_options["minLength"] . " Characters)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $this->_value)) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00107", $this->_label . ": Invalid Email Address", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ($errors) { return false; } else { return true; } } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_Enum.php0100644000000000000000000001021710226510447020041 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_Enum */ /** * Require Data_Type class * */ require_once 'Data_Types/CCMS_Data_Type.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_Enum' CCMS_Data_Type * * The CCMS_Enum CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_Enum extends CCMS_Data_Type{ var $_values; function CCMS_Enum($options = Array(), $defs = Array()) { $this->_defs = $defs; $this->_options = $options; $this->_arrError = Array(); $this->_values = Array(); if(isset($this->_defs['sqlType'])){ //load potential values if (ereg('enum.(.*).', $this->_defs['sqlType'], $types)) { $opts = explode(',', $types[1]); foreach ($opts as $opt) { array_push($this->_values,substr(substr($opt,1),0,-1)); } return true; } } return false; } /** * Returns the HTML form field needed to get a CCMS_Enum from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_Enum $elementId the id/name attribute for the HTML element * @return CCMS_Enum a CCMS_Enum containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_Enum, and error type * * @access public * @since Method available since Release 1.0.0 */ function getFormElement($elementId) { //returns html form fields (no tables) required to add / edit this CCMS_Data_Type $opt = ""; $opt .= (isset($this->_options["cssClass"])) ? " class=\"" . $this->_options["cssClass"] . "\" " : "class=\"CCMS_INPUT\""; $width = (isset($this->_options["width"])) ? " style=\"width:" . $this->_options["width"] . "\" " : ""; $opt .= (isset($this->_options["size"])) ? " size=\"" . $this->_options["size"] . "\" " : ""; $ret = ""; //save the form id to the instace of this class $this->_id = $elementId; return $ret; } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_File.php0100644000000000000000000003605210220060045020005 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_File */ /** * Require CCMS_Data_Type class * */ require_once 'Data_Types/CCMS_Data_Type.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_File' CCMS_Data_Type * * The CCMS_File CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_File extends CCMS_Data_Type{ //relative var $_uploadPath; //base url var $_uploadUrl; //absolute path to file var $_uploadDir; var $_fileDir; //allowable file controls var $_mimeClasses; var $_mimeTypes; var $_fileExtensions; var $_maxFileSize; var $_fileName; var $_tempName; var $_fileType; var $_fileUploaded; var $_value; /** * Constructor for a CCMS_File object * * @param CCMS_File $value the value of the CCMS_File * @param array $options an array of the options (mainly used in output) for this data type * The format of the array should be Array("optionName"=>"optionValue"). * Currently supported options: * + "cssClass"=>"className" : With this option the class="className" attribute will be added to html form output * + "maxLength"=>"length" : the maximum length of the CCMS_File, this is enforced both in html forms and on the server side during processing * + "minLength"=>"length" : the minimum length of the CCMS_File, this is enforced both in html forms and on the server side during processing * + "size"=>"length" : length of the html input field * + "required"=>bool : is this field required (or can it be left blank) * * @return int returns true on success * @throws CCMS_Error CCMS_Error contains information about the error such as error number, error CCMS_File, and error type * * @access public * @static * @since Method available since Release 1.0.0 */ function CCMS_File($options = Array(), $defs = Array()){ $this->_options = $options; $this->_defs = $defs; $this->_arrError = Array(); //relative path (example media/uploads/) $this->_uploadPath = $options["uploadPath"]; //base url to the relative upload path $this->_uploadUrl = $options["uploadUrl"]; //absolute base path to the relative upload path $this->_uploadDir = $options["uploadDir"]; //allowable file controls $this->_mimeClasses = explode(",", $options["mimeClasses"]); $this->_mimeTypes = explode(",", $options["mimeTypes"]); $this->_fileExtensions = explode(",", $options["fileExtensions"]); $this->_maxFileSize = $options["maxFileSize"]; $this->_fileUploaded = false; $this->_value = ""; if(substr($this->_uploadPath,-1,1) != "/") $this->_uploadPath = $this->_uploadPath . "/"; if(substr($this->_uploadDir,-1,1) != "/") $this->_uploadDir = $this->_uploadDir . "/"; if(substr($this->_uploadUrl,-1,1) != "/") $this->_uploadUrl = $this->_uploadUrl . "/"; $this->_fileDir = $this->_uploadDir . $this->_uploadPath; return true; } function cleanup(){ //this function gets called after all data has been validated and saved to database if($this->_fileUploaded){ if (!$upload = $this->_copyFile()) { return false; } } return true; } function deleteHandler(){ //called when removing a 'file' object from the database if (strlen($this->_value) > 0 && file_exists($this->_fileDir . $this->_value)) { @unlink($this->_fileDir . $this->_value); } } function _test(){ //checks for errors before file upload (directory permissions) // 1. upload directory is writable // 2. thumbnail directory is writable // 3. imagemagick could be found // 4. disk space? } /** * Returns the HTML form field needed to get a CCMS_File from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_File $elementId the id/name attribute for the HTML element * @return CCMS_File a CCMS_File containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_File, and error type * * @access public * @since Method available since Release 1.0.0 */ function getFormElement($elementId) { //returns html form fields (no tables) required to add / edit this CCMS_Data_Type $opt = ""; $opt .= (isset($this->_options["cssClass"])) ? " class=\"" . $this->_options["cssClass"] . "\" " : "class=\"CCMS_INPUT\""; $opt .= (isset($this->_options["size"])) ? " size=\"" . $this->_options["size"] . "\" " : ""; $ret = "_value . "\" " . $opt . ">\n"; if (strlen($this->_value) > 0) { $ret .= "
Current File: _uploadUrl . $this->_uploadPath . $this->_value . "\" target=\"_blank\">" . $this->_value . "\n"; } $ret .= "_value . "\">\n"; //save the form id to the instace of this class $this->_id = $elementId; return $ret; } function loadFromGPC($gpcId = null){ //use the internal pointer for this one $gpcId = $this->_id . ":UPLOAD"; if(isset($_FILES[$gpcId]['name']) && strlen($_FILES[$gpcId]['name']) > 0){ $this->_fileName = (get_magic_quotes_gpc()) ? stripslashes($_FILES[$gpcId]['name']) : $_FILES[$gpcId]['name']; $this->_tempName = (get_magic_quotes_gpc()) ? stripslashes($_FILES[$gpcId]['tmp_name']) : $_FILES[$gpcId]['tmp_name']; $this->_fileType = (get_magic_quotes_gpc()) ? stripslashes($_FILES[$gpcId]['type']) : $_FILES[$gpcId]['type']; $this->_uploadFile(); } return false; } function _copyFile(){ $errors = 0; if (move_uploaded_file($this->_tempName, ($this->_fileDir . $this->_fileName))) { $this->_value = $this->_fileName; // change file permissions chmod($this->_fileDir . $this->_fileName, 0775); }else{ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00111", strtoupper($ext) . " Files Are Not Allowed", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ($errors) { return false; } return true; } function _uploadFile(){ $fileName = $this->_fileName; $fileType = $this->_fileType; $tempName = $this->_tempName; $dir = $this->_fileDir; $errors = 0; /* ** Get rid of illegal file name chars */ $fileName = preg_replace("/[\\\\\/:\*\?\"<>\|\s]+/","_",$fileName); $fileName = trim(strtolower($fileName)); /* ** Check to see if directory is writable to avoid all sorts of errors later on ** This also avoids some ugly php errors that can stop script execution */ if(!is_writable($dir)){ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00110", "This webiste currently does not have permission to upload files to '$dir'. Please contact the webmaster.", CCMS_ERR_T_INP, CCMS_ERR_M_HARD)); }else{ /* If this server is running PHP 4.2 > than error checking should be added using $_FILES['']['error'] */ /* ** Check to see if file exists */ $fileNum = 1; $ext = substr($fileName, strlen($fileName)-4,4); $base = substr($fileName,0,strlen($fileName)-4); while(file_exists($dir . $fileName)) { $fileName = $base . "(" . $fileNum . ")" . $ext; $fileNum++; } //update internal filename $this->_fileName = $fileName; /* ** FILE UPLOAD ERROR CHECKING */ if($fileName == "" || $tempName == "none" || $fileType == "") { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00111", "File Upload Failed", CCMS_ERR_T_INP, CCMS_ERR_M_HARD)); }else if(is_array($this->_fileExtensions) && sizeof($this->_fileExtensions)>0){ //extension based file type checking if(!in_array(substr($ext,1),$this->_fileExtensions)){ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00111", strtoupper($ext) . " Files Are Not Allowed", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } }else if(is_array($this->_mimeTypes) && sizeof($this->_mimeTypes)>0){ //mime based file type checking if (!in_array($fileType,$this->_mimeTypes)) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00111", "Files Of Type " . strtoupper($fileType) . " Are Not Allowed", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } } if(!$errors){ $this->_fileUploaded = true; } } } /** * Returns the SQL value of the data * * This function will return the value of the data with any conversions necessary so that the data can be inserted into an SQL-style database (such as addslashes) * The data value of this class instance should always be un-escaped data (slashes are striped at input if necessary). * * @return CCMS_File a CCMS_File containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_File, and error type * @see CCMS_File::setValue, IO::process * * @access public * @since Method available since Release 1.0.0 */ function getSqlValue() { //in here we want to return the existing value //this->_value should always contain un-escaped data return addslashes($this->_value); } /** * Returns the value (human-readable) of the data * * This function will return the value of the data in its human readable / manageable form. * * @return CCMS_File a CCMS_File containing the value element ready to be printed / displayed * @throws CCMS_Error contains information about the error such as error number, error CCMS_File, and error type * * @access public * @since Method available since Release 1.0.0 */ function getValue() { //returns the text (human readable) value for this object return $this->_value; } /** * Sets the value of the data * * This function sets the value of the data * * @return CCMS_String a CCMS_String containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * @see CCMS_String::setValue * * @access public * @since Method available since Release 1.0.0 */ function setValue($val) { if(strlen($val) > 0 && file_exists($this->_fileDir . $val)){ $this->_value = $val; return true; } return false; } /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_File, and error type * @see CCMS_File::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { if (($this->_options["required"]) && ((!isset($this->_fileName)) || (strlen($this->_fileName) == 0))){ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00101", $this->_label . " is required", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } //check options $errors = 0; if(sizeof($this->_arrError) > 0) $errors = 1; if ($errors) { return false; } else { return true; } } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_Integer.php0100644000000000000000000002112010220060046020512 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_Integer */ /** * Require CCMS_Data_Type class * */ require_once 'Data_Types/CCMS_Data_Type.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_Integer' CCMS_Data_Type * * The CCMS_Integer CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_Integer extends CCMS_Data_Type{ /** * Returns the HTML form field needed to get a CCMS_Integer from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_Integer $elementId the id/name attribute for the HTML element * @return CCMS_Integer a CCMS_Integer containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_Integer, and error type * * @access public * @since Method available since Release 1.0.0 */ function getFormElement($elementId) { //returns html form fields (no tables) required to add / edit this CCMS_Data_Type $opt = ""; $opt .= (isset($this->_options["cssClass"])) ? " class=\"" . $this->_options["cssClass"] . "\" " : "class=\"CCMS_INPUT\""; $opt .= (isset($this->_options["maxValue"])) ? " maxlength=\"" . strlen($this->_options["maxValue"]) . "\" " : ""; $opt .= (isset($this->_options["size"])) ? " size=\"" . $this->_options["size"] . "\" " : ""; $ret = "_value . "\" " . $opt . ">"; //save the form id to the instace of this class $this->id = $elementId; return $ret; } /** * Returns the SQL value of the data * * This function will return the value of the data with any conversions necessary so that the data can be inserted into an SQL-style database (such as addslashes) * The data value of this class instance should always be un-escaped data (slashes are striped at input if necessary). * * @return CCMS_Integer a CCMS_Integer containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_Integer, and error type * @see CCMS_Integer::setValue, IO::process * * @access public * @since Method available since Release 1.0.0 */ function getSqlValue() { //this->_value should always contain un-escaped data return addslashes($this->_value); } /** * Returns the value (human-readable) of the data * * This function will return the value of the data in its human readable / manageable form. * * @return CCMS_Integer a CCMS_Integer containing the value element ready to be printed / displayed * @throws CCMS_Error contains information about the error such as error number, error CCMS_Integer, and error type * * @access public * @since Method available since Release 1.0.0 */ function getValue() { //returns the text (human readable) value for this object return ($this->_value); } /** * Sets the value of the data * * This function sets the value of the data * * @return CCMS_Integer a CCMS_Integer containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_Integer, and error type * @see CCMS_Integer::setValue * * @access public * @since Method available since Release 1.0.0 */ function setValue($val) { //need error checking here $this->_value = $val; return true; } /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_Integer, and error type * @see CCMS_Integer::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { //check options $errors = 0; if (($this->_options["required"]) && ((!isset($this->_value)) || (strlen($this->_value) == 0))){ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00101", "Required field (Cannot be left blank)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["maxValue"])) && (intval($this->_value) > $this->_options["maxValue"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00104", "Maximum Value Exceeded (" . $this->_options["maxValue"] . " Max)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["minValue"])) && (intval($this->_value) < $this->_options["minValue"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00105", "Minimum Length Not Met (Must be atleast " . $this->_options["minValue"] . ")", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if (intval($this->_value) != $this->_value) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00106", "Must Be an Integer Value", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ($errors) { return false; } else { return true; } } /** * Returns an error (if any) from the internal Error stack * * This function shifts a CCMS_Error object off the internal Error array and returns it * * @return CCMS_Error returns a CCMS_Error object, if no Error objects are on the internal error stack, the function returns false * @throws CCMS_Error contains information about the error such as error number, error CCMS_Integer, and error type * @see CCMS_Error * * @access public * @since Method available since Release 1.0.0 */ function getError() { if (sizeof($this->_arrError) > 0) { return array_shift($this->_arrError); } else { return false; } } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_Linked_Table.php0100644000000000000000000003261010220051124021435 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_Linked_Table */ /** * Require Data_Type class * */ require_once 'Data_Types/CCMS_Data_Type.php'; require_once 'IO/IO.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; $GLOBALS['_CCMS_CHOOSER_DATA']; $GLOBALS['_CCMS_LINKD_TABLE_RES']; /** * Defines the 'CCMS_Linked_Table' CCMS_Data_Type * * The CCMS_Linked_Table CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_Linked_Table extends CCMS_Data_Type{ /** * Returns the HTML form field needed to get a CCMS_Linked_Table from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_Linked_Table $elementId the id/name attribute for the HTML element * @return CCMS_Linked_Table a CCMS_Linked_Table containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_Linked_Table, and error type * * @access public * @since Method available since Release 1.0.0 */ //this datatype requires GPC access var $_id; //the word has been preset //an object of the linked table type var $_linkedDataObject; //the name of the linked table var $_linkedTable; //the dsn of the linked table var $_dsn; //the linked field containing the translated (ie text) value of the data var $_linkedValueField; var $_linkedIndexField; //the type of thel inked object var $_linkedDataType; var $_defTable; //io object for linked table var $_io; var $_linkedPid; //url for content chooser var $_chooserUrl; function CCMS_Linked_Table($options = Array()) { //////POTENTIAL OPTIONS for field input // form field = create new (always) // form field = create new (if not exists) // form field = load existing from other table (chooser) ///////////////////////// //table and valuefield options are required if(isset($options["linkedtable"]) && isset($options["linkedindexfield"]) && isset($options["dsn"])) { //create IO object for linked table $this->_options = $options; $this->_arrError = Array(); $this->_linkedTable = $options["linkedtable"]; $this->_dsn = $options["dsn"]; $this->_linkedIndexField = $options["linkedindexfield"]; //need to set session data globally if (!isset($GLOBALS['_CCMS_CHOOSER_DATA'])) { $GLOBALS['_CCMS_CHOOSER_DATA'] = $_SESSION['_ccms_chooser']; } if (isset($options["chooserurl"])) { $this->_chooserUrl = $options["chooserurl"]; } else { $this->_chooserUrl = "ccms.chooser.php"; } if (isset($options["chooserurllabel"])) { $this->_chooserUrlLabel = $options["chooserurllabel"]; } else { $this->_chooserUrlLabel = "Choose"; } if (isset($options["linkedvaluefield"])) { $this->_linkedValueField = $options["linkedvaluefield"]; } else { $this->_linkedValueField = $options["linkedindexfield"]; } if (!isset($options["tabledefs"])) { $this->_defTable = "TABLE_DEFS"; } else { $this->_defTable = $options["tabledefs"]; } $this->_io = new IO($this->_dsn, $this->_linkedTable, $this->_defTable); //load the parameters for the linked data and create and object that points to it $db =& DB::connect($this->_dsn); if (DB::isError($db)) { die($db->getMessage()); } $sql = "SELECT * from " . $this->_defTable . " where sTable='" . $this->_linkedTable . "' and sField='" . $this->_linkedValueField . "' LIMIT 1"; $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } if ($res->numRows() > 0) { $row =& $res->fetchRow(DB_FETCHMODE_ASSOC); $this->_linkedDataType = $row["sClass"]; eval("\$this->_linkedDataObject = new " . $this->_linkedDataType . "(array(" . $row['aArgs'] . "));"); if (is_object($this->_linkedDataObject)) { $this->_linkedDataObject->setLabel($row["sLabel"]); $res->free(); return true; } } $res->free(); return false; } else { return false; } } //reset() will be called before any call to 'new' if ?RES is specified in the url function reset(){ if(!($GLOBALS['_CCMS_LINKD_TABLE_RES'])){ $GLOBALS['_CCMS_CHOOSER_DATA'] = array(); $_SESSION['_ccms_chooser'] = array(); $GLOBALS['_CCMS_LINKD_TABLE_RES'] = true; } } function setValue($val) { //backup the current value (it will be restored upon any validation errors) if (is_object($this->_linkedDataObject)) { //load the value of the object if it is set $db =& DB::connect($this->_dsn); if (DB::isError($db)) { die($db->getMessage()); } $sql = "SELECT * from " . $this->_linkedTable . " WHERE " . $this->_linkedIndexField . "='" . addslashes($val) . "' LIMIT 1"; $res =& $db->query($sql); if ($res->numRows() > 0) { $row =& $res->fetchRow(DB_FETCHMODE_ASSOC); if (isset($row[$this->_linkedValueField])) { $this->_linkedDataObject->setValue($row[$this->_linkedValueField]); } } $res->free(); } //for a linked table only set the value if there is a string if(strlen($val) > 0) { $this->_value = $val; } return true; } function getValue(){ $ret = $this->_io->HTMLview($this->_value, null,array("formButtons"=>"NONE", "formContainer"=>false)); return $ret; } function getValuePreview(){ if (is_object($this->_linkedDataObject)) { return $this->_linkedDataObject->getValue(); } else { return $this->_value; } } /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_Linked_Table, and error type * @see CCMS_Linked_Table::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { //check options $errors = 0; if (($this->_options["required"]) && ( !isset($this->_value) ) ){ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00101", $this->_label . " is required", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ($errors) { return false; } else { return true; } //any errors will be picked up by respectiive liked classes return true; } function getFormElement($elementId) { $this->_id = $elementId; if($this->_options["usechooser"]){ //see if we just came back from a chooser $_ccms_chooser = $GLOBALS['_CCMS_CHOOSER_DATA']; if(isset($_REQUEST['cid']) && isset($_REQUEST['cid']) && isset($_REQUEST['cvalue']) && urldecode($_REQUEST['cid']) == $elementId) { $this->setValue($_REQUEST['cvalue']); } else if (isset($_ccms_chooser[$elementId])) { //load value from session / global $this->setValue($_ccms_chooser[$elementId]['currentvalue']); } $_ccms_chooser[$elementId]['url'] = urlencode($this->_chooserUrl); $_ccms_chooser[$elementId]['return'] = urlencode($_SERVER["PHP_SELF"] . "?" . preg_replace("/^RES/","", $_SERVER["QUERY_STRING"])); $_ccms_chooser[$elementId]['table'] = urlencode($this->_linkedTable); $_ccms_chooser[$elementId]['dsn'] = urlencode($this->_dsn); $_ccms_chooser[$elementId]['currentvalue'] = $this->_value; $_ccms_chooser[$elementId]['action'] = urlencode("CCMS_ACT_CH_SINGLE"); //need to save globally so that other class instances get added to the same sesison data (otherwise values are lost becuse $_SESSION only gets read on page load) $GLOBALS['_CCMS_CHOOSER_DATA'] = $_ccms_chooser; //save value to session $_SESSION['_ccms_chooser'] = $_ccms_chooser; $urllabel = $this->_chooserUrlLabel; $ccms_chooser_url .= $this->_chooserUrl; $ccms_chooser_url .= strpos($ccms_chooser_url, '?') !== false ? "&" : "?"; $ccms_chooser_url .= "cid=" . urlencode($elementId); $ret = $this->getValuePreview() . "  " . htmlspecialchars($urllabel) . ""; } else if(isset($this->_options["useselect"])) { $ret = ""; } else { //load the field name out of the element id $field = substr($this->_id, strrpos($this->_id, ":")+1, -1); if (strlen($field) == 0) { $field = $this->_id; } $this->_linkedPid = "_LINKED_PID_" . $this->_linkedTable . "_" . $field; $ret = $this->_io->HTMLinput($this->_value,$this->_linkedPid,array("formButtons"=>"NONE", "formContainer"=>false)); } return $ret; } function getSqlValue() { //set value to the msyql_insert_id() if(!($this->_value) && isset($this->_linkedPid)){ return "''%%%ID:" . $this->_linkedPid . "%%%''"; } //this->_value should always contain un-escaped data return addslashes($this->_value); } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_Password.php0100644000000000000000000001544210220060047020732 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_Password */ /** * Require CCMS_Data_Type class * */ require_once 'Data_Types/CCMS_String.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_Password' CCMS_Data_Type * * The CCMS_Password CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_Password extends CCMS_String{ /** * Returns the HTML form field needed to get a CCMS_Password from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_Password $elementId the id/name attribute for the HTML element * @return CCMS_Password a CCMS_Password containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_Password, and error type * * @access public * @since Method available since Release 1.0.0 */ var $_confirmId; var $_currentValue; //this datatype requires GPC access var $_id; //the word has been preset function setValue($val) { //backup the current value (it will be restored upon any validation errors) if(!isset($this->_currentValue)) { $this->_currentValue = $this->_value; } $this->_value = $val; return true; } /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_Password, and error type * @see CCMS_Password::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { //check options $errors = 0; //make a password required by setting a minimum length if ((isset($this->_options["maxLength"])) && (strlen($this->_value) > $this->_options["maxLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00102", "Maximum Length Exceeded (" . $this->_options["maxLength"] . " Characters Max)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["minLength"])) && (strlen($this->_value) < $this->_options["minLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00103", "Minimum Length Not Met (Must be atleast " . $this->_options["minLength"] . " Characters)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if (isset($this->_confirmId)){ if (get_magic_quotes_gpc()) { $confirmValue = stripslashes($_REQUEST[$this->_confirmId]); } else { $confirmValue = $_REQUEST[$this->_confirmId]; } } if ( (isset($this->_value)) && ($this->_value != $confirmValue)) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00106", "Passwords Do Not Match", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ($errors) { //if there are numbers restore the previous value if(isset($this->_currentValue)) $this->_value = $this->_currentValue; return false; } else { return true; } } function getFormElement($elementId) { $ret = array(); //returns html form fields (no tables) required to add / edit this CCMS_Data_Type $opt = ""; $opt .= (isset($this->_options["cssClass"])) ? " class=\"" . $this->_options["cssClass"] . "\" " : "class=\"CCMS_INPUT\""; $opt .= (isset($this->_options["maxLength"])) ? " asdf=\"" . $this->_options["maxLength"] . "\" " : ""; $opt .= (isset($this->_options["size"])) ? " size=\"" . $this->_options["size"] . "\" " : ""; $ret["Password"] = "_value . "\" " . $opt . ">"; $ret["Confirm Password"] = "_value . "\" " . $opt . ">"; //save the form id to the instace of this class $this->_id = $elementId; $this->_confirmId = $elementId . ":CONFIRM"; return $ret; } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_String.php0100644000000000000000000001704110222146151020376 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_String */ /** * Require CCMS_Data_Type class * */ require_once 'CCMS_Data_Type.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_String' CCMS_Data_Type * * The CCMS_String CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_String extends CCMS_Data_Type{ /** * Returns the HTML form field needed to get a CCMS_String from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_String $elementId the id/name attribute for the HTML element * @return CCMS_String a CCMS_String containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * * @access public * @since Method available since Release 1.0.0 */ function getFormElement($elementId) { //returns html form fields (no tables) required to add / edit this CCMS_Data_Type $opt = ""; $opt .= (isset($this->_options["cssClass"])) ? " class=\"" . $this->_options["cssClass"] . "\" " : "class=\"CCMS_INPUT\""; $opt .= (isset($this->_options["maxLength"])) ? " asdf=\"" . $this->_options["maxLength"] . "\" " : ""; $opt .= (isset($this->_options["size"])) ? " size=\"" . $this->_options["size"] . "\" " : ""; $ret = "_value) . "\" " . $opt . ">"; //save the form id to the instace of this class $this->_id = $elementId; return $ret; } /** * Returns the SQL value of the data * * This function will return the value of the data with any conversions necessary so that the data can be inserted into an SQL-style database (such as addslashes) * The data value of this class instance should always be un-escaped data (slashes are striped at input if necessary). * * @return CCMS_String a CCMS_String containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * @see CCMS_String::setValue, IO::process * * @access public * @since Method available since Release 1.0.0 */ function getSqlValue() { //this->_value should always contain un-escaped data return addslashes($this->_value); } /** * Returns the value (human-readable) of the data * * This function will return the value of the data in its human readable / manageable form. * * @return CCMS_String a CCMS_String containing the value element ready to be printed / displayed * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * * @access public * @since Method available since Release 1.0.0 */ function getValue() { //returns the text (human readable) value for this object return $this->_value; } /** * Sets the value of the data * * This function sets the value of the data * * @return CCMS_String a CCMS_String containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * @see CCMS_String::setValue * * @access public * @since Method available since Release 1.0.0 */ function setValue($val) { $this->_value = $val; return true; } /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * @see CCMS_String::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { //check options $errors = 0; if (($this->_options["required"]) && ((!isset($this->_value)) || (strlen($this->_value) == 0))){ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00101", $this->_label . " is required", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["maxLength"])) && (strlen($this->_value) > $this->_options["maxLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00102", "Maximum Length Exceeded (" . $this->_options["maxLength"] . " Characters Max)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["minLength"])) && (strlen($this->_value) < $this->_options["minLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00103", "Minimum Length Not Met (Must be atleast " . $this->_options["minLength"] . " Characters)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ($errors) { return false; } else { return true; } } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_Table_Pointer.php0100644000000000000000000002430010220051126021646 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_Table_Pointer */ /** * Require Data_Type class * */ require_once 'Data_Types/CCMS_Data_Type.php'; require_once 'IO/IO.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_Table_Pointer' CCMS_Data_Type * * The CCMS_Table_Pointer CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_Table_Pointer extends CCMS_Data_Type{ /** * Returns the HTML form field needed to get a CCMS_Table_Pointer from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_Table_Pointer $elementId the id/name attribute for the HTML element * @return CCMS_Table_Pointer a CCMS_Table_Pointer containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_Table_Pointer, and error type * * @access public * @since Method available since Release 1.0.0 */ //this datatype requires GPC access var $_id; //the word has been preset //an object of the linked table type var $_linkedDataObject; //an object of the local field we are linking type, with value var $_linkedDataObject; //the name of the linked table var $_linkedTable; //the dsn of the linked table var $_dsn; //the linked field containing the translated (ie text) value of the data var $_linkedValueField; var $_linkedIndexField; var $_linkedLocalField; //the type of thel inked object var $_linkedDataType; var $_defTable; //io object for linked table var $_io; var $_linkedPid; //url for content chooser var $_chooserUrl; function CCMS_Table_Pointer($options = Array(), $defs = Array()) { //////POTENTIAL OPTIONS for field input // form field = create new (always) // form field = create new (if not exists) // form field = load existing from other table (chooser) ///////////////////////// //table and valuefield options are required if(isset($options["linkedtable"]) && isset($options["linkedindexfield"]) && isset($options["dsn"])) { //create IO object for linked table $this->_options = $options; $this->_arrError = Array(); $this->_linkedTable = $options["linkedtable"]; $this->_dsn = $options["dsn"]; $this->_linkedIndexField = $options["linkedindexfield"]; $this->_linkedLocalField = $options["linkedlocalfield"]; if (isset($options["chooserurl"])) { $this->_chooserUrl = $options["chooserurl"]; } else { $this->_chooserUrl = "ccms.chooser.php"; } if (isset($options["chooserurllabel"])) { $this->_chooserUrlLabel = $options["chooserurllabel"]; } else { $this->_chooserUrlLabel = "Choose"; } if (isset($options["linkedvaluefield"])) { $this->_linkedValueField = $options["linkedvaluefield"]; } else { $this->_linkedValueField = $options["linkedindexfield"]; } if (!isset($options["tabledefs"])) { $this->_defTable = "TABLE_DEFS"; } else { $this->_defTable = $options["tabledefs"]; } if (isset($options["linkedlocalfield"])) { $this->_linkedLocalField = $options["linkedlocalfield"]; } else { //this should change to be the local index field $this->_linkedLocalField = "id"; } $this->_io = new IO($this->_dsn, $this->_linkedTable, $this->_defTable, $GLOBALS['_CCMS_VIEW_FIELDS'], $GLOBALS['_CCMS_EDIT_FIELDS']); //load the parameters for the linked data and create and object that points to it $db =& DB::connect($this->_dsn); if (DB::isError($db)) { die($db->getMessage()); } $sql = "SELECT * from " . $this->_defTable . " where sTable='" . $this->_linkedTable . "' and sField='" . $this->_linkedValueField . "' LIMIT 1"; $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } if ($res->numRows() > 0) { $row =& $res->fetchRow(DB_FETCHMODE_ASSOC); $this->_linkedDataType = $row["sClass"]; eval("\$this->_linkedDataObject = new " . $this->_linkedDataType . "(array(" . $row['aArgs'] . "));"); if (is_object($this->_linkedDataObject)) { $this->_linkedDataObject->setLabel($row["sLabel"]); $res->free(); return true; } } $res->free(); return false; } else { return false; } } function setValue($val = null) { //backup the current value (it will be restored upon any validation errors) //for a linked table only set the value if there is a string if(strlen($val) > 0) { $this->_value = $val; } return true; } function getValue(){ $ret = ""; //load the value of the object if it is set if (is_object($this->_linkedDataObject)) { $db =& DB::connect($this->_dsn); if (DB::isError($db)) { die($db->getMessage()); } $sql = "SELECT * from " . $this->_linkedTable . " WHERE " . $this->_linkedIndexField . "='" . addslashes($this->_value) . "'"; $res =& $db->query($sql); if ($res->numRows() > 0) { while($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) { if (isset($row[$this->_linkedValueField])) { $this->_linkedDataObject->setValue($row[$this->_linkedValueField]); $ret .= $this->_linkedDataObject->getValue() . ", "; } } } $res->free(); } if(strlen($ret) > 2) { $ret = substr($ret,0,-2); } return $ret; } /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_Table_Pointer, and error type * @see CCMS_Table_Pointer::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { //check options $errors = 0; //any errors will be picked up by respectiive liked classes return true; } function getFormElement($elementId) { $this->_id = $elementId; $ret = $this->getValue(); return $ret; } function getSqlValue() { //set value to the msyql_insert_id() if(!($this->_value) && isset($this->_linkedPid)){ return "''%%%ID:" . $this->_linkedPid . "%%%''"; } //this->_value should always contain un-escaped data return addslashes($this->_value); } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_Text.php0100644000000000000000000000624510220060051020050 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_Text */ /** * Require CCMS_Data_Type class * */ require_once 'Data_Types/CCMS_Data_Type.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_Text' CCMS_Data_Type * * The CCMS_Text CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_Text extends CCMS_String{ /** * Returns the HTML form field needed to get a CCMS_String from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_String $elementId the id/name attribute for the HTML element * @return CCMS_String a CCMS_String containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * * @access public * @since Method available since Release 1.0.0 */ function getFormElement($elementId) { //returns html form fields (no tables) required to add / edit this CCMS_Data_Type $opt = ""; $opt .= (isset($this->_options["cssClass"])) ? " class=\"" . $this->_options["cssClass"] . "\" " : "class=\"CCMS_TEXTAREA\""; $opt .= (isset($this->_options["rows"])) ? " rows=\"" . $this->_options["rows"] . "\" " : ""; $opt .= (isset($this->_options["cols"])) ? " cols=\"" . $this->_options["cols"] . "\" " : ""; $ret = "\n"; $this->_id = $elementId; return $ret; } } ?>usr/share/pear/CCMS-DEV/Data_Types/CCMS_Serialized_Class.php0100644000000000000000000002172410226750541022363 0ustar rootroot * @copyright 2005 Neil Sotirakopoulos * @version 1.0.0 * @see CCMS_Data_Type, CCMS_Serialized_Class */ /** * Require CCMS_Data_Type class * */ require_once 'CCMS_Data_Type.php'; /** * Require Error class * */ require_once 'Error/CCMS_Error.php'; /** * Defines the 'CCMS_Serialized_Class' CCMS_Data_Type * * The CCMS_Serialized_Class CCMS_Data_Type extension is part of a series of CCMS_Data_Type classes used * by the Circus Content Management System. This CCMS_Data_Type defines validation rules * for data, computes and translates between SQL storage values and human readable * data values, and generates html form fields needed to import / edit this CCMS_Data_Type. * * LICENSE: This source file is the intellectual property of Neil Sotirakopoulos and * has been created for use by Circus Media, LLC. Any other use / modifcation is * strictly prohibited. Future versions will probably released under the GNU Lesser * General Public License public (LGPL) * * @category Content Management * @package CCMS * @author Neil Sotirakopoulos * @copyright 2005 * @version 1.0.0 * @see CCMS_Data_Type * @since Class available since Release 1.0.0 */ class CCMS_Serialized_Class extends CCMS_Data_Type{ var $_object; /** * Constructor for a CCMS_Data_Type object * * @param mixed $value the value to be stored / manipulated * @param array $options an array of the options (mainly used in output) for this data type * * @return int returns true on success * @throws CCMS_Error CCMS_Error contains information about the error such as error number, error CCMS_String, and error type * * @access public * @static * @since Method available since Release 1.0.0 */ function CCMS_Serialized_Class($options = Array(), $defs = Array()) { $this->_defs = $defs; $this->_options = $options; $this->_arrError = Array(); if(!class_exists($this->_options['classname']) && isset($this->_options['classfile'])){ include_once ($this->_options['classfile']); } return true; } /** * Returns the HTML form field needed to get a CCMS_Serialized_Class from user input * * This function will only return the HTML input/select/textarea tag with no table structure or formatting included * * @param CCMS_Serialized_Class $elementId the id/name attribute for the HTML element * @return CCMS_Serialized_Class a CCMS_Serialized_Class containing the HTML code for the form element * @throws CCMS_Error contains information about the error such as error number, error CCMS_Serialized_Class, and error type * * @access public * @since Method available since Release 1.0.0 */ function getFormElement($elementId) { //there is currnetly no support for editing a seriliazed object, so just display the value $ret = false; if(is_object($this->_object)){ eval("\$ret = \$this->_object->" . $this->_options['displaymethod'] . ";"); } return nl2br($ret); } /** * Returns the SQL value of the data * * This function will return the value of the data with any conversions necessary so that the data can be inserted into an SQL-style database (such as addslashes) * The data value of this class instance should always be un-escaped data (slashes are striped at input if necessary). * * @return CCMS_Serialized_Class a CCMS_Serialized_Class containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_Serialized_Class, and error type * @see CCMS_Serialized_Class::setValue, IO::process * * @access public * @since Method available since Release 1.0.0 */ function getSqlValue() { //this->_value should always contain un-escaped data return addslashes($this->_value); } /** * Returns the value (human-readable) of the data * * This function will return the value of the data in its human readable / manageable form. * * @return CCMS_Serialized_Class a CCMS_Serialized_Class containing the value element ready to be printed / displayed * @throws CCMS_Error contains information about the error such as error number, error CCMS_Serialized_Class, and error type * * @access public * @since Method available since Release 1.0.0 */ function getValue() { //returns the text (human readable) value for this object $ret = false; if(is_object($this->_object)){ eval("\$ret = \$this->_object->" . $this->_options['displaymethod'] . ";"); } if(strip_tags($ret) == $ret){ $ret = nl2br($ret); } return $ret; } function getValuePreview() { //returns the text (human readable) value for this object $ret = false; if(is_object($this->_object)){ eval("\$ret = \$this->_object->" . $this->_options['previewmethod'] . ";"); } return $ret; } /** * Sets the value of the data * * This function sets the value of the data * * @return CCMS_Serialized_Class a CCMS_Serialized_Class containing the value element ready to be inserted into a database * @throws CCMS_Error contains information about the error such as error number, error CCMS_Serialized_Class, and error type * @see CCMS_Serialized_Class::setValue * * @access public * @since Method available since Release 1.0.0 */ function setValue($val) { $this->_value = $val; $this->_object = @unserialize($this->_value); if (!is_object($this->_object)) { $this->_object = null; } return true; } /** * This function checks the data for errors * * This function checks the data for errors (most commonly used when the data is inputed by the user, but can be used on generated data also) * Any special conditions of the data type should be check by this function (such as length, special characters, requirements, etc) * * @param mixed $val the data passed to this function should already have any add/strip slashes performed (this should be done to the GPC data at input / processing time) * @return bool returns true on sucess or false on failure. On a failure a CCMS error object is added to the internal error stack * @throws CCMS_Error contains information about the error such as error number, error CCMS_Serialized_Class, and error type * @see CCMS_Serialized_Class::getValue * * @access public * @since Method available since Release 1.0.0 */ function validate() { //check options $errors = 0; if (($this->_options["required"]) && ((!isset($this->_value)) || (strlen($this->_value) == 0))){ $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00101", $this->_label . " is required", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["maxLength"])) && (strlen($this->_value) > $this->_options["maxLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00102", "Maximum Length Exceeded (" . $this->_options["maxLength"] . " Characters Max)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ((isset($this->_options["minLength"])) && (strlen($this->_value) < $this->_options["minLength"])) { $errors = 1; //push error onto error stack array_push($this->_arrError, new CCMS_Error("00103", "Minimum Length Not Met (Must be atleast " . $this->_options["minLength"] . " Characters)", CCMS_ERR_T_INP, CCMS_ERR_M_SOFT)); } if ($errors) { return false; } else { return true; } } } ?>usr/share/pear/CCMS-DEV/Decorators/0040755000000000000000000000000010236227675015702 5ustar rootrootusr/share/pear/CCMS-DEV/Decorators/CCMS_Decorator_Control_Standard.php0100644000000000000000000001376510220060052024444 0ustar rootroot_cssSheets = array(); $this->_defCssPath = ""; $this->_messages = array(); $this->_pageHeader = ""; } function addMessage($text, $class = "_CCMS_MSG"){ $msg = array("text"=>"$text", "class"=>"$class"); array_push($this->_messages, $msg); return true; } function setPageHeader($text){ $this->_pageHeader = $text; return true; } function getPageHeader(){ return $this->_pageHeader; } function addDataTableObject($dataTable){ $this->_data = $dataTable; } function addStyleSheet($sheet){ if(file_exists($sheet)){ array_push($this->_cssSheets, $sheet); return true; } return false; } function setCssPath($path){ $this->_defCssPath = $path; } function setContentHeader($text){ $this->_contentHeader = $text; } function _htmlHead(){ $ret = ""; $ret .= "\n"; $ret .= "\n"; $ret .= "_defCssPath . "Control_Standard.css\" rel=\"stylesheet\" type=\"text/css\">\n"; foreach($this->_cssSheets as $k => $sheet){ $ret .= "\n"; } $ret .= "\n"; $ret .= "\n"; return $ret; } function buildHtml($options = array()){ $nowrap = ( isset($options["nowrap"]) && $options["nowrap"]) ? "nowrap" : ""; $output = $this->_htmlHead(); $output .= "\n"; if (strlen($this->getPageHeader()) > 0) { $output .= "
\n"; $output .= $this->getPageHeader(); $output .= "
\n"; } $output .= "
\n"; if (strlen($this->_contentHeader) > 0) { $output .= "
\n"; $output .= strtoupper($this->_contentHeader); $output .= "
\n"; } //print messages / errors / info if (sizeof($this->_messages) > 0) { foreach($this->_messages as $msg){ $output .= "
" . $msg["text"] . "
\n"; } } //quick parser for DataTable (this will become ViewHTMLedit class or something like that) //print data container footer while($headerObj = $this->_data->getHeader()){ if (is_object($headerObj)) { $output .= $headerObj->getValue() . "\n"; } } $output .= "\n"; //print data column headers if ($options["columnLabels"]){ $output .= "\n"; for($i = 0; $i < $this->_data->numCols(); $i++){ $value = $this->_data->getColumnHeader(); if (strlen($value) == 0 && $options["emptySpaces"]) { $value = " "; } $output .= "\n"; } $output .= "\n"; } $bgColorIndex = 0; while($dataGrp = $this->_data->getRow()){ //see if we should use background colors (alternating) $style = ""; if ($options["bgColor1"] || $options["bgColor2"]) { if ($bgColorIndex) { $style .= "background-color: " . $options["bgColor1"]; } else { $style .= "background-color: " . $options["bgColor2"]; } } $style = "style=\"" . $style . "\""; $output .= "\n"; if ($options["rowLabels"]) { if(substr($dataGrp->getLabel(),0,5) != "_CCMS") { $output .= "\n"; } } while($dataObj = $dataGrp->getData()){ $value = $dataObj->getValue(); $nw = $nowrap; if (strlen($value) == 0 && $options["emptySpaces"]) { $value = " "; } if($dataGrp->getLabel() == "_CCMS_HEADING") { $output .= "\n"; } else { $output .= "\n"; } } $output .= "\n"; $bgColorIndex = !$bgColorIndex; } $output .= "
" . $value . "
" . $dataGrp->getLabel() . "_data->numCols() . "\" class=\"CCMS_DATA_BLOCK_HEADER\" " . $style . " " . $nw . ">" . $value . "" . $value . "
\n"; //print data container footer while($footerObj = $this->_data->getFooter()){ $output .= $footerObj->getValue() . "\n"; } $output .= "
\n"; $output .= "\n"; $output .= "\n"; return $output; } } ?>usr/share/pear/CCMS-DEV/Decorators/CCMS_Decorator_Standard.php0100644000000000000000000001612310236227675022762 0ustar rootroot_cssSheets = array(); $this->_defCssPath = ""; $this->_messages = array(); $this->_pageHeader = ""; $this->_rowHeaders = array(); } function addMessage($text, $class = "_CCMS_MSG"){ $msg = array("text"=>"$text", "class"=>"$class"); array_push($this->_messages, $msg); return true; } function addRowHeader($value, $label){ $this->_rowHeaders[md5($label)] = $value; } function setPageHeader($text){ $this->_pageHeader = $text; return true; } function getPageHeader(){ return $this->_pageHeader; } function addDataTableObject($dataTable){ $this->_data = $dataTable; } function addStyleSheet($sheet){ if(file_exists($sheet)){ array_push($this->_cssSheets, $sheet); return true; } return false; } function setCssPath($path){ $this->_defCssPath = $path; } function setContentHeader($text){ $this->_contentHeader = $text; } function _htmlHead(){ $ret = ""; $ret .= "\n"; $ret .= "\n"; $ret .= "_defCssPath . "Control_Standard.css\" rel=\"stylesheet\" type=\"text/css\">\n"; foreach($this->_cssSheets as $k => $sheet){ $ret .= "\n"; } $ret .= "\n"; $ret .= "\n"; return $ret; } function buildHtml($options = array()){ $nowrap = ( isset($options["nowrap"]) && $options["nowrap"]) ? "nowrap" : ""; // $output = $this->_htmlHead(); // $output .= "\n"; if (strlen($this->getPageHeader()) > 0) { $output .= "
\n"; $output .= $this->getPageHeader(); $output .= "
\n"; } $output .= "
\n"; if (strlen($this->_contentHeader) > 0) { $output .= "
\n"; $output .= strtoupper($this->_contentHeader); $output .= "
\n"; } //print messages / errors / info if (sizeof($this->_messages) > 0) { foreach($this->_messages as $msg){ $output .= "
" . $msg["text"] . "
\n"; } } //quick parser for DataTable (this will become ViewHTMLedit class or something like that) //print data container footer while($headerObj = $this->_data->getHeader()){ if (is_object($headerObj)) { $output .= $headerObj->getValue() . "\n"; } } $output .= "\n"; //print data column headers if ($options["columnLabels"]){ $output .= "\n"; for($i = 0; $i < $this->_data->numCols(); $i++){ $value = $this->_data->getColumnHeader(); if (strlen($value) == 0 && $options["emptySpaces"]) { $value = " "; } $output .= "\n"; } $output .= "\n"; } $bgColorIndex = 0; while($dataGrp = $this->_data->getRow()){ // _invisible flag is a powerful and ugly hack if (isset($dataGrp->_arrData[0]->_invisible)) { continue; } //see if we should use background colors (alternating) $style = ""; if ($options["bgColor1"] || $options["bgColor2"]) { if ($bgColorIndex) { $style .= "background-color: " . $options["bgColor1"]; } else { $style .= "background-color: " . $options["bgColor2"]; } } $style = "style=\"" . $style . "\""; //see if we should print out a header row if(isset($this->_rowHeaders[md5($dataGrp->getLabel())])){ $output .= "\n\n"; } $output .= "\n"; if ($options["rowLabels"]) { if(substr($dataGrp->getLabel(),0,5) != "_CCMS") { if ($options["labelwrap"] && strlen($dataGrp->getLabel()) > $options["labelwrap"] ) { $output .= "\n\n\n"; } else { $output .= "\n"; } } } while($dataObj = $dataGrp->getData()){ $value = $dataObj->getValue(); $nw = $nowrap; if (strlen($value) == 0 && $options["emptySpaces"]) { $value = " "; } if($dataGrp->getLabel() == "_CCMS_HEADING") { $output .= "\n"; } else { $output .= "\n"; } } $output .= "\n"; $bgColorIndex = !$bgColorIndex; } $output .= "
" . $value . "
_data->numCols()+1) . "\">" . $this->_rowHeaders[md5($dataGrp->getLabel())] . "
_data->numCols()+1) . "\">" . $dataGrp->getLabel() . $options['labeltermination'] . "
 " . $dataGrp->getLabel() . $options['labeltermination'] . "_data->numCols() . "\" class=\"CCMS_DATA_BLOCK_HEADER\" " . $style . " " . $nw . ">" . $value . "" . $value . "
\n"; //print data container footer while($footerObj = $this->_data->getFooter()){ $output .= $footerObj->getValue() . "\n"; } $output .= "
\n"; // $output .= "\n"; // $output .= "\n"; return $output; } } ?> usr/share/pear/CCMS-DEV/Data_Types.inc.php0100644000000000000000000000105310225511340017066 0ustar rootrootusr/share/pear/CCMS-DEV/Error/0040755000000000000000000000000010220047430014644 5ustar rootrootusr/share/pear/CCMS-DEV/Error/CCMS_Error.php0100644000000000000000000000123510220047430017251 0ustar rootroottype = $type; $this->scope = $scope; $this->errno = $errno; $this->errstr = $errstr; } } ?>usr/share/pear/CCMS-DEV/IO/0040755000000000000000000000000010254320746014075 5ustar rootrootusr/share/pear/CCMS-DEV/IO/DataGroup.php0100644000000000000000000000305510226524175016475 0ustar rootroot_arrData = Array(); $this->_data = 0; $this->_label = $label; } function length(){ //returns the number of DataObjects in the group if(is_array($this->_arrData)) return sizeof($this->_arrData); else return 0; } function getLabel(){ if(isset($this->_label)) return $this->_label; else return ""; } function setLabel($label){ $this->_label = $label; } function add($value, $type = null, $class = null, $required = false){ //on success returns the size of the group $data = new DataObject($value, $type, $class, $required); if(array_push($this->_arrData, $data)) return sizeof($this->_arrData); else return 0; } function getData(){ //returns the current data object and moves the pointer forward if(sizeof($this->_arrData) > $this->_data && $this->_data >= 0){ $ret = $this->_arrData[$this->_data]; $this->_data++; return $ret; }else return 0; } function resetData(){ //reset header pointer to 0 $this->_data = 0; } } ?>usr/share/pear/CCMS-DEV/IO/DataObject.php0100644000000000000000000000212710226524106016600 0ustar rootroot_value = $value; $this->_type = $type; $this->_cssClass = $css; $this->_required = $required; } function getClass(){ if(!isset($this->_cssClass)){ return "_CCMS_DEFAULT_TEXT"; } else { return $this->_cssClass; } } function isRequired(){ return ($this->_required); } function getValue(){ return $this->_value; } function getType(){ return $this->_type; } function length(){ if(isset($this->_value)) return strlen($this->_value); else return 0; } } ?>usr/share/pear/CCMS-DEV/IO/DataTable.php0100644000000000000000000001110010220047431016403 0ustar rootroot_numCols = 0; $this->_columnHeaders = Array(); $this->_column = 0; $this->_tableHeaders = new DataGroup(); $this->_tableFooters = new DataGroup(); $this->_tableMessages = new DataGroup(); $this->_tableRows = Array(); $this->_row = 0; } function addRow($dataGroup){ //should do some validation on $dataGroup here! if(array_push($this->_tableRows, $dataGroup)){ if($dataGroup->length() > $this->_numCols) $this->_numCols = $dataGroup->length(); return sizeof($this->_tableRows); }else return 0; } function addFromTable($dataTable){ if (is_object($dataTable)) { while($headerObj = $dataTable->getHeader()){ if (is_object($headerObj)) { $this->addHeader($headerObj->getValue()); } } while($dataGrp = $dataTable->getRow()){ if (is_object($dataGrp)) { $this->addRow($dataGrp); } } while($footerObj = $dataTable->getFooter()){ if (is_object($footerObj)) { $this->addFooter($footerObj->getValue()); } } } } function addHeader($textVal){ return $this->_tableHeaders->add($textVal); } function addFooter($textVal){ return $this->_tableFooters->add($textVal); } function addMessage($textVal){ return $this->_tableMessages->add($textVal); } function setColumnHeaders($headers){ //need to add error checking here on input $this->_columnHeaders = $headers; } function addColumnHeader($header){ //need to add error checking here on input array_push($this->_columnHeaders, $header); } function getColumnHeader(){ //returns the current column header and moves the pointer forward if(sizeof($this->_columnHeaders) > $this->_column && $this->_column >= 0){ $ret = $this->_columnHeaders[$this->_column]; $this->_column++; return $ret; }else return ""; } function getRow(){ //returns the current column header and moves the pointer forward if(sizeof($this->_tableRows) > $this->_row && $this->_row >= 0){ $ret = $this->_tableRows[$this->_row]; $this->_row++; return $ret; }else return 0; } function getHeader(){ //returns the current column header and moves the pointer forward return $this->_tableHeaders->getData(); } function getFooter(){ //returns the current column header and moves the pointer forward return $this->_tableFooters->getData(); } function getMessage(){ return $this->_tableMessages->getData(); } function resetColumnHeader(){ //reset header pointer to 0 $this->_column = 0; } function resetMessages(){ //reset header pointer to 0 $this->_tableMessages->resetData(); } function resetHeaders(){ //reset header pointer to 0 $this->_tableHeaders->resetData(); } function resetFooters(){ //reset header pointer to 0 $this->_tableFooters->resetData(); } function numRows(){ //returns the number of rows if(is_array($this->rows)) return sizeof($this->rows); else return 0; } function numCols(){ //return the number of columns return $this->_numCols; } } ?>usr/share/pear/CCMS-DEV/IO/GPCData.php0100644000000000000000000000226410220047431016000 0ustar rootrootGPCid = $GPCid; $this->database = $database; $this->table = $table; $this->field = $field; $this->label = $label; $this->type = $type; $this->id = $id; $this->value = $value; $this->operation = $operation; $this->dataObj = $dataObj; } function validate(){ if(!$this->dataObj->validate()){ return 0; } return 1; } function getDataError(){ return $this->dataObj->getError(); } } ?>usr/share/pear/CCMS-DEV/IO/GPCDataGroup.php0100644000000000000000000000464710220047432017025 0ustar rootroot_arrGPCData = $_SESSION["_GPCDataQueue"]; }else $this->_arrGPCData = array(); $this->_index = sizeof($this->_arrGPCData); } function reset(){ //unset locallly unset($_arrGPCData); //unset in session unset($_SESSION["_GPCDataQueue"]); return 1; } function add($transId, $database, $table, $fieldName, $fieldType, $sqlProcessId = null){ $data = new GPCData($transId, $database, $table, $fieldName, $fieldType); //updates an entry in the data queue, if it doesn't exist, add it if(isset($sqlProcessId)) $this->_arrGPCData[$sqlProcessId][$transId] = $data; else $this->_arrGPCData[$this->_index][$transId] = $data; return 1; } function next(){ $this->_index++; return $this->_index; } function save(){ //need to have session checking here also to make sure sessions are enable and working $_SESSION["_GPCDataQueue"] = $this->_arrGPCData; return 1; } function deleteGPCData($sqlId, $dataId){ //delete an entry in the dataqueue based on its unique id if(isset($this->_arrGPCData[$sqlId][$dataId])){ unset($this->_arrGPCData[$sqlId][$dataId]); return 1; } return 0; } function deleteQuery($queryId){ //should probably loop through 2d array values here and unset each value... how good is php garabage collection? if(isset($this->_arrGPCData[$queryId])){ unset($this->_arrGPCData[$queryId]); return 1; } return 0; } function getGPCdata(){ if(sizeof($this->_arrGPCData) > 0){ return array_shift($this->_arrGPCData); } return 0; } } ?>usr/share/pear/CCMS-DEV/IO/GPCDataQueue.php0100644000000000000000000002347110221756376017030 0ustar rootroot_arrGPCData = array(); $this->_pointer = 0; //load existing values if they exist if(isset($name) && strlen($name) > 0){ $this->_sessionName = $name; if(isset($_SESSION[$this->_sessionName]) && is_array($_SESSION[$this->_sessionName])){ $this->_arrGPCData = $_SESSION[$this->_sessionName]; } } } //attempts to get the operation of the first item in the queue function getOperation($processId){ if (isset($this->_arrGPCData[$processId])) { $keys = array_keys($this->_arrGPCData[$processId]); if (isset($this->_arrGPCData[$processId][$keys[0]])){ return $this->_arrGPCData[$processId][$keys[0]]->operation; } } return false; } function getRowId($processId){ if (isset($this->_arrGPCData[$processId])) { $keys = array_keys($this->_arrGPCData[$processId]); if (isset($this->_arrGPCData[$processId][$keys[0]])){ return $this->_arrGPCData[$processId][$keys[0]]->id; } } return false; } function delete(){ //unset locallly unset($this->_arrGPCData); $this->_arrGPCData = array(); $this->_pointer = 0; //unset in session if(isset($this->_sessionName)) { unset($_SESSION[$this->_sessionName]); session_unregister($this->_sessionName); } return 1; } function cleanup(){ foreach($this->_arrGPCData as $k=>$v){ foreach($v as $i => $gpcData){ $gpcData->dataObj->cleanup(); } } return true; } function removeProcess($processId){ if(isset($this->_arrGPCData[$processId])){ unset($this->_arrGPCData[$processId]); return 1; } return 0; } function getValue($processId, $transId){ if (isset($this->_arrGPCData[$processId][$transId])) { return $this->_arrGPCData[$processId][$transId]; } return 0; } function getNextProcessId(){ //gets the next automatically generated index $index = 0; if(is_array($this->_arrGPCData)){ foreach(array_keys($this->_arrGPCData) as $ind => $key){ if(substr($key,0,10) == "_CCMS_PID_"){ if(intval(substr($key,10)) >= $index) { $index = substr($key,10) + 1; } } } } return "_CCMS_PID_" . $index; } function reset(){ $this->_pointer = 0; return 1; } function add($dataObj, $operation, $transId, $database, $table, $fieldName, $fieldLabel, $fieldType, $rowId, $sqlProcessId = null){ $data = new GPCData($dataObj, $operation, $transId, $database, $table, $fieldName, $fieldLabel, $fieldType, $rowId); //updates an entry in the data queue, if it doesn't exist, add it if (isset($sqlProcessId)){ $this->_arrGPCData[$sqlProcessId][$transId] = $data; } else { $this->_arrGPCData[$this->getNextIndex()][$transId] = $data; } return 1; } function add_from_object($data, $sqlProcessId = null){ //should verify that $data is a correct object here //updates an entry in the data queue, if it doesn't exist, add it if(isset($sqlProcessId)) //force associativity $this->_arrGPCData[$sqlProcessId][$data->GPCid] = $data; else $this->_arrGPCData[$this->getNextIndex()][$data->GPCid] = $data; return 1; } function save(){ //need to have session checking here also to make sure sessions are enable and working if(isset($this->_sessionName)){ eval("\$" . $this->_sessionName . " = \$this->_arrGPCData;"); eval("session_register(" . $this->_sessionName . ");"); $_SESSION[$this->_sessionName] = $this->_arrGPCData; } return 1; } function length(){ return sizeof($this->_arrGPCData); } function deleteGPCData($sqlId, $dataId){ //delete an entry in the dataqueue based on its unique id if(isset($this->_arrGPCData[$sqlId][$dataId])){ unset($this->_arrGPCData[$sqlId][$dataId]); return 1; } return 0; } function deleteQuery($queryId){ //should probably loop through 2d array values here and unset each value... how good is php garabage collection? if(isset($this->_arrGPCData[$queryId])){ unset($this->_arrGPCData[$queryId]); return 1; } return 0; } function runDataMethod($processId, $method){ //loop through the data for a given process and call a given function on it if (isset($this->_arrGPCData[$processId])) { foreach($this->_arrGPCData[$processId] as $uniqueId=>$gpcObj){ $arrMethods = get_class_methods($gpcObj->type); if(in_array(strtolower($method), $arrMethods)){ eval("\$gpcObj->dataObj->" . $method . "();"); } } return true; } return false; } function getGPCdata(){ if (($this->_pointer < sizeof($this->_arrGPCData))){ $keys = array_keys($this->_arrGPCData); $ret = $this->_arrGPCData[$keys[$this->_pointer]]; $this->_pointer++; return $ret; } return false; } function shiftGPCdata(){ if (sizeof($this->_arrGPCData) > 0){ $keys = array_keys($this->_arrGPCData); return array($keys[0], array_shift($this->_arrGPCData)); } return false; } function getSQL(){ //print queue, for debug purposes $arrRet = Array(); //print the contents of the process queue foreach($this->_arrGPCData as $k=>$v){ // $sqlQuery = ""; $sqlKeys = ""; $sqlValues = ""; unset($curDb); unset($curTable); unset($curId); unset($curOp); foreach($v as $i=>$j){ //get the database + table names for this transaction if(!isset($curDb)) $curDb = $j->database; if(!isset($curTable)) $curTable = $j->table; if(!isset($curId)){ $curId = $j->id; } if(!isset($curOp)){ $curOp = $j->operation; } if($j->database != $curDb){ echo "
ERROR: database mismatch
"; }else if($j->table != $curTable){ echo "
ERROR: table mismatch $j->table != $curTable
"; }else if($j->id != $curId){ echo "
ERROR: index mismatch " . $j->id . " != " . $curId . "
"; }else if($j->operation != $curOp){ echo "
ERROR: operation mismatch
"; } switch($curOp){ case 'INSERT': $sqlKeys .= $j->field . ", "; $sqlValues .= "'" . $j->dataObj->getSqlValue() . "', "; break; case 'UPDATE': $sqlValues .= $j->field . "='" . $j->dataObj->getSqlValue() . "', "; break; case 'DELETE': $sqlValues .= $j->field . "='" . $j->dataObj->getSqlValue() . "' AND "; break; default: echo "ERROR: unrecogniced operation"; break; } } //create sql statement switch($curOp){ case 'INSERT': $sqlQuery = "INSERT INTO " . $curTable . " (" . substr($sqlKeys,0,-2) . ") VALUES (" . substr($sqlValues,0,-2) . ")"; break; case 'UPDATE': $sqlQuery = "UPDATE " . $curTable . " SET " . substr($sqlValues,0,-2) . " WHERE id='" . $curId . "'"; break; case 'DELETE': $sqlQuery = "DELETE FROM " . $curTable . " WHERE id='" . $curId . "' LIMIT 1"; break; default: echo "ERROR: unrecogniced operation"; break; } $arrRet[$k] = $sqlQuery; } return $arrRet; } function fetchRows(){ //return associate arrays of field=>value $arrRet = Array(); //print the contents of the process queue foreach($this->_arrGPCData as $k=>$v){ // $row = array(); foreach($v as $i=>$j){ //get the database + table names for this transaction $row[$j->field] = $j->dataObj->getValue(); $arrRet[$k] = $row; } } return $arrRet; } } ?>usr/share/pear/CCMS-DEV/IO/IO.php0100644000000000000000000021453710254320655015125 0ustar rootrootedit($id); $userIo->save(); */ require_once 'DB.php'; require_once 'DataTable.php'; require_once 'GPCDataQueue.php'; //field in defTable to sorty by $GLOBALS["defTableSortKey"] = "iOrder"; //sort mode for fields, ASC / DESC; $GLOBALS["defTableSortMode"] = "ASC"; $GLOBALS['_CCMS_IO_ERROR_QUEUE']; $GLOBALS['_CCMS_IO_PROCESS_QUEUE']; $GLOBALS['_CCMS_IO_SQL_QUEUE']; $GLOBALS['_CCMS_IO_QUEUE_LOADED']; function parse_dsn($dsn){ preg_match("/(.*):\/\/(.*):(.*)@(.*)\/(.*)/",$dsn, $matches); if(sizeof($matches) < 6){ //ERROR PARSING DSN return array(); }else{ $ret = array(); $ret["dsn"] = $matches[0]; $ret["db_type"] = $matches[1]; $ret["username"] = $matches[2]; $ret["password"] = $matches[3]; $ret["server"] = $matches[4]; $ret["database"] = $matches[5]; return $ret; } } class IO{ //this class generates input structures and parses input from said structures //Input / Output interface for a table var $dsn; var $database; var $table; //table with field definitions in it var $defTable; var $indexField; //array of information about the fields in said table var $fieldInfo; var $_loaded; var $_inputHeader; var $_inputFooter; var $_inputRowHeader; var $_inputRowFooter; var $_headers; var $_footers; var $_messages; function IO($dsn, $table, $defTable){ if($dbParams = parse_dsn($dsn)){ $this->dsn = $dbParams["dsn"]; $this->database = $dbParams["database"]; $this->table = $table; $this->defTable = $defTable; $this->_inputHeader = array(); $this->_inputFooter = array(); $this->_inputRowHeader = array(); $this->_inputRowFooter = array(); $this->_headers = array(); $this->_footers = array(); $this->_messages = new DataGroup("_CCMS_MESSAGES"); //load singletons if they arn't loaded already if (!isset($GLOBALS['_CCMS_IO_ERROR_QUEUE'])) { $GLOBALS['_CCMS_IO_ERROR_QUEUE'] = new GPCDataQueue("_GPC_ERROR_QUEUE_"); } if (!isset($GLOBALS['_CCMS_IO_PROCESS_QUEUE'])) { $GLOBALS['_CCMS_IO_PROCESS_QUEUE'] = new GPCDataQueue("_GPC_PROCESS_QUEUE_"); } if (!isset($GLOBALS['_CCMS_IO_SQL_QUEUE'])) { $GLOBALS['_CCMS_IO_SQL_QUEUE'] = new GPCDataQueue("_GPC_SAVE_QUEUE_"); } $GLOBALS['_CCMS_IO_QUEUE_LOADED'] = true; }else{ //ERROR INITIALIZING CLASS } } function resetQueue(){ //empty the process queue and return the reset query id info $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->delete(); $GLOBALS['_CCMS_IO_SQL_QUEUE']->delete(); $GLOBALS['_CCMS_IO_ERROR_QUEUE']->delete(); return 1; } function resetProcessQueue(){ $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->delete(); return 1; } function _load(){ //loads table / field info //load table info from TABLE_DEFS $db =& DB::connect($this->dsn); if (DB::isError($db)) { die($db->getMessage()); } // LOADING FIELDS // 1. load index field $tableInfo = array(); $sql = "show columns from " . $this->table; $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $tableInfo[$row['Field']]['sqlType'] = $row['Type']; $tableInfo[$row['Field']]['sqlKey'] = $row['Key']; $tableInfo[$row['Field']]['sqlNull'] = $row['Null']; $tableInfo[$row['Field']]['sqlDefault'] = $row['Default']; $tableInfo[$row['Field']]['sqlExtra'] = $row['Extra']; } $res->free(); $sql = "SELECT * from " . $this->defTable . " where sTable='" . $this->table . "' order by " . $GLOBALS["defTableSortKey"] . " " . $GLOBALS["defTableSortMode"]; $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } $defTable = Array(); while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)){ if (isset($tableInfo[$row["sField"]]) && is_array($tableInfo[$row["sField"]])) { $row = array_merge($row,$tableInfo[$row["sField"]]); } $defTable[$row["sField"]] = $row; if($row["bIndex"]){ //this row is the table index $this->indexField = $row["sField"]; } } $res->free(); //load default field info $this->fieldInfo =& $defTable; //load any custom field overrides $this->loadFields(); $this->_loaded = 1; return true; } function _is_loaded(){ //check to see if the info is already loaded return (($this->_loaded) ? 1 : 0); } function isProcessable(){ $_action = strtoupper($_POST["_CCMS_ACTION"]); if($_action == "PROCESS" && $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->length() > 0){ return 1; } else { return 0; } } function processGPCInput(){ //validates data in the process queue and saves it to the sql queue for insertion //only save to the sql queue if $sqeSQL = ture //make sure the info for THIS table is loaded if(!$this->_is_loaded()){ $this->_load(); } //calling getGPCdata shifts data out of the queue while($arrGPC = $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->shiftGPCData()){ $processId = $arrGPC[0]; $gpc = $arrGPC[1]; //gpc returns an array of GPCData objects that will be validated and if ok, turned into sql statements $err = 0; foreach($gpc as $gpcId=> $gpcObj){ //echo "processing $gpcId == " . $_POST[$gpcId] . "
\n"; //check to see if data is set, if it is and is escaped CCMS_String data, un-escape it /* if (!isset($_POST[$gpcId])) { $value = null; } else { if (get_magic_quotes_gpc()) { $value = stripslashes($_POST[$gpcId]); } else { $value = $_POST[$gpcId]; } } */ //set the value of the object even if it is 'null' //let the CCMS_Data_Type class determine if null values are acceptable or not $value = $gpcObj->dataObj->loadFromGPC($gpcId); $gpcObj->dataObj->setValue($value); //push modified object back onto arry, php pointers!? $gpc[$gpcId] = $gpcObj; if(!$gpcObj->validate()){ $err = 1; } } if(!$err){ //add data to sql queue //remove data from process queue //$GLOBALS['_CCMS_IO_SQL_QUEUE']->next(); // reset($gpc); foreach($gpc as $gpcId=>$gpcObj){ $GLOBALS['_CCMS_IO_SQL_QUEUE']->add_from_object($gpcObj, $processId); } }else{ //add data to error queue //if process is in sqlQueue already, delete it! $GLOBALS['_CCMS_IO_SQL_QUEUE']->removeProcess($processId); foreach($gpc as $gpcId=>$gpcObj){ $GLOBALS['_CCMS_IO_ERROR_QUEUE']->add_from_object($gpcObj, $processId); } } } //save the empty process queue //$GLOBALS['_CCMS_IO_PROCESS_QUEUE']->save(); $GLOBALS['_CCMS_IO_SQL_QUEUE']->save(); //note: the error queue is not saved (errors should be handled immediatly) return true; } function process(){ //DEPRICATED //validates data in the process queue and saves it to the sql queue for insertion //make sure the info for THIS table is loaded if(!$this->_is_loaded()){ $this->_load(); } //calling getGPCdata shifts data out of the queue while($arrGPC = $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->shiftGPCData()){ $processId = $arrGPC[0]; $gpc = $arrGPC[1]; //gpc returns an array of GPCData objects that will be validated and if ok, turned into sql statements $err = 0; foreach($gpc as $gpcId=> $gpcObj){ //echo "processing $gpcId == " . $_POST[$gpcId] . "
\n"; //check to see if data is set, if it is and is escaped CCMS_String data, un-escape it /* if (!isset($_POST[$gpcId])) { $value = null; } else { if (get_magic_quotes_gpc()) { $value = stripslashes($_POST[$gpcId]); } else { $value = $_POST[$gpcId]; } } */ //set the value of the object even if it is 'null' //let the CCMS_Data_Type class determine if null values are acceptable or not $value = $gpcObj->dataObj->loadFromGPC($gpcId); $gpcObj->dataObj->setValue($value); //push modified object back onto arry, php pointers!? $gpc[$gpcId] = $gpcObj; if(!$gpcObj->validate()){ $err = 1; } } if(!$err){ //add data to sql queue //remove data from process queue //$GLOBALS['_CCMS_IO_SQL_QUEUE']->next(); // reset($gpc); foreach($gpc as $gpcId=>$gpcObj){ $GLOBALS['_CCMS_IO_SQL_QUEUE']->add_from_object($gpcObj, $processId); } }else{ //add data to error queue //if process is in sqlQueue already, delete it! $GLOBALS['_CCMS_IO_SQL_QUEUE']->removeProcess($processId); foreach($gpc as $gpcId=>$gpcObj){ $GLOBALS['_CCMS_IO_ERROR_QUEUE']->add_from_object($gpcObj, $processId); } } } //save the empty process queue //$GLOBALS['_CCMS_IO_PROCESS_QUEUE']->save(); $GLOBALS['_CCMS_IO_SQL_QUEUE']->save(); //note: the error queue is not saved (errors should be handled immediatly) return true; } function processAll(){ //moves everything from the process queue to the sql queue //make sure the info for THIS table is loaded if(!$this->_is_loaded()){ $this->_load(); } //calling getGPCdata shifts data out of the queue while($arrGPC = $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->shiftGPCData()){ $processId = $arrGPC[0]; $gpc = $arrGPC[1]; //gpc returns an array of GPCData objects that will be validated and if ok, turned into sql statements $err = 0; foreach($gpc as $gpcId=>$gpcObj){ $GLOBALS['_CCMS_IO_SQL_QUEUE']->add_from_object($gpcObj, $processId); } } //save the empty process queue //$GLOBALS['_CCMS_IO_PROCESS_QUEUE']->save(); $GLOBALS['_CCMS_IO_SQL_QUEUE']->save(); //note: the error queue is not saved (errors should be handled immediatly) return true; } function save(){ //save data in the sql queue to the database (it has already been validated) $err = 0; $arrInsIds = array(); $db =& DB::connect($this->dsn); if (DB::isError($db)) { die($db->getMessage()); }else{ if(!$GLOBALS['_CCMS_IO_SQL_QUEUE']->cleanup()){ //errors during cleanup! $err=1; $this->_messages->add("Error: An error occured while prepairing your data. Please try again."); } $sqlQueries = $GLOBALS['_CCMS_IO_SQL_QUEUE']->getSQL(); $iterate = true; //attempts to sort queries based on dependencies to other quereies in the sql queue while(sizeof($sqlQueries) > 0 && $iterate){ $iterate = false; foreach($sqlQueries as $processId => $sql){ $operation = $GLOBALS['_CCMS_IO_SQL_QUEUE']->getOperation($processId); switch($operation) { case "DELETE": //call pre delete function on data object $GLOBALS['_CCMS_IO_SQL_QUEUE']->runDataMethod($processId,"deleteHandler"); break; default: break; } //echo "reading $sql
"; if(preg_match_all("/''%%%ID:(.*)%%%''/U",$sql, $matches)){ foreach ($matches[1] as $k=>$rpid) { //if the depending statement has run, put the insert id in, otherwise bail on this query for now if(isset($arrInsIds[$rpid])){ //we changed something this iteration so run atleast once more $iterate = true; $sql = str_replace($matches[0][$k], $arrInsIds[$rpid], $sql); } } } if(!preg_match_all("/''%%%ID:(.*)%%%''/U",$sql, $matches)){ //we're changing something this iteration so run atleast once more $iterate = true; //no substitutions need to be made, so we can execute the query //echo "executing $sql
"; $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } if (strpos(strtoupper($sql), "INSERT") !== false) { $sql = "select last_insert_id()"; $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } $row =& $res->fetchRow(); $arrInsIds[$processId] = $row[0]; // echo "insert id: " . $row[0] . "
"; } //unset the current process so it doesn't get run again unset($sqlQueries[$processId]); $GLOBALS['_CCMS_IO_SQL_QUEUE']->removeProcess($processId); }else{ //echo "skipped $processId for this iteration
"; } }//end of foreach } //end of while loop if(sizeof($sqlQueries) == 0){ //echo "SUCESS!"; } else { $err = 1; $this->_messages->add("Error: Race condition occured while adding data to linked tables."); } $GLOBALS['_CCMS_IO_SQL_QUEUE']->delete(); } $this->_messages->add("Changes Saved Successfully At " . date("g:i:s A")); if ($err) { $this->_messages->add("Error: Could not save"); return false; } return true; } function fetchRow($pid = null){ //if pid is set, only fetch the row for said pid, otherwise return all //return the data in the sql queue as an associative array of [pid][field]=>value $ret = array(); $sqlRow = $GLOBALS['_CCMS_IO_SQL_QUEUE']->fetchRows(); foreach($sqlRow as $processId => $sql){ //nt process so it doesn't get run again if(isset($pid)){ if($processId != $pid){ echo "skipping $processId \n\n"; unset($sqlRow[$processId]); } else { echo "returning $processId\n\n"; $GLOBALS['_CCMS_IO_SQL_QUEUE']->removeProcess($processId); } } else { echo "returning $processId\n\n"; $GLOBALS['_CCMS_IO_SQL_QUEUE']->removeProcess($processId); } }//end of foreach if(!isset($pid)){ echo "deleting entire queue!!\n\n"; $GLOBALS['_CCMS_IO_SQL_QUEUE']->delete(); } return $sqlRow; } function load(){ if(!$this->_is_loaded()){ $this->_load(); } return true; } //WARNING!!! NO DATA CHECKING DONE ON INJECTED VALUES! function injectSQLValues($processId, $arrValues){ foreach($arrValues as $key=>$value){ if(isset($this->fieldInfo[$key])){ eval ("\$obj = new " . $this->fieldInfo[$key]["sClass"] . "();"); if (isset($_REQUEST['RES'])) { if(method_exists($obj, 'reset')){ $obj->reset(); } } if( preg_match("/^%%_CCMS\((.*)\)_%%$/", $v, $matches) && isset($row[$matches[1]]) ) { $v = $row[$matches[1]]; } $obj->setValue($value); $obj->setLabel($fieldInfo[$key]["sLabel"]); $operation = $GLOBALS['_CCMS_IO_SQL_QUEUE']->getOperation($processId); $rowId = $GLOBALS['_CCMS_IO_SQL_QUEUE']->getRowId($processId); $uniqueId = "CCMS_" . $processId . ":" . $this->fieldInfo[$key]["sClass"] . ":" . $this->fieldInfo[$key]["sField"] . "_"; $GLOBALS['_CCMS_IO_SQL_QUEUE']->add($obj, $operation, $uniqueId, $this->database, $this->table, $this->fieldInfo[$key]["sField"],$this->fieldInfo[$key]["sLabel"], $this->fieldInfo[$key]["sClass"], $rowId, $processId); } } return true; } function HTMLinput($rowId = null, $processId = null, $options = null){ // SET OPTION DEFAULTS $formButtons = "FOOTER"; $formContainer = true; // LOAD OPTIONS if(is_array($options)){ if(isset($options["formButtons"])){ $formButtons = $options["formButtons"]; } if(isset($options["formContainer"])){ $formContainer = $options["formContainer"]; } } if(!$this->_is_loaded()){ $this->_load(); } /* load object from db if ID is set */ if(isset($rowId) && !is_array($rowId)){ $db =& DB::connect($this->dsn); if (DB::isError($db)) { die($db->getMessage()); } $sql = "SELECT * from " . $this->table . " WHERE " . $this->indexField . "='" . $rowId . "'"; $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } //need to make sure row is valid! $dbRow =& $res->fetchRow(DB_FETCHMODE_ASSOC); $res->free(); } else if(is_array($rowId)) { $dbRow = $rowId; } if(!$processId) $processId = $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->getNextProcessId(); //formContainer - put
tags in header and footer //autoProcess - include hidden fields to handle data submission (for use with io::process) //return a 2-d matrix of information $retData = new DataTable(); //load information foreach($this->fieldInfo as $i => $arrField){ $fieldName = $arrField["sField"]; $fieldType = $arrField["sClass"]; $fieldLabel = $arrField["sLabel"]; $fieldOptions = $arrField["aArgs"]; $fieldDefault = $arrField["sDefault"]; $fieldEdit = $arrField["bEdit"]; $fieldView = $arrField["bView"]; //echo "\n"; $uniqueId = "CCMS_" . $processId . ":" . $fieldType . ":" . $arrField["sField"] . "_"; if(isset($rowId)){ $operation = "UPDATE"; }else{ $operation = "INSERT"; } //in the session a queue of sql statements is stored, this id identifies the statement in the queue //load value of the object //1. check the error queue for a value //2. check the sql queue for a value //2.5 load the existing value //3. LOAD DEFAULT VALUE $val = ""; //attempt to evaulate default expression if(strlen($fieldDefault) > 0){ @eval("\$val = " . $fieldDefault . ";"); } if($existObj = $GLOBALS['_CCMS_IO_ERROR_QUEUE']->getValue($processId, $uniqueId)){ $val = $existObj->dataObj->getFormValue(); }else if($existObj = $GLOBALS['_CCMS_IO_SQL_QUEUE']->getValue($processId, $uniqueId)){ $val = $existObj->dataObj->getFormValue(); }else if(isset($dbRow[$fieldName])){ $val = $dbRow[$fieldName]; } eval("\$arrOptions = Array(" . $fieldOptions . ");"); // load object, set value if(strlen($fieldType) > 0) { eval ("\$obj = new " . $fieldType . "(Array(" . $fieldOptions . "), \$arrField);"); } if (isset($_REQUEST['RES'])) { if(method_exists($obj, 'reset')){ $obj->reset(); } } if( preg_match("/^%%_CCMS\((.*)\)_%%$/", $val, $matches) && isset($dbRow[$matches[1]]) ) { $val = $dbRow[$matches[1]]; } $obj->setValue($val); //see if the field is required, and add optional character $fieldLabel = ($obj->getOption('required') === true) ? $options['requiredtermination'] . $fieldLabel : $fieldLabel; //overwrite fildinfo value $this->fieldInfo[$fieldName]['sLabel'] = $fieldLabel; $obj->setLabel($req . $fieldLabel); //is the field required? if($fieldEdit){ if(isset($arrOptions["heading"])){ $dataRow = new DataGroup("_CCMS_HEADING"); $dataRow->add($arrOptions["heading"]); $retData->addRow($dataRow); } $arrOut = $obj->getFormElement($uniqueId); if (is_object($arrOut)) { $retData->addFromTable($arrOut); } else if(is_array($arrOut)){ foreach($arrOut as $_label => $_value){ $dataRow = new DataGroup($_label); $dataRow->add($_value); // $dataRow->add($arrField["sExample"]); $retData->addRow($dataRow); } }else{ $dataRow = new DataGroup($fieldLabel); if($options['appendexamples']){ $dataRow->add($arrOut . $arrField["sExample"],null,$obj->getClass(), ($obj->getOption('required') === true)); } else { $dataRow->add($arrOut,null,$obj->getClass(), ($obj->getOption('required') === true)); $dataRow->add($arrField["sExample"]); } $retData->addRow($dataRow); } $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->add($obj, $operation, $uniqueId, $this->database, $this->table, $fieldName,$fieldLabel, $fieldType, $rowId, $processId); }else if($fieldView){ if(isset($arrOptions["heading"])){ $dataRow = new DataGroup("_CCMS_HEADING"); $dataRow->add($arrOptions["heading"]); $retData->addRow($dataRow); } $arrOut = $obj->getValue(); if (is_object($arrOut)) { $retData->addFromTable($arrOut); } else if(is_array($arrOut)){ foreach($arrOut as $_label => $_value){ $dataRow = new DataGroup($_label); $dataRow->add($_value, null,$obj->getClass(), ($obj->getOption('required') === true)); // $dataRow->add($arrField["sExample"]); $retData->addRow($dataRow); } }else{ $dataRow = new DataGroup($fieldLabel); $dataRow->add($arrOut, null,$obj->getClass(), ($obj->getOption('required') === true)); $retData->addRow($dataRow); } //$dataRow->add($arrField["sExample"]); //$retData->addRow($dataRow); } } // ADD FORM BUTTONS TO DATA CONTAINER if($formButtons == "DATA"){ $dataRow = new DataGroup(""); $dataRow->add(" "); $retData->addRow($dataRow); }else if($formButtons == "HEADER"){ $retData->addHeader(" ", "_FORM_BUTTONS"); }else if($formButtons == "FOOTER"){ $retData->addFooter(" ", "_FORM_BUTTONS"); } // ADD FORM CONTAINER TO DATA CONTAINER if($formContainer){ $retData->addHeader(""); $retData->addFooter("
"); } //save queue to session $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->save(); return $retData; } function HTMLview($rowId = null, $processId = null, $options = null){ //prints full html info if(!$this->_is_loaded()){ $this->_load(); } /* load object from db if ID is set */ if(isset($rowId)){ $db =& DB::connect($this->dsn); if (DB::isError($db)) { die($db->getMessage()); } $sql = "SELECT * from " . $this->table . " WHERE " . $this->indexField . "='" . $rowId . "'"; $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } //need to make sure row is valid! $dbRow =& $res->fetchRow(DB_FETCHMODE_ASSOC); $res->free(); if(!$processId) $processId = $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->getNextProcessId(); //formContainer - put
tags in header and footer //autoProcess - include hidden fields to handle data submission (for use with io::process) //return a 2-d matrix of information $retData = new DataTable(); //load information foreach($this->fieldInfo as $i => $arrField){ $fieldName = $arrField["sField"]; $fieldType = $arrField["sClass"]; $fieldLabel = $arrField["sLabel"]; $fieldOptions = $arrField["aArgs"]; $fieldDefault = $arrField["sDefault"]; $fieldEdit = $arrField["bEdit"]; $fieldView = $arrField["bView"]; //in the session a queue of sql statements is stored, this id identifies the statement in the queue //load value of the object //1. check the error queue for a value //2. check the sql queue for a value //2.5 load the existing value //3. LOAD DEFAULT VALUE $val = ""; $val = $dbRow[$fieldName]; $arrOptions = array(); eval("\$arrOptions = Array(" . $fieldOptions . ");"); // load object, set value eval ("\$obj = new " . $fieldType . "(Array(" . $fieldOptions . "), \$arrField);"); if (isset($_REQUEST['RES'])) { if(method_exists($obj, 'reset')){ $obj->reset(); } } if( preg_match("/^%%_CCMS\((.*)\)_%%$/", $val, $matches) && isset($dbRow[$matches[1]]) ) { $val = $dbRow[$matches[1]]; } $obj->setValue($val); $obj->setLabel($fieldLabel); if($fieldView){ if(isset($arrOptions["heading"])){ $dataRow = new DataGroup("_CCMS_HEADING"); $dataRow->add($arrOptions["heading"]); $retData->addRow($dataRow); } $arrOut = $obj->getValue(); if (is_object($arrOut)) { $retData->addFromTable($arrOut); } else if(is_array($arrOut)){ foreach($arrOut as $_label => $_value){ $dataRow = new DataGroup($_label); $dataRow->add($_value, null,$obj->getClass(), ($obj->getOption('required') === true)); // $dataRow->add($arrField["sExample"]); $retData->addRow($dataRow); } }else{ $dataRow = new DataGroup($arrField["sLabel"]); $dataRow->add($arrOut, null,$obj->getClass(), ($obj->getOption('required') === true)); $retData->addRow($dataRow); } } } return $retData; } return false; } function setFields($fields){ if(is_array($fields)) { $GLOBALS['_CCMS_FIELDS'] = $fields; if(!$this->_is_loaded()){ $this->_load(); } $this->loadFields(); } } function loadFields(){ $fields = $GLOBALS['_CCMS_FIELDS']; if (is_array($fields)){ foreach ($this->fieldInfo as $field=>$info) { if (isset($fields[$info['sTable']][$field])) { $perm = $fields[$info['sTable']][$field]; if($perm['bView']) { $this->fieldInfo[$field]['bView'] = true; $this->fieldInfo[$field]['sLabel'] = $fields[$info['sTable']][$field]; } } else { $this->fieldInfo[$field]['bView'] = false; } } } } function HTMLdelete($rowId, $processId = null, $options = null){ // SET OPTION DEFAULTS $formButtons = "FOOTER"; $formContainer = true; // LOAD OPTIONS if(is_array($options)){ if(isset($options["formButtons"])){ $formButtons = $options["formButtons"]; } if(isset($options["formContainer"])){ $formContainer = $options["formContainer"]; } } if(!$this->_is_loaded()){ $this->_load(); } /* load object from db if ID is set */ if(isset($rowId)){ $db =& DB::connect($this->dsn); if (DB::isError($db)) { die($db->getMessage()); } $sql = "SELECT * from " . $this->table . " WHERE " . $this->indexField . "='" . $rowId . "'"; $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } //need to make sure row is valid! $dbRow =& $res->fetchRow(DB_FETCHMODE_ASSOC); $res->free(); } if(!$processId) $processId = $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->getNextProcessId(); //formContainer - put tags in header and footer //autoProcess - include hidden fields to handle data submission (for use with io::process) //return a 2-d matrix of information $retData = new DataTable(); //load information foreach($this->fieldInfo as $i => $arrField){ $fieldName = $arrField["sField"]; $fieldType = $arrField["sClass"]; $fieldLabel = $arrField["sLabel"]; $fieldOptions = $arrField["aArgs"]; $fieldDefault = $arrField["sDefault"]; $fieldEdit = $arrField["bEdit"]; $fieldView = $arrField["bView"]; $uniqueId = "CCMS_" . $processId . ":" . $fieldType . ":" . $arrField["sField"] . "_"; $operation = "DELETE"; //in the session a queue of sql statements is stored, this id identifies the statement in the queue //load value of the object //1. check the error queue for a value //2. check the sql queue for a value //2.5 load the existing value //3. LOAD DEFAULT VALUE $val = ""; //attempt to evaulate default expression if(strlen($fieldDefault) > 0){ @eval("\$val = " . $fieldDefault . ";"); } if($existObj = $GLOBALS['_CCMS_IO_ERROR_QUEUE']->getValue($processId, $uniqueId)){ $val = $existObj->dataObj->getFormValue(); }else if($existObj = $GLOBALS['_CCMS_IO_SQL_QUEUE']->getValue($processId, $uniqueId)){ $val = $existObj->dataObj->getFormValue(); }else if(isset($dbRow[$fieldName])){ $val = $dbRow[$fieldName]; } // load object, set value eval ("\$obj = new " . $fieldType . "(Array(" . $fieldOptions . "), \$arrField);"); if (isset($_REQUEST['RES'])) { if(method_exists($obj, 'reset')){ $obj->reset(); } } if( preg_match("/^%%_CCMS\((.*)\)_%%$/", $val, $matches) && isset($dbRow[$matches[1]]) ) { $val = $dbRow[$matches[1]]; } $obj->setValue($val); $obj->setLabel($fieldLabel); if($fieldView || $fieldEdit){ $arrOut = $obj->getValue($uniqueId); if(is_array($arrOut)){ foreach($arrOut as $_label => $_value){ $dataRow = new DataGroup($_label); $dataRow->add($_value); // $dataRow->add($arrField["sExample"]); $retData->addRow($dataRow); } }else{ $dataRow = new DataGroup($arrField["sLabel"]); $dataRow->add($arrOut,null,$obj->getClass(), ($obj->getOption('required') === true)); //$dataRow->add($arrField["sExample"]); $retData->addRow($dataRow); } $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->add($obj, $operation, $uniqueId, $this->database, $this->table, $fieldName,$fieldLabel, $fieldType, $rowId, $processId); } } // ADD FORM BUTTONS TO DATA CONTAINER if($formButtons == "DATA"){ $dataRow = new DataGroup(""); $dataRow->add(" "); $retData->addRow($dataRow); }else if($formButtons == "HEADER"){ $retData->addHeader(" ", "_FORM_BUTTONS"); }else if($formButtons == "FOOTER"){ $retData->addFooter(" ", "_FORM_BUTTONS"); } // ADD FORM CONTAINER TO DATA CONTAINER if($formContainer){ $retData->addHeader(""); $retData->addFooter("
"); } //save queue to session $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->save(); return $retData; } function addInput($name, $location, $arrBtn = array()){ if (strlen($name) == 0) { return false; } switch(strtoupper($location)) { case "HEADER": array_push($this->_inputHeader, $arrBtn); break; case "FOOTER": array_push($this->_inputFooter, $arrBtn); break; case "ROWHEADER": array_push($this->_inputRowHeader, $arrBtn); break; case "ROWFOOTER": array_push($this->_inputRowFooter, $arrBtn); break; default: return false; break; } return true; } function addHeader($header) { array_unshift($this->_headers, $header); return true; } function addFooter($footer) { array_push($this->_footers, $footer); return true; } function addContainer($header, $footer){ //this function should attempt to automatically determine the footer if it is not set $this->addHeader($header); $this->addFooter($footer); return true; } function browseData($options = array()){ // LOADS DATA INTO A TABLE FORMAT if(!$this->_is_loaded()){ $this->_load(); } $retData = new DataTable(); $db =& DB::connect($this->dsn); if (DB::isError($db)) { die($db->getMessage()); } // LOADING FIELDS // 1. load index field $sql = "SELECT * from " . $this->table; /** sbeam hack to allow the listing to be ordered by passing an orderable * column name in $options array to this method */ if (isset($options['order']) and $options['order']) { $sql .= " ORDER BY " . $options['order']; } $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } $colHeaders = array(); $init = true; while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $dataRow = new DataGroup(""); foreach($this->_inputRowHeader as $inputName=>$arrInput) { if ($init) { array_push($colHeaders, ""); } $inputOptions = ""; $outputOptions = ""; if (is_array($arrInput)) { //process values foreach ($arrInput as $inputKey=>$inputValue) { //loop through and perform changes $inputValue = str_replace("%%INDEX%%", $row[$this->indexField], $inputValue); $inputValue = str_replace("%%THIS%%", "\$arrInput", $inputValue); //special cases if (strtolower($inputKey) == "_eval") { $inputValue = @eval($inputValue); } $arrInput[$inputKey] = $inputValue; } //print modified output foreach($arrInput as $outputKey=>$outputValue) { if(substr($outputKey,0,1) != "_") { $outputOptions .= $outputKey; if ($outputValue != null) { $outputOptions .= "=\"" . $outputValue . "\""; } $outputOptions .= " "; } } } $dataRow->add(""); } //print out data foreach($row as $k=>$v){ if(isset($this->fieldInfo[$k]["bView"]) && $this->fieldInfo[$k]["bView"]){ unset($obj); //load object, set value eval ("\$obj = new " . $this->fieldInfo[$k]["sClass"] . "(Array(" . $this->fieldInfo[$k]["aArgs"] . "), \$this->fieldInfo[$k]);"); if (isset($_REQUEST['RES'])) { if(method_exists($obj, 'reset')){ $obj->reset(); } } if(is_object($obj)){ if( preg_match("/^%%_CCMS\((.*)\)_%%$/", $v, $matches) && isset($row[$matches[1]]) ) { $v = $row[$matches[1]]; } $obj->setValue($v); $obj->setLabel($this->fieldInfo[$k]["sLabel"]); if ($options['showfull']) { $value = $obj->getValue(); } else { $value = $obj->getValuePreview(); } if (is_object($value)) { while($tblRow = $value->getRow()) { while($tblCol = $tblRow->getData()){ $dataRow->add($tblCol->getValue()); if ($init) { array_push($colHeaders, $tblRow->getLabel()); } } } } else if(is_array($value)){ foreach($value as $_label => $_value){ //chop length? if (isset($options["chopLength"]) ) { if ( $options["chopLength"] > 0 && strlen($value) > $options["chopLength"] ){ $value = substr($value,0,$options["chopLength"]) . "..."; } }else{ if ( strlen($value) > 50) { $value = substr($value,0,50) . "..."; } } $dataRow->add($_value); if ($init) { array_push($colHeaders, $_label); } } }else{ //chop length? if (isset($options["chopLength"]) ) { if ( $options["chopLength"] > 0 && strlen($value) > $options["chopLength"] ){ $value = substr($value,0,$options["chopLength"]) . "..."; } }else{ if ( strlen($value) > 50) { $value = substr($value,0,50) . "..."; } } $dataRow->add($value); if ($init) { array_push($colHeaders, $this->fieldInfo[$k]["sLabel"]); } } //$dataRow->add($value); } } } //add row footers foreach($this->_inputRowFooter as $inputName=>$arrInput) { if ($init) { array_push($colHeaders, ""); } $inputOptions = ""; $outputOptions = ""; if (is_array($arrInput)) { //process values foreach ($arrInput as $inputKey=>$inputValue) { //loop through and perform changes $inputValue = str_replace("%%INDEX%%", $row[$this->indexField], $inputValue); $inputValue = str_replace("%%THIS%%", "\$arrInput", $inputValue); //special cases if (strtolower($inputKey) == "_eval") { $inputValue = @eval($inputValue); } $arrInput[$inputKey] = $inputValue; } //print modified output foreach($arrInput as $outputKey=>$outputValue) { if(substr($outputKey,0,1) != "_") { $outputOptions .= $outputKey; if ($outputValue != null) { $outputOptions .= "=\"" . $outputValue . "\""; } $outputOptions .= " "; } } } $dataRow->add(""); } $retData->addRow($dataRow); $init = false; } $res->free(); //add headers foreach($this->_inputHeader as $inputName=>$arrInput) { $inputOptions = ""; $inputOptions = ""; $outputOptions = ""; if (is_array($arrInput)) { //process values foreach ($arrInput as $inputKey=>$inputValue) { //loop through and perform changes $inputValue = str_replace("%%INDEX%%", $row[$this->indexField], $inputValue); $inputValue = str_replace("%%THIS%%", "\$arrInput", $inputValue); //special cases if (strtolower($inputKey) == "_eval") { $inputValue = @eval($inputValue); } $arrInput[$inputKey] = $inputValue; } //print modified output foreach($arrInput as $outputKey=>$outputValue) { if(substr($outputKey,0,1) != "_") { $outputOptions .= $outputKey; if ($outputValue != null) { $outputOptions .= "=\"" . $outputValue . "\""; } $outputOptions .= " "; } } } $retData->addHeader(""); } foreach($this->_headers as $headerKey=>$headerValue) { $retData->addHeader($headerValue); } //add footers foreach($this->_inputFooter as $inputName=>$arrInput) { $inputOptions = ""; $inputOptions = ""; $outputOptions = ""; if (is_array($arrInput)) { //process values foreach ($arrInput as $inputKey=>$inputValue) { //loop through and perform changes $inputValue = str_replace("%%INDEX%%", $row[$this->indexField], $inputValue); $inputValue = str_replace("%%THIS%%", "\$arrInput", $inputValue); //special cases if (strtolower($inputKey) == "_eval") { $inputValue = @eval($inputValue); } $arrInput[$inputKey] = $inputValue; } //print modified output foreach($arrInput as $outputKey=>$outputValue) { if(substr($outputKey,0,1) != "_") { $outputOptions .= $outputKey; if ($outputValue != null) { $outputOptions .= "=\"" . $outputValue . "\""; } $outputOptions .= " "; } } } $retData->addFooter(""); } foreach($this->_footers as $footerKey=>$footerValue) { $retData->addFooter($footerValue); } $retData->setColumnHeaders($colHeaders); return $retData; } function listData($outString, $options = array()){ // LOADS DATA INTO A TABLE FORMAT if(!$this->_is_loaded()){ $this->_load(); } $retData = new DataTable(); $db =& DB::connect($this->dsn); if (DB::isError($db)) { die($db->getMessage()); } // LOADING FIELDS // 1. load index field $sql = "SELECT * from " . $this->table; $res =& $db->query($sql); if (DB::isError($res)) { //ERROR LOADING DATABASE INFORMATION die($res->getMessage()); } $colHeaders = array(); $init = true; while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $dataRow = new DataGroup(""); preg_match_all("/%%(.*)%%/U", $outString, $matches); $targets = array(); foreach ($matches[1] as $k) { $targetKeys[$k] = true; } foreach($this->_inputRowHeader as $inputName=>$arrInput) { if ($init) { array_push($colHeaders, ""); } $inputOptions = ""; $outputOptions = ""; if (is_array($arrInput)) { //process values foreach ($arrInput as $inputKey=>$inputValue) { //loop through and perform changes $inputValue = str_replace("%%INDEX%%", $row[$this->indexField], $inputValue); $inputValue = str_replace("%%THIS%%", "\$arrInput", $inputValue); //special cases if (strtolower($inputKey) == "_eval") { $inputValue = @eval($inputValue); } $arrInput[$inputKey] = $inputValue; } //print modified output foreach($arrInput as $outputKey=>$outputValue) { if(substr($outputKey,0,1) != "_") { $outputOptions .= $outputKey; if ($outputValue != null) { $outputOptions .= "=\"" . $outputValue . "\""; } $outputOptions .= " "; } } } $dataRow->add(""); } $targetValues = array(); $strValue = $outString; foreach($row as $k=>$v){ if ($targetKeys[$k]) { //this data is in the target output string, load it unset($obj); //load object, set value eval ("\$obj = new " . $this->fieldInfo[$k]["sClass"] . "(Array(" . $this->fieldInfo[$k]["aArgs"] . "), \$this->fieldInfo[$k]);"); if (isset($_REQUEST['RES'])) { if(method_exists($obj, 'reset')){ $obj->reset(); } } if(is_object($obj)){ if( preg_match("/^%%_CCMS\((.*)\)_%%$/", $v, $matches) && isset($row[$matches[1]]) ) { $v = $row[$matches[1]]; } $obj->setValue($v); $obj->setLabel($this->fieldInfo[$k]["sLabel"]); $value = $obj->getValuePreview(); //chop length? if (isset($options["chopLength"]) ) { if ( $options["chopLength"] > 0 && strlen($value) > $options["chopLength"] ){ $value = substr($value,0,$options["chopLength"]) . "..."; } }else{ if ( strlen($value) > 50) { $value = substr($value,0,50) . "..."; } } $targetValues[$k] = $value; } } } foreach(array_keys($targetKeys) as $key) { $strValue = str_replace('%%' . $key . '%%', $targetValues[$key], $strValue); } $dataRow->add($strValue); //add row footers foreach($this->_inputRowFooter as $inputName=>$arrInput) { if ($init) { array_push($colHeaders, ""); } $inputOptions = ""; $outputOptions = ""; if (is_array($arrInput)) { //process values foreach ($arrInput as $inputKey=>$inputValue) { //loop through and perform changes $inputValue = str_replace("%%INDEX%%", $row[$this->indexField], $inputValue); $inputValue = str_replace("%%THIS%%", "\$arrInput", $inputValue); //special cases if (strtolower($inputKey) == "_eval") { $inputValue = @eval($inputValue); } $arrInput[$inputKey] = $inputValue; } //print modified output foreach($arrInput as $outputKey=>$outputValue) { if(substr($outputKey,0,1) != "_") { $outputOptions .= $outputKey; if ($outputValue != null) { $outputOptions .= "=\"" . $outputValue . "\""; } $outputOptions .= " "; } } } $dataRow->add(""); } $retData->addRow($dataRow); $init = false; } $res->free(); //add headers foreach($this->_inputHeader as $inputName=>$arrInput) { $inputOptions = ""; $inputOptions = ""; $outputOptions = ""; if (is_array($arrInput)) { //process values foreach ($arrInput as $inputKey=>$inputValue) { //loop through and perform changes $inputValue = str_replace("%%INDEX%%", $row[$this->indexField], $inputValue); $inputValue = str_replace("%%THIS%%", "\$arrInput", $inputValue); //special cases if (strtolower($inputKey) == "_eval") { $inputValue = @eval($inputValue); } $arrInput[$inputKey] = $inputValue; } //print modified output foreach($arrInput as $outputKey=>$outputValue) { if(substr($outputKey,0,1) != "_") { $outputOptions .= $outputKey; if ($outputValue != null) { $outputOptions .= "=\"" . $outputValue . "\""; } $outputOptions .= " "; } } } $retData->addHeader(""); } foreach($this->_headers as $headerKey=>$headerValue) { $retData->addHeader($headerValue); } //add footers foreach($this->_inputFooter as $inputName=>$arrInput) { $inputOptions = ""; $inputOptions = ""; $outputOptions = ""; if (is_array($arrInput)) { //process values foreach ($arrInput as $inputKey=>$inputValue) { //loop through and perform changes $inputValue = str_replace("%%INDEX%%", $row[$this->indexField], $inputValue); $inputValue = str_replace("%%THIS%%", "\$arrInput", $inputValue); //special cases if (strtolower($inputKey) == "_eval") { $inputValue = @eval($inputValue); } $arrInput[$inputKey] = $inputValue; } //print modified output foreach($arrInput as $outputKey=>$outputValue) { if(substr($outputKey,0,1) != "_") { $outputOptions .= $outputKey; if ($outputValue != null) { $outputOptions .= "=\"" . $outputValue . "\""; } $outputOptions .= " "; } } } $retData->addFooter(""); } foreach($this->_footers as $footerKey=>$footerValue) { $retData->addFooter($footerValue); } $retData->setColumnHeaders($colHeaders); return $retData; } function getSQLQueue(){ return $GLOBALS['_CCMS_IO_SQL_QUEUE']->getSQL(); } function printSQLQueue(){ //for debug only $ret = ""; $ret .= "
********************************************
"; $ret .= "SQL QUEUE

"; $ret .= "DESCRIPTION:
"; $ret .= "The SQL queue contains GPC data that has been entered, validated, and is ready to be saved to a database

"; $ret .= "CONTENTS:
"; $sqlBatch = $GLOBALS['_CCMS_IO_SQL_QUEUE']->getSQL(); foreach($sqlBatch as $k=>$v) $ret .= $k . ":" . $v . "
"; $ret .= "
********************************************
"; return $ret; } function printProcessQueue(){ //for debug only $ret = ""; $ret .= "
********************************************
"; $ret .= "PROCESS QUEUE

"; $ret .= "DESCRIPTION:
"; $ret .= "The process queue contains the structure of the GPC data that is currently being inputed (or waiting for user input).

"; $ret .= "CONTENTS:
"; $sqlBatch = $GLOBALS['_CCMS_IO_PROCESS_QUEUE']->getSQL(); foreach($sqlBatch as $k=>$v) $ret .= $k . ":" . $v . "
"; $ret .= "
********************************************
"; return $ret; } function inputErrorCount(){ return $GLOBALS['_CCMS_IO_ERROR_QUEUE']->length(); } function getErrors(){ $dataRow = new DataGroup("_CCMS_ERRORS"); //reset internal result pointer $GLOBALS['_CCMS_IO_ERROR_QUEUE']->reset(); while($gpc = $GLOBALS['_CCMS_IO_ERROR_QUEUE']->getGPCData()){ foreach($gpc as $gpcId=> $gpcObj){ while($errObj = $gpcObj->getDataError()){ $dataRow->add("ERROR (" . $errObj->errno . "): " . $errObj->errstr); } } } return $dataRow; } function getMessages(){ return $this->_messages; } function printErrorQueue(){ //for debug only $ret = ""; $ret .= "
********************************************
"; $ret .= "ERROR QUEUE

"; $ret .= "DESCRIPTION:
"; $ret .= "The error queue contains data that was submitted on the previous page, but contained errors so it could not be saved to the SQL queue.

"; $ret .= "CONTENTS:
"; $sqlBatch = $GLOBALS['_CCMS_IO_ERROR_QUEUE']->getSQL(); foreach($sqlBatch as $k=>$v) $ret .= $k . ":" . $v . "
"; $ret .= "
********************************************
"; return $ret; } } //end of class ?>