Browse Source

admin - removed as external and added directly to trunk

tags/v1.5.5
Arkadiusz Bisaga 8 years ago
parent
commit
f5d91d5856
50 changed files with 1415 additions and 0 deletions
  1. +153
    -0
      admin/AdminIndex.php
  2. +27
    -0
      admin/AdminModule.php
  3. +45
    -0
      admin/Authorization.php
  4. +52
    -0
      admin/ModuleLoader.php
  5. +111
    -0
      admin/SimpleLayout.php
  6. +97
    -0
      admin/SteppedAdminModule.php
  7. +5
    -0
      admin/authorize.php
  8. +5
    -0
      admin/configinfo.php
  9. +5
    -0
      admin/functions.php
  10. +162
    -0
      admin/images/admintools.css
  11. BIN
      admin/images/epesi-powered.png
  12. BIN
      admin/images/header-blue-hover.png
  13. BIN
      admin/images/header-blue.png
  14. BIN
      admin/images/logo-small.png
  15. +5
    -0
      admin/include.php
  16. +11
    -0
      admin/index.php
  17. +5
    -0
      admin/langup.php
  18. +5
    -0
      admin/logout.php
  19. +5
    -0
      admin/modules.php
  20. +101
    -0
      admin/modules/ConfigInfo.php
  21. +49
    -0
      admin/modules/EpesiShell.php
  22. +38
    -0
      admin/modules/LangUp.php
  23. +50
    -0
      admin/modules/Modules.php
  24. +33
    -0
      admin/modules/ModulesUp.php
  25. +131
    -0
      admin/modules/Patches/Patches.php
  26. BIN
      admin/modules/Patches/images/button-hover.gif
  27. BIN
      admin/modules/Patches/images/button-hover.png
  28. BIN
      admin/modules/Patches/images/button.gif
  29. BIN
      admin/modules/Patches/images/button.png
  30. BIN
      admin/modules/Patches/images/dark-gray-gradient.png
  31. BIN
      admin/modules/Patches/images/dark-gray.png
  32. BIN
      admin/modules/Patches/images/epesi-powered.png
  33. BIN
      admin/modules/Patches/images/favicon.png
  34. BIN
      admin/modules/Patches/images/header-blue-hover.png
  35. BIN
      admin/modules/Patches/images/header-blue.png
  36. BIN
      admin/modules/Patches/images/loader.gif
  37. BIN
      admin/modules/Patches/images/logo-small.png
  38. BIN
      admin/modules/Patches/images/patches.png
  39. +105
    -0
      admin/modules/Patches/patches.css
  40. +27
    -0
      admin/modules/PhpInfo/PhpInfo.php
  41. +108
    -0
      admin/modules/PhpInfo/phpinfo.css
  42. +40
    -0
      admin/modules/ThemeUp.php
  43. +5
    -0
      admin/modulesup.php
  44. +5
    -0
      admin/phpconsole.php
  45. +5
    -0
      admin/phpfm.php
  46. +5
    -0
      admin/phpinfo.php
  47. +5
    -0
      admin/phpinfoframe.php
  48. +5
    -0
      admin/phpminiadmin.php
  49. +5
    -0
      admin/themeup.php
  50. +5
    -0
      admin/wfb.php

+ 153
- 0
admin/AdminIndex.php View File

@@ -0,0 +1,153 @@
<?php

