Example #1
0
 /**
  * @covers Config::write
  * @todo   Implement testWrite().
  */
 public function testWrite()
 {
     $config = array('app_key' => 'appkeyvalue', 'user_key' => 'userkeyvalue');
     $this->object->setConfig($config);
     echo getcwd();
     $this->object->setFileName('data/testOutputFile.ini');
     $this->object->write();
     $this->assertEquals($config, $this->object->read());
     unlink($this->object->getFileName());
 }
 public function testEmpty()
 {
     file_put_contents($this->file, '');
     $this->assertEquals($this->object->get('test.trees.oak.fairies', 'default'), 'default');
     $this->object->set('test.trees.oak.second_fairy', 'Trixie');
     $this->assertEquals($this->object->get('test.trees.oak.second_fairy'), 'Trixie');
     $this->object->write('test');
     $group = $this->object->get('test');
     $this->assertArrayHasKey('trees', $group);
     $this->assertArrayHasKey('oak', $group['trees']);
     $this->assertArrayHasKey('second_fairy', $group['trees']['oak']);
     $this->assertEquals($group['trees']['oak']['second_fairy'], 'Trixie');
 }
Example #3
0
	/**
	 * Shuts the bot down
	 *
	 * @return	void
	 */
	public static function destruct() {
		// break in child
		if (self::$bot !== null) {
			if (!self::$bot->isParent()) return;
		}
		self::$log->info = 'Shutting down';
		
		// send leave message
		self::$bot->getConnection()->leave();
		if (VERBOSE > 0) self::$log->info = 'Left chat';
		// write the configs
		self::$config->write();
		if (VERBOSE > 0) self::$log->info = 'Written config';
		
		// call destructors of modules
		foreach (self::$modules as $module) {
			$module->destruct();
		}
		if (VERBOSE > 0) self::$log->info = 'Unloading modules';
		
		// clear class cache
		$files = glob(DIR.'cache/*');
		foreach ($files as $file) {
			unlink($file);
		}
		if (VERBOSE > 0) self::$log->info = 'Cleaned cache';
		unlink(DIR.'bot.pid');
	}
Example #4
0
 public function stage1()
 {
     if (Input::method() == 'POST') {
         // run patch containing the changes
         require PATH . 'upgrade/patch.php';
         Migrations::apply();
         Config::write(PATH . 'config.php', Config::get());
         return redirect('complete');
     }
     render('stage1');
 }
Example #5
0
 public function __construct($file)
 {
     // Define path to application directory
     Config::write('BASE_PATH', $file);
     Config::write('APP_PATH', $file . '/../app');
     Config::write('SITE_NAME', 'Marketing Evolution');
     Config::write('SITE_URL', 'http://marketingevolution.com');
     //invoke the rest object.
     $rest = new \kiss\Rest();
     //Return response to context
     $this->response = $rest->response();
 }
Example #6
0
function get_generic_access_token()
{
    $client = new \GuzzleHttp\Client();
    $response = $client->post(Config::get('motibu.API_URL') . 'oauth/client_cred_grant_token', ['body' => ['client_id' => Config::get('motibu.CLIENT_ID'), 'client_secret' => Config::get('motibu.CLIENT_SECRET'), 'grant_type' => 'client_credentials']]);
    $response = $response->json();
    Log::info($response);
    if (!array_key_exists('access_token', $response) && !strlen($response['access_token'])) {
        return false;
    } else {
        Config::write('access.client_token', $response['access_token']);
        Config::set('access.client_token', $response['access_token']);
        return true;
    }
}
Example #7
0
 public function postEdit()
 {
     $rules = ['phone' => 'required|min:4', 'email' => 'required|email', 'company' => 'required|min:3', 'title' => 'required|min:20', 'description' => 'required|min:50', 'author' => 'required|min:5', 'keywords' => 'required|min:20', 'address' => 'required|min:5', 'mode' => 'required|min:10', 'zoom' => 'required|min:1|max:40|integer', 'latitude' => 'required|min:1|max:90', 'longitude' => 'required|min:1|max:90'];
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to("admin/setting")->withErrors($validator)->withInput(Input::except(''));
     }
     //dd(Input::all());
     foreach ($rules as $key => $value) {
         Config::write('setting.' . $key, Input::get($key));
     }
     if (Input::get('parameters')) {
         $parameters = json_decode(Input::get('parameters'));
         $img = Image::make($parameters->name);
         $img->crop($parameters->w, $parameters->h, $parameters->x, $parameters->y);
         $img->resize(Config::get('setting.logo.w'), Config::get('setting.logo.h'));
         $img->save(Config::get('setting.logo.path'));
         File::delete($parameters->tmp);
         $img->destroy();
     }
     return Redirect::to("admin/setting")->with('success', trans("message.setting"));
 }
Example #8
0
<?php

// Site
Config::write('site.domain', $_SERVER['SERVER_NAME']);
Config::write('site.protocol', 'http');
// Database
Config::write('db.prefix', 'pgsql');
$Connection = get_connection();
$Connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Initialisation
Config::write('var.showsession', FALSE);
//Developent
Config::write('dev.noemail', TRUE);
Example #9
0
<?php

