Changeset 2317 for branches

Show
Ignore:
Timestamp:
12/19/10 10:35:49 (17 months ago)
Author:
petsagouris
Message:

[Branch 1.5] Removing the urlencode/urldecode from the core as far as database is concerned.

Location:
branches/1.5/libs
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • branches/1.5/libs/Announcements.php

    r2299 r2317  
    5656                $maintenance->getSiteAnnouncement($h); 
    5757                if ($h->vars['admin_announcement_enabled']) { 
    58                         $announcements[] = urldecode($h->vars['admin_announcement']); 
     58                        $announcements[] = $h->vars['admin_announcement']; 
    5959                } 
    6060 
     
    8888 
    8989                // Check if install file has not been run 
    90                 $sql = "SELECT miscdata_value FROM ".TABLE_MISCDATA." WHERE miscdata_key = %s"; 
    91                 $hotaru_version = $h->db->get_var($h->db->prepare($sql, 'hotaru_version')); 
     90                $hotaru_version = $h->db->get_var("SELECT miscdata_value FROM ".TABLE_MISCDATA." WHERE miscdata_key = 'hotaru_version'"); 
    9291                if (version_compare($h->version, $hotaru_version, '>')) { 
    9392                        $announcements[] = $h->lang['admin_announcement_run_install']; 
     
    114113                $announcements = $h->vars['admin_announcements']; 
    115114 
    116                 if (!is_array($announcements)) { 
    117                         return false; 
    118                 } else { 
     115                if (is_array($announcements)) { 
    119116                        return $announcements; 
    120117                } 
     118                return FALSE; 
    121119        } 
    122120 
  • branches/1.5/libs/Category.php

    r1690 r2317  
    3636        { 
    3737                $sql = "SELECT category_id FROM " . TABLE_CATEGORIES . " WHERE category_safe_name = %s"; 
    38                 $cat_id = $h->db->get_var($h->db->prepare($sql, urlencode($cat_safe_name))); 
     38                $cat_id = $h->db->get_var($h->db->prepare($sql, $cat_safe_name)); 
    3939                return $cat_id; 
    4040        } 
     
    5959                        $cat_name = $h->db->get_var($h->db->prepare($sql, $cat_id)); 
    6060                } 
    61                 return urldecode($cat_name); 
     61                return $cat_name; 
    6262        } 
    6363         
     
    8888                } 
    8989                 
    90                 return urldecode($cat_safe_name); 
     90                return $cat_safe_name; 
    9191        } 
    9292         
     
    243243                // return false if duplicate name 
    244244                $sql = "SELECT category_name FROM " . TABLE_CATEGORIES . " WHERE category_name = %s"; 
    245                 $exists = $h->db->get_var($h->db->prepare($sql, urlencode($new_cat_name))); 
     245                $exists = $h->db->get_var($h->db->prepare($sql, $new_cat_name)); 
    246246                if ($exists) { return false; } 
    247247 
     
    258258                //insert new category after parent category: 
    259259                $sql = "INSERT INTO " . TABLE_CATEGORIES . " (category_parent, category_name, category_safe_name, category_order, category_updateby) VALUES (%d, %s, %s, %d, %d)"; 
    260                 $h->db->query($h->db->prepare($sql, $parent, urlencode($new_cat_name), urlencode(make_url_friendly($new_cat_name)), $position, $h->currentUser->id)); 
     260                $h->db->query($h->db->prepare($sql, $parent, $new_cat_name, make_url_friendly($new_cat_name), $position, $h->currentUser->id)); 
    261261                 
    262262                $this->rebuildTree($h, 1, 0); 
  • branches/1.5/libs/Feeds.php

    r2175 r2317  
    4040                 
    4141                $feed = new RSS($h->url(array('page'=>'rss'))); 
    42                 $feed->title = stripslashes(html_entity_decode(urldecode($title), ENT_QUOTES, 'UTF-8')); 
     42                $feed->title = stripslashes(html_entity_decode($title, ENT_QUOTES, 'UTF-8')); 
    4343                $feed->link = html_entity_decode($link, ENT_QUOTES, 'UTF-8'); 
    4444                $feed->description = $description; 
  • branches/1.5/libs/PluginManagement.php

    r2247 r2317  
    6464                                $p['folder'] = $plugin_row->plugin_folder; 
    6565                                $p['author'] = $plugin_row->plugin_author; 
    66                                 $p['authorurl'] = urldecode($plugin_row->plugin_authorurl); 
     66                                $p['authorurl'] = $plugin_row->plugin_authorurl; 
    6767                                $p['status'] = ($plugin_row->plugin_enabled) ? 'active' : 'inactive'; 
    6868                                $p['version'] = $plugin_row->plugin_version; 
     
    8282 
    8383                                if (isset($plugin_details['authorurl'])) { 
    84                                         $p['authorurl'] = urldecode($plugin_details['authorurl']); 
     84                                        $p['authorurl'] = $plugin_details['authorurl']; 
    8585                                } 
    8686 
     
    166166        public function getPluginsMeta() 
    167167        { 
    168                 $plugin_list = getFilenames(PLUGINS, "short"); 
     168                $plugin_list = FileSystem::listFiles(PLUGINS); 
    169169                $plugins_array = array(); 
    170170                foreach ($plugin_list as $plugin_folder_name) { 
     
    184184        public function readPluginMeta($plugin_file) 
    185185        { 
    186                 if ($plugin_file == 'placeholder.txt') { 
    187                         return FALSE; 
    188                 } 
    189  
    190186                // Include the generic_pmd class that reads post metadata from the a plugin 
    191187                require_once(EXTENSIONS.'GenericPHPConfig/class.metadata.php'); 
     
    227223                // Clear the database cache to ensure stored plugins and hooks 
    228224                // are up-to-date. 
    229                 $h->deleteFiles(CACHE.'db_cache'); 
     225                FileSystem::deleteFiles(CACHE.'db_cache'); 
    230226 
    231227                // Clear the css/js cache to ensure any new ones get included 
    232                 $h->deleteFiles(CACHE.'css_js_cache'); 
     228                FileSystem::deleteFiles(CACHE.'css_js_cache'); 
    233229 
    234230                // Clear the language cache to ensure any new language files get included 
     
    263259 
    264260                        $sql = "REPLACE INTO ".TABLE_PLUGINS." (plugin_enabled, plugin_name, plugin_folder, plugin_class, plugin_extends, plugin_type, plugin_desc, plugin_requires, plugin_version, plugin_author, plugin_authorurl, plugin_updateby) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d)"; 
    265                         $h->db->query($h->db->prepare($sql, $h->plugin->enabled, $h->plugin->name, $h->plugin->folder, $h->plugin->class, $h->plugin->extends, $h->plugin->type, $h->plugin->desc, $h->plugin->requires, $h->plugin->version, $h->plugin->author, urlencode($h->plugin->authorurl), $h->currentUser->id)); 
     261                        $h->db->query($h->db->prepare($sql, $h->plugin->enabled, $h->plugin->name, $h->plugin->folder, $h->plugin->class, $h->plugin->extends, $h->plugin->type, $h->plugin->desc, $h->plugin->requires, $h->plugin->version, $h->plugin->author, $h->plugin->authorurl, $h->currentUser->id)); 
    266262 
    267263                        // Get the last order number - doing this after REPLACE INTO because 
     
    276272                        // upgrading: 
    277273                        $sql = "UPDATE ".TABLE_PLUGINS." SET plugin_enabled = %d, plugin_name = %s, plugin_folder = %s, plugin_class = %s, plugin_extends = %s, plugin_type = %s, plugin_desc = %s, plugin_requires = %s, plugin_version = %s, plugin_author = %s, plugin_authorurl = %s, plugin_updateby = %d WHERE plugin_folder = %s"; 
    278                         $h->db->query($h->db->prepare($sql, $h->plugin->enabled, $h->plugin->name, $h->plugin->folder, $h->plugin->class, $h->plugin->extends, $h->plugin->type, $h->plugin->desc, $h->plugin->requires, $h->plugin->version, $h->plugin->author, urlencode($h->plugin->authorurl), $h->currentUser->id, $h->plugin->folder)); 
     274                        $h->db->query($h->db->prepare($sql, $h->plugin->enabled, $h->plugin->name, $h->plugin->folder, $h->plugin->class, $h->plugin->extends, $h->plugin->type, $h->plugin->desc, $h->plugin->requires, $h->plugin->version, $h->plugin->author, $h->plugin->authorurl, $h->currentUser->id, $h->plugin->folder)); 
    279275                } 
    280276 
     
    398394        { 
    399395                // Clear the database cache to ensure plugins and hooks are up-to-date. 
    400                 $h->deleteFiles(CACHE.'db_cache'); 
     396                FileSystem::deleteFiles(CACHE.'db_cache'); 
    401397 
    402398                // Clear the css/js cache to ensure any new ones get included 
    403                 $h->deleteFiles(CACHE.'css_js_cache'); 
     399                FileSystem::deleteFiles(CACHE.'css_js_cache'); 
    404400 
    405401                // Clear the language cache to ensure any new language files get included 
     
    420416        { 
    421417                // Clear the database cache to ensure plugins and hooks are up-to-date. 
    422                 $h->deleteFiles(CACHE.'db_cache'); 
     418                FileSystem::deleteFiles(CACHE.'db_cache'); 
    423419 
    424420                // Clear the css/js cache to ensure this plugin's files are removed 
    425                 $h->deleteFiles(CACHE.'css_js_cache'); 
     421                FileSystem::deleteFiles(CACHE.'css_js_cache'); 
    426422 
    427423                // Clear the language cache to ensure any new language files get included 
     
    553549        { // 0 = deactivate, 1 = activate 
    554550                // Clear the database cache to ensure plugins and hooks are up-to-date. 
    555                 $h->deleteFiles(CACHE.'db_cache'); 
     551                FileSystem::deleteFiles(CACHE.'db_cache'); 
    556552 
    557553                // Clear the css/js cache to ensure any new ones get included 
    558                 $h->deleteFiles(CACHE.'css_js_cache'); 
     554                FileSystem::deleteFiles(CACHE.'css_js_cache'); 
    559555 
    560556                // Get the enabled status for this plugin... 
     
    770766 
    771767} 
    772  
    773 ?> 
  • branches/1.5/libs/Post.php

    r2296 r2317  
    9494                        $this->pubDate = $post_row->post_pub_date; 
    9595                        $this->status = $post_row->post_status; 
    96                         $this->type = urldecode($post_row->post_type); 
    97                         $this->category = urldecode($post_row->post_category); 
    98                         $this->tags = stripslashes(urldecode($post_row->post_tags)); 
    99                         $this->title = stripslashes(urldecode($post_row->post_title)); 
    100                         $this->origUrl = urldecode($post_row->post_orig_url); 
    101                         $this->domain = urldecode($post_row->post_domain); 
    102                         $this->url = urldecode($post_row->post_url); 
    103                         $this->content = stripslashes(urldecode($post_row->post_content)); 
     96                        $this->type = $post_row->post_type; 
     97                        $this->category = $post_row->post_category; 
     98                        $this->tags = stripslashes($post_row->post_tags); 
     99                        $this->title = stripslashes($post_row->post_title); 
     100                        $this->origUrl = $post_row->post_orig_url; 
     101                        $this->domain = $post_row->post_domain; 
     102                        $this->url = $post_row->post_url; 
     103                        $this->content = stripslashes($post_row->post_content); 
    104104                        $this->comments = $post_row->post_comments; 
    105105                        $this->subscribe = $post_row->post_subscribe; 
     
    155155                $sql = "INSERT INTO " . TABLE_POSTS . " SET post_author = %d, post_date = CURRENT_TIMESTAMP, post_status = %s, post_type = %s, post_category = %d, post_tags = %s, post_title = %s, post_orig_url = %s, post_domain = %s, post_url = %s, post_content = %s, post_subscribe = %d, post_updateby = %d"; 
    156156                 
    157                 $h->db->query($h->db->prepare($sql, $this->author, $this->status, urlencode($this->type), $this->category, urlencode(trim($this->tags)), urlencode(trim($this->title)), urlencode($this->origUrl), urlencode($this->domain), urlencode(trim($this->url)), urlencode(trim($this->content)), $this->subscribe, $h->currentUser->id)); 
     157                $h->db->query($h->db->prepare($sql, $this->author, $this->status, $this->type, $this->category, trim($this->tags), trim($this->title), $this->origUrl, $this->domain, trim($this->url), trim($this->content), $this->subscribe, $h->currentUser->id)); 
    158158                 
    159159                $last_insert_id = $h->db->get_var($h->db->prepare("SELECT LAST_INSERT_ID()")); 
     
    194194                $sql = "UPDATE " . TABLE_POSTS . " SET post_author = %d, post_status = %s, post_type = %s, post_category = %d, post_tags = %s, post_title = %s, post_orig_url = %s, post_domain = %s, post_url = %s, post_content = %s, post_subscribe = %d, post_comments = %s, post_updateby = %d WHERE post_id = %d"; 
    195195                 
    196                 $h->db->query($h->db->prepare($sql, $this->author, $this->status, urlencode($this->type), $this->category, urlencode(trim($this->tags)), urlencode(trim($this->title)), urlencode($this->origUrl), urlencode($this->domain), urlencode(trim($this->url)), urlencode(trim($this->content)), $this->subscribe, $this->comments, $h->currentUser->id, $this->id)); 
     196                $h->db->query($h->db->prepare($sql, $this->author, $this->status, $this->type, $this->category, trim($this->tags), trim($this->title), $this->origUrl, $this->domain, trim($this->url), trim($this->content), $this->subscribe, $this->comments, $h->currentUser->id, $this->id)); 
    197197                 
    198198                $h->post->id = $this->id; // a small hack to get the id for use in plugins. 
     
    282282        { 
    283283                $sql = "SELECT post_id, post_status FROM " . TABLE_POSTS . " WHERE post_orig_url = %s"; 
    284                 $posts = $h->db->get_results($h->db->prepare($sql, urlencode($url))); 
     284                $posts = $h->db->get_results($h->db->prepare($sql, $url)); 
    285285                 
    286286                if (!$posts) { return false; } 
     
    296296                // One last check to see if a post is present: 
    297297                $sql = "SELECT * FROM " . TABLE_POSTS . " WHERE post_orig_url = %s LIMIT 1"; 
    298                 $post = $h->db->get_row($h->db->prepare($sql, urlencode($url))); 
     298                $post = $h->db->get_row($h->db->prepare($sql, $url)); 
    299299                 
    300300                // if present return the first existing row 
     
    316316 
    317317                $sql = "SELECT post_id, post_status FROM " . TABLE_POSTS . " WHERE post_title = %s"; 
    318                 $posts = $h->db->get_results($h->db->prepare($sql, urlencode($title))); 
     318                $posts = $h->db->get_results($h->db->prepare($sql, $title)); 
    319319                 
    320320                if (!$posts) { return false; } 
     
    330330                // One last check to see if a post is present: 
    331331                $sql = "SELECT post_id FROM " . TABLE_POSTS . " WHERE post_title = %s LIMIT 1"; 
    332                 $post_id = $h->db->get_var($h->db->prepare($sql, urlencode($title))); 
     332                $post_id = $h->db->get_var($h->db->prepare($sql, $title)); 
    333333                 
    334334                if ($post_id) { return $post_id; } else { return false; } 
     
    345345        { 
    346346                $sql = "SELECT post_id FROM " . TABLE_POSTS . " WHERE post_url = %s LIMIT 1"; 
    347                 $post_id = $h->db->get_var($h->db->prepare($sql, urlencode($post_url))); 
     347                $post_id = $h->db->get_var($h->db->prepare($sql, $post_url)); 
    348348                if ($post_id) { return $post_id; } else { return false; } 
    349349        }