Example #1
0
function get_prefs($nick)
{
    $prefs = load_settings(WEATHER_PREFS_FILE);
    if (isset($prefs[$nick]) == True) {
        return unserialize($prefs[$nick]);
    } else {
        return False;
    }
}
Example #2
0
	function __construct() {
		parent::__construct();
		if (file_exists(FCPATH . "config.php")) {
			$this->load->database();
			$this->load->library('session');
			$this->load->library('tank_auth');
			$this->load->library('datamapper');

			if (!$this->session->userdata('nation')) {
				// If the user doesn't have a nation set, let's grab it
				//
				require_once("assets/geolite/GeoIP.php");
				$gi = geoip_open("assets/geolite/GeoIP.dat", GEOIP_STANDARD);
				$remote_addr = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR']: '127.0.0.1';
				$nation = geoip_country_code_by_addr($gi, $remote_addr);
				geoip_close($gi);
				$this->session->set_userdata('nation', $nation);
			}
			
			// loads variables from database for get_setting()
			load_settings();
			
			$this->config->config['tank_auth']['allow_registration'] = !get_setting('fs_reg_disabled');

			$this->config->config['tank_auth']['email_activation'] = ((get_setting('fs_reg_email_disabled'))?FALSE:TRUE);
			
			$captcha_public = get_setting('fs_reg_recaptcha_public');
			if ($captcha_public != "") {
				$captcha_secret = get_setting('fs_reg_recaptcha_secret');
				if ($captcha_secret != "") {
					$this->config->config['tank_auth']['use_recaptcha'] = TRUE;
					$this->config->config['tank_auth']['recaptcha_public_key'] = $captcha_public;
					$this->config->config['tank_auth']['recaptcha_secret_key'] = $captcha_secret;
				}
			}
		}
	}
Example #3
0
//
// Compatibilité avec les version < 2.3.x
//
if (!defined('WA_ROOTDIR')) {
    if (!isset($waroot)) {
        exit("Le répertoire de Wanewsletter n'est pas défini!");
    }
    define('WA_ROOTDIR', rtrim($waroot, '/'));
}
$default_error_reporting = error_reporting(E_ALL);
require WA_ROOTDIR . '/start.php';
require WA_ROOTDIR . '/includes/functions.validate.php';
if (!empty($language) && validate_lang($language)) {
    load_settings(array('admin_lang' => $language));
} else {
    load_settings();
}
$action = !empty($_REQUEST['action']) ? trim($_REQUEST['action']) : '';
$email = !empty($_REQUEST['email']) ? trim($_REQUEST['email']) : '';
$format = isset($_REQUEST['format']) ? intval($_REQUEST['format']) : 0;
$liste = isset($_REQUEST['liste']) ? intval($_REQUEST['liste']) : 0;
$message = '';
$code = '';
if (empty($action) && preg_match('/([a-z0-9]{20})(?:&|$)/i', $_SERVER['QUERY_STRING'], $match)) {
    $code = $match[1];
} else {
    if (!empty($action) && !empty($email) && strlen($code) == 32) {
        $code = substr($code, 0, 20);
    }
}
if (!empty($action) || !empty($code)) {
} else {
    header("Location: login.php\n\n");
    exit;
}
// default settings loaded, may be overwritten when preferences get loaded
// to handle older .wfmrc files
$personal["language"] = $default_lang;
$personal["prev_size"] = $editor_prefs["preview_size"];
$personal["edit_col"] = $editor_prefs["cols"];
$personal["edit_row"] = $editor_prefs["rows"];
$personal["show_hidden"] = FALSE;
// load users theme if allow_custom setting is on
if ($allow_custom) {
    // load the .wfmrc file, then load the appropriate theme
    // overwrites default settings set earlier
    $personal = array_merge($personal, load_settings($fp, $default_theme, $def_Display_Hidden, $numeric_val));
    // if the user specified to start in a different dir from his home dir
    if (compat_array_key_exists("start_dir", $personal) && $personal["start_dir"] != "") {
        $location = "Location: crossover.php?SID=" . session_id() . "&submit=CD&CHDIR={$personal['start_dir']}" . $lang_loc;
    }
}
$theme = find_theme($fp, $personal, $default_theme);
// Following variables are stored in an array in the session in this order
// user - user who is logging in
// pass - users encrypted (if supported) password
// server - server connected too
// port - port connected on
// dir - current directory
// warn - warning messagez
// IP - remote IP address
// level - warning severity level
Example #5
0
 public function cron()
 {
     if ($this->tank_auth->is_admin()) {
         $last_check = get_setting('fs_cron_autoupgrade');
         // hourly cron
         if (time() - $last_check > 3600) {
             // update autoupgrade cron time
             $this->db->update('preferences', array('value' => time()), array('name' => 'fs_cron_autoupgrade'));
             // load model
             $this->load->model('upgrade_model');
             // check
             $versions = $this->upgrade_model->check_latest(TRUE);
             // if a version is outputted, save the new version number in database
             if ($versions[0]) {
                 $this->db->update('preferences', array('value' => $versions[0]->version . '.' . $versions[0]->subversion . '.' . $versions[0]->subsubversion), array('name' => 'fs_cron_autoupgrade_version'));
             }
             // remove one week old logs
             $files = glob($this->config->item('log_path') . 'log*.php');
             foreach ($files as $file) {
                 if (filemtime($file) < strtotime('-7 days')) {
                     unlink($file);
                 }
             }
             // reload the settings
             load_settings();
         }
     }
 }