abstract class Config
{
    private static $_config = array();
    public static function get($name)
    {
        return self::$_config[$name];
    }
    public static function write($name, $value)
    {
        self::$_config[$name] = $value;
    }
}
require __DIR__ . '/user/config.php';
foreach ($config as $name => $value) {
    Config::write($name, $value);
}
Example #10
0
 /**
  * @testdox should read and write config values
  */
 public function testShouldReadAndWriteConfigValues()
 {
     Config::write('Test.status', $expected = 'success');
     $actual = Config::read('Test.status');
     $this->assertEquals($expected, $actual);
 }
 /**
  * Switch config to use primary domain (for multi domain testing).
  *
  * Switch will happen only if a first switch to secondary domain was done first.
  */
 public function switchToPrimaryDomain()
 {
     // Switch needs to be done only if a switch to secondary domain was done first.
     if (Config::read('passbolt.url_primary')) {
         // Reset the config with the base url.
         Config::write('passbolt.url', Config::read('passbolt.url_primary'));
         PassboltServer::resetExtraConfig();
     }
 }
Example #12
0
<?php

/**
 * ROUTES
 *
 * Configurações de redirecionamento de URL.
 *
 * Por padrão, o sistema procura por qualquer endereço escrito no índice de
 * array $routes e redireciona tudo.
 *
 *
 * Os Routes são lidos na ordem. O sistema vai usar o primeiro item que
 * coincidir com o padrão.
 *
 */
$routes = array("/:controller/:action/:arg" => array("controller" => ":controller", "action" => ":action", ":arg"), "/:controller/:action" => array("controller" => ":controller", "action" => ":action"), "/" => array("controller" => "site", "action" => "index"));
/**
 * Salva a configuração acima
 */
Config::write("routes", $routes);
Example #13
0
<?php

/**
 * Liteframe PHP Framework
 * @author Nabeel Shahzad
 * @copyright Copyright (c) 2009 - 2010, Nabeel Shahzad
 * @link http://github.com/nshahzad/liteframe
 *
 */
namespace Liteframe;

# The default routing
Config::write('DEFAULT_CONTROLLER', 'default');
# Your default site title
Config::write('SITE_TITLE', 'liteframe');
# This is the default, used with the $this->url() function
Config::write('BASE_URL', $_SERVER['SERVER_NAME']);
# Use a mod-rewrite rule, or default will be ?q=
# Used with the $this->url() function to generate URLs
Config::write('USE_REWRITE', true);
Config::write('DATABASE_CONNECTIONS', array('example' => 'mysql://*****:*****@localhost/database_name'));
# If this is not blank, then a DB connection will be made
# Should be one of the indexes from above
Config::write('DATABASE_CONNECTOR', '');
Example #14
0
<?php

// Time zone
date_default_timezone_set('Australia/Adelaide');
// Site
Config::write('site.title', 'Australian Curriculum Engagement Tool');
Config::write('site.includenone', FALSE);
// Email
// (Uncomment only one of the following three
// Config::write('email.transporttype','Smtp');
Config::write('email.transporttype', 'Sendmail');
// Config::write('email.transporttype','Mail');
// SMTP
Config::write('smtp.host', 'smtp.gmail.com');
Config::write('smtp.port', '465');
Config::write('smtp.encr', 'ssl');
Config::write('smtp.user', '*****@*****.**');
Config::write('smtp.pass', 'ttrezhjcrurgvlaq');
// Sendmail
Config::write('email.sendmail', '/usr/sbin/sendmail -bs');
// Database
Config::write('db.host', '127.0.0.1');
Config::write('db.user', 'amoschou');
Config::write('db.port', '5432');
Config::write('db.password', '');
Config::write('db.basename', 'acmathematicsweb');
// Password
Config::write('password.cost', 11);
Example #15
0
<?php

