예제 #1
5
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         $helper = $this->getHelper('question');
         $question = new Question('Please enter the login : '******'');
         $login = $helper->ask($input, $output, $question);
         if ($login == "") {
             throw new \Exception("you must specify login");
         }
         // récupération de la config securité
         $values = \Parameters::get('security');
         $class = $values['security']['classes'];
         $ss = new $class(new Session(), new Request());
         // get user instance
         $user = $ss->userFromLogin($login);
         if ($user == null) {
             throw new \Exception("User {$login} doesn't exist");
         }
         $iduser = $user->id;
         // get all roles
         $roles = $ss->getRoles();
         $strRole = "[";
         foreach ($roles as $role) {
             if ($strRole != "[") {
                 $strRole .= ",";
             }
             $strRole .= $role->role;
         }
         $strRole .= "]";
         $question = new Question('Add roles for ' . $login . ' ' . $strRole . ', type role separated by comma : ', '');
         $roles = $helper->ask($input, $output, $question);
         $output->writeln('Add roles to user');
         if ($roles != "" && $iduser != null) {
             $rolea = \Stringy\Stringy::create($roles)->split(",");
             foreach ($rolea as $role) {
                 $roles = $ss->getRolesFromName(array($role));
                 $role1 = $roles->first();
                 $ss->addUserToRole($iduser, $role1->id);
             }
         }
     } catch (\Exception $e) {
         $output->writeln('Error : ' . $e->getMessage());
     }
     $output->writeln('finished');
 }
예제 #2
2
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         $helper = $this->getHelper('question');
         $question = new Question('Please enter the login : '******'');
         $login = $helper->ask($input, $output, $question);
         if ($login == "") {
             throw new \Exception("you must specify login");
         }
         $question = new Question('Please enter the mail : ', '');
         $email = $helper->ask($input, $output, $question);
         if ($email == "") {
             throw new \Exception("you must specify a mail");
         }
         $question = new Question('Please enter the password : '******'');
         $password = $helper->ask($input, $output, $question);
         if ($password == "") {
             throw new \Exception("you must specify a password");
         }
         // récupération de la config securité
         $values = \Parameters::get('security');
         $class = $values['security']['classes'];
         $ss = new $class(new Session(), new Request());
         if ($ss->emailExist($email)) {
             throw new \Exception("Email already exists.");
         }
         if ($ss->loginExist($login)) {
             throw new \Exception("Login already exists.");
         }
         // get all roles
         $roles = $ss->getRoles();
         $strRole = "[";
         foreach ($roles as $role) {
             if ($strRole != "[") {
                 $strRole .= ",";
             }
             $strRole .= $role->role;
         }
         $strRole .= "]";
         $question = new Question('Add roles for this user ' . $strRole . ', type role separated by comma : ', '');
         $roles = $helper->ask($input, $output, $question);
         $output->writeln('Create user');
         $ret = $ss->userCreate($login, $email, $password);
         if ($roles != "" && $ret != null) {
             $rolea = \Stringy\Stringy::create($roles)->split(",");
             foreach ($rolea as $role) {
                 $roles = $ss->getRolesFromName(array($role));
                 $role1 = $roles->first();
                 $ss->addUserToRole($ret, $role1->id);
             }
         }
     } catch (\Exception $e) {
         $output->writeln('Error : ' . $e->getMessage());
     }
     $output->writeln('finished');
 }
예제 #3
0
 /**
  * @param \Elastica_Index $index
  * @param string $type
  * @param Naturwerk\Find\Parameters $parameter
  */
 public function __construct($index, $type, Parameters $parameters)
 {
     $this->index = $index;
     $this->type = $type;
     $this->parameters = $parameters;
     // resort and activate columns
     if (count($parameters->getColumns()) > 0) {
         $columns = array();
         foreach ($this->columns as $i => $column) {
             $index = array_search($column->getName(), $parameters->getColumns());
             if ($index === false) {
                 $column->setActive(false);
                 $columns[999 + $i] = $column;
             } else {
                 $column->setActive(true);
                 $columns[$index] = $column;
             }
         }
         ksort($columns);
         $this->columns = $columns;
     }
     // set default sort
     $this->sort = $this->parameters->getSort();
     $active = array();
     foreach ($this->columns as $column) {
         if ($column->isActive()) {
             $active[] = $column->getName();
         }
     }
     if (count($this->sort) == 0 || !in_array(key($this->sort), $active)) {
         $column = reset($this->columns);
         $this->sort = array($column->getName() => 'asc');
     }
 }
