コード例 #1
0
 public function __construct()
 {
     parent::__construct();
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $a_pref = $prefs->get('UserGroupDB', 'activedirectory');
     if (is_array($a_pref)) {
         foreach ($a_pref as $k => $v) {
             $this->preferences[$k] = $v;
         }
     }
     // Generate parent (ldap) settings
     $this->preferences['filter'] = '(objectClass=group)';
     $this->preferences['match'] = array('name' => 'name', 'description' => 'description');
     $this->preferences['group_match_user'] = array('user_field', 'group_field');
     $this->preferences['user_field'] = 'memberOf';
     $this->preferences['user_field_type'] = 'group_dn';
     $this->preferences['group_field'] = 'member';
     $this->preferences['group_field_type'] = 'user_dn';
     $this->preferences['ou'] = '';
     if (array_key_exists('use_child_group', $this->preferences)) {
         if (in_array($this->preferences['use_child_group'], array(1, '1'))) {
             $this->preferences['user_field'] .= ':1.2.840.113556.1.4.1941:';
             $this->preferences['group_field'] .= ':1.2.840.113556.1.4.1941:';
         }
     }
 }
コード例 #2
0
function __autoload($class_name)
{
    //what about NameSpaces ?
    $class_files = array();
    if (!class_exists($class_name)) {
        $class_files[] = PREMIUM_CLASSES_DIR . '/' . $class_name . '.class.php';
        $class_files[] = CLASSES_DIR . '/' . $class_name . '.class.php';
        $class_files[] = CLASSES_DIR . '/configelements/' . $class_name . '.class.php';
        $class_files[] = CLASSES_DIR . '/events/' . $class_name . '.class.php';
        $class_files[] = EVENTS_DIR . '/' . $class_name . '.class.php';
        $class_files[] = CLASSES_DIR . '/tasks/' . $class_name . '.class.php';
        $class_files[] = MODULES_DIR . '/' . $class_name . '.php';
        $class_files[] = ABSTRACT_CLASSES_DIR . '/' . $class_name . '.class.php';
        $class_files[] = ABSTRACT_CLASSES_DIR . '/liaison/' . $class_name . '.class.php';
        $class_files[] = ADMIN_CLASSES_DIR . '/' . $class_name . '.class.php';
        $class_files[] = MODULES_DIR . '/' . preg_replace('/_/', '/', $class_name, 1) . '.php';
        foreach ($class_files as $class_file) {
            if (file_exists($class_file)) {
                require_once $class_file;
                return;
            }
        }
        if (isset($autoload_die) && $autoload_die === true) {
            die_error('Class \'' . $class_name . '\' not found', __FILE__, __LINE__);
        }
    }
}
コード例 #3
0
ファイル: Admin.php プロジェクト: Orelab/election-libre
 public function invitation()
 {
     $id = $this->input->post('id', true);
     if (!is_numeric($id)) {
         die_error($id . ' : bad identifier.');
     }
     // ...
     die($id . ' not invited.');
 }
コード例 #4
0
ファイル: ldap.php プロジェクト: bloveing/openulteo
 public function __construct()
 {
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $this->config = $prefs->get('UserDB', 'ldap');
     $this->cache_users = array();
 }
コード例 #5
0
ファイル: sql_external.php プロジェクト: skdong/nfs-ovd
 public function __construct()
 {
     $prefs = Preferences::getInstance();
     if ($prefs) {
         $this->config = $prefs->get('UserGroupDB', 'sql_external');
     } else {
         die_error('USERGROUPDB::MYSQL_external::construct get Prefs failed', __FILE__, __LINE__);
     }
 }