class AdminIndex {

private $admin_modules = array();
private $layout;
private $module_loader;

function __construct($layout, $module_loader) {
$this->layout = $layout;
$this->module_loader = $module_loader;
}

private function include_epesi() {
define('CID', false);
if (!file_exists('../data/config.php'))
return false;
require_once('../include.php');
$this->module_loader->load(array('Base_User', 'Base_User_Login', 'Base_Acl'));
require_once('admin/Authorization.php');
return true;
}
private function show_unavailable() {
$this->layout->hide_action_links();
$this->layout->display_html('Feature unavailable');
}

private function demo_or_hosting() {
if (DEMO_MODE || HOSTING_MODE) {
$this->show_unavailable();
return true;
}
return false;
}

private function authorized() {
$auth = AdminAuthorization::form();
if ($auth) {
$this->layout->hide_action_links();
$this->layout->display_html($auth);
return false;
}
return true;
}

private function include_admin_modules() {
require_once("admin/AdminModule.php");
require_once("admin/SteppedAdminModule.php");
// load modules files
$modules_dir = "admin/modules";
foreach (scandir($modules_dir) as $filename) {
$file = $modules_dir . '/' . $filename;
// include only php files
if (strtolower(pathinfo($filename, PATHINFO_EXTENSION)) == 'php') {
include_once $file;
} elseif (is_dir($file)) {
$file = $file . '/' . $filename . '.php';
if (file_exists($file))
include_once $file;
}
}
}

private function create_admin_modules_instances() {
foreach (get_declared_classes() as $class) {
$rclass = new ReflectionClass($class);
if ($rclass->isSubclassOf("AdminModule") && !$rclass->isAbstract()) {
$module = new $class;
if (
(Base_AclCommon::i_am_sa()) ||
(Base_AclCommon::i_am_admin() && $module->access_admin()) ||
(Base_AclCommon::i_am_user() && $module->access_user())
) {
$this->admin_modules[$class] = $module;
}
}
}
ksort($this->admin_modules);
}

private function selected_module() {
$module_param = isset($_GET['module']) ? $_GET['module'] : null;
return isset($this->admin_modules[$module_param]) ? $this->admin_modules[$module_param] : null;
}

private function show_module($module) {
$this->module_loader->load($module->required_epesi_modules());
$this->layout->set_title($module->menu_entry());
$this->layout->display_html($module->body());
}

private function show_menu() {
foreach ($this->admin_modules as $module_name => $module) {
$href = '?' . http_build_query(array('module' => $module_name));
$this->layout->add_menu_entry($href, $module->menu_entry());
}
$this->layout->display_menu();
}

private function logout_action() {
if (isset($_GET['logout'])) {
unset($_GET['logout']);
Base_User_LoginCommon::logout();
$get = count($_GET) ? '?' . http_build_query($_GET) : '';
header('Location: ' . $_SERVER['PHP_SELF'] . $get);
} else {
$get = $_GET;
$get['logout'] = 1;
$this->layout->add_action_link('?' . http_build_query($get), 'Logout');
}
}

private function main_menu_action() {
$this->layout->add_action_link($_SERVER['PHP_SELF'], 'Main menu');
}
private function start_epesi_action() {
$admin_index = $_SERVER['PHP_SELF'];
$epesi_dir = rtrim(dirname(dirname($admin_index)), '/') . '/';
$this->layout->add_action_link($epesi_dir, 'Start EPESI');
}

function run() {
if (!$this->include_epesi()) { // current directory changed to main epesi dir
$this->show_unavailable();
return;
}
if ($this->demo_or_hosting())
return;

$this->main_menu_action();
$this->start_epesi_action();
$this->logout_action();

if (!$this->authorized())
return;

$this->include_admin_modules();
$this->create_admin_modules_instances();

$module = $this->selected_module();
if ($module)
$this->show_module($module);
else
$this->show_menu();
}

}

?>

+ 27
- 0
admin/AdminModule.php View File

@@ -0,0 +1,27 @@
<?php

/**
* Simple admin module to display some html.
*
* @author Adam Bukowski <abukowski@telaxus.com>
*/
abstract class AdminModule {

abstract function menu_entry();

abstract function body();
function required_epesi_modules() {
return array();
}
function access_admin() {
return false;
}
function access_user() {
return false;
}
}

?>

+ 45
- 0
admin/Authorization.php View File

@@ -0,0 +1,45 @@
<?php

require_once('modules/Libs/QuickForm/requires.php');

class AdminAuthorization {

static function form() {
try {
$anonymous = Variable::get('anonymous_setup');
} catch (NoSuchVariableException $e) {
$anonymous = true;
}

if ((!Base_AclCommon::is_user()) && !$anonymous) {
Base_User_LoginCommon::autologin();
}
if ((!Base_AclCommon::is_user()) && !$anonymous) {
$get = count($_GET) ? '?' . http_build_query($_GET) : '';
$form = new HTML_QuickForm('loginform', 'post', $_SERVER['PHP_SELF'] . $get);
$form->addElement('html', '<div class="title">Admin Tools<div><hr/>');
$form->addElement('text', 'user', 'Login');
$form->addRule('user', 'Field required', 'required');
$form->addElement('password', 'pass', 'Password');
$form->addRule('pass', 'Field required', 'required');
$form->registerRule('check_login', 'callback', 'submit_login', 'AdminAuthorization');
$form->addRule('user', 'Login or password incorrect', 'check_login', $form);
$form->addElement('submit', null, 'Ok');
if ($form->validate()) {
$user = $form->exportValue('user');
Base_AclCommon::set_user(Base_UserCommon::get_user_id($user), true);
// redirect below is used to better browser refresh behavior.
header('Location: ' . $_SERVER['REQUEST_URI']);
} else {
return "<center>" . $form->toHtml() . "</center>";
}
}
}

static function submit_login($username, $form) {
return ModuleManager::is_installed('Base_User_Login') >= 0 && Base_User_LoginCommon::check_login($username, $form->exportValue('pass'));
}

}

?>

+ 52
- 0
admin/ModuleLoader.php View File

@@ -0,0 +1,52 @@
<?php

/**
* Description of ModuleLoader
*
* @author Adam Bukowski <abukowski@telaxus.com>
*/
class ModuleLoader {
const all_modules = ':all:';

private $lpa;
private $lpa_count;
private $lpa_index = 0;
private $loaded_modules = array();
private $initialized = false;

private function init() {
if (!$this->initialized) {
$this->initialized = true;
$this->lpa = ModuleManager::get_load_priority_array();
$this->lpa_count = count($this->lpa);
ModuleManager::$not_loaded_modules = $this->lpa;
ModuleManager::$loaded_modules = array();
ModulesAutoloader::enable(false);
}
}

function load($modules) {
$this->init();
if (!is_array($modules))
$modules = array($modules);

foreach ($modules as $m) {
if (array_key_exists($m, ModuleManager::$modules))
continue;

while ($this->lpa_index < $this->lpa_count) {
$row = $this->lpa[$this->lpa_index++];
$module = $row['name'];
$version = $row['version'];
ModuleManager :: include_common($module, $version);
ModuleManager :: register($module, $version, ModuleManager::$modules);
if ($m != self::all_modules && $module == $m)
break;
}
}
}

}