// Models
include_once "models/class.UserModel.php";
include_once "models/class.RoleModel.php";
// Views
include_once "views/class.UserSearchView.php";
include_once "views/class.UserDetailView.php";
include_once "views/class.LoginView.php";
include_once "views/class.LoginTimeOutView.php";
// Controllers
include_once "controllers/class.User.php";
include_once "controllers/class.Login.php";
// Pages URL's
Config::write('page.url.user.search', Config::read('url.admin') . "/user/search");
Config::write('page.url.user.detail', Config::read('url.admin') . "/user/detail");
Config::write('page.url.user.remove', Config::read('url.admin') . "/user/remove");
Config::write('page.url.login', Config::read('url.admin'));
Config::write('page.url.login.inactive', Config::read('url.admin') . "/login/inactive");
Config::write('page.url.login.logoff', Config::read('url.admin') . "/login/logoff");
Example #16
0
}
require_once "{$incpath}/config.inc.php";
if (isset($CONF['configured'])) {
    if ($CONF['configured'] == FALSE) {
        die("Please edit config.inc.php - change \$CONF['configured'] to true after setting your database settings");
    }
}
Config::write($CONF);
require_once "{$incpath}/languages/language.php";
require_once "{$incpath}/functions.inc.php";
if (defined('POSTFIXADMIN_CLI')) {
    $language = 'en';
    # TODO: make configurable or autodetect from locale settings
} else {
    $language = check_language();
    # TODO: storing the language only at login instead of calling check_language() on every page would save some processor cycles ;-)
    $_SESSION['lang'] = $language;
}
require_once "{$incpath}/languages/" . $language . ".lang";
if (!empty($CONF['language_hook']) && function_exists($CONF['language_hook'])) {
    $hook_func = $CONF['language_hook'];
    $PALANG = $hook_func($PALANG, $language);
}
Config::write('__LANG', $PALANG);
if (!defined('POSTFIXADMIN_CLI')) {
    if (!is_file("{$incpath}/smarty.inc.php")) {
        die("smarty.inc.php is missing! Something is wrong...");
    }
    require_once "{$incpath}/smarty.inc.php";
}
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
Example #17
0
    if (!$db) {
        $errors['select'] = 'Не удалось найти базу. Проверте имя базы!';
    }
    if (!empty($_POST['prefix']) && !preg_match('#^[a-z_]*$#i', $_POST['prefix'])) {
        $errors['db_prefix'] = 'Не допустимые символы в поле "Префикс"';
    }
    if (empty($errors)) {
        $settings = Config::read('all');
        $settings['db'] = array();
        $settings['db']['host'] = $_POST['host'];
        $settings['db']['name'] = $_POST['base'];
        $settings['db']['user'] = $_POST['user'];
        $settings['db']['pass'] = $_POST['pass'];
        $settings['db']['prefix'] = $_POST['prefix'];
        $settings['admin_email'] = $_POST['adm_email'];
        Config::write($settings);
        $_SESSION['adm_name'] = $_POST['adm_login'];
        $_SESSION['adm_pass'] = $_POST['adm_pass'];
        $_SESSION['adm_email'] = $_POST['adm_email'];
        header('Location: step2.php ');
        die;
    }
}
?>
<!doctype html>
<html>
<head>
<title>AtomX CMS - вместе в будущее</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<link rel="shortcut icon" href="../sys/img/favicon.ico" type="image/x-icon">
<link type="text/css" rel="StyleSheet" href="css/style.css" />
Example #18
0
 /**
  * Setup configuration database, handle versioning and upgrades
  * @param DatabaseSqlite3 &$db Database object
  * @return void
  */
 public static function setupDatabase(&$db)
 {
     Log::debug('Checking Aetolos database');
     // Global configuration table
     $rc = $db->query(self::$schemaConfig);
     if ($rc === false) {
         return false;
     }
     // Verify that the table was created successfully
     $db->query("SELECT 1 FROM `sqlite_master` WHERE type='table' AND name='config'");
     $db->next_row();
     if (!isset($db->row[0]) || $db->row[0] !== "1") {
         Log::error('Error while creating table: config');
         return false;
     }
     // Check database version or check for an empty/new database
     $db->query("SELECT Value FROM `config` WHERE Config='aetolos|dbversion'");
     $db->next_row();
     if ($db->row === false) {
         // New database, set default values
         $config = array();
         // Aetolos
         $config['aetolos|version'] = AET_VER;
         $config['aetolos|dbversion'] = AET_DB_VER;
         $config['aetolos|features'] = 'php|opendkim|nsd|clamav|spamassassin|postfix|dovecot|mariadb|roundcube|apache';
         // Smarty
         $config['smarty|templateDirectory'] = dirname(__DIR__) . '/templates';
         $config['smarty|compileDirectory'] = dirname(__DIR__) . '/smarty/templates_c';
         $config['smarty|cacheDirectory'] = dirname(__DIR__) . '/smarty/cache';
         $config['smarty|configDirectory'] = dirname(__DIR__) . '/smarty/configs';
         $config['smarty|pluginsDirectory'] = dirname(__DIR__) . '/smarty/libs/plugins';
         $config['smarty|cacheLifetime'] = 14400;
         $config['smarty|debug'] = false;
         // PHP
         $config['php|iniFile'] = '/etc/php.ini';
         // NSD
         $config['nsd'] = 'enabled';
         $config['nsd|nsdConfFile'] = '/etc/nsd/nsd.conf';
         $config['nsd|directoryConfD'] = '/etc/nsd/conf.d';
         $config['nsd|selinuxModule'] = '';
         // ClamAV
         $config['clamav'] = 'enabled';
         $config['clamav|clamdConfFile'] = '/etc/clamd.d/clamd.conf';
         $config['clamav|clamdSysconfigFile'] = '/etc/sysconfig/clamd';
         $config['clamav|clamdSystemdFile'] = '/usr/lib/systemd/system/clamd.service';
         $config['clamav|clamdTmpfilesFile'] = '/usr/lib/tmpfiles.d/clamd.conf';
         $config['clamav|freshclamFile'] = '/etc/freshclam.conf';
         $config['clamav|clamavMilterFile'] = '/etc/mail/clamav-milter.conf';
         $config['clamav|clamavMilterTmp'] = '/usr/lib/tmpfiles.d/clamav-milter.conf';
         $config['clamav|selinuxModule'] = '';
         // Spamassassin
         $config['spamassassin'] = 'enabled';
         $config['spamassassin|initPreFile'] = '/etc/mail/spamassassin/init.pre';
         $config['spamassassin|milterFile'] = '/etc/sysconfig/spamass-milter';
         $config['spamassassin|localCfFile'] = '/etc/mail/spamassassin/local.cf';
         $config['spamassassin|selinuxModule'] = '';
         // Postfix
         $config['postfix'] = 'enabled';
         $config['postfix|postfixDirectory'] = '/etc/postfix';
         $config['postfix|virtualDomainsFile'] = '/etc/postfix/virtual_mailbox_domains';
         $config['postfix|selinuxModule'] = '';
         // OpenDKIM
         $config['opendkim'] = 'enabled';
         $config['opendkim|opendkimConfFile'] = '/etc/opendkim.conf';
         // Dovecot
         $config['dovecot'] = 'enabled';
         $config['dovecot|confFile'] = '/etc/dovecot/dovecot.conf';
         $config['dovecot|directoryConfD'] = '/etc/dovecot/conf.d';
         $config['dovecot|selinuxModule'] = '';
         // MariaDB
         $config['mariadb'] = 'enabled';
         $config['mariadb|serverFile'] = '/etc/my.cnf.d/server.cnf';
         // Roundcube
         $config['roundcube'] = 'enabled';
         $config['roundcube|dbPassword'] = hash('sha256', openssl_random_pseudo_bytes(16));
         $config['roundcube|desKey'] = mb_substr(hash('sha256', openssl_random_pseudo_bytes(16)), rand(0, 40), 24);
         $config['roundcube|configFile'] = '/etc/roundcubemail/config.inc.php';
         // Apache
         $config['apache'] = 'enabled';
         $config['apache|directoryConf'] = '/etc/httpd/conf';
         $config['apache|directoryConfD'] = '/etc/httpd/conf.d';
         $config['apache|directoryConfModulesD'] = '/etc/httpd/conf.modules.d';
         $config['apache|maxClients'] = 50;
         $config['apache|selinuxModule'] = '';
         // PKI/TLS
         $config['pkitls|directoryCerts'] = '/etc/pki/tls/certs';
         $config['pkitls|directoryPrivate'] = '/etc/pki/tls/private';
         // Write to global configuration and save to database
         foreach ($config as $key => $value) {
             Config::write($db, $key, $value);
         }
     } else {
         if (isset($db->row[0]) && $db->row[0] !== AET_DB_VER) {
             // Current version number
             $ver = (int) $db->row[0];
             // Back to the future?
             if ($ver > AET_DB_VER) {
                 Log::error('The database version ' . $ver . ' is higher than the supported version ' . AET_DB_VER . ' of this Aetolos installation');
                 return false;
             }
             // Loop while current version requires updating
             while ($ver < AET_DB_VER) {
                 // Version numbers
                 switch ($ver) {
                     case 1:
                         /*
                          * WTF?
                          *
                          * You are probably wondering what is the meaning of the following block of code,
                          * well so have I, like many others who have stumbled uppon this issue. The 1st
                          * iteration of the database used 'UNIQUE' on two columns that had to be removed
                          * by altering the table schema. Apparently this is not supported by SQlite3,
                          * thus the only solution was to create a temporary table, copy the rows, delete
                          * the old table, create a table with the new schema, copy the rows and finally
                          * delete the temporary table. Note to self: RTFM
                          *
                          */
                         $db->conn->beginTransaction();
                         $rc1 = $db->query('CREATE TABLE `virtualHost_backup` ( Id INTEGER PRIMARY KEY AUTOINCREMENT, Created DATETIME DEFAULT CURRENT_TIMESTAMP, DomainName VARCHAR(253) NOT NULL UNIQUE, UnixName VARCHAR(32) NOT NULL, DbPrefix VARCHAR(8) NOT NULL, IpAddress VARCHAR(39) NOT NULL, Home VARCHAR(255) NOT NULL, DomainZoneVersion INTEGER DEFAULT 1, AdminEmail VARCHAR(255), Quota INTEGER DEFAULT 0, BandwidthLimit INTEGER, MaxEmails INTEGER, MaxDatabases INTEGER, MaxSubDomains INTEGER, MaxParkedDomains INTEGER, ParkedUnder INTEGER, FOREIGN KEY(ParkedUnder) REFERENCES virtualHost(Id) )');
                         $rc2 = $db->query('INSERT INTO `virtualHost_backup` SELECT *,null FROM `virtualHost`');
                         $rc3 = $db->query('DROP TABLE `virtualHost`');
                         $rc4 = $db->query('CREATE TABLE `virtualHost` ( Id INTEGER PRIMARY KEY AUTOINCREMENT, Created DATETIME DEFAULT CURRENT_TIMESTAMP, DomainName VARCHAR(253) NOT NULL UNIQUE, UnixName VARCHAR(32) NOT NULL, DbPrefix VARCHAR(8) NOT NULL, IpAddress VARCHAR(39) NOT NULL, Home VARCHAR(255) NOT NULL, DomainZoneVersion INTEGER DEFAULT 1, AdminEmail VARCHAR(255), Quota INTEGER DEFAULT 0, BandwidthLimit INTEGER, MaxEmails INTEGER, MaxDatabases INTEGER, MaxSubDomains INTEGER, MaxParkedDomains INTEGER, ParkedUnder INTEGER, FOREIGN KEY(ParkedUnder) REFERENCES virtualHost(Id) )');
                         $rc5 = $db->query('INSERT INTO `virtualHost` SELECT * FROM `virtualHost_backup`');
                         $rc6 = $db->query('DROP TABLE `virtualHost_backup`');
                         if ($rc1 === true && $rc2 === true && $rc3 === true && $rc4 === true && $rc5 === true && $rc6 === true) {
                             $db->conn->commit();
                         } else {
                             $db->conn->rollBack();
                             return false;
                         }
                         $db->query("UPDATE `config` SET Value='2' WHERE Config='aetolos|dbversion'");
                         $ver++;
                         break;
                     case 2:
                         /*
                          * OpenDKIM configuration parameters
                          */
                         $db->conn->beginTransaction();
                         $rc1 = $db->query('INSERT OR REPLACE INTO `config` (Config, Value) VALUES ("opendkim", "enabled")');
                         $rc2 = $db->query('INSERT OR REPLACE INTO `config` (Config, Value) VALUES ("opendkim|opendkimConfFile", "/etc/opendkim.conf")');
                         $rc3 = $db->query("UPDATE `config` SET Value='php|opendkim|nsd|clamav|spamassassin|postfix|dovecot|mariadb|roundcube|apache' WHERE Config='aetolos|features'");
                         if ($rc1 === true && $rc2 === true && $rc3 === true) {
                             $db->conn->commit();
                         } else {
                             $db->conn->rollBack();
                             return false;
                         }
                         $db->query("UPDATE `config` SET Value='3' WHERE Config='aetolos|dbversion'");
                         $ver++;
                         break;
                     case 3:
                         /*
                          * Spamassassin configuration parameter
                          */
                         $db->conn->beginTransaction();
                         $rc1 = $db->query('INSERT OR REPLACE INTO `config` (Config, Value) VALUES ("spamassassin|initPreFile", "/etc/mail/spamassassin/init.pre")');
                         if ($rc1 === true) {
                             $db->conn->commit();
                         } else {
                             $db->conn->rollBack();
                             return false;
                         }
                         $db->query("UPDATE `config` SET Value='4' WHERE Config='aetolos|dbversion'");
                         $ver++;
                         break;
                     case 4:
                         /*
                          * Spamassassin configuration parameter
                          */
                         $db->conn->beginTransaction();
                         $rc1 = $db->query('INSERT OR REPLACE INTO `config` (Config, Value) VALUES ("spamassassin|milterFile", "/etc/sysconfig/spamass-milter")');
                         if ($rc1 === true) {
                             $db->conn->commit();
                         } else {
                             $db->conn->rollBack();
                             return false;
                         }
                         $db->query("UPDATE `config` SET Value='5' WHERE Config='aetolos|dbversion'");
                         $ver++;
                         break;
                 }
             }
         }
         // Load existing table data
         $rc = Config::loadDatabase($db);
         if ($rc === false) {
             return false;
         }
     }
     // Virtual host configuration table
     $rc = $db->query(self::$schemaVirtualHost);
     if ($rc === false) {
         return false;
     }
     // DNS configuration table
     $rc = $db->query(self::$schemaVirtualHostNs);
     if ($rc === false) {
         return false;
     }
     // Mail servers configuration table
     $rc = $db->query(self::$schemaVirtualHostMx);
     if ($rc === false) {
         return false;
     }
     // Verify that the table was created successfully
     $db->query("SELECT 1 FROM `sqlite_master` WHERE type='table' AND name='virtualHost'");
     $db->next_row();
     if (!isset($db->row[0]) || $db->row[0] !== "1") {
         Log::error('Error while creating table: virtualHost');
         return false;
     }
     return $db;
 }