コード例 #6
0
ファイル: mail.inc.php プロジェクト: bloveing/openulteo
function send_alert_mail($subject_, $message_)
{
    $prefs = Preferences::getInstance();
    if (!$prefs) {
        die_error('get Preferences failed', __FILE__, __LINE__);
    }
    $tos = $prefs->get('events', 'mail_to');
    foreach ($tos as $to) {
        sendamail($to, $subject_, $message_);
    }
}
コード例 #7
0
ファイル: ldap.php プロジェクト: bloveing/openulteo
 public function __construct()
 {
     $this->cache_import = array();
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $a_pref = $prefs->get('UserGroupDB', 'ldap');
     if (is_array($a_pref)) {
         $this->preferences = $a_pref;
     } else {
         // ugly...
         $this->preferences = array();
     }
 }
コード例 #8
0
ファイル: activedirectory.php プロジェクト: skdong/nfs-ovd
 public function makeLDAPconfig($config_ = NULL)
 {
     if ($config_ != NULL) {
         $config = $config_;
     } else {
         $config = $this->config_ad;
     }
     $ldap_suffix = domain2suffix($config['domain']);
     if (!$ldap_suffix) {
         die_error('Active Directory configuration not valid (domain2suffix error)2', __FILE__, __LINE__);
     }
     $match_minimal = array('login' => 'sAMAccountName', 'displayname' => 'displayName', 'real_login' => 'sAMAccountName', 'countrycode' => 'c', 'objectclass' => 'objectClass');
     $config_ldap = array('hosts' => $config['hosts'], 'suffix' => $ldap_suffix, 'login' => $config['login'] . '@' . $config['domain'], 'password' => $config['password'], 'port' => '389', 'options' => array('LDAP_OPT_PROTOCOL_VERSION' => '3', 'LDAP_OPT_REFERRALS' => 0), 'filter' => '(&(objectCategory=person)(objectClass=user))', 'match' => array_merge($match_minimal, $config['match']));
     return $config_ldap;
 }
コード例 #9
0
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             die_error('get Preferences failed', __FILE__, __LINE__);
         }
         $enabled_modules = $prefs->get('general', 'module_enable');
         if (!in_array('SessionManagement', $enabled_modules)) {
             die_error('SessionManagement module must be enabled', __FILE__, __LINE__);
         }
         $SessionManagement_module_name = 'SessionManagement_' . $prefs->get('SessionManagement', 'enable');
         self::$instance = new $SessionManagement_module_name();
     }
     return self::$instance;
 }
コード例 #10
0
ファイル: UserDB.php プロジェクト: bloveing/openulteo
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             die_error('get Preferences failed', __FILE__, __LINE__);
         }
         $mods_enable = $prefs->get('general', 'module_enable');
         if (!in_array('UserDB', $mods_enable)) {
             die_error(_('UserDB module must be enabled'), __FILE__, __LINE__);
         }
         $mod_app_name = 'UserDB_' . $prefs->get('UserDB', 'enable');
         self::$instance = new $mod_app_name();
     }
     return self::$instance;
 }
コード例 #11
0
ファイル: User.class.php プロジェクト: bloveing/openulteo
 public function getLocale()
 {
     if ($this->hasAttribute('countrycode')) {
         $language = $this->getAttribute('countrycode');
         // only works for ISO-3166
     } else {
         $prefs = Preferences::getInstance();
         if (!$prefs) {
             die_error('get Preferences failed', __FILE__, __LINE__);
         }
         $default_settings = $prefs->get('general', 'session_settings_defaults');
         $language = $default_settings['language'];
     }
     $locale = locale2unix($language);
     return $locale;
 }
コード例 #12
0
function __autoload($class_name)
{
    //what about NameSpaces ?
    $class_files = array();
    if (!class_exists($class_name)) {
        $class_files[] = CLASSES_DIR . '/' . $class_name . '.class.php';
        foreach ($class_files as $class_file) {
            if (file_exists($class_file)) {
                require_once $class_file;
                return;
            }
        }
        if (isset($autoload_die) && $autoload_die === true) {
            die_error('Class \'' . $class_name . '\' not found', __FILE__, __LINE__);
        }
    }
}
コード例 #13
0
 public function __construct($id_, $name_, $description_, $url_)
 {
     Logger::debug('main', "Application_weblink::construct('{$id_}','{$name_}','{$description_}','{$url_}')");
     parent::__construct($id_, $name_, $description_, 'weblink', $url_, NULL, NULL, NULL, true, $name_ . '.weblink');
     // executable_path <=> url;
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $mods_enable = $prefs->get('general', 'module_enable');
     if (!in_array('ApplicationDB', $mods_enable)) {
         die_error('Module ApplicationDB must be enabled', __FILE__, __LINE__);
     }
     $default_browser = $prefs->get('general', 'default_browser');
     if (!is_array($default_browser)) {
         Logger::error('main', 'Application_weblink::construct failed to get default_browser preferences');
     }
     $this->default_browser = $default_browser;
 }
