public function set($theme = false) { if (!$theme || !file_exists("application/themes/" . $theme)) { die('قالب نا معتبر است'); } $fusionConfig = new ConfigEditor("application/config/fusion.php"); $fusionConfig->set('theme', $theme); $fusionConfig->save(); $this->cache->delete('*.cache'); $this->cache->delete('messages/*.cache'); $this->cache->delete('search/*.cache'); die('قالب با موفقیت تغییر یافت'); }
public function set() { $language = $this->input->post('language'); requirePermission("changeDefaultLanguage"); require_once 'application/libraries/configeditor.php'; if (!$language || !is_dir("application/language/" . $language)) { die("Invalid language"); } $fusionConfig = new ConfigEditor("application/config/default_language.php"); $fusionConfig->set("language", $language); $fusionConfig->save(); die('success'); }
public function set($theme = false) { if (!$theme || !file_exists("application/themes/" . $theme)) { die('Invalid theme'); } $fusionConfig = new ConfigEditor("application/config/fusion.php"); $fusionConfig->set('theme', $theme); $fusionConfig->save(); $this->cache->delete('*.cache'); $this->cache->delete('messages/*.cache'); $this->cache->delete('search/*.cache'); die('yes'); }
/** * * * @param $index * @param array $data * * @dataProvider configProvider * * @return void * @since */ public function testRewrite($index, array $data) { $basePath = \Yii::getPathOfAlias('application.tests._data.config'); $rawFilePath = sprintf('%s/raw.%s.php', $basePath, $index); $rewrittenFilePath = sprintf('%s/rewritten.%s.php', $basePath, $index); $dumpPath = sprintf(\Yii::getPathOfAlias('application.runtime.rewritten-config') . '.%d.php', $index); $rawFileContent = file_get_contents($rawFilePath); // $rawFileData = require $rawFilePath; $rewrittenFileContent = file_get_contents($rewrittenFilePath); // $rewrittenFileData = require $rewrittenFilePath; $hambda = new \ConfigEditor(); $newConfig = $hambda->rewriteConfig($rawFileContent, $data); file_put_contents($dumpPath, $newConfig); $this->assertSame($rewrittenFileContent, $newConfig); // it won't be same because of __FILE__ and __DIR__ usage. Text // comparison is quite an ok way to test. //$this->assertSame($rewrittenFileData, include $dumpPath); }
public function save() { requirePermission("toggleMessage"); $fusionConfig = new ConfigEditor("application/config/message.php"); $fusionConfig->set('message_enabled', $this->input->post('message_enabled')); $fusionConfig->set('message_headline', $this->input->post('message_headline')); $fusionConfig->set('message_headline_size', $this->input->post('message_headline_size')); $fusionConfig->set('message_text', $this->input->post('message_text')); $fusionConfig->save(); die("اطلاعیه با موفقیت ذخیره شد"); }
public function save() { requirePermission("toggleMessage"); $fusionConfig = new ConfigEditor("application/config/message.php"); $fusionConfig->set('message_enabled', $this->input->post('message_enabled')); $fusionConfig->set('message_headline', $this->input->post('message_headline')); $fusionConfig->set('message_headline_size', $this->input->post('message_headline_size')); $fusionConfig->set('message_text', $this->input->post('message_text')); $fusionConfig->save(); die("The announcement has been saved!"); }
public static function checkLogin() { if (isset($_REQUEST['logout'])) { session_unset(); header("Location: index.php"); } if (isset($_REQUEST['forgot'])) { $reqmess = ConfigEditor::requestPassword(); } $config = ConfigEditor::read('config.php'); if (!isset($_SESSION['configuration']['logged']) || !$_SESSION['configuration']['logged'] || $_SESSION['configuration']['logged']['user'] != $config['admin_user'] || $_SESSION['configuration']['logged']['password'] != $config['admin_pass']) { //$config = ConfigEditor::read('config.php'); if (isset($_REQUEST['adminuser']) && isset($_REQUEST['adminpass'])) { if ($_REQUEST['adminuser'] == $config['admin_user'] && $_REQUEST['adminpass'] == $config['admin_pass']) { $_SESSION['configuration']['logged'] = array(); $_SESSION['configuration']['logged']['user'] = $config['admin_user']; $_SESSION['configuration']['logged']['password'] = $config['admin_pass']; return true; } else { $_SESSION['configuration']['logged'] = false; $loginerror = "Login Failed"; require "views/login.php"; die; } } else { if (!isset($config['admin_user']) || $config['admin_user'] == "") { $_SESSION['configuration']['logged'] = true; return true; } else { require "views/login.php"; die; } } } else { return true; } }
<?php /* * @author: Tomáš Mičulka * @version: 2.0 * @last_update: 14.4.2014 */ defined('IN_INNE') or die("Acces denied!"); $database = Mysql::getConnection(); $getToken = $_POST["token"]; $user = User::getInstance(); if ($user->userToken == $getToken && $user->userPerm == 5) { $config = new ConfigEditor(); for ($i = 0; $i < count($config->properties); $i++) { $config->SetProperty($config->properties[$i], $database->handler->real_escape_string($_POST[$config->properties[$i]])); } $config->SaveConfig(); }
/** * Writes provided config into config file. * * @param string $alias Yii path alias for config file. * @param array $config New config. * * @return int Number of written bytes or one of self::CONFIG_FILE_* error * constants. Since number of written bytes should be big (20+), error * codes should no intersect with it. * @since 0.1.0 */ protected function writeConfig($alias, array $updates) { \Yii::beginProfile('applicationModel.writeConfig'); $path = \Yii::getPathOfAlias($alias) . '.php'; if (!file_exists($path)) { return self::CONFIG_FILE_MISSING; } elseif (!is_writable($path)) { return self::CONFIG_FILE_NOT_WRITABLE; } $editor = new ConfigEditor(); $configText = file_get_contents($path); $config = $editor->rewriteConfig($configText, $updates); $result = file_put_contents($path, $config); \Yii::endProfile('applicationModel.writeConfig'); return $result; }
$zip = new ZipArchive(); $res = $zip->open($tmpfile); if ($res === TRUE) { $zip->extractTo(ROOT_PATH . '/'); $zip->close(); $uploadzip = "OK"; } else { $uploadzip = "ERR"; } } else { $uploadzip = "ERR"; } } if (isset($_GET['deftheme']) && is_dir(ROOT_PATH . '/themes/' . $_GET['deftheme'])) { $config['portal_theme'] = $_GET['deftheme']; $altmess = ConfigEditor::write('config.php', $config); } if (isset($_REQUEST['action']) && $_REQUEST['action'] == "themes") { $pagetitle = "Themes Manager"; $viewname = "themes"; } else { if (isset($_REQUEST['action']) && $_REQUEST['action'] == "themestore") { $pagetitle = "Themes Store"; $viewname = "themestore"; } else { if (isset($_REQUEST['action']) && $_REQUEST['action'] == "pluginstore") { $pagetitle = "Plugins Store"; $viewname = "pluginstore"; } else { if (isset($_REQUEST['action']) && $_REQUEST['action'] == "appearance") { $pagetitle = "Appearance Settings";
public function saveSettings() { requirePermission("editSlider"); require_once 'application/libraries/configeditor.php'; $slider = $this->input->post("show_slider"); if (!is_numeric($this->input->post("slider_interval")) || !$this->input->post("slider_interval")) { $slider_interval = 3000; } else { $slider_interval = (int) $this->input->post("slider_interval") * 1000; } $slider_style = $this->input->post("slider_style"); if ($slider == "always") { $slider = true; $slider_home = false; } elseif ($slider == "home") { $slider = true; $slider_home = true; } else { $slider = false; $slider_home = false; } $fusionConfig = new ConfigEditor("application/config/fusion.php"); $fusionConfig->set('slider', $slider); $fusionConfig->set('slider_interval', $slider_interval); $fusionConfig->set('slider_home', $slider_home); $fusionConfig->set('slider_style', $slider_style); $fusionConfig->save(); die("UI.alert('Settings have been saved!')"); }
function main($argc, $argv) { if ($this->getParameterCount() == 0) { $this->usage(); return 1; } switch ($this->getParameter(0)) { case 'call': if ($this->hasArgument('u')) { $user = $this->getArgument('u'); $pass = null; if ($this->hasArgument('p')) { printf('Password: '******':', $paramlistitem . ':'); $data[$k] = $v; } $site = $this->conf->vs_siteurl; $xc = new XmlrpcClient($site . '/api/xmlrpc', $user, $pass); $ret = $xc->call($this->getParameter(1), $data); if ($ret) { if (arr::hasKey($ret, 'faultCode')) { printf("Error %d: %s\n", $ret['faultCode'], $ret['faultString']); } else { debug::inspect($ret, false, false); } } else { printf("Server error.\n"); } break; case 'config': $editor = new ConfigEditor(); $editor->loop(); break; case 'set': $key = $this->getParameter(1); $defs = $this->conf->getDefs($key); $val = $this->getParameter(2); $this->printValue($key, $val); switch ($defs['vartype']) { case 'boolean': if ($val == "1") { $this->conf->{$key} = true; } else { $this->conf->{$key} = false; } break; case 'integer': $this->conf->{$key} = intval($val); break; case 'float': $this->conf->{$key} = floatval($val); break; default: $this->conf->{$key} = $val; } break; case 'get': if ($this->getParameterCount() > 1) { $key = $this->getParameter(1); $val = $this->conf->{$key}; $this->printValue($key, $val); } else { $keys = $this->conf->getAll(); ksort($keys); foreach ($keys as $key => $val) { if ($key) { $this->printValue($key, $val); } } } break; case 'backup': $filename = $this->getParameter(1); printf("Backing up to %s...\n", $filename); $keys = $this->conf->getAll(); file_put_contents($filename, serialize($keys)); break; case 'restore': $filename = $this->getParameter(1); printf("Restoring from %s...\n", $filename); $keys = unserialize(file_get_contents($filename)); foreach ($keys as $key => $value) { printf(" %s: ", $key); $this->conf->{$key} = $value; printf("Ok\n"); } break; case 'unset': $keys = $this->getParameters(); $keys = array_slice($keys, 1); foreach ($keys as $key) { printf("Unset key: %s\n", $key); $this->conf->{$key} = null; } break; default: $params = $this->getParameters(); $cmd = $params[0]; $params = array_slice($params, 1); $cmdm = 'cmd_' . $cmd; if (is_callable(array($this, $cmdm))) { call_user_func_array(array($this, $cmdm), $params); } else { printf("Unknown command: %s, try -h\n", $cmd); } break; } }
<?php /* * @author: Tomáš Mičulka * @version: 2.0 * @last_update: 15.4.2014 */ defined('IN_INNE') or die("Acces denied!"); $getToken = $_GET["token"]; $user = User::getInstance(); if ($user->userToken == $getToken && $user->userPerm == 5) { $templateId = InneAdm::$postData["id"]; $database = Mysql::getConnection(); $database->Query("UPDATE " . TABLE_PREFIX . "templates SET templateActive='0';"); $database->Query("UPDATE " . TABLE_PREFIX . "templates SET templateActive='1' WHERE templateId='{$templateId}';"); $data = $database->Query("SELECT * FROM " . TABLE_PREFIX . "templates WHERE templateActive='1';"); while ($row = $data->fetch_array()) { $templateName = $row['templateName']; } $config = new ConfigEditor(); $config->webTemplate = $templateName; $config->SaveConfig(); $debug = new Debug(); $debug->debugLevel = 0; $debug->debugType = 0; $debug->debugMessage = Lang::$langData["templateEnabled"]; $debug->StartDebug(); }
public function save($module = false, $name = false) { if (!$name || !$module || !$this->configExists($module, $name)) { die("ماژول نامعتبر است یا نام آن نامعتبر است"); } else { if ($this->input->post()) { $fusionConfig = new ConfigEditor("application/modules/" . $module . "/config/" . $name . ".php"); foreach ($this->input->post() as $key => $value) { $fusionConfig->set($key, $value); } $fusionConfig->save(); die("تنظیمات با موفقیت ذخیره شد"); } else { die("داده ای وارد نشده"); } } }
public function save($module = false, $name = false) { if (!$name || !$module || !$this->configExists($module, $name)) { die("Invalid module or config name"); } else { if ($this->input->post()) { $fusionConfig = new ConfigEditor("application/modules/" . $module . "/config/" . $name . ".php"); foreach ($this->input->post() as $key => $value) { $fusionConfig->set($key, $value); } $fusionConfig->save(); die("The settings have been saved!"); } else { die("No data to set"); } } }
private function config() { $owner = fopen("../application/config/owner.php", "w"); fwrite($owner, '<?php $config["owner"] = "' . addslashes($_POST['superadmin']) . '";'); fclose($owner); require_once '../application/libraries/configeditor.php'; $distConfig = '../application/config/fusion.php.dist'; $config = '../application/config/fusion.php'; if (file_exists($distConfig)) { copy($distConfig, $config); } // preserve the original in-case they mess up the new one $config = new ConfigEditor($config); $data['title'] = $_POST['title']; $data['server_name'] = $_POST['server_name']; $data['realmlist'] = $_POST['realmlist']; $data['keywords'] = $_POST['keywords']; $data['description'] = $_POST['description']; $data['analytics'] = $_POST['analytics'] ? $_POST['analytics'] : false; $data['cdn'] = $_POST['cdn'] == "yes" ? true : false; $data['security_code'] = $_POST['security_code']; foreach ($data as $key => $value) { $config->set($key, $value); } if (in_array($_POST['emulator'], array('arcemu', 'summitemu'))) { switch ($_POST['expansion']) { case "wotlk": $config->set('disabled_expansions', array(32)); break; case "tbc": $config->set('disabled_expansions', array(24, 32)); break; case "vanilla": $config->set('disabled_expansions', array(8, 24, 32)); break; } } else { switch ($_POST['expansion']) { case "wotlk": $config->set('disabled_expansions', array(3)); break; case "tbc": $config->set('disabled_expansions', array(2, 3)); break; case "vanilla": $config->set('disabled_expansions', array(1, 2, 3)); break; default: $config->set('disabled_expansions', array()); break; } } $config->save(); $db = fopen("../application/config/database.php", "w"); $raw = '<?php $active_group = "cms"; $active_record = TRUE; $db["cms"]["hostname"] = "' . $_POST['cms_hostname'] . '"; $db["cms"]["username"] = "******"; $db["cms"]["password"] = "******"; $db["cms"]["database"] = "' . $_POST['cms_database'] . '"; $db["cms"]["port"] = ' . (is_numeric($_POST['cms_port']) ? $_POST['cms_port'] : self::MYSQL_DEFAULT_PORT) . '; $db["cms"]["dbdriver"] = "mysqli"; $db["cms"]["dbprefix"] = ""; $db["cms"]["pconnect"] = TRUE; $db["cms"]["db_debug"] = TRUE; $db["cms"]["cache_on"] = FALSE; $db["cms"]["cachedir"] = ""; $db["cms"]["char_set"] = "utf8"; $db["cms"]["dbcollat"] = "utf8_general_ci"; $db["cms"]["swap_pre"] = ""; $db["cms"]["autoinit"] = TRUE; $db["cms"]["stricton"] = FALSE; $db["account"]["hostname"] = "' . $_POST['realmd_hostname'] . '"; $db["account"]["username"] = "******"; $db["account"]["password"] = "******"; $db["account"]["database"] = "' . $_POST['realmd_database'] . '"; $db["account"]["port"] = ' . (is_numeric($_POST['realmd_port']) ? $_POST['realmd_port'] : self::MYSQL_DEFAULT_PORT) . '; $db["account"]["dbdriver"] = "mysqli"; $db["account"]["dbprefix"] = ""; $db["account"]["pconnect"] = TRUE; $db["account"]["db_debug"] = TRUE; $db["account"]["cache_on"] = FALSE; $db["account"]["cachedir"] = ""; $db["account"]["char_set"] = "utf8"; $db["account"]["dbcollat"] = "utf8_general_ci"; $db["account"]["swap_pre"] = ""; $db["account"]["autoinit"] = FALSE; $db["account"]["stricton"] = FALSE;'; fwrite($db, $raw); fclose($db); die('1'); }
public function saveSmtp() { $fusionConfig = new ConfigEditor("application/config/smtp.php"); $fusionConfig->set('use_own_smtp_settings', $this->input->post('use_own_smtp_settings')); $fusionConfig->set('smtp_host', $this->input->post('smtp_host')); $fusionConfig->set('smtp_user', $this->input->post('smtp_user')); $fusionConfig->set('smtp_pass', $this->input->post('smtp_pass')); $fusionConfig->set('smtp_port', $this->input->post('smtp_port')); $fusionConfig->save(); die('بله'); }
public function saveHeader() { requirePermission("changeThemeHeader"); $header_url = $this->input->post('header_url'); require_once 'application/libraries/configeditor.php'; $fusionConfig = new ConfigEditor("application/config/fusion.php"); $fusionConfig->set('header_url', $header_url); $fusionConfig->save(); }
<?php /* * @author: Tomáš Mičulka * @version: 2.0 * @last_update: 7.1.2014 */ defined('IN_INNE') or die("Acces denied!"); $config = new ConfigEditor(); $configData = array(); for ($i = 0; $i < count($config->properties); $i++) { $configData[$i]["name"] = $config->properties[$i]; $configData[$i]["value"] = $config->GetProperty($config->properties[$i]); $configData[$i]["type"] = "DISABLED"; } $template = AdmTemplate::getInstance(); $template->template->assign("configData", $configData);