Example #19
0
 /**
  * Setup SELinux
  * @return boolean
  */
 public function _selinux()
 {
     // Grab existing custom contexts
     $contexts = shell_exec('/usr/sbin/semanage fcontext --list -C');
     // SELinux httpd access to ~/public_html
     if (preg_match('/public_html.*httpd_sys_rw_content_t/', $contexts) === 0) {
         exec('/usr/sbin/semanage fcontext -a -t httpd_sys_rw_content_t \'/home/.*/public_html(/.*)?\'');
     }
     // SELinux httpd access to ~/tmp
     if (preg_match('/tmp.*httpd_sys_rw_content_t/', $contexts) === 0) {
         exec('/usr/sbin/semanage fcontext -a -t httpd_sys_rw_content_t \'/home/.*/tmp(/.*)?\'');
     }
     // SELinux postfix access to forward/forward.db
     if (preg_match('/forwarders.*postfix_etc_t/', $contexts) === 0) {
         exec('/usr/sbin/semanage fcontext -a -t postfix_etc_t -f f \'/home/.*/etc/.*/forwarders(\\.db)?\'');
     }
     // SELinux - allow network access via scripts executed by Apache, if this is disabled then scripts like Roundcube can't run
     $rc = exec('/usr/sbin/getsebool httpd_can_network_connect');
     if (strpos($rc, '--> on') === false) {
         Log::debug('SELinux: enable httpd_can_network_connect');
         // Enable network access
         exec('/usr/sbin/setsebool -P httpd_can_network_connect on');
     }
     // SELinux - allow Apache scripts to send emails
     $rc = exec('/usr/sbin/getsebool httpd_can_sendmail');
     if (strpos($rc, '--> on') === false) {
         Log::debug('SELinux: enable httpd_can_sendmail');
         // Enable emails
         exec('/usr/sbin/setsebool -P httpd_can_sendmail on');
     }
     // SELinux - allow Apache to access home files
     $rc = exec('/usr/sbin/getsebool httpd_read_user_content');
     if (strpos($rc, '--> on') === false) {
         Log::debug('SELinux: enable httpd_read_user_content');
         // Enable home access
         exec('/usr/sbin/setsebool -P httpd_read_user_content on');
     }
     // SELinux - allow Apache to access home directories
     $rc = exec('/usr/sbin/getsebool httpd_enable_homedirs');
     if (strpos($rc, '--> on') === false) {
         Log::debug('SELinux: enable httpd_enable_homedirs');
         // Enable home access
         exec('/usr/sbin/setsebool -P httpd_enable_homedirs on');
     }
     // SELinux - allow Apache to write tmp files
     if (Config::read('apache|selinuxModule') === '') {
         Log::debug('SELinux: enable httpd_home_tmp_aetolos.pp');
         // Install SELinux module
         exec('/usr/sbin/semodule -i ' . dirname(__DIR__) . '/selinux/httpd_home_tmp_aetolos.pp 2>/dev/null');
         // Remember the module has already been installed
         Config::write($this->db, 'apache|selinuxModule', 'installed');
     }
     // SELinux - allow ClamAV JIT access
     $rc = exec('/usr/sbin/getsebool clamd_use_jit');
     if (strpos($rc, '--> on') === false) {
         Log::debug('SELinux: enable clamd_use_jit');
         // Enable JIT access
         exec('/usr/sbin/setsebool -P clamd_use_jit on');
     }
     // SELinux - allow ClamAV to scan the system
     $rc = exec('/usr/sbin/getsebool antivirus_can_scan_system');
     if (strpos($rc, '--> on') === false) {
         Log::debug('SELinux: enable antivirus_can_scan_system');
         // Enable JIT access
         exec('/usr/sbin/setsebool -P antivirus_can_scan_system on');
     }
     // SELinux - allow ClamAV to create its own tmp files
     if (Config::read('clamav|selinuxModule') === '') {
         Log::debug('SELinux: enable clamav_tmp_aetolos.pp');
         // Install SELinux module
         exec('/usr/sbin/semodule -i ' . dirname(__DIR__) . '/selinux/clamav_tmp_aetolos.pp 2>/dev/null');
         // Remember the module has already been installed
         Config::write($this->db, 'clamav|selinuxModule', 'installed');
     }
     // SELinux - allow SpamAssassin to read /etc/resolv.conf for DNS queries
     if (Config::read('spamassassin|selinuxModule') === '') {
         Log::debug('SELinux: enable spamd_resolv_aetolos.pp');
         // Install SELinux module
         exec('/usr/sbin/semodule -i ' . dirname(__DIR__) . '/selinux/spamd_resolv_aetolos.pp 2>/dev/null');
         // Remember the module has already been installed
         Config::write($this->db, 'spamassassin|selinuxModule', 'installed');
     }
     // SELinux - allow Dovecot to access user home directories to read passwd/shadow files under user/etc
     if (Config::read('dovecot|selinuxModule') === '') {
         Log::debug('SELinux: enable dovecot_home_etc_aetolos.pp');
         // Install SELinux module
         exec('/usr/sbin/semodule -i ' . dirname(__DIR__) . '/selinux/dovecot_home_etc_aetolos.pp 2>/dev/null');
         // Remember the module has already been installed
         Config::write($this->db, 'dovecot|selinuxModule', 'installed');
     }
     // SELinux - allow NSD to write to log and temporary directories/files
     if (Config::read('nsd|selinuxModule') === '') {
         Log::debug('SELinux: enable nsd_etc_nsd_aetolos.pp');
         // Install SELinux module
         exec('/usr/sbin/semodule -i ' . dirname(__DIR__) . '/selinux/nsd_etc_nsd_aetolos.pp 2>/dev/null');
         // Remember the module has already been installed
         Config::write($this->db, 'nsd|selinuxModule', 'installed');
     }
     // SELinux - allow Postfix to access clamav-milter socket
     if (Config::read('postfix|selinuxModule') === '') {
         Log::debug('SELinux: enable postfix_socket_clamav_aetolos.pp');
         // Install SELinux module
         exec('/usr/sbin/semodule -i ' . dirname(__DIR__) . '/selinux/postfix_socket_clamav_aetolos.pp 2>/dev/null');
         // Remember the module has already been installed
         Config::write($this->db, 'postfix|selinuxModule', 'installed');
     }
     return true;
 }
