Commit 8fda131d authored by pedro_morgan's avatar pedro_morgan
Browse files

Getting ring of finalt rootpath arguments

parent 99bf8ffb
......@@ -107,9 +107,7 @@ $conf['db_password'] = '';
$conf['db_database'] = 'ispconfig3';
*/
//$conf['rootpath'] = substr(dirname(__FILE__),0,-4);
$conf['fs_div'] = '/'; // File system divider, \\ on windows and / on linux and unix
// predro notes: not sure this is the right thing ?
$conf['cache_dir'] = ISPC_ROOT_PATH.'/cache';
......
......@@ -34,9 +34,9 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Tabellendefinition
Datentypen:
- INTEGER (Wandelt Ausdrcke in Int um)
- INTEGER (Wandelt Ausdrcke in Int um)
- DOUBLE
- CURRENCY (Formatiert Zahlen nach Whrungsnotation)
- CURRENCY (Formatiert Zahlen nach Whrungsnotation)
- VARCHAR (kein weiterer Format Check)
- TEXT (kein weiterer Format Check)
- DATE (Datumsformat, Timestamp Umwandlung)
......@@ -55,18 +55,18 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- Wert oder Array
Hinweis:
Das ID-Feld ist nicht bei den Table Values einzufgen.
Das ID-Feld ist nicht bei den Table Values einzufgen.
*/
// lese Module aus
//* Load modules
$modules_list = array();
$handle = @opendir($conf["rootpath"]."/web");
$handle = @opendir(ISPC_WEB_PATH);
while ($file = @readdir ($handle)) {
if ($file != "." && $file != "..") {
if(@is_dir($conf["rootpath"]."/web/".$file)) {
if(is_file($conf["rootpath"]."/web/".$file."/lib/module.conf.php") and $file != 'login') {
if(@is_dir(ISPC_WEB_PATH."/$file")) {
if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login') {
$modules_list[$file] = $file;
}
}
......@@ -74,197 +74,191 @@ while ($file = @readdir ($handle)) {
}
closedir($handle);
// lese Datenbanken mit aktivierter db_history ein.
//* read data bases in with more activated db_history.
$db_tables = array();
foreach($modules_list as $md) {
$handle = @opendir($conf["rootpath"]."/web/".$md."/form");
$handle = @opendir(ISPC_WEB_PATH."/$md/form");
while ($file = @readdir ($handle)) {
if ($file != "." && $file != ".." && substr($file,0,1) != '.') {
include_once($conf["rootpath"]."/web/".$md."/form/".$file);
if($form["db_history"] == "yes") {
$tmp_id = $form["db_table"];
$db_tables[$tmp_id] = $form["db_table"];
if ($file != '.' && $file != '..' && substr($file, 0, 1) != '.') {
include_once(ISPC_WEB_PATH."/$md/form/$file");
if($form['db_history'] == 'yes') {
$tmp_id = $form['db_table'];
$db_tables[$tmp_id] = $form['db_table'];
}
unset($form);
}
}
closedir($handle);
}
unset($form);
$form['title'] = 'DB sync';
$form['description'] = 'ISPConfig database snchronisation tool.';
$form['name'] = 'dbsync';
$form['action'] = 'dbsync_edit.php';
$form['db_table'] = 'sys_dbsync';
$form['db_table_idx'] = 'id';
$form['tab_default'] = 'dbsync';
$form['list_default'] = 'dbsync_list.php';
$form['auth'] = 'no';
$form["title"] = "DB sync";
$form["description"] = "ISPConfig database snchronisation tool.";
$form["name"] = "dbsync";
$form["action"] = "dbsync_edit.php";
$form["db_table"] = "sys_dbsync";
$form["db_table_idx"] = "id";
$form["tab_default"] = "dbsync";
$form["list_default"] = "dbsync_list.php";
$form["auth"] = 'no';
$form["tabs"]['dbsync'] = array (
'title' => "DB sync",
'width' => 80,
'template' => "templates/dbsync_edit.htm",
'fields' => array (
##################################
# Beginn Datenbankfelder
##################################
'jobname' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'regex' => '/^.{1,30}$/',
'errmsg' => 'jobname_err',
'default' => '',
'value' => '',
'separator' => '',
'width' => '15',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'sync_interval_minutes' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '',
'separator' => '',
'width' => '15',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_type' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => array('mysql' => 'mysql'),
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_host' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_name' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_username' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_password' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_tables' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOXARRAY',
'regex' => '',
'errmsg' => '',
'default' => 'admin,forms',
'value' => $db_tables,
'separator' => ',',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'empty_datalog' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'sync_datalog_external' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'active' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'regex' => '',
'errmsg' => '',
'default' => '1',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
)
##################################
# ENDE Datenbankfelder
##################################
)
$form['tabs']['dbsync'] = array (
'title' => 'DB sync',
'width' => 80,
'template' => 'templates/dbsync_edit.htm',
'fields' => array (
##################################
# Beginn Datenbankfelder
##################################
'jobname' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'regex' => '/^.{1,30}$/',
'errmsg' => 'jobname_err',
'default' => '',
'value' => '',
'separator' => '',
'width' => '15',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'sync_interval_minutes' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '',
'separator' => '',
'width' => '15',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_type' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => array('mysql' => 'mysql'),
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_host' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_name' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_username' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_password' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'db_tables' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOXARRAY',
'regex' => '',
'errmsg' => '',
'default' => 'admin,forms',
'value' => $db_tables,
'separator' => ',',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'empty_datalog' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'sync_datalog_external' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'regex' => '',
'errmsg' => '',
'default' => '',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),
'active' => array (
'datatype' => 'INTEGER',
'formtype' => 'CHECKBOX',
'regex' => '',
'errmsg' => '',
'default' => '1',
'value' => array(0 => 0,1 => 1),
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
)
##################################
# ENDE Datenbankfelder
##################################
)
);
?>
\ No newline at end of file
......@@ -76,9 +76,9 @@ $form['auth_preset']['userid'] = 0;
$form['auth_preset']['groupid'] = 0;
//** Permissions are: r = read, i = insert, u = update, d = delete
$form['auth_preset']['perm_user'] = 'riud';
$form['auth_preset']['perm_group'] = 'riud'; //r = read, i = insert, u = update, d = delete
$form['auth_preset']['perm_other'] = ''; //r = read, i = insert, u = update, d = delete
$form['auth_preset']['perm_user'] = 'riud';
$form['auth_preset']['perm_group'] = 'riud';
$form['auth_preset']['perm_other'] = '';
//* Pick out modules
$modules_list = array();
......
......@@ -50,10 +50,9 @@ while ($file = @readdir ($handle)) {
if(@is_dir(ISPC_WEB_PATH."/$file")) {
if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login') {
include_once(ISPC_WEB_PATH."/$file/lib/module.conf.php");
$bgcolor = ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
$modules_list[] = array( 'module' => $module['name'],
'title' => $module['title'],
'bgcolor' => $bgcolor
'bgcolor' => ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'
);
}
}
......@@ -62,7 +61,7 @@ while ($file = @readdir ($handle)) {
$app->tpl->setLoop('records', $modules_list);
// loading language file
//* loading language file
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_module_list.lng';
include($lng_file);
$app->tpl->setVar($wb);
......@@ -70,5 +69,4 @@ $app->tpl->setVar($wb);
$app->tpl_defaults();
$app->tpl->pparse();
?>
\ No newline at end of file
......@@ -30,126 +30,120 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
//* Securoty checkpoint
if($_SESSION['s']['user']['typ'] != 'admin'){
die('Admin permissions required.');
}
// Checke Berechtigungen fr Modul
// Checke Berechtigungen fr Modul
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
header("Location: ../index.php");
exit;
}
// Lade Template
//* Load template
$app->uses('tpl');
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->setInclude('content_tpl','templates/module_nav_edit.htm');
// TODO: Check module and nav_id for malicius chars, nav_id can be empty or any number, even 0
$module_name = $_REQUEST["module_name"];
$nav_id = $_REQUEST["nav_id"];
if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$nav_id)) die("nav_id contains invalid chars.");
$module_name = $_REQUEST['module_name'];
$nav_id = $_REQUEST['nav_id'];
if(empty($module_name)) die("module is empty.");
//** Sanity checks of module
if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $module_name)){
die('module_name contains invalid chars.');
}
if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $nav_id)){
die('nav_id contains invalid chars.');
}
if(empty($module_name)){
die('module is empty.');
}
if(count($_POST) > 0) {
// Bestimme aktion
if($nav_id != '') {
$action = 'UPDATE';
} else {
$action = 'INSERT';
}
//* Determine Action
$action = ($nav_id != '') ? 'UPDATE' : 'INSERT';
$error = '';
// TODO: Check variables
if($error == '') {
$filename = "../".$module_name."/lib/module.conf.php";
$filename = "../$module_name/lib/module.conf.php";
if(!@is_file($filename)) die("File not found: $filename");
if(!@is_file($filename)){
die("File not found: $filename");
}
include_once($filename);
if($action == 'UPDATE') {
$items = $module["nav"][$nav_id]["items"];
} else {
$items = array();
}
$items = ($action == 'UPDATE') ? $module['nav'][$nav_id]['items'] : array();
$tmp = array('title' =>$_POST["nav"]["title"],
'open' => 1,
$tmp = array('title' => $_POST['nav']['title'],
'open' => 1,
'items' => $items);
if($action == 'UPDATE') {
$module["nav"][$nav_id] = $tmp;
$module['nav'][$nav_id] = $tmp;
} else {
$module["nav"][] = $tmp;
$module['nav'][] = $tmp;
}
$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
// writing module.conf
//* writing module.conf
if (!$handle = fopen($filename, 'w')) {
print "Cannot open file ($filename)";
exit;
die("Cannot open file ($filename)");
}
if (!fwrite($handle, $m)) {
print "Cannot write to file ($filename)";
exit;
die("Cannot write to file ($filename)");
}
fclose($handle);
// zu Liste springen
//* Jump to list
header("Location: module_show.php?id=$module_name");
exit;
} else {
$app->tpl->setVar("error","<b>Fehler:</b><br>".$error);
$app->tpl->setVar('error', '<b>Fehler:</b><br>'.$error);
$app->tpl->setVar($_POST);
}
}
if($nav_id != '') {
// Datensatz besteht bereits
// bestehenden Datensatz anzeigen
//* Data record exists
if($error == '') {
// es liegt ein Fehler vor
include_once("../".$module_name."/lib/module.conf.php");
$record = $module["nav"][$nav_id];
include_once("../$module_name/lib/module.conf.php");
$record = $module['nav'][$nav_id];
} else {
// ein Fehler
//* error
$record = $_POST;
}
//$record["readonly"] = 'style="back