?>

+ 111
- 0
admin/SimpleLayout.php View File

@@ -0,0 +1,111 @@
<?php

class SimpleLayout {

private $menu_entries = array();
private $show_action_links = true;
private $action_links = array();
private $title = '';

function add_menu_entry($href, $text) {
$this->menu_entries[$href] = htmlspecialchars($text);
}

function hide_action_links() {
$this->show_action_links = false;
}
function add_action_link($href, $text) {
$this->action_links[$text] = $href;
}
function set_title($title) {
$this->title = $title;
}
private function format_action_links() {
$links = array();
foreach($this->action_links as $text => $href) {
$text = htmlspecialchars($text);
$links[] = "<a href=\"$href\">$text</a>";
}
return implode(' | ', $links);
}

function display_html($html) {
$this->pageheader();
$this->startframe();

print($html);

$this->closeframe();
$this->pagefooter();
}

function display_menu() {
$this->pageheader();
$this->startframe();

asort($this->menu_entries);
$i = 1;
foreach ($this->menu_entries as $href => $text) {
print("<a href=\"$href\">$i. {$text}</a><br/>");
$i++;
}
if ($i == 1) { // no menu entries
print("There is nothing here for you.");
}

$this->closeframe();
$this->pagefooter();
}

function pageheader() { ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php $xx = $this->title ? $this->title . ' - ' : ''; print $xx; ?>EPESI Administrator's Tools</title>
<link href="./images/admintools.css" rel="stylesheet" type="text/css" />

</head>

<body>
<table id="banner" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="image">&nbsp;</td>
<td class="header">&nbsp;&nbsp;Administrator's Tools&nbsp;</td>
</tr>
</table>
<br/>
<center>
<?php }

function startframe() { ?>
<div id="main">
<div class="content">
<?php
}

function closeframe() {
?>
</div></div>
<?php }

function pagefooter() {
print '<br/><center>';
if ($this->show_action_links)
print('<div class="title">' . $this->format_action_links() . '</div>');
?>
<hr/>
<p><a href="http://www.epesi.org"><img src="./images/epesi-powered.png" border="0" alt="EPESI powered"/></a></p>
<span class="footer">Copyright &copy; 2012 &bull; <a href="http://www.epesi.org/">epesi framework</a> &bull; Application developed by <a href="http://www.telaxus.com">Telaxus LLC</a></span>
<br/>
</center>

</body>

</html>
<?php }

}
?>

+ 97
- 0
admin/SteppedAdminModule.php View File

@@ -0,0 +1,97 @@
<?php

/**
* This class provide two step admin module. Just implement abstract methods.
* action method should return boolean success value.
*
* @author Adam Bukowski <abukowski@telaxus.com>
*/
abstract class SteppedAdminModule extends AdminModule {

private static $step_var = 'step';
private $button_text = 'Next';
private $next_step;
private $step = false;

abstract function header();

abstract function action();

abstract function start_text();

abstract function success_text();

abstract function failure_text();

public function body() {
ob_start();
$this->_get_step();
$this->_print_header();
if ($this->step)
$this->_run_action();
else
$this->_print_starting_page();
$this->_print_action_button();
return ob_get_clean();
}

private function _get_step() {
if (isset($_POST[self::$step_var]) && $_POST[self::$step_var]) {
$_SESSION[self::$step_var] = $_POST[self::$step_var];
header('Location: ' . $_SERVER['REQUEST_URI']);
die();
}
if (isset($_GET[self::$step_var]) && $_GET[self::$step_var]) {
$_SESSION[self::$step_var] = $_GET[self::$step_var];
}
$this->step = isset($_SESSION[self::$step_var])
? $_SESSION[self::$step_var] : false;
// set next step if we are in first page
if (!$this->step && !$this->next_step)
$this->set_next_step(1);
}
protected function get_step() {
return $this->step;
}

private function _print_header() {
print('<div class="title">' . $this->header() . '</div><br/>');
}

private function _run_action() {
print( $this->action() ?
$this->success_text() :
$this->failure_text()
);
unset($_SESSION[self::$step_var]);
}

private function _print_starting_page() {
print($this->start_text());
}
private function _print_action_button() {
if ($this->next_step != null)
print("<br/><br/><center>{$this->_run_button()}</center>");
}

private function _run_button() {
return '<form method="post">
<input type="hidden" name="' . self::$step_var . '" value="' .
htmlspecialchars($this->next_step) . '" />
<input type="submit" class="button" value="' .
htmlspecialchars($this->button_text) . '" /></form>';
}
protected function set_button_text($text) {
$this->button_text = $text;
}
protected function set_next_step($value) {
$this->next_step = $value;
}

}

?>

+ 5
- 0
admin/authorize.php View File

@@ -0,0 +1,5 @@
<?php

die('File removed');

?>

+ 5
- 0
admin/configinfo.php View File

@@ -0,0 +1,5 @@
<?php

die('File removed');

?>

+ 5
- 0
admin/functions.php View File

@@ -0,0 +1,5 @@
<?php

die('File removed');

?>

