本文整理匯總了PHP中OpenVBX::schemaVersion方法的典型用法代碼示例。如果您正苦於以下問題:PHP OpenVBX::schemaVersion方法的具體用法?PHP OpenVBX::schemaVersion怎麽用?PHP OpenVBX::schemaVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OpenVBX
的用法示例。
在下文中一共展示了OpenVBX::schemaVersion方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: login
private function login($redirect)
{
try {
$user = VBX_User::authenticate($this->input->post('email'), $this->input->post('pw'), $this->input->post('captcha'), $this->input->post('captcha_token'));
if ($user) {
$connect_auth = OpenVBX::connectAuthTenant($user->tenant_id);
// we kick out non-admins, admins will have an opportunity to re-auth the account
if (!$connect_auth && !$user->is_admin) {
$this->session->set_flashdata('error', 'Connect auth denied');
return redirect('auth/connect/account_deauthorized');
}
$userdata = array('email' => $user->email, 'user_id' => $user->id, 'is_admin' => $user->is_admin, 'loggedin' => TRUE, 'signature' => VBX_User::signature($user->id));
$this->session->set_userdata($userdata);
if (OpenVBX::schemaVersion() >= 24) {
return $this->after_login_completed($user, $redirect);
}
return $this->redirect($redirect);
}
$this->session->set_flashdata('error', 'Email address and/or password is incorrect');
return redirect('auth/login?redirect=' . urlencode($redirect));
} catch (GoogleCaptchaChallengeException $e) {
$this->session->set_flashdata('error', $e->getMessage());
$data['error'] = $e->getMessage();
$data['captcha_url'] = $e->captcha_url;
$data['captcha_token'] = $e->captcha_token;
}
}
示例2: setup
public function setup()
{
$json['success'] = true;
$json['message'] = '';
try {
$currentSchemaVersion = OpenVBX::schemaVersion();
$upgradingToSchemaVersion = OpenVBX::getLatestSchemaVersion();
$upgradeScriptPath = VBX_ROOT . '/updates/';
$updates = scandir($upgradeScriptPath);
$updatesToRun = array();
// Collect all files named numerically in /updates and key sort the list of updates
foreach ($updates as $i => $update) {
if (preg_match('/^(\\d+).(sql|php)$/', $update, $matches)) {
$updateExtension = $matches[2];
$rev = $matches[1];
$updatesToRun[$rev] = array('type' => $updateExtension, 'filename' => $update, 'revision' => $rev);
}
}
ksort($updatesToRun);
// Cut the updates by the current schema version.
$updatesToRun = array_slice($updatesToRun, $currentSchemaVersion);
$tplvars = array('originalVersion' => $currentSchemaVersion, 'version' => $upgradingToSchemaVersion, 'updates' => $updatesToRun);
foreach ($updatesToRun as $updateToRun) {
$file = $updateToRun['filename'];
$type = $updateToRun['type'];
$revision = $updateToRun['revision'];
switch ($type) {
case 'php':
require_once $upgradeScriptPath . $file;
$runUpdateMethod = "runUpdate_{$revision}";
if (!function_exists($runUpdateMethod)) {
throw new UpgradeException('runUpdate method missing from ' . $file . ': ' . $runUpdateMethod);
}
call_user_func($runUpdateMethod);
break;
case 'sql':
$sql = @file_get_contents($upgradeScriptPath . $file);
if (empty($sql)) {
throw new UpgradeException("Unable to read update: {$file}", 1);
}
foreach (explode(";", $sql) as $stmt) {
$stmt = trim($stmt);
if (!empty($stmt)) {
PluginData::sqlQuery($stmt);
}
}
break;
}
}
flush_minify_caches();
} catch (Exception $e) {
$json['success'] = false;
$json['message'] = $e->getMessage();
$json['step'] = $e->getCode();
}
$json['tplvars'] = $tplvars;
echo json_encode($json);
}
示例3: login
private function login($redirect)
{
try {
$user = VBX_User::authenticate($this->input->post('email'), $this->input->post('pw'), $this->input->post('captcha'), $this->input->post('captcha_token'));
if ($user) {
$userdata = array('email' => $user->email, 'user_id' => $user->id, 'is_admin' => $user->is_admin, 'loggedin' => TRUE, 'signature' => VBX_User::signature($user->id));
$this->session->set_userdata($userdata);
if (OpenVBX::schemaVersion() >= 24) {
return $this->after_login_completed($user, $redirect);
}
return $this->redirect($redirect);
}
$this->session->set_flashdata('error', 'Email address and/or password is incorrect');
return redirect('auth/login?redirect=' . urlencode($redirect));
} catch (GoogleCaptchaChallengeException $e) {
$this->session->set_flashdata('error', $e->getMessage());
$data['error'] = $e->getMessage();
$data['captcha_url'] = $e->captcha_url;
$data['captcha_token'] = $e->captcha_token;
}
}
示例4: setup
public function setup()
{
$json['success'] = true;
$json['message'] = '';
try {
$currentSchemaVersion = OpenVBX::schemaVersion();
$upgradingToSchemaVersion = OpenVBX::getLatestSchemaVersion();
$sqlPath = VBX_ROOT . '/sql-updates/';
$updates = scandir($sqlPath);
$files = array();
foreach ($updates as $i => $update) {
if (preg_match('/^(\\d+).sql$/', $update)) {
$rev = intval(str_replace('.sql', '', $update));
$files[$rev] = $update;
}
}
ksort($files);
$files = array_slice($files, $currentSchemaVersion);
$tplvars = array('originalVersion' => $currentSchemaVersion, 'version' => $upgradingToSchemaVersion, 'updates' => $files);
foreach ($files as $file) {
$sql = @file_get_contents($sqlPath . $file);
if (empty($sql)) {
throw new UpgradeException("Unable to read update: {$file}", 1);
}
foreach (explode(";", $sql) as $stmt) {
$stmt = trim($stmt);
if (!empty($stmt)) {
PluginData::sqlQuery($stmt);
}
}
}
} catch (Exception $e) {
$json['success'] = false;
$json['message'] = $e->getMessage();
$json['step'] = $e->getCode();
}
$json['tplvars'] = $tplvars;
echo json_encode($json);
}
示例5: login_openvbx
/**
* Attempt to log in the user
*
* @param VBX_User $user
* @param string $password
* @return mixed VBX_User on success, bool FALSE on failure
*/
protected function login_openvbx($user, $password)
{
if (!self::authenticate($user, $password)) {
return FALSE;
} else {
// Login succeeded
if (OpenVBX::schemaVersion() >= 24) {
$user->last_login = new MY_ModelLiteral('UTC_TIMESTAMP()');
// auto-upgrade old passwords
if (OpenVBX::schemaVersion() > 63 && strlen($user->password) == 40) {
$user->password = self::salt_encrypt($password);
$user->save();
}
try {
$user->setting_set('last_login', new MY_ModelLiteral('UTC_TIMESTAMP()'));
} catch (VBX_UserException $e) {
$this->error_message('login', $e->getMessage());
return FALSE;
}
}
return $user;
}
}
示例6: schemaVersion
/**
* Returns the version of the database schema
*
* @static
* @return int
*/
public static function schemaVersion()
{
if (empty(self::$schemaVersion)) {
$ci =& get_instance();
if ($ci->db) {
$reenable_cache = false;
$ci->load->model('vbx_settings');
if (isset($ci->cache) && $ci->cache->enabled()) {
$ci->cache->enabled(false);
$reenable_cache = true;
}
self::$schemaVersion = $ci->vbx_settings->get('schema-version', VBX_PARENT_TENANT);
if ($reenable_cache) {
$ci->cache->enabled(true);
}
}
}
return self::$schemaVersion;
}
示例7: login_openvbx
function login_openvbx($user, $password)
{
if ($user->password != self::salt_encrypt($password)) {
return FALSE;
} else {
// Login succeeded
if (OpenVBX::schemaVersion() >= 24) {
$user->last_login = new MY_ModelLiteral('UTC_TIMESTAMP()');
try {
$user->save();
} catch (VBX_UserException $e) {
$this->error_message('login', $e->getMessage());
return FALSE;
}
}
return $user;
}
}
示例8:
</div><!-- #vbx-main -->
</div><!-- .yui-b -->
</div>
<div class="yui-b">
<div class="vbx-sidebar">
</div><!-- .vbx-sidebar -->
</div><!-- .yui-b -->
</div><!-- #bd .error-404 -->
<div id="ft">
<p class="copyright">OpenVBX • <em>v</em><?php
echo OpenVBX::version();
?>
r<?php
echo OpenVBX::schemaVersion();
?>
— Powered by <a href="http://twilio.com/">Twilio Inc.</a> • <a href="http://www.twilio.com/legal/tos">Terms</a> • <a href="http://www.twilio.com/legal/privacy">Privacy</a></p>
</div><!-- #ft -->
</div><!-- #wrapper -->
</div><!-- #doc -->
</body>
</html>
示例9: upgrade_check
private function upgrade_check()
{
$currentSchemaVersion = OpenVBX::schemaVersion(false);
$upgradingToSchemaVersion = OpenVBX::getLatestSchemaVersion();
if ($currentSchemaVersion != $upgradingToSchemaVersion) {
redirect('upgrade');
}
}