コード例 #14
0
ファイル: Help.php プロジェクト: Auwibana/babesk
 public function execute($dataContainer)
 {
     defined('_AEXEC') or die("Access denied");
     require_once 'AdminHelpProcessing.php';
     require_once 'AdminHelpInterface.php';
     require_once PATH_ACCESS . '/GlobalSettingsManager.php';
     $gbManager = new GlobalSettingsManager();
     $helpInterface = new AdminHelpInterface($this->relPath);
     $helpProcessing = new AdminHelpProcessing($helpInterface);
     if ('POST' == $_SERVER['REQUEST_METHOD']) {
         try {
             switch ($_GET['action']) {
                 case 1:
                     //show the Help-Text
                     try {
                         $helptext = $gbManager->getHelpText();
                     } catch (MySQLVoidDataException $e) {
                         $helptext = '&nbsp;';
                     }
                     $helpInterface->ShowHelp($helptext);
                     break;
                 case 2:
                     //edit the Help-Text
                     if (isset($_POST['helptext'])) {
                         $helpProcessing->change_help($_POST['helptext']);
                     } else {
                         try {
                             $helptext = $gbManager->getHelpText();
                         } catch (MySQLVoidDataException $e) {
                             $helptext = '&nbsp;';
                         }
                         $helpInterface->EditHelp($helptext);
                     }
                     break;
             }
         } catch (Exception $e) {
             die_error($e->getMessage());
         }
     } else {
         $helpInterface->IndexMenu();
     }
 }
コード例 #15
0
 public function __construct($id_, $application_id, $url_prefix, $raw_configuration, $values)
 {
     Logger::debug('api', "Application_webapp_configuration::construct('{$id_}','{$application_id}','{$url_prefix}','{$raw_configuration}','{$values}')");
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $mods_enable = $prefs->get('general', 'module_enable');
     if (!in_array('ApplicationDB', $mods_enable)) {
         die_error('Module ApplicationDB must be enabled', __FILE__, __LINE__);
     }
     if (!in_array('WebAppConfDB', $mods_enable)) {
         die_error('Module WebAppConfDB must be enabled', __FILE__, __LINE__);
     }
     $this->attributes = array();
     $this->attributes['id'] = $id_;
     $this->attributes['application_id'] = $application_id;
     $this->attributes['url_prefix'] = $url_prefix;
     $this->attributes['raw_configuration'] = $raw_configuration;
     $this->attributes['values'] = $values;
 }
コード例 #16
0
 public function __construct($login_, $password_, $ssl_ = true)
 {
     if (defined('DEBUG_MODE') && DEBUG_MODE === true) {
         ini_set('soap.wsdl_cache_enabled', 0);
     }
     $xff = $_SERVER['REMOTE_ADDR'];
     $headers = apache_request_headers();
     foreach ($headers as $k => $v) {
         // Internet explorer send http headers in lower cases...
         $k = strtolower($k);
         if ($k == 'x-forwarded-for') {
             $xff = $v . ', ' . $_SERVER['REMOTE_ADDR'];
         }
     }
     try {
         $this->service = new SoapClient(ADMIN_ROOT . '/includes/ovd-admin.wsdl', array('login' => $login_, 'password' => $password_, 'location' => ($ssl_ ? 'https' : 'http') . '://' . SESSIONMANAGER_HOST . '/ovd/service/admin', 'stream_context' => stream_context_create(array('http' => array('header' => 'X-Forwarded-For: ' . $xff)))));
     } catch (Exception $e) {
         die_error(self::format_soap_error_message($e));
         throw $e;
     }
 }