예제 #4
0
 public function testInstantiate()
 {
     $params = new Parameters($_SERVER);
     $this->assertEquals($_SERVER['PATH'], $params->get('PATH'));
     $this->assertEquals($_SERVER, $params->getData());
     $this->assertEquals(null, $params->get('THE_KEY_NOT_EXISTS'));
     $this->assertEquals('default-value', $params->get('THE_KEY_NOT_EXISTS', 'default-value'));
 }
예제 #5
0
 /**
  * Check if user has permissions to access object.
  *
  * @param object $object
  * @param Parameters $parameters
  * @return boolean
  */
 public function permission($object, $parameters)
 {
     if ($object->shared) {
         return true;
     }
     if (in_array($parameters->getUser(), $object->access)) {
         return true;
     }
     return false;
 }
예제 #6
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         $helper = $this->getHelper('question');
         $question = new Question('Please enter the role key : ', '');
         $role = $helper->ask($input, $output, $question);
         if ($role == "") {
             throw new \Exception("you must specify role key");
         }
         $roles = \Stringy\Stringy::create($role)->slugify();
         $question = new Question('Please enter the role description : ', '');
         $description = $helper->ask($input, $output, $question);
         if ($description == "") {
             throw new \Exception("you must specify a description");
         }
         // récupération de la config securité
         $values = \Parameters::get('security');
         $class = $values['security']['classes'];
         $ss = new $class(new Session(), new Request());
         $output->writeln('Create role');
         $ss->roleCreate($roles, $description);
     } catch (\Exception $e) {
         $output->writeln('Error : ' . $e->getMessage());
     }
     $output->writeln('finished');
 }
예제 #7
0
 /**
  * Get current route parameters in array 
  * @return array (controller,action,parameters and _route)
  */
 function getCurrentRoute()
 {
     $ret = null;
     $inst = null;
     $url = null;
     if ($this->_request->get('url')) {
         $url = $this->_request->get('url');
     }
     $url = '/' . $url;
     $parameters = \Parameters::get('router');
     $classes = "GL\\Core\\Routing\\Router";
     if (isset($parameters["classes"])) {
         $classes = $parameters["classes"];
     }
     try {
         Assertion::classExists($classes);
         $inst = new $classes();
         $ret = $inst->route($url);
         $args = $inst->getArgs();
         $ret = array();
         $ret["controller"] = $inst->getController();
         $ret["action"] = $inst->getMethod();
         $ret["_route"] = $inst->getRoute();
         $ret = array_merge($ret, $args);
     } catch (AssertionFailedException $e) {
         $ret = null();
     }
     return $ret;
 }
예제 #8
0
 /**
  * @param string $dataset (mandatory) datasetid
  * @param string $format
  */
 public function __construct($dataset, $format)
 {
     $parameters = array();
     $parameters['dataset'] = $dataset;
     $parameters['format'] = $format;
     parent::__construct($parameters);
 }
예제 #9
0
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
예제 #10
0
 public function __construct()
 {
     $this->addCollector(new MessagesCollector());
     $this->addCollector(new RequestDataCollector());
     $this->addCollector(new TimeDataCollector());
     $this->addCollector(new RouteDataCollector());
     $this->addCollector(new ExceptionsCollector());
     $values = \Parameters::get('redis');
     $redis_enable = isset($values['default']['enable']) ? $values['default']['enable'] : 0;
     if ($redis_enable != 0) {
         $this->addCollector(new RedisDataCollector());
     }
     try {
         $conn = Capsule::connection("default");
         if ($conn != null) {
             $db = $conn->getPdo();
             $pdo = new TraceablePDO($db);
             $this->addCollector(new PDOCollector($pdo));
         }
     } catch (\Illuminate\Contracts\Container\BindingResolutionException $ex) {
         $this['exceptions']->addException($ex);
     } catch (\PDOException $e) {
         $this['exceptions']->addException($e);
     }
 }
