function tconf() { \config\Conf::$numerorole["test"] = 1; \config\Conf::$numerorole["test2"] = array("Install", "Visiteur", "Normal", "Torrent", "Sysop", "test" => 0.1); var_dump(\model\simple\MakerConf::makeParam(\config\Conf::$numerorole)); var_dump(\config\Conf::$numerorole["test2"]); var_dump(var_export(null, true)); }
function mysqlinit() { $this->layout = "install"; /*if (isset($_REQUEST["hostmysql"]) && isset($_REQUEST["loginmysql"]) && isset($_REQUEST["passmysql"])) { $querys = file_get_contents(ROOT . DS . "mysql" . DS . "mediastorrent.sql"); \core\Mysqli::initmultiquery($_REQUEST["hostmysql"], $_REQUEST["loginmysql"], $_REQUEST["passmysql"], $querys); \model\simple\MakerConf::makerConfSavBDD($_REQUEST["hostmysql"], $_REQUEST["loginmysql"], $_REQUEST["passmysql"]); } else*/ if (isset($_REQUEST["login"]) && isset($_REQUEST["pass"]) && isset($_REQUEST["mail"])) { $res = \model\mysql\Utilisateur::insertUtilisateurSysop($_REQUEST["login"], $_REQUEST["pass"], $_REQUEST["mail"]); \model\simple\MakerConf::makerConfEnd(); $this->set("res", $res); } }
} \config\Conf::$distribution = $c[1]; $c = \model\simple\Console::execute("ls -l /proc/1/exe | awk '{ print \$11 }'"); if ($c[0] === 1) { throw new Exception("Impossible de trouver l'init.."); } \config\Conf::$init = basename($c[1]); \model\simple\MakerRtorrentLancer::create(); //\model\simple\MakerRtorrent::create(); \model\simple\Console::println("Configuration de mysql"); $host = \model\simple\Console::saisieString("Entré host de mysql"); $login = \model\simple\Console::saisieString("Entré le login de mysql"); $mdp = \model\simple\Console::saisieString("Entré le mot de passe de mysql"); $querys = file_get_contents(ROOT . DS . "mysql" . DS . "mediastorrent.sql"); \core\Mysqli::initmultiquery($host, $login, $mdp, $querys); $lvm = \model\simple\Console::saisieBoolean("Est ce que vous utiliserez lvm2 ?"); $volumegroup = ""; if ($lvm) { $volumegroup = \model\simple\Console::saisieString("Entré le nom du volume group que vous utiliserez"); $sortie = \model\simple\Console::execute('vgdisplay -c ' . $volumegroup); if ($sortie[0] === 1) { $lvm = false; \model\simple\Console::println($volumegroup . " non disponible => désactivation du support de lvm2"); } } \model\simple\MakerConf::make($host, $login, $mdp, $lvm, $volumegroup); exec("crontab -l > mycron"); exec('echo "*/1 * * * * ' . ROOT . DS . "script" . DS . 'cronroot.sh" >> mycron'); exec("crontab mycron"); exec("rm mycron"); \model\simple\Console::println("Fini");
function delRtorrent() { \model\simple\MakerConf::makeRtorrent(""); $this->set("del", \model\mysql\Rtorrent::retirerServeur()); }
static function makeParam($res) { if (is_array($res)) { $res1 = "array("; foreach ($res as $k => $v) { if (is_int($k)) { $res1 .= MakerConf::makeParam($v) . ','; } else { $res1 .= '"' . $k . '"=>' . MakerConf::makeParam($v) . ','; } } $res1 = substr($res1, 0, -1); $res1 .= ")"; return $res1; } if (is_null($res)) { return "null"; } if (is_bool($res)) { return $res ? "true" : "false"; } if (is_string($res)) { return '"' . $res . '"'; } if (is_numeric($res)) { return $res; } }
<?php /** * Created by PhpStorm. * User: salorium * Date: 09/05/14 * Time: 01:13 */ define('WEBROOT', __DIR__); define('ROOT', dirname(WEBROOT)); define('DS', DIRECTORY_SEPARATOR); function __autoload($class_name) { $filename = ROOT . DS . str_replace("\\", DS, $class_name) . ".php"; if (file_exists($filename)) { require_once $filename; } else { } } //Retour visuel \config\Conf::$debuglocalfile = false; if ($argc == 4) { $host = $argv[1]; $login = $argv[2]; $pass = $argv[3]; $querys = file_get_contents(ROOT . DS . "mysql" . DS . "mediastorrent.sql"); \core\Mysqli::initmultiquery($host, $login, $pass, $querys); \model\simple\MakerConf::makerConfSavBDDEnd($host, $login, $pass); } else { \model\simple\Console::println(basename(__FILE__) . " <hostmysql> <loginmysql> <passmysql>"); }