+ 162
- 0
admin/images/admintools.css View File

@@ -0,0 +1,162 @@
body {
font-family: Geneva,Arial,Helvetica,sans-serif;
font-size: 10px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
background-color: #EAEAEA;
}
a {
color: #1d7dd1;
font-weight: bold;
text-decoration: none;
}
table.listing {
width: 100%;
}
table.listing td {
width: 50%;
}
table.listing tr.even {
background-color: white;
}
table.listing tr.odd {
background-color: #e5e5ff;
}
.button {
color: #FFFFFF;
font-weight: normal;
line-height: 20px;
display: block;
width: 100px;
background-image: url("header-blue.png");
text-align: center;
}
.button:hover {
background-image: url("header-blue-hover.png");
}
.green {
color: #669933;
}
.red {
color: #993333;
}
.blue {
color: #336699;
}
.left {
float: left;
width: 50%;
}
.right {
float: right;
width: 50%;
}
.header {
height: 30px;
padding-top: 6px;
padding-left: 80px;
color: #1d7dd1;
font-size: 30px;
font-weight: bold;
}
.title {
height: 30px;
color: #1d7dd1;
font-size: 20px;
font-weight: bold;
text-align: center;
margin-bottom: 10px;
}
span.footer {
font-size: 10px;
color: #777777;
}
.line {
height: 1px;
width: 100%;
background-color: #B3B3B3;
margin-top: 10px;
margin-bottom: 10px;
}
/*** table banner ***/
#banner {
width: 100%;
border-bottom: 4px solid #1d7dd1;
}
#banner .image {
background-image: url("logo-small.png");
background-repeat: repeat-x;
width: 193px;
height: 83px;
}
#banner .header {
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #e0e0e0 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e0e0e0)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* IE10+ */
background: linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e0e0e0',GradientType=0 ); /* IE6-9 */
}
/*** main box ***/
#main {
border: 2px solid #1d7dd1;
background-color: #FFFFFF;
-moz-border-radius: 10px; /* Firefox 1+ */
-webkit-border-radius: 10px; /* Safari 3+, Chrome */
border-radius: 10px; /* CSS3, Opera 10.5, IE 9 */
-moz-box-shadow: 1px 2px 10px #333333; /* Firefox F3.5+ */
-webkit-box-shadow: 1px 2px 10px #333333; /* Safari3.0+, Chrome */
box-shadow: 1px 2px 10px #333333; /* Opera 10.5, IE 9.0 */
padding: 0px 0px 0px 0px;
font-size: 16px;
background-color: #FFFFFF;
width: 650px;
text-align: left;
margin:20px;
}
.content {
padding: 20px 20px 20px 20px;
}
.div-button {
height: 48px;
padding-top: 20px;
}
div.licence {
overflow: auto;
height: 300px;
border: 1px solid #B3B3B3;
background-color: #FFFFFF;
padding: 10px 10px 10px 10px;
}
input {
font-size: 11px;
border: 1px solid #B3B3B3;
}

BIN
admin/images/epesi-powered.png View File

Before After
Width: 118  |  Height: 15  |  Size: 1019 B

BIN
admin/images/header-blue-hover.png View File

Before After
Width: 1  |  Height: 20  |  Size: 210 B

BIN
admin/images/header-blue.png View File

Before After
Width: 1  |  Height: 20  |  Size: 214 B

BIN
admin/images/logo-small.png View File

Before After
Width: 193  |  Height: 83  |  Size: 16 KiB

+ 5
- 0
admin/include.php View File

@@ -0,0 +1,5 @@
<?php

die('File removed');

?>

+ 11
- 0
admin/index.php View File

@@ -0,0 +1,11 @@
<?php

require_once('AdminIndex.php');
require_once('SimpleLayout.php');
require_once('ModuleLoader.php');

$module_loader = new ModuleLoader();
$layout = new SimpleLayout();
$admin = new AdminIndex($layout, $module_loader);
$admin->run();
?>

+ 5
- 0
admin/langup.php View File

@@ -0,0 +1,5 @@
<?php

die('File removed');

?>

+ 5
- 0
admin/logout.php View File

@@ -0,0 +1,5 @@
<?php

die('File removed');

?>

+ 5
- 0
admin/modules.php View File

@@ -0,0 +1,5 @@
<?php

die('File removed');

?>

+ 101
- 0
admin/modules/ConfigInfo.php View File

@@ -0,0 +1,101 @@
<?php