Example #20
0
<?php

$allowGuest = $install = $ignoreDataBase = true;
require '../framework/inc.php';
Page::setTitle('Install Wizard');
$hideDefaultView = true;
?>

<?php 
$base = $_SERVER['PHP_SELF'];
$base = substr($base, 0, strlen($base) - strlen('/install/index.php')) . '/';
Config::write('BASE', $base);
Page::css('inspinia/plugins/iCheck/custom');
Page::css('inspinia/plugins/steps/jquery.steps');
Page::js('inspinia/plugins/steps/jquery.steps.min');
Page::js('inspinia/plugins/validate/jquery.validate.min');
Page::js('../install/wizard');
?>

<div class="ibox-content">
<h2>
    Skyer configuration
</h2>
<p>
    This wizard will help you to configure Skyer
</p>

<form id="form" action="form-submit.php" method="POST" class="wizard-big">
    <h1>DataBase</h1>
    <fieldset>
        <h2>DataBase Settings</h2>
Example #21
0
<?php

// Models
include_once "models/class.InboxModel.php";
// Views
include_once "views/class.InboxSearchView.php";
// Controllers
include_once "controllers/class.Inbox.php";
// Pages URL's
Config::write('page.url.inbox.search', URL_ROOT . "/inbox");
Config::write('page.url.inbox.detail', URL_ROOT . "/inbox/detail");
Config::write('page.url.inbox.remove', URL_ROOT . "/inbox/remove");
Example #22
0
require PATH . 'system/classes/helpers.php';
// map classes
Autoloader::map(array('Schema' => PATH . 'upgrade/classes/schema.php', 'Migrations' => PATH . 'upgrade/classes/migrations.php'));
// tell the autoloader where to find classes
Autoloader::directory(array(PATH . 'system/classes/'));
// register the auto loader
Autoloader::register();
/**
	Report all errors let our error class decide which to display
*/
error_reporting(-1);
/**
	Error display will be handled by our error class
*/
ini_safe_set('display_errors', false);
// Register the default timezone for the application.
date_default_timezone_set(Config::get('application.timezone'));
// Register the PHP exception handler.
set_exception_handler(array('Error', 'exception'));
// Register the PHP error handler.
set_error_handler(array('Error', 'native'));
// Register the shutdown handler.
register_shutdown_function(array('Error', 'shutdown'));
// load current config file
Config::load(PATH . 'config.php');
// add and apply migrations
require PATH . 'upgrade/migrations.php';
// write any config changes
Config::write(PATH . 'config.php', Config::get());
// redirect
header('Location: complete.php');
Example #23
0
<?php

