]*>(.*)<\/body>.*/is", "\\1", $t);
}
}
function geturlwp($u)
{
global $su;
$t = '';
if ($fh = fopen(($u . '?' . preg_replace("/^" . preg_replace("/\+/s", "\\\+", preg_replace("/\//s", "\\\/", $su)) . "(\&)?/s", "", sv('QUERY_STRING'))), "r"))
{
while (!feof($fh))
$t .= fread($fh, 1024);
fclose($fh);
return $t;
}
}
function autogallery($u)
{
return 'function deprecated';
}
function h($n)
{
global $h;
return $h[$n];
}
function l($n)
{
global $l;
return $l[$n];
}
/**
* Returns $__text with CMSimple scripting evaluated.
*
* @param string $__text
* @param bool $__compat Wether only last CMSimple script should be evaluated.
* @return string
*/
function evaluate_cmsimple_scripting($__text, $__compat = TRUE)
{
global $output;
foreach ($GLOBALS as $__name => $__dummy) {global $$__name;}
$__scope_before = NULL;
$__scripts = array();
preg_match_all('~'.$cf['scripting']['regexp'].'~is', $__text, $__scripts);
if (count($__scripts[1]) > 0)
{
//$output = preg_replace('~'.$cf['scripting']['regexp'].'~is', '', $__text);
$output = preg_replace('~#CMSimple (?!hide)(.*?)#~is', '', $__text);
if ($__compat)
{
$__scripts[1] = array_reverse($__scripts[1]);
}
foreach ($__scripts[1] as $__script)
{
if (strtolower($__script) !== 'hide' && strtolower($__script) !== 'remove')
{
$__script = preg_replace(
array("'&(quot|#34);'i", "'&(amp|#38);'i", "'&(apos|#39);'i", "'&(lt|#60);'i", "'&(gt|#62);'i", "'&(nbsp|#160);'i", "'%anchor%'", "'%hashtag%'"),
array("\"", "&", "'", "<", ">", " ", "#", "#"),
$__script);
$__scope_before = array_keys(get_defined_vars());
eval($__script);
$__scope_after = array_keys(get_defined_vars());
$__diff = array_diff($__scope_after, $__scope_before);
foreach ($__diff as $__var)
{
$GLOBALS[$__var] = $$__var;
}
if ($__compat)
{
break;
}
}
}
$eval_script_output = $output;
$output = '';
return $eval_script_output;
}
return $__text;
}
/**
* Returns $__text with all plugin calls evaluatated.
* see plugins/index.php preCallPlugins()
*
* @param string $__text
* @return string
*/
function evaluate_plugincall($__text)
{
global $u;
$__text = preg_replace('|{{(.*)#CMSimple(.*)}}|i','
CMSimple Scripting in user input detected!
',$__text);
$error = '
{{CALL TO:{{%1}} FAILED}} '; //use this for debugging of failed plugin-calls
$pl_regex = '"{{{RGX:CALL(.*?)}}}"is'; //general CALL-RegEx (Placeholder: "RGX:CALL")
$pl_calls = array('PLUGIN:' => 'return {{%1}}', 'function:' => 'return {{%1}}');
$fd_calls = array();
foreach ($pl_calls AS $regex => $call)
{
preg_match_all(str_replace("RGX:CALL", $regex, $pl_regex), $__text, $fd_calls[$regex]); //catch all PL-CALLS
foreach ($fd_calls[$regex][0] AS $call_nr => $replace)
{
$call = str_replace("{{%1}}", $fd_calls[$regex][1][$call_nr], $pl_calls[$regex]);
$fnct_call = preg_replace('"(?:(?:return)\s)*(.*?)\(.*?\);"is', '$1', $call);
$fnct = function_exists($fnct_call) ? TRUE : FALSE; //without object-calls; functions-only!!
if ($fnct)
{
preg_match_all("/\\$([a-z_0-9]*)/i", $call, $matches);
foreach ($matches[1] as $var)
{
global $$var;
}
}
$__text = str_replace($replace,
($fnct
? eval(str_replace('{{%1}}', $fd_calls[$regex][1][$call_nr], $pl_calls[$regex]))
: str_replace('{{%1}}', $regex . $fd_calls[$regex][1][$call_nr], $error)),
$__text); //replace PL-CALLS (String only!!)
}
}
return $__text;
}
/**
* Returns $text with CMSimple scripting and plugin calls evaluated.
*
* @param string $text
* @param bool $compat Wheter only last CMSimple script will be evaluated.
* @return void
*/
function evaluate_scripting($text, $compat = TRUE)
{
return evaluate_cmsimple_scripting(evaluate_plugincall($text), $compat);
}
/**
* Returns content of the first CMSimple page with the heading $heading
* with the heading removed and all scripting evaluated.
* Returns FALSE, if the page doesn't exist.
*
* @param string $heading
* @return mixed
*/
function newsbox($heading)
{
global $c, $cl, $h, $cf, $edit, $su, $adm, $txc;
for ($i = 0; $i < $cl; $i++)
{
if ($h[$i] == $heading)
{
if($cf['use']['h1only_pagesplitting'] == 'true')
{
$body = preg_replace('~(.*?)~isu', '', $c[$i]);
}
else
{
$body = preg_replace("/.*<\/h[1-".$cf['menu']['levels']."]>/isu", "", $c[$i]);
}
return $edit ? $body : preg_replace("/".$cf['scripting']['regexp']."/is", "", evaluate_scripting($body, FALSE));
}
}
return FALSE;
}
// EDITOR CALL
function init_editor($elementClasses = array(), $initFile = false)
{
global $pth, $cf;
if (!file_exists($pth['folder']['plugins'] . $cf['editor']['external'] . '/init.php'))
{
return false;
}
include_once $pth['folder']['plugins'] . $cf['editor']['external'] . '/init.php';
$function = 'init_' . $cf['editor']['external'];
if (!function_exists($function))
{
return false;
}
$function($elementClasses, $initFile);
return true;
}
function include_editor()
{
global $pth, $cf;
if (!file_exists($pth['folder']['plugins'] . $cf['editor']['external'] . '/init.php'))
{
return false;
}
include_once $pth['folder']['plugins'] . $cf['editor']['external'] . '/init.php';
$function = 'include_' . $cf['editor']['external'];
if (!function_exists($function))
{
return false;
}
$function();
return true;
}
function editor_replace($elementID = false, $config = '')
{
global $pth, $cf;
if(!$elementID)
{
trigger_error('No elementID given', E_USER_NOTICE);
return false;
}
if (!file_exists($pth['folder']['plugins'] . $cf['editor']['external'] . '/init.php'))
{
return false;
}
include_once $pth['folder']['plugins'] . $cf['editor']['external'] . '/init.php';
$function = $cf['editor']['external'] . '_replace';
if (!function_exists($function))
{
return false;
}
return $function($elementID, $config);
}
function final_clean_up($html)
{
global $adm, $s, $o, $cmsimple_debugMode, $plugins, $errors, $cf, $bjs, $file;
if ($adm === true)
{
$debugHint = '';
$errorList = '';
$margin = 34;
$style = '';
if ($cmsimple_debugMode)
{
$debugHint .= '' . "\n" . 'Notice: Debug-Mode is enabled!' . "\n" . '
' . "\n";
$margin += 25;
}
global $errors;
if(count($errors) > 0)
{
$errorList .= '
';
$errors = array_unique($errors);
foreach($errors as $error){
$errorList .= '- ' . $error . '
';
}
$errorList .= '
';
}
if (isset($cf['adminmenu']['scroll']) && $cf['adminmenu']['scroll'] == 'true')
{
$style = ' style="z-index: 9999;"';
$margin = 0;
}
else
{
$style =' style="position: fixed; top: 0; left: 0; width: 100%; z-index: 9990;"';
$html = preg_replace('~~','' ."\n" . '$0', $html, 1);
}
$html = preg_replace('~]*>~',
'$0' . '' . $debugHint. admin_menu($plugins, $cmsimple_debugMode) . '
' ."\n" . $errorList,
$html, 1);
}
if (!empty($bjs) && $file != 'template')
{
if (function_exists('str_ireplace'))
{
$html = str_ireplace('CSRF protection - logout »");
}
}
function initvar($name)
{
if (!isset($GLOBALS[$name]))
{
if (isset($_GET[$name]))
$GLOBALS[$name] = $_GET[$name];
else if (isset($_POST[$name]))
$GLOBALS[$name] = $_POST[$name];
else
$GLOBALS[$name] = preg_replace("/.*?(" . $name . "=([^\&]*))?.*?/i", "\\2", sv('QUERY_STRING'));
}
}
function sv($s)
{
if (!isset($_SERVER))
{
global $_SERVER;
$_SERVER = $GLOBALS['HTTP_SERVER_VARS'];
}
if (isset($_SERVER[$s]))
return $_SERVER[$s];
else
return'';
}
function rmnl($t)
{
return preg_replace("/(\r\n|\r|\n)+/", "\n", $t);
}
function rmanl($t)
{
return preg_replace("/(\r\n|\r|\n)+/", "", $t);
}
function stsl($t) {return $t;}
function download($fl)
{
global $sn, $download, $tx;
if (!is_readable($fl) || ($download != '' && !chkdl($sn . '?download=' . basename($fl))))
{
global $o, $text_title;
shead('404');
$fl = htmlspecialchars(stripslashes(strip_tags($fl)), ENT_QUOTES, 'UTF-8');
$o .= 'File ' . $fl . '
';
return;
}
else
{
header('Content-Type: application/save-as');
header('Content-Disposition: attachment; filename="' . basename($fl) . '"');
header('Content-Length:' . filesize($fl));
header('Content-Transfer-Encoding: binary');
if ($fh = fopen($fl, "rb"))
{
while (!feof($fh))
echo fread($fh, filesize($fl));
fclose($fh);
}
exit;
}
}
function chkdl($fl)
{
global $pth, $sn;
$m = false;
if (is_dir($pth['folder']['downloads']))
{
$fd = opendir($pth['folder']['downloads']);
while (($p = readdir($fd)) == true)
{
if (preg_match("/.+\..+$/", $p))
{
if ($fl == $sn . '?download=' . $p)
$m = true;
}
}
if ($fd == true)
closedir($fd);
}
return $m;
}
function rf($fl)
{
$fl = rp($fl);
if (!file_exists($fl))
return;
clearstatcache();
if (function_exists('file_get_contents'))
return file_get_contents($fl);
else
{
return join("\n", file($fl));
}
}
function chkfile($fl, $writable)
{
global $pth, $tx;
$t = rp($pth['file'][$fl]);
if ($t == '')
e('undefined', 'file', $fl);
else if (!file_exists($t))
e('missing', $fl, $t);
else if (!is_readable($t))
e('notreadable', $fl, $t);
else if (!is_writable($t) && $writable)
e('notwritable', $fl, $t);
}
function e($et, $ft, $fn)
{
global $e, $tx;
$e .= '' . $tx['error'][$et] . ' ' . $tx['filetype'][$ft] . '' . tag('br') . $fn . '' . "\n";
}
function rfc()
{
global $c, $cl, $h, $u, $l, $su, $s, $pth, $tx, $edit, $adm, $cf;
$c = array();
$h = array();
$u = array();
$l = array();
$empty = 0;
$duplicate = 0;
$content = file_get_contents($pth['file']['content']);
$content = preg_replace('/<\/html>/isu', '', $content);
$stop = $cf['menu']['levels'];
if($cf['use']['h1only_pagesplitting'] == 'true')
{
$content = preg_split('/(?=(.*?)/isu', '$1', array_pop($content));
array_shift($content);
foreach ($content as $page)
{
$c[] = $page;
if($cf['use']['h1only_pagesplitting'] == 'true')
{
preg_match('~(.*)(.*)';
$l[] = $temp[1];
$temp_h[] = preg_replace('/[ \f\n\r\t\xa0]+/isu', ' ', trim(strip_tags($temp[2])));
}
$cl = count($c);
$s = -1;
if ($cl == 0)
{
if($cf['use']['h1only_pagesplitting'] == 'true')
{
$c[] = '' . $tx['toc']['newpage'] . '
';
}
else
{
$c[] = '' . $tx['toc']['newpage'] . '
';
}
$h[] = trim(strip_tags($tx['toc']['newpage']));
$u[] = uenc($h[0]);
$l[] = 1;
$s = 0;
return;
}
$ancestors = array(); /* just a helper for the "url" construction:
* will be filled like this [0] => "Page"
* [1] => "Subpage"
* [2] => "Sub_Subpage" etc.
*/
foreach ($temp_h as $i => $heading)
{
$temp = trim(strip_tags($heading));
if ($temp == '')
{
$empty++;
$temp = $tx['toc']['empty'] . ' ' . $empty;
}
$h[] = $temp;
$ancestors[$l[$i] - 1] = uenc($temp);
$ancestors = array_slice($ancestors, 0, $l[$i]);
$url = implode($cf['uri']['seperator'], $ancestors);
$u[] = substr($url, 0, $cf['uri']['length']);
}
foreach ($u as $i => $url)
{
if ($su == $u[$i] || $su == urlencode($u[$i]))
{
$s = $i;
} // get index of selected page
for ($j = $i + 1; $j < $cl; $j++) { //check for duplicate "urls"
if ($u[$j] == $u[$i])
{
$duplicate++;
$h[$j] = $tx['toc']['dupl'] . ' ' . $duplicate;
$u[$j] = uenc($h[$j]);
}
}
}
if (!($edit && $adm))
{
foreach ($c as $i => $j)
{
if (cmscript('remove', $j))
{
$c[$i] = '#CMSimple hide#';
}
}
}
}
function a($i, $x)
{
global $sn, $u, $cf, $adm;
if ($i == 0 && !$adm) {
if ($x == '' && $cf['locator']['show_homepage'] == 'true')
{
return '';
}
}
return isset($u[$i]) ? '' : '';
}
function meta($n)
{
global $cf, $print;
$exclude = array('robots', 'keywords', 'description');
if ($cf['meta'][$n] != '' && !($print && in_array($n, $exclude)))
return tag('meta name="' . $n . '" content="' . htmlspecialchars($cf['meta'][$n], ENT_COMPAT, 'UTF-8') . '"') . "\n";
}
function ml($i, $img_src = '')
{
global $pth, $tx, $f, $sn;
$t = '';
$title = $tx['menu'][$i];
if ($f != $i) $t .= '';
if ($img_src != '')
{
$t .= tag('img title="' . $title . '" src="' . $pth['folder']['template'] . 'images/' . $img_src . '" alt="' . $title . '"');
}
else
{
$t .= $title;
}
if ($f != $i)$t .= '';
return $t;
}
function homelink($img_src = '')
{
global $pth, $s, $u;
$homepage = $u[0];
$img = tag('img title="' . $homepage . '" src="' . $pth['folder']['template'] . 'images/' . $img_src . '" alt="' . $homepage . '"');
if ($s == 0) $t = $img;
else $t = a(0, '') . $img . '';
return $t;
}
function uenc($s)
{
global $tx;
if (isset($tx['urichar']['org']) && isset($tx['urichar']['new']))
$s = str_replace(explode(",", $tx['urichar']['org']), explode(",", $tx['urichar']['new']), $s);
return str_replace('+', '_', urlencode($s));
}
function rp($p)
{
if (realpath($p) == '')
return $p;
else
return realpath($p);
}
function sortdir($dir)
{
$fs = array();
$fd = opendir($dir);
while (false !== ($fn = readdir($fd)))
{
$fs[] = $fn;
}
if ($fd == true)
closedir($fd);
sort($fs, SORT_STRING);
return $fs;
}
function cmscript($s, $i)
{
global $cf;
return preg_match(preg_replace("/\(\.\*\?\)/", $s, "/" . $cf['scripting']['regexp'] . "/is"), $i);
}
function hide($i)
{
global $c, $edit, $adm;
if ($i < 0)
{
return false;
}
return (!($edit && $adm) && cmscript('hide', $c[$i]));
}
// For valid XHTML
function tag($s)
{
global $cf;
$t = '';
if ($cf['xhtml']['endtags'] == 'true')
$t = ' /';
return '<' . $s . $t . '>';
}
function amp()
{
global $cf;
if ($cf['xhtml']['amp'] == 'true')
return '&';
else
return('&');
}
function shead($s)
{
global $iis, $cgi, $tx, $cf, $title, $o, $CMSimple4menulevel;
if ($s == '401')
header(($cgi || $iis) ? 'status: 401 Unauthorized' : 'HTTP/1.0 401 Unauthorized');
if ($s == '404')
{
if (function_exists('custom_404'))
{
custom_404();
}
else
{
header(($cgi || $iis) ? 'status: 404 Not Found' : 'HTTP/1.0 404 Not Found');
// $o.= "\n" . '' . "\n" . searchbox() . '
';
$o.= "\n" . '' . $tx['menu']['sitemap'] . '
';
$o.= "\n" . '';
$o.= "\n" . str_replace('menulevel','sitemaplevel',toc(1,$CMSimple4menulevel,1));
$o.= "\n" . '
';
}
}
$title = $tx['error'][$s];
$o = '' . $title . '
' . $o;
}
/**
* Debug-Mode
* Check if file "_CMSimpleDebug.txt" exists to turn on debug-mode
* with default setting E_ERROR | E_USER_WARNING | E_PARSE.
* Level of debug mode can be adjusted by placing an
* integer-value within the file using following values:
*
* Possible values of $dbglevel:
* 0 - Turn off all error reporting
* 1 - Running errors except warnings
* 2 - Running errors
* 3 - Running errors + notices
* 4 - All errors except notices and warnings
* 5 - All errors except notices
* 6 - All errors
*
* @author Holger
*
* @global array $pth CMSimple's pathes
* @return boolean Returns true/false if error_reporting was enabled or not
*/
function CMSimpleDebugMode()
{
global $pth;
$dbglevel = '';
# possible values of $dbglevel:
# 0 - Turn off all error reporting
# 1 - Running errors except warnings
# 2 - Running errors
# 3 - Running errors + notices
# 4 - All errors except notices and warnings
# 5 - All errors except notices
# 6 - All errors
if (file_exists($pth['folder']['userfiles'] . '_core/_CMSimpleDebug.txt'))
{
ini_set('display_errors', 1);
$dbglevel = rf($pth['folder']['userfiles'] . '_core/_CMSimpleDebug.txt');
if (strlen($dbglevel) == 1)
{
set_error_handler('CMSimpleDebug');
switch ($dbglevel)
{
case 0: error_reporting(0);
break;
case 1: error_reporting(E_ERROR | E_USER_WARNING | E_PARSE);
break;
case 2: error_reporting(E_ERROR | E_WARNING | E_USER_WARNING | E_PARSE);
break;
case 3: error_reporting(E_ERROR | E_WARNING | E_USER_WARNING | E_PARSE | E_NOTICE);
break;
case 4: error_reporting(E_ALL ^ (E_NOTICE | E_WARNING | E_USER_WARNING));
break;
case 5: error_reporting(E_ALL ^ E_NOTICE);
break;
case 6: error_reporting(E_ALL);
break;
default:
error_reporting(E_ERROR | E_USER_WARNING | E_PARSE);
}
}
else
{
error_reporting(E_ERROR | E_USER_WARNING | E_PARSE);
}
}
else
{
ini_set('display_errors', 0);
error_reporting(0);
}
if (error_reporting() > 0)
{
return true;
}
else
{
return false;
}
}
function CMSimpleDebug($errno, $errstr, $errfile, $errline)
{
global $errors;
if (!(error_reporting() & $errno))
{
// This error code is not included in error_reporting
return;
}
switch ($errno)
{
case E_USER_ERROR:
$errors[] = "CMSimple-ERROR: [$errno] $errstr
$errfile:$errline
\n";
break;
case E_USER_WARNING:
echo "CMSimple WARNING: $errstr
$errfile: $errline
\n";
break;
case E_USER_NOTICE:
$errors[] = "CMSimple-NOTICE: [$errno] $errstr
$errfile:$errline
\n";
break;
case E_WARNING:
$errors[] = "WARNING: $errno $errstr
$errfile:$errline
\n";
break;
case E_NOTICE:
$errors[] = "NOTICE: $errstr
$errfile:$errline
\n";
break;
case E_ERROR:
$errors[] = "ERROR: $errstr
$errfile:$errline
\n";
break;
default:
echo "Unknown error type: [$errno] $errstr
$errfile:$errline
\n";
break;
}
return true;
}
// TEMPLATE FUNCTIONS
function head()
{
global $title, $cf, $pth, $tx, $sn, $hjs;
$t = htmlspecialchars($cf['site']['title'], ENT_COMPAT, 'UTF-8');
if (!empty($t) && !empty($title))
{
$t .= ' - ';
}
$t .= $title;
$t = '' . strip_tags($t) . '' . "\n";
foreach ($cf['meta'] as $i => $k)
{
$t .= meta($i);
}
if(file_exists('./favicon.ico'))
{
$t.=tag('link rel="shortcut icon" type="image/x-icon" href="' . $sn . 'favicon.ico"') . "\n";
}
$t = '' . "\n" . $t;
return $t . tag('meta name="generator" content="' . CMSIMPLE_VERSION . ' ' . CMSIMPLE_RELEASE . ' - www.cmsimple.org"') . "\n" . tag('link rel="stylesheet" href="' . $pth['file']['corestyle'] . '" type="text/css"') . "\n" . tag('link rel="stylesheet" href="' . $pth['file']['stylesheet'] . '" type="text/css"') . "\n" . $hjs;
}
function sitename()
{
global $cf;
return isset($cf['site']['title']) ? htmlspecialchars(strip_tags($cf['site']['title']), ENT_QUOTES, 'UTF-8') : '';
}
function pagename()
{
global $pd_current, $h, $s;
return($pd_current['show_heading'] == '1' ? htmlspecialchars(strip_tags($pd_current['heading']), ENT_QUOTES, 'UTF-8'): $h[$s]);
}
function onload()
{
global $onload;
return ' onload="' . $onload . '"';
}
function toc($start = NULL, $end = NULL, $openToc = 0)
{
global $c, $cl, $s, $l, $cf, $adm, $su, $CMSimple4menulevel;
if (isset($start))
{
if (!isset($end))
{
$end = $start;
}
}
else
{
$start = 1;
}
if (!isset($end))
{
$end = $CMSimple4menulevel;
}
$ta = array();
if($openToc === 0) // dynamic toc
{
if ($s > -1)
{
$tl = $l[$s];
for ($i = $s; $i > -1; $i--)
{
if ($l[$i] <= $tl && $l[$i] >= $start && $l[$i] <= $end)
{
if (!hide($i) || ($i == $s && $cf['hidden']['pages_toc'] == 'true'))
{
if($l[$i] >= $start)$ta[] = $i;
}
}
if ($l[$i] < $tl)
{
$tl = $l[$i];
}
}
sort($ta);
$tl = $l[$s];
}
else
{
$tl = 0;
}
$tl += 1 + $cf['menu']['levelcatch'];
for ($i = $s + 1; $i < $cl; $i++)
{
if ($l[$i] <= $tl && $l[$i] >= $start && $l[$i] <= $end)
{
if (!hide($i))
{
if($l[$i] >= $start)$ta[] = $i;
}
}
if ($l[$i] < $tl)
{
$tl = $l[$i];
}
}
return li($ta, $start);
}
else //open toc
{
if ($s > -1)
{
for ($i = $s; $i > -1; $i--)
{
if ($l[$i] >= $start && $l[$i] <= $end)
{
if (!hide($i) || ($i == $s && $cf['hidden']['pages_toc'] == 'true'))
{
$ta[] = $i;
}
}
}
sort($ta);
}
for ($i = $s + 1; $i < $cl; $i++)
{
if ($l[$i] >= $start && $l[$i] <= $end)
{
if (!hide($i))
{
$ta[] = $i;
}
}
}
return li($ta, $start);
}
}
function expToc()
{
global $hc;
return(li($hc, 'menulevel'));
}
function li($ta, $st)
{
global $s, $l, $h, $cl, $cf, $u;
$tl = count($ta);
if ($tl < 1)
return;
$t = '';
if ($st == 'submenu' || $st == 'search')
$t .= '' . "\n";
$b = 0;
if ($st > 0 && $st != 'sitemaplevel' && $st != 'submenu')
{
$b = intval($st)-1;
$st = 'menulevel';
}
$lf = array();
for ($i = 0; $i < $tl; $i++)
{
$tf = ($s != $ta[$i]);
$splitCssClass = str_replace('%','m',uenc($u[$ta[$i]]));
if ($st == 'menulevel' || $st == 'sitemaplevel')
{
for ($k = (isset($ta[$i - 1]) ? $l[$ta[$i - 1]] : $b); $k < $l[$ta[$i]]; $k++)
{
$t .= "\n" . '' . "\n";
}
}
if(strstr($h[$ta[$i]],'_splitToc_'))
{
$t.= '- ' . str_replace('_splitToc_','',$h[$ta[$i]]) . '
' . "\n";
for ($k = $l[$ta[$i]]; $k > (isset($ta[$i + 1]) ? $l[$ta[$i + 1]] : $b); $k--)
{
$t .= '
' . "\n";
}
}
else
{
if ($st == 'menulevel')
{
$t .= '- -1)
{
if ($l[$ta[$i]] < $l[$s])
{
if (substr($u[$s], 0, strlen($cf['uri']['seperator']) + strlen($u[$ta[$i]])) == $u[$ta[$i]] . $cf['uri']['seperator'])
$t .= 's';
}
}
$t .= 'doc';
for ($j = $ta[$i] + 1; $j < $cl; $j++)
if (!hide($j) && $l[$j] - $l[$ta[$i]] < 2 + $cf['menu']['levelcatch'])
{
if ($l[$j] > $l[$ta[$i]])
$t .= 's';
break;
}
$t .= '">';
if(!$tf)
{
$t.='';
}
if ($tf)
$t .= a($ta[$i], '');
$t .= $h[$ta[$i]];
if ($tf)
{
$t .= '';
}
else
{
$t .= '';
}
if ($st == 'menulevel' || $st == 'sitemaplevel')
{
if ((isset($ta[$i + 1]) ? $l[$ta[$i + 1]] : $b) > $l[$ta[$i]])
$lf[$l[$ta[$i]]] = true;
else
{
$t .= '
' . "\n";
$lf[$l[$ta[$i]]] = false;
}
for ($k = $l[$ta[$i]]; $k > (isset($ta[$i + 1]) ? $l[$ta[$i + 1]] : $b); $k--)
{
$t .= '
' . "\n";
if (isset($lf[$k - 1]))
{
if ($lf[$k - 1])
{
$t .= '' . "\n";
$lf[$k - 1] = false;
}
}
}
}
else
{
$t .= '' . "\n";
}
}
}
if ($st == 'submenu' || $st == 'search')
{
$t .= '' . "\n";
}
return $t;
}
function searchbox()
{
global $sn, $tx;
return '' . "\n";
}
function sitemaplink($img_src = '')
{
return ml('sitemap', $img_src);
}
function printlink($img_src = '')
{
global $f, $search, $file, $sn, $tx, $pth;
$t = amp().'print';
$title = $tx['menu']['print'];
if ($f == 'search')
$t .= amp() . 'function=search' . amp() . 'search=' . htmlspecialchars(stsl($search));
else if ($f == 'file')
$t .= amp() . 'file=' . $file;
else if ($f != '' && $f != 'save')
$t .= amp() . $f;
else if (sv('QUERY_STRING') != '')
$t = htmlspecialchars(sv('QUERY_STRING'), ENT_QUOTES, "UTF-8") . $t;
$link = '';
if ($img_src != '')
{
$link = tag('img title="' . $title . '" src="' . $pth['folder']['template'] . 'images/' . $img_src . '" alt="' . $title . '"');
}
else
{
$link .= $title;
}
return '' . $link . '';
}
function mailformlink($img_src = '')
{
global $cf;
if ($cf['mailform']['email'] != '')return ml('mailform', $img_src);
}
function guestbooklink(){}
function loginlink()
{
global $cf, $adm, $sn, $u, $s, $tx;
if (!$adm)
{
return a($s > -1 ? $s : 0, '&login') . $tx['menu']['login'] . '';
}
}
function lastupdate($br = NULL, $hour = NULL) {
global $tx, $pth;
$t = $tx['lastupdate']['text'] . ':';
if (!(isset($br)))
$t .= tag('br');
else
$t .= ' ';
return $t . date($tx['lastupdate']['dateformat'], filemtime($pth['file']['content']) + (isset($hour) ? $hour * 3600 : 0));
}
function legallink() {}
function locator($cmsimpleLocatorDelimiter = '>')
{
global $title, $h, $s, $f, $c, $l, $tx, $adm, $cf;
if (hide($s) && $cf['hidden']['path_locator'] != 'true')
return '' . str_replace('_splitToc_','',$h[$s]) . '';
if ($title != '' && (!isset($h[$s]) || $h[$s] != $title))
return '' . str_replace('_splitToc_','',$title) . '';
$t = '';
if ($s == 0)
return '' . str_replace('_splitToc_','',$h[$s]) . '';
elseif ($f != '')
return ucfirst($f);
elseif ($s > 0) {
$tl = $l[$s];
if ($tl > 1)
{
for ($i = $s - 1; $i >= 0; $i--)
{
if ($l[$i] < $tl)
{
$t = '' . a($i, '') . $h[$i] . ' ' . $cmsimpleLocatorDelimiter . ' ' . "\n" . $t;
$tl--;
}
if ($tl < 2)
break;
}
}
if ($cf['locator']['show_homepage'] == 'true')
{
return "\n" . '' . a(0, '') . $tx['locator']['home'] . ' ' . $cmsimpleLocatorDelimiter . ' ' . "\n" . $t . '' . str_replace('_splitToc_','',$h[$s]) . ' ';
}
else
{
return "\n" . $t . '' . str_replace('_splitToc_','',$h[$s]) . '';
}
}
else
{
return ' ';
}
}
function editmenu()
{
return '';
}
function admin_menu($plugins = array(), $debug = false)
{
global $adm, $edit, $s, $u, $sn, $tx, $sl, $cf, $su, $pth, $disabled_plugins, $active_plugins, $userfiles_path_images, $userfiles_path_downloads, $userfiles_path_media, $cmsimpleAdmin; // pluginmanager (added "$pth, $disabled_plugins")
if ($adm)
{
$pluginMenu = '';
if ((bool) $plugins)
{
// pluginmanager (changed)
$pluginMenu .= '';
$pluginMenu .= '' . ucfirst($tx['adminmenu']['plugins']) . '' . "\n";
if(count($active_plugins) > $cf['adminmenu']['narrow_max'])
{
$pluginMenu .= '