/**
* Description of ConfigInfo
*
* @author ajb
*/
class ConfigInfo extends AdminModule {

private function startTable() {
print('<table class="listing">');
}

private function closeTable() {
print('</table>');
}

// Print 2 columns
private function printTD($left = '&nbsp;', $right = '&nbsp;', $color = 'green', $strong = true) {
static $rowclass = null;
if ($rowclass != 'odd')
$rowclass = 'odd';
else
$rowclass = 'even';
if ($right == "NO") {
$color = 'red';
}
$tag = $strong ? 'strong' : 'span';
print("<tr class=\"$rowclass\"><td>$left</td><td><$tag class=\"$color\">$right</$tag></td></tr>");
}

private function print_info() {
print('<div class="title">PHP environment check</div>');

$this->startTable();
$data_dir_ok = is_writable('data');
$data_writable = $data_dir_ok ? "OK" : '<strong>WARNING!</strong> Please fix privileges for data directory.';
$color = $data_dir_ok ? 'green' : 'red';
$this->printTD("Data directory is writeable", $data_writable, $color, $data_dir_ok);

$version_ok = version_compare(phpversion(), '5.1.0') >= 0;
$text = $version_ok ? 'OK' : '<strong>WARNING!</strong> You are running an old version of PHP, minimum version 5.1 required.';
$color = $version_ok ? 'green' : 'red';
$this->printTD('PHP version: ' . phpversion(), $text, $color, $version_ok);

$curl_ok = extension_loaded('curl');
$curl_loaded = $curl_ok ? 'OK' : 'Curl extension not found - Please uncomment <pre><strong>;extension=php_curl.dll</strong></pre> line in your php.ini';
$color = $curl_ok ? 'green' : 'red';
$this->printTD("Curl loaded", $curl_loaded, $color, $curl_ok);
$this->closeTable();

print('<br/><br/><div class="title">EPESI config.php</div>');

$this->startTable();
$this->printTD('epesi version:', EPESI_VERSION);
$this->printTD('epesi revison:', EPESI_REVISION);
$this->printTD('Database Name:', DATABASE_NAME);
$this->printTD('Database Driver:', DATABASE_DRIVER);
$this->printTD('epesi Local Dir:', EPESI_LOCAL_DIR);
$this->printTD('epesi Dir:', EPESI_DIR);
$this->printTD('epesi URL:', get_epesi_url());
$this->printTD('System Timezone:', SYSTEM_TIMEZONE);

$this->printTD('Debug:', (DEBUG ? 'YES' : 'NO'));
$this->printTD('Module Times:', (MODULE_TIMES ? 'YES' : 'NO'));
$this->printTD('Display sql queries processing times: ', (SQL_TIMES ? 'YES' : 'NO'));
$this->printTD('Strip output html from comments: ', (STRIP_OUTPUT ? 'YES' : 'NO'));
$this->printTD('Display additional error info: ', (DISPLAY_ERRORS ? 'YES' : 'NO'));
$this->printTD('Report all errors (E_ALL): ', (REPORT_ALL_ERRORS ? 'YES' : 'NO'));
$this->printTD('GZIP client web browser history: ', (GZIP_HISTORY ? 'YES' : 'NO'));

$this->printTD('Reducing Transfer: ', (REDUCING_TRANSFER ? 'YES' : 'NO'));
$this->printTD('Minify Encode: ', (MINIFY_ENCODE ? 'YES' : 'NO'));
$this->printTD('Minify sources: ', (MINIFY_SOURCES ? 'YES' : 'NO'));
$this->printTD('Suggest Donation: ', (SUGGEST_DONATION ? 'YES' : 'NO'));
$this->printTD('Check epesi version: ', (CHECK_VERSION ? 'YES' : 'NO'));
$this->printTD('JS Output: ', (JS_OUTPUT ? 'YES' : 'NO'));
$this->printTD('Set Session: ', (SET_SESSION ? 'YES' : 'NO'));

$this->printTD('Read Only Session: ', (READ_ONLY_SESSION ? 'YES' : 'NO'));
$this->printTD('Mobile Device: ', (MOBILE_DEVICE ? 'YES' : 'NO'));
$this->printTD('First Run: ', (FIRST_RUN ? 'YES' : 'NO'));
$this->printTD('Hosting Mode: ', (HOSTING_MODE ? 'YES' : 'NO'));
$this->printTD('Trial Mode: ', (TRIAL_MODE ? 'YES' : 'NO'));
$this->printTD('Demo Mode: ', (DEMO_MODE ? 'YES' : 'NO'));
$this->closeTable();
}

public function body() {
ob_start();
$this->print_info();
return ob_get_clean();
}

public function menu_entry() {
return "PHP environment & config.php";
}

}

?>

+ 49
- 0
admin/modules/EpesiShell.php View File

@@ -0,0 +1,49 @@
<?php

class EpesiShell extends AdminModule {

public function menu_entry() {
return 'Run PHP command';
}

public function required_epesi_modules() {
return ModuleLoader::all_modules;
}

public function body() {
ob_start();
print('<div class="title">EPESI Shell</div>');
print('<p>Place "return" statement to see returned value</p>');
$cmd = $this->cmd();
if ($cmd) {
ob_start();
$returned_value = eval($cmd . ';');
$output = ob_get_clean();
$this->output($output);
$this->returned_value($returned_value);
}
$this->form($cmd);
return ob_get_clean();
}

private function cmd() {
return isset($_POST['cmd']) ? $_POST['cmd'] : null;
}

private function output($output) {
print('<pre>Output:</pre><div style="border: 1px solid lightgray; padding: 10px">' . $output . '</div>');
}

private function returned_value($value) {
print('<pre>Returned value:</pre><div style="border: 1px solid lightgray; padding: 10px; overflow: auto"><xmp>');
var_dump($value);
print('</xmp></div>');
}

private function form($cmd = '') {
print('<pre>Command:<form method="post"><textarea type="text" name="cmd" style="width:100%">' . $cmd . '</textarea><input type="submit" value="execute"/></form></pre>');
}

}

