本文整理汇总了PHP中message::set方法的典型用法代码示例。如果您正苦于以下问题:PHP message::set方法的具体用法?PHP message::set怎么用?PHP message::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message
的用法示例。
在下文中一共展示了message::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareUpdateView
protected function prepareUpdateView($baseModel = NULL)
{
$route_types = array();
$trunkList = array();
$interfaceList = array();
if (class_exists('Trunk')) {
$trunks = Doctrine::getTable('Trunk')->findAll(Doctrine::HYDRATE_ARRAY);
foreach ($trunks as $trunk) {
$trunkList[$trunk['trunk_id']] = $trunk['name'];
}
if (!empty($trunkList)) {
$route_types[ExternalXfer::TYPE_TRUNK] = 'via Trunk';
}
}
if (class_exists('SipInterface')) {
$interfaces = Doctrine::getTable('SipInterface')->findAll(Doctrine::HYDRATE_ARRAY);
foreach ($interfaces as $interface) {
$interfaceList[$interface['sipinterface_id']] = $interface['name'];
}
if (!empty($interfaceList)) {
$route_types[ExternalXfer::TYPE_SIP] = 'via SIP URI';
}
}
if (empty($route_types)) {
message::set('No Trunk or Sip Interfaces avaliable to route external destinations through!');
$this->returnQtipAjaxForm(NULL);
url::redirect(Router_Core::$controller);
}
$this->view->trunks = $trunkList;
$this->view->interfaces = $interfaceList;
$this->view->route_types = $route_types;
parent::prepareUpdateView($baseModel);
}
示例2: __construct
public function __construct()
{
parent::__construct();
if (users::getAttr('user_type') != User::TYPE_SYSTEM_ADMIN) {
message::set('You are not authorized to manage sip interfaces!');
$this->returnQtipAjaxForm(NULL);
url::redirect('/');
}
}
示例3: loadBaseModel
protected function loadBaseModel($id = NULL, $baseModel = NULL)
{
parent::loadBaseModel($id, $baseModel);
if (!empty($this->netlist['system_list']) and $this->netlist['system_list'] != 'trunks.auto') {
message::set($this->netlist['name'] . ' is generated by FreeSwitch and can not be edited!', 'alert');
$this->returnQtipAjaxForm(NULL);
url::redirect(Router::$controller);
}
}
示例4: submitReport
protected function submitReport($report)
{
$valid = TRUE;
$validation = Bluebox_Controller::$validation;
if (empty($report['issue'])) {
$validation->add_error('report[issue]', 'Please describe the issue');
$valid = FALSE;
}
if (empty($report['while'])) {
$validation->add_error('report[while]', 'Please describe the cause');
$valid = FALSE;
}
if (empty($report['contact'])) {
$validation->add_error('report[contact]', 'Please provide a method to contact you');
$valid = FALSE;
}
if (empty($report['error'])) {
$validation->add_error('report[error]', 'Please provide the error message');
$valid = FALSE;
}
if (!$valid) {
return FALSE;
}
if (!empty($report['log'])) {
$filename = Kohana::log_directory() . date('Y-m-d') . '.log' . EXT;
$offset = -150 * 120;
$rs = @fopen($filename, 'r');
$report['log'] = '';
if ($rs !== FALSE) {
fseek($rs, $offset, SEEK_END);
fgets($rs);
while (!feof($rs)) {
$buffer = fgets($rs);
$report['log'] .= htmlspecialchars($buffer . "\n");
}
fclose($rs);
}
}
$allowStats = Kohana::config('core.anonymous_statistics');
if (!empty($allowStats)) {
$report['anonymous_id'] = Kohana::config('core.anonymous_id');
Package_Catalog::disableRemote();
Package_Catalog::buildCatalog();
$report['catalog'] = Package_Catalog::getPackageList();
}
try {
$errorCollector = Kohana::config('errorreporter.collector');
$this->do_post_request($errorCollector, $report);
} catch (Exception $e) {
message::set($e->getMessage());
$this->returnQtipAjaxForm(NULL);
return FALSE;
}
return TRUE;
}
示例5: lookupPort
public static function lookupPort($type)
{
switch ($type) {
case 'mysql':
return 3306;
break;
case 'pgsql':
return 5432;
break;
default:
message::set("Unable to resolve port for {$type}");
}
}
示例6: rebuild
public function rebuild($number_id)
{
$this->loadBaseModel($number_id);
$this->number->markModified('number');
try {
$this->number->save();
message::set('Number ' . $this->number['number'] . ' dialplan rebuild complete!', 'success');
parent::save_succeeded($this->number);
} catch (Exception $e) {
message::set($e->getMessage());
}
$this->returnQtipAjaxForm();
url::redirect(Router_Core::$controller);
}
示例7: delete
public function delete($id = NULL)
{
if (users::getAttr('user_type') != User::TYPE_SYSTEM_ADMIN) {
if (users::getAttr('account_id') != $id) {
message::set('You are not authorized to delete that account!');
$this->returnQtipAjaxForm(NULL);
url::redirect(Router::$controller);
}
} else {
users::masqueradeAccount($id);
}
Session::instance()->set('bluebox.delete.unlimit', TRUE);
parent::delete($id);
Session::instance()->set('bluebox.delete.unlimit', FALSE);
}
示例8: __construct
/**
* Initialize the ESL connection. This must be called first
* @access public
* @static
* @return bool
*/
public function __construct()
{
$host = Kohana::config('freeswitch.ESLHost');
$port = Kohana::config('freeswitch.ESLPort');
$password = Kohana::config('freeswitch.ESLAuth');
if (!extension_loaded("ESL")) {
$this->esl = new ESLconnection($host, $port, $password);
// socket connection
$this->extension = FALSE;
} else {
include_once MODPATH . 'esl-1.0/assets/ESL.php';
$this->esl = new ESLconnection($host, $port, $password);
// FreeSWITCH ESL Swigged class
$this->extension = TRUE;
}
if (!$this->esl->connected()) {
message::set('Failed to connect to ESL. Make sure FreeSWITCH is running...', 'alert');
return FALSE;
}
return TRUE;
}
示例9: save
public function save()
{
// This array maps the telephony returns to the telephony file
$telephonyOptions = array('cfg_root' => rtrim($this->session->get('installer.ast_root'), '/'), 'AmiHost' => $this->session->get('installer.ami_host'), 'AmiPort' => $this->session->get('installer.ami_port'), 'AmiUser' => $this->session->get('installer.ami_user'), 'AmiPass' => $this->session->get('installer.ami_pass'));
if (!is_dir($telephonyOptions['cfg_root'])) {
message::set('Unable to access directory <pre>' . $telephonyOptions['cfg_root'] . '</pre>');
return false;
}
// Write $telephonyOptions to asterisk.php
if (!Installer_Controller::updateConfig($telephonyOptions, 'asterisk')) {
return false;
}
// Set the driver name in telephony.php
if (!Installer_Controller::updateConfig(array('driver' => 'Asterisk'), 'telephony')) {
return false;
}
// Reload the new asterisk options
Kohana::config_clear('asterisk');
Kohana::config_load('asterisk');
$this->session->set('installer.default_packages', kohana::config('asterisk.default_packages'));
return true;
}
示例10: profile
public function profile()
{
// We use a different base model and writable fields for this controller
$this->writable = array('first_name', 'last_name', 'email_address');
$this->baseModelObject = 'User';
// Overload the update view
$this->template->content = new View(Router::$controller . '/profile');
$this->user = Doctrine::getTable('User')->findOneByUserId($this->user->user_id);
$this->new_password = $this->confirm_password = '';
// Was anything retrieved? If no, this may be an invalid request
if (!$this->user) {
message::set('Unable to locate User');
}
// Are we supposed to be saving stuff? (received a form post?)
if ($this->submitted()) {
$hashedPassword = Auth::instance()->hash_password($_POST['user']['old_password'], Auth::instance()->find_salt($this->user->password));
if (empty($_POST['user']['old_password'])) {
message::set('Old password is empty');
} elseif (empty($_POST['user']['new_password'])) {
message::set('new password is empty');
} elseif (empty($_POST['user']['confirm_password'])) {
message::set('You need to confirm your password');
} elseif ($_POST['user']['confirm_password'] != $_POST['user']['new_password']) {
message::set('Your passwords did not match.');
} elseif ($hashedPassword != $this->user->password) {
// Password mismatch
message::set('Old password is wrong');
} else {
$this->new_password = $_POST['user']['new_password'];
$this->confirm_password = $_POST['user']['confirm_password'];
$rules = Bluebox_Controller::$validation;
//$rules->add_callbacks('new_password', array($this, '_strong_pwd'));
$this->formSave($this->user);
}
}
$this->view->old_password = '';
// Since the confirm_password doesnt exist in the table handle it specially
$this->view->confirm_password = $this->confirm_password;
// The password will returned hashed and we need plain text....
$this->view->new_password = $this->new_password;
// Set our own view variables from the DB records.
$this->view->user = $this->user;
// Execute plugin hooks here, after we've loaded the core data sets
plugins::views($this);
}
示例11: Validator
$validator = new Validator();
if (isset($_POST['submit'])) {
$validator->add_rule('contactname', 'Name', 'required');
$validator->add_rule('email', 'Email', 'required|email');
$validator->add_rule('message', 'Message', 'required|min(5)');
$validator->custom_message('email', 'required', "Please enter your email, this will only be used to respond to your message");
$validator->custom_message('email', 'email', "Please enter a valid email, this will only be used to respond to your message");
if ($validator->run() == true) {
$email = new Email(array('to' => c::get('site_email'), 'from' => 'Aurer emailer <noreply@aurer.co.uk>', 'subject' => $validator->get_value('subject', 'Response from the Aurer site'), 'body' => $validator->get_value('contactname') . " sent you a message\n\n" . $validator->get_value('message') . "\n\n" . $validator->get_value('email'), 'service' => 'mailgun', 'options' => array('key' => c::get('mailgun_key'), 'domain' => c::get('mailgun_domain'))));
if ($email->send()) {
s::set('email_sent', true);
go($page->url());
} else {
s::set('email_sent', false);
message::set('mail_error', 'It appears your message cannot be sent right now, many appologies.', 'error');
go($page->url());
}
}
}
?>
<?php
echo snippet('header');
?>
<div class="section section--contact">
<div class="section-inner">
<h1><?php
echo html($page->title());
?>
示例12: restfulDelete
/**
* This function preforms the default restful delete,
* extend this class and redefine if you need different behavoir.
*
* @return void
*/
public function restfulDelete()
{
$errorOccured = FALSE;
kohana::log('debug', 'Attempting a RESTful delete');
if (empty($_POST['id'])) {
message::set('No rows where specified for delete', array('type' => 'alert'));
return;
}
$delIDs = explode(',', $_POST['id']);
$conn = Doctrine_Manager::connection();
foreach ($delIDs as $delID) {
$row = Doctrine::getTable($this->baseModel)->find($delID);
if (!$row) {
$errorOccured = TRUE;
message::set('Unable to locate row ' . strtolower($this->baseModel) . ' id ' . $delID . '!');
continue;
}
try {
Bluebox_Record::setBaseSaveObject($row);
$conn->beginTransaction();
plugins::delete($row);
$row->delete();
$conn->commit();
plugins::delete($row, array('custom' => Router::$controller . '.success', 'coreAction' => FALSE, 'core' => FALSE));
Bluebox_Record::setBaseSaveObject(NULL);
} catch (Exception $e) {
$errorOccured = TRUE;
message::set('Unable to delete ' . strtolower($this->baseModel) . ' id ' . $delID . '! ' . $e->getMessage());
}
}
if (empty($errorOccured)) {
message::set('Selected record(s) deleted.', array('type' => 'success'));
}
}
示例13:
<?php
message::set('hello', 'Hello, World!');
message::set('fox', 'The quick brown fox jumps over the lazy dog.');
示例14: prepareUpdateView
protected function prepareUpdateView($baseModel = NULL)
{
$route_types = array();
$trunkList = array();
$interfaceList = array();
$numbers = Doctrine_Query::Create()->select("Number.number_id,Number.number,Number.foreign_id")->from("Number,NumberPool,NumberType")->where("NumberType.class='ExternalXferNumber'")->andWhere("NumberType.number_type_id=NumberPool.number_type_id")->andWhere("NumberPool.number_id=Number.number_id");
if ($this->externalxfer->external_xfer_id) {
$numbers = $numbers->andWhere("(Number.class_type='' or Number.class_type IS NULL or Number.foreign_id=?)", $this->externalxfer->external_xfer_id);
} else {
$numbers = $numbers->andWhere("(Number.class_type='' or Number.class_type IS NULL )");
}
$numbers = $numbers->orderBy('Number.number')->execute(array(), Doctrine::HYDRATE_SCALAR);
$this->view->numbers = array();
$this->view->numberdefault = NULL;
$matchcount = 0;
foreach ($numbers as $number) {
$this->view->numbers[$number['Number_number_id']] = $number['Number_number'];
if ($this->externalxfer->external_xfer_id == $number['Number_foreign_id']) {
$this->view->numberdefault = $number['Number_number_id'];
$matchcount++;
}
}
if ($matchcount > 1) {
message::set('This record cannot be edited, due to having multiple numbers');
$this->returnQtipAjaxForm(NULL);
url::redirect(Router_Core::$controller);
}
if (class_exists('Trunk')) {
$trunks = Doctrine::getTable('Trunk')->findAll(Doctrine::HYDRATE_ARRAY);
foreach ($trunks as $trunk) {
$trunkList[$trunk['trunk_id']] = $trunk['name'];
}
if (!empty($trunkList)) {
$route_types[ExternalXfer::TYPE_TRUNK] = 'via Trunk';
}
}
if (class_exists('SipInterface')) {
$interfaces = Doctrine::getTable('SipInterface')->findAll(Doctrine::HYDRATE_ARRAY);
foreach ($interfaces as $interface) {
$interfaceList[$interface['sipinterface_id']] = $interface['name'];
}
if (!empty($interfaceList)) {
$route_types[ExternalXfer::TYPE_SIP] = 'via SIP URI';
}
}
if (empty($route_types)) {
message::set('No Trunk or Sip Interfaces avaliable to route external destinations through!');
$this->returnQtipAjaxForm(NULL);
url::redirect(Router_Core::$controller);
}
if (empty($numbers)) {
message::set('No extensions available!');
$this->returnQtipAjaxForm(NULL);
url::redirect(Router_Core::$controller);
}
$this->view->trunks = $trunkList;
$this->view->interfaces = $interfaceList;
$this->view->route_types = $route_types;
parent::prepareUpdateView($baseModel);
}
示例15: create
public function create()
{
$reqPath = '';
if (isset($_POST['path']) and isset($_POST['newfolder'])) {
$reqPath = $_POST['path'];
$path = Media::getMediaPath() . $reqPath;
kohana::log('debug', 'Creating ' . $path . DIRECTORY_SEPARATOR . $_POST['newfolder']);
if ($this->createFolder($path . DIRECTORY_SEPARATOR . $_POST['newfolder'])) {
message::set('Folder created.');
url::redirect(Router_Core::$controller . '/index');
} else {
message::set('The path ' . $_POST['path'] . ' does not exist or could not be created! Does your web user have write access?');
}
}
plugins::views($this);
$this->view->soundPath = Media::getMediaPath();
$this->view->reqPath = $reqPath;
}