// Models
include_once "models/class.FAQModel.php";
// Views
include_once "views/class.HomePageView.php";
include_once "views/class.TermsOfServiceView.php";
include_once "views/class.PrivacyPolicyView.php";
include_once "views/class.FAQView.php";
include_once "views/class.ContactView.php";
// Controllers
include_once "controllers/class.Content.php";
include_once "controllers/class.HomePage.php";
// Pages URL's
Config::write('page.url.homepage', URL_ROOT . "/");
Config::write('page.url.faq', URL_ROOT . "/content/faq");
Config::write('page.url.service', URL_ROOT . "/content/service");
Config::write('page.url.privacy', URL_ROOT . "/content/privacy");
Config::write('page.url.contact', URL_ROOT . "/content/contact");
Example #24
0
<?php

Config::write('app.hempty', '1B2M2Y8AsgTpgAmY7PhCfg');
Config::write('app.hsubject.mathematics', 'VAsh7Nsnb1CH7lhc7dbV0A');
Config::write('app.hlevel.year7', select_from('hlevel', "ac_Levels WHERE Level = 'Year 7'"));
Config::write('app.hlevel.year8', select_from('hlevel', "ac_Levels WHERE Level = 'Year 8'"));
Config::write('app.hlevel.year9', select_from('hlevel', "ac_Levels WHERE Level = 'Year 9'"));
Config::write('app.hlevel.year10', select_from('hlevel', "ac_Levels WHERE Level = 'Year 10'"));
Config::write('app.hlevel.year10a', select_from('hlevel', "ac_Levels WHERE Level = 'Year 10A'"));
Example #25
0
<?php

