mirror of
https://github.com/e107inc/e107.git
synced 2025-08-28 16:50:07 +02:00
Code optimization for speed and reduced memory usage.
This commit is contained in:
@@ -639,7 +639,7 @@ class admin_log_form_ui extends e_admin_form_ui
|
||||
$text = str_replace("<br />","\n",$text);
|
||||
$text = str_replace("\","/",$text);
|
||||
|
||||
if(substr($text,0,2) == '\n') // cleanup (not sure of the cause)
|
||||
if(strpos($text,'\n') === 0) // cleanup (not sure of the cause)
|
||||
{
|
||||
$text = substr($text,2);
|
||||
}
|
||||
|
@@ -341,7 +341,7 @@ if (!function_exists("parse_admin"))
|
||||
|
||||
$adtmp = explode("\n", $ADMINLAYOUT);
|
||||
|
||||
for ($a = 0; $a < count($adtmp); $a++)
|
||||
for ($a = 0, $aMax = count($adtmp); $a < $aMax; $a++)
|
||||
{
|
||||
if (preg_match("/{.+?}/", $adtmp[$a]))
|
||||
{
|
||||
|
@@ -61,28 +61,28 @@ $filtered = e107::getParser()->filter($_POST);
|
||||
// Check for pack-related buttons pressed
|
||||
foreach($filtered as $key => $value)
|
||||
{
|
||||
if(strstr($key, "subPack_"))
|
||||
if(strpos($key, "subPack_") !== false)
|
||||
{
|
||||
$subpack = str_replace("subPack_", "", $key);
|
||||
$emote->emoteConf($subpack);
|
||||
break;
|
||||
}
|
||||
|
||||
if(strstr($key, "XMLPack_"))
|
||||
if(strpos($key, "XMLPack_") !== false)
|
||||
{
|
||||
$subpack = str_replace("XMLPack_", "", $key);
|
||||
$emote->emoteXML($subpack);
|
||||
break;
|
||||
}
|
||||
|
||||
if(strstr($key, "defPack_"))
|
||||
if(strpos($key, "defPack_") !== false)
|
||||
{
|
||||
e107::getConfig()->set('emotepack', str_replace("defPack_", "", $key))->save(true,true,true);
|
||||
e107::getLog()->add('EMOTE_01', $pref['emotepack'], E_LOG_INFORMATIVE, '');
|
||||
break;
|
||||
}
|
||||
|
||||
if(strstr($key, "scanPack_"))
|
||||
if(strpos($key, "scanPack_") !== false)
|
||||
{
|
||||
$one_pack = str_replace("scanPack_", "", $key);
|
||||
break;
|
||||
@@ -203,9 +203,9 @@ class emotec
|
||||
|
||||
foreach($emoteArray as $emote)
|
||||
{
|
||||
if (strstr($emote['fname'], ".pak")
|
||||
|| strstr($emote['fname'], ".xml")
|
||||
|| strstr($emote['fname'], "phpBB"))
|
||||
if (strpos($emote['fname'], ".pak") !== false
|
||||
|| strpos($emote['fname'], ".xml") !== false
|
||||
|| strpos($emote['fname'], "phpBB") !== false)
|
||||
{
|
||||
$can_scan = TRUE; // Allow re-scan of config files
|
||||
}
|
||||
@@ -474,15 +474,15 @@ class emotec
|
||||
$confFile = '';
|
||||
foreach($fileArray as $k => $file)
|
||||
{
|
||||
if(strstr($file['fname'], ".xml"))
|
||||
if(strpos($file['fname'], ".xml") !== false)
|
||||
{
|
||||
$confFile = array('file' => $file['fname'], 'type' => "xml");
|
||||
}
|
||||
else if(strstr($file['fname'], ".pak"))
|
||||
else if(strpos($file['fname'], ".pak") !== false)
|
||||
{
|
||||
$confFile = array('file' => $file['fname'], 'type' => "pak");
|
||||
}
|
||||
else if(strstr($file['fname'], ".php"))
|
||||
else if(strpos($file['fname'], ".php") !== false)
|
||||
{
|
||||
$confFile = array('file' => $file['fname'], 'type' => "php");
|
||||
}
|
||||
@@ -501,7 +501,7 @@ class emotec
|
||||
$contentArray = array();
|
||||
foreach($pakconf as $line)
|
||||
{
|
||||
if(trim($line) && strstr($line, "=+") && !strstr($line, ".txt") && !strstr($line, ".html") && !strstr($line, "cvs")) $contentArray[] = $line;
|
||||
if(trim($line) && strpos($line, "=+") !== false && strpos($line, ".txt") === false && strpos($line, ".html") === false && strpos($line, "cvs") === false) $contentArray[] = $line;
|
||||
}
|
||||
$confArray = array();
|
||||
foreach($contentArray as $pakline)
|
||||
@@ -554,7 +554,7 @@ class emotec
|
||||
|
||||
if ($xml_type)
|
||||
{
|
||||
for($a=0; $a < count($match[0]); $a++)
|
||||
for($a=0, $aMax = count($match[0]); $a < $aMax; $a++)
|
||||
{
|
||||
$e_file = '';
|
||||
switch ($xml_type)
|
||||
|
@@ -254,7 +254,7 @@ if(isset($_POST['fp_save_new']))
|
||||
if($temp['order'] == 0) // New index to add
|
||||
{
|
||||
$ind = 0;
|
||||
for($i = 1; $i <= count($fp_settings); $i ++)
|
||||
for($i = 1, $iMax = count($fp_settings); $i <= $iMax; $i ++)
|
||||
{
|
||||
if($fp_settings[$i]['class'] == $temp['class'])
|
||||
$ind = $i;
|
||||
@@ -307,7 +307,7 @@ if($fp_update_prefs)
|
||||
{ // Save the two arrays
|
||||
$fp_list = array();
|
||||
$fp_force = array();
|
||||
for($i = 1; $i <= count($fp_settings); $i ++)
|
||||
for($i = 1, $iMax = count($fp_settings); $i <= $iMax; $i ++)
|
||||
{
|
||||
$fp_list[$fp_settings[$i]['class']] = $fp_settings[$i]['page'];
|
||||
$fp_force[$fp_settings[$i]['class']] = $fp_settings[$i]['force'];
|
||||
|
@@ -1146,7 +1146,7 @@ class lancheck
|
||||
$input .= $diz;
|
||||
$message .= str_replace("\n","<br />",$diz);
|
||||
|
||||
for ($i=0; $i<count($_POST['newlang']); $i++)
|
||||
for ($i=0, $iMax = count($_POST['newlang']); $i< $iMax; $i++)
|
||||
{
|
||||
$notdef_start = "";
|
||||
$notdef_end = "\n";
|
||||
|
@@ -616,7 +616,7 @@ if(!empty($_GET['iframe']))
|
||||
foreach ($tabs as $table_name)
|
||||
{
|
||||
$installed = 'lan_'.strtolower($languageSelected)."_".$table_name;
|
||||
if (stristr($languageSelected, $installed) === FALSE)
|
||||
if (stripos($languageSelected, $installed) === false)
|
||||
{
|
||||
|
||||
$selected = ($sql->isTable($table_name,$languageSelected)) ? " checked='checked'" : "";
|
||||
@@ -1524,7 +1524,7 @@ class lanDeveloper
|
||||
asort($_SESSION['languageTools_lanFileList']);
|
||||
foreach($_SESSION['languageTools_lanFileList'] as $val)
|
||||
{
|
||||
if(strstr($val,e_SYSTEM))
|
||||
if(strpos($val, e_SYSTEM) !== false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -1502,13 +1502,13 @@ class news_form_ui extends e_admin_form_ui
|
||||
<div class="tab-content">';
|
||||
|
||||
|
||||
$val = strstr($curVal, "[img]http") ? $curVal : str_replace("[img]../", "[img]", $curVal);
|
||||
$val = strpos($curVal, "[img]http") !== false ? $curVal : str_replace("[img]../", "[img]", $curVal);
|
||||
$text .= "<div id='news-body-container' class='tab-pane active'>";
|
||||
$text .= $frm->bbarea('news_body', $val, 'news', 'news', 'large');
|
||||
$text .= "</div>";
|
||||
$text .= "<div id='news-extended-container' class='tab-pane'>";
|
||||
|
||||
$val = (strstr($curValExt, "[img]http") ? $curValExt : str_replace("[img]../", "[img]",$curValExt));
|
||||
$val = (strpos($curValExt, "[img]http") !== false ? $curValExt : str_replace("[img]../", "[img]",$curValExt));
|
||||
$text .= $frm->bbarea('news_extended', $val, 'extended', 'news','large');
|
||||
|
||||
$text .= "</div>
|
||||
|
@@ -1248,7 +1248,7 @@ class theme_builder extends e_admin_ui
|
||||
foreach($matches[1] as $i => $m)
|
||||
{
|
||||
$leg[$m] = strip_tags($matches[3][$i]);
|
||||
if(substr($m,0,5) == 'theme' || $m == "CUSTOMPAGES")
|
||||
if(strpos($m,'theme') === 0 || $m == "CUSTOMPAGES")
|
||||
{
|
||||
$search[] = $matches[0][$i];
|
||||
}
|
||||
|
@@ -1509,7 +1509,7 @@ function update_706_to_800($type='')
|
||||
if ($just_check) return update_needed('Avatar paths require updating.');
|
||||
foreach($avatar_images as $av)
|
||||
{
|
||||
$apath = (strstr($av['path'],'public/')) ? e_AVATAR_UPLOAD : e_AVATAR_DEFAULT;
|
||||
$apath = (strpos($av['path'], 'public/') !== false) ? e_AVATAR_UPLOAD : e_AVATAR_DEFAULT;
|
||||
|
||||
if(rename($av['path'].$av['fname'], $apath. $av['fname'])===false)
|
||||
{
|
||||
|
Reference in New Issue
Block a user