Example #6
0
 * manager_menu.php
 *
 * This file handles the menu (left) pane of the Solid State Manager application.
 *
 * @package Pages
 * @author John Diamond <*****@*****.**>
 * @copyright John Diamond <*****@*****.**>
 * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
 */
// Load config file
require_once dirname(__FILE__) . "/../config/config.inc.php";
// Load SolidWorks
require_once dirname(__FILE__) . "/../solidworks/solidworks.php";
// Load settings from database
require_once dirname(__FILE__) . "/../util/settings.php";
load_settings($conf);
require_once dirname(__FILE__) . "/../include/SolidStateMenu.class.php";
// Set the current theme
$theme = isset($_SESSION['client']['userdbo']) ? $_SESSION['client']['userdbo']->getTheme() : $conf['themes']['manager'];
$conf['themes']['current'] = $theme;
// Load the user's language preference
session_start();
$language = isset($_SESSION['client']['userdbo']) ? $_SESSION['client']['userdbo']->getLanguage() : null;
if ($language != null) {
    TranslationParser::load("language/" . $language);
    Translator::getTranslator()->setActiveLanguage($language);
}
// Change the charset to UTF-8
header("Content-type: text/html; charset=utf-8");
// Build the core menu
$menu = SolidStateMenu::getSolidStateMenu();
Example #7
0
	function _submit($post) {
		$this->load->library('form_validation');
		$this->form_validation->set_rules('db_type', _('Database type'), '');
		$this->form_validation->set_rules('db_hostname', _('Database hostname'), '');
		$this->form_validation->set_rules('db_name', _('Database name'), '');
		$this->form_validation->set_rules('db_username', _('Database username'), '');
		$this->form_validation->set_rules('db_password', _('Database password'), '');
		$this->form_validation->set_rules('db_prefix', _('Database prefix'), '');
		$this->form_validation->set_rules('username', _('Administrator username'), 'required|min_length[4]|max_length[20]');
		$this->form_validation->set_rules('password', _('Administrator password'), 'required|min_length[5]|max_length[20]');
		$this->form_validation->set_rules('email', _('Administrator email'), 'required|valid_email');

		if ($this->form_validation->run() == FALSE) {
			return false;
		}

		if (!is_writable('content') && is_writable('content/themes')) {
			return false;
		}

		$config["hostname"] = $post["db_hostname"];
		$config["database"] = $post["db_name"];
		$config["username"] = $post["db_username"];
		$config["password"] = $post["db_password"];
		$config["dbprefix"] = $post["db_prefix"];
		$config['dbdriver'] = $post["db_type"];
		$config['pconnect'] = FALSE;
		$config['db_debug'] = FALSE;
		$config['cache_on'] = FALSE;
		$config['cachedir'] = "";
		$config['char_set'] = "utf8";
		$config['dbcollat'] = "utf8_general_ci";
		$this->db = $this->load->database($config, TRUE);
		if ($this->db->conn_id == "") {
			// unable to connect
			set_notice('error', _('Connection with database not enstabilished: check the database fields.'));
			return false;
		}

		$config = read_file('assets/config.sample.php');
		$config = str_replace("\$db['default']['dbdriver'] = ''", "\$db['default']['dbdriver'] = '" . addslashes($post["db_type"]) . "'", $config);
		$config = str_replace("\$db['default']['hostname'] = 'localhost'", "\$db['default']['hostname'] = '" . addslashes($post["db_hostname"]) . "'", $config);
		$config = str_replace("\$db['default']['username'] = ''", "\$db['default']['username'] = '******'", $config);
		$config = str_replace("\$db['default']['password'] = ''", "\$db['default']['password'] = '******'", $config);
		$config = str_replace("\$db['default']['database'] = ''", "\$db['default']['database'] = '" . addslashes($post["db_name"]) . "'", $config);
		$config = str_replace("\$db['default']['dbprefix'] = 'fs_'", "\$db['default']['dbprefix'] = '" . addslashes($post["db_prefix"]) . "'", $config);

		$random_string = random_string(20);
		$this->config->set_item('encryption_key', $random_string);
		$config = str_replace("\$config['encryption_key'] = ''", "\$config['encryption_key'] = '" . addslashes($random_string) . "'", $config);

		$manual_config = FALSE;
		if (!write_file('config.php', $config)) {
			$manual_config = TRUE;
		}

		$this->load->library('migration');
		$this->migration->latest();
		$this->load->library('session');
		$this->load->library('tank_auth');
		$this->load->library('datamapper');
		load_settings();

		$user = $this->tank_auth->create_user($post["username"], $post["email"], $post["password"], FALSE);
		if ($user !== FALSE) {
			$profile = new Profile();
			$profile->where('user_id', $user['user_id'])->get();
			$profile->group_id = 1;
			$profile->save();
		}

		if (!is_dir('content/ads'))
			mkdir('content/ads');
		if (!is_dir('content/cache'))
			mkdir('content/cache');
		if (!is_dir('content/logs'))
			mkdir('content/logs');
		if (!is_dir('content/comics'))
			mkdir('content/comics');

		if ($manual_config) {
			$this->notices = array();
			$data["config"] = $config;
			$this->viewdata['main_content_view'] = $this->load->view("install/manual_config", $data, TRUE);
			$this->load->view("admin/default", $this->viewdata);
			return 'stop';
		}

		flash_notice('notice', _('FoOlSlide has installed successfully. Check the preferences and make sure you create a team entry for your own chapters.'));
		redirect('/admin/');
	}