コード例 #17
0
ファイル: Server_Logs.class.php プロジェクト: skdong/nfs-ovd
 public function __construct($server_)
 {
     // 		Logger::debug('main', 'Starting Server_Logs::__construct for \''.$server_->fqdn.'\'');
     if (!check_folder(SESSIONMANAGER_SPOOL . '/cache/logs')) {
         Logger::error('main', 'Server_Logs::__construct Unable to create global logs cache folder');
         die_error(SESSIONMANAGER_SPOOL . '/cache/logs does not exist and cannot be created!', __FILE__, __LINE__);
     }
     $this->server = $server_;
     $this->logsdir = SESSIONMANAGER_SPOOL . '/cache/logs/' . $this->server->fqdn;
     if (!check_folder($this->logsdir)) {
         Logger::error('main', 'Server_Logs::__construct Unable to create logs cache folder for server \'' . $this->server->fqdn . '\'');
         die_error($this->logsdir . ' does not exist and cannot be created!', __FILE__, __LINE__);
     }
     $this->since = @file_get_contents($this->logsdir . '/since');
     if (!$this->since) {
         $this->since = 0;
     }
     $this->last = @file_get_contents($this->logsdir . '/last');
     if (!$this->last) {
         $this->last = 0;
     }
 }
コード例 #18
0
ファイル: login.php プロジェクト: bloveing/openulteo
function adminAuthenticate($login_, $password_)
{
    if (array_key_exists('no_ssl', $_SESSION)) {
        unset($_SESSION['no_ssl']);
    }
    try {
        $service = new SessionManager($login_, $password_, true);
        $ret = $service->test_link_connected();
    } catch (Exception $e) {
        if ($e->faultcode == 'auth_failed') {
            $_SESSION['admin_error'] = _('There was an error with your authentication');
            return false;
        }
        if (defined('DEBUG_MODE') && DEBUG_MODE === true) {
            popup_error('Unable to login the Session Manager using HTTPS method, retry with HTTP');
        }
        try {
            $service = new SessionManager($login_, $password_, false);
            $ret = $service->test_link_connected();
        } catch (Exception $e) {
            if ($e->faultcode == 'auth_failed') {
                $_SESSION['admin_error'] = _('There was an error with your authentication');
                return false;
            }
            if (defined('DEBUG_MODE') && DEBUG_MODE === true) {
                popup_error($service->format_soap_error_message($e));
            }
            die_error(_('Unable to initialize communication with Session Manager'));
        }
        $_SESSION['no_ssl'] = true;
        if (defined('DEBUG_MODE') && DEBUG_MODE === true) {
            popup_info('Succefully connected the Session Manager using HTTP method, will alwais use HTTP for this session');
        }
    }
    $_SESSION['admin_login'] = $login_;
    $_SESSION['admin_password'] = $password_;
    $_SESSION['service'] = $service;
    return true;
}
コード例 #19
0
ファイル: misc_helper.php プロジェクト: Orelab/election-libre
 function sendmail($data)
 {
     // formating email
     $sys_name = 'Election Libre';
     $sys_address = '*****@*****.**';
     if (!is_array($data)) {
         die_error('Bad datatype.');
     }
     if (!isset($data['subject']) or !isset($data['message']) or !isset($data['toEmail'])) {
         die_error('Incomplete mail information.');
     }
     $CI =& get_instance();
     $CI->load->library('email');
     $CI->email->subject($data['subject']);
     $CI->email->message($data['message']);
     if (isset($data['fromEmail'])) {
         $reply_to = $data['fromEmail'];
     } else {
         $reply_to = $sys_address;
     }
     if (isset($data['fromName'])) {
         $CI->email->from($sys_address, $data['fromName']);
     } else {
         $CI->email->from($sys_address, $sys_name);
     }
     if (isset($data['fromBusiness'])) {
         $CI->email->reply_to($reply_to, $data['fromBusiness']);
     } else {
         $CI->email->reply_to($reply_to);
     }
     if (isset($data['toName'])) {
         $CI->email->to($data['toEmail'], $data['toName']);
     } else {
         $CI->email->to($data['toEmail']);
     }
     // Sending email
     return $CI->email->send() ? true : $CI->email->print_debugger();
 }
