mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
Code cleanup
This commit is contained in:
parent
b726dde81d
commit
8ffe5f4fca
@ -17,11 +17,9 @@ if (!defined('e107_INIT'))
|
||||
|
||||
e107::getDb()->db_Mark_Time('(Start boot.php)');
|
||||
header('Content-type: text/html; charset=utf-8', TRUE);
|
||||
|
||||
define('ADMINFEED', 'https://e107.org/adminfeed');
|
||||
|
||||
|
||||
|
||||
if(!empty($_GET['iframe'])) // global iframe support.
|
||||
{
|
||||
define('e_IFRAME', true);
|
||||
@ -117,13 +115,13 @@ if(e_AJAX_REQUEST && ADMIN && varset($_GET['mode']) == 'core' && ($_GET['type']
|
||||
echo $text;
|
||||
|
||||
}
|
||||
else
|
||||
/*else
|
||||
{
|
||||
if(e_DEBUG)
|
||||
{
|
||||
// echo "Feed failed: ".ADMINFEED;
|
||||
echo "Feed failed: ".ADMINFEED;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -166,7 +164,7 @@ if(ADMIN && (e_AJAX_REQUEST || deftrue('e_DEBUG_FEEDS')) && varset($_GET['mode']
|
||||
$text .= '<div class="media">';
|
||||
$text .= '<div class="media-left">
|
||||
<a href="'.$link.'">
|
||||
<img class="media-object img-rounded rounded" src="'.$img.'" style="width:100px">
|
||||
<img class="media-object img-rounded rounded" src="'.$img.'" style="width:100px" alt="" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
@ -236,10 +234,10 @@ if(!defset('e_ADMIN_UI') && !defset('e_PAGETITLE'))
|
||||
foreach($array_functions as $val)
|
||||
{
|
||||
$link = str_replace("../","",$val[0]);
|
||||
if(strpos(e_SELF,$link)!==FALSE)
|
||||
{
|
||||
//if(strpos(e_SELF,$link)!==FALSE)
|
||||
// {
|
||||
// define('e_PAGETITLE',$val[1]);
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,8 +255,8 @@ if (!defined('ADMIN_WIDTH')) //BC Only
|
||||
*
|
||||
* @param integer|bool $update return result of db::db_Query
|
||||
* @param string $type update|insert|update
|
||||
* @param string $success forced success message
|
||||
* @param string $failed forced error message
|
||||
* @param string|bool $success forced success message
|
||||
* @param string|bool $failed forced error message
|
||||
* @param bool $output false suppress any function output
|
||||
* @return integer|bool db::db_Query result
|
||||
*/
|
||||
@ -320,185 +318,6 @@ function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_li
|
||||
|
||||
|
||||
return e107::getNav()->admin($title, $active_page, $e107_vars, $tmpl, $sub_link , $sortlist );
|
||||
|
||||
|
||||
// See e107::getNav()->admin();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/// Search for id
|
||||
|
||||
$temp = explode('--id--', $title, 2);
|
||||
$title = $temp[0];
|
||||
$id = str_replace(array(' ', '_'), '-', varset($temp[1]));
|
||||
|
||||
unset($temp);
|
||||
|
||||
// SORT
|
||||
|
||||
|
||||
|
||||
if ($sortlist == TRUE)
|
||||
{
|
||||
$temp = $e107_vars;
|
||||
unset($e107_vars);
|
||||
$func_list = array();
|
||||
foreach (array_keys($temp) as $key)
|
||||
{
|
||||
$func_list[] = $temp[$key]['text'];
|
||||
}
|
||||
|
||||
usort($func_list, 'strcoll');
|
||||
|
||||
foreach ($func_list as $func_text)
|
||||
{
|
||||
foreach (array_keys($temp) as $key)
|
||||
{
|
||||
if ($temp[$key]['text'] == $func_text)
|
||||
{
|
||||
$e107_vars[] = $temp[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($temp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$kpost = '';
|
||||
$text = '';
|
||||
|
||||
if ($sub_link)
|
||||
{
|
||||
$kpost = '_sub';
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = $tmpl['start'];
|
||||
}
|
||||
|
||||
//FIXME - e_parse::array2sc()
|
||||
$search = array();
|
||||
$search[0] = '/\{LINK_TEXT\}(.*?)/si';
|
||||
$search[1] = '/\{LINK_URL\}(.*?)/si';
|
||||
$search[2] = '/\{ONCLICK\}(.*?)/si';
|
||||
$search[3] = '/\{SUB_HEAD\}(.*?)/si';
|
||||
$search[4] = '/\{SUB_MENU\}(.*?)/si';
|
||||
$search[5] = '/\{ID\}(.*?)/si';
|
||||
$search[6] = '/\{SUB_ID\}(.*?)/si';
|
||||
$search[7] = '/\{LINK_CLASS\}(.*?)/si';
|
||||
$search[8] = '/\{SUB_CLASS\}(.*?)/si';
|
||||
$search[9] = '/\{LINK_IMAGE\}(.*?)/si';
|
||||
|
||||
foreach (array_keys($e107_vars) as $act)
|
||||
{
|
||||
if (isset($e107_vars[$act]['perm']) && !getperms($e107_vars[$act]['perm'])) // check perms first.
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// check class so that e.g. e_UC_NOBODY will result no permissions granted (even for main admin)
|
||||
if (isset($e107_vars[$act]['userclass']) && !e107::getUser()->checkClass($e107_vars[$act]['userclass'], false)) // check userclass perms
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// print_a($e107_vars[$act]);
|
||||
|
||||
$replace = array();
|
||||
|
||||
$rid = str_replace(array(' ', '_'), '-', $act).($id ? "-{$id}" : '');
|
||||
|
||||
if (($active_page == $act && !is_numeric($act))|| (str_replace("?", "", e_PAGE.e_QUERY) == str_replace("?", "", $act)))
|
||||
{
|
||||
$temp = $tmpl['button_active'.$kpost];
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp = $tmpl['button'.$kpost];
|
||||
}
|
||||
|
||||
// $temp = $tmpl['button'.$kpost];
|
||||
// echo "ap = ".$active_page;
|
||||
// echo " act = ".$act."<br /><br />";
|
||||
|
||||
if($rid == 'adminhome')
|
||||
{
|
||||
$temp = $tmpl['button_other'.$kpost];
|
||||
}
|
||||
|
||||
if($rid == 'home')
|
||||
{
|
||||
$temp = $tmpl['button_home'.$kpost];
|
||||
}
|
||||
|
||||
if($rid == 'language')
|
||||
{
|
||||
$temp = $tmpl['button_language'.$kpost];
|
||||
}
|
||||
|
||||
if($rid == 'logout')
|
||||
{
|
||||
$temp = $tmpl['button_logout'.$kpost];
|
||||
}
|
||||
|
||||
$replace[0] = str_replace(" ", " ", $e107_vars[$act]['text']);
|
||||
// valid URLs
|
||||
$replace[1] = str_replace(array('&', '&'), array('&', '&'), varsettrue($e107_vars[$act]['link'], "#{$act}"));
|
||||
$replace[2] = '';
|
||||
if (varsettrue($e107_vars[$act]['include']))
|
||||
{
|
||||
$replace[2] = $e107_vars[$act]['include'];
|
||||
//$replace[2] = $js ? " onclick=\"showhideit('".$act."');\"" : " onclick=\"document.location='".$e107_vars[$act]['link']."'; disabled=true;\"";
|
||||
}
|
||||
$replace[3] = $title;
|
||||
$replace[4] = '';
|
||||
|
||||
$replace[5] = $id ? " id='eplug-nav-{$rid}'" : '';
|
||||
$replace[6] = $rid;
|
||||
|
||||
$replace[7] = varset($e107_vars[$act]['link_class']);
|
||||
$replace[8] = '';
|
||||
$replace[9] = varset($e107_vars[$act]['image']);
|
||||
|
||||
if($rid == 'logout' || $rid == 'home' || $rid == 'language')
|
||||
{
|
||||
$START_SUB = $tmpl['start_other_sub'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$START_SUB = $tmpl['start_sub'];
|
||||
}
|
||||
|
||||
if (varsettrue($e107_vars[$act]['sub']))
|
||||
{
|
||||
$replace[6] = $id ? " id='eplug-nav-{$rid}-sub'" : '';
|
||||
$replace[7] = ' '.varset($e107_vars[$act]['link_class'], 'e-expandit');
|
||||
$replace[8] = ' '.varset($e107_vars[$act]['sub_class'], 'e-hideme e-expandme');
|
||||
$replace[4] = preg_replace($search, $replace, $START_SUB);
|
||||
$replace[4] .= e_ad/min_menu(false, $active_page, $e107_vars[$act]['sub'], $tmpl, true, (isset($e107_vars[$act]['sort']) ? $e107_vars[$act]['sort'] : $sortlist));
|
||||
$replace[4] .= $tmpl['end_sub'];
|
||||
}
|
||||
|
||||
$text .= preg_replace($search, $replace, $temp);
|
||||
// echo "<br />".$title." act=".$act;
|
||||
//print_a($e107_vars[$act]);
|
||||
}
|
||||
|
||||
$text .= (!$sub_link) ? $tmpl['end'] : '';
|
||||
|
||||
if ($sub_link || empty($title))
|
||||
{
|
||||
return $text;
|
||||
}
|
||||
|
||||
$ns = e107::getRender();
|
||||
$ns->tablerender($title, $text, array('id'=>$id, 'style'=>'button_menu'));
|
||||
return '';
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
@ -508,7 +327,7 @@ if (!function_exists('show_admin_menu'))
|
||||
{
|
||||
function show_admin_menu($title, $active_page, $e107_vars, $js = FALSE, $sub_link = FALSE, $sortlist = FALSE)
|
||||
{
|
||||
|
||||
unset($js,$sub_link);
|
||||
return e107::getNav()->admin($title, $active_page, $e107_vars, false, false, $sortlist);
|
||||
}
|
||||
}
|
||||
@ -519,6 +338,7 @@ if (!function_exists("parse_admin"))
|
||||
{
|
||||
$sc = e107::getScBatch('admin');
|
||||
$tp = e107::getParser();
|
||||
|
||||
$adtmp = explode("\n", $ADMINLAYOUT);
|
||||
|
||||
for ($a = 0; $a < count($adtmp); $a++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user