aboutsummaryrefslogtreecommitdiff
path: root/h-source/Library/Model/Base.php
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-07-28 20:27:23 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-07-28 20:27:23 +0000
commite7b3717614621f14695ab6ca6dda6dd17ba3d65c (patch)
treec8e6061aef3ff7bad5a17e1aecaf441d35e282cb /h-source/Library/Model/Base.php
parent0de74c6879d263645770de3d6b3ce7123f5241d6 (diff)
added new easygiant library
Diffstat (limited to 'h-source/Library/Model/Base.php')
-rwxr-xr-xh-source/Library/Model/Base.php39
1 files changed, 26 insertions, 13 deletions
diff --git a/h-source/Library/Model/Base.php b/h-source/Library/Model/Base.php
index 753d93c..f420ad9 100755
--- a/h-source/Library/Model/Base.php
+++ b/h-source/Library/Model/Base.php
@@ -119,7 +119,7 @@ abstract class Model_Base
protected $_arraySoftCheck; //Array_Validate_Soft object
public $db; //reference to the database layer class
- protected $_lang = 'Eng'; //language of notices
+ protected $_lang = 'En'; //language of notices
public function __construct() {
@@ -138,7 +138,7 @@ abstract class Model_Base
$modelStringClass = 'Lang_'.$this->_lang.'_ModelStrings';
if (!class_exists($modelStringClass))
{
- $modelStringClass = 'Lang_Eng_ModelStrings';
+ $modelStringClass = 'Lang_En_ModelStrings';
}
$this->_resultString = new $modelStringClass();
@@ -146,7 +146,7 @@ abstract class Model_Base
$dbCondStringClass = 'Lang_'.$this->_lang.'_DbCondStrings';
if (!class_exists($dbCondStringClass))
{
- $dbCondStringClass = 'Lang_Eng_DbCondStrings';
+ $dbCondStringClass = 'Lang_En_DbCondStrings';
}
$this->_dbCondString = new $dbCondStringClass();
@@ -168,7 +168,8 @@ abstract class Model_Base
//sanitize all the $values property
public function sanitize()
{
- $this->values = $this->arrayExt->subset($this->values,null,'sanitizeDb');
+ $keys = implode(',',array_keys($this->values));
+ $this->values = $this->arrayExt->subset($this->values,$keys,'sanitizeDb');
}
//change a resulting string from a db query
@@ -308,6 +309,18 @@ abstract class Model_Base
//$functionsIfFromDb = associative array of the form: array($entry=>$function_to_be_applied)
public function getFormValues($queryType = 'insert', $func = 'sanitizeHtml',$id = null,$defaultValues = array(),$functionsIfFromDb = array())
{
+ @session_start();
+ if (is_array($func))
+ {
+ $funcPost = $func[0];
+ $funcDb = $func[1];
+ }
+ else
+ {
+ $funcPost = $func;
+ $funcDb = 'none';
+ }
+
$arrayType = array('update','insert');
$values = array();
$idName = $this->identifierName;
@@ -331,11 +344,13 @@ abstract class Model_Base
$recordArray = $this->selectId($ident);
$fieldsArray = explode(',',$this->fields);
+
+ $values = $this->arrayExt->subset($recordArray,$this->fields,$funcDb);
- foreach ($fieldsArray as $field)
- {
- $values[$field] = array_key_exists($field,$recordArray) ? $recordArray[$field] : '';
- }
+// foreach ($fieldsArray as $field)
+// {
+// $values[$field] = array_key_exists($field,$recordArray) ? $recordArray[$field] : '';
+// }
$values[$idName] = $ident;
@@ -359,7 +374,6 @@ abstract class Model_Base
{
if ($this->formStruct['entries'][$k]['type'] === 'File')
{
- session_start();
$_SESSION['form_'.$k] = $v;
}
}
@@ -371,13 +385,13 @@ abstract class Model_Base
$tempArray = is_array($defaultValues) ? $defaultValues : array();
- $values = $this->arrayExt->subset($tempArray,$this->fields,$func);
+ $values = $this->arrayExt->subset($tempArray,$this->fields,$funcPost);
}
}
else
{
- $values = $this->arrayExt->subset($_POST,$this->fields,$func);
+ $values = $this->arrayExt->subset($_POST,$this->fields,$funcPost);
if ($queryType === 'update')
{
@@ -392,7 +406,6 @@ abstract class Model_Base
{
if ($this->formStruct['entries'][$tempFieldArray[$i]]['type'] === 'File')
{
- session_start();
if (isset($_SESSION['form_'.$tempFieldArray[$i]]))
{
$values[$tempFieldArray[$i]] = $_SESSION['form_'.$tempFieldArray[$i]];
@@ -434,7 +447,7 @@ abstract class Model_Base
$this->_backupFields = $this->fields;
$this->_backupValues = $this->values;
$this->values = $this->arrayExt->subsetComplementary($this->values,$list);
- $this->fields = implode(',',array_keys($this->values));
+// $this->fields = implode(',',array_keys($this->values));
}
//restore the fields and values saved in $_backupFields and $_backupValues