コード例 #20
0
ファイル: Misc.php プロジェクト: Orelab/election-libre
 public function csv2json()
 {
     //-- Security
     $this->Security_model->log('csv to json', 1);
     //-- Conversion
     $this->load->helper(array('form', 'url'));
     $this->load->library('upload');
     if ($this->upload->do_upload('elector_list')) {
         $fileinfo = $this->upload->data();
     } else {
         die_error($this->upload->display_errors());
     }
     if ($fileinfo['file_type'] != 'text/plain') {
         die_error('file_type');
     }
     if ($fileinfo['file_ext'] != '.csv') {
         die_error('file_extension');
     }
     $data = array_map("str_getcsv", file($fileinfo['full_path']));
     unlink($fileinfo['full_path']);
     if (!is_array($data)) {
         die_error('corrupted_data');
     }
     if (count($data) < 1) {
         die_error('empty file.');
     }
     if (count($data[0]) < 3) {
         die_error('missing_titles');
     }
     if (implode($data[0]) == "prenomnomadresse email") {
         array_shift($data);
     }
     foreach ($data as &$d) {
         $d[] = filter_var($d[2], FILTER_VALIDATE_EMAIL) ? true : false;
     }
     die(json_encode($data));
 }
コード例 #21
0
ファイル: Script.class.php プロジェクト: bloveing/openulteo
 public function usersGroups()
 {
     Logger::debug('main', 'Script::usersGroups');
     $userGroupDB = UserGroupDB::getInstance();
     $result = array();
     // add the default user group is enable
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         Logger::critical('main', 'Script::usersGroups get prefs failed');
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $liaison = Abstract_Liaison::load('Scripts', $this->getAttribute('name'), NULL);
     if (is_null($liaison)) {
         Logger::error('main', 'Script::usersGroups load(' . $this->getAttribute('name') . ') is null');
         return $result;
     }
     foreach ($liaison as $row) {
         $g = $userGroupDB->import($row->group);
         if (is_object($g)) {
             $result[] = $g;
         }
     }
     return $result;
 }
コード例 #22
0
    $cmd_clear = "zmprov sm {$zimbra_account} emptyFolder '/{$zimbra_folder}'";
    $cmd_fill = "curl -Ss -k -u '{$zimbra_username}:{$zimbra_password}' -T /tmp/SugarCRMContacts.csv '{$zimbra_url}/zimbra/home/" . urlencode("{$zimbra_account}") . '/' . urlencode("{$zimbra_folder}") . "?fmt=csv'";
    if ($DEBUG) {
        echo "===== DEBUG MODE IS ON - not changing data, just printing out the commands =====\n";
        echo "=> {$msg_clear}: {$cmd_clear}\n";
        echo "=> {$msg_fill}: {$cmd_fill}\n";
    } else {
        echo "=> {$msg_clear}\n";
        exec($cmd_clear, $output, $ret);
        if ($ret) {
            die_error("Command failed: {$cmd_clear}\n" . print_r($output, true) . "\nexitcode {$ret}");
        }
        echo "=> {$msg_fill}\n";
        // curl is pretty lame. it might exit(0) even though the server gave http 400, luckily we can parse the output
        exec($cmd_fill, $output);
        $output = implode($output, "\n");
        if (stripos($output, 'error') !== false) {
            die_error($output);
        }
    }
    echo "=> Done!\n";
} catch (SoapFault $soapFault) {
    die_error("Second connection" . var_export($soapFault, true));
}
function my_replace($data)
{
    $data = str_replace("&amp;", "&", $data);
    $data = str_replace("&#039;", "'", $data);
    return $data;
}
unset($soapClient);
コード例 #23
0
 public function isDefault()
 {
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         Logger::critical('main', 'USERSGROUP::isDefault get prefs failed');
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $user_default_group = $prefs->get('general', 'user_default_group');
     return $user_default_group === $this->getUniqueID();
 }
