private static function initialize() { $config_path = \My\Env::get('config_path') . 'config.php'; if (!file_exists($config_path)) { throw new Exception_config_file_not_found('File not found: ' . $config_path); } include $config_path; if (isset($configuration) && is_array($configuration)) { self::$data = $configuration; } else { throw new Exception_config_empty('Configfile has no $configuration array set'); } // domain specific configuration $config_path = \My\Env::get('config_path') . 'config.' . \My\Env::get('domain') . '.php'; if (file_exists($config_path)) { unset($configuration); include $config_path; if (isset($configuration) && is_array($configuration)) { foreach ($configuration as $key => $value) { self::$data[$key] = $value; } } } self::$initialized = true; }
<?php //Read configurations include 'include/config.php'; $config = MyConfig::read('include/settings.php'); $en_gram = $config['en_gram']; $lv_gram = $config['lv_gram']; $de_gram = $config['de_gram']; $fr_gram = $config['fr_gram']; //Get input data if ($_POST['src'] != '') { $src = $_POST['src']; } if ($_POST['srclang'] != '') { $srclang = $_POST['srclang']; } if ($_POST['trglang'] != '') { $trglang = $_POST['trglang']; } switch ($srclang) { case "English": $grammarFile = $en_gram; break; case "Latvian": $grammarFile = $lv_gram; break; case "German": $grammarFile = $de_gram; break; case "French": $grammarFile = $fr_gram;
<?php require "./cms.header.php"; $config = new MyConfig(); if (!isset($_GET["action"])) { exit; } $action = $_GET["action"]; switch ($action) { case 'insert': $config->insert(); break; case 'update': $config->update(); break; case 'delete': break; default: # code... break; } redirect("config.cms.php");
public function excute() { // Init Data $data['category'] = $this->that->mcategory->findAll(); $data['error'] = ''; // Config path image $old_path_name = APPPATH . '../assets/uploads/'; // Submit was click if ($this->that->input->post('name')) { // Init image process $imageProcess = new ImageProcess($this->that); // Init image Config $myConfig = new MyConfig(); // Get data product $data['product'] = $this->getDataProduct(); $imageProcess->setConfig($myConfig->getConfigUpload()); if (!$imageProcess->getUpload()->upload(new uploadUserLib())) { $data['error'] = $imageProcess->getUpload()->getError(); } else { // Get image that uploaded $image_data = $imageProcess->getUpload()->getImage(); // Resize image $imageProcess->setConfig($myConfig->getConfigResize()); $imageProcess->getResize()->resize(new resizeUserLib()); // Rename image $rename = new Rename($image_data, $old_path_name, new getNameByTime()); $rename->excute(); // Add link image to upload $data['product']['image'] = 'assets/uploads/' . $rename->getNewName()->getName(); echo $data['product']['image']; } $this->that->mproduct->insert($data['product']); redirect('cproduct'); } else { $this->that->load->view('product/insert', $data); } }
function set($secname, $key, $val) { $section = $this->getOrCreate($this->rootObj, $secname); $directive = $this->getOrCreate($section, $key, $val); $directive->setContent($val); } function getOrCreate(Config_Container $cont, $name, $value = null) { $itemtype = is_null($value) ? 'section' : 'directive'; if ($child = $cont->searchPath(array($name))) { return $child; } return $cont->createItem($itemtype, $name, null); } function __toString() { return $this->rootObj->toString($this->type); } function get($section, $key) { $directive = $this->rootObj->searchPath("config/{$section}/{$key}"); return $directive; } } $myconf = new MyConfig(null, 'phparray'); $myconf->set("directories", "prefs", "/tmp/myapp/prefs"); $myconf->set("directories", "scratch", "/tmp/"); $myconf->set("general", "version", "1.0"); echo $myconf; $myconf = new MyConfig('test.conf'); print "{$myconf}";
<?php header("Content-Type: text/html;charset=utf-8"); require "../include/config.php"; require "../include/db.class.php"; require "../include/lib.class.php"; require "../include/config.class.php"; $DB = new MyPDO(DB_HOST, DB_USER, DB_PASS, DB_NAME); $config = new MyConfig(); $config->read();
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ require 'vendor/autoload.php'; require_once 'config/myconfig.php'; //Created MyConfig instance $myconfig = new MyConfig(); //Read db settings file $db_config = MyConfig::read('config/db_settings.php'); $whoops = new \Whoops\Run(); $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); $whoops->register(); //create a new "Capsule" manager instance use Illuminate\Database\Capsule\Manager as Capsule; $capsule = new Capsule(); $capsule->addConnection(['driver' => 'mysql', 'host' => 'localhost', 'database' => $db_config['db_name'], 'username' => $db_config['db_username'], 'password' => $db_config['db_password'], 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci']); // Set the event dispatcher used by Eloquent models... (optional) use Illuminate\Events\Dispatcher; use Illuminate\Container\Container; $capsule->setEventDispatcher(new Dispatcher(new Container())); // Make this Capsule instance available globally via static methods... (optional) $capsule->setAsGlobal(); // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher()) $capsule->bootEloquent(); // SELECT * FROM `posts` WHERE `status`='published' //$results = Capsule::table('url')->get(); //$results = Capsule::select('select * from url where id = ?', array(1));
/** * @param string $resource */ public function dump($resource) { $this->dumper->dump($resource, $this->config->getParameters()); }
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); //require myconfig file require 'config/myconfig.php'; if (isset($_POST['submit'])) { //Get form post data $config['db_name'] = $_POST['db_name']; $config['db_username'] = $_POST['db_username']; $config['db_password'] = $_POST['db_password']; //Create MyConfig instance $myconfig = new MyConfig(); //Write db settings file $status = $myconfig->write('config/db_settings.php', $config); if ($status == false) { //Throw an error while file writing operation fail header("Location:install.php?error=file_operation"); } else { require 'db_connection.php'; try { //get db connection $db = $capsule->getConnection(); //create url table $capsule->schema()->create('url', function ($table) { $table->increments('id'); $table->string('url')->unique(); $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); }); //add some seed url into url table
] }, { id: 2, title: 'Рабочие дела', tasks: [ { id: 1, text: 'Посторить дом', isComplite: false }, { id: 2, text: 'Вырастить сына', isComplite: false }, ] } ]; */ if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { // Если к нам идёт Ajax запрос, то ловим его $action = $_POST['action']; $data = $_POST['data']; $m = new MyConfig(); $m->openbd(); switch ($action) { case 'GetMaxIdBlock': echo $m->GetMaxIdBlock(); break; case 'GetMaxIdLine': echo $m->GetMaxIdLine($data); break; case 'Start': $r = $m->GetFulldata(); echo json_encode($r); break; case 'myDeleteLine': echo $m->DeleteLine($data); break;
require_once $transitionfile; } foreach (glob(VPANEL_MITGLIEDERFILTERACTIONS . "/*.class.php") as $actionfile) { require_once $actionfile; } foreach (glob(VPANEL_STREAMHANDLERS . "/*.class.php") as $streamhandlerfile) { require_once $streamhandlerfile; } class MyConfig extends DefaultConfig { public function getWebRoot() { return "http://192.168.100.166/~prauscher/vpanel/"; } } $config = new MyConfig(); $config->setStorage(new MySQLStorage("localhost", "root", "anything92", "vpanel")); $config->setSendMailBackend(new SleepSendMailBackend()); $config->registerLang("de", new PHPLanguage(VPANEL_LANGUAGE . "/de.lang.php")); require_once dirname(__FILE__) . "/config.page.php"; $filterid = 0; $gliederungen = $config->getStorage()->getGliederungList(); $mitgliedschaften = $config->getStorage()->getMitgliedschaftList(); $beitraege = $config->getStorage()->getBeitragList(); $config->getStorage()->registerMitgliederFilter(new MitgliederFilter(++$filterid, "Mitgliedschaft Piratenpartei", null, new RevisionFlagMitgliederMatcher(1))); foreach ($gliederungen as $gliederung) { $config->getStorage()->registerMitgliederFilter(new MitgliederFilter(++$filterid, "Mitglied im " . $gliederung->getLabel(), $gliederung->getGliederungID(), new TrueMitgliederMatcher())); } $config->getStorage()->registerMitgliederFilter(new MitgliederFilter(++$filterid, "Momentane Mitglieder", null, new NotMitgliederMatcher(new AusgetretenMitgliederMatcher()))); $config->getStorage()->registerMitgliederFilter(new MitgliederFilter(++$filterid, "Ausgetretene Mitglieder", null, new AusgetretenMitgliederMatcher())); foreach ($mitgliedschaften as $mitgliedschaft) {