From a6a98a82ad44cb58c54861ae93e4ec08a7d9fff9 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 26 Jun 2020 13:58:59 -0700 Subject: [PATCH] Code cleanup. Incompatible plugin alert now links directly to uninstall page for each plugin found. --- e107_admin/admin.php | 6 ++--- e107_admin/cpage.php | 2 +- e107_admin/cron.php | 6 ++--- e107_admin/includes/flexpanel.php | 1 + e107_admin/links.php | 2 +- e107_admin/upload.php | 40 +++++++++++++++---------------- e107_admin/users_extended.php | 4 ++-- e107_handlers/file_class.php | 2 +- e107_handlers/pclzip.lib.php | 8 +++---- e107_handlers/search_class.php | 4 ++-- e107_handlers/user_model.php | 3 ++- 11 files changed, 40 insertions(+), 38 deletions(-) diff --git a/e107_admin/admin.php b/e107_admin/admin.php index d3404310c..1fa54e595 100644 --- a/e107_admin/admin.php +++ b/e107_admin/admin.php @@ -93,7 +93,7 @@ if (!isset($pref['adminstyle'])) $pref['adminstyle'] = 'infopanel'; // Shouldn' class admin_start { - + private $incompat = array( array('banhelper', 1.5), array('banhelper', 1.7), @@ -536,14 +536,14 @@ TMPO; if(!empty($installedPlugs[$folder]) && ($version == $installedPlugs[$folder] || $version === '*')) { - $inCompatText .= "
  • ".$folder." v".$installedPlugs[$folder]."
  • "; + $inCompatText .= "
  • ".$folder." v".$installedPlugs[$folder]."
  • "; } } if($inCompatText) { $text = ""; - $mes->addWarning(ADLAN_189." ".$text."".LAN_UNINSTALL.""); + $mes->addWarning(ADLAN_189." 

    ".$text); } } diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index 7688018c8..40c2262fa 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -596,7 +596,7 @@ class page_admin_ui extends e_admin_ui 'page_sef' => array('title'=> LAN_SEFURL, 'tab' => 1, 'type' => 'text', 'batch'=>true, 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'writeParms'=>'size=xxlarge&sef=page_title'), 'page_metakeys' => array('title'=> LAN_KEYWORDS, 'tab' => 1, 'type' => 'tags', 'data'=>'str', 'width' => 'auto'), 'page_metadscr' => array('title'=> CUSLAN_11, 'tab' => 1, 'type' => 'text', 'data'=>'str', 'width' => 'auto', 'writeParms'=>'size=xxlarge'), - 'page_metarobots' => array('title' => LAN_ROBOTS, 'tab'=>1, 'type' => 'dropdown', 'data'=>'safestr', 'batch'=>true, 'inline'=>true, 'readParms'=>array('type'=>'checkboxes'), 'width' => 'auto', 'thclass' => 'left', 'class' => 'left', 'nosort' => false, 'batch'=>true, 'filter'=>true), + 'page_metarobots' => array('title' => LAN_ROBOTS, 'tab'=>1, 'type' => 'dropdown', 'data'=>'safestr', 'batch'=>true, 'inline'=>true, 'readParms'=>array('type'=>'checkboxes'), 'width' => 'auto', 'thclass' => 'left', 'class' => 'left', 'nosort' => false, 'filter'=>true), 'page_order' => array('title'=> LAN_ORDER, 'tab' => 1, 'type' => 'number', 'width' => 'auto', 'inline'=>true), 'page_fields' => array('title'=>'Custom Fields', 'tab'=>4, 'type'=>'hidden', 'data'=>'json', 'width'=>'auto'), diff --git a/e107_admin/cron.php b/e107_admin/cron.php index 7ff158850..1202af244 100644 --- a/e107_admin/cron.php +++ b/e107_admin/cron.php @@ -93,9 +93,9 @@ class cron_admin_ui extends e_admin_ui } - if (!vartrue(e107::getPref('e_cron_pwd')) || varset($_POST['generate_pwd'])) + if (empty(e107::getPref('e_cron_pwd')) || !empty($_POST['generate_pwd'])) { - $pwd = $this->setCronPwd(); + $this->setCronPwd(); } $sql->gen("SELECT cron_function,cron_active FROM #cron "); @@ -1299,4 +1299,4 @@ function cron_adminmenu() */ -?> + diff --git a/e107_admin/includes/flexpanel.php b/e107_admin/includes/flexpanel.php index 0b48094bd..cabdb9b10 100644 --- a/e107_admin/includes/flexpanel.php +++ b/e107_admin/includes/flexpanel.php @@ -102,6 +102,7 @@ class adminstyle_flexpanel extends adminstyle_infopanel */ public function render() { + /** @var admin_shortcodes $admin_sc */ $admin_sc = e107::getScBatch('admin'); $tp = e107::getParser(); $ns = e107::getRender(); diff --git a/e107_admin/links.php b/e107_admin/links.php index 42dccbb08..2d536bc4c 100644 --- a/e107_admin/links.php +++ b/e107_admin/links.php @@ -895,7 +895,7 @@ class links_admin_form_ui extends e_admin_form_ui * * @return string */ - public function getList($ajax = false) + public function getList($ajax = false, $view='default') { $tp = e107::getParser(); $controller = $this->getController(); diff --git a/e107_admin/upload.php b/e107_admin/upload.php index da787ac2e..b382788d9 100644 --- a/e107_admin/upload.php +++ b/e107_admin/upload.php @@ -562,25 +562,25 @@ if ($action == "dl") { $id = str_replace("%20", " ", $id); - if (preg_match("/Binary\s(.*?)\/.*/", $id, $result)) - { - $bid = $result[1]; - $result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id='$bid' "); - $binary_data = @mysql_result($result, 0, "binary_data"); - $binary_filetype = @mysql_result($result, 0, "binary_filetype"); - $binary_name = @mysql_result($result, 0, "binary_name"); - header("Content-type: ".$binary_filetype); - header("Content-length: ".$download_filesize); - header("Content-Disposition: attachment; filename=".$binary_name); - header("Content-Description: PHP Generated Data"); - echo $binary_data; - exit; - } - else - { - header("location:".e_UPLOAD.str_replace("dl.", "", e_QUERY)); - exit; - } +// if (preg_match("/Binary\s(.*?)\/.*/", $id, $result)) +// { +// $bid = $result[1]; +// $result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id='$bid' "); +// $binary_data = @mysql_result($result, 0, "binary_data"); +// $binary_filetype = @mysql_result($result, 0, "binary_filetype"); +// $binary_name = @mysql_result($result, 0, "binary_name"); +// header("Content-type: ".$binary_filetype); +// header("Content-length: ".$download_filesize); +// header("Content-Disposition: attachment; filename=".$binary_name); +// header("Content-Description: PHP Generated Data"); +// echo $binary_data; +// exit; +// } +// else +// { +// header("location:".e_UPLOAD.str_replace("dl.", "", e_QUERY)); +// exit; +// } } require_once(e_HANDLER.'upload_handler.php'); @@ -979,4 +979,4 @@ function upload_adminmenu() require_once("footer.php"); -?> + diff --git a/e107_admin/users_extended.php b/e107_admin/users_extended.php index 3d5f74c72..76cce070a 100755 --- a/e107_admin/users_extended.php +++ b/e107_admin/users_extended.php @@ -551,12 +551,12 @@ e107::js('footer-inline', js()); } - +/* public function afterDelete($data,$id) { - } + }*/ // ------- Customize Update -------- diff --git a/e107_handlers/file_class.php b/e107_handlers/file_class.php index dfaf83d21..449dca259 100644 --- a/e107_handlers/file_class.php +++ b/e107_handlers/file_class.php @@ -1101,7 +1101,7 @@ class e_file $data_len = filesize($filename); if ($seek > ($data_len - 1)) { $seek = 0; } // if ($filename == null) { $filename = basename($this->data); } - $res =& fopen($filename, 'rb'); + $res = fopen($filename, 'rb'); if ($seek) { fseek($res , $seek); diff --git a/e107_handlers/pclzip.lib.php b/e107_handlers/pclzip.lib.php index d3b8eee12..c320f5dbe 100644 --- a/e107_handlers/pclzip.lib.php +++ b/e107_handlers/pclzip.lib.php @@ -3792,7 +3792,7 @@ class PclZip } // ----- Write gz file format header - $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); + $v_binary_data = pack('va1a1Va1a1', 0x8b1f, chr($p_entry['compression']), chr(0x00), time(), chr(0x00), chr(3)); @fwrite($v_dest_file, $v_binary_data, 10); // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks @@ -5084,11 +5084,11 @@ class PclZip } // ----- Get and memorize the magic_quote value - $this->magic_quotes_status = @get_magic_quotes_runtime(); + $this->magic_quotes_status = ini_get('magic_quotes_runtime'); // @get_magic_quotes_runtime(); // ----- Disable magic_quotes if ($this->magic_quotes_status == 1) { - @set_magic_quotes_runtime(0); + @ini_set('magic_quotes_runtime', 0); } // ----- Return @@ -5118,7 +5118,7 @@ class PclZip // ----- Swap back magic_quotes if ($this->magic_quotes_status == 1) { - @set_magic_quotes_runtime($this->magic_quotes_status); + @ini_set('magic_quotes_runtime', 0); // set_magic_quotes_runtime($this->magic_quotes_status); } // ----- Return diff --git a/e107_handlers/search_class.php b/e107_handlers/search_class.php index 05df7b63b..3b8ca2e22 100644 --- a/e107_handlers/search_class.php +++ b/e107_handlers/search_class.php @@ -50,8 +50,8 @@ class e_search $this->bullet = ''; // Use CSS instead. preg_match_all('/(\W?".*?")|(.*?)(\s|$)/', $this->query, $boolean_keys); - - sort($this -> keywords['split'] = array_unique(array_filter(str_replace('"', '', array_merge($boolean_keys[1], $boolean_keys[2]))))); + $this->keywords['split'] = array_unique(array_filter(str_replace('"', '', array_merge($boolean_keys[1], $boolean_keys[2])))); + sort($this->keywords['split']); foreach ($this -> keywords['split'] as $k_key => $key) { diff --git a/e107_handlers/user_model.php b/e107_handlers/user_model.php index d1c0a6688..f9443d86f 100644 --- a/e107_handlers/user_model.php +++ b/e107_handlers/user_model.php @@ -811,7 +811,8 @@ class e_user_model extends e_admin_model { if($this->get('user_xup')) { - return array_shift(explode('_', $this->get('user_xup'))); + $provider = explode('_', $this->get('user_xup')); + return array_shift($provider); } return null; }