2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2009-11-17 10:35:34 +00:00
|
|
|
* e107 website system
|
|
|
|
*
|
2009-11-18 01:06:08 +00:00
|
|
|
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
2009-11-17 10:35:34 +00:00
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* $Source: /cvs_backup/e107_0.8/e107_admin/admin.php,v $
|
2010-02-10 18:18:01 +00:00
|
|
|
* $Revision$
|
|
|
|
* $Date$
|
|
|
|
* $Author$
|
2009-11-17 10:35:34 +00:00
|
|
|
*/
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once('../class2.php');
|
2009-11-17 10:35:34 +00:00
|
|
|
|
|
|
|
//TODO - marj prepare language reorganisation
|
|
|
|
//include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
2009-08-28 16:11:02 +00:00
|
|
|
|
2012-12-06 14:53:58 -08:00
|
|
|
if(vartrue($_GET['iframe']) == 1)
|
2012-05-17 09:19:44 +00:00
|
|
|
{
|
|
|
|
define('e_IFRAME', true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
$e_sub_cat = 'main';
|
2012-12-04 00:14:43 -08:00
|
|
|
|
|
|
|
if($pref['adminstyle'] == 'infopanel')
|
|
|
|
{
|
|
|
|
require_once(e_ADMIN.'includes/'.$pref['adminstyle'].'.php');
|
|
|
|
$adp = new adminstyle_infopanel;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once('auth.php');
|
|
|
|
require_once(e_HANDLER.'admin_handler.php');
|
2008-08-25 10:46:46 +00:00
|
|
|
require_once(e_HANDLER.'upload_handler.php');
|
2012-12-05 21:30:17 -08:00
|
|
|
// require_once (e_HANDLER."message_handler.php");
|
2010-10-27 11:13:44 +00:00
|
|
|
$emessage = e107::getMessage();
|
2008-12-30 15:56:12 +00:00
|
|
|
|
2008-08-25 10:46:46 +00:00
|
|
|
if (!isset($pref['adminstyle'])) $pref['adminstyle'] = 'classis'; // Shouldn't be needed - but just in case
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
// --- check for htmlarea.
|
2008-12-30 15:56:12 +00:00
|
|
|
if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea'))
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2008-12-30 15:56:12 +00:00
|
|
|
/*$text = ADLAN_ERR_2."<br /><br />
|
2006-12-02 04:36:16 +00:00
|
|
|
<div style='text-align:center'>".$HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/</div>";
|
2008-12-30 15:56:12 +00:00
|
|
|
$ns -> tablerender(ADLAN_ERR_1, $text);*/
|
2012-12-05 21:30:17 -08:00
|
|
|
|
2008-12-30 15:56:12 +00:00
|
|
|
$emessage->add($HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/", E_MESSAGE_WARNING);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-30 15:56:12 +00:00
|
|
|
/* Not used in 0.8
|
2006-12-02 04:36:16 +00:00
|
|
|
// check for old modules.
|
2008-08-25 10:46:46 +00:00
|
|
|
if(getperms('0') && isset($pref['modules']) && $pref['modules'] && $sql->db_Field("plugin",5) == "plugin_addons")
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$mods=explode(",", $pref['modules']);
|
|
|
|
$thef = "e_module.php";
|
|
|
|
foreach ($mods as $mod)
|
|
|
|
{
|
|
|
|
if (is_readable(e_PLUGIN."{$mod}/module.php"))
|
|
|
|
{
|
|
|
|
$mod_found[] = e_PLUGIN."{$mod}/module.php";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($mod_found)
|
|
|
|
{
|
|
|
|
$text = ADLAN_ERR_5." <b>".$thef."</b>:<br /><br /><ul>";
|
|
|
|
foreach($mod_found as $val){
|
|
|
|
$text .= "<li>".str_replace("../","",$val)."</li>\n";
|
|
|
|
}
|
|
|
|
$text .="</ul><br />
|
|
|
|
<form method='post' action='".e_ADMIN."db.php' id='upd'>
|
|
|
|
<a href='#' onclick=\"document.getElementById('upd').submit()\">".ADLAN_ERR_6."</a>
|
|
|
|
<input type='hidden' name='plugin_scan' value='1' />
|
|
|
|
</form>";
|
|
|
|
$ns -> tablerender(ADLAN_ERR_4,$text);
|
|
|
|
}
|
|
|
|
}
|
2008-10-11 11:55:18 +00:00
|
|
|
*/
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
// check for file-types;
|
2008-08-25 10:46:46 +00:00
|
|
|
$allowed_types = get_filetypes(); // Get allowed types according to filetypes.xml or filetypes.php
|
|
|
|
if (count($allowed_types) == 0)
|
|
|
|
{
|
|
|
|
$allowed_types = array('zip' => 1, 'gz' => 1, 'jpg' => 1, 'png' => 1, 'gif' => 1);
|
2008-12-30 15:56:12 +00:00
|
|
|
$emessage->add("Setting default filetypes: ".implode(', ',array_keys($allowed_types)), E_MESSAGE_INFO);
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-12-30 15:56:12 +00:00
|
|
|
|
2008-08-25 10:46:46 +00:00
|
|
|
//echo "Allowed filetypes = ".implode(', ',array_keys($allowed_types)).'<br />';
|
2006-12-02 04:36:16 +00:00
|
|
|
// avatar check.
|
2009-11-07 02:17:02 +00:00
|
|
|
$public = array(e_UPLOAD, e_UPLOAD.'avatars');
|
2011-11-26 01:38:08 +00:00
|
|
|
$exceptions = array(".","..","/","CVS","avatars","Thumbs.db",".ftpquota",".htaccess","php.ini",".cvsignore",'e107.htaccess');
|
2009-09-10 21:08:39 +00:00
|
|
|
|
|
|
|
//TODO use $file-class to grab list and perform this check.
|
2008-12-30 15:56:12 +00:00
|
|
|
foreach ($public as $dir)
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2008-12-30 15:56:12 +00:00
|
|
|
if (is_dir($dir))
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2008-12-30 15:56:12 +00:00
|
|
|
if ($dh = opendir($dir))
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2008-12-30 15:56:12 +00:00
|
|
|
while (($file = readdir($dh)) !== false)
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2009-09-10 21:08:39 +00:00
|
|
|
if (is_dir($dir."/".$file) == FALSE && !in_array($file,$exceptions))
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
|
|
|
$fext = substr(strrchr($file, "."), 1);
|
2008-12-30 15:56:12 +00:00
|
|
|
if (!array_key_exists(strtolower($fext),$allowed_types) )
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2008-12-30 15:56:12 +00:00
|
|
|
if ($file == 'index.html' || $file == "null.txt")
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2008-12-30 15:56:12 +00:00
|
|
|
if (filesize($dir.'/'.$file))
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$potential[] = str_replace('../', '', $dir).'/'.$file;
|
|
|
|
}
|
2008-12-30 15:56:12 +00:00
|
|
|
}
|
|
|
|
else
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$potential[] = str_replace('../', '', $dir).'/'.$file;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-08-25 10:46:46 +00:00
|
|
|
closedir($dh);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-30 15:56:12 +00:00
|
|
|
if (isset($potential))
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2008-12-30 15:56:12 +00:00
|
|
|
//$text = ADLAN_ERR_3."<br /><br />";
|
|
|
|
$emessage->add(ADLAN_ERR_3, E_MESSAGE_WARNING);
|
|
|
|
$text = '<ul>';
|
|
|
|
foreach ($potential as $p_file)
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2008-12-30 15:56:12 +00:00
|
|
|
$text .= '<li>'.$p_file.'</li>';
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-12-30 15:56:12 +00:00
|
|
|
$emessage->add($text, E_MESSAGE_WARNING);
|
|
|
|
//$ns -> tablerender(ADLAN_ERR_1, $text);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// auto db update
|
2008-12-30 15:56:12 +00:00
|
|
|
if ('0' == ADMINPERMS)
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once(e_ADMIN.'update_routines.php');
|
|
|
|
update_check();
|
|
|
|
}
|
|
|
|
// end auto db update
|
|
|
|
|
2008-08-25 10:46:46 +00:00
|
|
|
/*
|
2008-12-30 15:56:12 +00:00
|
|
|
if (e_QUERY == 'purge' && getperms('0'))
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$admin_log->purge_log_events(false);
|
|
|
|
}
|
2008-08-25 10:46:46 +00:00
|
|
|
*/
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
$td = 1;
|
2008-08-25 10:46:46 +00:00
|
|
|
if(!defined("ADLINK_COLS"))
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
define("ADLINK_COLS",5);
|
|
|
|
}
|
2008-08-25 10:46:46 +00:00
|
|
|
|
2012-12-03 02:21:51 -08:00
|
|
|
// DEPRECATED
|
2008-12-30 15:56:12 +00:00
|
|
|
function render_links($link, $title, $description, $perms, $icon = FALSE, $mode = FALSE)
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2012-12-03 02:21:51 -08:00
|
|
|
|
|
|
|
return e107::getNav()->renderAdminButton($link, $title, $description, $perms, $icon, $mode);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2006-12-02 04:36:16 +00:00
|
|
|
global $td,$tp;
|
|
|
|
$text = '';
|
2008-12-30 15:56:12 +00:00
|
|
|
if (getperms($perms))
|
2008-12-04 20:17:54 +00:00
|
|
|
{
|
2008-12-29 16:11:02 +00:00
|
|
|
$description = strip_tags($description);
|
2008-12-30 15:56:12 +00:00
|
|
|
if ($mode == 'adminb')
|
2008-12-04 20:17:54 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$text = "<tr><td class='forumheader3'>
|
|
|
|
<div class='td' style='text-align:left; vertical-align:top; width:100%'
|
|
|
|
onmouseover=\"eover(this, 'forumheader5')\" onmouseout=\"eover(this, 'td')\" onclick=\"document.location.href='".$link."'\">
|
2009-10-29 12:39:21 +00:00
|
|
|
".$icon." <b>".$title."</b> ".($description ? "[ <span class='field-help'>".$description."</span> ]" : "")."</div></td></tr>";
|
2008-12-30 15:56:12 +00:00
|
|
|
}
|
|
|
|
else
|
2008-12-04 20:17:54 +00:00
|
|
|
{
|
2009-07-04 03:08:03 +00:00
|
|
|
|
2012-11-26 18:42:11 -08:00
|
|
|
if($mode != "div" && $mode != 'div-icon-only')
|
2008-12-04 20:17:54 +00:00
|
|
|
{
|
2009-07-04 03:08:03 +00:00
|
|
|
if ($td == (ADLINK_COLS+1))
|
|
|
|
{
|
|
|
|
$text .= '</tr>';
|
|
|
|
$td = 1;
|
|
|
|
}
|
|
|
|
if ($td == 1)
|
|
|
|
{
|
|
|
|
$text .= '<tr>';
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2012-11-26 14:41:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
switch ($mode)
|
2008-12-04 20:17:54 +00:00
|
|
|
{
|
2012-11-26 14:41:32 -08:00
|
|
|
case 'default':
|
|
|
|
$text .= "<td class='td' style='text-align:left; vertical-align:top; width:20%; white-space:nowrap'
|
2007-01-06 23:10:31 +00:00
|
|
|
onmouseover=\"eover(this, 'forumheader5')\" onmouseout=\"eover(this, 'td')\" onclick=\"document.location.href='".$link."'\">".$icon." ".$tp->toHTML($title,FALSE,"defs, emotes_off")."</td>";
|
2012-11-26 14:41:32 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'classis':
|
|
|
|
$text .= "<td style='text-align:center; vertical-align:top; width:20%'><a class='core-mainpanel-link-icon' href='".$link."' title='{$description}'>".$icon."</a><br />
|
|
|
|
<a class='core-mainpanel-link-text' href='".$link."' title='{$description}'><b>".$tp->toHTML($title,FALSE,"defs, emotes_off")."</b></a><br /><br /></td>";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'beginner':
|
|
|
|
$text .= "<td style='text-align:center; vertical-align:top; width:20%' ><a class='core-mainpanel-link-icon' href='".$link."' >".$icon."</a>
|
2006-12-02 04:36:16 +00:00
|
|
|
<div style='padding:5px'>
|
2012-11-26 14:41:32 -08:00
|
|
|
<a class='core-mainpanel-link-text' href='".$link."' title='".$description."'><b>".$tp->toHTML($title,FALSE,"defs, emotes_off")."</b></a></div><br /><br /><br /></td>";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'div':
|
|
|
|
$text .= "<div class='core-mainpanel-block'><a class='core-mainpanel-link-icon e-tip' href='".$link."' title='{$description}'>".$icon."</a><br />
|
2012-11-26 03:23:20 -08:00
|
|
|
<a class='core-mainpanel-link-text e-tip' href='".$link."' title='{$description}'>".$tp->toHTML($title,FALSE,"defs, emotes_off")."</a>
|
2012-11-26 14:41:32 -08:00
|
|
|
</div>";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'div-icon-only':
|
|
|
|
$text .= "<div class='core-mainpanel-block'><a class='core-mainpanel-link-icon e-tip' href='".$link."' title='{$description}'>".$icon."</a></div>";
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2012-11-26 14:41:32 -08:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
$td++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $text;
|
2012-12-03 02:21:51 -08:00
|
|
|
|
|
|
|
*/
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-08-25 10:46:46 +00:00
|
|
|
|
2012-12-05 21:30:17 -08:00
|
|
|
function render_clean() // still used by classis, tabbed etc.
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
global $td;
|
2009-11-08 12:08:35 +00:00
|
|
|
$text = "";
|
|
|
|
while ($td <= ADLINK_COLS)
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$text .= "<td class='td' style='width:20%;'></td>";
|
|
|
|
$td++;
|
|
|
|
}
|
|
|
|
$text .= "</tr>";
|
|
|
|
$td = 1;
|
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
2008-12-04 20:17:54 +00:00
|
|
|
|
2009-07-04 13:36:15 +00:00
|
|
|
|
2012-12-04 00:14:43 -08:00
|
|
|
if(is_object($adp))
|
|
|
|
{
|
|
|
|
$adp->render();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
require_once(e_ADMIN.'includes/'.$pref['adminstyle'].'.php');
|
|
|
|
}
|
2009-07-04 13:36:15 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-08-25 10:46:46 +00:00
|
|
|
|
2008-12-30 15:56:12 +00:00
|
|
|
function admin_info()
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
global $tp;
|
|
|
|
|
|
|
|
$width = (getperms('0')) ? "33%" : "50%";
|
|
|
|
|
|
|
|
$ADMIN_INFO_TEMPLATE = "
|
|
|
|
<div style='text-align:center'>
|
|
|
|
<table style='width: 100%; border-collapse:collapse; border-spacing:0px;'>
|
|
|
|
<tr>
|
|
|
|
<td style='width: ".$width."; vertical-align: top'>
|
|
|
|
{ADMIN_STATUS}
|
|
|
|
</td>
|
|
|
|
<td style='width:".$width."; vertical-align: top'>
|
|
|
|
{ADMIN_LATEST}
|
|
|
|
</td>";
|
|
|
|
|
|
|
|
if(getperms('0'))
|
|
|
|
{
|
|
|
|
$ADMIN_INFO_TEMPLATE .= "
|
|
|
|
<td style='width:".$width."; vertical-align: top'>{ADMIN_LOG}</td>";
|
|
|
|
}
|
|
|
|
|
|
|
|
$ADMIN_INFO_TEMPLATE .= "
|
|
|
|
</tr></table></div>";
|
|
|
|
|
|
|
|
return $tp->parseTemplate($ADMIN_INFO_TEMPLATE);
|
|
|
|
}
|
|
|
|
|
2008-12-30 15:56:12 +00:00
|
|
|
function status_request()
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
global $pref;
|
2009-07-04 03:08:03 +00:00
|
|
|
if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade' || $pref['adminstyle'] == 'beginner' || $pref['adminstyle'] == 'tabbed') {
|
2006-12-02 04:36:16 +00:00
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-25 10:46:46 +00:00
|
|
|
|
2008-12-30 15:56:12 +00:00
|
|
|
function latest_request()
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
global $pref;
|
2009-07-04 03:08:03 +00:00
|
|
|
if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade' || $pref['adminstyle'] == 'beginner' || $pref['adminstyle'] == 'tabbed') {
|
2006-12-02 04:36:16 +00:00
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-30 15:56:12 +00:00
|
|
|
function log_request()
|
2008-08-25 10:46:46 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
global $pref;
|
2009-07-04 03:08:03 +00:00
|
|
|
if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade'|| $pref['adminstyle'] == 'beginner' || $pref['adminstyle'] == 'tabbed') {
|
2006-12-02 04:36:16 +00:00
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-03 01:40:47 -08:00
|
|
|
// getPlugLinks() - moved to sitelinks_class.php : pluginLinks();
|
2008-08-25 10:46:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once("footer.php");
|
|
|
|
|
|
|
|
?>
|