コード例 #24
0
require_once '../config.php';
$errorRedir = ROOT;
$successRedir = ROOT;
$db = db_connect();
$loggedIn = check_login($db);
if (!$loggedIn) {
    $db->close();
    header('Location: login.php');
    exit;
}
//Authenticated, so now check params
if (!isset($_POST['id']) || !$_POST['id'] || count(trim($_POST['id'])) < 1) {
    die_error($errorRedir, 'Missing controller ID.');
}
$id = trim($_POST['id']);
if (!isset($_POST['field']) || !$_POST['field'] || count($_POST['field']) < 1) {
    die_error($errorRedir, 'Missing settings field.');
}
$field = trim($_POST['field']);
if (!isset($_POST['value']) || count($_POST['value']) < 1) {
    die_error($errorRedir, 'Missing settings value.');
}
$value = trim($_POST['value']);
//Params looks good, so lets attempt the update in one go because f**k it
$update_sql = sprintf("UPDATE `settings` SET `%s` = '%s' WHERE `id` = %d ", $db->real_escape_string($field), $db->real_escape_string($value), $db->real_escape_string($id));
if (!$db->query($update_sql)) {
    $error = $db->error;
    $db->close();
    echo sprintf('Error updating field: %s', $error);
}
die_success($successRedir);
コード例 #25
0
ファイル: send-fax.php プロジェクト: rkania/GS3
$pin = gs_user_pin_get($user);
# use default fax TSI if not provided in http request
#
if ($tsi == '') {
    $fax_tsis_global = explode(',', gs_get_conf('GS_FAX_TSI'));
    if (array_key_exists(0, $fax_tsis_global) && $fax_tsis_global[0] != '') {
        $tsi = $fax_tsis_global[0];
    } else {
        $tsi = '0';
    }
}
# if no local file is specified check if ist's provided in http request
#
if ($local_file == '' && is_array($_FILES) && array_key_exists('file', $_FILES) && $_FILES['file']['error'] == 0 && $_FILES['file']['size'] > 0) {
    $local_file = $_FILES['file']['tmp_name'];
}
# invoke function from the fax library
#
if ($local_file != '') {
    $local_file = gs_get_conf('GS_FAX_INIT_DOCDIR', '') . '/' . preg_replace('/\\.\\./', '', $local_file);
    if (file_exists($local_file)) {
        $fax_job_id = fax_send($user_id, $user, $to, $tsi, $local_file, $email, $resolution, $pin);
    }
}
# result
#
if (isset($fax_job_id) && $fax_job_id >= 1) {
    die_ok('Fax job sent with id: ' . $fax_job_id);
} else {
    die_error('Fax job not accepted');
}
コード例 #26
0
ファイル: Manage.php プロジェクト: Orelab/election-libre
 public function save()
 {
     // Security stuffs
     $this->Security_model->log('election creation', 3);
     // None of these fields must be empty. If it occurs, there is an IHM problem and the procedure
     // should be aborted.
     $profile = array('election' => array('admin_name' => '', 'admin_surname' => '', 'admin_email' => '', 'admin_password' => '', 'business' => '', 'winners' => '', 'title' => '', 'page' => '', 'start' => '', 'end' => ''), 'candidates' => array(), 'electors' => array());
     // No need to specify 'true' in the second argument as it is also configured in the config file,
     // but as it is a very important verification, it's better to force it here...
     $data = $this->input->post(null, true);
     $keys = array_keys($profile['election']);
     foreach ($data as $key => $value) {
         if ($key == 'start' or $key == 'end') {
             //$dt = DateTime::createFromFormat( 'd/m/Y', $value );
             $dt = DateTime::createFromFormat('Y/m/d H:i', $value);
             if ($dt) {
                 $profile['election'][$key] = $dt->format(DateTime::ISO8601);
             } else {
                 die('Date error.');
             }
         } elseif ($key == 'page') {
             $profile['election']['page'] = $value;
             // the same as below, without strip_tags()
         } elseif (in_array($key, $keys)) {
             $profile['election'][$key] = strip_tags($value);
         } elseif (substr($key, 0, 9) == 'candidate') {
             $profile['candidates'][] = strip_tags($value);
         } elseif (in_array(substr($key, 0, 4), array('name', 'surn', 'emai'))) {
             $col = preg_replace('/[0-9]/s', '', $key);
             $row = preg_replace('/[^0-9]/s', '', $key);
             $profile['electors'][$row][$col] = strip_tags($value);
         } elseif (substr($key, 0, 5) == 'valid') {
             // We have to ignore explicitly this field, otherwise we trigger
             // an 'unexpected data' error (see bellow)
         } else {
             die_error('unexpected data.');
         }
     }
     // Adding public user ID
     //
     //	$key_list is used to prevent the generation of two identical keys.
     //
     $key_list = array();
     foreach ($profile['electors'] as &$e) {
         $key = random_key();
         while (in_array($key, $key_list)) {
             $key = random_key();
         }
         $key_list[] = $key;
         $e['public_id'] = $key;
     }
     // post treatment validation
     foreach ($profile as $value) {
         if ($value == '' or is_array($value) && count($value) == 0) {
             die_error('missing data.');
         }
     }
     // generate a password for the admin
     //	It will be sent to the admin with its confirmation mail.
     // In the database, only the md5 is saved for security reasons.
     $password = random_key();
     $profile['election']['admin_password'] = md5($password);
     // Ok, so let's record it
     $this->load->model('Election_model');
     $this->load->model('Candidate_model');
     $this->load->model('Elector_model');
     $fk = $this->Election_model->save($profile['election']);
     $this->Candidate_model->save($profile['candidates'], $fk);
     $this->Elector_model->save($profile['electors'], $fk);
     //  warn the admin
     $this->lang->load('el_mail');
     $response = sendmail(array('subject' => 'Congratulations ! Elections are on rails now', 'message' => $this->load->view('email/creation', array('data' => $profile['election'], 'password' => $password), true), 'toName' => $profile['election']['admin_name'] . ' ' . $profile['election']['admin_surname'], 'toEmail' => $profile['election']['admin_email']));
     if ($response !== true) {
         die_error($response);
     }
     //  warn the electors
     foreach ($profile['electors'] as $elector) {
         $mail = array('subject' => $profile['election']['title'], 'message' => $this->load->view('email/invitation', array('message' => $profile['election']['page'], 'public_id' => $elector['public_id'], 'start' => $profile['election']['start'], 'end' => $profile['election']['end']), true), 'fromName' => 'Election Libre', 'fromEmail' => $profile['election']['admin_email'], 'fromBusiness' => $profile['election']['business'], 'toName' => $elector['name'] . ' ' . $elector['surname'], 'toEmail' => $elector['email']);
         $response = sendmail($mail);
         if ($response !== true) {
             die_error($response);
         }
     }
     die(lang('manage_success'));
 }
