Getting ring of finalt rootpath arguments
| | |
| | | $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'; |
| | | |
| | | |
| | |
| | | Tabellendefinition |
| | | |
| | | Datentypen: |
| | | - INTEGER (Wandelt Ausdrücke in Int um) |
| | | - INTEGER (Wandelt Ausdr�cke in Int um) |
| | | - DOUBLE |
| | | - CURRENCY (Formatiert Zahlen nach Währungsnotation) |
| | | - CURRENCY (Formatiert Zahlen nach W�hrungsnotation) |
| | | - VARCHAR (kein weiterer Format Check) |
| | | - TEXT (kein weiterer Format Check) |
| | | - DATE (Datumsformat, Timestamp Umwandlung) |
| | |
| | | - Wert oder Array |
| | | |
| | | Hinweis: |
| | | Das ID-Feld ist nicht bei den Table Values einzufügen. |
| | | Das ID-Feld ist nicht bei den Table Values einzuf�gen. |
| | | |
| | | |
| | | */ |
| | | |
| | | // 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; |
| | | } |
| | | } |
| | |
| | | } |
| | | 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 |
| | | ################################## |
| | | ) |
| | | ); |
| | | |
| | | ?> |
| | |
| | | $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(); |
| | |
| | | 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' |
| | | ); |
| | | } |
| | | } |
| | |
| | | |
| | | $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); |
| | | |
| | | $app->tpl_defaults(); |
| | | $app->tpl->pparse(); |
| | | |
| | | |
| | | ?> |
| | |
| | | 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 für Modul |
| | | // Checke Berechtigungen f�r 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"]; |
| | | $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."); |
| | | |
| | | 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="background-color: #EEEEEE;" readonly'; |
| | | } else { |
| | | // neuer datensatz |
| | | //* New data record |
| | | if($error == '') { |
| | | // es liegt kein Fehler vor |
| | | //* es liegt kein Fehler vor |
| | | } else { |
| | | // ein Fehler |
| | | //* error |
| | | $record = $_POST; |
| | | |
| | | } |
| | | //$record["readonly"] = ''; |
| | | } |
| | | |
| | | $record["nav_id"] = $nav_id; |
| | | $record["module_name"] = $module_name; |
| | | $record['nav_id'] = $nav_id; |
| | | $record['module_name'] = $module_name; |
| | | |
| | | $app->tpl->setVar($record); |
| | | |
| | | include_once("lib/lang/".$_SESSION["s"]["language"]."_module_nav_edit.lng"); |
| | | include_once('lib/lang/'.$_SESSION['s']['language'].'_module_nav_edit.lng'); |
| | | $app->tpl->setVar($wb); |
| | | |
| | | // Defaultwerte setzen |
| | | $app->tpl_defaults(); |
| | | |
| | | // Template parsen |
| | | $app->tpl->pparse(); |
| | | |
| | | ?> |