예제 #11
0
 public static function Initialize()
 {
     $userMapping = new Mapping("User", "T_User");
     $userMapping->AddColumn("UserId", "Id");
     $userMapping->AddColumn("CreationDate", "CreDat");
     $userMapping->AddColumn("IsAdministrator", "IsAdmin");
     self::$Mappings = array("User" => $userMapping);
 }
예제 #12
0
 public function offsetGet($offset)
 {
     $return = $this->description[$offset];
     if (is_array($return)) {
         $return = Parameters::wrap($this->description[$offset]);
         $this->description[$offset] = $return;
     }
     return $return;
 }
예제 #13
0
 private function createContainer()
 {
     $container = new ContainerBuilder();
     // retrieve security class
     $values = \Parameters::get('security');
     $class = $values['security']['classes'];
     $session_name = $values['session']['name'];
     // test if class exist and implement interface
     try {
         Assertion::ClassExists($class);
         Assertion::implementsInterface($class, '\\GL\\Core\\Security\\AuthenticationServiceInterface');
     } catch (AssertionFailedException $e) {
         echo $e->getMessage();
         die;
     }
     // Inject mailer
     $container->register('mailer', 'GL\\Core\\Tools\\Mailer');
     // Inject Request
     $container->register('request', 'Symfony\\Component\\HttpFoundation\\Request')->setFactory("Symfony\\Component\\HttpFoundation\\Request::createFromGlobals");
     // Inject Request helper
     $container->register('request_helper', 'GL\\Core\\Helpers\\RequestHelper')->addMethodCall('setRequest', array(new Reference('request')));
     // Inject Twig Service
     $container->register('template', 'GL\\Core\\Templating\\TemplateProvider');
     // Inject RouteCollection
     $container->register('routes', 'Symfony\\Component\\Routing\\RouteCollection')->setFactory("GL\\Core\\Routing\\RouteProvider::GetRouteCollection");
     if (class_exists("\\PHPExcel")) {
         // Inject PHPExcel Wrapper
         $container->register('excel', 'GL\\Core\\Tools\\Excel');
     }
     if (class_exists("\\TCPDF")) {
         // Inject FPDF Wrapper
         $container->register('pdf', 'GL\\Core\\Tools\\PDF');
     }
     // Inject Session
     $container->register('session', 'Symfony\\Component\\HttpFoundation\\Session\\Session')->addMethodCall('setName', array($session_name))->addMethodCall('start');
     // Inject Crsf verifier
     $container->register('crsf', 'GL\\Core\\Security\\FormCrsf')->addArgument(new Reference('session'))->addArgument(new Reference('request'));
     // Inject translator service
     $container->register('translator', 'GL\\Core\\Config\\Translator');
     // Inject Security Service
     $container->register('security', $class)->addArgument(new Reference('session'))->addArgument(new Reference('request'))->addMethodCall('autologin');
     // Inject DebugBar
     $container->register('debug', 'GL\\Core\\Debug\\KLDebugBar');
     // Inject Pdo Object
     $container->register('pdo', 'PDO')->setFactory("GL\\Core\\Helpers\\DbHelper::getPdo");
     // Inject Config
     $container->register('config', 'GL\\Core\\Config\\Config');
     // Inject DbHelper
     $container->register('db', 'GL\\Core\\Helpers\\DbHelper');
     // Inject Redis
     $container->register('redis', 'GL\\Core\\Tools\\Redis');
     // Inject services defined in config/services.yml
     $loader = new YamlFileLoader($container, new FileLocator(SERVICEPATH));
     $loader->load('services.yml');
     $container->compile();
     return $container;
 }