set_time_limit(0);
function __autoload($classname)
{
    include_once "{$classname}.php";
}
// Config
Config::write("db.host", "localhost");
Config::write("db.dbname", "mediaserver");
Config::write("db.user", "mediaserver");
Config::write("db.password", "qFw5Y4QxpQWGNseh");
Config::write("folder.movies", "D:\\Videos\\Movies");
echo "<pre>";
$mIndexer = new MovieIndexer(Config::read("folder.movies"));
print_r($mIndexer->indexUnindexed());
foreach ($mIndexer->getIndexed() as $movie) {
    echo "{$movie->Title}\n<img src='{$movie->Poster}'></img>\n\n";
}
//
//function getTvMetadata($episode, &$matches) {
//    if (preg_match("'^(.+)S([0-9]+)E([0-9]+).*$'i", $episode, $matches)) {
//        array_shift($matches);
//        return $matches;
//    }
//    return FALSE;
//}
Example #26
0
<?php

// Models
include_once "models/class.FAQModel.php";
// Views
include_once "views/class.HomePageView.php";
include_once "views/class.FAQSearchView.php";
include_once "views/class.FAQDetailView.php";
include_once "views/class.ContentDetailView.php";
// Controllers
include_once "controllers/class.Content.php";
// Pages URL's
Config::write('page.url.content.homepage', Config::read('url.admin') . "/content/homepage");
Config::write('page.url.content.detail', Config::read('url.admin') . "/content/detail");
Config::write('page.url.content.faq.search', Config::read('url.admin') . "/content/faqSearch");
Config::write('page.url.content.faq.detail', Config::read('url.admin') . "/content/faqDetail");
Config::write('page.url.content.faq.remove', Config::read('url.admin') . "/content/faqRemove");
Example #27
0
<?php

