本文整理汇总了PHP中Configuration::read方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::read方法的具体用法?PHP Configuration::read怎么用?PHP Configuration::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration::read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showMessages
public function showMessages($echo = TRUE)
{
$msg = '';
try {
$errors = $this->sessionHelper->read('sr_errors');
} catch (SessionDataIOException $e) {
$errors = array();
}
try {
$messages = $this->sessionHelper->read('sr_messages');
} catch (SessionDataIOException $e) {
$messages = array();
}
while ($e = array_shift($errors)) {
$msg .= '<div class="' . Configuration::read('error_div_class') . '">' . $e . '</div>';
}
while ($e = array_shift($messages)) {
$msg .= '<div class="' . Configuration::read('message_div_class') . '">' . $e . '</div>';
}
$this->sessionHelper->destroy('sr_errors');
$this->sessionHelper->destroy('sr_messages');
if (!$echo) {
return $msg;
}
echo $msg;
}
示例2: protection
/**
* Check auth level of an user
*
* @param integer $auth Auth level asked to show content
*
* @return boolean
* @static
*/
public static function protection($auth = 1)
{
if (isset($_COOKIE['leqg'], $_COOKIE['time']) && !empty($_COOKIE['time']) && !empty($_COOKIE['leqg'])) {
$query = Core::query('user-data-cookie', 'core');
$query->bindValue(':cookie', $_COOKIE['leqg'], PDO::PARAM_INT);
$query->execute();
if ($query->rowCount() == 1) {
$data = $query->fetch(PDO::FETCH_ASSOC);
if ($data['client'] == Configuration::read('client')) {
if ($data['auth_level'] >= $auth) {
return true;
} else {
header('Location: http://' . $data['client'] . '.leqg.info');
}
} else {
header('Location: http://' . $data['client'] . '.leqg.info' . $_SERVER['PHP_SELF']);
}
} else {
setcookie('leqg', null, time(), '/', 'leqg.info');
setcookie('time', null, time(), '/', 'leqg.info');
header('Location: http://auth.leqg.info');
}
} else {
setcookie('leqg', null, time(), '/', 'leqg.info');
setcookie('time', null, time(), '/', 'leqg.info');
header('Location: http://auth.leqg.info');
}
}
示例3: __construct
protected function __construct()
{
$this->mysqli = mysqli_init();
if (!$this->mysqli->real_connect(Configuration::read('db_host'), Configuration::read('db_username'), Configuration::read('db_password'), Configuration::read('db_name'))) {
throw new MysqliConnectionException('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}
}
示例4: loadView
public static function loadView($v, $viewData = NULL)
{
$file = Configuration::read('view_path') . $v . '.view.php';
if (file_exists($file)) {
extract($viewData);
include $file;
}
}
示例5: postcontroller
public function postcontroller()
{
$postController = scandir(Configuration::read('task_path'));
foreach ($postController as $post) {
if (preg_match('/postcontroller.php$/', $post) > 0) {
$post = preg_replace('/\\..*$/', '', $post);
$task = new $post();
$task->execute();
}
}
}
示例6: query
/**
* Prepare an SQL query existing in a file (sql/ directory)
*
* @param string $query file to load
* @param string $bdd which database?
*
* @return object
* @static
*/
public static function query(string $query, $bdd = 'link')
{
// On récupère le lien vers la BDD
$link = Configuration::read('db.' . $bdd);
// On vérifie que la requête existe
if (file_exists("sql/{$query}.sql")) {
// On récupère la requête et on retourne la requête préparée
$query = file_get_contents("sql/{$query}.sql");
return $link->prepare($query);
} else {
exit;
}
}
示例7: addScript
/**
* Add a script to the header.
*
* @param string $script The name of the script to add or the path if using a script outside of the default script location.
* @param int $priority [Optional] The priority of the script. 0 is higest meaning it will be loaded first. Default is -1
* meaning add the script onto the end of the list.
* @param boolean $absolute [Optional] Whether or not the script name is absolute. Default is false.
*/
public function addScript($script, $priority = -1, $absolute = FALSE)
{
if (!$absolute) {
if ($priority >= 0) {
$priority = min(array($priority, count($this->script)));
array_splice($this->script, $priority, 0, Configuration::read('basepath') . '/Webroot/js/' . $script . '.js');
} else {
$this->script[] = Configuration::read('basepath') . '/Webroot/js/' . $script . '.js';
}
} else {
if ($priority >= 0) {
$priority = min(array($priority, count($this->script)));
array_splice($this->script, $priority, 0, $script);
} else {
$this->script[] = $script;
}
}
}
示例8: create
/**
* Create a new template
*
* @return integer
* @static
*/
public static function create()
{
$user = User::ID();
$query = Core::query('template-create');
$query->bindParam(':user', $user);
$query->execute();
return Configuration::read('db.link')->lastInsertId();
}
示例9: trackingInfos
/**
* Tracking informations
*
* @param string $track_id Tracking ID
*
* @return array
* @static
**/
public static function trackingInfos(string $track_id)
{
$mandrill = Configuration::read('mail');
$result = $mandrill->messages->info($track_id);
return $result;
}
示例10: envoi
/**
* Créé un nouvel envoi
*
* @param string $objet Objet de l'envoi
* @param string $message Message de l'envoi
* @param string $type Type de l'envoi
*
* @return integer
* @static
*/
public static function envoi(string $objet, string $message, string $type)
{
// On récupère les données
$user = User::ID();
// On lance la création de l'envoi
$link = Configuration::read('db.link');
$query = 'INSERT INTO `envois` (`compte_id`,
`envoi_type`,
`envoi_time`,
`envoi_titre`,
`envoi_texte`)
VALUES (:compte,
:type,
NOW(),
:titre,
:texte)';
$query = $link->prepare($query);
$query->bindValue(':compte', $user, PDO::PARAM_INT);
$query->bindValue(':type', $type);
$query->bindValue(':titre', $objet);
$query->bindValue(':texte', $message);
$query->execute();
return $link->lastInsertId();
}
示例11: PDO
* @category Ajax
* @package LeQG
* @author Damien Senger <hi@hiwelo.co>
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
* @link http://leqg.info
*/
if (is_string($_POST['message']) && is_numeric($_POST['numero']) && is_numeric($_POST['contact'])) {
// On créé le lien vers la BDD Client
$dsn = 'mysql:host=' . Configuration::read('db.host') . ';dbname=' . Configuration::read('db.basename');
$user = Configuration::read('db.user');
$pass = Configuration::read('db.pass');
$link = new PDO($dsn, $user, $pass);
// On créé le lien vers la BDD Centrale
$dsn = 'mysql:host=' . Configuration::read('db.host') . ';dbname=leqg';
$user = Configuration::read('db.user');
$pass = Configuration::read('db.pass');
$zentrum = new PDO($dsn, $user, $pass);
// On règle l'expéditeur
$expediteur = 'LeQG';
// On récupère le numéro de téléphone
$query = 'SELECT `coordonnee_numero`
FROM `coordonnees`
WHERE `coordonnee_id` = :id';
$query = $link->prepare($query);
$query->bindParam(':id', $_POST['numero']);
$query->execute();
$numero = $query->fetch(PDO::FETCH_ASSOC);
$numero = $numero['coordonnee_numero'];
// On prépare l'envoi
$message = new \Esendex\Model\DispatchMessage($expediteur, $numero, $_POST['message'], \Esendex\Model\Message::SmsType);
// On assure le démarrage du service
示例12: last
/**
* Last created persons
*
* @param int $number Asked number of created persons
* @return array
* */
public static function last($number = 5)
{
$link = Configuration::read('db.link');
$query = $link->query('SELECT `id` FROM `people` ORDER BY `id` DESC LIMIT 0, ' . $number);
return $query->fetchAll(PDO::FETCH_ASSOC);
}
示例13: estimation
/**
* Number of phonecall to do in a mission
*
* @param array $args sorting methods
*
* @return integer
* @static
*/
public static function estimation(array $args)
{
// On commence par paramétrer les données PDO
$link = Configuration::read('db.link');
// On prépare la requête de récupération de tous les numéros
// connus par le système
$sql = 'SELECT *
FROM `coordonnees`
WHERE `coordonnee_type` != "email"';
$query = $link->prepare($sql);
$query->execute();
$numeros = $query->fetchAll(PDO::FETCH_ASSOC);
// On prépare le tableau des résultats du tri $num
$num = array();
// On retraite les arguments entrés
if (isset($args['age']) && !empty($args['age'])) {
$age = array();
$age['usr'] = explode(':', $args['age']);
$age['min'] = $age['usr'][0];
$age['max'] = $age['usr'][1];
} else {
$age = false;
}
if (isset($args['bureaux']) && !empty($args['bureaux'])) {
$bureaux = explode(',', $args['bureaux']);
} else {
$bureaux = false;
}
if (isset($args['thema']) && !empty($args['thema'])) {
$thema = $args['thema'];
} else {
$thema = false;
}
// On fait la boucle de tous les numéros,
// et on charge les informations pour chacun
foreach ($numeros as $numero) {
// On réinitialise le test
$test = true;
// On ouvre la fiche correspondante
$contact = new People($numero['contact_id']);
// On récupère son bureau de vote, son âge et ses tags
$ageContact = $contact->age();
$bureau = $contact->get('bureau');
$tags = $contact->get('tags');
// On vérifie si la fiche correspond aux arguments entrés
if ($age && $test) {
if ($ageContact <= $age['max'] && $ageContact >= $age['min']) {
// On le rajoute au test
$test = true;
$testAge = true;
} else {
$test = false;
$testAge = false;
}
}
// On fait les vérifications concernant le bureau de vote
if ($bureaux && $test) {
if (in_array($bureau, $bureaux)) {
$test = true;
$testBureau = true;
} else {
$test = false;
$testBureau = false;
}
}
// On fait les vérifications concernant les thématiques
if ($thema && $test) {
if (in_array($thema, $tags)) {
$test = true;
} else {
$test = false;
}
}
// Si le test est concluant, on l'ajoute à la liste des numéros
// en utilisant comme key l'ID du contact pour éviter les doublons
if ($test) {
$id = $contact->get('id');
$num[$id] = $numero['coordonnee_id'];
}
}
// On calcule maintenant le nombre de numéros concluant
$nombre = count($num);
// On retourne cette estimation
return $nombre;
}
示例14: create
/**
* Create a new event
*
* @param integer $person Person ID for this event
*
* @return integer
*/
public static function create(int $person)
{
$user = User::ID();
$query = Core::query('event-new');
$query->bindValue(':person', $person, PDO::PARAM_INT);
$query->bindValue(':user', $user, PDO::PARAM_INT);
$query->execute();
return Configuration::read('db.link')->lastInsertId();
}
示例15: __construct
/**
*
* @param string $key The name of the key to use for this instance
*/
public function __construct($key = 'random_salt')
{
$this->secretKey = Configuration::read($key);
}