本文整理汇总了PHP中Flux类的典型用法代码示例。如果您正苦于以下问题:PHP Flux类的具体用法?PHP Flux怎么用?PHP Flux使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Flux类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flux_get_default_bmp_data
function flux_get_default_bmp_data()
{
$filename = sprintf('%s/emblem/%s', FLUX_DATA_DIR, Flux::config('MissingEmblemBMP'));
if (file_exists($filename)) {
return file_get_contents($filename);
}
}
示例2: getCashPoints
function getCashPoints($account_id, $server)
{
$cp_tbl = Flux::config('FluxTables.cashpoints');
$sql = "SELECT value FROM {$cp_tbl} WHERE account_id = ? AND key = '#CASHPOINTS'";
$sth = $server->connection->getStatement($sql);
$sth->execute(array((int) $account_id));
return $sth->rowCount() ? (int) $sth->fetch()->value : 0;
}
示例3: isUp
/**
* Checks whether the server is up and running (accepting connections).
* Will return true/false based on the server status.
*
* @return bool Returns true if server is running, false if not.
* @access public
*/
public function isUp()
{
$addr = $this->config->getAddress();
$port = $this->config->getPort();
$sock = @fsockopen($addr, $port, $errno, $errstr, (int) Flux::config('ServerStatusTimeout'));
if (is_resource($sock)) {
fclose($sock);
return true;
} else {
return false;
}
}
示例4: execute
public function execute(array $inputParameters = array())
{
$res = $this->stmt->execute($inputParameters);
Flux::$numberOfQueries++;
if ((int) $this->stmt->errorCode()) {
$info = $this->stmt->errorInfo();
self::$errorLog->puts('[SQLSTATE=%s] Err %s: %s', $info[0], $info[1], $info[2]);
if (Flux::config('DebugMode')) {
$message = sprintf('MySQL error (SQLSTATE: %s, ERROR: %s): %s', $info[0], $info[1], $info[2]);
throw new Flux_Error($message);
}
}
return $res;
}
示例5: __construct
public function __construct($name, $addonDir = null)
{
$this->name = $name;
$this->addonDir = is_null($addonDir) ? FLUX_ADDON_DIR . "/{$name}" : $addonDir;
$this->configDir = "{$this->addonDir}/config";
$this->moduleDir = "{$this->addonDir}/modules";
$this->themeDir = "{$this->addonDir}/themes/" . Flux::config('ThemeName');
$files = array('addonConfig' => "{$this->configDir}/addon.php", 'accessConfig' => "{$this->configDir}/access.php");
foreach ($files as $configName => $filename) {
if (file_exists($filename)) {
$this->{$configName} = Flux::parseConfigFile($filename);
}
if (!$this->{$configName} instanceof Flux_Config) {
$tempArr = array();
$this->{$configName} = new Flux_Config($tempArr);
}
}
// Use new language system for messages (also supports addons).
$this->messagesConfig = Flux::parseLanguageConfigFile($name);
}
示例6: __construct
public function __construct()
{
if (!self::$errLog) {
self::$errLog = new Flux_LogFile(FLUX_DATA_DIR . '/logs/errors/mail/' . date('Ymd') . '.log');
}
if (!self::$log) {
self::$log = new Flux_LogFile(FLUX_DATA_DIR . '/logs/mail/' . date('Ymd') . '.log');
}
$this->pm = $pm = new PHPMailer();
$this->errLog = self::$errLog;
$this->log = self::$log;
if (Flux::config('MailerUseSMTP')) {
$pm->IsSMTP();
if (is_array($hosts = Flux::config('MailerSMTPHosts'))) {
$hosts = implode(';', $hosts);
}
$pm->Host = $hosts;
if ($user = Flux::config('MailerSMTPUsername')) {
$pm->SMTPAuth = true;
if (Flux::config('MailerSMTPUseTLS')) {
$pm->SMTPSecure = 'tls';
}
if (Flux::config('MailerSMTPUseSSL')) {
$pm->SMTPSecure = 'ssl';
}
if ($port = Flux::config('MailerSMTPPort')) {
$pm->Port = (int) $port;
}
$pm->Username = $user;
if ($pass = Flux::config('MailerSMTPPassword')) {
$pm->Password = $pass;
}
}
}
// From address.
$pm->From = Flux::config('MailerFromAddress');
$pm->FromName = Flux::config('MailerFromName');
// Always use HTML.
$pm->IsHTML(true);
}
示例7: csrfValidate
/**
* Check CSRF validity
* @param string $name identifier
* @param array $storage check : $_POST / $_GET / ect.
* @param string $error reference to overwrite if something to say
* @return bool PASS
* @access public
*/
public static function csrfValidate($name, $storage, &$error)
{
// Missing session token
if (!isset(self::$session['CSRF_' . $name])) {
$error = Flux::message('SecurityNeedSession');
return false;
}
// Missing origin token
if (!isset($storage[$name])) {
$error = Flux::message('SecurityNeedToken');
return false;
}
// Get back hash, clean up session
$hash = self::$session['CSRF_' . $name];
unset(self::$session['CSRF_' . $name]);
// Invalid token
if ($storage[$name] !== $hash) {
$error = Flux::message('SecuritySessionInvalid');
return false;
}
// PASS
return true;
}
示例8: trim
if (count($_POST)) {
$prev = (bool) $params->get('_preview');
$to = trim($params->get('to'));
$subject = trim($params->get('subject'));
$body = trim($params->get('body'));
if (!$to) {
$errorMessage = Flux::message('MailerEnterToAddress');
} elseif (!$subject) {
$errorMessage = Flux::message('MailerEnterSubject');
} elseif (!$body) {
$errorMessage = Flux::message('MailerEnterBodyText');
} elseif (!Flux_Security::csrfValidate('Mailer', $_POST, $error)) {
$errorMessage = $error;
}
if (empty($errorMessage)) {
if ($prev) {
require_once 'markdown/markdown.php';
$preview = Markdown($body);
} else {
require_once 'Flux/Mailer.php';
$mail = new Flux_Mailer();
$opts = array('_ignoreTemplate' => true, '_useMarkdown' => true);
if ($mail->send($to, $subject, $body, $opts)) {
$session->setMessageData(sprintf(Flux::message('MailerEmailHasBeenSent'), $to));
$this->redirect();
} else {
$errorMessage = Flux::message('MailerFailedToSend');
}
}
}
}
示例9: array
<?php
if (!defined('FLUX_ROOT')) {
exit;
}
//$this->loginRequired();
$title = 'Viewing Item';
require_once 'Flux/TemporaryTable.php';
if ($server->isRenewal) {
$fromTables = array("{$server->charMapDatabase}.item_db_re", "{$server->charMapDatabase}.item_db2_re");
} else {
$fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2");
}
$tableName = "{$server->charMapDatabase}.items";
$tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables);
$shopTable = Flux::config('FluxTables.ItemShopTable');
$itemID = $params->get('id');
/* ITEM SHOP */
try {
$sql = 'select * from shops_sells s left join npcs n on s.id_shop = n.id where s.item = ?';
$sth = $server->connection->getStatement($sql);
$sth->execute(array($itemID));
if ((int) $sth->stmt->errorCode()) {
throw new Flux_Error('db not found');
}
$itemShop = $sth->fetchAll();
} catch (Exception $e) {
$itemShop = false;
}
/* ITEM SHOP */
$col = 'items.id AS item_id, name_english AS identifier, ';
示例10: array
<?php
if (!defined('FLUX_ROOT')) {
exit;
}
$title = 'Email Changes';
$changeTable = Flux::config('FluxTables.ChangeEmailTable');
$sqlpartial = "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = log.account_id ";
$sqlpartial .= 'WHERE 1=1 ';
$bind = array();
// Email change searching.
$requestAfter = $params->get('request_after_date');
$requestBefore = $params->get('request_before_date');
$changeAfter = $params->get('change_after_date');
$changeBefore = $params->get('change_before_date');
$accountID = trim($params->get('account_id'));
$username = trim($params->get('username'));
$oldEmail = trim($params->get('old_email'));
$newEmail = trim($params->get('new_email'));
$requestIP = trim($params->get('request_ip'));
$changeIP = trim($params->get('change_ip'));
if ($requestAfter) {
$sqlpartial .= 'AND request_date >= ? ';
$bind[] = $requestAfter;
}
if ($requestBefore) {
$sqlpartial .= 'AND request_date <= ? ';
$bind[] = $requestBefore;
}
if ($accountID) {
$sqlpartial .= 'AND log.account_id = ? ';
示例11: VALUES
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (is_null($errorMessage)) {
$sql = "INSERT INTO {$server->loginDatabase}.{$vfp_sites} VALUES (NULL, ?, ?, ?, ?, ?, ?, ?)";
$sth = $server->connection->getStatement($sql);
if ($imageurl === "") {
$imageurl = NULL;
}
if ($uploadimg['error'] > 0) {
$uploadimg = NULL;
}
$bind = array($votename, $voteurl, $voteinterval, $votepoints, $filename, $imageurl, date(Flux::config('DateTimeFormat')));
if ($sth->execute($bind)) {
$successMessage = Flux::message("SuccessVoteSite");
} else {
$errorMessage = Flux::message("FailedToAdd");
}
}
}
示例12: htmlspecialchars
?>
</td>
<td><?php
echo htmlspecialchars(Flux::message('TLStatus' . $trow->status));
?>
</td>
<td><?php
echo date(Flux::config('DateFormat'), strtotime($trow->created));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
?>
<p>
<?php
echo htmlspecialchars(Flux::message('TLNoTasks'));
?>
<br/><br/>
<a href="<?php
echo $this->url('tasks', 'createnew');
?>
">Create a Task</a>
</p>
<?php
}
示例13: array
</select>.
<?php
}
?>
<form action="<?php
echo $this->urlWithQs;
?>
" method="post" name="preferred_server_form" style="display: none">
<input type="hidden" name="preferred_server" value="" />
</form>
</span>
</td>
<td bgcolor="#e1eaf3"></td>
</tr>
<?php
if (!empty($adminMenuItems) && Flux::config('AdminMenuNewStyle')) {
?>
<?php
$mItems = array();
foreach ($adminMenuItems as $menuItem) {
$mItems[] = sprintf('<a href="%s">%s</a>', $menuItem['url'], $menuItem['name']);
}
?>
<tr>
<td bgcolor="#e1eaf3"></td>
<td bgcolor="#e1eaf3" valign="middle" class="loginbox-admin-menu">
<strong>Admin</strong>: <?php
echo implode(' • ', $mItems);
?>
</td>
<td bgcolor="#e1eaf3"></td>
示例14: sprintf
<?php
if (!defined('FLUX_ROOT')) {
exit;
}
$this->loginRequired(Flux::message('LoginToDonate'));
$title = 'Fazer Uma Doação';
$donationAmount = false;
if (count($_POST) && $params->get('setamount')) {
$minimum = Flux::config('PagSeguroMin');
$amount = (double) $params->get('amount');
if (!$amount || $amount < $minimum) {
$errorMessage = sprintf('A quantidade de doação deve ser maior ou igual a %s R$!', $this->formatCurrency($minimum));
} else {
$donationAmount = $amount;
}
}
if (!$params->get('setamount') && $params->get('resetamount')) {
$this->redirect($this->url);
}
示例15: htmlspecialchars
<?php
}
?>
<form action="<?php
echo $this->urlWithQs;
?>
" method="post" class="generic-form">
<table class="generic-form-table">
<tr>
<th><label for="email"><?php
echo htmlspecialchars(Flux::message('EmailChangeLabel'));
?>
</label></th>
<td><input type="text" name="email" id="email" /></td>
<td><p><?php
echo htmlspecialchars(Flux::message('EmailChangeInputNote'));
?>
</p></td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" value="<?php
echo htmlspecialchars(Flux::message('EmailChangeButton'));
?>
" />
</td>
<td></td>
</tr>
</table>
</form>