?>

+ 38
- 0
admin/modules/LangUp.php View File

@@ -0,0 +1,38 @@
<?php

class LangUp extends SteppedAdminModule {

public function menu_entry() {
return "Rebuild language files";
}

public function required_epesi_modules() {
return array('Base_Lang');
}

public function header() {
return 'Language Updater Utility';
}

public function action() {
Base_LangCommon::update_translations();
return true;
}

public function start_text() {
return '<center>This utility will rebuild language files.<br/><br/>'
. 'After clicking Next button please wait...<br/>'
. 'Rebuilding language files may take a while.</center>';
}

public function success_text() {
return '<center><strong>Language files were successfully updated.</strong></center>';
}

public function failure_text() {
return 'Failure';
}

}

?>

+ 50
- 0
admin/modules/Modules.php View File

@@ -0,0 +1,50 @@
<?php

class Modules extends AdminModule {

public function body() {
ob_start();

//create default module form
print('<div class="title">Select modules to disable</div>');
print('<span style="color: red; font-weight: bold">WARNING!</span> Selected modules will be marked as not installed but uninstall methods <strong>WILL NOT</strong> be called. Any database tables and other modifications made by modules\' install methods will not be reverted.');
print('<hr/><br/>');
$form = new HTML_QuickForm('modulesform', 'post', $_SERVER['PHP_SELF'] . '?' . http_build_query($_GET), '', null, true);

$modules = DB::GetAssoc('SELECT name, name FROM modules ORDER BY name');
foreach ($modules as $name)
$form->addElement('checkbox', $name, $name);

$form->addElement('button', 'submit_button', 'Disable Selected', array('class' => 'button', 'onclick' => 'if(confirm("Are you sure you want to disable selected modules?"))document.modulesform.submit();'));

//validation or display
if ($form->validate()) {
//uninstall
$vals = $form->exportValues();
$ret = DB::Execute('SELECT * FROM modules ORDER BY priority DESC');
$uninstalled = array();
while ($row = $ret->FetchRow())
if (isset($vals[$row['name']]) && $vals[$row['name']]) {
DB::Execute('DELETE FROM modules WHERE name=%s', array($row['name']));
$uninstalled[] = $row['name'];
}
if (count($uninstalled)) {
print('<strong>Modules that were marked as uninstalled:</strong><br/>');
print(implode('<br/>', $uninstalled));
} else {
print('No modules selected.');
}
} else {
$form->display();
}

return ob_get_clean();
}

public function menu_entry() {
return "Disable modules";
}

}

?>

+ 33
- 0
admin/modules/ModulesUp.php View File

@@ -0,0 +1,33 @@
<?php

class ModulesUp extends SteppedAdminModule {

public function menu_entry() {
return "Update load priority array";
}

public function header() {
return 'Update load priority array';
}

public function action() {
ModuleManager::create_load_priority_array();
return true;
}

public function start_text() {
return '<center>This utility will rebuild load priority array.<br/><br/>'
. 'After clicking Next button please wait...</center>';
}

public function success_text() {
return '<center><strong>Load priority array was successfully updated.</strong></center>';
}

public function failure_text() {
return '';
}

}

?>

+ 131
- 0
admin/modules/Patches/Patches.php View File

@@ -0,0 +1,131 @@
<?php

