diff --git a/e107_admin/admin_log.php b/e107_admin/admin_log.php index 386d4461c..8a08e6696 100644 --- a/e107_admin/admin_log.php +++ b/e107_admin/admin_log.php @@ -1717,7 +1717,7 @@ if(isset($page_title[$action])) } // Now put up the events $delete_button = FALSE; - while($row = $sql->db_Fetch()) + while($row = $sql->fetch()) { $text .= ''; foreach($col_fields[$action] as $cf) diff --git a/e107_admin/administrator.php b/e107_admin/administrator.php index 48b892e46..1dc13e0aa 100644 --- a/e107_admin/administrator.php +++ b/e107_admin/administrator.php @@ -64,8 +64,8 @@ if (isset($_POST['edit_admin']) || $action == "edit") { $edid = array_keys($_POST['edit_admin']); $theid = intval(($sub_action < 0) ? $edid[0] : $sub_action); - if ((!$sql->db_Select("user", "*", "user_id=".$theid)) - || !($row = $sql->db_Fetch())) + if ((!$sql->select("user", "*", "user_id=".$theid)) + || !($row = $sql->fetch())) { $mes->addDebug("Couldn't find user ID: {$theid}, {$sub_action}, {$edid[0]}"); // Debug code - shouldn't be executed } @@ -76,8 +76,8 @@ if (isset($_POST['del_admin']) && count($_POST['del_admin'])) { $delid = array_keys($_POST['del_admin']); $aID = intval($delid[0]); - $sql->db_Select("user", "*", "user_id= ".$aID); - $row = $sql->db_Fetch(); + $sql->select("user", "*", "user_id= ".$aID); + $row = $sql->fetch(); if ($row['user_id'] == 1) { // Can't delete main admin @@ -92,7 +92,7 @@ if (isset($_POST['del_admin']) && count($_POST['del_admin'])) exit; } - $mes->addAuto($sql -> db_Update("user", "user_admin=0, user_perms='' WHERE user_id= ".$aID), 'update', ADMSLAN_61, LAN_DELETED_FAILED, false); + $mes->addAuto($sql->update("user", "user_admin=0, user_perms='' WHERE user_id= ".$aID), 'update', ADMSLAN_61, LAN_DELETED_FAILED, false); $logMsg = str_replace(array('[x]', '[y]'),array($aID, $row['user_name']),ADMSLAN_73); e107::getLog()->add('ADMIN_02',$logMsg,E_LOG_INFORMATIVE,''); } diff --git a/e107_admin/auth.php b/e107_admin/auth.php index 2ff7dc995..fc5e4796d 100644 --- a/e107_admin/auth.php +++ b/e107_admin/auth.php @@ -186,7 +186,7 @@ else if (in_array(varset($pref['user_audit_class'], ''), $class_list)) { - e107::getAdminLog()->user_audit(USER_AUDIT_LOGIN, 'Login via admin page', $row['user_id'], $row['user_name']); + e107::getAdminLog()->user_audit(USER_AUDIT_LOGIN, ['Login via admin page'], $row['user_id'], $row['user_name']); } $edata_li = array("user_id"=>$row['user_id'], "user_name"=>$row['user_name'], 'class_list'=>implode(',', $class_list), 'user_admin'=> $row['user_admin']); @@ -412,7 +412,8 @@ class auth * @param string $authname, entered name * @param string $authpass, entered pass * @param object $authresponse [optional] - * @return boolean if fail, else result array + * @return array if fail, 'authfail' will contain a message. + * */ public function authcheck($authname, $authpass, $authresponse = '') { diff --git a/e107_admin/banlist.php b/e107_admin/banlist.php index 304622250..a6a447ba2 100644 --- a/e107_admin/banlist.php +++ b/e107_admin/banlist.php @@ -1138,7 +1138,7 @@ if ($writeBanFile) if ($action == 'edit' || $action == 'whedit') { $sql->db_Select('banlist', '*', "banlist_ip='{$sub_action}'"); - $row = $sql->db_Fetch(); + $row = $sql->fetch(); extract($row); //FIXME - kill extract() } else @@ -1726,7 +1726,7 @@ switch ($action) $text .= " "; - while($row = $sql->db_Fetch()) + while($row = $sql->fetch()) { //extract($row);//FIXME - kill extract() $row['banlist_reason'] = str_replace('LAN_LOGIN_18', BANLAN_11, $row['banlist_reason']); @@ -1863,7 +1863,7 @@ function process_csv($filename, $override_imports, $override_expiry, $separator // echo "Read CSV: {$filename} separator: {$separator}, quote: {$quote} override imports: {$override_imports} override expiry: {$override_expiry}
"; // Renumber imported bans if ($override_imports) - $sql->db_Update('banlist', "`banlist_bantype`=".eIPHandler::BAN_TYPE_TEMPORARY." WHERE `banlist_bantype` = ".eIPHandler::BAN_TYPE_IMPORTED); + $sql->update('banlist', "`banlist_bantype`=".eIPHandler::BAN_TYPE_TEMPORARY." WHERE `banlist_bantype` = ".eIPHandler::BAN_TYPE_IMPORTED); $temp = file($filename); $line_num = 0; foreach ($temp as $line) @@ -1932,7 +1932,7 @@ function process_csv($filename, $override_imports, $override_expiry, $separator } // Success here - may need to delete old imported bans if ($override_imports) - $sql->db_Delete('banlist', "`banlist_bantype` = ".eIPHandler::BAN_TYPE_TEMPORARY); + $sql->delete('banlist', "`banlist_bantype` = ".eIPHandler::BAN_TYPE_TEMPORARY); @unlink($filename); // Delete file once done $mes->addSuccess(str_replace('[y]', $line_num, BANLAN_51).$filename); return str_replace('[y]', $line_num, BANLAN_51).$filename; diff --git a/e107_admin/banlist_export.php b/e107_admin/banlist_export.php index 68fcd71ed..96f107fba 100644 --- a/e107_admin/banlist_export.php +++ b/e107_admin/banlist_export.php @@ -79,7 +79,7 @@ function do_export($filename, $type_list='',$format_array=array(), $sep = ',', $ $qry = "SELECT * FROM `#banlist` "; if ($type_list != '') $qry .= " WHERE`banlist_bantype` IN ({$type_list})"; if (!$sql->gen($qry)) return 'No data: '.$qry; - while ($row = $sql->db_Fetch()) + while ($row = $sql->fetch()) { $line = ''; $spacer = ''; diff --git a/e107_admin/image.php b/e107_admin/image.php index fdae4fca1..873fa1748 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -507,7 +507,7 @@ class media_form_ui extends e_admin_form_ui if($this->resizeImage($path,$img_import_w,$img_import_h)) { - $info = $fl->get_file_info($path); + $info = $fl->getFileInfo($path); $mes->addSuccess(LAN_IMA_004.": ".basename($path)); $mes->addSuccess(print_a($info,true)); $dim = intval($info['img-width'])." x ".intval($info['img-height']); @@ -3045,7 +3045,7 @@ class media_admin_ui extends e_admin_ui $f = e107::getFile()->get_file_info($oldpath,TRUE); $mes->addDebug("checkDupe(): newpath=".$newpath."
oldpath=".$oldpath."
".print_r($newpath,TRUE)); - if(file_exists($newpath) || e107::getDb()->db_Select("core_media","*","media_url = '".$tp->createConstants($newpath,'rel')."' LIMIT 1") ) + if(file_exists($newpath) || e107::getDb()->select("core_media","*","media_url = '".$tp->createConstants($newpath,'rel')."' LIMIT 1") ) { $mes->addWarning($newpath." already exists."); $file = $f['pathinfo']['filename']."_.".$f['pathinfo']['extension']; @@ -3594,7 +3594,7 @@ if (isset($_POST['submit_show_deleteall'])) { $image_name = basename($image_name); $image_todb = $tp->toDB($image_name); - if (!$sql->db_Count('user', '(*)', "WHERE user_image='-upload-{$image_todb}' OR user_sess='{$image_todb}'")) { + if (!$sql->count('user', '(*)', "WHERE user_image='-upload-{$image_todb}' OR user_sess='{$image_todb}'")) { unlink(e_AVATAR_UPLOAD.$image_name); $imgList .= '[!br!]'.$image_name; $count++; @@ -3626,7 +3626,7 @@ if (isset($_POST['submit_avdelete_multi'])) $multiaction = $tp->filter($_POST['multiaction'], 'int'); //sql queries significant reduced - if(!empty($multiaction) && $sql->db_Select("user", 'user_id, user_name, user_image', "user_id IN (".implode(',', $multiaction).")")) + if(!empty($multiaction) && $sql->select("user", 'user_id, user_name, user_image', "user_id IN (".implode(',', $multiaction).")")) { $search_users = $sql->db_getList('ALL', FALSE, FALSE, 'user_id'); foreach($multiaction as $uid) @@ -3648,7 +3648,7 @@ if (isset($_POST['submit_avdelete_multi'])) //sql queries significant reduced if(!empty($uids)) { - $sql->db_Update("user", "user_image='' WHERE user_id IN (".implode(',', $uids).")"); + $sql->update("user", "user_image='' WHERE user_id IN (".implode(',', $uids).")"); } $mes->addSuccess(IMALAN_51.''.implode(', ', $tmp).' '.IMALAN_28); @@ -3703,13 +3703,13 @@ if (isset($_POST['check_avatar_sizes'])) // // Loop through avatar field for every user // - $iUserCount = $sql->db_Count("user"); + $iUserCount = $sql->count("user"); $found = false; $allowedWidth = intval($pref['im_width']); $allowedHeight = intval($pref['im_width']); - if ($sql->db_Select("user", "*", "user_image!=''")) { + if ($sql->select("user", "*", "user_image!=''")) { - while ($row = $sql->db_Fetch()) + while ($row = $sql->fetch()) { //Check size $avname=avatar($row['user_image']); diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 09b6834e3..236dd3577 100755 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -692,7 +692,7 @@ class adminstyle_infopanel if (e107::getDb()->gen($menu_qry)) { - while ($row = e107::getDb()->db_Fetch()) + while ($row = e107::getDb()->fetch()) { // Custom menu (core). if(is_numeric($row['menu_path'])) diff --git a/e107_admin/links.php b/e107_admin/links.php index 2d536bc4c..783c5980e 100644 --- a/e107_admin/links.php +++ b/e107_admin/links.php @@ -661,9 +661,9 @@ class links_admin_form_ui extends e_admin_form_ui { if(null === $this->current_parent) { - if(e107::getDb()->db_Select('links', 'link_name', 'link_id='.$current)) + if(e107::getDb()->select('links', 'link_name', 'link_id='.$current)) { - $tmp = e107::getDb()->db_Fetch(); + $tmp = e107::getDb()->fetch(); $this->current_parent = $tmp['link_name']; } } diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 07564f557..156d18c33 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -1337,7 +1337,7 @@ class news_admin_ui extends e_admin_ui $_POST['cat_id'] = $row['news_category']; $_POST['news_start'] = $row['news_start']; $_POST['news_end'] = $row['news_end']; - $_POST['comment_total'] = e107::getDb()->db_Count("comments", "(*)", " WHERE comment_item_id={$row['news_id']} AND comment_type='0'"); + $_POST['comment_total'] = e107::getDb()->count("comments", "(*)", " WHERE comment_item_id={$row['news_id']} AND comment_type='0'"); $_POST['news_render_type'] = $row['news_render_type']; $_POST['news_thumbnail'] = $row['news_thumbnail']; $_POST['news_meta_keywords'] = $row['news_meta_keywords']; diff --git a/e107_admin/search.php b/e107_admin/search.php index 9bdb4ab62..42437ecec 100644 --- a/e107_admin/search.php +++ b/e107_admin/search.php @@ -136,9 +136,9 @@ if (isset($_POST['update_handler'])) $search_prefs[$handler_type][$query[2]]['pre_title_alt'] = $tp -> toDB($_POST['pre_title_alt']); // $tmp = addslashes(serialize($search_prefs)); - $tmp = e107::getArrayStorage()->writeArray($search_prefs, true); + $tmp = e107::serialize($search_prefs, true); - $check = $sql -> db_Update("core", "e107_value='".$tmp."' WHERE e107_name='search_prefs'"); + $check = $sql ->update("core", "e107_value='".$tmp."' WHERE e107_name='search_prefs'"); if($check) { $mes->addSuccess(LAN_UPDATED); diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index 6b3fad260..6923eb533 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -1006,11 +1006,11 @@ function update_706_to_800($type='') // Leave this one here.. just in case.. //delete record for online_extended_menu (now only using one online menu) - if($sql->db_Select('menus', '*', "menu_path='online_extended_menu' || menu_path='online_extended_menu/'")) + if($sql->select('menus', '*', "menu_path='online_extended_menu' || menu_path='online_extended_menu/'")) { if ($just_check) return update_needed("The Menu table needs to have some paths corrected in its data."); - $row=$sql->db_Fetch(); + $row=$sql->fetch(); //if online_extended is activated, we need to activate the new 'online' menu, and delete this record if($row['menu_location']!=0) @@ -1028,7 +1028,7 @@ function update_706_to_800($type='') } //change menu_path for online_menu (if it still exists) - if($sql->db_Select('menus', 'menu_path', "menu_path='online_menu' || menu_path='online_menu/'")) + if($sql->select('menus', 'menu_path', "menu_path='online_menu' || menu_path='online_menu/'")) { if ($just_check) return update_needed('change menu_path for online menu'); @@ -1961,7 +1961,7 @@ function update_70x_to_706($type='') if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."tmp")) { - $row = $sql -> db_Fetch(); + $row = $sql ->fetch(); if (!in_array('tmp_ip', $row)) { if ($just_check) return update_needed(); @@ -2027,9 +2027,9 @@ function copy_user_timezone() e107::getMessage()->addDebug("Line:".__LINE__); // Created the field - now copy existing data - if ($sql->db_Select('user','user_id, user_timezone')) + if ($sql->select('user','user_id, user_timezone')) { - while ($row = $sql->db_Fetch()) + while ($row = $sql->fetch()) { $sql2->update('user_extended',"`user_timezone`='{$row['user_timezone']}' WHERE `user_extended_id`={$row['user_id']}"); } @@ -2075,7 +2075,7 @@ function addIndexToTable($target, $indexSpec, $just_check, &$updateMessages, $op if ($sql->gen("SHOW INDEX FROM ".MPREFIX.$target)) { $found = FALSE; - while ($row = $sql -> db_Fetch()) + while ($row = $sql ->fetch()) { // One index per field if (in_array($indexSpec, $row)) { diff --git a/e107_admin/upload.php b/e107_admin/upload.php index 5bbf3504b..36f849291 100644 --- a/e107_admin/upload.php +++ b/e107_admin/upload.php @@ -523,8 +523,8 @@ if (e_QUERY) if ($action == "dis" && isset($_POST['updelete']['upload_'.$id]) ) { - $res = $sql -> db_Select("upload", "*", "upload_id='".intval($id)."'"); - $row = $sql -> db_Fetch(); + $res = $sql ->select("upload", "*", "upload_id='".intval($id)."'"); + $row = $sql ->fetch(); if (preg_match("#Binary (.*?)/#", $row['upload_file'], $match)) { $sql -> db_Delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'"); @@ -535,7 +535,7 @@ if ($action == "dis" && isset($_POST['updelete']['upload_'.$id]) ) } if (preg_match("#Binary (.*?)/#", $row['upload_ss'], $match)) { - $sql -> db_Delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'"); + $sql ->delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'"); } else if ($row['upload_ss'] && file_exists(e_FILE."public/".$row['upload_ss'])) { diff --git a/e107_admin/users.php b/e107_admin/users.php index 4c5c049fe..1a892e2a8 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -1951,7 +1951,7 @@ class users_admin_ui extends e_admin_ui } // TODO - move to e_userinfo.php $obj = new convert; - $sql->db_Select("chatbox", "*", "cb_ip='$ipd' LIMIT 0,20"); + $sql->select("chatbox", "*", "cb_ip='$ipd' LIMIT 0,20"); $host = $e107->get_host_name($ipd); $text = USFLAN_3." ".$ipd." [ ".USFLAN_4.": $host ]
".USFLAN_5." @@ -1974,7 +1974,7 @@ class users_admin_ui extends e_admin_ui $text .= "
"; - $sql->db_Select("comments", "*", "comment_ip='$ipd' LIMIT 0,20"); + $sql->select("comments", "*", "comment_ip='$ipd' LIMIT 0,20"); while (list($comment_id, $comment_item_id, $comment_author, $comment_author_email, $comment_datestamp, $comment_comment, $comment_blocked, $comment_ip) = $sql->fetch()) { $datestamp = $obj->convert_date($comment_datestamp, "short"); diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index af95d5c13..f5cba9115 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -1634,6 +1634,7 @@ Inverse 10 10 /** * Old Admin Navigation Routine. */ + /* function sc_admin_navigationOld($parm=null) { @@ -1902,7 +1903,7 @@ Inverse 10 10 return e107::getNav()->admin('', $active, $menu_vars, $$tmpl, FALSE, FALSE); //return e_admin_men/u('', e_PAGE, $menu_vars, $$tmpl, FALSE, FALSE); } - +*/ /** * New Admin Navigation Routine. v2.1.5 diff --git a/e107_core/shortcodes/batch/user_shortcodes.php b/e107_core/shortcodes/batch/user_shortcodes.php index 793c508a4..c3d76355a 100644 --- a/e107_core/shortcodes/batch/user_shortcodes.php +++ b/e107_core/shortcodes/batch/user_shortcodes.php @@ -317,14 +317,11 @@ class user_shortcodes extends e_shortcode case 'location': return ($boot) ? $tp->toGlyph('fa-map-marker') : ''; break; - + + case 'msn': case 'icq': return ($boot) ? $tp->toGlyph('fa-comment') : ''; - break; - - case 'msn': - return ($boot) ? $tp->toGlyph('fa-comment') : ''; - break; + break; default: case 'realname': diff --git a/e107_core/shortcodes/single/news_categories.sc b/e107_core/shortcodes/single/news_categories.sc index f3c9b6fb1..0d4e0492a 100644 --- a/e107_core/shortcodes/single/news_categories.sc +++ b/e107_core/shortcodes/single/news_categories.sc @@ -126,7 +126,7 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols; return ''; } $cats = array(); - while ($row = $sql2->db_Fetch()) + while ($row = $sql2->fetch()) { if($row['ccount'] > 0) $cats[$row['category_id']] = $row; } diff --git a/e107_core/shortcodes/single/user_extended_old.sc b/e107_core/shortcodes/single/user_extended_old.sc index 88c7a4cbe..a01b941c9 100644 --- a/e107_core/shortcodes/single/user_extended_old.sc +++ b/e107_core/shortcodes/single/user_extended_old.sc @@ -117,9 +117,9 @@ if ($parms[1] == 'value') case EUF_DB_FIELD : // check for db_lookup type $tmp = explode(',',$ueStruct['user_'.$parms[0]]['user_extended_struct_values']); $sql_ue = new db; // Use our own DB object to avoid conflicts - if($sql_ue->db_Select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'")) + if($sql_ue->select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'")) { - $row = $sql_ue->db_Fetch(); + $row = $sql_ue->fetch(); $ret_data = $row[$tmp[2]]; } else diff --git a/e107_handlers/admin_log_class.php b/e107_handlers/admin_log_class.php index 31aca1159..6b8376e9e 100644 --- a/e107_handlers/admin_log_class.php +++ b/e107_handlers/admin_log_class.php @@ -415,7 +415,7 @@ class e_admin_log * @param array $event_data is an array of data fields whose keys and values are logged (usually user data, but doesn't have to be - can add messages here) * @param int $id * @param string $u_name - * both $id and $u_name are left blank except for admin edits and user login, where they specify the id and login name of the 'target' user + * both $id and $u_name are left blank except for admin edits and user login, where they specify the id and login name of the 'target' user * * @return bool */ diff --git a/e107_handlers/chart_class.php b/e107_handlers/chart_class.php index 991d98fe9..24a619609 100644 --- a/e107_handlers/chart_class.php +++ b/e107_handlers/chart_class.php @@ -577,21 +577,15 @@ class e_chart $js .= 'var myLine = new Chart(document.getElementById("'.$id.'").getContext("2d")).Bar(ChartData, ChartOptions);'; break; - case 'radar': - //TODO - break; - case 'polar': + case 'pie': + case 'radar': //TODO break; case 'doughnut': $js .= 'var myDoughnut = new Chart(document.getElementById("'.$id.'").getContext("2d")).Doughnut(ChartData, ChartOptions);'; break; - - case 'pie': - //TODO - break; default: case 'line': diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php index c6ef67844..7e728de7a 100644 --- a/e107_handlers/comment_class.php +++ b/e107_handlers/comment_class.php @@ -1464,7 +1464,7 @@ class comment } } - cachevars('e_comment', $data); + e107::setRegistry('e_comment', $data); return $data; } } diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php index c9c667333..c6616657b 100644 --- a/e107_handlers/core_functions.php +++ b/e107_handlers/core_functions.php @@ -152,10 +152,9 @@ function print_a($var, $return = FALSE) echo '
'.htmlspecialchars(print_r($var, TRUE), ENT_QUOTES, 'utf-8').'
'; return TRUE; } - else - { - return '
'.htmlspecialchars(print_r($var, true), ENT_QUOTES, 'utf-8').'
'; - } + + return '
'.htmlspecialchars(print_r($var, true), ENT_QUOTES, 'utf-8').'
'; + } function e_print($expr = null) @@ -186,14 +185,13 @@ function e_dump($expr = null) */ function strip_if_magic($data) { - if (MAGIC_QUOTES_GPC == true) + if (MAGIC_QUOTES_GPC === true) { return array_stripslashes($data); } - else - { - return $data; - } + + return $data; + } /** @@ -272,9 +270,8 @@ function echo_gzipped_page() if($encoding) { - $contents = ob_get_contents(); - ob_end_clean(); - header('Content-Encoding: '.$encoding); + $contents = ob_get_clean(); + header('Content-Encoding: '.$encoding); print("\x1f\x8b\x08\x00\x00\x00\x00\x00"); $size = strlen($contents); $contents = gzcompress($contents, 9); @@ -282,11 +279,10 @@ function echo_gzipped_page() print($contents); exit(); } - else - { - ob_end_flush(); - exit(); - } + + ob_end_flush(); + exit(); + } @@ -336,7 +332,7 @@ if (!function_exists('r_emote')) $value2 = substr($value, 0, strpos($value, " ")); $value = ($value2 ? $value2 : $value); - $value = ($value == '&|') ? ':((' : $value; + $value = ($value === '&|') ? ':((' : $value; $value = " ".$value." "; // $str .= "\n "; @@ -388,12 +384,12 @@ if (!function_exists('multiarray_sort')) if(!$natsort) { - ($order=='asc')? asort($sort_values) : arsort($sort_values); + ($order==='asc')? asort($sort_values) : arsort($sort_values); } elseif(isset($sort_values)) { $case ? natsort($sort_values) : natcasesort($sort_values); - if($order != 'asc') $sort_values = array_reverse($sort_values, true); + if($order !== 'asc') $sort_values = array_reverse($sort_values, true); } @@ -445,8 +441,9 @@ class e_array { return false; } - // Saftety mechanism for 0.7 -> 0.8 transition. - if(substr($ArrayData,0,2)=='a:' || substr($ArrayData,0,2)=='s:') // php serialize. + // Saftety mechanism for 0.7 -> 0.8 transition. + $first2Chars = substr($ArrayData,0,2); + if($first2Chars === 'a:' || $first2Chars === 's:') // php serialize. { $dat = unserialize($ArrayData); $ArrayData = $this->WriteArray($dat,FALSE); @@ -457,7 +454,7 @@ class e_array { // e107::getDebug()->log("Json data found"); - if(json_last_error() != JSON_ERROR_NONE && e_DEBUG === true && !e107::isCli()) + if(e_DEBUG === true && json_last_error() != JSON_ERROR_NONE && !e107::isCli()) { echo "

e107::unserialize() Parser Error (json)

"; echo "
";
@@ -478,12 +475,12 @@ class e_array {
 			$ArrayData = (string) substr($ArrayData,8);
 		}
 
-        if(strtolower(substr($ArrayData,0,5)) != 'array')
+        if(strtolower(substr($ArrayData,0,5)) !== 'array')
         {
             return false;
         }
 
-		if(strpos($ArrayData,"0 => \'")!=false)
+		if(strpos($ArrayData,"0 => \'")!==false)
 		{
              $ArrayData = stripslashes($ArrayData);
 		}
@@ -495,7 +492,7 @@ class e_array {
 	    $ArrayData = str_replace('=>','=>',$ArrayData); //FIX for PDO encoding of strings. .
 
 
-	    if(trim($ArrayData) == 'Array') // Something went wrong with storage.
+	    if(trim($ArrayData) === 'Array') // Something went wrong with storage.
         {
             $debug = debug_backtrace(false);
             e107::getMessage()->addDebug("Bad Array Storage found: ". print_a($debug,true));
@@ -586,7 +583,7 @@ class e_array {
 
         $Array = var_export($ArrayData, true);
 
-        if ($mode == true)
+        if ($mode === true)
         {
             $Array = addslashes($Array);
         }
diff --git a/e107_handlers/db_verify_class.php b/e107_handlers/db_verify_class.php
index 7fb77af2f..cc70fee45 100755
--- a/e107_handlers/db_verify_class.php
+++ b/e107_handlers/db_verify_class.php
@@ -1136,7 +1136,7 @@ class db_verify
 	function getSqlLanguages()
 	{
 		$sql = e107::getDb();
-		$list = $sql->db_TableList('lan');
+		$list = $sql->tables('lan');
 		
 		$array = array();
 		
diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php
index 5c88d61ef..27a1c30e8 100644
--- a/e107_handlers/e107_class.php
+++ b/e107_handlers/e107_class.php
@@ -3296,7 +3296,7 @@ class e107
 		$cstring  = 'corelan/'.e_LANGUAGE.'_'.$fname.($admin ? '_admin' : '_front');
 		if(self::getRegistry($cstring)) return null;
 
-		$fname = ($admin ? 'admin/' : '').'lan_'.preg_replace('/[^\w]/', '', trim($fname, '/')).'.php';
+		$fname = ($admin ? 'admin/' : '').'lan_'.preg_replace('/[\W]/', '', trim($fname, '/')).'.php';
 		$path = e_LANGUAGEDIR.e_LANGUAGE.'/'.$fname;
 
 		self::setRegistry($cstring, true);
@@ -3337,7 +3337,7 @@ class e107
 		$cstring  = 'pluglan/'.e_LANGUAGE.'_'.$plugin.'_'.$fname.($flat ? '_1' : '_0');
 		if(self::getRegistry($cstring)) return null;
 
-		$plugin = preg_replace('/[^\w]/', '', $plugin);
+		$plugin = preg_replace('/[\W]/', '', $plugin);
 
 		if($fname === 'global') // fix ambiguity
 		{
@@ -4927,7 +4927,7 @@ class e107
 
 	/**
 	 * Retrieve & cache host name
-	 * @deprecated but needed by some old plugins/menus.
+	 * @deprecated Use getIPHandler()->get_host_name() instead. Still needed by some old plugins/menus.
 	 * @todo Find old calls and replace with code within.
 	 * @param string $ip_address
 	 * @return string host name
diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index 7d692641c..7955432a0 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -15,7 +15,7 @@ if (!defined('e107_INIT')) { exit(); }
 // Directory for the hard-coded utf-8 handling routines
 define('E_UTF8_PACK', e_HANDLER.'utf8/');
 
-define("E_NL", chr(2));
+define('E_NL', chr(2));
 
 class e_parse extends e_parser
 {
@@ -116,7 +116,7 @@ class e_parse extends e_parser
 		);
 
 	// Super modifiers override default option values
-	protected	$e_SuperMods = array(
+	protected $e_SuperMods = array(
 				//text is part of a title (e.g. news title)
 				'TITLE' =>
 					array(
@@ -348,14 +348,12 @@ class e_parse extends e_parser
 	 */
 	public function ustrtoupper($str)
 	{
-		switch($this->utfAction)
+		if($this->utfAction === 1)
 		{
-
-			case 1:
-				return mb_strtoupper($str);
-			default:
-				return strtoupper($str);
+			return mb_strtoupper($str);
 		}
+		
+		return strtoupper($str);
 
 	}
 
@@ -374,15 +372,12 @@ class e_parse extends e_parser
 	 */
 	public function ustrpos($haystack, $needle, $offset = 0)
 	{
-		switch($this->utfAction)
+		if($this->utfAction === 1)
 		{
-
-			case 1:
-				return mb_strpos($haystack, $needle, $offset);
-			default:
-				return strpos($haystack, $needle, $offset);
+			return mb_strpos($haystack, $needle, $offset);
 		}
-
+		
+		return strpos($haystack, $needle, $offset);
 	}
 
 
@@ -400,15 +395,13 @@ class e_parse extends e_parser
 	 */
 	public function ustrrpos($haystack, $needle, $offset = 0)
 	{
-		switch($this->utfAction)
+		if($this->utfAction === 1)
 		{
-
-			case 1:
-				return mb_strrpos($haystack, $needle, $offset);
-			default:
-				return strrpos($haystack, $needle, $offset);
+			return mb_strrpos($haystack, $needle, $offset);
 		}
 
+		return strrpos($haystack, $needle, $offset);
+		
 	}
 
 
@@ -451,22 +444,12 @@ class e_parse extends e_parser
 	 */
 	public function usubstr($str, $start, $length = NULL)
 	{
-		switch($this->utfAction)
+		if($this->utfAction === 1)
 		{
-
-			case 1:
-				if(is_null($length))
-				{
-					return mb_substr($str, $start);
-				}
-				else
-				{
-					return mb_substr($str, $start, $length);
-				}
-
-			default:
-				return substr($str, $start, $length);
+			return ($length === null) ? mb_substr($str, $start) : mb_substr($str, $start, $length);				
 		}
+		
+		return substr($str, $start, $length);
 
 	}
 
@@ -508,7 +491,7 @@ class e_parse extends e_parser
 		}
 
 
-		if (MAGIC_QUOTES_GPC == true && $nostrip == false)
+		if (MAGIC_QUOTES_GPC === true && $nostrip === false)
 		{
 			$data = stripslashes($data);
 		}
@@ -633,10 +616,10 @@ class e_parse extends e_parser
 	 *	@return boolean TRUE if an unopened closing tag found
 	 *					FALSE if nothing found
 	 */
-	function htmlAbuseFilter($data, $tagList = '')
+	public function htmlAbuseFilter($data, $tagList = '')
 	{
 		
-		if ($tagList == '')
+		if (empty($tagList))
 		{
 			$checkTags = array('textarea', 'input', 'td', 'tr', 'table');
 		}
@@ -658,8 +641,11 @@ class e_parse extends e_parser
 		{
 			// $m[0] is the complete tag; $m[1] is '/' or empty; $m[2] is the tag and any attributes
 			list ($tag) = explode(' ', $m[2], 2);
-			if (!isset($tagArray[$tag])) continue;			// Not a tag of interest
-			if ($m[1] == '/')
+			if (!isset($tagArray[$tag]))
+			{
+				continue;
+			}            // Not a tag of interest
+			if ($m[1] === '/')
 			{	// Closing tag
 				if ($tagArray[$tag] == 0) 
 				{
@@ -676,7 +662,10 @@ class e_parse extends e_parser
 		//print_a($tagArray);
 		foreach ($tagArray as $t)
 		{
-			if ($t > 0) return TRUE;		// More opening tags than closing tags
+			if ($t > 0)
+			{
+				return TRUE;
+			}        // More opening tags than closing tags
 		}
 		return FALSE;						// OK now
 	}
@@ -703,7 +692,7 @@ class e_parse extends e_parser
 
 		foreach ($ret as $s)
 		{
-			if (substr($s, 0, 5) != '[code')
+			if (strpos($s, '[code') !== 0)
 			{
 				$vl = array();
 				$t = html_entity_decode(rawurldecode($s), ENT_QUOTES, CHARSET);
@@ -715,7 +704,7 @@ class e_parse extends e_parser
 					{
 						$vl[] = $vw;		// Add to list of words found
 					}
-					if (substr($vw, 0, 1) == '<')
+					if (strpos($vw, '<') === 0)
 					{
 						$vw = 'toHTML($text,true);
 			$search = array('"',''','\', '&',); // '&' must be last.
@@ -832,7 +821,7 @@ class e_parse extends e_parser
 	}
 
 
-	function post_toForm($text)
+	public function post_toForm($text)
 	{
 		if(is_array($text))
 		{
@@ -846,11 +835,11 @@ class e_parse extends e_parser
 		{
 			$text = stripslashes($text);
 		}
-		return str_replace(array("'", '"', "<", ">"), array("'", """, "<", ">"), $text);
+		return str_replace(array("'", '"', '<', '>'), array(''', '"', '<', '>'), $text);
 	}
 
 
-	function post_toHTML($text, $original_author = FALSE, $extra = '', $mod = FALSE)
+	public function post_toHTML($text, $original_author = FALSE, $extra = '', $mod = FALSE)
 	{
 		$text = $this->toDB($text, FALSE, FALSE, $mod, $original_author);
 		return $this->toHTML($text, TRUE, $extra);
@@ -863,12 +852,12 @@ class e_parse extends e_parser
 	 * @param object $eVars - XXX more info needed.
 	 * @return string
 	 */
-	function parseTemplate($text, $parseSCFiles = true, $extraCodes = null, $eVars = null)
+	public function parseTemplate($text, $parseSCFiles = true, $extraCodes = null, $eVars = null)
 	{
 
 		if(!is_bool($parseSCFiles))
 		{
-			trigger_error("\$parseSCFiles in parseTemplate() was given incorrect data");
+			trigger_error('$parseSCFiles in parseTemplate() was given incorrect data');
 		}
 
 		return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
@@ -895,18 +884,16 @@ class e_parse extends e_parser
 			{
 				return false;
 			}
-			else
-			{
-				return true;
-			}
-		/*	if(!strpos($code, 'return '))
-			{
-				return true;
-			}
-			else 
-			{
-				return false;
-			}*/
+
+			return true;
+			/*	if(!strpos($code, 'return '))
+				{
+					return true;
+				}
+				else
+				{
+					return false;
+				}*/
 		}		
 	}
 
@@ -920,7 +907,7 @@ class e_parse extends e_parser
 	 * @param string $replaceUnset string to be used if replace variable is not set, false - don't replace
 	 * @return string parsed content
 	 */
-	function simpleParse($template, $vars, $replaceUnset='')
+	public function simpleParse($template, $vars, $replaceUnset='')
 	{
 		$this->replaceVars = $vars;
 		$this->replaceUnset = $replaceUnset;
@@ -942,7 +929,7 @@ class e_parse extends e_parser
 	}
 
 
-	function htmlwrap($str, $width, $break = "\n", $nobreak = "a", $nobr = "pre", $utf = FALSE)
+	public function htmlwrap($str, $width, $break = "\n", $nobreak = 'a', $nobr = 'pre', $utf = FALSE)
 	{
 		/*
 		Pretty well complete rewrite to try and handle utf-8 properly.
@@ -955,25 +942,27 @@ class e_parse extends e_parser
 		//return $str;
 
 		// Don't wrap if non-numeric width
-		$width = intval($width);
+		$width = (int)$width;
 		// And trap stupid wrap counts
 		if ($width < 6)
+		{
 			return $str;
+		}
 
 		// Transform protected element lists into arrays
-		$nobreak = explode(" ", strtolower($nobreak));
+		$nobreak = explode(' ', strtolower($nobreak));
 
 		// Variable setup
 
 		$innbk = array();
-		$drain = "";
+		$drain = '';
 
 		// List of characters it is "safe" to insert line-breaks at
 		// It is not necessary to add < and > as they are automatically implied
 		$lbrks = "/?!%)-}]\\\"':;&";
 
 		// Is $str a UTF8 string?
-		if ($utf || strtolower(CHARSET) == 'utf-8')
+		if ($utf || strtolower(CHARSET) === 'utf-8')
 		{
 			// 0x1680, 0x180e, 0x2000-0x200a, 0x2028, 0x205f, 0x3000 are 'non-ASCII' Unicode UCS-4 codepoints - see http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
 			// All convert to 3-byte utf-8 sequences:
@@ -1001,7 +990,7 @@ class e_parse extends e_parser
 		$content = preg_split('#(<.*?'.'>)#mis', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
 		foreach($content as $value)
 		{
-			if ($value[0] == "<")
+			if ($value[0] === '<')
 			{
 				// We are within an HTML tag
 				// Create a lowercase copy of this tag's contents
@@ -1010,14 +999,16 @@ class e_parse extends e_parser
 				{
 					// Tag of non-zero length
 					// If the first character is not a / then this is an opening tag
-					if ($lvalue[0] != "/")
+					if ($lvalue[0] !== '/')
 					{
 						// Collect the tag name
 						preg_match("/^(\w*?)(\s|$)/", $lvalue, $t);
 
 						// If this is a protected element, activate the associated protection flag
 						if(in_array($t[1], $nobreak))
+						{
 							array_unshift($innbk, $t[1]);
+						}
 					}
 					else
 					{
@@ -1051,7 +1042,7 @@ class e_parse extends e_parser
 				if (!count($innbk))
 				{
 					// Use the ACK (006) ASCII symbol to replace all HTML entities temporarily
-					$value = str_replace("\x06", "", $value);
+					$value = str_replace("\x06", '', $value);
 					preg_match_all("/&([a-z\d]{2,7}|#\d{2,5});/i", $value, $ents);
 					$value = preg_replace("/&([a-z\d]{2,7}|#\d{2,5});/i", "\x06", $value);
 					//			echo "Found block length ".strlen($value).': '.substr($value,20).'
'; @@ -1088,7 +1079,9 @@ class e_parse extends e_parser for($i = strlen($matches[1]) - 1; $i >= 0; $i--) { if(strpos($lbrks, $matches[1][$i]) !== FALSE) + { break; + } } if($i < 0) { @@ -1114,7 +1107,9 @@ class e_parse extends e_parser { // No speed advantage to defining match character if (strpos($lbrks, $sp[$i-1]) !== FALSE) + { break; + } } if ($i == 0) { @@ -1138,7 +1133,9 @@ class e_parse extends e_parser } // Put captured HTML entities back into the string foreach ($ents[0] as $ent) + { $value = preg_replace("/\x06/", $ent, $value, 1); + } } } // Send the modified segment down the drain @@ -1162,7 +1159,7 @@ class e_parse extends e_parser * @param boolean $exact If false, $text will not be cut mid-word * @return string Trimmed string. */ - function html_truncate($text, $length = 100, $ending = '...', $exact = true) + public function html_truncate($text, $length = 100, $ending = '...', $exact = true) { if($this->ustrlen(preg_replace('/<.*?>/', '', $text)) <= $length) { @@ -1216,11 +1213,9 @@ class e_parse extends e_parser $truncate .= $this->usubstr($tag[3], 0, $left + $entitiesLength); break; } - else - { - $truncate .= $tag[3]; - $totalLength += $contentLength; - } + + $truncate .= $tag[3]; + $totalLength += $contentLength; if($totalLength >= $length) { break; @@ -1272,8 +1267,8 @@ class e_parse extends e_parser { switch($text [$pos] ) { - case "<": - if($text [$pos + 1] == "/") + case '<': + if($text [$pos + 1] === '/') { $closing_tag = TRUE; } @@ -1283,8 +1278,8 @@ class e_parse extends e_parser break; - case ">": - if($text [$pos - 1] == "/") + case '>': + if($text [$pos - 1] === '/') { $closing_tag = TRUE; } @@ -1298,10 +1293,10 @@ class e_parse extends e_parser break; - case "&": - if($text [$pos + 1] == "#") + case '&': + if($text [$pos + 1] === '#') { - $end = strpos(substr($text, $pos, 7), ";"); + $end = strpos(substr($text, $pos, 7), ';'); if($end !== FALSE) { $pos += ($end + 1); @@ -1333,7 +1328,7 @@ class e_parse extends e_parser $ret = ($tmp_pos > 0 ? substr($text, 0, $tmp_pos+1) : substr($text, 0, $pos)); if($pos < strlen($text)) { - $ret = $ret.$more; + $ret .= $more; } return $ret; } @@ -1381,7 +1376,7 @@ class e_parse extends e_parser } - function textclean ($text, $wrap = 100) + public function textclean ($text, $wrap = 100) { $text = str_replace("\n\n\n", "\n\n", $text); $text = $this->htmlwrap($text, $wrap); @@ -1393,7 +1388,7 @@ class e_parse extends e_parser // Test for text highlighting, and determine the text highlighting transformation // Returns TRUE if highlighting is active for this page display - function checkHighlighting() + public function checkHighlighting() { global $pref; @@ -1406,7 +1401,7 @@ class e_parse extends e_parser if(!isset($this->e_highlighting)) { $this->e_highlighting = FALSE; - $shr = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""); + $shr = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''); if($pref['search_highlight'] && (strpos(e_SELF, 'search.php') === FALSE) && ((strpos($shr, 'q=') !== FALSE) || (strpos($shr, 'p=') !== FALSE))) { $this->e_highlighting = TRUE; @@ -1448,7 +1443,7 @@ class e_parse extends e_parser switch($type) { default: - case "email": + case 'email': preg_match_all("#(?:[\n\r ]|^)?([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", $text, $match); @@ -1468,14 +1463,14 @@ class e_parse extends e_parser } break; - case "url": + case 'url': $linktext = (!empty($textReplace)) ? $textReplace : '$3'; $external = (!empty($opts['ext'])) ? 'target="_blank"' : ''; - $text= preg_replace("/(^|[\n \(])([\w]*?)([\w]*?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is", "$1$2".$linktext."", $text); - $text= preg_replace("/(^|[\n \(])([\w]*?)((www)\.[^ \,\"\t\n\r\)<]*)/is", "$1$2".$linktext."", $text); - $text= preg_replace("/(^|[\n ])([\w]*?)((ftp)\.[^ \,\"\t\n\r<]*)/is", "$1$2".$linktext."", $text); + $text= preg_replace("/(^|[\n \(])([\w]*?)([\w]*?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is", '$1$2' .$linktext. '', $text); + $text= preg_replace("/(^|[\n \(])([\w]*?)((www)\.[^ \,\"\t\n\r\)<]*)/is", '$1$2' .$linktext. '', $text); + $text= preg_replace("/(^|[\n ])([\w]*?)((ftp)\.[^ \,\"\t\n\r<]*)/is", '$1$2' .$linktext. '', $text); break; @@ -1489,7 +1484,7 @@ class e_parse extends e_parser - function parseBBCodes($text, $postID) + public function parseBBCodes($text, $postID) { if (!is_object($this->e_bb)) { @@ -1601,8 +1596,7 @@ class e_parse extends e_parser if(strpos($text,'[center]') === 0) // quick bc fix TODO Find a better solution. [center][/center] containing HTML. { - $text = str_replace("[center]","
",$text); - $text = str_replace("[/center]","
",$text); + $text = str_replace(array('[center]', '[/center]'), array("
", '
'), $text); } } @@ -1726,9 +1720,9 @@ class e_parse extends e_parser // $code_text = str_replace("\r\n", " ", $code_text); // $code_text = html_entity_decode($code_text, ENT_QUOTES, CHARSET); // $code_text = str_replace('&','&',$code_text); // validation safe. - $html_start = ""; // markers for html-to-bbcode replacement. - $html_end = ""; - $full_text = str_replace(array("[html]","[/html]"), "",$code_text); // quick fix.. security issue? + $html_start = ''; // markers for html-to-bbcode replacement. + $html_end = ''; + $full_text = str_replace(array('[html]', '[/html]'), '',$code_text); // quick fix.. security issue? $full_text = $this->parseBBCodes($full_text, $postID); // parse any embedded bbcodes eg. [img] $full_text = $this->replaceConstants($full_text,'abs'); // parse any other paths using {e_.... @@ -1903,7 +1897,7 @@ class e_parse extends e_parser if ($parseBB === TRUE) { // 'Normal' or 'legacy' processing - if($modifiers == "WYSIWYG") + if($modifiers === 'WYSIWYG') { $sub_blk = $this->e_bb->parseBBCodes($sub_blk, $postID, 'wysiwyg'); } @@ -1962,17 +1956,13 @@ class e_parse extends e_parser if ( varset($pref['tohtml_hook'])) { //Process the older tohtml_hook pref (deprecated) - foreach(explode(",", $pref['tohtml_hook']) as $hook) + foreach(explode(',', $pref['tohtml_hook']) as $hook) { - if (!is_object($this->e_hook[$hook])) + if (!is_object($this->e_hook[$hook]) && is_readable(e_PLUGIN . $hook . "/" . $hook . ".php")) { - if(is_readable(e_PLUGIN.$hook."/".$hook.".php")) - { - require_once(e_PLUGIN.$hook."/".$hook.".php"); - $hook_class = "e_".$hook; - $this->e_hook[$hook] = new $hook_class; - } - + require_once(e_PLUGIN.$hook."/".$hook.".php"); + $hook_class = "e_".$hook; + $this->e_hook[$hook] = new $hook_class; } if(is_object($this->e_hook[$hook])) // precaution for old plugins. @@ -1994,16 +1984,13 @@ class e_parse extends e_parser continue; } - if (empty($this->e_hook[$hook]) /*&& !is_object($this->e_hook[$hook])*/) + if (empty($this->e_hook[$hook]) && is_readable(e_PLUGIN . $hook . "/e_tohtml.php") /*&& !is_object($this->e_hook[$hook])*/) { - if(is_readable(e_PLUGIN.$hook."/e_tohtml.php")) - { - require_once(e_PLUGIN.$hook."/e_tohtml.php"); + require_once(e_PLUGIN.$hook."/e_tohtml.php"); - $hook_class = "e_tohtml_".$hook; + $hook_class = "e_tohtml_".$hook; - $this->e_hook[$hook] = new $hook_class; - } + $this->e_hook[$hook] = new $hook_class; } if(is_object( $this->e_hook[$hook])) @@ -2047,12 +2034,9 @@ class e_parse extends e_parser // Search highlighting - if ($opts['emotes']) // Why?? + if ($opts['emotes'] && $this->checkHighlighting()) // Why?? { - if ($this->checkHighlighting()) - { - $sub_blk = $this->e_highlight($sub_blk, $this->e_query); - } + $sub_blk = $this->e_highlight($sub_blk, $this->e_query); } @@ -2093,8 +2077,8 @@ class e_parse extends e_parser foreach($this->blockTags as $val) { - $srch[] = "
"; - $repl[] = ""; + $srch[] = '
'; + $repl[] = ''; } $ret_parser = str_replace($srch, $repl, $ret_parser); @@ -2156,7 +2140,7 @@ class e_parse extends e_parser } - function toASCII($text) + public function toASCII($text) { $char_map = array( @@ -2231,7 +2215,7 @@ class e_parse extends e_parser * @param string $text * @example echo "Hello"; */ - function toAttribute($text) + public function toAttribute($text) { // URLs posted without HTML access may have an & in them. @@ -2258,8 +2242,8 @@ class e_parse extends e_parser */ public function toJS($stringarray) { - $search = array("\r\n", "\r", "
", "'"); - $replace = array("\\n", "", "\\n", "\'"); + $search = array("\r\n", "\r", '
', "'"); + $replace = array("\\n", '', "\\n", "\'"); $stringarray = str_replace($search, $replace, $stringarray); $stringarray = strip_tags($stringarray); @@ -2403,7 +2387,7 @@ class e_parse extends e_parser $output = array(); foreach($var as $k => $v) { - $output[] = $this->toJSONhelper(strval($k)) . ':' . $this->toJSONhelper($v); + $output[] = $this->toJSONhelper((string)$k) . ':' . $this->toJSONhelper($v); } return '{' . implode(', ', $output) . '}'; @@ -2420,7 +2404,7 @@ class e_parse extends e_parser * @param boolean $tags [optional] * @return string */ - function toRss($text, $tags = false) + public function toRss($text, $tags = false) { if($tags != true) { @@ -2430,15 +2414,15 @@ class e_parse extends e_parser $text = $this->toEmail($text); - $search = array("&#039;", "&#036;", "'", "$", e_BASE, "href='request.php","",""); - $replace = array("'", '$', "'", '$', SITEURL, "href='".SITEURL."request.php", '', '' ); + $search = array('&#039;', '&#036;', ''', '$', e_BASE, "href='request.php", '', ''); + $replace = array("'", '$', "'", '$', SITEURL, "href='".SITEURL. 'request.php', '', '' ); $text = str_replace($search, $replace, $text); $text = $this->ampEncode($text); if($tags == true && ($text)) { - $text = ""; + $text = ''; } return $text; @@ -2451,7 +2435,7 @@ class e_parse extends e_parser * @param string $value * @return int|float */ - function toNumber($value) + public function toNumber($value) { // adapted from: https://secure.php.net/manual/en/function.floatval.php#114486 $dotPos = strrpos($value, '.'); @@ -2460,12 +2444,12 @@ class e_parse extends e_parser ((($commaPos > $dotPos) && $commaPos) ? $commaPos : false); if (!$sep) { - return preg_replace("/[^-0-9]/", "", $value); + return preg_replace('/[^-0-9]/', '', $value); } return ( - preg_replace("/[^-0-9]/", "", substr($value, 0, $sep)) . '.' . - preg_replace("/[^0-9]/", "", substr($value, $sep+1, strlen($value))) + preg_replace('/[^-0-9]/', '', substr($value, 0, $sep)) . '.' . + preg_replace('/[^0-9]/', '', substr($value, $sep+1, strlen($value))) ); } @@ -2476,11 +2460,11 @@ class e_parse extends e_parser * @param string $text * @return mixed|string */ - function ampEncode($text='') + public function ampEncode($text='') { // Fix any left-over '&' - $text = str_replace('&', '&', $text); //first revert any previously converted. - $text = str_replace('&', '&', $text); + //first revert any previously converted. + $text = str_replace(array('&', '&'), array('&', '&'), $text); return $text; } @@ -2491,7 +2475,7 @@ class e_parse extends e_parser * @param $text * @return mixed|string */ - function toText($text) + public function toText($text) { if($this->isBBcode($text) === true) // convert any bbcodes to html @@ -2502,12 +2486,12 @@ class e_parse extends e_parser if($this->isHtml($text) === true) // strip any html. { $text = $this->toHTML($text,true); - $text = str_replace("\n","",$text); // clean-out line-breaks. - $text = str_ireplace( array("
","
","
"), "\n", $text); + $text = str_replace("\n", '',$text); // clean-out line-breaks. + $text = str_ireplace( array('
', '
', '
'), "\n", $text); $text = strip_tags($text); } - $search = array("&#039;", "&#036;", "'", "$", "\", "&#092;"); + $search = array('&#039;', '&#036;', ''', '$', '\', '&#092;'); $replace = array("'", '$', "'", '$', "\\", "\\"); $text = str_replace($search, $replace, $text); return $text; @@ -2648,7 +2632,8 @@ class e_parse extends e_parser if(!empty($options['type'])) { - $ext = $newOpts['type'] = $options['type']; + $newOpts['type'] = $options['type']; + $ext = $newOpts['type']; } @@ -2686,7 +2671,7 @@ class e_parse extends e_parser if($log !== null) { file_put_contents(e_LOG.$log, "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n", FILE_APPEND); - $message = "Name: ".$fname."\n"; + $message = 'Name: ' .$fname."\n"; $message .= $path."\n".var_export($newOpts,true)."\n\n\n"; file_put_contents(e_LOG.$log, $message, FILE_APPEND); @@ -2711,10 +2696,10 @@ class e_parse extends e_parser } elseif($val !== false) { - $this->staticCount = $this->staticCount + (int) $val; + $this->staticCount += (int)$val; } - return (int) $count; + return $count; } @@ -2734,10 +2719,8 @@ class e_parse extends e_parser { return !empty($opts['full']) ? SITEURL : e_HTTP; } - else - { - return !empty($opts['full']) ? self::replaceConstants($path, 'full') : self::replaceConstants($path, 'abs'); // self::replaceConstants($path, 'full'); - } + + return !empty($opts['full']) ? $this->replaceConstants($path, 'full') : $this->replaceConstants($path, 'abs'); // self::replaceConstants($path, 'full'); } $staticArray = $this->staticUrl; // e_HTTP_STATIC; @@ -2769,7 +2752,7 @@ class e_parse extends e_parser $base = ''; - $path = self::replaceConstants($path, 'abs'); // replace any {THEME} etc. + $path = $this->replaceConstants($path, 'abs'); // replace any {THEME} etc. $srch = array( e_PLUGIN_ABS, @@ -2831,7 +2814,7 @@ class e_parse extends e_parser return $this->replaceConstants($url, 'abs'); } - if(strpos($url,"{e_") === 0) // Fix for broken links that use {e_MEDIA} etc. + if(strpos($url, '{e_') === 0) // Fix for broken links that use {e_MEDIA} etc. { //$url = $this->replaceConstants($url,'abs'); // always switch to 'nice' urls when SC is used @@ -2858,7 +2841,10 @@ class e_parse extends e_parser $raw = true; } - if($raw) $url = $this->createConstants($url, 'mix'); + if($raw) + { + $url = $this->createConstants($url, 'mix'); + } $baseurl = ($full ? SITEURL : e_HTTP).'thumb.php?'; @@ -2973,13 +2959,13 @@ class e_parse extends e_parser * @param $src * @return array */ - function thumbUrlDecode($src) + public function thumbUrlDecode($src) { - list($url,$qry) = array_pad(explode("?",$src), 2, null); + list($url,$qry) = array_pad(explode('?',$src), 2, null); $ret = array(); - if(strstr($url,"thumb.php") && !empty($qry)) // Regular + if(strstr($url, 'thumb.php') && !empty($qry)) // Regular { parse_str($qry,$val); $ret = $val; @@ -3009,7 +2995,7 @@ class e_parse extends e_parser } elseif(defined('TINYMCE_DEBUG')) { - print_a("thumbUrlDecode: No Matches"); + print_a('thumbUrlDecode: No Matches'); } @@ -3025,10 +3011,11 @@ class e_parse extends e_parser * @param int|string|array $width - desired size in px or '2x' or '3x' or null for all or array ( * @return string */ - function thumbSrcSet($src='', $width=null) + public function thumbSrcSet($src='', $width=null) { $multiply = null; $encode = false; + $parm = array(); if(is_array($width)) { @@ -3040,7 +3027,7 @@ class e_parse extends e_parser // $encode = $this->thumbEncode();; - if($width == null || $width=='all') + if($width == null || $width === 'all') { $links = array(); $mag = ($width == null) ? array(1, 2) : array(160,320,460,600,780,920,1100); @@ -3049,14 +3036,14 @@ class e_parse extends e_parser $w = ($this->thumbWidth * $v); $h = ($this->thumbHeight * $v); - $att = (!empty($this->thumbCrop)) ? array('aw' => $w, 'ah' => $h) : array('w' => $w, 'h' => $h); + $att = (!empty($this->thumbCrop)) ? array('aw' => $w, 'ah' => $h) : compact('w', 'h'); $att['x'] = $encode; - $add = ($width == null) ? " ".$v."x" : " ".$v."w"; + $add = ($width == null) ? ' ' .$v. 'x' : ' ' .$v. 'w'; $links[] = $this->thumbUrl($src, $att).$add; // " w".$width; // } - return implode(", ",$links); + return implode(', ',$links); } elseif($multiply === '2x' || $multiply === '3x' || $multiply === '4x') @@ -3066,7 +3053,7 @@ class e_parse extends e_parser if(empty($parm['w']) && isset($parm['h'])) { $parm['h'] = ($parm['h'] * $multiInt) ; - return $this->thumbUrl($src, $parm)." ".$multiply; + return $this->thumbUrl($src, $parm). ' ' .$multiply; } if(isset($parm['w']) && !isset($parm['h'])) // if w set, assume h value of 0 is set. @@ -3123,7 +3110,7 @@ class e_parse extends e_parser $ret = $this->thumbUrl($src, $parms); - $ret .= ($multiply) ? " ".$multiply : " ".$width."w"; + $ret .= ($multiply) ? ' ' .$multiply : ' ' .$width. 'w'; return $ret; @@ -3163,7 +3150,7 @@ class e_parse extends e_parser if(!empty($options['x']) && !empty($options['ext'])) // base64 encoded. Build URL for: RewriteRule ^media\/img\/([-A-Za-z0-9+/]*={0,3})\.(jpg|gif|png)?$ thumb.php?id=$1 { $ext = strtolower($options['ext']); - return $base.'media/img/'.base64_encode($options['thurl']).'.'.str_replace("jpeg", "jpg", $ext); + return $base.'media/img/'.base64_encode($options['thurl']).'.'.str_replace('jpeg', 'jpg', $ext); } elseif(strstr($url, 'e_MEDIA_IMAGE')) // media images. { @@ -3278,7 +3265,7 @@ class e_parse extends e_parser } - function getEmotes() + public function getEmotes() { return $this->e_emote->emotes; } @@ -3309,36 +3296,36 @@ class e_parse extends e_parser return $new; } - if($mode != "") + if($mode != '') { $e107 = e107::getInstance(); $replace_relative = array( - $e107->getFolder('media_files'), - $e107->getFolder('media_video'), - $e107->getFolder('media_image'), - $e107->getFolder('media_icon'), - $e107->getFolder('avatars'), - $e107->getFolder('web_js'), - $e107->getFolder('web_css'), - $e107->getFolder('web_image'), + $e107::getFolder('media_files'), + $e107::getFolder('media_video'), + $e107::getFolder('media_image'), + $e107::getFolder('media_icon'), + $e107::getFolder('avatars'), + $e107::getFolder('web_js'), + $e107::getFolder('web_css'), + $e107::getFolder('web_image'), //$e107->getFolder('web_pack'), e_IMAGE_ABS, e_THEME_ABS, - $e107->getFolder('images'), - $e107->getFolder('plugins'), - $e107->getFolder('files'), - $e107->getFolder('themes'), + $e107::getFolder('images'), + $e107::getFolder('plugins'), + $e107::getFolder('files'), + $e107::getFolder('themes'), // $e107->getFolder('downloads'), - $e107->getFolder('handlers'), - $e107->getFolder('media'), - $e107->getFolder('web'), - $e107->site_theme ? $e107->getFolder('themes').$e107->site_theme.'/' : '', + $e107::getFolder('handlers'), + $e107::getFolder('media'), + $e107::getFolder('web'), + $e107->site_theme ? $e107::getFolder('themes').$e107->site_theme.'/' : '', defset('THEME_ABS'), - (ADMIN ? $e107->getFolder('admin') : ''), + (ADMIN ? $e107::getFolder('admin') : ''), '', - $e107->getFolder('core'), - $e107->getFolder('system'), + $e107::getFolder('core'), + $e107::getFolder('system'), ); switch ($mode) @@ -3414,22 +3401,22 @@ class e_parse extends e_parser '{e_WEB_CSS}', '{e_WEB_IMAGE}', // '{e_WEB_PACK}', - "{e_IMAGE_ABS}", - "{e_THEME_ABS}", - "{e_IMAGE}", - "{e_PLUGIN}", - "{e_FILE}", - "{e_THEME}", + '{e_IMAGE_ABS}', + '{e_THEME_ABS}', + '{e_IMAGE}', + '{e_PLUGIN}', + '{e_FILE}', + '{e_THEME}', //,"{e_DOWNLOAD}" - "{e_HANDLER}", - "{e_MEDIA}", - "{e_WEB}", - "{THEME}", - "{THEME_ABS}", - "{e_ADMIN}", - "{e_BASE}", - "{e_CORE}", - "{e_SYSTEM}", + '{e_HANDLER}', + '{e_MEDIA}', + '{e_WEB}', + '{THEME}', + '{THEME_ABS}', + '{e_ADMIN}', + '{e_BASE}', + '{e_CORE}', + '{e_SYSTEM}', ); /*if (ADMIN) @@ -3451,7 +3438,7 @@ class e_parse extends e_parser $replace_relative[] = ''; $replace_absolute[] = ''; } - $search[] = "{USERID}"; + $search[] = '{USERID}'; } // current THEME @@ -3470,7 +3457,7 @@ class e_parse extends e_parser $search[] = "{THEME_ABS}"; }*/ - $replace = ((string)$mode == "full" || (string)$mode=='abs' ) ? $replace_absolute : $replace_relative; + $replace = ((string)$mode === 'full' || (string)$mode === 'abs' ) ? $replace_absolute : $replace_relative; return str_replace($search,$replace,$text); } @@ -3494,7 +3481,7 @@ class e_parse extends e_parser } - function doReplace($matches) + public function doReplace($matches) { if(defined($matches[1]) && (deftrue('ADMIN') || strpos($matches[1], 'ADMIN') === FALSE)) { @@ -3530,26 +3517,26 @@ class e_parse extends e_parser { case 0: // folder name only. $tmp = array( - '{e_MEDIA_FILE}' => $e107->getFolder('media_files'), - '{e_MEDIA_VIDEO}' => $e107->getFolder('media_videos'), - '{e_MEDIA_IMAGE}' => $e107->getFolder('media_images'), - '{e_MEDIA_ICON}' => $e107->getFolder('media_icons'), - '{e_AVATAR}' => $e107->getFolder('avatars'), - '{e_WEB_JS}' => $e107->getFolder('web_js'), - '{e_WEB_CSS}' => $e107->getFolder('web_css'), - '{e_WEB_IMAGE}' => $e107->getFolder('web_images'), - // '{e_WEB_PACK}' => $e107->getFolder('web_packs'), + '{e_MEDIA_FILE}' => $e107::getFolder('media_files'), + '{e_MEDIA_VIDEO}' => $e107::getFolder('media_videos'), + '{e_MEDIA_IMAGE}' => $e107::getFolder('media_images'), + '{e_MEDIA_ICON}' => $e107::getFolder('media_icons'), + '{e_AVATAR}' => $e107::getFolder('avatars'), + '{e_WEB_JS}' => $e107::getFolder('web_js'), + '{e_WEB_CSS}' => $e107::getFolder('web_css'), + '{e_WEB_IMAGE}' => $e107::getFolder('web_images'), + // '{e_WEB_PACK}' => $e107::getFolder('web_packs'), - '{e_IMAGE}' => $e107->getFolder('images'), - '{e_PLUGIN}' => $e107->getFolder('plugins'), - '{e_FILE}' => $e107->getFolder('files'), - '{e_THEME}' => $e107->getFolder('themes'), - '{e_DOWNLOAD}' => $e107->getFolder('downloads'), - '{e_ADMIN}' => $e107->getFolder('admin'), - '{e_HANDLER}' => $e107->getFolder('handlers'), - '{e_MEDIA}' => $e107->getFolder('media'), - '{e_WEB}' => $e107->getFolder('web'), - '{e_UPLOAD}' => $e107->getFolder('uploads'), + '{e_IMAGE}' => $e107::getFolder('images'), + '{e_PLUGIN}' => $e107::getFolder('plugins'), + '{e_FILE}' => $e107::getFolder('files'), + '{e_THEME}' => $e107::getFolder('themes'), + '{e_DOWNLOAD}' => $e107::getFolder('downloads'), + '{e_ADMIN}' => $e107::getFolder('admin'), + '{e_HANDLER}' => $e107::getFolder('handlers'), + '{e_MEDIA}' => $e107::getFolder('media'), + '{e_WEB}' => $e107::getFolder('web'), + '{e_UPLOAD}' => $e107::getFolder('uploads'), ); break; @@ -3671,7 +3658,7 @@ class e_parse extends e_parser //FIXME - $match not used? - function e_highlight($text, $match) + public function e_highlight($text, $match) { $tags = array(); preg_match_all('#<[^>]+>#', $text, $tags); @@ -3693,7 +3680,7 @@ class e_parse extends e_parser * @param boolean $posted - if the text has been posted. (uses stripslashes etc) * @param string $mods - flags for text transformation. */ - public function toEmail($text, $posted = "", $mods = "parse_sc, no_make_clickable") + public function toEmail($text, $posted = '', $mods = 'parse_sc, no_make_clickable') { if ($posted === TRUE) { @@ -3704,11 +3691,11 @@ class e_parse extends e_parser $text = preg_replace('#\[(php)#i', '[\\1', $text); } - $text = (strtolower($mods) != "rawtext") ? $this->replaceConstants($text, "full") : $text; + $text = (strtolower($mods) !== 'rawtext') ? $this->replaceConstants($text, 'full') : $text; if($this->isHtml($text)) { - $text = str_replace(array("[html]","[/html]"), "", $text); + $text = str_replace(array('[html]', '[/html]'), '', $text); $text = html_entity_decode( $text, ENT_COMPAT, 'UTF-8'); } else @@ -3731,7 +3718,7 @@ class e_parse extends e_parser * @param null $subject [optional] default subject for email. * @return string */ - function emailObfuscate($email, $words = null, $subject =null) + public function emailObfuscate($email, $words = null, $subject =null) { if(strpos($email, '@') === false) { @@ -3747,7 +3734,7 @@ class e_parse extends e_parser if(empty($words)) { - $words = "@"; + $words = '@'; $user = "data-user='".$this->obfuscate($name)."'"; $dom = "data-dom='".$this->obfuscate($address)."'"; } @@ -3757,7 +3744,7 @@ class e_parse extends e_parser $dom = ''; } - $url = "mailto:".$email.$subject; + $url = 'mailto:' .$email.$subject; $safe = $this->obfuscate($url); @@ -3776,7 +3763,7 @@ class e_parse extends e_parser $ret = ''; foreach (str_split($text) as $letter) { - switch (rand(1, 3)) + switch (mt_rand(1, 3)) { // HTML entity code case 1: @@ -3933,7 +3920,7 @@ class e_parser /** * Used by e_parse to start */ - function init() + public function init() { if(defined('FONTAWESOME')) @@ -4066,7 +4053,7 @@ class e_parser */ public function leadingZeros($num,$numDigits) { - return (string) sprintf("%0".$numDigits."d",$num); + return (string) sprintf('%0' .$numDigits. 'd',$num); } /** @@ -4077,7 +4064,7 @@ class e_parser * @example $tp->lanVars("My name is [x] and I own a [y]", array("John","Cat")); * @return string */ - function lanVars($lan, $vals, $bold=false) + public function lanVars($lan, $vals, $bold=false) { $array = (!is_array($vals)) ? array('x'=>$vals) : $vals; @@ -4094,8 +4081,8 @@ class e_parser $k = $defaults[$k]; } - $search[] = "[".$k."]"; - $replace[] = ($bold===true) ? "".$v."" : $v; + $search[] = '[' .$k. ']'; + $replace[] = ($bold===true) ? '' .$v. '' : $v; } return str_replace($search, $replace, $lan); @@ -4112,7 +4099,7 @@ class e_parser if($header == false) { - $html = "".$html.""; + $html = '' .$html. ''; } $doc = $this->domObj; @@ -4121,7 +4108,7 @@ class e_parser libxml_use_internal_errors(true); $doc->loadHTML($html); - $tg = explode(",", $taglist); + $tg = explode(',', $taglist); $ret = array(); foreach($tg as $find) @@ -4136,7 +4123,7 @@ class e_parser { $tag = $node->nodeName; $inner = $node->C14N(); - $inner = str_replace(" ","",$inner); + $inner = str_replace(' ', '',$inner); foreach ($node->attributes as $attr) { @@ -4174,7 +4161,7 @@ class e_parser * @example $tp->toGlyph('fa-spinner', array('spin'=>1)); * @example $tp->toGlyph('fa-shield', array('rotate'=>90, 'size'=>'2x')); */ - public function toGlyph($text, $options=" ") + public function toGlyph($text, $options= ' ') { if(empty($text)) @@ -4197,7 +4184,7 @@ class e_parser $parm = array(); } - if(substr($text,0,2) === 'e-') // e107 admin icon. + if(strpos($text, 'e-') === 0) // e107 admin icon. { $size = (substr($text,-3) === '-32') ? 'S32' : 'S16'; @@ -4206,7 +4193,7 @@ class e_parser $size = 'S24'; } - return ""; + return ""; } // Get Glyph names. @@ -4266,23 +4253,23 @@ class e_parser $size = (vartrue($parm['size'])) ? ' fa-'.$parm['size'] : ''; $tag = 'i'; $spin = !empty($parm['spin']) ? ' fa-spin' : ''; - $rotate = !empty($parm['rotate']) ? ' fa-rotate-'.intval($parm['rotate']) : ''; - $fixedW = !empty($parm['fw']) ? ' fa-fw' : ""; + $rotate = !empty($parm['rotate']) ? ' fa-rotate-'. (int)$parm['rotate'] : ''; + $fixedW = !empty($parm['fw']) ? ' fa-fw' : ''; if($this->fontawesome === 5) { $fab = e107::getMedia()->getGlyphs('fab'); - $fas = e107::getMedia()->getGlyphs('fas');; + $fas = e107::getMedia()->getGlyphs('fas'); $code = substr($id,3); if(in_array($code,$fab)) { - $prefix = "fab "; + $prefix = 'fab '; } elseif(in_array($code,$fas)) { - $prefix = "fas "; + $prefix = 'fas '; } } @@ -4300,7 +4287,7 @@ class e_parser { $prefix = 'glyphicon '; $tag = 'span'; - $id = str_replace("icon-", "glyphicon-", $id); + $id = str_replace('icon-', 'glyphicon-', $id); } else { @@ -4315,7 +4302,7 @@ class e_parser { if(strpos($text, $glyphConfig['prefix']) === 0) { - $prefix = $glyphConfig['class'] . " "; + $prefix = $glyphConfig['class'] . ' '; $tag = $glyphConfig['tag']; continue; } @@ -4326,12 +4313,12 @@ class e_parser $idAtt = (!empty($parm['id'])) ? "id='".$parm['id']."' " : ''; $style = (!empty($parm['style'])) ? "style='".$parm['style']."' " : ''; - $class = (!empty($parm['class'])) ? $parm['class']." " : ''; - $placeholder = isset($parm['placeholder']) ? $parm['placeholder'] : ""; + $class = (!empty($parm['class'])) ? $parm['class']. ' ' : ''; + $placeholder = isset($parm['placeholder']) ? $parm['placeholder'] : ''; $title = (!empty($parm['title'])) ? " title='".$this->toAttribute($parm['title'])."' " : ''; - $text = "<".$tag." {$idAtt}class='".$class.$prefix.$id.$size.$spin.$rotate.$fixedW."' ".$style.$title.">".$placeholder."" ; - $text .= ($options !== false) ? $options : ""; + $text = '<' .$tag." {$idAtt}class='".$class.$prefix.$id.$size.$spin.$rotate.$fixedW."' ".$style.$title. '>' .$placeholder. ''; + $text .= ($options !== false) ? $options : ''; return $text; @@ -4346,9 +4333,9 @@ class e_parser */ public function toBadge($text, $parm=null) { - $class = !empty($parm['class']) ? " ".$parm['class'] : ' badge-secondary'; + $class = !empty($parm['class']) ? ' ' .$parm['class'] : ' badge-secondary'; - return "".$text.""; + return "".$text. ''; } @@ -4364,15 +4351,15 @@ class e_parser $type = 'default'; } - $tmp = explode(",",$text); + $tmp = explode(',',$text); $opt = array(); foreach($tmp as $v) { - $opt[] = "".$v.""; + $opt[] = "".$v. ''; } - return implode(" ",$opt); + return implode(' ',$opt); } /** @@ -4387,7 +4374,7 @@ class e_parser '{e_PLUGIN}' => 'e_PLUGIN/' ); - $link = e_HTTP."request.php?file=". str_replace(array_keys($srch), $srch,$text); + $link = e_HTTP. 'request.php?file=' . str_replace(array_keys($srch), $srch,$text); if(!empty($parm['raw'])) { @@ -4419,7 +4406,7 @@ class e_parser { $tp = e107::getParser(); $width = !empty($options['w']) ? intval($options['w']) : $tp->thumbWidth; - $height = ($tp->thumbHeight !== 0) ? $tp->thumbHeight : ""; + $height = ($tp->thumbHeight !== 0) ? $tp->thumbHeight : ''; $crop = !empty($options['crop']) ? $options['crop'] : $tp->thumbCrop; $linkStart = ''; $linkEnd = ''; @@ -4437,8 +4424,8 @@ class e_parser if(!empty($options['hd'])) // Fix resolution on Retina display. { - $width = $width * 2; - $height = $height * 2; + $width *= 2; + $height *= 2; } @@ -4454,24 +4441,24 @@ class e_parser $image = (!empty($userData['user_image'])) ? varset($userData['user_image']) : null; - $genericFile = e_IMAGE."generic/blank_avatar.jpg"; - $genericImg = $tp->thumbUrl($genericFile,"w=".$width."&h=".$height,true, $full); + $genericFile = e_IMAGE. 'generic/blank_avatar.jpg'; + $genericImg = $tp->thumbUrl($genericFile, 'w=' .$width. '&h=' .$height,true, $full); if (!empty($image)) { - if(strpos($image,"://")!==false) // Remote Image + if(strpos($image, '://')!==false) // Remote Image { $url = $image; } - elseif(substr($image,0,8) == "-upload-") + elseif(strpos($image, "-upload-") === 0) { $image = substr($image,8); // strip the -upload- from the beginning. if(file_exists(e_AVATAR_UPLOAD.$image)) { $file = e_AVATAR_UPLOAD.$image; - $url = $tp->thumbUrl($file,"w=".$width."&h=".$height."&crop=".$crop, false, $full); + $url = $tp->thumbUrl($file, 'w=' .$width. '&h=' .$height. '&crop=' .$crop, false, $full); } else { @@ -4482,7 +4469,7 @@ class e_parser elseif(file_exists(e_AVATAR_DEFAULT.$image)) // User-Uplaoded Image { $file = e_AVATAR_DEFAULT.$image; - $url = $tp->thumbUrl($file,"w=".$width."&h=".$height."&crop=".$crop, false, $full); + $url = $tp->thumbUrl($file, 'w=' .$width. '&h=' .$height. '&crop=' .$crop, false, $full); } else // Image Missing. { @@ -4515,11 +4502,11 @@ class e_parser if(($url == $genericImg) && !empty($userData['user_id'] ) && (($userData['user_id'] == USERID)) && !empty($options['link'])) { $linkStart = ""; - $linkEnd = ""; + $linkEnd = ''; } $title = (ADMIN) ? $image : $tp->toAttribute($userData['user_name']); - $shape = (!empty($options['shape'])) ? "img-".$options['shape'] : "img-rounded rounded"; + $shape = (!empty($options['shape'])) ? 'img-' .$options['shape'] : 'img-rounded rounded'; if(!empty($options['type']) && $options['type'] === 'url') @@ -4533,15 +4520,15 @@ class e_parser } $heightInsert = empty($height) ? '' : "height='".$height."'"; - $id = (!empty($options['id'])) ? "id='".$options['id']."' " : ""; + $id = (!empty($options['id'])) ? "id='".$options['id']."' " : ''; - $classOnline = (!empty($userData['user_currentvisit']) && intval($userData['user_currentvisit']) > (time() - 300)) ? " user-avatar-online" : ''; + $classOnline = (!empty($userData['user_currentvisit']) && intval($userData['user_currentvisit']) > (time() - 300)) ? ' user-avatar-online' : ''; - $class = !empty($options['class']) ? $options['class'] : $shape." user-avatar"; + $class = !empty($options['class']) ? $options['class'] : $shape. ' user-avatar'; $style = !empty($options['style']) ? " style='".$options['style']."'" : ''; $text = $linkStart; - $text .= "\"".$title."\""; + $text .= '\"".$title."\"'; $text .= $linkEnd; // return $url; return $text; @@ -4568,7 +4555,7 @@ class e_parser // return "
Use \$tp->toImage() instead of toIcon() for ".$icon."
"; // debug info only. // } - if(substr($icon,0,3) == 'toGlyph($icon,$parm); } @@ -4625,7 +4612,7 @@ class e_parser $alt = (!empty($parm['alt'])) ? $this->toAttribute($parm['alt']) : basename($path); $class = (!empty($parm['class'])) ? $parm['class'] : 'icon'; - return "".$alt.""; + return "".$alt."'; } @@ -4643,7 +4630,7 @@ class e_parser if(strpos($file,'e_AVATAR')!==false) { - return "
Use \$tp->toAvatar() instead of toImage() for ".$file."
"; // debug info only. + return "
Use \$tp->toAvatar() instead of toImage() for ".$file. '
'; // debug info only. } @@ -4731,7 +4718,7 @@ class e_parser { $log = e107::getAdminLog(); $log->addDebug('Broken Image Path: '.$legacyPath."\n".print_r(debug_backtrace(null,2), true), false)->save('IMALAN_00'); - e107::getDebug()->log("Broken Image Path: ".$legacyPath); + e107::getDebug()->log('Broken Image Path: ' .$legacyPath); } } @@ -4745,24 +4732,24 @@ class e_parser $path = $tp->thumbUrl($file,$parm); } - $id = (!empty($parm['id'])) ? "id=\"".$parm['id']."\" " : "" ; - $class = (!empty($parm['class'])) ? $parm['class'] : "img-responsive img-fluid"; + $id = (!empty($parm['id'])) ? 'id="' .$parm['id']. '" ' : ''; + $class = (!empty($parm['class'])) ? $parm['class'] : 'img-responsive img-fluid'; $alt = (!empty($parm['alt'])) ? $tp->toAttribute($parm['alt']) : basename($file); - $style = (!empty($parm['style'])) ? "style=\"".$parm['style']."\" " : "" ; - $srcset = (!empty($parm['srcset'])) ? "srcset=\"".$parm['srcset']."\" " : ""; - $width = (!empty($parm['w'])) ? "width=\"".intval($parm['w'])."\" " : ""; - $title = (!empty($parm['title'])) ? "title=\"".$parm['title']."\" " : ""; - $height = !empty($parm['h']) ? "height=\"".intval($parm['h'])."\" " : ""; - $loading = !empty($parm['loading']) ? "loading=\"".$parm['loading']."\" " : ""; // eg. lazy, eager, auto + $style = (!empty($parm['style'])) ? 'style="' .$parm['style']. '" ' : ''; + $srcset = (!empty($parm['srcset'])) ? 'srcset="' .$parm['srcset']. '" ' : ''; + $width = (!empty($parm['w'])) ? 'width="' . (int)$parm['w'] . '" ' : ''; + $title = (!empty($parm['title'])) ? 'title="' .$parm['title']. '" ' : ''; + $height = !empty($parm['h']) ? 'height="' . (int)$parm['h'] . '" ' : ''; + $loading = !empty($parm['loading']) ? 'loading="' .$parm['loading']. '" ' : ''; // eg. lazy, eager, auto if(isset($parm['width'])) // width attribute override (while retaining w) { - $width = "width=\"".$parm['width']."\" " ; + $width = 'width="' .$parm['width']. '" '; } if(isset($parm['height'])) // height attribute override (while retaining h) { - $height = "height=\"".$parm['height']."\" " ; + $height = 'height="' .$parm['height']. '" '; } $html = ''; @@ -4787,7 +4774,7 @@ class e_parser $html .= "\n"; } - $html .= "\"".$alt."\""; + $html .= "' .$alt. ''; $html .= ($this->convertToWebP) ? "\n" : ''; @@ -4801,7 +4788,7 @@ class e_parser * @param $text * @return bool */ - function isBBcode($text) + public function isBBcode($text) { if(preg_match('#(?<=<)\w+(?=[^<]*?>)#', $text)) { @@ -4830,7 +4817,7 @@ class e_parser * @param $text * @return bool */ - function isHtml($text) + public function isHtml($text) { if(strpos($text,'[html]') !==false) @@ -4866,7 +4853,7 @@ class e_parser return false; } - if(substr($text,0,1) === '{' || substr($text,0,1) === '[') // json + if(strpos($text, '{') === 0 || strpos($text, '[') === 0) // json { $dat = json_decode($text, true); @@ -4931,7 +4918,7 @@ class e_parser * @param $file string * @return boolean */ - function isVideo($file) + public function isVideo($file) { $ext = pathinfo($file,PATHINFO_EXTENSION); @@ -4944,9 +4931,9 @@ class e_parser * @param $file string * @return boolean */ - function isImage($file) + public function isImage($file) { - if(substr($file,0,3)=="{e_") + if(strpos($file, "{e_") === 0) { $file = e107::getParser()->replaceConstants($file); } @@ -4970,8 +4957,8 @@ class e_parser $mime = varset($parm['mime'], 'audio/mpeg'); - $autoplay = !empty($parm['autoplay']) ? "autoplay " : ""; - $controls = !empty($parm['controls']) ? "controls" : ""; + $autoplay = !empty($parm['autoplay']) ? 'autoplay ' : ''; + $controls = !empty($parm['controls']) ? 'controls' : ''; $text = '
", "", $value); - $value = str_replace('

', "__E_PARSER_CLEAN_HTML_LINE_BREAK__", $value); + $value = str_replace(array('', '

'), array('', '__E_PARSER_CLEAN_HTML_LINE_BREAK__'), $value); } elseif($node->nodeName === 'code') { $value = preg_replace('/^]*>/', '', $value); - $value = str_replace("", "", $value); - $value = str_replace("

", "__E_PARSER_CLEAN_HTML_LINE_BREAK__", $value); + $value = str_replace(array('', '

'), array('', '__E_PARSER_CLEAN_HTML_LINE_BREAK__'), $value); } - $value = str_replace('__E_PARSER_CLEAN_HTML_CURLY_OPEN__', '{{{', $value); // temporarily change {e_XXX} to {{{e_XXX}}} - $value = str_replace('__E_PARSER_CLEAN_HTML_CURLY_CLOSED__', '}}}', $value); // temporarily change {e_XXX} to {{{e_XXX}}} + // temporarily change {e_XXX} to {{{e_XXX}}} + $value = str_replace(array('__E_PARSER_CLEAN_HTML_CURLY_OPEN__', '__E_PARSER_CLEAN_HTML_CURLY_CLOSED__'), array('{{{', '}}}'), $value); // temporarily change {e_XXX} to {{{e_XXX}}} $newNode = $doc->createElement($node->nodeName); @@ -5745,18 +5725,16 @@ return; $cleaned = $doc->saveHTML($doc->documentElement); // $doc->documentElement fixes utf-8/entities issue. @see http://stackoverflow.com/questions/8218230/php-domdocument-loadhtml-not-encoding-utf-8-correctly // Workaround for https://bugs.php.net/bug.php?id=76285 // Part 2 of 2 - $cleaned = str_replace("\n", "", $cleaned); - $cleaned = str_replace("__E_PARSER_CLEAN_HTML_LINE_BREAK__", "\n", $cleaned); + // prevent replacement of   with spaces. - convert back. - $cleaned = str_replace('__E_PARSER_CLEAN_HTML_NON_BREAKING_SPACE__', ' ', $cleaned); // prevent replacement of   with spaces. - convert back. + // convert shortcode temporary triple-curly braces back to entities. + // convert shortcode temporary triple-curly braces back to entities. - $cleaned = str_replace('{{{','{', $cleaned); // convert shortcode temporary triple-curly braces back to entities. - $cleaned = str_replace('}}}','}', $cleaned); // convert shortcode temporary triple-curly braces back to entities. - - $cleaned = str_replace("__E_PARSER_CLEAN_HTML_CURLY_OPEN__","{", $cleaned); - $cleaned = str_replace("__E_PARSER_CLEAN_HTML_CURLY_CLOSED__","}", $cleaned); - - $cleaned = str_replace(array('','','',''),'', $cleaned); // filter out tags. + $cleaned = str_replace( + array("\n", '__E_PARSER_CLEAN_HTML_LINE_BREAK__', '__E_PARSER_CLEAN_HTML_NON_BREAKING_SPACE__', '{{{', '}}}', '__E_PARSER_CLEAN_HTML_CURLY_OPEN__', '__E_PARSER_CLEAN_HTML_CURLY_CLOSED__', '', '', '', ''), + array('', "\n", ' ', '{', '}', '{', '}', '', '', '', ''), + $cleaned + ); // filter out tags. return trim($cleaned); } @@ -5777,7 +5755,7 @@ return; * @param $value string * @return bool true/false */ - function invalidAttributeValue($value) + public function invalidAttributeValue($value) { @@ -5906,18 +5884,18 @@ class e_emotefilter private $singleSearch = array(); private $singleReplace = array(); - function __construct() + public function __construct() { $pref = e107::getPref(); if(empty($pref['emotepack'])) { - $pref['emotepack'] = "default"; + $pref['emotepack'] = 'default'; e107::getConfig('emote')->clearPrefCache('emote'); e107::getConfig('core')->set('emotepack','default')->save(false,true,false); } - $this->emotes = e107::getConfig("emote")->getPref(); + $this->emotes = e107::getConfig('emote')->getPref(); if(empty($this->emotes)) { @@ -5939,31 +5917,31 @@ class e_emotefilter // Next two probably to sort out legacy issues - may not be required any more // $key = preg_replace("#_(\w{3})$#", ".\\1", $key); - $key = str_replace("!", "_", $key); + $key = str_replace('!', '_', $key); - $filename = e_IMAGE."emotes/" . $pref['emotepack'] . "/" . $key; + $filename = e_IMAGE. 'emotes/' . $pref['emotepack'] . '/' . $key; - $fileloc = $base.e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" . $key; + $fileloc = $base.e_IMAGE_ABS. 'emotes/' . $pref['emotepack'] . '/' . $key; $alt = str_replace(array('.png','.gif', '.jpg'),'', $key); if(file_exists($filename)) { - $tmp = explode(" ", $value); + $tmp = explode(' ', $value); foreach($tmp as $code) { - $img = "\"".$alt."\""; + $img = "\"".$alt.'; $this->search[] = "\n".$code; $this->replace[] = "\n".$img; - $this->search[] = " ".$code; - $this->replace[] = " ".$img; + $this->search[] = ' ' .$code; + $this->replace[] = ' ' .$img; - $this->search[] = ">".$code; // Fix for emote within html. - $this->replace[] = ">".$img; + $this->search[] = '>' .$code; // Fix for emote within html. + $this->replace[] = '>' .$img; $this->singleSearch[] = $code; $this->singleReplace[] = $img; @@ -6012,7 +5990,7 @@ class e_emotefilter } - function filterEmotes($text) + public function filterEmotes($text) { if(empty($text)) @@ -6030,7 +6008,7 @@ class e_emotefilter } - function filterEmotesRev($text) + public function filterEmotesRev($text) { return str_replace($this->replace, $this->search, $text); } @@ -6041,16 +6019,16 @@ class e_profanityFilter { protected $profanityList; - function __construct() + public function __construct() { global $pref; - $words = explode(",", $pref['profanity_words']); + $words = explode(',', $pref['profanity_words']); $word_array = array(); foreach($words as $word) { $word = trim($word); - if($word != "") + if($word != '') { $word_array[] = $word; if (strpos($word, '$') !== FALSE) @@ -6067,7 +6045,7 @@ class e_profanityFilter return TRUE; } - function filterProfanities($text) + public function filterProfanities($text) { global $pref; if (!$this->profanityList) @@ -6077,14 +6055,12 @@ class e_profanityFilter if ($pref['profanity_replace']) { return preg_replace("#\b".$this->profanityList."\b#is", $pref['profanity_replace'], $text); - } - else - { - return preg_replace_callback("#\b".$this->profanityList."\b#is", array($this, 'replaceProfanities'), $text); } + + return preg_replace_callback("#\b".$this->profanityList."\b#is", array($this, 'replaceProfanities'), $text); } - function replaceProfanities($matches) + public function replaceProfanities($matches) { /*! @function replaceProfanities callback @@ -6093,7 +6069,7 @@ class e_profanityFilter @result filtered text */ - return preg_replace("#a|e|i|o|u#i", "*" , $matches[0]); + return preg_replace('#a|e|i|o|u#i', '*', $matches[0]); } } @@ -6103,7 +6079,7 @@ class e_profanityFilter */ class textparse { - function editparse($text, $mode = "off") + public function editparse($text, $mode = 'off') { if(E107_DBG_DEPRECATED) { @@ -6113,7 +6089,7 @@ class textparse { return e107::getParser()->toForm($text); } - function tpa($text, $mode = '', $referrer = '', $highlight_search = false, $poster_id = '') + public function tpa($text, $mode = '', $referrer = '', $highlight_search = false, $poster_id = '') { if(E107_DBG_DEPRECATED) { @@ -6123,7 +6099,7 @@ class textparse { return e107::getParser()->toHTML($text, true, $mode, $poster_id); } - function tpj($text) + public function tpj($text) { if(E107_DBG_DEPRECATED) @@ -6134,7 +6110,7 @@ class textparse { return $text; } - function formtpa($text, $mode = '') + public function formtpa($text, $mode = '') { if(E107_DBG_DEPRECATED) @@ -6147,7 +6123,7 @@ class textparse { return e107::getParser()->toDB($text); } - function formtparev($text) + public function formtparev($text) { if(E107_DBG_DEPRECATED) diff --git a/e107_handlers/e_upgrade_class.php b/e107_handlers/e_upgrade_class.php index c9a328224..f39f6474c 100644 --- a/e107_handlers/e_upgrade_class.php +++ b/e107_handlers/e_upgrade_class.php @@ -124,9 +124,9 @@ class e_upgrade { $pref = e107::getPref(); $sql = e107::getDB(); - if($sql -> db_Select_Gen("SELECT * FROM #plugin WHERE plugin_installflag = 1 AND plugin_releaseUrl !=''")) + if($sql ->gen("SELECT * FROM #plugin WHERE plugin_installflag = 1 AND plugin_releaseUrl !=''")) { - while($row = $sql-> db_Fetch()) + while($row = $sql->fetch()) { $options = array('curFolder' => $row['plugin_path'], 'curVersion' => $row['plugin_version'], 'releaseUrl' => $row['plugin_releaseUrl']); $this->setOptions($options); diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index b242d7959..24b84ef38 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -3647,29 +3647,22 @@ var_dump($select_options);*/ case 'create': case 'import': case 'submit': + case 'execute': case 'success': $class = 'btn-success'; break; - case 'checkall': - $class = 'btn-default'; - break; - - case 'cancel': - $class = 'btn-default'; - break; - case 'delete': case 'danger': $class = 'btn-danger'; break; - case 'execute': - $class = 'btn-success'; - break; - case 'other': case 'login': + case 'batch e-hide-if-js': + case 'filter e-hide-if-js': + case 'batch': + case 'filter': case 'primary': $class = 'btn-primary'; break; @@ -3679,17 +3672,9 @@ var_dump($select_options);*/ $class = 'btn-warning'; break; - case 'batch': - case 'batch e-hide-if-js': - $class = 'btn-primary'; - break; - - case 'filter': - case 'filter e-hide-if-js': - $class = 'btn-primary'; - break; - case 'default': + case 'checkall': + case 'cancel': default: $class = 'btn-default'; break; diff --git a/e107_handlers/iphandler_class.php b/e107_handlers/iphandler_class.php index a4de7c79c..e0a3861c2 100644 --- a/e107_handlers/iphandler_class.php +++ b/e107_handlers/iphandler_class.php @@ -1369,7 +1369,7 @@ class banlistManager if ($sql->gen($qry)) { - while ($row = $sql->db_Fetch()) + while ($row = $sql->fetch()) { $row['banlist_ip'] = $this->trimWildcard($row['banlist_ip']); if ($row['banlist_ip'] == '') continue; // Ignore empty IP addresses @@ -1655,7 +1655,7 @@ class banlistManager if ($row = $ourDb->fetch()) { // @todo check next line - $writeDb->db_Update('banlist', + $writeDb->update('banlist', '`banlist_banexpires` = '.intval($row['banlist_banexpires'] + $pref['ban_durations'][$row['banlist_banreason']])); $numRet++; } diff --git a/e107_handlers/js_manager.php b/e107_handlers/js_manager.php index 05461d794..c195746a7 100644 --- a/e107_handlers/js_manager.php +++ b/e107_handlers/js_manager.php @@ -692,11 +692,8 @@ class e_jsmanager case 'front': return ($this->isInAdmin()) ? true : false; break; - + case 'none': - return true; - break; - default: return true; break; diff --git a/e107_handlers/mail_manager_class.php b/e107_handlers/mail_manager_class.php index 10f5ebb21..8b38c5517 100644 --- a/e107_handlers/mail_manager_class.php +++ b/e107_handlers/mail_manager_class.php @@ -1672,7 +1672,7 @@ class e107MailManager */ public function getNextEmailStatus() { - $result = $this->db->db_Fetch(); + $result = $this->db->fetch(); if (is_array($result)) { return $this->dbToMail($result); } return FALSE; } @@ -1742,7 +1742,7 @@ class e107MailManager */ public function getNextTargetStatus() { - $result = $this->db2->db_Fetch(); + $result = $this->db2->fetch(); if (is_array($result)) { return $this->dbToTarget($result); } return FALSE; } diff --git a/e107_handlers/mailout_class.php b/e107_handlers/mailout_class.php index 77405a79a..9daaf9db8 100644 --- a/e107_handlers/mailout_class.php +++ b/e107_handlers/mailout_class.php @@ -227,7 +227,7 @@ class core_mailout { $sql = e107::getDb(); - if (!($row = $sql->db_Fetch())) return FALSE; + if (!($row = $sql->fetch())) return FALSE; $ret = array('mail_recipient_id' => $row['user_id'], 'mail_recipient_name' => $row['user_name'], // Should this use realname? 'mail_recipient_email' => $row['user_email'], diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 7bbf9de6e..50206fc69 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -905,7 +905,7 @@ class e_media $sql = e107::getDb(); // $mes->addDebug("checkDupe(): newpath=".$newpath."
oldpath=".$oldpath."
".print_r($upload,TRUE)); - if(file_exists($newpath) && ($f = e107::getFile()->get_file_info($oldpath,TRUE))) + if(file_exists($newpath) && ($f = e107::getFile()->getFileInfo($oldpath,TRUE))) { $this->log($newpath." already exists and will be renamed during import."); $mes->addWarning($newpath." already exists and was renamed during import."); @@ -1262,10 +1262,8 @@ class e_media return FALSE; } - $info = e107::getFile()->get_file_info($path); - + $info = e107::getFile()->getFileInfo($path); - $this->log("File info for $path : ".print_r($info,true)); return array( diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php index 81fa4cccf..9bb219af0 100644 --- a/e107_handlers/menu_class.php +++ b/e107_handlers/menu_class.php @@ -61,7 +61,7 @@ class e_menu * Constructor * */ - function __construct() + public function __construct() { } @@ -80,13 +80,13 @@ class e_menu } // print_a($eMenuArea); - if(varset($_SERVER['E_DEV_MENU']) == 'true') // New in v2.x Experimental + if(varset($_SERVER['E_DEV_MENU']) === 'true') // New in v2.x Experimental { $layouts = e107::getPref('menu_layouts'); if(!is_array($layouts)) { $converted = $this->convertMenuTable(); - e107::getConfig('core')->set('menu_layouts', $converted)->save(); + e107::getConfig()->set('menu_layouts', $converted)->save(); } $eMenuArea = $this->getData(THEME_LAYOUT); @@ -145,7 +145,7 @@ class e_menu { $layout = vartrue($row['menu_layout'],'default'); $location = $row['menu_location']; - $data[$layout][$location][] = array('name'=>$row['menu_name'],'class'=> intval($row['menu_class']),'path'=>$row['menu_path'],'pages'=>$row['menu_pages'],'parms'=>$row['menu_parms']); + $data[$layout][$location][] = array('name'=>$row['menu_name'],'class'=> (int)$row['menu_class'],'path'=>$row['menu_path'],'pages'=>$row['menu_pages'],'parms'=>$row['menu_parms']); } return $data; @@ -203,6 +203,8 @@ class e_menu { return array(); } + + $ret = array(); foreach($mpref[$layout] as $area=>$v) { @@ -210,7 +212,7 @@ class e_menu foreach($v as $val) { - $class = intval($val['class']); + $class = (int)$val['class']; if(!check_class($class)) { @@ -255,7 +257,7 @@ class e_menu public function setParms($plugin, $menu, $parms=array(), $location = 'all') { $qry = 'menu_parms="'.e107::serialize($parms).'" WHERE menu_parms="" AND menu_path="'.$plugin.'/" AND menu_name="'.$menu.'" '; - $qry .= ($location != 'all') ? 'menu_location='.intval($location) : ''; + $qry .= ($location !== 'all') ? 'menu_location='. (int)$location : ''; return e107::getDb()->update('menus', $qry); } @@ -414,7 +416,7 @@ class e_menu * Returns true if a menu is currently active. * @param string $menuname (without the '_menu.php' ) */ - function isLoaded($menuname) + public function isLoaded($menuname) { if(empty($menuname)) { @@ -440,12 +442,7 @@ class e_menu protected function isFrontPage() { - if(e_REQUEST_SELF == SITEURL) - { - return true; - } - - return false; + return e_REQUEST_SELF == SITEURL; } @@ -481,7 +478,7 @@ class e_menu foreach($pagelist as $p) { - if($p == 'FRONTPAGE' && $this->isFrontPage()) + if($p === 'FRONTPAGE' && $this->isFrontPage()) { $show_menu = true; break; @@ -508,7 +505,7 @@ class e_menu $show_menu = true; foreach($pagelist as $p) { - if($p == 'FRONTPAGE' && $this->isFrontPage()) + if($p === 'FRONTPAGE' && $this->isFrontPage()) { $show_menu = false; break; @@ -516,7 +513,7 @@ class e_menu $p = $tp->replaceConstants($p, 'full'); - if(substr($p, -1)=='!') + if(substr($p, -1) === '!') { $p = substr($p, 0, -1); if(substr($check_url, strlen($p)*-1) == $p) @@ -558,7 +555,7 @@ class e_menu $buffer_output = (E107_DBG_INCLUDES) ? false : true; // Turn off when trouble-shooting includes. Default - return all output. - if(isset($tmp[1])&&$tmp[1]=='echo') + if(isset($tmp[1])&&$tmp[1] === 'echo') { $buffer_output = false; } @@ -580,9 +577,7 @@ class e_menu e107::getRender()->eMenuArea = null; if($buffer_output) { - $ret = ob_get_contents(); - ob_end_clean(); - return $ret; + return ob_get_clean(); } } @@ -631,7 +626,7 @@ class e_menu if(is_numeric($mpath) || ($mname === false)) // Custom Page/Menu { - $query = ($mname === false) ? "menu_name = '".$mpath."' " : "page_id=".intval($mpath)." "; // load by ID or load by menu-name (menu_name) + $query = ($mname === false) ? "menu_name = '".$mpath."' " : "page_id=". (int)$mpath ." "; // load by ID or load by menu-name (menu_name) $sql->select("page", "*", $query); $page = $sql->fetch(); @@ -659,7 +654,7 @@ class e_menu // echo "TEMPLATE= ($mpath)".$page['menu_template']; $ns->setUniqueId('cmenu-'.$page['menu_name']); - $caption .= e107::getForm()->instantEditButton(e_ADMIN_ABS."cpage.php?mode=menu&action=edit&tab=2&id=".intval($page['page_id']),'J'); + $caption .= e107::getForm()->instantEditButton(e_ADMIN_ABS."cpage.php?mode=menu&action=edit&tab=2&id=". (int)$page['page_id'],'J'); $ns->tablerender($caption, $text, 'cmenu-'.$page['menu_template']); } @@ -705,9 +700,7 @@ class e_menu if($return) { - $ret = ob_get_contents(); - ob_end_clean(); - return $ret; + return ob_get_clean(); } unset($pref); diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php index bf2859b79..e8c9afa65 100644 --- a/e107_handlers/menumanager_class.php +++ b/e107_handlers/menumanager_class.php @@ -336,29 +336,29 @@ class e_menuManager { if (isset($location) && isset($position) && $menu_act == "bot") { $menu_count = $sql->count("menus", "(*)", " WHERE menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' "); - $sql->db_Update("menus", "menu_order=".($menu_count+1)." WHERE menu_order='{$position}' AND menu_location='{$location}' AND menu_layout = '$this->dbLayout' "); - $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_location='{$location}' AND menu_order > {$position} AND menu_layout = '".$this->dbLayout."' "); + $sql->update("menus", "menu_order=".($menu_count+1)." WHERE menu_order='{$position}' AND menu_location='{$location}' AND menu_layout = '$this->dbLayout' "); + $sql->update("menus", "menu_order=menu_order-1 WHERE menu_location='{$location}' AND menu_order > {$position} AND menu_layout = '".$this->dbLayout."' "); e107::getLog()->add('MENU_06',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } if (isset($location) && isset($position) && $menu_act == "top") { - $sql->db_Update("menus", "menu_order=menu_order+1 WHERE menu_location='{$location}' AND menu_order < {$position} AND menu_layout = '".$this->dbLayout."' ",$this->debug); - $sql->db_Update("menus", "menu_order=1 WHERE menu_id='{$this->menuId}' "); + $sql->update("menus", "menu_order=menu_order+1 WHERE menu_location='{$location}' AND menu_order < {$position} AND menu_layout = '".$this->dbLayout."' ",$this->debug); + $sql->update("menus", "menu_order=1 WHERE menu_id='{$this->menuId}' "); e107::getLog()->add('MENU_05',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } if (isset($location) && isset($position) && $menu_act == "dec") { - $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_order='".($position+1)."' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' ",$this->debug); - $sql->db_Update("menus", "menu_order=menu_order+1 WHERE menu_id='{$this->menuId}' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' "); + $sql->update("menus", "menu_order=menu_order-1 WHERE menu_order='".($position+1)."' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' ",$this->debug); + $sql->update("menus", "menu_order=menu_order+1 WHERE menu_id='{$this->menuId}' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' "); e107::getLog()->add('MENU_08',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } if (isset($location) && isset($position) && $menu_act == "inc") { - $sql->db_Update("menus", "menu_order=menu_order+1 WHERE menu_order='".($position-1)."' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' ",$this->debug); - $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_id='{$this->menuId}' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' "); + $sql->update("menus", "menu_order=menu_order+1 WHERE menu_order='".($position-1)."' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' ",$this->debug); + $sql->update("menus", "menu_order=menu_order-1 WHERE menu_id='{$this->menuId}' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' "); e107::getLog()->add('MENU_07',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } @@ -389,7 +389,7 @@ class e_menuManager { return false; } - $sql->db_Update("menus", "menu_location='0' WHERE menu_layout = '" . $this->dbLayout . "' "); // Clear All existing. + $sql->update("menus", "menu_location='0' WHERE menu_layout = '" . $this->dbLayout . "' "); // Clear All existing. foreach($menuAreas as $val) { @@ -397,7 +397,7 @@ class e_menuManager { { $row = $sql->fetch(); - if(!$sql->db_Update('menus', "menu_order='" . (int) $val['menu_order'] . "', menu_location = " . (int) $val['menu_location'] . ", menu_class= " . $val['menu_class'] . " WHERE menu_name='" . $tp->filter($val['menu_name']) . "' AND menu_layout = '" . $this->dbLayout . "' LIMIT 1 ")) + if(!$sql->update('menus', "menu_order='" . (int) $val['menu_order'] . "', menu_location = " . (int) $val['menu_location'] . ", menu_class= " . $val['menu_class'] . " WHERE menu_name='" . $tp->filter($val['menu_name']) . "' AND menu_layout = '" . $this->dbLayout . "' LIMIT 1 ")) { $insert = array( 'menu_id' => 0, @@ -554,7 +554,7 @@ class e_menuManager { $c = 1; while($row = $sql->fetch()) { - $sql2->db_Update("menus", "menu_order={$c} WHERE menu_id=" . $row['menu_id']); + $sql2->update("menus", "menu_order={$c} WHERE menu_id=" . $row['menu_id']); $c++; } } @@ -1097,7 +1097,7 @@ class e_menuManager { if($sql2->select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = 0 AND menu_layout ='".$this->dbLayout."' LIMIT 1")) { //menu_location=0 already exists, we can just delete this record - if(!$sql2->db_Delete('menus', 'menu_id='.$this->menuId)) + if(!$sql2->delete('menus', 'menu_id='.$this->menuId)) { $message = "Deletion Failed"; $error = true; diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index 4ea1335fa..3e331e13d 100755 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -3068,7 +3068,7 @@ class e_admin_model extends e_front_model } $sql = e107::getDb(); $table = $this->getModelTable(); - $res = $sql->db_Insert($table, $this->toSqlQuery('replace')); + $res = $sql->insert($table, $this->toSqlQuery('replace')); $this->_db_qry = $sql->getLastQuery(); if(!$res) { diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index f5707a57c..876099885 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -608,7 +608,7 @@ class e_db_mysql implements e_db { global $db_mySQLQueryCount; - $table = $this->db_IsLang($table); + $table = $this->hasLanguage($table); $this->mySQLcurTable = $table; @@ -679,7 +679,7 @@ class e_db_mysql implements e_db */ function insert($tableName, $arg, $debug = FALSE, $log_type = '', $log_remark = '') { - $table = $this->db_IsLang($tableName); + $table = $this->hasLanguage($tableName); $this->mySQLcurTable = $table; $REPLACE = false; // kill any PHP notices $DUPEKEY_UPDATE = false; @@ -873,7 +873,7 @@ class e_db_mysql implements e_db /** * hasLanguage() alias - * @deprecated + * @deprecated Use hasLanguage($table,$multiple) */ function db_IsLang($table, $multiple=false) { @@ -987,7 +987,7 @@ class e_db_mysql implements e_db */ function update($tableName, $arg, $debug = FALSE, $log_type = '', $log_remark = '') { - $table = $this->db_IsLang($tableName); + $table = $this->hasLanguage($tableName); $this->mySQLcurTable = $table; $this->provide_mySQLaccess(); @@ -1121,7 +1121,7 @@ class e_db_mysql implements e_db */ function db_UpdateArray($table, $vars, $arg='', $debug = FALSE, $log_type = '', $log_remark = '') { - $table = $this->db_IsLang($table); + $table = $this->hasLanguage($table); $this->mySQLcurTable = $table; $this->provide_mySQLaccess(); @@ -1240,7 +1240,7 @@ class e_db_mysql implements e_db */ function count($table, $fields = '(*)', $arg = '', $debug = FALSE, $log_type = '', $log_remark = '') { - $table = $this->db_IsLang($table); + $table = $this->hasLanguage($table); if ($fields == 'generic') { @@ -1330,7 +1330,7 @@ class e_db_mysql implements e_db */ function delete($table, $arg = '', $debug = FALSE, $log_type = '', $log_remark = '') { - $table = $this->db_IsLang($table); + $table = $this->hasLanguage($table); $this->mySQLcurTable = $table; $this->provide_mySQLaccess(); @@ -1465,7 +1465,7 @@ class e_db_mysql implements e_db function ml_check($matches) { - $table = $this->db_IsLang($matches[1]); + $table = $this->hasLanguage($matches[1]); if($this->tabset == false) { $this->mySQLcurTable = $table; @@ -1788,7 +1788,7 @@ class e_db_mysql implements e_db // Loop thru relevant language tables and replace each tablename within the query. - if($tablist = $this->db_IsLang($table, true)) + if($tablist = $this->hasLanguage($table, true)) { foreach($tablist as $key=>$tab) { @@ -2164,7 +2164,7 @@ class e_db_mysql implements e_db /** * Legacy Alias of tables - * @deprecated + * @deprecated Use $sql->tables($mode) instead. * @param string $mode * @return array */ diff --git a/e107_handlers/news_class.php b/e107_handlers/news_class.php index d8525cccf..2f3c474e8 100644 --- a/e107_handlers/news_class.php +++ b/e107_handlers/news_class.php @@ -76,7 +76,7 @@ class news { $message = LAN_ERROR_48; $emessage->add(LAN_ERROR_48, E_MESSAGE_ERROR, $smessages); } - elseif($sql->db_Count('news', '(news_id)', ($news['news_sef'] ? 'news_id<>'.intval($news['news_id']).' AND ' : '')."news_sef='".$tp->toDB($news['news_sef'])."'")) + elseif($sql->count('news', '(news_id)', ($news['news_sef'] ? 'news_id<>'.intval($news['news_id']).' AND ' : '')."news_sef='".$tp->toDB($news['news_sef'])."'")) { $error = true; $message = LAN_ERROR_49; @@ -166,7 +166,7 @@ class news { $data['WHERE'] = 'news_id='.intval($news['news_id']); //$vals = "news_datestamp = '".intval($news['news_datestamp'])."', ".$author_insert." news_title='".$news['news_title']."', news_body='".$news['news_body']."', news_extended='".$news['news_extended']."', news_category='".intval($news['cat_id'])."', news_allow_comments='".intval($news['news_allow_comments'])."', news_start='".intval($news['news_start'])."', news_end='".intval($news['news_end'])."', news_class='".$tp->toDB($news['news_class'])."', news_render_type='".intval($news['news_rendertype'])."' , news_summary='".$news['news_summary']."', news_thumbnail='".$tp->toDB($news['news_thumbnail'])."', news_sticky='".intval($news['news_sticky'])."' WHERE news_id='".intval($news['news_id'])."' "; - if ($sql->db_Update('news', $data)) + if ($sql->update('news', $data)) { @@ -213,7 +213,7 @@ class news { else { // Adding item - $data['data']['news_id'] = $sql->db_Insert('news', $data); + $data['data']['news_id'] = $sql->insert('news', $data); $news['news_id'] = $data['data']['news_id']; //$news['news_id'] = $sql ->db_Insert('news', "0, '".$news['news_title']."', '".$news['news_body']."', '".$news['news_extended']."', ".intval($news['news_datestamp']).", ".intval($news['news_author']).", '".intval($news['cat_id'])."', '".intval($news['news_allow_comments'])."', '".intval($news['news_start'])."', '".intval($news['news_end'])."', '".$tp->toDB($news['news_class'])."', '".intval($news['news_rendertype'])."', '0' , '".$news['news_summary']."', '".$tp->toDB($news['news_thumbnail'])."', '".intval($news['news_sticky'])."' ") if ($data['data']['news_id']) @@ -320,8 +320,8 @@ class news { $param['image_sticky'] = IMAGE_sticky; } - cachevars('current_news_item', $news); - cachevars('current_news_param', $param); + e107::setRegistry('current_news_item', $news); + e107::setRegistry('current_news_param', $param); if ($news['news_render_type'] == 1 && $mode != "extend") { diff --git a/e107_handlers/online_class.php b/e107_handlers/online_class.php index 7f7d68529..779dc0e74 100755 --- a/e107_handlers/online_class.php +++ b/e107_handlers/online_class.php @@ -375,7 +375,7 @@ class e_online define('MEMBERS_ONLINE', $members_online); define('GUESTS_ONLINE', $total_online - $members_online); $dbg->logTime('Go online (db count) Line:'.__LINE__); - define('ON_PAGE', $sql->db_Count('online', '(*)', "WHERE `online_location` = '{$page}' ")); + define('ON_PAGE', $sql->count('online', '(*)', "WHERE `online_location` = '{$page}' ")); define('MEMBER_LIST', $member_list); //update most ever online diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index cea5c4652..5816ad536 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -2301,7 +2301,7 @@ class e107plugin if (($path && $sql->select('links', 'link_id,link_order', "link_url = '{$path}'")) || $sql->select('links', 'link_id,link_order', "link_name = '{$link_name}'")) { $row = $sql->fetch(); - $sql->db_Update('links', "link_order = link_order - 1 WHERE link_order > {$row['link_order']}"); + $sql->update('links', "link_order = link_order - 1 WHERE link_order > {$row['link_order']}"); return $sql->delete('links', "link_id = {$row['link_id']}"); } } diff --git a/e107_handlers/pref_class.php b/e107_handlers/pref_class.php index 9386d5481..888cc01ef 100644 --- a/e107_handlers/pref_class.php +++ b/e107_handlers/pref_class.php @@ -1166,9 +1166,9 @@ class prefs // Data not in cache - retrieve from DB $get_sql = new db; // required so sql loops don't break using $tp->toHTML(). - if($get_sql->db_Select('core', '*', "`e107_name` = '{$Name}'", 'default')) + if($get_sql->select('core', '*', "`e107_name` = '{$Name}'", 'default')) { - $row = $get_sql->db_Fetch(); + $row = $get_sql->fetch(); $this->prefVals['core'][$Name] = $row['e107_value']; return $this->prefVals['core'][$Name]; } @@ -1225,17 +1225,18 @@ class prefs } $val = addslashes($val); - switch ($table ) { + switch ($table ) + { case 'core': - if(!$sql->db_Update($table, "e107_value='$val' WHERE e107_name='$name'")) + if(!$sql->update($table, "e107_value='$val' WHERE e107_name='$name'")) { - $sql->db_Insert($table, "'{$name}', '{$val}'"); + $sql->insert($table, "'{$name}', '{$val}'"); } $this->prefVals[$table][$name] = $val; unset($this->prefArrays[$table][$name]); break; case 'user': - $sql->db_Update($table, "user_prefs='$val' WHERE user_id=$uid"); + $sql->update($table, "user_prefs='$val' WHERE user_id=$uid"); break; } } diff --git a/e107_handlers/search/search_event.php b/e107_handlers/search/search_event.php index de2a2bbf9..47eadd0b9 100644 --- a/e107_handlers/search/search_event.php +++ b/e107_handlers/search/search_event.php @@ -19,7 +19,7 @@ if (!defined('e107_INIT')) { exit; } $query = $tp -> toDB($query); $results = $sql->db_Select("event", "*", "event_stake REGEXP('".$query."') OR event_ward REGEXP('".$query."') OR event_organisation REGEXP('".$query."') OR event_title REGEXP('".$query."') OR event_location REGEXP('".$query."') OR event_details REGEXP('".$query."') OR event_thread REGEXP('".$query."') "); -while (list($event_id, $event_stake, $event_ward, $event_organisation, $event_start, $event_end, $event_allday, , , $event_title, $event_location, $event_details, $event_author, $event_contact, $event_category, $event_url ) = $sql->db_Fetch()) { +while (list($event_id, $event_stake, $event_ward, $event_organisation, $event_start, $event_end, $event_allday, , , $event_title, $event_location, $event_details, $event_author, $event_contact, $event_category, $event_url ) = $sql->fetch()) { $sql2->db_select("event_cat", "event_cat_name, event_cat_icon", "event_cat_id='".$event_category."' "); list($event_cat_name, $event_cat_icon ) = $sql2->db_Fetch(); diff --git a/e107_handlers/search_class.php b/e107_handlers/search_class.php index 3b8ca2e22..4b7e42f41 100644 --- a/e107_handlers/search_class.php +++ b/e107_handlers/search_class.php @@ -310,7 +310,7 @@ class e_search } else { $x = 0; - while ($row = $sql -> db_Fetch()) + while ($row = $sql ->fetch()) { $display_row[] = $row; $x++; diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index 62f7ee45b..c8c3c4ff1 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -1150,8 +1150,8 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } $plug_id = array(); $plugin_array = array(); - e107::getDb()->db_Select("plugin", "*", "plugin_installflag = 1"); // Grab plugin IDs. - while ($row = e107::getDb()->db_Fetch()) + e107::getDb()->select("plugin", "*", "plugin_installflag = 1"); // Grab plugin IDs. + while ($row = e107::getDb()->fetch()) { $pth = $row['plugin_path']; $plug_id[$pth] = $row['plugin_id']; diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index f4f7ffd0d..5d0f47fea 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -2887,9 +2887,9 @@ class themeHandler else { // echo $plug; - if($sql->db_Select("plugin", "plugin_id", " plugin_path = '".$plug."' LIMIT 1 ")) + if($sql->select("plugin", "plugin_id", " plugin_path = '".$plug."' LIMIT 1 ")) { - $row = $sql->db_Fetch(); + $row = $sql->fetch(); $name = "installplugin[".$row['plugin_id']."]"; $text .= $this->frm->admin_button($name, ADLAN_121." ".$plug."", 'delete'); } diff --git a/e107_handlers/upload_handler.php b/e107_handlers/upload_handler.php index 5b9860128..1a5067df0 100644 --- a/e107_handlers/upload_handler.php +++ b/e107_handlers/upload_handler.php @@ -304,7 +304,7 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL) { // File upload broken - temp file renamed. // FIXME - method starting with 'get' shouldn't do system file changes. - $uploaded[$c] = e107::getFile()->get_file_info($uploadfile, true, false); + $uploaded[$c] = e107::getFile()->getFileInfo($uploadfile, true, false); $uploaded[$c]['name'] = $name; $uploaded[$c]['rawname'] = $raw_name; diff --git a/e107_handlers/user_handler.php b/e107_handlers/user_handler.php index 52e8162a5..5b055d389 100644 --- a/e107_handlers/user_handler.php +++ b/e107_handlers/user_handler.php @@ -1057,7 +1057,7 @@ Following fields auto-filled in code as required: } else { - $row = $db->db_Fetch(); + $row = $db->fetch(); if ($uid && ($uid != $row['user_id'])) { $error = 'UID mismatch: '.$uid.'/'.$row['user_id']; diff --git a/e107_handlers/user_model.php b/e107_handlers/user_model.php index 2e144b514..95ab85f08 100644 --- a/e107_handlers/user_model.php +++ b/e107_handlers/user_model.php @@ -2148,9 +2148,9 @@ class e_user_extended_model extends e_admin_model $value = $this->get($field); list($table, $field_id, $field_name, $field_order) = explode(',', $this->_struct_index[$field]['db'], 4); $this->_struct_index[$field]['db_value'] = $value; - if($value && $table && $field_id && $field_name && e107::getDb()->db_Select($table, $field_name, "{$field_id}='{$value}'")) + if($value && $table && $field_id && $field_name && e107::getDb()->select($table, $field_name, "{$field_id}='{$value}'")) { - $res = e107::getDb()->db_Fetch(); + $res = e107::getDb()->fetch(); $this->_struct_index[$field]['db_value'] = $res[$field_name]; } @@ -2428,7 +2428,7 @@ class e_user_extended_model extends e_admin_model } $this->_buildManageRules(); // insert new record - if(!e107::getDb()->db_Count('user_extended', '(user_extended_id)', "user_extended_id=".$this->getId())) + if(!e107::getDb()->count('user_extended', '(user_extended_id)', "user_extended_id=".$this->getId())) { return $this->insert(true, $session); } diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index 16db69af0..e6a15603c 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -1751,7 +1751,7 @@ class user_class_admin extends user_class $classrec['userclass_accum'] = implode(',',$temp); } } - if ($this->sql_r->db_Insert('userclass_classes',$this->copy_rec($classrec, TRUE)) === FALSE) + if ($this->sql_r->insert('userclass_classes',$this->copy_rec($classrec, TRUE)) === FALSE) { return FALSE; } @@ -1801,7 +1801,7 @@ class user_class_admin extends user_class $spacer = ", "; } } - if ($this->sql_r->db_Update('userclass_classes', $qry." WHERE `userclass_id`='{$classrec['userclass_id']}'") === FALSE) + if ($this->sql_r->update('userclass_classes', $qry." WHERE `userclass_id`='{$classrec['userclass_id']}'") === FALSE) { return FALSE; } @@ -1873,7 +1873,7 @@ class user_class_admin extends user_class { if (self::queryCanDeleteClass($classID) === FALSE) return FALSE; - if ($this->sql_r->db_Delete('userclass_classes', "`userclass_id`='{$classID}'") === FALSE) return FALSE; + if ($this->sql_r->delete('userclass_classes', "`userclass_id`='{$classID}'") === FALSE) return FALSE; $this->clearCache(); $this->readTree(TRUE); // Re-read the class tree return TRUE; diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index f8b3b73cc..256729cd9 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -19,6 +19,7 @@ class parseXml extends xmlClass // BC with v1.x { private $xmlData = array(); private $counterArray = array(); + function __construct() { @@ -85,7 +86,7 @@ class parseXml extends xmlClass // BC with v1.x foreach($array as $data) { - if(strlen($data == 4096)) + if(strlen($data) == 4096) { $log->addDebug("The XML cannot be parsed as it is badly formed.")->save('XML'); return FALSE; @@ -297,8 +298,8 @@ class xmlClass /** * Constructor - set defaults * - */ - function __constructor() + *//* + function __construct() { $this->reset(); @@ -306,7 +307,7 @@ class xmlClass { $this->filePathConvKeys = array_keys($this->filePathConversions); } - } + }*/ /** * Reset object @@ -504,7 +505,7 @@ class xmlClass * XXX New parser in testing phase - see e_marketplace::parse() * @param SimpleXMLElement $xml * @param string $rec_parent used for recursive calls only - * @return array + * @return array|string */ function xml2array($xml, $rec_parent = '') { @@ -534,7 +535,7 @@ class xmlClass $tags = array_keys($tags); foreach ($tags as $tag) { - if($tag == '@attributes') + if($tag === '@attributes') { $tmp = (array) $xml->attributes(); $ret['@attributes'] = $tmp['@attributes']; @@ -870,7 +871,7 @@ class xmlClass if(is_array($val)) { - $val = e107::serialize($val,false); + $val = e107::serialize($val); if($val === null) { @@ -931,7 +932,7 @@ class xmlClass ksort($theprefs); foreach($theprefs as $key=>$val) { - if($type == 'core' && $this->modifiedPrefsOnly == true && (($val == $default[$key]) || in_array($key,$excludes) || substr($key,0,2) == 'e_')) + if($type === 'core' && $this->modifiedPrefsOnly == true && (($val == $default[$key]) || in_array($key,$excludes) || strpos($key, 'e_') === 0)) { continue; } @@ -1009,11 +1010,11 @@ class xmlClass $eQry = (!empty($options['query'])) ? $options['query'] : null; e107::getDb()->select($eTable, "*", $eQry); $text .= "\t\n"; - $count = 1; + // $count = 1; while($row = e107::getDb()->fetch()) { - if($this->convertFilePaths == true && $eTable == 'core_media' && substr($row['media_url'],0,8) != '{e_MEDIA') + if($this->convertFilePaths == true && $eTable === 'core_media' && strpos($row['media_url'], '{e_MEDIA') !== 0) { continue; } @@ -1026,7 +1027,7 @@ class xmlClass } $text .= "\t\t\n"; - $count++; + // $count++; } $text .= "\t\n"; @@ -1282,7 +1283,7 @@ class xmlClass $insert_array[$fieldkey] = $fieldval; } - if(($mode == "replace") && $sql->replace($table, $insert_array)!==FALSE) + if(($mode === "replace") && $sql->replace($table, $insert_array)!==FALSE) { $ret['success'][] = $table; } diff --git a/e107_plugins/alt_auth/alt_auth_login_class.php b/e107_plugins/alt_auth/alt_auth_login_class.php index 59d7cb994..fbf44b032 100755 --- a/e107_plugins/alt_auth/alt_auth_login_class.php +++ b/e107_plugins/alt_auth/alt_auth_login_class.php @@ -60,7 +60,7 @@ class alt_auth_base $sql->db_Select('alt_auth', '*', "auth_type = '".$prefix."' "); $parm = array(); - while($row = $sql->db_Fetch()) + while($row = $sql->fetch()) { $parm[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval'])); } diff --git a/e107_plugins/alt_auth/importdb_auth.php b/e107_plugins/alt_auth/importdb_auth.php index 974d168ed..c2a89a47a 100644 --- a/e107_plugins/alt_auth/importdb_auth.php +++ b/e107_plugins/alt_auth/importdb_auth.php @@ -83,7 +83,7 @@ class auth_login extends alt_auth_base // Now look at their password - we always need to verify it, even if its a core E107 format. // Higher levels will always convert an authorised password to E107 format and save it for us. - if (!$row = $sql->db_Fetch()) + if (!$row = $sql->fetch()) { $this->makeErrorText('Error reading DB'); return AUTH_NOCONNECT; // Debateable return code - really a DB error. But consistent with other handler diff --git a/e107_plugins/alt_auth/ldap_auth.php b/e107_plugins/alt_auth/ldap_auth.php index 02ca8096d..f2a000f51 100755 --- a/e107_plugins/alt_auth/ldap_auth.php +++ b/e107_plugins/alt_auth/ldap_auth.php @@ -43,7 +43,7 @@ class auth_login extends alt_auth_base /** * Read configuration, initialise connection to LDAP database * - * @return AUTH_xxxx result code + * @return integer AUTH_xxxx result code */ public function __construct() { diff --git a/e107_plugins/alt_auth/radius_auth.php b/e107_plugins/alt_auth/radius_auth.php index d93782baa..60523fef9 100644 --- a/e107_plugins/alt_auth/radius_auth.php +++ b/e107_plugins/alt_auth/radius_auth.php @@ -44,7 +44,7 @@ class auth_login extends alt_auth_base /** * Read configuration, initialise connection to LDAP database * - * @return AUTH_xxxx result code + * @return int AUTH_xxxx result code */ function __construct() { diff --git a/e107_plugins/blogcalendar_menu/archive.php b/e107_plugins/blogcalendar_menu/archive.php index becac1d9d..756c1b7f4 100644 --- a/e107_plugins/blogcalendar_menu/archive.php +++ b/e107_plugins/blogcalendar_menu/archive.php @@ -61,8 +61,8 @@ if (!isset($req_year)) $req_year = $cur_year; // -------------------------------- // look for the first and last year // -------------------------------- -$bcSql->db_Select_gen("SELECT news_id, news_datestamp from #news ORDER BY news_datestamp LIMIT 0,1"); -$first_post = $bcSql->db_Fetch(); +$bcSql->gen("SELECT news_id, news_datestamp from #news ORDER BY news_datestamp LIMIT 0,1"); +$first_post = $bcSql->fetch(); $start_year = date("Y", $first_post['news_datestamp']); $end_year = $cur_year; @@ -85,7 +85,7 @@ for($i = $start_year; $i <= $end_year; $i++) $year_selector .= " selected='selected'"; if ($bcSql->db_Select("news", "news_id, news_datestamp, news_class", "news_datestamp > {$start} AND news_datestamp < {$end}")) { - while ($news = $bcSql->db_Fetch()) + while ($news = $bcSql->fetch()) { if (check_class($news['news_class'])) { diff --git a/e107_plugins/download/admin_download.php b/e107_plugins/download/admin_download.php index 4b9ceb3d6..3148953d1 100644 --- a/e107_plugins/download/admin_download.php +++ b/e107_plugins/download/admin_download.php @@ -100,7 +100,7 @@ if (isset($_POST['update_catorder'])) { if (is_numeric($_POST['catorder'][$key])) { - $sql -> db_Update("download_category", "download_category_order='".intval($order)."' WHERE download_category_id='".intval($key)."'"); + $sql ->update("download_category", "download_category_order='".intval($order)."' WHERE download_category_id='".intval($key)."'"); } } e107::getLog()->add('DOWNL_08',implode(',',array_keys($_POST['catorder'])),E_LOG_INFORMATIVE,''); @@ -206,7 +206,7 @@ if (isset($_POST['updatelimits'])) if (!$_POST['count_num'][$idLim] && !$_POST['count_days'][$idLim] && !$_POST['bw_num'][$idLim] && !$_POST['bw_days'][$idLim]) { //All entries empty - Remove record - if ($sql->db_Delete('generic',"gen_id = {$idLim}")) + if ($sql->delete('generic',"gen_id = {$idLim}")) { $message .= $idLim." - ".DOWLAN_119."
"; e107::getLog()->add('DOWNL_11','ID: '.$idLim,E_LOG_INFORMATIVE,''); diff --git a/e107_plugins/download/download_setup.php b/e107_plugins/download/download_setup.php index 7f29f4e32..3a3cdec9e 100644 --- a/e107_plugins/download/download_setup.php +++ b/e107_plugins/download/download_setup.php @@ -111,7 +111,7 @@ class download_setup { if($needed == TRUE){ return "Incorrect download image paths"; } // Signal that an update is required. - if($sql->db_Update("download","download_image = CONCAT('{e_FILE}downloadimages/',download_image) WHERE download_image !='' ")) + if($sql->update("download","download_image = CONCAT('{e_FILE}downloadimages/',download_image) WHERE download_image !='' ")) { $mes->addSuccess("Updated Download-Image paths"); } @@ -120,7 +120,7 @@ class download_setup $mes->addError("Failed to update Download-Image paths"); } - if($sql->db_Update("download"," download_thumb = CONCAT('{e_FILE}downloadthumbs/',download_thumb) WHERE download_thumb !='' ")) + if($sql->update("download"," download_thumb = CONCAT('{e_FILE}downloadthumbs/',download_thumb) WHERE download_thumb !='' ")) { $mes->addSuccess("Updated Download-Thumbnail paths"); } @@ -136,7 +136,7 @@ class download_setup // Signal that an update is required. if($needed == TRUE){ return "Downloads-Category icon paths need updating"; } // Must have a value if an update is needed. Text used for debug purposes. - if($sql->db_Update("download_category","download_category_icon = CONCAT('{e_IMAGE}icons/',download_category_icon) WHERE download_category_icon !='' ")) + if($sql->update("download_category","download_category_icon = CONCAT('{e_IMAGE}icons/',download_category_icon) WHERE download_category_icon !='' ")) { $mes->addSuccess("Updated Download-Image paths"); } diff --git a/e107_plugins/download/e_list.php b/e107_plugins/download/e_list.php index 6a914bf27..797dfa90e 100644 --- a/e107_plugins/download/e_list.php +++ b/e107_plugins/download/e_list.php @@ -46,7 +46,7 @@ class list_download WHERE dc.download_category_class REGEXP '".e_CLASS_REGEXP."' AND d.download_class REGEXP '".e_CLASS_REGEXP."' AND d.download_active != '0' ".$qry." ORDER BY download_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount'])." "; - $downloads = $this->parent->e107->sql->db_Select_gen($qry); + $downloads = $this->parent->e107->sql->gen($qry); if($downloads == 0) { $list_data = LIST_DOWNLOAD_2; @@ -54,7 +54,7 @@ class list_download else { $list_data = array(); - while($row = $this->parent->e107->sql->db_Fetch()) + while($row = $this->parent->e107->sql->fetch()) { $record = array(); $rowheading = $this->parent->parse_heading($row['download_name']); diff --git a/e107_plugins/faqs/controllers/e107.list.php b/e107_plugins/faqs/controllers/e107.list.php index 5e51fd50e..0f4080356 100644 --- a/e107_plugins/faqs/controllers/e107.list.php +++ b/e107_plugins/faqs/controllers/e107.list.php @@ -96,7 +96,7 @@ class plugin_faqs_list_controller extends eControllerFront $text = $tp->parseTemplate($FAQ_START, true, $sc); - while ($rw = $sql->db_Fetch()) + while ($rw = $sql->fetch()) { $sc->setVars($rw); diff --git a/e107_plugins/faqs/faqs_setup.php b/e107_plugins/faqs/faqs_setup.php index faba50be7..b8e320321 100644 --- a/e107_plugins/faqs/faqs_setup.php +++ b/e107_plugins/faqs/faqs_setup.php @@ -30,7 +30,7 @@ class faqs_setup (3, 1, 'What is a plugin?', 'A plugin is an additional program that integrates with the e107 core system.\r\n\r\nActually plugins are enhancements to the existing system. Some other CMS systems call it extensions, components or modules.\r\n\r\nAlready some core plugins are included in the full install package of e107.\r\n\r\nYou can activate them using Admin > Plugin Manager, and click on Install for the ones you want. They will appear in your Admin Area for configuration.\r\n\r\nThere are all kinds of plugins: small and large, core plugins and third party plugins. There are plugins for all kinds of purposes. ', 0, 123123123, 1, 2); "; - $status = ($sql->db_Select_gen($query)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; + $status = ($sql->gen($query)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $mes->add(LAN_DEFAULT_TABLE_DATA.": faqs", $status); @@ -39,7 +39,7 @@ class faqs_setup (2, 'Misc', 'Other FAQs', 0, 0, 1, '', '', ''); "; - $status = ($sql->db_Select_gen($query2)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; + $status = ($sql->gen($query2)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $mes->add(LAN_DEFAULT_TABLE_DATA.": faqs_info", $status); } diff --git a/e107_plugins/featurebox/includes/category.php b/e107_plugins/featurebox/includes/category.php index e180e1a23..c87c85561 100644 --- a/e107_plugins/featurebox/includes/category.php +++ b/e107_plugins/featurebox/includes/category.php @@ -128,9 +128,9 @@ class plugin_featurebox_category extends e_model { if($force || null === $this->_loaded_data) { - if(e107::getDb()->db_Select('featurebox_category', '*', 'fb_category_class IN ('.USERCLASS_LIST.') AND fb_category_template=\''.e107::getParser()->toDB($template).'\'')) + if(e107::getDb()->select('featurebox_category', '*', 'fb_category_class IN ('.USERCLASS_LIST.') AND fb_category_template=\''.e107::getParser()->toDB($template).'\'')) { - $this->setData(e107::getDb()->db_Fetch()); + $this->setData(e107::getDb()->fetch()); $this->_loaded_data = true; } } diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index eb892988b..c9a01558b 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -1584,7 +1584,7 @@ class e107forum } else { - $this->modArray = e107::getUserClass()->get_users_in_class($uclass, 'user_name', true); + $this->modArray = e107::getUserClass()->getUsersInClass($uclass, 'user_name', true); } diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php index a3f91acf1..5a1f89bfc 100644 --- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php @@ -153,7 +153,7 @@ /** * @example {TOPIC_DATESTAMP: format=relative} * @param string $parm['format'] short|long|forum|relative - * @return HTML + * @return string HTML */ function sc_topic_datestamp($parm=null) { diff --git a/e107_plugins/import/providers/coppermine_import_class.php b/e107_plugins/import/providers/coppermine_import_class.php index d3ea54766..d4ee8e8bf 100644 --- a/e107_plugins/import/providers/coppermine_import_class.php +++ b/e107_plugins/import/providers/coppermine_import_class.php @@ -45,7 +45,7 @@ class coppermine_import extends base_import_class switch ($task) { case 'users' : - $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users WHERE `user_active`='YES' "); + $result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}users WHERE `user_active`='YES' "); if ($result === FALSE) return FALSE; break; default : diff --git a/e107_plugins/import/providers/drupal_import_class.php b/e107_plugins/import/providers/drupal_import_class.php index 400251878..583d98e8a 100644 --- a/e107_plugins/import/providers/drupal_import_class.php +++ b/e107_plugins/import/providers/drupal_import_class.php @@ -130,7 +130,7 @@ class drupal_import extends base_import_class $result = $this->_setupQueryUsers(); $this->copyUserInfo = !$blank_user; break; - +/* case 'news': break; @@ -138,7 +138,7 @@ class drupal_import extends base_import_class break; case 'links': - break; + break;*/ default: break; diff --git a/e107_plugins/import/providers/ikonboard_import_class.php b/e107_plugins/import/providers/ikonboard_import_class.php index 7a7b83a56..88a96cdff 100644 --- a/e107_plugins/import/providers/ikonboard_import_class.php +++ b/e107_plugins/import/providers/ikonboard_import_class.php @@ -41,23 +41,20 @@ class ikonboard_import extends base_import_class switch ($task) { case 'users' : - $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}member_profiles"); + $result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}member_profiles"); if ($result === FALSE) return FALSE; break; - case 'forumdefs' : - return FALSE; - case 'forumposts' : - return FALSE; - case 'polls' : - return FALSE; - case 'news' : - return FALSE; - default : - return FALSE; + + case 'forumdefs': + case 'forumposts': + case 'polls': + case 'news': + default : + return false; } $this->copyUserInfo = !$blank_user; $this->currentTask = $task; - return TRUE; + return true; } diff --git a/e107_plugins/import/providers/joomla_import_class.php b/e107_plugins/import/providers/joomla_import_class.php index 4b48bae82..d4f91dc3b 100644 --- a/e107_plugins/import/providers/joomla_import_class.php +++ b/e107_plugins/import/providers/joomla_import_class.php @@ -45,7 +45,7 @@ class joomla_import extends base_import_class switch ($task) { case 'users' : - $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users"); + $result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}users"); if ($result === FALSE) return FALSE; break; default : diff --git a/e107_plugins/import/providers/mambo_import_class.php b/e107_plugins/import/providers/mambo_import_class.php index fa71c05f4..d1c297555 100644 --- a/e107_plugins/import/providers/mambo_import_class.php +++ b/e107_plugins/import/providers/mambo_import_class.php @@ -41,7 +41,7 @@ class mambo_import extends base_import_class switch ($task) { case 'users' : - $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users"); + $result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}users"); if ($result === FALSE) return FALSE; break; default : diff --git a/e107_plugins/import/providers/phpbb3_import_class.php b/e107_plugins/import/providers/phpbb3_import_class.php index eb26ef893..44d330c27 100644 --- a/e107_plugins/import/providers/phpbb3_import_class.php +++ b/e107_plugins/import/providers/phpbb3_import_class.php @@ -111,17 +111,14 @@ class phpbb3_import extends base_import_class if ($result === FALSE) return FALSE; break; - - case 'polls' : + + case 'news': + case 'polls' : return FALSE; - break; - - case 'news' : - return FALSE; break; - - - default : + + + default : return FALSE; } diff --git a/e107_plugins/list_new/section/list_news.php b/e107_plugins/list_new/section/list_news.php index 181d2790b..020e01120 100644 --- a/e107_plugins/list_new/section/list_news.php +++ b/e107_plugins/list_new/section/list_news.php @@ -55,14 +55,14 @@ class list_news WHERE ".$qry." AND n.news_class REGEXP '".e_CLASS_REGEXP."' ORDER BY n.news_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount']); - if(!$this->parent->e107->sql->db_Select_gen($qry)) + if(!$this->parent->e107->sql->gen($qry)) { $list_data = LIST_NEWS_2; } else { $list_data = array(); - while($row=$this->parent->e107->sql->db_Fetch()) + while($row=$this->parent->e107->sql->fetch()) { $row['news_title'] = $this->parse_news_title($row['news_title']); $rowheading = $this->parent->parse_heading($row['news_title']); diff --git a/e107_plugins/log/stats.php b/e107_plugins/log/stats.php index 56daacfba..345dbc049 100644 --- a/e107_plugins/log/stats.php +++ b/e107_plugins/log/stats.php @@ -710,7 +710,7 @@ class siteStats /* get main stat info from database */ if($sql->select('logstats', 'log_data', "log_id='pageTotal'")) { - $row = $sql -> db_Fetch(); + $row = $sql ->fetch(); $this -> dbPageInfo = unserialize($row['log_data']); } else @@ -1176,7 +1176,7 @@ class siteStats if ($entries = $sql->select("logstats", "*", $pars['query'])) { - $row = $sql -> db_Fetch(); + $row = $sql -> fetch(); $statOs = unserialize($row['log_data']); } else @@ -1309,7 +1309,7 @@ class siteStats if ($entries = $sql->select('logstats', 'log_data', $pars['query'])) { - $row = $sql -> db_Fetch(); + $row = $sql -> fetch(); $statDom = unserialize($row['log_data']); } else @@ -1399,7 +1399,7 @@ class siteStats if ($entries = $sql->db_Select('logstats', 'log_data', $pars['query'])) { - $row = $sql -> db_Fetch(); + $row = $sql -> fetch(); $statScreen = unserialize($row['log_data']); } else @@ -1503,7 +1503,7 @@ class siteStats if ($entries = $sql->select('logstats', 'log_data', $pars['query'])) { - $row = $sql -> db_Fetch(); + $row = $sql -> fetch(); $statRefer = unserialize($row['log_data']); } else @@ -1600,7 +1600,7 @@ class siteStats if ($entries = $sql->select("logstats", "*", $pars['query'])) { - $row = $sql -> db_Fetch(); + $row = $sql -> fetch(); $statQuery = unserialize($row['log_data']); } else @@ -2058,7 +2058,7 @@ class siteStats $sql = e107::getDB(); if ($sql->select("logstats", "*", "log_id='pageTotal'")) { - $row = $sql -> db_Fetch(); + $row = $sql -> fetch(); $dbPageInfo = unserialize($row[2]); unset($dbPageInfo[$toremove]); $dbPageDone = serialize($dbPageInfo); diff --git a/e107_plugins/log/stats_csv.php b/e107_plugins/log/stats_csv.php index fb8c2fc5b..dad1c27b9 100644 --- a/e107_plugins/log/stats_csv.php +++ b/e107_plugins/log/stats_csv.php @@ -191,11 +191,8 @@ function export_stats($export_type, $export_date, $export_filter, $first_date, case 3 : $filename .= $export_type.'_year_'.date('Ym',$first_date).'_'.date('Ym',$last_date); $values_per_row = 12; break; - case 4 : -// $filename .= $export_type.'_alltime'; - $filename .= $export_type; - break; - case 5 : + case 5: + case 4 : // $filename .= $export_type.'_alltime'; $filename .= $export_type; break; @@ -203,7 +200,7 @@ function export_stats($export_type, $export_date, $export_filter, $first_date, $filename .= '.csv'; if (defined('CSV_DEBUG')) $export_text .= "export stats to {$filename}
"; - while($row = $sql -> db_Fetch()) + while($row = $sql ->fetch()) { // Process one DB entry $date_id = substr($row['log_id'],strrpos($row['log_id'],'-')+1); // Numeric value of date being processed (not always valid) if (!is_numeric($date_id)) $date_id = 0; diff --git a/e107_plugins/login_menu/login_menu_class.php b/e107_plugins/login_menu/login_menu_class.php index 49f57626c..8e81d8fc3 100644 --- a/e107_plugins/login_menu/login_menu_class.php +++ b/e107_plugins/login_menu/login_menu_class.php @@ -192,9 +192,9 @@ class login_menu_class WHERE t.thread_datestamp > ".USERLV." and f.forum_class IN (".USERCLASS_LIST.") AND NOT (f.forum_class REGEXP ".$nobody_regexp.") "; - if($sql->db_Select_gen($qry)) + if($sql->gen($qry)) { - $row = $sql->db_Fetch(); + $row = $sql->fetch(); $lbox_stats['forum'][0]['stat_new'] = $row['count']; } } diff --git a/e107_plugins/newsletter/admin_config.php b/e107_plugins/newsletter/admin_config.php index acf3c2624..2bc7267ea 100644 --- a/e107_plugins/newsletter/admin_config.php +++ b/e107_plugins/newsletter/admin_config.php @@ -483,7 +483,7 @@ class newsletter { if($sql->select('user', 'user_name,user_email,user_loginname,user_lastvisit', 'user_id='.$memberID)) { - $row = $sql->db_Fetch(); + $row = $sql->fetch(); $uTarget = array('mail_recipient_id' => $memberID, 'mail_recipient_name' => $row['user_name'], // Should this use realname? 'mail_recipient_email' => $row['user_email'], @@ -638,7 +638,7 @@ class newsletter ".LAN_OPTIONS." "; - if($nl_row = $nl_sql-> db_Fetch()) + if($nl_row = $nl_sql->fetch()) { $subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers'])); sort($subscriber_list); diff --git a/e107_plugins/pm/admin_config.php b/e107_plugins/pm/admin_config.php index 26da81680..d1b87dabc 100644 --- a/e107_plugins/pm/admin_config.php +++ b/e107_plugins/pm/admin_config.php @@ -663,9 +663,9 @@ class private_msg_ui extends e_admin_ui { $qry = implode(' OR ', $del_qry); $cnt = 0; - if($db2->db_Select('private_msg', 'pm_id', $qry)) + if($db2->select('private_msg', 'pm_id', $qry)) { - while ($row = $db2->db_Fetch()) + while ($row = $db2->fetch()) { if ($pmHandler->del($row['pm_id']) !== FALSE) { diff --git a/e107_plugins/pm/pm_conf.php b/e107_plugins/pm/pm_conf.php index c926a15a9..98b05bf63 100755 --- a/e107_plugins/pm/pm_conf.php +++ b/e107_plugins/pm/pm_conf.php @@ -388,9 +388,9 @@ function show_limits($pm_prefs) if (!isset($pm_prefs['pm_limits'])) { $pm_prefs['pm_limits'] = 0; } - if($sql->db_Select('generic', "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'")) + if($sql->select('generic', "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'")) { - while($row = $sql->db_Fetch()) + while($row = $sql->fetch()) { $limitList[$row['limit_classnum']] = $row; } @@ -480,9 +480,9 @@ function add_limit($pm_prefs) $sql = e107::getDb(); $frm = e107::getForm(); - if($sql->db_Select('generic', "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'")) + if($sql->select('generic', "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'")) { - while($row = $sql->db_Fetch()) + while($row = $sql->fetch()) { $limitList[$row['limit_classnum']] = $row; } @@ -679,7 +679,7 @@ function doMaint($opts, $pmPrefs) WHERE `#user`.`user_id` IS NULL")) { $start = max($start + 1, time()); - $results[E_MESSAGE_ERROR][$start] = str_replace(array('[y]', '[z]'), array($this->sql->getLastErrorNum, $this->sql->getLastErrorText), ADLAN_PM_70); + $results[E_MESSAGE_ERROR][$start] = str_replace(array('[y]', '[z]'), array($db2->sql->getLastErrorNum, $db2->sql->getLastErrorText), ADLAN_PM_70); } else { @@ -690,7 +690,7 @@ function doMaint($opts, $pmPrefs) WHERE `#user`.`user_id` IS NULL")) { $start = max($start + 1, time()); - $results[E_MESSAGE_ERROR][$start] = str_replace(array('[y]', '[z]'), array($this->sql->getLastErrorNum, $this->sql->getLastErrorText), ADLAN_PM_70); + $results[E_MESSAGE_ERROR][$start] = str_replace(array('[y]', '[z]'), array($db2->sql->getLastErrorNum, $db2->sql->getLastErrorText), ADLAN_PM_70); } else { @@ -719,9 +719,9 @@ function doMaint($opts, $pmPrefs) { $qry = implode(' OR ', $del_qry); $cnt = 0; - if($db2->db_Select('private_msg', 'pm_id', $qry)) + if($db2->select('private_msg', 'pm_id', $qry)) { - while ($row = $db2->db_Fetch()) + while ($row = $db2->fetch()) { if ($pmHandler->del($row['pm_id']) !== FALSE) { diff --git a/e107_plugins/rss_menu/rss.php b/e107_plugins/rss_menu/rss.php index 481fe3395..25b63618b 100644 --- a/e107_plugins/rss_menu/rss.php +++ b/e107_plugins/rss_menu/rss.php @@ -282,7 +282,9 @@ class rssCreate $path = e_PLUGIN."forum/e_rss.php"; break; + case 8: + case 11: if(!$this -> topicid) { return FALSE; @@ -291,13 +293,6 @@ class rssCreate break; // case 10 was bugtracker - case 11: - if(!$this -> topicid) - { - return FALSE; - } - $path = e_PLUGIN."forum/e_rss.php"; - break; case 'download': case 12: diff --git a/e107_plugins/tinymce4/admin_config.php b/e107_plugins/tinymce4/admin_config.php index 468e0bb73..146719de5 100644 --- a/e107_plugins/tinymce4/admin_config.php +++ b/e107_plugins/tinymce4/admin_config.php @@ -224,7 +224,7 @@ class tinymce ""; - if(!$sql->db_Select_gen($this->listQry)) + if(!$sql->gen($this->listQry)) { $text .= "\n".CUSLAN_42."\n"; } @@ -300,7 +300,7 @@ class tinymce /** * Render Form Element (edit page) * - * @param array $key + * @param string $key * @param array $row * @return string method's value or HTML input */ @@ -339,8 +339,8 @@ class tinymce if($id) { $query = str_replace("{ID}",$id,$this->editQry); - $sql->db_Select_gen($query); - $row = $sql->db_Fetch(); + $sql->gen($query); + $row = $sql->fetch(); } else { diff --git a/e107_tests/tests/unit/e_bbcodeTest.php b/e107_tests/tests/unit/e_bbcodeTest.php new file mode 100644 index 000000000..c3612dd9b --- /dev/null +++ b/e107_tests/tests/unit/e_bbcodeTest.php @@ -0,0 +1,95 @@ +bb = $this->make('e_bbcode'); + } + catch(Exception $e) + { + $this->assertTrue(false, $e->getMessage()); + } + + } +/* + public function testSetClass() + { + + } + + public function testResizeWidth() + { + + } + + public function testGetContent() + { + + } + + public function testHtmltoBBcode() + { + + } + + public function testImgToBBcode() + { + + } + + public function testResizeHeight() + { + + } + + public function testRenderButtons() + { + + } + + public function testProcessTag() + { + + } + + public function testParseBBCodes() + { + + } + + public function testClearClass() + { + + } + + public function testGetClass() + { + + } + + public function testGetMode() + { + + } +*/ + + + + } diff --git a/e107_tests/tests/unit/e_parseTest.php b/e107_tests/tests/unit/e_parseTest.php index 8636a8b40..18fb812fa 100644 --- a/e107_tests/tests/unit/e_parseTest.php +++ b/e107_tests/tests/unit/e_parseTest.php @@ -27,6 +27,9 @@ $this->tp->__construct(); } + + + /* public function testHtmlAbuseFilter() { diff --git a/e107_themes/_blank/theme.php b/e107_themes/_blank/theme.php index bfba9d116..97b5a797b 100644 --- a/e107_themes/_blank/theme.php +++ b/e107_themes/_blank/theme.php @@ -30,7 +30,7 @@ function tablestyle($caption, $text, $mode='') switch($style) { - +/* case 'home': echo $caption; echo $text; @@ -44,7 +44,7 @@ function tablestyle($caption, $text, $mode='') case 'full': echo $caption; echo $text; - break; + break;*/ default: echo $caption; diff --git a/email.php b/email.php index 33dc0be21..0a33e5e23 100644 --- a/email.php +++ b/email.php @@ -153,9 +153,9 @@ if (isset($_POST['emailsubmit'])) { $emailurl = strip_tags($_POST['referer']); $message = ''; - if($sql->db_Select('news', 'news_title, news_body, news_extended', 'news_id='.((int)$parms))) + if($sql->select('news', 'news_title, news_body, news_extended', 'news_id='.((int)$parms))) { - $row = $sql->db_Fetch(); + $row = $sql->fetch(); $message = "
".$row['news_body']."
".$row['news_extended']."

{e_BASE}news.php?extend.".$parms."
"; $message = $tp->toEmail($message); } diff --git a/top.php b/top.php index 66b6f26a7..237dafdb1 100644 --- a/top.php +++ b/top.php @@ -122,7 +122,7 @@ if ($action == 'active') $text .= "\n"; - $ftotal = $sql->db_Count('forum_thread', '(*)', 'WHERE `thread_parent` = 0'); + $ftotal = $sql->count('forum_thread', '(*)', 'WHERE `thread_parent` = 0'); $parms = "{$ftotal},{$view},{$from},".e_SELF.'?[FROM].active.forum.'.$view; $text .= "
".$tp->parseTemplate("{NEXTPREV={$parms}}").'
'; $ns->tablerender(LAN_7, $text, 'nfp');