예제 #14
0
 function testParametersAreAssignedToSqlCommand()
 {
     $SqlCommand = new SqlCommand();
     $parameters = new Parameters();
     $p1 = new Parameter('n1', 'v1');
     $parameters->Add($p1);
     $parameters->Add(new Parameter('n2', 'v2'));
     $SqlCommand->SetParameters($parameters);
     $newParam = new Parameter('n3', 'v3');
     $SqlCommand->AddParameter($newParam);
     $this->assertNotNull($parameters, 'Parameters object null');
     $this->assertNotNull($SqlCommand->Parameters, 'SqlCommand::parameters is null');
     $this->assertEquals(3, $SqlCommand->Parameters->Count());
     $this->assertEquals($parameters->Items(0), $SqlCommand->Parameters->Items(0));
     $this->assertEquals($parameters->Items(1), $SqlCommand->Parameters->Items(1));
     $this->assertNotNull($SqlCommand->Parameters->Items(2), 'Last parameter object null');
     $this->assertEquals(3, $parameters->Count());
     $this->assertEquals($newParam, $SqlCommand->Parameters->Items(2));
 }
 public function actionDelete()
 {
     if (!Parameters::hasParam('type')) {
         throw new APIException('Invalid resource TYPE (parameter name: \'type\')', APIResponseCode::API_INVALID_METHOD_PARAMS);
     }
     if (!Parameters::hasParam('id')) {
         throw new APIException('Invalid resource IDENTIFICATOR (parameter name: \'id\')', APIResponseCode::API_INVALID_METHOD_PARAMS);
     }
     $type = Parameters::get('type');
     $id = Parameters::get('id');
     return $this->dataAccessor->delete($type, $id);
 }
예제 #16
0
 function testDatabaseQueryLoadsValuesInCorrectOrder()
 {
     $name1 = 'paramName1';
     $val1 = 'value1';
     $name2 = 'paramName2';
     $val2 = 'value2';
     $cn = new FakeDBConnection();
     $db = new Database($cn);
     $p1 = new Parameter($name1, $val1);
     $p2 = new Parameter($name2, $val2);
     $parameters = new Parameters();
     $parameters->Add($p1);
     $parameters->Add($p2);
     $command = new SqlCommand("SELECT * FROM sometable WHERE col1 = @{$name1} AND col2 = @{$name2}");
     $command->SetParameters($parameters);
     $adapter = new Mdb2CommandAdapter($command);
     $vals = $adapter->GetValues();
     $this->assertEquals(2, count($vals));
     $this->assertEquals($val1, $vals[$name1]);
     $this->assertEquals($val2, $vals[$name2]);
     $this->assertEquals("SELECT * FROM sometable WHERE col1 = :{$name1} AND col2 = :{$name2}", $adapter->GetQuery());
 }
예제 #17
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         // récupération de la config securité
         $values = \Parameters::get('security');
         $class = $values['security']['classes'];
         $ss = new $class(new Session(), new Request());
         $output->writeln('Create users table and model');
         $ss->createTables();
     } catch (\Exception $e) {
         $output->writeln('Error : ' . $e->getMessage());
     }
     $output->writeln('finished');
 }
예제 #18
0
 public function actionView()
 {
     if (!Parameters::hasParam('id')) {
         throw new APIException('Invalid resource IDENTIFICATOR (parameter name: \'id\')', APIResponseCode::API_INVALID_METHOD_PARAMS);
     }
     $id = Parameters::get('id');
     $result = ARClientApp::model()->findByPk($id);
     if (is_null($result)) {
         throw new APIException('Invalid ID value', APIResponseCode::API_INVALID_ID);
     }
     $coder = new CJSON();
     $response = $coder->encode($result);
     echo $response;
 }
예제 #19
0
 public function loadConfig()
 {
     try {
         $value = \Parameters::get('security');
         $this->config = $value;
         $this->users_tablename = isset($this->config['security']['users_table']) ? $this->config['security']['users_table'] : 'users';
         $this->roles_tablename = isset($this->config['security']['roles_table']) ? $this->config['security']['roles_table'] : 'roles';
         $this->usersroles_tablename = isset($this->config['security']['usersroles_table']) ? $this->config['security']['usersroles_table'] : 'usersroles';
         $this->tokensalt = $this->config['cookie']['token'];
         $this->cookiename = $this->config['cookie']['name'];
         $this->cookieduration = $this->config['cookie']['duration'];
     } catch (Exception $e) {
     }
 }