Config::write('Debug.level', 0);
Example #28
0
 function save_conf()
 {
     //错误信息
     $message = null;
     $form_index = IReq::get('form_index');
     switch ($form_index) {
         case "base_conf":
             if (isset($_FILES['logo']['name']) && $_FILES['logo']['name'] != '') {
                 $uploadObj = new PhotoUpload('image');
                 $uploadObj->setIterance(false);
                 $photoInfo = $uploadObj->run();
                 if (!isset($photoInfo['logo']['img']) || !file_exists($photoInfo['logo']['img'])) {
                     $message = 'logo图片上传失败';
                 } else {
                     unlink('image/logo.gif');
                     rename($photoInfo['logo']['img'], 'image/logo.gif');
                 }
             }
             break;
         case "index_slide":
             $config_slide = array();
             if (isset($_POST['slide_name'])) {
                 foreach ($_POST['slide_name'] as $key => $value) {
                     $config_slide[$key]['name'] = $value;
                     $config_slide[$key]['url'] = $_POST['slide_url'][$key];
                     $config_slide[$key]['img'] = $_POST['slide_img'][$key];
                 }
             }
             if (isset($_FILES['slide_pic'])) {
                 $uploadObj = new PhotoUpload();
                 $uploadObj->setIterance(false);
                 $slideInfo = $uploadObj->run();
                 if (isset($slideInfo['slide_pic']['flag'])) {
                     $slideInfo['slide_pic'] = array($slideInfo['slide_pic']);
                 }
                 if (isset($slideInfo['slide_pic'])) {
                     foreach ($slideInfo['slide_pic'] as $key => $value) {
                         if ($value['flag'] == 1) {
                             $config_slide[$key]['img'] = $value['img'];
                         }
                     }
                 }
             }
             $_POST = array('index_slide' => serialize($config_slide));
             break;
         case "guide_conf":
             $guideName = IFilter::act(IReq::get('guide_name'));
             $guideLink = IFilter::act(IReq::get('guide_link'));
             $data = array();
             $guideObj = new IModel('guide');
             if (!empty($guideName)) {
                 foreach ($guideName as $key => $val) {
                     if (!empty($val) && !empty($guideLink[$key])) {
                         $data[$key]['name'] = $val;
                         $data[$key]['link'] = $guideLink[$key];
                     }
                 }
             }
             //清空导航栏
             $guideObj->del('all');
             if (!empty($data)) {
                 //插入数据
                 foreach ($data as $order => $rs) {
                     $dataArray = array('order' => $order, 'name' => $rs['name'], 'link' => $rs['link']);
                     $guideObj->setData($dataArray);
                     $guideObj->add();
                 }
                 //跳转方法
                 $this->conf_base($form_index);
             }
             break;
         case "shopping_conf":
             break;
         case "show_conf":
             if (isset($_POST['auto_finish']) && $_POST['auto_finish'] == "") {
                 $_POST['auto_finish'] == "0";
             }
             break;
         case "image_conf":
             break;
         case "mail_conf":
             break;
         case "system_conf":
             break;
     }
     //获取输入的数据
     $inputArray = $_POST;
     if ($message == null) {
         if ($form_index == 'system_conf') {
             //写入的配置文件
             $configFile = IWeb::$app->config['basePath'] . 'config/config.php';
             config::edit($configFile, $inputArray);
         } else {
             $siteObj = new Config('site_config');
             $siteObj->write($inputArray);
         }
         //跳转方法
         $this->conf_base($form_index);
     } else {
         $inputArray['form_index'] = $form_index;
         $this->confRow = $inputArray;
         $this->redirect('conf_base', false);
         Util::showMessage($message);
     }
 }
Example #29
0
<?php

// Models
include_once "models/class.AccountModel.php";
// Views
include_once "views/class.AccountSearchView.php";
include_once "views/class.AccountDetailView.php";
// Controllers
include_once "controllers/class.Account.php";
// Pages URL's
Config::write('page.url.account.search', Config::read('url.admin') . "/account/search");
Config::write('page.url.account.detail', Config::read('url.admin') . "/account/detail");
Config::write('page.url.account.remove', Config::read('url.admin') . "/account/remove");
Example #30
0
        if (empty($value)) {
            $value = '';
        }
        if (!empty($params['type']) && 'checkbox' === $params['type']) {
            $tmpSet[$fname] = !empty($value) ? 1 : 0;
        } else {
            $tmpSet[$fname] = $value;
        }
    }
    if (!in_array($module, $noSub)) {
        $_tmpSet = $config;
        $_tmpSet[$module] = $tmpSet;
        $tmpSet = $_tmpSet;
    }
    //save settings
    Config::write($tmpSet);
    $_SESSION['message'] = __('Saved');
    //clean cache
    $Cache = new Cache();
    $Cache->clean(CACHE_MATCHING_ANY_TAG, array('module_' . $module));
    redirect('/admin/settings.php?m=' . $module);
}
// Build form for settings editor
$_config = in_array($module, $noSub) ? $config : $config[$module];
$output = '';
if (count($settingsInfo)) {
    foreach ($settingsInfo as $fname => $params) {
        if (is_string($params)) {
            //$output .= '<tr class="small"><td class="group" colspan="3">' . h($params) . '</td></tr>';
            $output .= '</div><div class="head"><div class="title">' . h($params) . '</div></div><div class="items">';
            continue;