本文整理汇总了PHP中Signal类的典型用法代码示例。如果您正苦于以下问题:PHP Signal类的具体用法?PHP Signal怎么用?PHP Signal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Signal类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: bootstrap
public function bootstrap()
{
$config = $this->getConfig();
if ($config->get('ajax_submission_enable')) {
Signal::connect('ajax.client', ['AjaxPlugin', 'registerDispatch']);
}
}
开发者ID:kohenkatz,项目名称:OST-AJAX,代码行数:7,代码来源:ajax.php
示例2: signal
public function signal()
{
pcntl_signal(SIGHUP, function ($signo) {
//echo "\n This signal is called. [$signo] \n";
printf("The process has been reload.\n");
Signal::set($signo);
});
}
开发者ID:xingcuntian,项目名称:example,代码行数:8,代码来源:daemon.php
示例3: bootstrap
public function bootstrap()
{
if ($this->firstRun()) {
$this->install();
}
Signal::connect('apps.scp', array('EquipmentPlugin', 'callbackDispatch'));
$this->createStaffMenu();
}
开发者ID:flotwig,项目名称:osTicket-Equipment,代码行数:8,代码来源:equipment.php
示例4: decode
function decode()
{
$params = array('crlf' => "\r\n", 'charset' => $this->charset, 'include_bodies' => $this->include_bodies, 'decode_headers' => $this->decode_headers, 'decode_bodies' => $this->decode_bodies);
$info = array('raw' => &$this->mime_message);
Signal::send('mail.received', $this, $info);
$this->splitBodyHeader();
$decoder = new Mail_mimeDecode($this->mime_message);
$this->struct = $decoder->decode($params);
if (PEAR::isError($this->struct)) {
return false;
}
$info = array('raw_header' => &$this->header, 'headers' => &$this->struct->headers, 'body' => &$this->struct->parts, 'type' => $this->struct->ctype_primary . '/' . $this->struct->ctype_secondary, 'mail' => $this->struct, 'decoder' => $decoder);
// Allow signal handlers to interact with the processing
Signal::send('mail.decoded', $decoder, $info);
// Handle wrapped emails when forwarded
if ($this->struct && $this->struct->parts) {
$outer = $this->struct;
$ctype = $outer->ctype_primary . '/' . $outer->ctype_secondary;
if (strcasecmp($ctype, 'message/rfc822') === 0) {
// Capture Delivered-To header from the outer mail
$dt = $this->struct->headers['delivered-to'];
// Capture Message-Id from outer mail
$mid = $this->struct->headers['message-id'];
$this->struct = $outer->parts[0];
// Add (clobber) delivered to header from the outer mail
if ($dt) {
$this->struct->headers['delivered-to'] = $dt;
}
// Ensure the nested mail has a Message-Id
if (!isset($this->struct->headers['message-id'])) {
$this->struct->headers['message-id'] = $mid;
}
// Use headers of the wrapped message
$headers = array();
foreach ($this->struct->headers as $h => $v) {
$headers[mb_convert_case($h, MB_CASE_TITLE)] = $v;
}
$this->header = Format::array_implode(": ", "\n", $headers);
}
}
// Look for application/tnef attachment and process it
if ($this->struct && $this->struct->parts) {
foreach ($this->struct->parts as $i => $part) {
if (!@$part->parts && $part->ctype_primary == 'application' && $part->ctype_secondary == 'ms-tnef') {
try {
$tnef = new TnefStreamParser($part->body);
$this->tnef = $tnef->getMessage();
// No longer considered an attachment
unset($this->struct->parts[$i]);
} catch (TnefException $ex) {
// TNEF will remain an attachment
$this->notes[] = 'TNEF parsing exception: ' . $ex->getMessage();
}
}
}
}
return count($this->struct->headers) > 1;
}
开发者ID:gizur,项目名称:osticket,代码行数:58,代码来源:class.mailparse.php
示例5: bootstrap
function bootstrap()
{
if ($this->getConfig()->get('reindex', true)) {
Signal::connect('cron', array($this, 'IndexOldStuff'));
}
}
开发者ID:KM-MFG,项目名称:osTicket-1.8,代码行数:6,代码来源:class.search.php
示例6: sendResetEmail
function sendResetEmail($template = 'pwreset-staff', $log = true)
{
global $ost, $cfg;
$content = Page::lookup(Page::getIdByType($template));
$token = Misc::randCode(48);
// 290-bits
if (!$content) {
return new Error('Unable to retrieve password reset email template');
}
$vars = array('url' => $ost->getConfig()->getBaseUrl(), 'token' => $token, 'staff' => $this, 'recipient' => $this, 'reset_link' => sprintf("%s/scp/pwreset.php?token=%s", $ost->getConfig()->getBaseUrl(), $token));
$vars['link'] =& $vars['reset_link'];
if (!($email = $cfg->getAlertEmail())) {
$email = $cfg->getDefaultEmail();
}
$info = array('email' => $email, 'vars' => &$vars, 'log' => $log);
Signal::send('auth.pwreset.email', $this, $info);
if ($info['log']) {
$ost->logWarning(_S('Agent Password Reset'), sprintf(_S('Password reset was attempted for agent: %1$s<br><br>
Requested-User-Id: %2$s<br>
Source-Ip: %3$s<br>
Email-Sent-To: %4$s<br>
Email-Sent-Via: %5$s'), $this->getName(), $_POST['userid'], $_SERVER['REMOTE_ADDR'], $this->getEmail(), $email->getEmail()), false);
}
$msg = $ost->replaceTemplateVariables(array('subj' => $content->getName(), 'body' => $content->getBody()), $vars);
$_config = new Config('pwreset');
$_config->set($vars['token'], $this->getId());
$email->send($this->getEmail(), Format::striptags($msg['subj']), $msg['body']);
}
开发者ID:KingsleyGU,项目名称:osticket,代码行数:28,代码来源:class.staff.php
示例7: __construct
function __construct($json)
{
$this->id = $json->id;
$this->text = $json->text;
$this->signal = Signal::from_pronto($json->code);
}
开发者ID:smdern,项目名称:IRRemote,代码行数:6,代码来源:remotes.inc.php
示例8: install
//.........这里部分代码省略.........
elseif(!($fp = @fopen($this->getConfigFile(),'r+')))
$this->errors['err']=__('Unable to open config file for writing. Permission denied! (#3)');
else {
$streams = DatabaseMigrater::getUpgradeStreams(INCLUDE_DIR.'upgrader/streams/');
foreach ($streams as $stream=>$signature) {
$schemaFile = INC_DIR."streams/$stream/install-mysql.sql";
if (!file_exists($schemaFile) || !($fp2 = fopen($schemaFile, 'rb')))
$this->errors['err'] = sprintf(
__('%s: Internal Error - please make sure your download is the latest (#1)'),
$stream);
elseif (
// TODO: Make the hash algo configurable in the streams
// configuration ( core : md5 )
!($hash = md5(fread($fp2, filesize($schemaFile))))
|| strcasecmp($signature, $hash))
$this->errors['err'] = sprintf(
__('%s: Unknown or invalid schema signature (%s .. %s)'),
$stream,
$signature, $hash);
elseif (!$this->load_sql_file($schemaFile, $vars['prefix'], true, $debug))
$this->errors['err'] = sprintf(
__('%s: Error parsing SQL schema! Get help from developers (#4)'),
$stream);
}
}
if(!$this->errors) {
// TODO: Use language selected from install worksheet
$i18n = new Internationalization($vars['lang_id']);
$i18n->loadDefaultData();
Signal::send('system.install', $this);
$sql='SELECT `id` FROM '.TABLE_PREFIX.'sla ORDER BY `id` LIMIT 1';
$sla_id_1 = db_result(db_query($sql, false));
$sql='SELECT `dept_id` FROM '.TABLE_PREFIX.'department ORDER BY `dept_id` LIMIT 1';
$dept_id_1 = db_result(db_query($sql, false));
$sql='SELECT `tpl_id` FROM '.TABLE_PREFIX.'email_template_group ORDER BY `tpl_id` LIMIT 1';
$template_id_1 = db_result(db_query($sql, false));
$sql='SELECT `group_id` FROM '.TABLE_PREFIX.'groups ORDER BY `group_id` LIMIT 1';
$group_id_1 = db_result(db_query($sql, false));
$sql='SELECT `value` FROM '.TABLE_PREFIX.'config WHERE namespace=\'core\' and `key`=\'default_timezone_id\' LIMIT 1';
$default_timezone = db_result(db_query($sql, false));
//Create admin user.
$sql='INSERT INTO '.TABLE_PREFIX.'staff SET created=NOW() '
.", isactive=1, isadmin=1, group_id='$group_id_1', dept_id='$dept_id_1'"
.", timezone_id='$default_timezone', max_page_size=25"
.', email='.db_input($vars['admin_email'])
.', firstname='.db_input($vars['fname'])
.', lastname='.db_input($vars['lname'])
.', username='.db_input($vars['username'])
.', passwd='.db_input(Passwd::hash($vars['passwd']));
if(!db_query($sql, false) || !($uid=db_insert_id()))
$this->errors['err']=__('Unable to create admin user (#6)');
}
if(!$this->errors) {
//Create default emails!
$email = $vars['email'];
开发者ID:KingsleyGU,项目名称:osticket,代码行数:67,代码来源:class.installer.php
示例9: update
function update($vars, &$errors)
{
global $cfg;
$rtoken = $_SESSION['_client']['reset-token'];
if ($vars['passwd1'] || $vars['passwd2'] || $vars['cpasswd'] || $rtoken) {
if (!$vars['passwd1']) {
$errors['passwd1'] = __('New password is required');
} elseif ($vars['passwd1'] && strlen($vars['passwd1']) < 6) {
$errors['passwd1'] = __('Password must be at least 6 characters');
} elseif ($vars['passwd1'] && strcmp($vars['passwd1'], $vars['passwd2'])) {
$errors['passwd2'] = __('Passwords do not match');
}
if ($rtoken) {
$_config = new Config('pwreset');
if ($_config->get($rtoken) != $this->getUserId()) {
$errors['err'] = __('Invalid reset token. Logout and try again');
} elseif (!($ts = $_config->lastModified($rtoken)) && $cfg->getPwResetWindow() < time() - strtotime($ts)) {
$errors['err'] = __('Invalid reset token. Logout and try again');
}
} elseif ($this->get('passwd')) {
if (!$vars['cpasswd']) {
$errors['cpasswd'] = __('Current password is required');
} elseif (!$this->hasCurrentPassword($vars['cpasswd'])) {
$errors['cpasswd'] = __('Invalid current password!');
} elseif (!strcasecmp($vars['passwd1'], $vars['cpasswd'])) {
$errors['passwd1'] = __('New password MUST be different from the current password!');
}
}
}
if (!$vars['timezone_id']) {
$errors['timezone_id'] = __('Time zone selection is required');
}
if ($errors) {
return false;
}
$this->set('timezone_id', $vars['timezone_id']);
$this->set('dst', isset($vars['dst']) ? 1 : 0);
// Change language
$this->set('lang', $vars['lang'] ?: null);
$_SESSION['client:lang'] = null;
TextDomain::configureForUser($this);
if ($vars['backend']) {
$this->set('backend', $vars['backend']);
if ($vars['username']) {
$this->set('username', $vars['username']);
}
}
if ($vars['passwd1']) {
$this->set('passwd', Passwd::hash($vars['passwd1']));
$info = array('password' => $vars['passwd1']);
Signal::send('auth.pwchange', $this->getUser(), $info);
$this->cancelResetTokens();
$this->clearStatus(UserAccountStatus::REQUIRE_PASSWD_RESET);
}
return $this->save();
}
开发者ID:gizur,项目名称:osticket,代码行数:56,代码来源:class.client.php
示例10: Copyright
Peter Rotich <[email protected]>
Copyright (c) 2006-2013 osTicket
http://www.osticket.com
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
# Override staffLoginPage() defined in staff.inc.php to return an
# HTTP/Forbidden status rather than the actual login page.
# XXX: This should be moved to the AjaxController class
function staffLoginPage($msg = 'Unauthorized')
{
Http::response(403, 'Must login: ' . Format::htmlchars($msg));
exit;
}
require 'staff.inc.php';
//Clean house...don't let the world see your crap.
ini_set('display_errors', '0');
//Disable error display
ini_set('display_startup_errors', '0');
//TODO: disable direct access via the browser? i,e All request must have REFER?
if (!defined('INCLUDE_DIR')) {
Http::response(500, 'Server configuration error');
}
require_once INCLUDE_DIR . '/class.dispatcher.php';
$dispatcher = new Dispatcher();
Signal::send('apps.scp', $dispatcher);
# Call the respective function
print $dispatcher->resolve($ost->get_path_info());
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:31,代码来源:dispatcher.php
示例11: bootstrap
function bootstrap()
{
Signal::connect('model.created', array($this, 'onTicketCreated'), 'Ticket');
Signal::connect('model.created', array($this, 'onThreadEntryCreated'), 'ThreadEntry');
}
开发者ID:tuudik,项目名称:osticket-rocketchat,代码行数:5,代码来源:rocketchat.php
示例12: ob_end_clean
if ($sec < 180 || !$ost || $ost->isUpgradePending())
ob_end_clean();
require_once(INCLUDE_DIR.'class.cron.php');
// Clear staff obj to avoid false credit internal notes & auto-assignment
$thisstaff = null;
// Release the session to prevent locking a future request while this is
// running
$_SESSION['lastcroncall'] = time();
session_write_close();
// Age tickets: We're going to age tickets regardless of cron settings.
Cron::TicketMonitor();
// Run file purging about every 20 cron runs (1h40 on a five minute cron)
if (mt_rand(1, 20) == 4)
Cron::CleanOrphanedFiles();
if($cfg && $cfg->isAutoCronEnabled()) { //ONLY fetch tickets if autocron is enabled!
Cron::MailFetcher(); //Fetch mail.
$ost->logDebug(_S('Auto Cron'), sprintf(_S('Mail fetcher cron call [%s]'), $caller));
}
$data = array('autocron'=>true);
Signal::send('cron', $data);
ob_end_clean();
?>
开发者ID:KingsleyGU,项目名称:osticket,代码行数:30,代码来源:autocron.php
示例13: array
}
$source = @$r['0'];
$target = @$r['1'];
$relations = array();
for ($i0 = 0; isset($r['2.' . $i0]); $i0++) {
$relations[$i0] = @$r['2.' . $i0 . ''];
}
$explanation = @$r['3'];
$previous = @$r['4'];
$next = @$r['5'];
$pattern = @$r['6'];
$contains = array();
for ($i0 = 0; isset($r['7.' . $i0]); $i0++) {
$contains[$i0] = @$r['7.' . $i0 . ''];
}
$Signal = new Signal($ID, $source, $target, $relations, $explanation, $previous, $next, $pattern, $contains);
if ($Signal->save() !== false) {
die('ok:' . serviceref($_REQUEST['content']) . '&Signal=' . urlencode($Signal->getId()));
} else {
die('Please fix errors!');
}
exit;
// do not show the interface
}
$buttons = "";
if (isset($_REQUEST['new'])) {
$new = true;
} else {
$new = false;
}
if (isset($_REQUEST['edit']) || $new) {
开发者ID:4ZP6Capstone2015,项目名称:ampersand-models,代码行数:31,代码来源:Signal.php
示例14: sendResetEmail
function sendResetEmail()
{
global $ost, $cfg;
if (!($tpl = $this->getDept()->getTemplate())) {
$tpl = $ost->getConfig()->getDefaultTemplate();
}
$token = Misc::randCode(48);
// 290-bits
if (!($template = $tpl->getMsgTemplate('staff.pwreset'))) {
return new Error('Unable to retrieve password reset email template');
}
$vars = array('url' => $ost->getConfig()->getBaseUrl(), 'token' => $token, 'reset_link' => sprintf("%s/scp/pwreset.php?token=%s", $ost->getConfig()->getBaseUrl(), $token));
if (!($email = $cfg->getAlertEmail())) {
$email = $cfg->getDefaultEmail();
}
$info = array('email' => $email, 'vars' => &$vars);
Signal::send('auth.pwreset.email', $this, $info);
$msg = $ost->replaceTemplateVariables($template->asArray(), $vars);
$_config = new Config('pwreset');
$_config->set($vars['token'], $this->getId());
$email->send($this->getEmail(), $msg['subj'], $msg['body']);
}
开发者ID:pkdevboxy,项目名称:osTicket-1.7,代码行数:22,代码来源:class.staff.php
示例15: getTtfFonts
static function getTtfFonts()
{
if (!class_exists('Phar')) {
return;
}
$fonts = $subs = array();
foreach (self::availableLanguages() as $code => $info) {
if (!$info['phar'] || !isset($info['fonts'])) {
continue;
}
foreach ($info['fonts'] as $simple => $collection) {
foreach ($collection as $type => $name) {
list($name, $url) = $name;
$ttffile = 'phar://' . $info['path'] . '/fonts/' . $name;
if (file_exists($ttffile)) {
$fonts[$simple][$type] = $ttffile;
}
}
if (@$collection[':sub']) {
$subs[] = $simple;
}
}
}
$rv = array($fonts, $subs);
Signal::send('config.ttfonts', null, $rv);
return $rv;
}
开发者ID:KingsleyGU,项目名称:osticket,代码行数:27,代码来源:class.i18n.php
示例16: fillGraph
/**
* Fill a lib's graph object.
*
* @param GraphCommons\Graph\Graph $graph
* @param array|object $g
* @return GraphCommons\Graph\Graph
*/
private final function fillGraph(Graph $graph, $g) : Graph
{
// force input being an object
$g = Util::toObject($g);
if (isset($g->id)) {
$graph->setId($g->id)->setName($g->name)->setDescription($g->description)->setSubtitle($g->subtitle)->setStatus($g->status)->setCreatedAt($g->created_at);
// add signals if exists
if (isset($g->signals)) {
$array = [];
foreach ($g->signals as $i => $signal) {
$action = $signal->action;
unset($signal->action);
$array[$i]['action'] = Signal::detectAction($action);
$array[$i]['parameters'] = Util::toArray($signal);
}
$graph->setSignals(SignalCollection::fromArray($array));
}
}
return $graph;
}
开发者ID:graphcommons,项目名称:graphcommons-php7,代码行数:27,代码来源:GraphCommonsApi.php
示例17: create
static function create($vars, &$errors, $origin, $autorespond = true, $alertstaff = true)
{
global $ost, $cfg, $thisclient, $_FILES;
// Don't enforce form validation for email
$field_filter = function ($type) use($origin) {
return function ($f) use($origin, $type) {
// Ultimately, only offer validation errors for web for
// non-internal fields. For email, no validation can be
// performed. For other origins, validate as usual
switch (strtolower($origin)) {
case 'email':
return false;
case 'staff':
// Required 'Contact Information' fields aren't required
// when staff open tickets
return $type != 'user' || in_array($f->get('name'), array('name', 'email'));
case 'web':
return !$f->get('private');
default:
return true;
}
};
};
$reject_ticket = function ($message) use(&$errors) {
global $ost;
$errors = array('errno' => 403, 'err' => __('This help desk is for use by authorized users only'));
$ost->logWarning(_S('Ticket Denied'), $message, false);
return 0;
};
Signal::send('ticket.create.before', null, $vars);
// Create and verify the dynamic form entry for the new ticket
$form = TicketForm::getNewInstance();
$form->setSource($vars);
// If submitting via email or api, ensure we have a subject and such
if (!in_array(strtolower($origin), array('web', 'staff'))) {
foreach ($form->getFields() as $field) {
$fname = $field->get('name');
if ($fname && isset($vars[$fname]) && !$field->value) {
$field->value = $field->parse($vars[$fname]);
}
}
}
if (!$form->isValid($field_filter('ticket'))) {
$errors += $form->errors();
}
if ($vars['uid']) {
$user = User::lookup($vars['uid']);
}
$id = 0;
$fields = array();
$fields['message'] = array('type' => '*', 'required' => 1, 'error' => __('Message content is required'));
switch (strtolower($origin)) {
case 'web':
$fields['topicId'] = array('type' => 'int', 'required' => 1, 'error' => __('Select a help topic'));
break;
case 'staff':
$fields['deptId'] = array('type' => 'int', 'required' => 0, 'error' => __('Department selection is required'));
$fields['topicId'] = array('type' => 'int', 'required' => 1, 'error' => __('Help topic selection is required'));
$fields['duedate'] = array('type' => 'date', 'required' => 0, 'error' => __('Invalid date format - must be MM/DD/YY'));
case 'api':
$fields['source'] = array('type' => 'string', 'required' => 1, 'error' => __('Indicate ticket source'));
break;
case 'email':
$fields['emailId'] = array('type' => 'int', 'required' => 1, 'error' => __('Unknown system email'));
break;
default:
# TODO: Return error message
$errors['err'] = $errors['origin'] = __('Invalid ticket origin given');
}
if (!Validator::process($fields, $vars, $errors) && !$errors['err']) {
$errors['err'] = __('Missing or invalid data - check the errors and try again');
}
//Make sure the due date is valid
if ($vars['duedate']) {
if (!$vars['time'] || strpos($vars['time'], ':') === false) {
$errors['time'] = __('Select a time from the list');
} elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) === false) {
$errors['duedate'] = __('Invalid due date');
} elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) <= time()) {
$errors['duedate'] = __('Due date must be in the future');
}
}
if (!$errors) {
# Perform ticket filter actions on the new ticket arguments
$__form = null;
if ($vars['topicId']) {
if (($__topic = Topic::lookup($vars['topicId'])) && ($__form = $__topic->getForm())) {
$__form = $__form->instanciate();
$__form->setSource($vars);
}
}
try {
$vars = self::filterTicketData($origin, $vars, array($form, $__form), $user);
} catch (RejectedException $ex) {
return $reject_ticket(sprintf(_S('Ticket rejected (%s) by filter "%s"'), $ex->vars['email'], $ex->getRejectingFilter()->getName()));
}
//Make sure the open ticket limit hasn't been reached. (LOOP CONTROL)
if ($cfg->getMaxOpenTickets() > 0 && strcasecmp($origin, 'staff') && ($_user = TicketUser::lookupByEmail($vars['email'])) && ($openTickets = $_user->getNumOpenTickets()) && $openTickets >= $cfg->getMaxOpenTickets()) {
$errors = array('err' => __("You've reached the maximum open tickets allowed."));
$ost->logWarning(sprintf(_S('Ticket denied - %s'), $vars['email']), sprintf(_S('Max open tickets (%1$d) reached for %2$s'), $cfg->getMaxOpenTickets(), $vars['email']), false);
//.........这里部分代码省略.........
开发者ID:gizur,项目名称:osticket,代码行数:101,代码来源:class.ticket.php
示例18: save
function save($id, $vars, &$errors, $validation = false)
{
//Cleanup.
$vars['question'] = Format::striptags(trim($vars['question']));
//validate
if ($id && $id != $vars['id']) {
$errors['err'] = __('Internal error. Try again');
}
if (!$vars['question']) {
$errors['question'] = __('Question required');
} elseif (($qid = self::findIdByQuestion($vars['question'])) && $qid != $id) {
$errors['question'] = __('Question already exists');
}
if (!$vars['category_id'] || !($category = Category::lookup($vars['category_id']))) {
$errors['category_id'] = __('Category is required');
}
if (!$vars['answer']) {
$errors['answer'] = __('FAQ answer is required');
}
if ($errors || $validation) {
return !$errors;
}
//save
$sql = ' updated=NOW() ' . ', question=' . db_input($vars['question']) . ', answer=' . db_input(Format::sanitize($vars['answer'], false)) . ', category_id=' . db_input($vars['category_id']) . ', ispublished=' . db_input(isset($vars['ispublished']) ? $vars['ispublished'] : 0) . ', notes=' . db_input(Format::sanitize($vars['notes']));
if ($id) {
$sql = 'UPDATE ' . FAQ_TABLE . ' SET ' . $sql . ' WHERE faq_id=' . db_input($id);
if (db_query($sql)) {
return true;
}
$errors['err'] = sprintf(__('Unable to update %s.'), __('this FAQ article'));
} else {
$sql = 'INSERT INTO ' . FAQ_TABLE . ' SET ' . $sql . ',created=NOW()';
if (db_query($sql) && ($id = db_insert_id())) {
Signal::send('model.created', FAQ::lookup($id));
return $id;
}
$errors['err'] = sprintf(__('Unable to create %s.'), __('this FAQ article')) . ' ' . __('Internal error occurred');
}
return false;
}
开发者ID:CarlosAvilesMx,项目名称:CarlosAviles.Mx,代码行数:40,代码来源:class.faq.php
示例19: dump
function dump($error_stream)
{
// Allow plugins to change the tables exported
Signal::send('export.tables', $this, $this->tables);
$this->dump_header();
foreach ($this->tables as $t) {
if ($error_stream) {
$error_stream->write("{$t}\n");
}
// Inspect schema
$table = array();
$res = db_query("select column_name from information_schema.columns\n where table_schema=DATABASE() and table_name='{$t}'");
while (list($field) = db_fetch_row($res)) {
$table[] = $field;
}
if (!$table) {
if ($error_stream) {
$error_stream->write($t . ': Cannot export table with no fields' . "\n");
}
die;
}
$this->write_block(array('table', substr($t, strlen(TABLE_PREFIX)), $table));
db_query("select * from {$t}");
// Dump row data
while ($row = db_fetch_row($res)) {
$this->write_block($row);
}
$this->write_block(array('end-table'));
}
}
开发者ID:ed00m,项目名称:osTicket-1.8,代码行数:30,代码来源:class.export.php
示例20: run
function run()
{
//called by outside cron NOT autocron
global $ost;
if (!$ost || $ost->isUpgradePending()) {
return;
}
self::MailFetcher();
self::TicketMonitor();
self::PurgeLogs();
// Run file purging about every 10 cron runs
if (mt_rand(1, 9) == 4) {
self::CleanOrphanedFiles();
}
self::PurgeDrafts();
self::MaybeOptimizeTables();
$data = array('autocron' => false);
Signal::send('cron', $data);
}
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:19,代码来源:class.cron.php
注:本文中的Signal类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论