class Patches extends SteppedAdminModule {

private $_patches_ran;

public function menu_entry() {
return 'Patches';
}

public function header() {
print ('<link href="modules/Patches/patches.css" rel="stylesheet" type="text/css" />');
return 'EPESI Patching utility';
}

public function required_epesi_modules() {
return ModuleLoader::all_modules;
}

public function action() {
$success = true;
ini_set('display_errors',true);
set_time_limit(0);
switch ($this->get_step()) {
case 1:
$this->_patches_ran = PatchUtil::apply_new();
$this->set_next_step(2);
break;
case 2:
ModuleManager::create_common_cache();
Base_ThemeCommon::themeup();
Base_LangCommon::update_translations();
break;
}
return $success;
}

public function start_text() {
ob_start();
$this->_print_patches_list();
$patches = '<br/><br/>' . ob_get_clean();
return '<center><b>This utility scans for available patches and applies them as necessary</b></center>' . $patches;
}

public function success_text() {
switch ($this->get_step()) {
case 1:
ob_start();
$this->_print_ran_patches();
return ob_get_clean();
case 2:
$txt = 'The installation was patched and cache files were updated.';
return "<center><strong>$txt</strong></center>";
}
}

public function failure_text() {
}

private function _print_ran_patches() {
$patched_success = 0;
$patched_failure = 0;
print('<table id="patches">');
foreach ($this->_patches_ran as $patch) {
if ($patch->get_apply_success()) {
$this->print_row_install_success($patch);
$patched_success++;
} else {
$this->print_row_install_failure($patch);
$patched_failure++;
}
}
if ($patched_success)
print('<tr><td><div class="left">&nbsp;</div><div class="center strong">Patches successfully installed: </div><div class="right green strong">' . $patched_success . '</div></td></tr>');
if ($patched_failure)
print('<tr><td><div class="left">&nbsp;</div><div class="center strong">Patches with errors: </div><div class="right red strong">' . $patched_failure . '</div></td></tr>');
print('<tr><td><div class="content infotext">Press NEXT to rebuild common cache, theme files and base language files. This operation can take a minute...</div></td></tr>');
print('</table>');
}

private function _print_patches_list() {
$counter = 0;
$counterpatched = 0;
$patches = PatchUtil::list_patches(false);
print('<table id="patches">');
foreach ($patches as $patch) {
if ($patch->was_applied()) {
$this->print_row_old_patch($patch);
$counterpatched++;
} else {
$this->print_row_new_patch($patch);
$counter++;
}
}
print('<tr><td>&nbsp;</td></tr>');
if ($counter)
print('<tr><td><div class="left">&nbsp;</div><div class="center strong">New patches found: </div><div class="right red strong">' . $counter . '</div></td></tr>');
if ($counterpatched)
print('<tr><td><div class="left">&nbsp;</div><div class="center strong">Patches already installed: </div><div class="right green">' . $counterpatched . '</div></td></tr>');
if ($counter == 0) {
print('<tr><td><div class="content infotext">No new patches were found. Press NEXT to rebuild common cache and theme files. This operation can take a minute...</div></td></tr>');
$this->set_next_step(2);
} else {
print('<tr><td><div class="content infotext">New patches were found. Press NEXT to apply them. This operation can take a minute...</div></td></tr>');
$this->set_next_step(1);
}
print('</table>');
}

private function print_row_new_patch(Patch $patch) {
print("<tr><td><div class=\"left strong\">{$patch->get_module()}</div><div class=\"center strong\"><b>{$patch->get_short_description()}</b></div><div class=\"right red strong\">new patch</div></td></tr>");
}

private function print_row_old_patch(Patch $patch) {
print("<tr><td><div class=\"left\">{$patch->get_module()}</div><div class=\"center\">{$patch->get_short_description()}</div><div class=\"right green\">installed</div></td></tr>");
}

private function print_row_install_success(Patch $patch) {
print("<tr><td><div class=\"left\">{$patch->get_module()}</div><div class=\"center\">{$patch->get_short_description()}</div><div class=\"right green strong\">patch installed</div></td></tr>");
}

private function print_row_install_failure(Patch $patch) {
print("<tr><td><div class=\"left strong\">{$patch->get_module()}</div><div class=\"center strong\">{$patch->get_short_description()}</div><div class=\"right red strong\">install error</div></td></tr>");
$errormsg = "File: {$patch->get_file()}\n{$patch->get_apply_error_msg()}";
print("<tr><td><pre class=\"errorbox\">$errormsg</pre></td></tr>");
}

}

?>

BIN
admin/modules/Patches/images/button-hover.gif View File

Before After
Width: 100  |  Height: 20  |  Size: 536 B

BIN
admin/modules/Patches/images/button-hover.png View File

Before After
Width: 100  |  Height: 20  |  Size: 208 B

BIN
admin/modules/Patches/images/button.gif View File

Before After
Width: 100  |  Height: 20  |  Size: 517 B

BIN
admin/modules/Patches/images/button.png View File

Before After
Width: 100  |  Height: 20  |  Size: 306 B

BIN
admin/modules/Patches/images/dark-gray-gradient.png View File

Before After
Width: 300  |  Height: 1  |  Size: 276 B

BIN
admin/modules/Patches/images/dark-gray.png View File

Before After
Width: 10  |  Height: 10  |  Size: 186 B

BIN
admin/modules/Patches/images/epesi-powered.png View File

Before After
Width: 118  |  Height: 15  |  Size: 1019 B

BIN
admin/modules/Patches/images/favicon.png View File

Before After
Width: 16  |  Height: 16  |  Size: 146 B

BIN
admin/modules/Patches/images/header-blue-hover.png View File

Before After
Width: 1  |  Height: 20  |  Size: 210 B

BIN
admin/modules/Patches/images/header-blue.png View File

Before After
Width: 1  |  Height: 20  |  Size: 214 B

BIN
admin/modules/Patches/images/loader.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 606 B

BIN
admin/modules/Patches/images/logo-small.png View File

Before After
Width: 193  |  Height: 83  |  Size: 5.6 KiB

BIN
admin/modules/Patches/images/patches.png View File

Before After
Width: 32  |  Height: 32  |  Size: 1.8 KiB

+ 105
- 0
admin/modules/Patches/patches.css View File

@@ -0,0 +1,105 @@
/* Generated by KompoZer */
a {
color: #336699;
font-weight: bold;
text-decoration: none;
}

a:hover {
color: #993333;
}

a.button {
color: #ffffff;
font-weight: normal;
line-height: 20px;
height: 20px;
display: block;
width: 100px;
background-image: url('images/button.gif');
text-align: center;
}

a.button:hover {
background-image: url('images/button-hover.gif');
}

.green {
color: #339933;
}
.red {
color: #993333;
}
.blue {
color: #336699;
}

.left {
padding-left: 10px;
width: 200px;
display: block;
text-align: center;
color: gray;
float: left;
}

.center {
padding-left: 10px;
padding-right: 10px;
width: 260px;
font-weight: normal;
display: block;
float: left;
}

.right {
width: 100px;
display: block;
float: right;
text-align: right;
padding-right: 10px;
}

