Changeset 2319 for branches

Show
Ignore:
Timestamp:
12/19/10 11:53:59 (17 months ago)
Author:
nick_ramsay
Message:

[1.5] Removing most category-related code from the core.

Location:
branches/1.5
Files:
1 removed
6 modified

Legend:

Unmodified
Added
Removed
  • branches/1.5/Hotaru.php

    r2315 r2319  
    16851685        } 
    16861686 
    1687         ######################## 
    1688         ## CATEGORY FUNCTIONS ## 
    1689         ######################## 
    1690  
    1691         /** 
    1692          * Returns the category id for a given category safe name. 
    1693          * 
    1694          * @param string $cat_name 
    1695          * @return int 
    1696          */ 
    1697         public function getCatId($cat_safe_name = '') 
    1698         { 
    1699                 $category = new Category(); 
    1700                 return $category->getCatId($this, $cat_safe_name); 
    1701         } 
    1702  
    1703  
    1704         /** 
    1705          * Returns the category name for a given category id or safe name. 
    1706          * 
    1707          * @param int $cat_id 
    1708          * @param string $cat_safe_name 
    1709          * @return string 
    1710          */ 
    1711         public function getCatName($cat_id = 0, $cat_safe_name = '') 
    1712         { 
    1713                 $category = new Category(); 
    1714                 return $category->getCatName($this, $cat_id, $cat_safe_name); 
    1715         } 
    1716  
    1717  
    1718         /** 
    1719          * Returns the category safe name for a given category id 
    1720          * 
    1721          * @param int $cat_id 
    1722          * @return string 
    1723          */ 
    1724         public function getCatSafeName($cat_id = 0) 
    1725         { 
    1726                 $category = new Category(); 
    1727                 return $category->getCatSafeName($this, $cat_id); 
    1728         } 
    1729  
    1730  
    1731         /** 
    1732          * Returns parent id 
    1733          * 
    1734          * @param int $cat_id 
    1735          * @return int 
    1736          */ 
    1737         public function getCatParent($cat_id = 0) 
    1738         { 
    1739                 $category = new Category(); 
    1740                 return $category->getCatParent($this, $cat_id); 
    1741         } 
    1742  
    1743  
    1744         /** 
    1745          * Returns child ids 
    1746          * 
    1747          * @param int $cat_parent_id 
    1748          * @return int 
    1749          */ 
    1750         public function getCatChildren($cat_parent_id = 0) 
    1751         { 
    1752                 $category = new Category(); 
    1753                 return $category->getCatChildren($this, $cat_parent_id); 
    1754         } 
    1755  
    1756          /** 
    1757          * Returns Category list ids 
    1758          * 
    1759          * @param array $args 
    1760          * @return int 
    1761          */ 
    1762         public function getCategories($args = array()) 
    1763         { 
    1764                 $category = new Category(); 
    1765                 return $category->getCategories($this, $args); 
    1766         } 
    1767  
    1768  
    1769         /** 
    1770          * Returns meta description and keywords for the category (if available) 
    1771          * 
    1772          * @param int $cat_id 
    1773          * @return array|false 
    1774          */ 
    1775         public function getCatMeta($cat_id = 0) 
    1776         { 
    1777                 $category = new Category(); 
    1778                 return $category->getCatMeta($this, $cat_id); 
    1779         } 
    1780  
    1781  
    1782         /** 
    1783          * Add a new category 
    1784          * 
    1785          * @param int $parent 
    1786          * @param string $new_cat_name 
    1787          * @return bool 
    1788          */ 
    1789         public function addCategory($parent = 0, $new_cat_name = '') 
    1790         { 
    1791                 $category = new Category(); 
    1792                 return $category->addCategory($this, $parent, $new_cat_name); 
    1793         } 
    1794  
    1795  
    1796         /** 
    1797          * rebuild the category tree 
    1798          * 
    1799          * @param int $parent_id 
    1800          * @param int $left 
    1801          * @return int 
    1802          */ 
    1803         public function rebuildTree($parent_id = 0, $left = 0) 
    1804         { 
    1805                 $category = new Category(); 
    1806                 return $category->rebuildTree($this, $parent_id, $left); 
    1807         } 
    1808  
    1809  
    1810         /** 
    1811          * Delete a category 
    1812          * 
    1813          * @param int $delete_category 
    1814          * @return bool 
    1815          */ 
    1816         function deleteCategory($delete_category = 0) 
    1817         { 
    1818                 $category = new Category(); 
    1819                 return $category->deleteCategory($this, $delete_category); 
    1820         } 
    18211687 
    18221688        ###################### 
  • branches/1.5/install/index.php

    r2313 r2319  
    499499        } else { 
    500500 
    501                 $tables = array('blocked', 'categories', 'miscdata', 'plugins', 'pluginhooks', 'pluginsettings', 'posts', 'postvotes', 'settings', 'tags', 'tempdata', 'tokens', 'users', 'usermeta', 'widgets'); 
     501                $tables = array('blocked', 'miscdata', 'plugins', 'pluginhooks', 'pluginsettings', 'posts', 'postvotes', 'settings', 'tags', 'tempdata', 'tokens', 'users', 'usermeta', 'widgets'); 
    502502 
    503503                // delete *all* tables in db: 
  • branches/1.5/install/install-upgrade.php

    r2313 r2319  
    587587 
    588588                // Drop unique site_id keys 
    589                 $sql = "ALTER TABLE `" . TABLE_CATEGORIES . "` DROP INDEX `key`"; 
    590                 $h->db->query($sql); 
    591                 $sql = "ALTER TABLE `" . TABLE_CATEGORIES . "` ADD UNIQUE KEY `key` (`category_name`)"; 
     589                $sql = "ALTER TABLE `".DB_PREFIX."categories` DROP INDEX `key`"; 
     590                $h->db->query($sql); 
     591                $sql = "ALTER TABLE `".DB_PREFIX."categories` ADD UNIQUE KEY `key` (`category_name`)"; 
    592592                $h->db->query($sql); 
    593593                 
  • branches/1.5/install/install_tables.php

    r2313 r2319  
    6060         
    6161         
    62         // CATEGORIES TABLE - categories 
    63          
    64         if ($table_name == "categories") { 
    65                 //echo "table doesn't exist. Stopping before creation."; exit; 
    66                 $sql = "CREATE TABLE `" . DB_PREFIX . $table_name . "` ( 
    67                         `category_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 
    68                         `category_parent` int(11) NOT NULL DEFAULT '1', 
    69                         `category_name` varchar(64) NOT NULL DEFAULT '', 
    70                         `category_safe_name` varchar(64) NOT NULL DEFAULT '', 
    71                         `rgt` int(11) NOT NULL DEFAULT '0', 
    72                         `lft` int(11) NOT NULL DEFAULT '0', 
    73                         `category_order` int(11) NOT NULL DEFAULT '0', 
    74                         `category_desc` text NULL, 
    75                         `category_keywords` varchar(255) NULL, 
    76                         `category_updatedts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,  
    77                         `category_updateby` int(20) NOT NULL DEFAULT 0, 
    78                         UNIQUE KEY `key` (`category_name`) 
    79                 ) ENGINE=" . DB_ENGINE . " DEFAULT CHARSET=" . DB_CHARSET . " COLLATE=" . DB_COLLATE . " COMMENT='Categories';"; 
    80                 echo $lang['install_step2_creating_table'] . ": '" . DB_PREFIX . $table_name . "'...<br />\n"; 
    81                 $db->query($sql); 
    82                  
    83                 $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (category_name, category_safe_name) VALUES (%s, %s)"; 
    84                 $db->query($db->prepare($sql, urlencode('All'), urlencode('all'))); 
    85         } 
    86  
    87  
    8862        // MISCDATA TABLE - for storing default permissions, etc. 
    8963         
  • branches/1.5/libs/Initialize.php

    r2316 r2319  
    113113                $tableConstants = array( 
    114114                        'TABLE_BLOCKED' => 'blocked', 
    115                         'TABLE_CATEGORIES' => 'categories', 
    116115                        'TABLE_MISCDATA' => 'miscdata', 
    117116                        'TABLE_PLUGINS' => 'plugins', 
     
    158157                require_once(FUNCTIONS.'funcs.arrays.php'); 
    159158                require_once(FUNCTIONS.'funcs.times.php'); 
    160                 require_once(FUNCTIONS.'funcs.files.php'); 
    161159                require_once(FUNCTIONS.'funcs.http.php'); 
    162160        } 
  • branches/1.5/libs/PageHandling.php

    r2301 r2319  
    351351                                        // if we're using categories and the category is not "all"... 
    352352                                        if ($h->isActive('categories') && $h->post->category > 1) { 
    353                                                 $url .= $h->getCatSafeName($h->post->category).'/'; 
     353                                                $url .= $h->vars['category']->getCatSafeName($h, $h->post->category).'/'; 
    354354                                        } 
    355355 
     
    357357                                } elseif ($key == 'category' && is_numeric($value)) { 
    358358 
    359                                         $url .= $key.'/'.$h->getCatSafeName($value).'/'; 
     359                                        $url .= $key.'/'.$h->vars['category']->getCatSafeName($h, $value).'/'; 
    360360                                } elseif ($key == 'page') { 
    361361