예제 #20
0
 protected function parametres()
 {
     $parametres = new Parameters();
     $parametres->add(T_Chat::id_sender, $this->chat->id_sender);
     $parametres->add(T_Chat::id_recipients, $this->chat->id_recipients);
     $parametres->add(T_Chat::msg, $this->chat->msg);
     $parametres->add(T_Chat::time_msg, $this->chat->time_msg);
     return $parametres;
 }
예제 #21
0
 public function loadFile()
 {
     $ret = false;
     try {
         $value = \Parameters::get('templates');
         foreach ($value as $name => $th) {
             $this->arr[$name] = $th['class'];
         }
     } catch (IOException $e) {
         $ret = false;
     } catch (Exception $e) {
         $ret = false;
     }
     return $ret;
 }
예제 #22
0
파일: Redis.php 프로젝트: kletellier/mvc
 private function init()
 {
     $this->commands = array();
     $values = \Parameters::get('redis');
     $enable = isset($values['default']['enable']) ? $values['default']['enable'] : 0;
     $pwd = isset($values['default']['password']) ? $values['default']['password'] : "";
     $this->client = null;
     if ($enable == 1) {
         $params = ['scheme' => 'tcp', 'host' => $values['default']['server'], 'port' => $values['default']['port']];
         if (trim($pwd) != "") {
             $params['password'] = $pwd;
         }
         $this->client = new \Predis\Client($params);
     }
 }
예제 #23
0
 public function actionCreate()
 {
     $storage = new YiiUserDataStorage();
     if (is_null($storage)) {
         throw new APIException('Could not create data storage', APIResponseCode::API_INVALID_METHOD_PARAMS);
     }
     try {
         $obj = new User();
         $data = Parameters::getRaw('data', 'post');
         $attr = $storage->decodeResponse($data);
         $obj->setAttributes($attr);
         $storage->save($obj);
     } catch (Exception $e) {
         throw new APIException('Can not save resource object', APIResponseCode::API_SHEMA_CREATE_ERROR);
     }
 }
예제 #24
0
 private function getRouterInstance()
 {
     $parameters = \Parameters::get('router');
     $classes = "GL\\Core\\Routing\\Router";
     $inst = null;
     if (isset($parameters["classes"])) {
         $classes = $parameters["classes"];
     }
     try {
         Assertion::classExists($classes);
         $inst = new $classes();
     } catch (AssertionFailedException $e) {
         echo "Routing classes " . $classes . " does not exist";
         die;
     }
     return $inst;
 }
예제 #25
0
 private function dispatchCall($controllerName, $method)
 {
     $format = Parameters::hasParam('format') ? Parameters::get('format') : 'json';
     try {
         $controller = $this->getFactory()->createObject($controllerName);
         if (is_null($controller) || !isset($controller)) {
             throw new APIException('Invalid controller name', APIResponseCode::API_INVALID_CLASSNAME);
         }
         if (!method_exists($controller, $method)) {
             throw new APIException('Controller have not the method with specified name', APIResponseCode::API_INVALID_METHOD);
         }
         $controller->{$method}();
     } catch (APIException $ex) {
         Yii::trace($ex, 'apps.APIController');
         die($ex->getResponse($format));
     }
 }
