From 72ff3bd43c2739e95e2077d8d6575f63484c5da4 Mon Sep 17 00:00:00 2001 From: habarnam Date: Wed, 25 Jun 2008 22:17:46 +0300 Subject: [PATCH] + initial commit of the lib separation branch - based on h.org code --- _res/_libs/mysqlim.class.php | 2 +- _res/_libs/tdoabstract.class.php | 6 +++--- _res/_libs/tsimage2.class.php | 2 +- _res/loader.php | 18 ------------------ config.inc.php | 5 +++-- image.php | 2 +- img2.php | 6 +++--- index.php | 28 ++++++++++++++++++++++++---- 8 files changed, 36 insertions(+), 33 deletions(-) delete mode 100644 _res/loader.php rewrite index.php (67%) diff --git a/_res/_libs/mysqlim.class.php b/_res/_libs/mysqlim.class.php index 82128a4..f1965a1 100644 --- a/_res/_libs/mysqlim.class.php +++ b/_res/_libs/mysqlim.class.php @@ -123,7 +123,7 @@ class mySqlIm extends interfaceSql { * @return mixed */ public function query ($query){ - if (!is_a($this->link,'mysqli')) { + if (!($this->link instanceof mysqli)) { return false; } if (!empty($query)) { diff --git a/_res/_libs/tdoabstract.class.php b/_res/_libs/tdoabstract.class.php index 6787dc3..a9fa5e8 100644 --- a/_res/_libs/tdoabstract.class.php +++ b/_res/_libs/tdoabstract.class.php @@ -604,10 +604,10 @@ class tdoAbstract { foreach ($valArray as $fieldName => $value) { if (array_key_exists ($fieldName, $this->fields)) { $this->fields[$fieldName]->set_value($value); - } elseif (!strinct) { + } elseif (!$strict) { // if the field name is not in the field list of the current object // it means that the valArray object is got from an JOIN sql - $this->fields[$fieldName] = new tdoAbstractField($field,'j1'); + $this->fields[$fieldName] = new tdoAbstractField($value,'j1'); $this->fields[$fieldName]->set_value ($value); } } @@ -926,7 +926,7 @@ class tdoAbstractJoin { foreach ($this->rightTable->wheres as $where) { $this->leftTable->addWhere ($where); } - $this->leftTable->wheres = &array_merge($this->rightTable->wheres, $this->leftTable->wheres); + $this->leftTable->wheres = array_merge($this->rightTable->wheres, $this->leftTable->wheres); } public function set_state ($st) { diff --git a/_res/_libs/tsimage2.class.php b/_res/_libs/tsimage2.class.php index 722c848..78ba47a 100644 --- a/_res/_libs/tsimage2.class.php +++ b/_res/_libs/tsimage2.class.php @@ -1,6 +1,6 @@ 'gif', 2 => 'jpg', 3 => 'png'); public $path; private $content, diff --git a/_res/loader.php b/_res/loader.php deleted file mode 100644 index fa5ae8a..0000000 --- a/_res/loader.php +++ /dev/null @@ -1,18 +0,0 @@ -dispatch (); diff --git a/config.inc.php b/config.inc.php index 5399cff..bf8ee60 100644 --- a/config.inc.php +++ b/config.inc.php @@ -19,9 +19,10 @@ define ('PAGE_PATH', BASE_PATH.DIRECTORY_SEPARATOR.'_pages'.DIRECTORY_SEPARATO /* URL constants -----------------------*/ -define ('BASE_URL', 'http://'.$_SERVER['HTTP_HOST']); +define ('BASE_URL', ''); define ('URL', BASE_URL.preg_replace('/\/[a-z0-9]+\.php/','',$_SERVER['SCRIPT_NAME'])); define ('NAV_VAR', 'to'); +define ('ACT_VAR', 'do'); define ('UPLOAD_URL', BASE_URL.'/upload'); /* Layout constants @@ -34,7 +35,7 @@ define ('S_TEMPL_DIR', '_templates'.DIRECTORY_SEPARATOR); define ('S_C_TEMPL_DIR', '_templates_c'.DIRECTORY_SEPARATOR); /* Db constants - -----------------------*/ + -----------------------*/ define ('DB_TYPE', 'mysqli'); define ('DB_HOST', 'localhost'); define ('DB_USER', 'b'); diff --git a/image.php b/image.php index 2e46d15..136d1a6 100644 --- a/image.php +++ b/image.php @@ -8,7 +8,7 @@ ob_start(); require ('config.inc.php'); require (LIB_PATH.'functions.inc.php'); -$id = tsPage::getRequest('id'); +$id = tsController::getRequest('id'); ob_end_clean(); $a = new tsImage ($id); diff --git a/img2.php b/img2.php index f0ce6ff..2a1cf69 100644 --- a/img2.php +++ b/img2.php @@ -10,9 +10,9 @@ require ('config.inc.php'); require (LIB_PATH.'functions.inc.php'); $imgDir = 'pics'; -$id = tsPage::getRequest('id'); -$resizeW = tsPage::getRequest('w'); -$resizeH = tsPage::getRequest('h'); +$id = tsController::getRequest ('id'); +$resizeW = tsController::getRequest ('w'); +$resizeH = tsController::getRequest ('h'); $a = new tsImage2 ( tsImage2::getPath ($id) ); $a->testPath (tsImage2::getPath ($id)); diff --git a/index.php b/index.php dissimilarity index 67% index 5f490ae..79ff1d5 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,24 @@ -addRoute ('index', '', true); +$myRoute->addRoute ('habarnam', '/aventurile lui habarnam/i'); +$myRoute->addRoute ('habarnam2', '/habarnam si orasul soarelui|orasul soarelui/i'); +/** + * REQUEST_URI : /Aventurile+Lui+Habarnam/Cum+a+devenit+Habarnam+muzicant + * 1. match pe req_uri : aventurile lui habarnam + * habarnam + * => to=habarnam + * 2. match pe restul req_uri + */ +//$to = ctrlFactory::getController (); +$to = $myRoute->getController (); +//var_dump($to); +if ($to instanceof tsController ) { + $to->dispatch (); +} else { + $to = new tsControllerHtml(); + $to->dispatch(); +} \ No newline at end of file -- 2.11.4.GIT