From bf5af6d04d5515b8c38260804f0fe5eb2829b627 Mon Sep 17 00:00:00 2001 From: habarnam Date: Sat, 28 Jun 2008 19:13:49 +0300 Subject: [PATCH] - deleted the models which also migrated to the application folder --- _res/_libs/tdocategories.class.php | 42 -------- _res/_libs/tdocategoriesposts.class.php | 15 --- _res/_libs/tdogroups.class.php | 13 --- _res/_libs/tdogroupsroles.class.php | 14 --- _res/_libs/tdooptions.class.php | 16 --- _res/_libs/tdoposts.class.php | 185 -------------------------------- _res/_libs/tdoroles.class.php | 13 --- _res/_libs/tdousers.class.php | 20 ---- _res/_libs/tdousersgroups.class.php | 14 --- 9 files changed, 332 deletions(-) delete mode 100644 _res/_libs/tdocategories.class.php delete mode 100644 _res/_libs/tdocategoriesposts.class.php delete mode 100644 _res/_libs/tdogroups.class.php delete mode 100644 _res/_libs/tdogroupsroles.class.php delete mode 100644 _res/_libs/tdooptions.class.php delete mode 100644 _res/_libs/tdoposts.class.php delete mode 100644 _res/_libs/tdoroles.class.php delete mode 100644 _res/_libs/tdousers.class.php delete mode 100644 _res/_libs/tdousersgroups.class.php diff --git a/_res/_libs/tdocategories.class.php b/_res/_libs/tdocategories.class.php deleted file mode 100644 index c94f2c9..0000000 --- a/_res/_libs/tdocategories.class.php +++ /dev/null @@ -1,42 +0,0 @@ -name = 'categories'; - - parent::__construct($db); -// $this->setIndex ($this->fields['category_id']); - } - - function set_category_flags ($flags = 0) { - $this->category_flags |= (int)$flags; - } - - function isPrivate () { - if ($this->category_flags & C_PRIVATE == C_PRIVATE) - return true; - else - return false; - } - - function isDefault () { - if ($this->category_flags & C_DEFAULT == C_DEFAULT) - return true; - else - return false; - } -} diff --git a/_res/_libs/tdocategoriesposts.class.php b/_res/_libs/tdocategoriesposts.class.php deleted file mode 100644 index d6b0fc1..0000000 --- a/_res/_libs/tdocategoriesposts.class.php +++ /dev/null @@ -1,15 +0,0 @@ -name = 'categories_posts'; - - parent::__construct($db); -// $this->setIndex($this->fields['cp_id']); - } -} diff --git a/_res/_libs/tdogroups.class.php b/_res/_libs/tdogroups.class.php deleted file mode 100644 index 57f0ecf..0000000 --- a/_res/_libs/tdogroups.class.php +++ /dev/null @@ -1,13 +0,0 @@ -name = 'groups'; - - parent::__construct($db); - } -} diff --git a/_res/_libs/tdogroupsroles.class.php b/_res/_libs/tdogroupsroles.class.php deleted file mode 100644 index aff106b..0000000 --- a/_res/_libs/tdogroupsroles.class.php +++ /dev/null @@ -1,14 +0,0 @@ -name = 'groups_roles'; - - parent::__construct($db); - } -} diff --git a/_res/_libs/tdooptions.class.php b/_res/_libs/tdooptions.class.php deleted file mode 100644 index 9aa1191..0000000 --- a/_res/_libs/tdooptions.class.php +++ /dev/null @@ -1,16 +0,0 @@ -name = 'options'; - - parent::__construct($db); -// $this->setIndex($this->fields['option_id']); - } -} diff --git a/_res/_libs/tdoposts.class.php b/_res/_libs/tdoposts.class.php deleted file mode 100644 index 9988e58..0000000 --- a/_res/_libs/tdoposts.class.php +++ /dev/null @@ -1,185 +0,0 @@ -name = 'posts'; - - parent::__construct ($db); -// $this->setIndex($this->fields['post_id']); -// $this->buildTable($tableDefinition); - } - -// public function __set ($key, $value) { -// if (stristr($key, 'body')) -// $this->clean($value); -// -// return parent::__set($key, $value); -// } - - public function getBody (){ - $this->set_post_body(stripslashes($this->post_body->getValue())); - return $this->post_body; - } - - public function clean (&$var) { - // here we might need to strip certain tags to avoid javascript injection - // then again... since we strip with smarty the posts the will become - // ... so it's commented out :D = Brilliant!! <- sarcasm - $var = stripslashes ($var); - if (extension_loaded('tidy')){ - $config = array ( - 'output-xhtml' => true, - 'enclose-text' => false, - 'show-body-only'=> true, - 'fix-uri' => false, - 'fix-backslash' => false, - 'merge-divs' => true, - 'merge-spans' => true, - 'break-before-br'=> true, - 'wrap' => false, - ); - - $var = tidy_repair_string ($var, $config, "utf8"); - } - } - - function isPrivate () { - if ($this->post_flags & P_PRIVATE == P_PRIVATE) - return true; - else - return false; - } - - public function getPostsCategories (){ - $this->buildInherentWheres(); - $cat = new tdoCategories($this->db); - $cp = new tdoCategoriesPosts($this->db); - - $cat->set_FieldModifier('GROUP_CONCAT(DISTINCT(%s))', $cat->category_name); // mySql - - $cp->joinWith('INNER', $cp->category_id, $cat, $cat->category_id); - - $this->joinWith ('INNER', $this->post_id, $cp, $cp->post_id); - - $this->addGroup($this->post_id); - - return $this->getArray(); - } - - /** - * cleaning the fields' contents before updating - * TODO: this can be equaly achieved, with less hassle, by modifying the $this->escape() method :D - * - * @param int $id - */ - public function update ($id = null) { - $this->clean ($this->post_title,false); - $this->clean ($this->post_body); - - return parent::update ($id); - } - - /** - * cleaning the fields' contents before inserting into the db - */ - public function insert () { - $this->clean ($this->post_title,false); - $this->clean ($this->post_body); - - return parent::insert (); - } - - private function buildPosts ($userId = null) { - $this->post_active = 'Y'; - - $this->addGroup ($this->post_id); - $this->addOrder ($this->post_time,false); - - $cat = new tdoCategories ($this->db); - $cp = new tdoCategoriesPosts ($this->db); - - $user = new tdoUsers ($this->db); - // I don't know if group concat is ANSI SQL compliant - $cat->set_FieldModifier('GROUP_CONCAT(DISTINCT(%s) SEPARATOR \', \')', $cat->category_name); - - $w1 = new tdoAbstractClause ($this->post_private, '=', 'N'); - $w2 = new tdoAbstractClause ($cat->category_private, '=', 'N'); - - $w3 = new tdoAbstractClause ($w1, 'AND', $w2); - - if (!empty ($userId)) { - $w4 = new tdoAbstractClause ($this->post_author, '=', $userId); - $this->addWhere ($w3, 'OR', $w4); - } else { - $this->addWhere ($w2,'AND',$w1); - } - - $cp->joinWith ('INNER', $cp->category_id, $cat, $cat->category_id); - - $this->joinWith ('INNER', $this->post_id, $cp, $cp->post_id); - $this->joinWith ('INNER', $this->post_author, $user, $user->user_id); - - $this->addGroup ($this->post_id); - } - - public function getAllPosts ($userId = null) { - $this->buildPosts ($userId); - - return $this->getArray (); - } - - public function getPost ($postId, $userId = null) { - $this->buildPosts ($userId); - - // these is the only modification from getAllPosts - if (!empty($postId)) { - $this->post_id = $postId; - } - - return /*/end/**/ ($this->getArray(1)); - } - - public function test () { - $this->buidPost (); - - $this->db->query ( $this->buildSql (1)); - - return $this->db->getObjects (); - } - - /** - * Hard coded FULLTEXT search on post_title and post_body - * Probably it won't be very hard to abstract it: - * 1/ We already have FULLTEXT as flag on tdoAbstractField, I'll need only - * the MATCH () AGAINST () stuff, plus IN BOOLEAN MODE or WITH QUERY EXPANSION - * 2/ I have to look in what to do for different type of tables - * - * @param string $searchText - */ - public function searchPosts ($searchText, $userId = null) { - - $this->buildPosts ($userId); - $s = new tdoAbstractClause (' MATCH (post_title, post_body) AGAINST (' . $this->escape($searchText) . ')'); -// var_dump($s);die; - $this->addWhere ($s); -// $sql = 'SELECT ' . $this->outputFieldList() . ' FROM ' . $this->name . ' AS ' . $this->alias . ' WHERE '. -// 'MATCH (post_title, post_body) AGAINST (' . $this->escape($searchText) . ') AND post_active = "Y"'; - -// $this->db->query ($sql); - - return $this->getArray (); - } - -} diff --git a/_res/_libs/tdoroles.class.php b/_res/_libs/tdoroles.class.php deleted file mode 100644 index 898f1e1..0000000 --- a/_res/_libs/tdoroles.class.php +++ /dev/null @@ -1,13 +0,0 @@ -name = 'roles'; - - parent::__construct($db); - } -} diff --git a/_res/_libs/tdousers.class.php b/_res/_libs/tdousers.class.php deleted file mode 100644 index fbfc32c..0000000 --- a/_res/_libs/tdousers.class.php +++ /dev/null @@ -1,20 +0,0 @@ -name = 'users'; - - parent::__construct($db); - } - -// function set_user_credentials ($incString) { -// $this->fields['user_credentials']->setValue(md5 ($incString.$this->salt)); -// } -} diff --git a/_res/_libs/tdousersgroups.class.php b/_res/_libs/tdousersgroups.class.php deleted file mode 100644 index 0271f8b..0000000 --- a/_res/_libs/tdousersgroups.class.php +++ /dev/null @@ -1,14 +0,0 @@ -name = 'users_groups'; - - parent::__construct($db); - } -} -- 2.11.4.GIT