.strong {
font-weight: bold;
}

.errorbox {
padding-left: 40px;
padding-right: 40px;
color: gray;
}

#patches {
padding: 0px;
font-size: 11px;
}

#patches td {
padding: 0;
}

.content {
padding: 20px;
}

.infotext {
text-align: center;
font-weight: bold;
}

.div-button {
height: 48px;
padding-top: 20px;
}
div.licence {
border: 1px solid #b3b3b3;
padding: 10px;
overflow: auto;
height: 300px;
background-color: #ffffff;
}
input {
border: 1px solid #b3b3b3;
font-size: 11px;
}

+ 27
- 0
admin/modules/PhpInfo/PhpInfo.php View File

@@ -0,0 +1,27 @@
<?php

class PhpInfo extends AdminModule {

public function menu_entry() {
return "PHP Info";
}

public function body() {
ob_start();
print('<link href="./modules/PhpInfo/phpinfo.css" rel="stylesheet" type="text/css" />');
print('<div id="phpinfo" style="height: 800px; overflow-y:auto;">');
ob_start();
phpinfo();
$pinfo = ob_get_contents();
ob_end_clean();

// the name attribute "module_Zend Optimizer" of an anker-tag is not xhtml valide, so replace it with "module_Zend_Optimizer"
echo ( str_replace("module_Zend Optimizer", "module_Zend_Optimizer", preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $pinfo)) );

print('</div>');
return ob_get_clean();
}

}

?>

+ 108
- 0
admin/modules/PhpInfo/phpinfo.css View File

@@ -0,0 +1,108 @@
body, table {
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 12px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
background-color: #e6e6e7;
table-layout: fixed;
}

#phpinfo .pre{
margin: 0px;
font-family: monospace;
}
#phpinfo a:link{
color: #1d7dd1;
text-decoration: none;
/* background-color: #ffffff; */
}
#phpinfo a:hover{
text-decoration: underline;
}
#phpinfo table{
border-collapse: collapse;
width:100%;
overflow: hidden;
word-break: break-all;
}
#phpinfo .center{
text-align: center;
}
#phpinfo .center table{
margin-left: auto;
margin-right: auto;
text-align: left;
}
#phpinfo .center th{
text-align: center !important;
}
#phpinfo td {
border: 1px solid #000000;
vertical-align: baseline;
}

#phpinfo th {
border: 1px solid #000000;
vertical-align: baseline;
color: white;
width: 30%;
}
#phpinfo h1 {
font-size: 150%;
color: black;
}
#phpinfo h2 {
font-size: 125%;
color: white;
background-color: #ba4f4f;
padding-top: 5px;
padding-bottom: 5px;
}
#phpinfo .p {
text-align: left;
}
#phpinfo .e {
background-color: #1b8a1b;
font-weight: bold;
color: white;
width: 30%;
}
#phpinfo .h {
background-color: #1d7dd1;
font-weight: bold;
color: #000000;
}
#phpinfo .v {
background-color: #ffffcc;
color: #000000;
}
#phpinfo .vr {
background-color: #cccccc;
text-align: right;
color: #000000;
}
#phpinfo img {
float: right;
border: 0px;
}
#phpinfo hr {
width: 100%;
background-color: #cccccc;
border: 0px;
height: 1px;
color: #000000;
}

+ 40
- 0
admin/modules/ThemeUp.php View File

@@ -0,0 +1,40 @@
<?php

class ThemeUp extends SteppedAdminModule {

public function menu_entry() {
return "Rebuild common cache & default theme";
}

public function required_epesi_modules() {
return array('Base_Theme');
}

public function header() {
return 'Theme Updater Utility';
}

public function action() {
set_time_limit(0);
ModuleManager::create_common_cache();
Base_ThemeCommon::themeup();
return true;
}

public function start_text() {
return '<center>This utility will rebuild Common Cache and refresh Theme files.<br/><br/>'
. 'After clicking Next button please wait...<br/>'
. 'Rebuilding theme files may take a while.</center>';
}

public function success_text() {
return '<center><strong>Common Cache and Theme templates were successfully updated.</strong></center>';
}

public function failure_text() {
return 'Failure';
}

}

?>

+ 5
- 0
admin/modulesup.php View File

@@ -0,0 +1,5 @@
<?php

die('File removed');

?>

+ 5
- 0
admin/phpconsole.php View File

@@ -0,0 +1,5 @@
<?php

die('Tool removed');

?>

+ 5
- 0
admin/phpfm.php View File

@@ -0,0 +1,5 @@
<?php
die('Tool removed');
?>

+ 5
- 0
admin/phpinfo.php View File

@@ -0,0 +1,5 @@
<?php

die('File removed');

?>

+ 5
- 0
admin/phpinfoframe.php View File

@@ -0,0 +1,5 @@
<?php
die('File removed');
?>

+ 5
- 0
admin/phpminiadmin.php View File

@@ -0,0 +1,5 @@
<?php

die('Tool removed');

?>

+ 5
- 0
admin/themeup.php View File

@@ -0,0 +1,5 @@
<?php

die('File removed');

?>

+ 5
- 0
admin/wfb.php View File

@@ -0,0 +1,5 @@
<?php

die('Tool removed');

?>

Loading…
Cancel
Save