コード例 #27
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
require_once dirname(__FILE__) . '/includes/core.inc.php';
require_once dirname(__FILE__) . '/includes/page_template.php';
if (!checkAuthorization('viewConfiguration')) {
    redirect('index.php');
}
page_header();
$prefs = Preferences::getInstance();
if (!$prefs) {
    die_error('get Preferences failed', __FILE__, __LINE__);
}
?>

<table style="width: 100%;" border="0" cellspacing="3" cellpadding="5">
  <tr>

  <td style="padding: 20px; vertical-align: top;">
  <div class="container rounded" style="background: #eee; width: 98%; margin-left: auto; margin-right: auto;">
  <div>
  <h2><?php 
echo _('Last save');
?>
</h2>
<?php 
if (file_exists(SESSIONMANAGER_CONFFILE_SERIALIZED)) {
コード例 #28
0
ファイル: configuration.php プロジェクト: skdong/nfs-ovd
        } catch (Exception $e) {
        }
        $prefs->initialize();
        require_once dirname(__FILE__) . '/includes/page_template.php';
        page_header();
        // printing of preferences
        if ($can_manage_configuration) {
            echo '<form method="post" action="configuration.php">';
            echo '<input type="hidden" name="setup" value="setup" />';
        }
        print_prefs5($prefs, 'general', 'sql');
        if ($can_manage_configuration) {
            echo '<input type="submit" id="submit" name="submit"  value="' . _('Save') . '" />';
            echo '</form>';
        }
        page_footer();
    } else {
        try {
            $prefs = new Preferences_admin();
        } catch (Exception $e) {
        }
        if (is_object($prefs)) {
            require_once dirname(__FILE__) . '/includes/page_template.php';
            page_header();
            print_prefs($prefs, $can_manage_configuration);
            page_footer();
        } else {
            die_error(_('Preferences not loaded'), __FILE__, __LINE__);
        }
    }
}
コード例 #29
0
ファイル: core.inc.php プロジェクト: skdong/nfs-ovd
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
//if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml'))
//	header('Content-Type: application/xhtml+xml; charset=utf-8');
//else
header('Content-Type: text/html; charset=utf-8');
require_once dirname(__FILE__) . '/core-minimal.inc.php';
$folders = array('reporting', 'tmp', 'cache');
foreach ($folders as $folder) {
    $buf = strtoupper($folder) . '_DIR';
    define($buf, SESSIONMANAGER_SPOOL . '/' . $folder);
    if (!check_folder(constant($buf))) {
        Logger::critical('main', constant($buf) . ' does not exist and cannot be created!');
        die_error(constant($buf) . ' does not exist and cannot be created!', __FILE__, __LINE__);
    }
}
$prefs = Preferences::getInstance();
if (is_object($prefs)) {
    define('HAS_PREFERENCES', true);
    $sql_conf = $prefs->get('general', 'sql');
    if (is_array($sql_conf)) {
        define('SERVERS_HISTORY_TABLE', $sql_conf['prefix'] . 'servers_history');
        define('SESSIONS_HISTORY_TABLE', $sql_conf['prefix'] . 'sessions_history');
        SQL::newInstance($sql_conf);
    }
}
コード例 #30
0
ファイル: AdminSoliProcessing.php プロジェクト: babesk/babesk
 /**
  * Change Settings for Solis
  * Enter description here ...
  */
 function ChangeSettings($soli_price)
 {
     require_once PATH_ACCESS . '/GlobalSettingsManager.php';
     require_once PATH_ACCESS . '/PriceClassManager.php';
     $gbManager = new GlobalSettingsManager();
     $pcManager = new PriceClassManager();
     die_error(SOLI_ERR_INP_PRICE);
     if ($soli_price !== NULL) {
         try {
             try {
                 //inputcheck
                 inputcheck($_POST['soli_price'], 'credits');
             } catch (Exception $e) {
                 die_error(SOLI_ERR_INP_PRICE);
                 $this->soliInterface->dieError($this->msg['SOLI_ERR_INP_PRICE']);
             }
             $gbManager->changeSoliPrice($_POST['soli_price']);
         } catch (Exception $e) {
             die_error(SOLI_ERR_CHANGE_PRICE . ':' . $e->getMessage());
             $this->soliInterface->dieError($this->msg['SOLI_ERR_CHANGE_PRICE '] . ':' . $e->getMessage());
         }
         $this->soliInterface->dieMsg($this->msg['SOLI_FIN_CHANGE']);
     } else {
         try {
             $soli_price = $gbManager->getSoliPrice();
             $priceclasses = $pcManager->getTableData();
         } catch (Exception $e) {
             $this->soliInterface->dieError($this->msg['SOLI_ERR_PRICE']);
         }
         $this->soliInterface->ChangeSettings($soli_price, $priceclasses);
     }
 }