set_error_handler("error_handler", E_ALL); // Catch all error/notice messages if (!file_exists($INIFILE)) { // Check if config file exists die("Config file not found"); } // Load config //$config = parse_ini_file($INIFILE, true,INI_SCANNER_RAW); // INI_SCANNER_RAW works only in php 5.3 $config = parse_ini_file($INIFILE, true); // Replace DOUBLEQUOTES string with '"'. Can't have '"' in ini file in php <5.3 foreach ($config['main'] as $key => $val) { if ($key != 'DQ') { $config['main'][$key] = str_replace($config['main']['DQ'], '"', $config['main'][$key]); } } if ($error = checkConfig($config)) { // Check required parameters from config file die($error); } //var_dump($config); $log = new LOG($config['main']['log_dir'] . 'restart.log'); // Log object $ckStart = new CheckStart($config['main']['log_dir'] . 'restart.lock'); if (!$ckStart->canStart()) { // Check if script already running. Doesn't allow customer to send multiple restart requests printLogAndDie("Script is already running."); } //$options = getopt('',array ('user:'******'pass:'******'status:')); // Read input Works in php 5.3 and above //var_dump($options); foreach ($argv as $v) { // Read input works in php < 5.3
* @version 04-06-07 * @package phpScheduleIt * * Copyright (C) 2003 - 2007 phpScheduleIt * License: GPL, see LICENSE */ $basedir = dirname(__FILE__) . '/..'; include_once $basedir . '/lib/DBEngine.class.php'; include_once $basedir . '/lib/Template.class.php'; @session_start(); // Start the session $failed = false; $t = new Template('phpScheduleIt ' . translate('Setup'), 1); $t->printHTMLHeader(); doPrintHeader(); if (checkConfig()) { if (isset($_POST['login'])) { setVars(); doLogin(); } else { if (isset($_POST['create'])) { $db = dbConnect(); doCreate(); doFinish(); } else { doPrintForm(); } } } $t->printHTMLFooter(); /**
<?php session_start(); require_once "functions.php"; checkConfig(); require_once "config.php"; checkMainFolderPermissions(); initialize(); require_once "languageFiles/" . $config['language'] . "/texts.php"; ?> <!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" xml:lang="de" lang="de"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title><?php echo $config['appName'] . " - " . $config['appDesc'] . " " . $config['version']; ?> </title> <meta name="generator" content="Sven Walther" /> <link rel="Shortcut Icon" type="image/x-icon" href="favicon.ico" /> <link href="<?php echo "themes/" . $config['theme'] . "/stylesheet.css"; ?> " rel="stylesheet" type="text/css" /> <?php if ($config['notificationsEnableSnarl']) { ?> <script src="snarl.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> function uploadStartFunc() {
checkConfig($config); $rawconfig = $Config->rawconfig; print "<h3 color='blue'>" . _t("Default settings are loaded...") . "</h3>\n"; $rawconf = $Config->_genRawConfig($rawconfig, 0, 'config.php', $initconfig); umask(00); $fp = fopen("config.php", "w"); fwrite($fp, $rawconf); fclose($fp); @chmod("config.php", 0666); print "<h2><font color='blue'>" . _t("Initial configurations are saved successfully.") . "</font></h2>\n"; print "<h3 class='warn'>" . _t("Goto <a href='monisetup.php'>MoniSetup</a> again to configure details") . "</h3>\n"; exit; } } else { $config = $Config->config; checkConfig($config); $rawconfig =& $Config->rawconfig; $configdesc =& $Config->configdesc; } } if ($_SERVER['REQUEST_METHOD'] == "POST") { $seeds = isset($_POST['seeds']) ? $_POST['seeds'] : ''; $action = isset($_POST['action']) ? $_POST['action'] : ''; if ($action == 'sow_seed' && $seeds) { sow_wikiseed($config, 'wikiseed', $seeds); print "<h2>WikiSeeds are sowed successfully</h2>"; if (file_exists('wiki.php')) { print "<h2>" . sprintf(_t("goto %s"), "<a href='wiki.php'>{$config['sitename']}</a>") . "</h2>"; } else { print "<h2>" . sprintf(_t("goto %s"), "<a href='" . $config[url_prefix] . "'>{$config['sitename']}</a>") . "</h2>"; }
<?php require_once 'vendor/autoload.php'; $cfg = getConfig(); try { checkConfig($cfg); } catch (Exception $e) { echo $e->getMessage() . "\r\n"; exit; } if (is_null($cfg->password)) { $cfg->password = readline('Enter the database password: '******'tableName' => $classNameFromTableName); $tables[$index]['columns'] = $db->MetaColumns($classNameFromTableName); } if (!file_exists($cfg->outputDirectory)) { $ret = mkdir($cfg->outputDirectory, 0777, true); if ($ret === false) {
<?php include "Header.php"; // include("adminnav.php"); include "confignav.php"; ?> <!-- BEGIN Record pws_clienti --> <form method="post" action="<?php print $PHP_SELF; ?> "> <!-- flag di invio del modulo --> <?php // se checkConfig e' = 0 il value e' 'insert', altrimenti e' 'update' $action_value = "update"; if (checkConfig() == '0') { $action_value = "insert"; } ?> <input type="Hidden" name="actionflag" value="<?php echo $action_value; ?> "> <input type="Hidden" name="ID_Azienda" value="<?php echo $form['ID_Azienda']; ?> "> <div align="center"><font class="FacetFormHeaderFont">Configurazione Azienda</div> <table border="0" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="center"> <!-- BEGIN Error --> <tr>
$path = '/'; $file = 'packages.json'; $localPath = $app['cache_dir'] . "/" . $rep . $path . $file; makeDirIfNeeded($localPath); makeLocalCache($responseJson, $localPath); return $app->json($responseJson); }); $app->get('{rep}/p/{provider}${hash}.json', function ($rep, $provider, $hash) use($app) { checkConfig($app, $rep); $path = "/p/"; $file = $provider . "\$" . $hash . ".json"; $url = $app['repositories'][$rep] . $path . $file; $localPath = $app['cache_dir'] . "/" . $rep . $path . $file; return load($app, $url, $localPath); }); $app->get('{rep}/p/{namespace}/{package}${hash}.json', function ($rep, $namespace, $package, $hash) use($app) { checkConfig($app, $rep); $path = "/p/" . $namespace . "/"; $file = $package . "\$" . $hash . ".json"; $url = $app['repositories'][$rep] . $path . $file; $localPath = $app['cache_dir'] . "/" . $rep . $path . $file; return load($app, $url, $localPath); }); $app->get('{rep}/p/{namespace}/{package}.json', function ($rep, $namespace, $package) use($app) { checkConfig($app, $rep); $path = "/p/" . $namespace . "/"; $file = $package . ".json"; $url = $app['repositories'][$rep] . $path . $file; $localPath = $app['cache_dir'] . "/" . $rep . $path . $file; return load($app, $url, $localPath); });
function checkConfig($config, $isArray = FALSE, $parentType = NULL) { global $mysqlTypeMap; $columns = array(); if ($isArray) { $groupColumn = isset($config['alias']) && isset($config['alias']['group']) ? $config['alias']['group'] : 'group'; $indexColumn = isset($config['alias']) && isset($config['alias']['group']) ? $config['alias']['index'] : 'index'; if (!$parentType) { $columns[$groupColumn] = JsonStore::escapedColumn($groupColumn) . " INT(11) AUTO_INCREMENT COMMENT 'Array ID (generated)'"; } else { if (isset($mysqlTypeMap[$type])) { $type = $mysqlTypeMap[$type]; $columns[$groupColumn] = JsonStore::escapedColumn($groupColumn) . " {$type} COMMENT 'Link to parent'"; } else { $type = "INT(11) /*{$type}*/"; $columns[$groupColumn] = JsonStore::escapedColumn($groupColumn) . " {$type} COMMENT 'Link to parent'"; } } $columns[$indexColumn] = JsonStore::escapedColumn($indexColumn) . " INT(11) COMMENT 'Array index'"; } foreach ($config['columns'] as $columnSpec => $columnName) { $subConfig = $columnName; if (is_numeric($columnSpec)) { $columnSpec = $columnName; } if (isset($config['alias']) && isset($config['alias'][$columnName])) { $columnName = $config['alias'][$columnName]; } $parts = explode("/", $columnSpec, 2); $type = $parts[0]; $path = substr($columnSpec, strlen($type)); $comment = $columnSpec; if ($type == "array") { $parentKeyType = NULL; if (isset($subConfig['parentKey'])) { foreach ($config['columns'] as $cs => $cn) { if (is_numeric($cs)) { $cs = $cn; } if ($cn == $subConfig['parentKey']) { $keyParts = explode("/", $cs, 2); $keyType = $keyParts[0]; $parentKeyType = $keyType; } } foreach ($config['alias'] as $cs => $cn) { if ($cn == $subConfig['parentKey']) { $keyParts = explode("/", $cs, 2); $keyType = $keyParts[0]; $parentKeyType = $keyType; } } checkConfig($subConfig, TRUE, $parentKeyType); continue; } else { checkConfig($subConfig, TRUE, NULL); $type == " INT(11)"; } } else { if (isset($mysqlTypeMap[$type])) { $type = $mysqlTypeMap[$type]; } else { $type = "TEXT /*{$type}*/"; } } if ($columnSpec == $config['keyColumn']) { $columns[$columnName] = JsonStore::escapedColumn($columnName) . " {$type} AUTO_INCREMENT PRIMARY KEY COMMENT " . JsonStore::mysqlQuote($comment); } else { $columns[$columnName] = JsonStore::escapedColumn($columnName) . " {$type} NULL COMMENT " . JsonStore::mysqlQuote($comment); } } if (isset($_POST['create-tables'])) { $sql = "CREATE TABLE IF NOT EXISTS {$config['table']} ("; $sql .= "\n\t" . implode(",\n\t", $columns) . "\n)"; echo "{$sql};\n"; JsonStore::mysqlQuery($sql); } $result = JsonStore::mysqlQuery("SHOW COLUMNS FROM {$config['table']}"); $observedColumns = array(); foreach ($result as $column) { $observedColumns[$column['Field']] = $column; } if (isset($_POST['update-tables-add'])) { foreach ($columns as $columnName => $column) { if (!isset($observedColumns[$columnName])) { $sql = "ALTER TABLE {$config['table']}\n\tADD COLUMN " . $column; echo "{$sql};\n"; JsonStore::mysqlQuery($sql); } } } if (isset($_POST['update-tables-delete'])) { foreach ($observedColumns as $columnName => $column) { if (!isset($columns[$columnName])) { $sql = "ALTER TABLE {$config['table']}\n\tDROP COLUMN " . $columnName; echo "{$sql};\n"; JsonStore::mysqlQuery($sql); } } } }
$template_name = 'install-step1-result.html'; $renderArray['resultText'] = 'Файл конфигурации уже существует!'; } } else { $renderArray['isNewConfig'] = true; $renderArray['conf_db_host'] = 'localhost'; $renderArray['conf_db_base'] = 'schoolreg'; } } } elseif ($step >= 2) { $template_name = 'install-step-result.html'; try { @(include_once CONFIG_FILE); include_once dirname(__FILE__) . '/create_tables.php'; include_once '../include/mysql_db.php'; if (!checkConfig()) { throw new Exception('Конфигурационный файл отсутствует или неверен.'); } $link = @mysql_connect($config['db']['db_host'], $config['db']['db_user'], $config['db']['db_passwd']); if (!$link) { throw new Exception('Ошибка подсоединения к базе, проверьте конфигурационные параметры. Текст ошибки: ' . mysql_error()); } if (!@mysql_select_db($config['db']['db_base'], $link)) { throw new Exception('Ошибка выбора базы, проверьте конфигурационные параметры. Текст ошибки: ' . mysql_error()); } if (!@mysql_query('SET NAMES UTF8;')) { throw new Exception('Ошибка установки client character set в UTF8. Текст ошибки: ' . mysql_error()); } if ($step == 2) { $result = db_query("SHOW TABLES LIKE 'users'"); if (mysql_fetch_row($result)) {