Example #8
0
 function _submit($post)
 {
     // validate the inputted data with the validation class
     $this->load->library('form_validation');
     $this->form_validation->set_rules('db_type', _('Database type'), '');
     $this->form_validation->set_rules('db_hostname', _('Database hostname'), '');
     $this->form_validation->set_rules('db_name', _('Database name'), '');
     $this->form_validation->set_rules('db_username', _('Database username'), '');
     $this->form_validation->set_rules('db_password', _('Database password'), '');
     $this->form_validation->set_rules('db_prefix', _('Database prefix'), '');
     $this->form_validation->set_rules('username', _('Administrator username'), 'required|min_length[4]|max_length[20]');
     $this->form_validation->set_rules('password', _('Administrator password'), 'required|min_length[5]|max_length[20]');
     $this->form_validation->set_rules('email', _('Administrator email'), 'required|valid_email');
     if ($this->form_validation->run() == FALSE) {
         return false;
     }
     if (!is_writable('content') && is_writable('content/themes')) {
         return false;
     }
     // we need to check database connection, and to do that we need to connect in first place
     $config["hostname"] = $post["db_hostname"];
     $config["database"] = $post["db_name"];
     $config["username"] = $post["db_username"];
     $config["password"] = $post["db_password"];
     $config["dbprefix"] = $post["db_prefix"];
     $config['dbdriver'] = $post["db_type"];
     $config['pconnect'] = FALSE;
     $config['db_debug'] = FALSE;
     $config['cache_on'] = FALSE;
     $config['cachedir'] = "";
     $config['char_set'] = "utf8";
     $config['dbcollat'] = "utf8_general_ci";
     // load the co
     $this->db = $this->load->database($config, TRUE);
     // without conn_id we're not connected to the database
     if ($this->db->conn_id == "") {
         // unable to connect
         set_notice('error', _('Connection with database not enstabilished: check the database fields.'));
         return false;
     }
     // pick the sample config and replace entries so we can insert the database
     $config = read_file('assets/config.sample.php');
     $config = str_replace("\$db['default']['dbdriver'] = ''", "\$db['default']['dbdriver'] = '" . addslashes($post["db_type"]) . "'", $config);
     $config = str_replace("\$db['default']['hostname'] = 'localhost'", "\$db['default']['hostname'] = '" . addslashes($post["db_hostname"]) . "'", $config);
     $config = str_replace("\$db['default']['username'] = ''", "\$db['default']['username'] = '******'", $config);
     $config = str_replace("\$db['default']['password'] = ''", "\$db['default']['password'] = '******'", $config);
     $config = str_replace("\$db['default']['database'] = ''", "\$db['default']['database'] = '" . addslashes($post["db_name"]) . "'", $config);
     $config = str_replace("\$db['default']['dbprefix'] = 'fs_'", "\$db['default']['dbprefix'] = '" . addslashes($post["db_prefix"]) . "'", $config);
     // create a random string of 20 letters and numbers for the encryption key
     $random_string = random_string(20);
     $this->config->set_item('encryption_key', $random_string);
     $config = str_replace("\$config['encryption_key'] = ''", "\$config['encryption_key'] = '" . addslashes($random_string) . "'", $config);
     // check if a manual config file must be made manually (due to no permissions on FoOlSlide root)
     $manual_config = FALSE;
     if (!write_file('config.php', $config)) {
         $manual_config = TRUE;
     }
     // load the necessary libraries
     // migrate to latest database
     $this->load->library('migration');
     $this->migration->latest();
     // load everything needed for a normal startup
     $this->load->library('session');
     $this->load->library('tank_auth');
     $this->load->library('datamapper');
     // load the settings from the now filled database
     load_settings();
     $user = $this->tank_auth->create_user($post["username"], $post["email"], $post["password"], FALSE);
     if ($user !== FALSE) {
         $profile = new Profile();
         $profile->where('user_id', $user['user_id'])->get();
         $profile->group_id = 1;
         $profile->save();
     }
     // create the generic dirs that you can find in content folder
     if (!is_dir('content/ads')) {
         mkdir('content/ads');
     }
     if (!is_dir('content/cache')) {
         mkdir('content/cache');
     }
     if (!is_dir('content/logs')) {
         mkdir('content/logs');
     }
     if (!is_dir('content/comics')) {
         mkdir('content/comics');
     }
     // if install can't make that config.php file, tell the user to do it manually
     if ($manual_config) {
         $this->notices = array();
         $data["config"] = $config;
         $this->viewdata['main_content_view'] = $this->load->view("install/manual_config", $data, TRUE);
         $this->load->view("install/default", $this->viewdata);
         return 'stop';
     }
     // a nice notice to tell that FoOlSlide install was a success
     flash_notice('notice', _('FoOlSlide has installed successfully. Check the preferences and make sure you create a team for your own chapters.'));
     redirect('/admin/');
 }
