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


PHP Logger::app方法代码示例

本文整理汇总了PHP中Logger::app方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::app方法的具体用法?PHP Logger::app怎么用?PHP Logger::app使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Logger的用法示例。


在下文中一共展示了Logger::app方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getIssueIDs

 public function getIssueIDs($options)
 {
     // Build the Sphinx client
     $this->sphinx->SetSortMode(SPH_SORT_RELEVANCE);
     //        $this->sphinx->SetWeights(array(1, 1));
     $this->sphinx->SetLimits(0, 500, 100000);
     $this->sphinx->SetArrayResult(true);
     if (empty($options['match_mode'])) {
         $options['match_mode'] = SPH_MATCH_ALL;
     }
     $this->sphinx->SetMatchMode($options['match_mode']);
     $this->sphinx->SetFilter('prj_id', array(Auth::getCurrentProject()));
     // TODO: Add support for selecting indexes to search
     $indexes = implode('; ', $this->getIndexes(Auth::getCurrentRole() > User::ROLE_CUSTOMER));
     if (isset($options['customer_id']) && !empty($options['customer_id'])) {
         $this->sphinx->SetFilter('customer_id', array($options['customer_id']));
     }
     $this->keywords = $options['keywords'];
     $this->match_mode = $options['match_mode'];
     $res = $this->sphinx->Query($options['keywords'], $indexes);
     // TODO: report these somehow back to the UI
     // probably easy to do with Logger framework (add new handler?)
     if (method_exists($this->sphinx, 'IsConnectError') && $this->sphinx->IsConnectError()) {
         Logger::app()->error('sphinx_fulltext_search: Network Error');
     }
     if ($this->sphinx->GetLastWarning()) {
         Logger::app()->warning('sphinx_fulltext_search: ' . $this->sphinx->GetLastWarning());
     }
     if ($this->sphinx->GetLastError()) {
         Logger::app()->error('sphinx_fulltext_search: ' . $this->sphinx->GetLastError());
     }
     $issue_ids = array();
     if (isset($res['matches'])) {
         foreach ($res['matches'] as $match_details) {
             // Variable translation
             $match_id = $match_details['id'];
             $issue_id = $match_details['attrs']['issue_id'];
             $weight = $match_details['weight'];
             $index_id = $match_details['attrs']['index_id'];
             // if sphinx returns 0 as a weight, make it one because it
             // did find a match in the result set
             if ($weight <= 0) {
                 $weight = 1;
             }
             $index_name = $this->getIndexNameByID($index_id);
             $this->matches[$issue_id][] = array('weight' => $weight, 'index' => $index_name, 'match_id' => $match_id);
             $issue_ids[] = $issue_id;
         }
     }
     return $issue_ids;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:51,代码来源:class.sphinx_fulltext_search.php

示例2: update

 /**
  * Method used to update the account details for a specific user.
  *
  * @param $usr_id
  * @param $data
  * @param bool $notify
  * @return  integer 1 if the update worked, -1 otherwise
  */
 public static function update($usr_id, $data, $notify = true)
 {
     // system account should not be updateable
     if ($usr_id == APP_SYSTEM_USER_ID) {
         return 1;
     }
     $params = array('usr_email' => $data['email']);
     if (isset($data['full_name'])) {
         $params['usr_full_name'] = $data['full_name'];
     }
     if (isset($data['grp_id'])) {
         $params['usr_grp_id'] = !empty($data['grp_id']) ? $data['grp_id'] : null;
     }
     if (isset($data['external_id'])) {
         $params['usr_external_id'] = $data['external_id'];
     }
     if (isset($data['par_code'])) {
         $params['usr_par_code'] = $data['par_code'];
     }
     $stmt = 'UPDATE
                 {{%user}}
              SET ' . DB_Helper::buildSet($params) . ' WHERE usr_id=?';
     $params[] = $usr_id;
     try {
         DB_Helper::getInstance()->query($stmt, $params);
     } catch (DbException $e) {
         return -1;
     }
     if (!empty($data['password'])) {
         try {
             self::updatePassword($usr_id, $data['password']);
         } catch (Exception $e) {
             Logger::app()->error($e);
             return -1;
         }
     }
     if (isset($data['role'])) {
         // update the project associations now
         $stmt = 'DELETE FROM
                     {{%project_user}}
                  WHERE
                     pru_usr_id=?';
         try {
             DB_Helper::getInstance()->query($stmt, array($usr_id));
         } catch (DbException $e) {
             return -1;
         }
         foreach ($data['role'] as $prj_id => $role) {
             if ($role < 1) {
                 continue;
             }
             $stmt = 'INSERT INTO
                         {{%project_user}}
                      (
                         pru_prj_id,
                         pru_usr_id,
                         pru_role
                      ) VALUES (
                         ?, ?, ?
                      )';
             try {
                 DB_Helper::getInstance()->query($stmt, array($prj_id, $usr_id, $role));
             } catch (DbException $e) {
                 return -1;
             }
         }
     }
     if ($notify == true) {
         if (!empty($data['password'])) {
             Notification::notifyUserPassword($usr_id, $data['password']);
         } else {
             Notification::notifyUserAccount($usr_id);
         }
     }
     return 1;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:84,代码来源:class.user.php

示例3: _sendEmail

 /**
  * Connects to the SMTP server and sends the queued message.
  *
  * @param   string $recipient The recipient of this message
  * @param   string $text_headers The full headers of this message
  * @param   string $body The full body of this message
  * @param   string $status The status of this message
  * @return  true, or a PEAR_Error object
  */
 private function _sendEmail($recipient, $text_headers, &$body, $status)
 {
     $header_names = Mime_Helper::getHeaderNames($text_headers);
     $_headers = self::_getHeaders($text_headers, $body);
     $headers = array();
     foreach ($_headers as $lowercase_name => $value) {
         // need to remove the quotes to avoid a parsing problem
         // on senders that have extended characters in the first
         // or last words in their sender name
         if ($lowercase_name == 'from') {
             $value = Mime_Helper::removeQuotes($value);
         }
         $value = Mime_Helper::encode($value);
         // add the quotes back
         if ($lowercase_name == 'from') {
             $value = Mime_Helper::quoteSender($value);
         }
         $headers[$header_names[$lowercase_name]] = $value;
     }
     // remove any Reply-To:/Return-Path: values from outgoing messages
     unset($headers['Reply-To']);
     unset($headers['Return-Path']);
     // mutt sucks, so let's remove the broken Mime-Version header and add the proper one
     if (in_array('Mime-Version', array_keys($headers))) {
         unset($headers['Mime-Version']);
         $headers['MIME-Version'] = '1.0';
     }
     $mail = Mail::factory('smtp', Mail_Helper::getSMTPSettings());
     $res = $mail->send($recipient, $headers, $body);
     if (Misc::isError($res)) {
         Logger::app()->error($res->getMessage(), array('debug' => $res->getDebugInfo()));
         return $res;
     }
     return true;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:44,代码来源:class.mail_queue.php

示例4: BadFunctionCallException

 * @license GNU General Public License, version 2 or later (GPL-2+)
 *
 * For the full copyright and license information,
 * please see the COPYING and AUTHORS files
 * that were distributed with this source code.
 */
require_once __DIR__ . '/../../init.php';
// handle ajax upload
// FIXME: no identity logged who added the file.
try {
    // check if logged in. if not, just give error
    if (!AuthCookie::hasAuthCookie()) {
        throw new BadFunctionCallException(ev_gettext('Must be logged in'));
    }
    if (!isset($_GET['file'])) {
        // TRANSLATORS: this is technical error and should not be displayed to end users
        throw new InvalidArgumentException(ev_gettext('No file argument'));
    }
    $file = (string) $_GET['file'];
    if (!isset($_FILES[$file])) {
        throw new InvalidArgumentException(ev_gettext('No files uploaded'));
    }
    $iaf_id = Attachment::addFiles($_FILES[$file]);
    $res = array('error' => 0, 'iaf_id' => $iaf_id);
} catch (Exception $e) {
    $code = $e->getCode();
    $res = array('error' => $code ? $code : -1, 'message' => $e->getMessage());
    Logger::app()->error($e);
}
header('Content-Type: application/json; charset=UTF-8');
echo json_encode($res);
开发者ID:dabielkabuto,项目名称:eventum,代码行数:31,代码来源:upload.php

示例5: getAuthBackend

 /**
  * @return Auth_Backend_Interface
  */
 public static function getAuthBackend()
 {
     /** @var Auth_Backend_Interface $instance */
     static $instance = false;
     if ($instance == false) {
         $class = APP_AUTH_BACKEND;
         // legacy: allow lowercase variants
         if (strtolower($class) == 'mysql_auth_backend') {
             $class = 'Mysql_Auth_Backend';
         } elseif (strtolower($class) == 'ldap_auth_backend') {
             $class = 'LDAP_Auth_Backend';
         }
         try {
             $instance = new $class();
         } catch (AuthException $e) {
             $message = "Unable to use auth backend '{$class}'";
             Logger::app()->critical($message, array('exception' => $e));
             if (APP_AUTH_BACKEND_ALLOW_FALLBACK != true) {
                 $tpl = new Template_Helper();
                 $tpl->setTemplate('authentication_error.tpl.html');
                 $tpl->assign('error_message', $e->getMessage());
                 $tpl->displayTemplate();
                 exit;
             }
             $instance = self::getFallBackAuthBackend();
         }
     }
     return $instance;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:32,代码来源:class.auth.php

示例6: save

 /**
  * Method used to save the setup options for the application.
  * The $options are merged with existing config and then saved.
  *
  * @param array $options Options to modify (does not need to be full setup)
  * @return integer 1 if the update worked, -1 or -2 otherwise
  */
 public static function save($options = array())
 {
     $config = self::set($options);
     try {
         $clone = clone $config;
         // save ldap config to separate file
         $ldap = $clone->ldap;
         unset($clone->ldap);
         self::saveConfig(APP_SETUP_FILE, $clone);
         if ($ldap) {
             self::saveConfig(APP_CONFIG_PATH . '/ldap.php', $ldap);
         }
     } catch (Exception $e) {
         $code = $e->getCode();
         Logger::app()->error($e);
         return $code ?: -1;
     }
     return 1;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:26,代码来源:class.setup.php

示例7: sendEmail

 /**
  * TODO: merge use of $options and $email arrays to just $email
  *
  * @param int $issue_id
  * @param string $type type of email
  * @param string $from
  * @param string $to
  * @param string $cc
  * @param string $subject
  * @param string $body
  * @param array $options optional parameters
  * - (int) parent_sup_id
  * - (array) iaf_ids attachment file ids
  * - (bool) add_unknown
  * - (bool) add_cc_to_ar
  * - (int) ema_id
  * @return int 1 if it worked, -1 otherwise
  */
 public static function sendEmail($issue_id, $type, $from, $to, $cc, $subject, $body, $options = array())
 {
     if ($to === null) {
         // BTW, $to = '' is ok
         Logger::app()->error('"To:" can not be NULL');
         return -1;
     }
     $parent_sup_id = isset($options['parent_sup_id']) ? $options['parent_sup_id'] : null;
     $iaf_ids = isset($options['iaf_ids']) ? (array) $options['iaf_ids'] : null;
     $add_unknown = isset($options['add_unknown']) ? (bool) $options['add_unknown'] : false;
     $add_cc_to_ar = isset($options['add_cc_to_ar']) ? (bool) $options['add_cc_to_ar'] : false;
     $ema_id = isset($options['ema_id']) ? (int) $options['ema_id'] : null;
     $current_usr_id = Auth::getUserID();
     $prj_id = Issue::getProjectID($issue_id);
     // if we are replying to an existing email, set the In-Reply-To: header accordingly
     $in_reply_to = $parent_sup_id ? self::getMessageIDByID($parent_sup_id) : false;
     // get ID of whoever is sending this.
     $sender_usr_id = User::getUserIDByEmail(Mail_Helper::getEmailAddress($from)) ?: false;
     // remove extra 'Re: ' from subject
     $subject = Mail_Helper::removeExcessRe($subject, true);
     $internal_only = false;
     $message_id = Mail_Helper::generateMessageID();
     // process any files being uploaded
     // from ajax upload, attachment file ids
     if ($iaf_ids) {
         // FIXME: is it correct to use sender from post data?
         $attach_usr_id = $sender_usr_id ?: $current_usr_id;
         Attachment::attachFiles($issue_id, $attach_usr_id, $iaf_ids, false, 'Attachment originated from outgoing email');
     }
     // hack needed to get the full headers of this web-based email
     $full_email = self::buildFullHeaders($issue_id, $message_id, $from, $to, $cc, $subject, $body, $in_reply_to, $iaf_ids);
     // email blocking should only be done if this is an email about an associated issue
     if ($issue_id) {
         $user_info = User::getNameEmail($current_usr_id);
         // check whether the current user is allowed to send this email to customers or not
         if (!self::isAllowedToEmail($issue_id, $user_info['usr_email'])) {
             // add the message body as a note
             $note = Mail_Helper::getCannedBlockedMsgExplanation() . $body;
             $note_options = array('full_message' => $full_email, 'is_blocked' => true);
             Note::insertNote($current_usr_id, $issue_id, $subject, $note, $note_options);
             $email_details = array('from' => $from, 'to' => $to, 'cc' => $cc, 'subject' => $subject, 'body' => &$body, 'message' => &$body, 'title' => $subject);
             Workflow::handleBlockedEmail($prj_id, $issue_id, $email_details, 'web');
             return 1;
         }
     }
     // only send a direct email if the user doesn't want to add the Cc'ed people to the notification list
     if (($add_unknown || Workflow::shouldAutoAddToNotificationList($prj_id)) && $issue_id) {
         // add the recipients to the notification list of the associated issue
         $recipients = array($to);
         $recipients = array_merge($recipients, self::getRecipientsCC($cc));
         foreach ($recipients as $address) {
             if ($address && !Notification::isIssueRoutingSender($issue_id, $address)) {
                 $actions = Notification::getDefaultActions($issue_id, $address, 'add_unknown_user');
                 Notification::subscribeEmail($current_usr_id, $issue_id, Mail_Helper::getEmailAddress($address), $actions);
             }
         }
     } else {
         // Usually when sending out emails associated to an issue, we would
         // simply insert the email in the table and call the Notification::notifyNewEmail() method,
         // but on this case we need to actually send the email to the recipients that are not
         // already in the notification list for the associated issue, if any.
         // In the case of replying to an email that is not yet associated with an issue, then
         // we are always directly sending the email, without using any notification list
         // functionality.
         if ($issue_id) {
             // send direct emails only to the unknown addresses, and leave the rest to be
             // catched by the notification list
             $from = Notification::getFixedFromHeader($issue_id, $from, 'issue');
             // build the list of unknown recipients
             if ($to) {
                 $recipients = array($to);
                 $recipients = array_merge($recipients, self::getRecipientsCC($cc));
             } else {
                 $recipients = self::getRecipientsCC($cc);
             }
             $unknowns = array();
             foreach ($recipients as $address) {
                 if (!Notification::isSubscribedToEmails($issue_id, $address)) {
                     $unknowns[] = $address;
                 }
             }
             if ($unknowns) {
//.........这里部分代码省略.........
开发者ID:dabielkabuto,项目名称:eventum,代码行数:101,代码来源:class.support.php

示例8: saveOutgoingEmailCopy

 /**
  * Method used to save a copy of the given email to a configurable address.
  *
  * @param   array $email The email to save.
  * @return bool
  */
 public static function saveOutgoingEmailCopy(&$email)
 {
     // check early: do we really want to save every outgoing email?
     $setup = Setup::get();
     $save_outgoing_email = !empty($setup['smtp']['save_outgoing_email']) && $setup['smtp']['save_outgoing_email'] == 'yes';
     if (!$save_outgoing_email || empty($setup['smtp']['save_address'])) {
         return false;
     }
     static $subjects = array();
     $hdrs =& $email['headers'];
     $body =& $email['body'];
     $issue_id = $email['maq_iss_id'];
     $sender_usr_id = $email['maq_usr_id'];
     // ok, now parse the headers text and build the assoc array
     $full_email = $hdrs . "\n\n" . $body;
     $structure = Mime_Helper::decode($full_email, false, false);
     $_headers =& $structure->headers;
     $header_names = Mime_Helper::getHeaderNames($hdrs);
     $headers = array();
     foreach ($_headers as $lowercase_name => $value) {
         // need to remove the quotes to avoid a parsing problem
         // on senders that have extended characters in the first
         // or last words in their sender name
         if ($lowercase_name == 'from') {
             $value = Mime_Helper::removeQuotes($value);
         }
         $value = Mime_Helper::encode($value);
         // add the quotes back
         if ($lowercase_name == 'from') {
             $value = Mime_Helper::quoteSender($value);
         }
         $headers[$header_names[$lowercase_name]] = $value;
     }
     // remove any Reply-To:/Return-Path: values from outgoing messages
     unset($headers['Reply-To']);
     unset($headers['Return-Path']);
     // prevent duplicate emails from being sent out...
     $subject = @$headers['Subject'];
     if (@in_array($subject, $subjects)) {
         return false;
     }
     // replace the To: header with the requested address
     $address = $setup['smtp']['save_address'];
     $headers['To'] = $address;
     // add specialized headers if they are not already added
     if (empty($headers['X-Eventum-Type'])) {
         $headers += self::getSpecializedHeaders($issue_id, $email['maq_type'], $sender_usr_id);
     }
     $params = self::getSMTPSettings();
     $mail = Mail::factory('smtp', $params);
     $res = $mail->send($address, $headers, $body);
     if (Misc::isError($res)) {
         Logger::app()->error($res->getMessage(), array('debug' => $res->getDebugInfo()));
     }
     $subjects[] = $subject;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:62,代码来源:class.mail_helper.php


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