当前位置: 首页>>代码示例>>PHP>>正文


PHP Signal类代码示例

本文整理汇总了PHP中Signal的典型用法代码示例。如果您正苦于以下问题:PHP Signal类的具体用法?PHP Signal怎么用?PHP Signal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Signal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 <peter@osticket.com>
    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


注:本文中的Signal类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。