Example #9
0
<?php

// part of orsee. see orsee.org
$debug__script_started = microtime();
include "../config/settings.php";
include "../config/system.php";
include "../config/requires.php";
require_once "../utils/general.php";
require_once "../utils/connections.php";
$proceed = true;
if ($proceed) {
    site__database_config();
    $settings = load_settings();
    $settings['style'] = $settings['orsee_public_style'];
    $color = load_colors();
    session_set_save_handler("orsee_session_open", "orsee_session_close", "orsee_session_read", "orsee_session_write", "orsee_session_destroy", "orsee_session_gc");
    session_start();
    $_REQUEST = strip_tags_array($_REQUEST);
}
if ($proceed) {
    if ($settings['stop_public_site'] == "y" && !isset($expadmindata['adminname']) && !(thisdoc() == "disabled.php")) {
        redirect("public/disabled.php");
    }
}
if ($proceed) {
    // with token-only, do not allow access to these pages
    $token_exclude = array("participant_reset_pw.php", "participant_change_pw.php", "participant_login.php", "participant_login_mob.php");
    if ($settings['subject_authentication'] == 'token' && in_array(thisdoc(), $token_exclude)) {
        redirect("public/");
    }
}
Example #10
0
  revive the comment submission script with ability to reply to a cid (get corresponding sid from mysql)