예제 #26
0
파일: Loader.php 프로젝트: kletellier/mvc
 public static function InitDatabase()
 {
     /**
      * Load database configuration from parameters.yml 
      */
     $value = \Parameters::get('database');
     $capsule = new Capsule();
     foreach ($value as $name => $conn) {
         $port = 3306;
         $connstr = $conn["server"];
         if (isset($conn["port"])) {
             $port = trim($conn["port"]);
         }
         $type = isset($conn["type"]) ? $conn["type"] : "mysql";
         $allowed = array('mysql', 'sqlite');
         if (!in_array($type, $allowed)) {
             echo $type . " database not allowed.";
             die;
         }
         $capsule->addConnection(array('driver' => $type, 'host' => $connstr, 'port' => $port, 'database' => $conn["database"], 'username' => $conn["user"], 'password' => $conn["password"], 'charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => ''), $name);
     }
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
 }
예제 #27
0
파일: Control.php 프로젝트: axoquen/tt780
 function getParameter($name, $default = null)
 {
     // {handler}.{method}:{parameters}
     if (preg_match("/^(\\w+(?:\\.\\w+)?):(\\w+)\$/", $name, $aux)) {
         if ($aux[2] == 'handler_file') {
             $res = $this->__h_include("{$aux[1]}.main");
             return $res[0];
         }
         $value = null;
         // load in cascade ...
         $hc = explode('_', $aux[1]);
         $origin = null;
         $ct = count($hc);
         for ($i = $ct; $i > 0; $i--) {
             $hc_c = implode('_', $hc);
             // ... from cache
             if (isset($GLOBALS['tt780'][$this->id]['parameters'][$hc_c]) && isset($GLOBALS['tt780'][$this->id]['parameters'][$hc_c][$aux[2]])) {
                 $value = $GLOBALS['tt780'][$this->id]['parameters'][$hc_c][$aux[2]];
                 break;
             }
             // ... from configuration
             if (isset($GLOBALS['tt780'][$this->id]['configuration'][$hc_c]) && is_array($GLOBALS['tt780'][$this->id]['configuration'][$hc_c]) && isset($GLOBALS['tt780'][$this->id]['configuration'][$hc_c]['parameters']) && isset($GLOBALS['tt780'][$this->id]['configuration'][$hc_c]['parameters'][$aux[2]])) {
                 $origin = true;
                 $value = $GLOBALS['tt780'][$this->id]['configuration'][$hc_c]['parameters'][$aux[2]];
                 break;
             }
             array_pop($hc);
         }
         if ($value) {
             $pre = array();
             $pre[$aux[2]] = $value;
             $pre2 = new Parameters();
             if ($origin) {
                 $pre2->origin('configuration_file');
             }
             $pre2->concat($GLOBALS['tt780'][$this->id]['globals']);
             // por si necesita valores de contexto
             $pre2->concat($pre);
             $res = $pre2->getParameter($aux[2], $default);
             return $res;
         }
     }
     // ???
     $cursor = count($this->cursor);
     if ($cursor > 0 && isset($this->cursor[$cursor - 1]) && isset($this->cursor[$cursor - 1][$name])) {
         return $this->cursor[$cursor - 1][$name];
     }
     return $GLOBALS['tt780'][$this->id]['globals']->getParameter($name, $default);
 }
예제 #28
0
파일: Script.php 프로젝트: phellow/cli
 /**
  * Show the help message.
  *
  * @param Parameters $params
  *
  * @return void
  */
 protected function showHelp(Parameters $params)
 {
     $table = new SimpleTable();
     $table->border = false;
     $table->padding = 3;
     $executedFile = basename($params->getExecutedFile());
     $arguments = $params->getRegisteredArguments();
     $argsUsage = '';
     $argsRows = [];
     foreach ($arguments as $arg) {
         $argsUsage .= ' <' . $arg['name'] . '>';
         $argsRows[] = [$arg['name'], $arg['description']];
     }
     $this->outln('Usage: ' . $executedFile . $argsUsage);
     // show possible arguments
     if ($argsRows) {
         $table->addRow([]);
         $table->addRow(['Arguments:']);
         foreach ($argsRows as $row) {
             $table->addRow($row);
         }
     }
     // show possible options
     $options = $params->getRegisteredOptions();
     if ($options) {
         $table->addRow([]);
         $table->addRow(['Options:']);
         foreach ($options as $opt) {
             $val = '';
             switch ($opt['valueFlag']) {
                 case Parameters::VALUE_YES:
                     $val = '=<value>';
                     break;
                 case Parameters::VALUE_OPTIONAL:
                     $val = '[=<value>]';
                     break;
             }
             $def = '--' . $opt['name'] . $val;
             if ($opt['short']) {
                 $def .= ' -' . $opt['short'] . $val;
             }
             $table->addRow([$def, $opt['description']]);
         }
     }
     $this->outln($table->getTable());
 }
예제 #29
0
파일: index.php 프로젝트: jdegges/pipweb
$Menu .= FormatMenuItem("NavNextItem", $Params, "Next", "Next", $NextItem);
$Params->Add("smf", 1);
$Params->Set("fid", $NextItem);
$Menu .= FormatMenuItem("NavNextItemGroup", $Params, "&gt;&gt;", "Next " . $Config->FilesPerPage, $NextItem);
$Params->Remove("smf");
$Params->Set("fid", $LastItem);
$Menu .= FormatMenuItem("NavLastItem", $Params, "&gt;|", "Last", $LastItem);
// ----------------------------------
// 7. WRITE THE REMAINDER OF THE PAGE
// ----------------------------------
echo "<ul class=\"NavMenu MainMenu\">" . $Menu . "</ul>\r\n";
echo "<div class=\"DisplayContainer\">\r\n";
// If a file has not been requested, write out the introductory paragraph (if there is one)
if ($Config->FileID == 0 && $Config->PageIntroduction != "" && ($Config->CurrentWorkingDirectory == $Config->CurrentBrowsingDirectory || $Config->CurrentWorkingDirectory != $Config->CurrentBrowsingDirectory && $Config->UsePageIntroductionInSubFolders)) {
    echo "<div class=\"Introduction\">" . $Config->PageIntroduction . "</div>\r\n";
}
// Write out the selected files
echo $FileDisplay;
echo "</div>\r\n" . "<ul class=\"NavMenu SubMenu\">\r\n" . $Menu . "</ul>\r\n" . "<div class=\"ListContainer\">\r\n";
// Write out the file/folder listing
if (trim($FileList) == "") {
    echo "<div class=\"ListEmpty\">No files or folders could be found.</div>\r\n";
} else {
    echo $FileList;
}
// Write out the page footer
echo "</div>\r\n" . "<!-- <div class=\"Foot\">\r\n         <form name=\"frmPager\" action=\"" . CurrentUrl() . "\" method=\"get\">";
$p = new Parameters();
$p->DefineCollection($_GET);
$p->Remove("fpp");
echo $p->GetHiddenInputs() . "<div class=\"Pager\">\r\n            <div class=\"PagerLabel\">Files/Page: </div>\r\n            <div class=\"PagerValue\"><input type=\"text\" name=\"fpp\" class=\"PagerInput\" value=\"" . $Config->FilesPerPage . "\" onchange=\"document.frmPager.submit();\" /></div>\r\n         </div>\r\n         </form>\r\n         <div class=\"ApplicationInformation\"><a href=\"http://lussumo.com\">Lussumo</a> <a href=\"http://thefilebrowser.com\">Filebrowser</a> " . $Config->Version . " &copy; " . $Config->Date . "</div>\r\n         <div class=\"DeveloperInformation\">Developed by " . $Config->Developer . "</div>\r\n      </div>\r\n   </div> --!>\r\n   </body>\r\n</html>";
예제 #30
0
 private function writeParametersToFile()
 {
     $parameters = new Parameters($_POST['language'], $_POST['types']);
     $fileName = '';
     foreach ($_POST['modules'] as $groupKey => $group) {
         foreach ($group as $moduleKey => $value) {
             if ($fileName == '') {
                 $fileName = "ip_" . htmlspecialchars($groupKey) . "_" . htmlspecialchars($moduleKey) . " " . date("Y-m-d") . ".php";
             }
             $parameters->loadParameters($value);
         }
     }
     $fileName = \Library\Php\File\Functions::genUnocupiedName($fileName, TMP_FILE_DIR);
     $fh = fopen(TMP_FILE_DIR . $fileName, 'w');
     if ($fh) {
         fwrite($fh, $this->generateConfigurationFile($parameters));
         fclose($fh);
         return $fileName;
     } else {
         trigger_error("can't open file " . $TMP_FILE_DIR . $fileName);
     }
     return false;
 }