*/
ini_set("display_errors", "on");
require_once "lib.php";
require_once "lib_mysql.php";
require_once "feeds_lib.php";
define("COMMENTS_CID_FILE", "../data/comments_cid.txt");
define("COMMENTS_TOP_FILE", "../data/comments_top.txt");
define("COMMENTS_FILTERS_FILE", "../data/comments_filters.txt");
define("COMMENTS_TABLE", "sn_comments");
define("MAIN_FEED_CHANNEL", "#comments");
$trailing = trim($argv[1]);
$dest = strtolower(trim($argv[2]));
$nick = strtolower(trim($argv[3]));
$alias = strtolower(trim($argv[4]));
$filters = load_settings(COMMENTS_FILTERS_FILE, " ");
if ($filters == False) {
    $filters = array();
}
if ($alias == "~comments") {
    $parts = explode(" ", $trailing);
    delete_empty_elements($parts);
    if (count($parts) == 0) {
        privmsg("  syntax: ~comments filter-add|filter-delete|filter-list");
        return;
    }
    $action = strtolower($parts[0]);
    array_shift($parts);
    $trailing = trim(implode(" ", $parts));
    switch ($action) {
        case "feed":
Example #11
0
exec:~!|10|0|0|1|*||||php scripts/link.php %%trailing%% %%dest%% %%nick%% %%alias%%
*/
#####################################################################################################
require_once "lib.php";
# TODO: do something similar to the github feed; output 6 and then make the last item something like "25 more not shown"
$trailing = trim($argv[1]);
$dest = $argv[2];
$nick = $argv[3];
$alias = $argv[4];
if ($trailing == "") {
    privmsg("syntax to search: {$alias} %search%, set: {$alias} %id% %content%, delete: {$alias} %id% -");
    privmsg("can't use pipe (|) char, %id% can't contain spaces, but %content% can, %search% is a regexp pattern");
    privmsg("will return a list of one or more %id% => %content% if %search% matches either %id% or %content%");
    return;
}
$list = load_settings(DATA_PATH . "links", "|");
ksort($list);
$parts = explode(" ", $trailing);
if (count($parts) >= 2) {
    if (count($parts) == 2 and $parts[1] == "-") {
        if (isset($list[$parts[0]]) == True) {
            unset($list[$parts[0]]);
            privmsg("  └─ deleted " . $parts[0]);
        } else {
            privmsg("  └─ " . $parts[0] . " not found");
        }
    } else {
        $id = $parts[0];
        array_shift($parts);
        $content = implode(" ", $parts);
        if (strpos($id, "|") === False and strpos($content, "|") === False) {
Example #12
0
function handle_macros($nick, $channel, $trailing)
{
    $reserved_triggers = array(".macro", ".macro-list");
    $reserved_commands = array("~restart-internal", "~q", "~ps", "~kill", "~killall", "~restart", "~rehash", "~dest-override", "~dest-clear", "~ignore", "~unignore", "~ignore-list", "~buckets-dump", "~eval", "~say", "~bucket", "~buckets-save", "~buckets-load", "~buckets-flush", "~buckets-list", "~exec-conflicts", "~exec-list", "~exec-timers", "~exec-errors", "~op", "~deop", "~voice", "~devoice", "~invite", "~kick", "~topic", "~exec-add", "~exec-del", "~exec-save", "<init>", "<quit>", "<startup>");
    $allowed = array("crutchy", "chromas", "TheMightyBuzzard", "Bytram", "arti", "paulej72", "mrcoolbp", "juggs");
    if ($nick == "" or $channel == "" or $trailing == "") {
        return;
    }
    if ($trailing == ".macro") {
        pm($channel, chr(3) . "02" . "  syntax to add: .macro <trigger> <chanlist> PRIVMSG|INTERNAL <command_template>");
        pm($channel, chr(3) . "02" . "  syntax to delete: .macro <trigger> -");
        #pm($channel,chr(3)."02"."  <chanlist> is comma-separated or * for any");
    }
    $macro_file = DATA_PATH . "exec_macros.txt";
    $macros = load_settings($macro_file, "=");
    if ($macros !== False and $trailing == ".macro-list") {
        foreach ($macros as $trigger => $data) {
            $data = unserialize($data);
            $cmd = "INTERNAL";
            if (isset($data["cmd"]) == True) {
                $cmd = $data["cmd"];
            }
            pm($channel, chr(3) . "13" . "  {$trigger} [" . $data["chanlist"] . "] {$cmd} " . $data["command"]);
        }
    }
    if ($macros === False) {
        $macros = array();
    }
    $parts = explode(" ", $trailing);
    delete_empty_elements($parts);
    if (count($parts) == 0) {
        return;
    }
    if (trim($parts[0]) == ".macro" and count($parts) > 2) {
        $account = users_get_account($nick);
        if (in_array($account, $allowed) == False) {
            return;
        }
        $trigger = trim($parts[1]);
        if (in_array($trigger, $reserved_triggers) == True) {
            privmsg(chr(3) . "02" . "  *** macro with trigger \"{$trigger}\" not permitted");
            return;
        }
        if (in_array($trigger, $reserved_commands) == True) {
            privmsg(chr(3) . "02" . "  *** macro with trigger \"{$trigger}\" not permitted");
            return;
        }
        $exec_list = unserialize(base64_decode(trim(get_bucket("<<EXEC_LIST>>"))));
        if (isset($exec_list[$trigger]) == True) {
            privmsg(chr(3) . "02" . "  *** error: macro with trigger that is the same as existing alias is not permitted");
            return;
        }
        $chanlist = trim($parts[2]);
        if ($chanlist == "-") {
            unset($macros[$trigger]);
            privmsg(chr(3) . "02" . "  *** macro with trigger \"{$trigger}\" deleted");
        } elseif (count($parts) >= 5) {
            array_shift($parts);
            array_shift($parts);
            array_shift($parts);
            $cmd = strtoupper(trim($parts[0]));
            if ($cmd != "PRIVMSG" and $cmd != "INTERNAL") {
                privmsg(chr(3) . "02" . "  *** error: invalid cmd (must be either INTERNAL or PRIVMSG)");
                return;
            }
            array_shift($parts);
            if (isset($macros[$parts[0]]) == True) {
                privmsg(chr(3) . "02" . "  *** error: triggering other macros is not permitted");
                return;
            }
            $command = implode(" ", $parts);
            for ($i = 0; $i < count($reserved_commands); $i++) {
                if (strtolower(substr($command, 0, strlen($reserved_commands[$i]))) == strtolower($reserved_commands[$i])) {
                    privmsg(chr(3) . "02" . "  *** macro with command \"{$command}\" not permitted");
                    return;
                }
            }
            $data = array();
            $data["chanlist"] = $chanlist;
            $data["command"] = $command;
            $data["cmd"] = $cmd;
            $macros[$trigger] = serialize($data);
            privmsg(chr(3) . "02" . "  *** macro with trigger \"{$trigger}\" and {$cmd} command template \"{$command}\" saved");
        }
        save_settings($macros, $macro_file, "=");
    } else {
        foreach ($macros as $trigger => $data) {
            if (trim($parts[0]) == $trigger) {
                $data = unserialize($data);
                if ($data["chanlist"] == "*" or in_array(strtolower($channel), explode(",", strtolower($data["chanlist"]))) == True) {
                    $account = users_get_account($nick);
                    if ($account != "") {
                        $cmd = "INTERNAL";
                        if (isset($data["cmd"]) == True) {
                            $cmd = $data["cmd"];
                        }
                        $trailing = trim(substr($trailing, strlen($trigger)));
                        # TODO: MAKE MORE TRAILING PARSING REPLACE ARGS
                        $command = str_replace("%%channel%%", $channel, $data["command"]);
                        $command = str_replace("%%nick%%", $nick, $command);
                        $command = str_replace("%%trailing%%", $trailing, $command);
                        echo "/IRC :" . get_bot_nick() . " {$cmd} {$channel} :{$command}\n";
                    }
                }
                return;
            }
        }
    }
}
Example #13
0
function change_settings($sender, $new_color)
{
    change_settings_from_db($sender, $new_color);
    load_settings($sender);
}
Example #14
0
/**
 * Save Settings
 *
 * Save the application settings to the database
 *
 * @param array $conf Configuration data
 */
function save_settings($conf)
{
    update_setting("company_name", $conf['company']['name']);
    update_setting("company_email", $conf['company']['email']);
    update_setting("company_notification_email", $conf['company']['notification_email']);
    update_setting("order_confirmation_subject", $conf['order']['confirmation_subject']);
    update_setting("order_confirmation_email", $conf['order']['confirmation_email']);
    update_setting("order_notification_subject", $conf['order']['notification_subject']);
    update_setting("order_notification_email", $conf['order']['notification_email']);
    update_setting("welcome_email", $conf['welcome_email']);
    update_setting("welcome_subject", $conf['welcome_subject']);
    update_setting("nameservers_ns1", $conf['dns']['nameservers'][0]);
    update_setting("nameservers_ns2", $conf['dns']['nameservers'][1]);
    update_setting("nameservers_ns3", $conf['dns']['nameservers'][2]);
    update_setting("nameservers_ns4", $conf['dns']['nameservers'][3]);
    update_setting("invoice_text", $conf['invoice_text']);
    update_setting("invoice_subject", $conf['invoice_subject']);
    update_setting("locale_currency_symbol", $conf['locale']['currency_symbol']);
    update_setting("locale_language", $conf['locale']['language']);
    update_setting("payment_gateway_default_module", $conf['payment_gateway']['default_module']);
    update_setting("payment_gateway_order_method", $conf['payment_gateway']['order_method']);
    update_setting("order_title", $conf['order']['title']);
    update_setting("order_accept_checks", $conf['order']['accept_checks'] ? "1" : "0");
    update_setting("order_tos_required", $conf['order']['tos_required'] ? "1" : "0");
    update_setting("order_tos_url", $conf['order']['tos_url']);
    update_setting("theme_manager", $conf['themes']['manager']);
    update_setting("theme_order", $conf['themes']['order']);
    // Reload
    load_settings($conf);
}
Example #15
0
            $settings['options_file_url'] = 'http://my.getbowtied.com/api/shopkeeper/theme_options/theme_options.json';
            $settings['theme_logo'] = get_template_directory_uri() . '/backend/img/shopkeeper.png';
            $settings['demo_image'] = get_template_directory_uri() . '/backend/img/demos/shopkeeper/default.png';
            break;
        case 'mr_tailor':
            $settings['theme_docs'] = 'http://support.getbowtied.com/hc/en-us/categories/200103142-Mr-Tailor';
            $settings['release_notes'] = 'http://support.getbowtied.com/hc/en-us/sections/200658372-Updates';
            $settings['purchase'] = 'http://themeforest.net/item/mr-tailor-responsive-woocommerce-theme/7292110?license=regular&open_purchase_for_item_id=7292110&purchasable=source';
            $settings['dummy_data_preview'] = 'http://mr-tailor.getbowtied.com/blank-v2/';
            $settings['demo_xml_file_url'] = 'http://my.getbowtied.com/api/mr_tailor/demos/demo.gz';
            $settings['options_file_url'] = 'http://my.getbowtied.com/api/mr_tailor/theme_options/theme_options.json';
            $settings['theme_logo'] = get_template_directory_uri() . '/backend/img/mr_tailor.png';
            $settings['demo_image'] = get_template_directory_uri() . '/backend/img/demos/mr_tailor/default.png';
            break;
        case 'the_retailer':
            $settings['theme_docs'] = 'http://support.getbowtied.com/hc/en-us/categories/200102021-The-Retailer';
            $settings['release_notes'] = 'http://support.getbowtied.com/hc/en-us/sections/200649072-Updates';
            $settings['purchase'] = 'http://themeforest.net/item/the-retailer-responsive-wordpress-theme/4287447?license=regular&open_purchase_for_item_id=4287447&purchasable=source&ref=getbowtied';
            $settings['dummy_data_preview'] = 'http://import.getbowtied.com/the-retailer-v1.1/';
            $settings['demo_xml_file_url'] = 'http://my.getbowtied.com/api/the_retailer/demos/demo.gz';
            $settings['options_file_url'] = 'http://my.getbowtied.com/api/the_retailer/theme_options/theme_options.txt';
            $settings['theme_logo'] = get_template_directory_uri() . '/backend/img/the_retailer.png';
            $settings['demo_image'] = get_template_directory_uri() . '/backend/img/demos/the_retailer/default.png';
            break;
        default:
            break;
    }
    return $settings;
}
$getbowtied_settings = load_settings(THEME_SLUG);
Example #16
0
            $mode = 'login';
        } else {
            $abodata = check_login($data['email'], $data['key']);
            if (!is_array($abodata)) {
                $mode = 'login';
            }
        }
    } else {
        $mode = 'login';
    }
}
//
// Fin de la vérification
//
$language = $mode == 'login' || $mode == 'sendkey' ? $nl_config['language'] : $abodata['language'];
load_settings(array('admin_lang' => $language));
switch ($mode) {
    case 'login':
        if (isset($_POST['submit'])) {
            $regkey = !empty($_POST['passwd']) ? trim($_POST['passwd']) : '';
            $regkey_md5 = md5($regkey);
            if (!empty($regkey) && validate_pass($regkey) && ($abodata = check_login($email, $regkey_md5))) {
                if ($abodata['status'] == ABO_ACTIF) {
                    $session->send_cookie('abo', serialize(array('email' => $abodata['email'], 'key' => $regkey_md5)), time() + 3600);
                    Location('profil_cp.php');
                }
                $output->message('Inactive_account');
            } else {
                $error = TRUE;
                $msg_error[] = $lang['Message']['Error_login'];
            }
Example #17
0
 function balancers()
 {
     if ($this->input->post()) {
         $result = array();
         if ($urls = $this->input->post('url')) {
             $priorities = $this->input->post('priority');
             if (is_array($urls)) {
                 foreach ($urls as $key => $item) {
                     if (!$item) {
                         unset($urls[$key]);
                         break;
                     }
                     if ($priorities[$key] >= 0 && $priorities[$key] <= 100) {
                         $result[] = array('url' => $item, 'priority' => $priorities[$key]);
                     }
                 }
             }
             $result = serialize($result);
             $this->db->from('preferences');
             $this->db->where(array('name' => 'fs_balancer_clients'));
             if ($this->db->count_all_results() == 1) {
                 $this->db->update('preferences', array('value' => $result), array('name' => 'fs_balancer_clients'));
             } else {
                 $this->db->insert('preferences', array('name' => 'fs_balancer_clients', 'value' => $result));
             }
         }
         if ($value = $this->input->post('fs_balancer_ips')) {
             if (is_array($value)) {
                 foreach ($value as $key => $val) {
                     if ($value[$key] == "") {
                         unset($value[$key]);
                     }
                 }
                 $value = serialize($value);
             }
             $this->db->from('preferences');
             $this->db->where(array('name' => 'fs_balancer_ips'));
             if ($this->db->count_all_results() == 1) {
                 $this->db->update('preferences', array('value' => $value), array('name' => 'fs_balancer_ips'));
             } else {
                 $this->db->insert('preferences', array('name' => 'fs_balancer_ips', 'value' => $value));
             }
         }
         load_settings();
         set_notice('notice', _('Updated settings.'));
     }
     if (get_setting('fs_balancer_clients')) {
         $data["balancers"] = unserialize(get_setting('fs_balancer_clients'));
     } else {
         $data["balancers"] = array();
     }
     if (get_setting('fs_balancer_ips')) {
         $data["ips"] = unserialize(get_setting('fs_balancer_ips'));
     } else {
         $data["ips"] = array();
     }
     $this->viewdata['function_title'] = _('Balancers');
     $this->viewdata["main_content_view"] = $this->load->view("admin/loadbalancer/balancers_list.php", $data, TRUE);
     $this->load->view("admin/default.php", $this->viewdata);
 }
Example #18
0
 function __construct()
 {
     parent::__construct();
     if (!file_exists(FCPATH . "config.php")) {
         if ($this->uri->segment(1) != "install") {
             show_error("If you are here, and have no clue why FoOlSlide is not working, start by reading the <a href='http://trac.foolrulez.com/foolslide/wiki/installation_guide'>installation manual</a>.");
         }
     } else {
         $this->load->database();
         $this->load->library('session');
         $this->load->library('datamapper');
         $this->load->library('tank_auth');
         // loads variables from database for get_setting()
         load_settings();
         // create an array for the set_notice system
         $this->notices = array();
         $this->flash_notice_data = array();
         // This is the first chance we get to load the right translation file
         if (get_setting('fs_gen_lang')) {
             $locale = get_setting('fs_gen_lang');
             putenv("LANG={$locale}");
             if ($locale != "tr_TR.utf8") {
                 setlocale(LC_ALL, $locale);
             } else {
                 setlocale(LC_COLLATE, $locale);
                 setlocale(LC_MONETARY, $locale);
                 setlocale(LC_NUMERIC, $locale);
                 setlocale(LC_TIME, $locale);
                 setlocale(LC_MESSAGES, $locale);
                 setlocale(LC_CTYPE, "sk_SK.utf8");
             }
             bindtextdomain(substr($locale, 0, 5), FCPATH . "assets/locale");
             textdomain(substr($locale, 0, 5));
         }
         // set the nationality where possible, and leave ignored ips without a nation
         $ignored_ips = array();
         if (get_setting('fs_balancer_ips')) {
             $ignored_ips = @unserialize(get_setting('fs_balancer_ips'));
         }
         $ignored_ips[] = '127.0.0.1';
         $remote_addr = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1';
         if ($this->session->userdata('nation') !== FALSE || !in_array($remote_addr, $ignored_ips)) {
             // If the user doesn't have a nation set, let's grab it
             require_once "assets/geolite/GeoIP.php";
             $gi = geoip_open("assets/geolite/GeoIP.dat", GEOIP_STANDARD);
             $nation = geoip_country_code_by_addr($gi, $remote_addr);
             geoip_close($gi);
             $this->session->set_userdata('nation', $nation);
         } else {
             if ($this->session->userdata('nation')) {
                 $this->session->set_userdata('nation', '');
             }
         }
         // a good time to change some of the defauly settings dynamically
         $this->config->config['tank_auth']['allow_registration'] = !get_setting('fs_reg_disabled');
         $this->config->config['tank_auth']['email_activation'] = get_setting('fs_reg_email_disabled') ? FALSE : TRUE;
         $captcha_public = get_setting('fs_reg_recaptcha_public');
         if ($captcha_public != "") {
             $captcha_secret = get_setting('fs_reg_recaptcha_secret');
             if ($captcha_secret != "") {
                 $this->config->config['tank_auth']['use_recaptcha'] = TRUE;
                 $this->config->config['tank_auth']['recaptcha_public_key'] = $captcha_public;
                 $this->config->config['tank_auth']['recaptcha_secret_key'] = $captcha_secret;
             }
         }
     }
 }
Example #19
0
$alias = $argv[1];
$trailing = trim($argv[2]);
$nick = trim($argv[3]);
switch ($alias) {
    case "~weather-prefs":
        # TODO: registered nick personalised settings (units, default location, private msg, formatting, etc)
        if ($trailing == "") {
            privmsg("syntax: ~weather-prefs unit metric|imperial|both");
            return;
        }
        $parts = explode(" ", $trailing);
        delete_empty_elements($parts);
        $pref = $parts[0];
        array_shift($parts);
        $trailing = trim(implode(" ", $parts));
        $prefs = load_settings(WEATHER_PREFS_FILE);
        if ($prefs === False) {
            $prefs = array();
        }
        if (isset($prefs[$nick]) == True) {
            $nick_prefs = unserialize($prefs[$nick]);
        }
        $nick_prefs[$pref] = $trailing;
        $prefs[$nick] = serialize($nick_prefs);
        if (save_settings($prefs, WEATHER_PREFS_FILE) == True) {
            privmsg("  successfully saved prefs");
        }
        break;
    case "~weather-del":
        if (del_location($trailing) == True) {
            privmsg("location \"{$trailing}\" deleted");
Example #20
0
	public function cron() {
		if ($this->tank_auth->is_admin()) {
			$last_check = get_setting('fs_cron_autoupgrade');

			// check for updates hourly
			if (time() - $last_check > 3600) {
				$this->db->update('preferences', array('value' => time()), array('name' => 'fs_cron_autoupgrade'));
				$this->load->model('upgrade_model');
				$versions = $this->upgrade_model->check_latest(TRUE);
				if ($versions[0]) {
					$this->db->update('preferences', array('value' => $versions[0]->version . '.' . $versions[0]->subversion . '.' . $versions[0]->subsubversion), array('name' => 'fs_cron_autoupgrade_version'));
				}
			}

			load_settings();
		}
	}
Example #21
0
if (!defined('IN_NEWSLETTER')) {
    exit('<b>No hacking</b>');
}
define('IN_ADMIN', true);
define('WA_ROOTDIR', '..');
$secure = TRUE;
require WA_ROOTDIR . '/start.php';
require WA_ROOTDIR . '/includes/class.sessions.php';
require WA_ROOTDIR . '/includes/class.auth.php';
$liste = !empty($_REQUEST['liste']) ? intval($_REQUEST['liste']) : 0;
//
//// Start session and load settings
//
$session = new Session();
$admindata = $session->check($liste);
load_settings($admindata);
//
//// End
//
if (!defined('IN_LOGIN')) {
    if (!$admindata) {
        $redirect = '?redirect=' . basename(server_info('PHP_SELF'));
        $redirect .= server_info('QUERY_STRING') != '' ? rawurlencode('?' . server_info('QUERY_STRING')) : '';
        Location('login.php' . $redirect);
    }
    $auth = new Auth();
    //
    // Si la liste en session n'existe pas, on met à jour la session
    //
    if (!isset($auth->listdata[$admindata['session_liste']])) {
        $admindata['session_liste'] = 0;