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


PHP Horde::log方法代码示例

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


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

示例1: getPrefix

 /**
  * Generate a prefix for the History system for the given Kolab data.
  *
  * @param  Horde_Kolab_Storage_Data $data  The data object.
  *
  * @return string  The History prefix.
  */
 public static function getPrefix(Horde_Kolab_Storage_Data $data)
 {
     $app = self::_type2app($data->getType());
     if (empty($app)) {
         Horde::log(sprintf('Unsupported app type: %s', $data->getType()), 'WARN');
         return false;
     }
     // Determine share id
     $user = $data->getAuth();
     $folder = $data->getPath();
     $share_id = '';
     $all_shares = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Share')->create($app)->listAllShares();
     foreach ($all_shares as $id => $share) {
         if ($folder == $share->get('folder')) {
             $share_id = $id;
             break;
         }
     }
     // Bail out if we are unable to determine the share id.
     if (empty($share_id)) {
         Horde::log(sprintf('HISTORY: share_id not found. Can\'t compute history prefix for user: %s, folder: %s', $user, $folder), 'WARN');
         return false;
     }
     return $app . ':' . $share_id . ':';
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:32,代码来源:HistoryPrefix.php

示例2: _getOtherGalleries

 /**
  * Build the HTML for the other galleries widget content.
  *
  * @param Horde_View $view  The view object.
  */
 protected function _getOtherGalleries(&$view)
 {
     $owner = $this->_view->gallery->get('owner');
     // Set up the tree
     $tree = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Tree')->create('otherAnselGalleries_' . md5($owner), 'Javascript', array('class' => 'anselWidgets'));
     try {
         $galleries = $GLOBALS['injector']->getInstance('Ansel_Storage')->listGalleries(array('attributes' => $owner));
     } catch (Ansel_Exception $e) {
         Horde::log($e, 'ERR');
         return;
     }
     foreach ($galleries as $gallery) {
         $parents = $gallery->get('parents');
         if (empty($parents)) {
             $parent = null;
         } else {
             $parents = explode(':', $parents);
             $parent = array_pop($parents);
         }
         $img = (string) Ansel::getImageUrl($gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')), 'mini', true);
         $link = Ansel::getUrlFor('view', array('gallery' => $gallery->id, 'slug' => $gallery->get('slug'), 'view' => 'Gallery'), true);
         $tree->addNode(array('id' => $gallery->id, 'parent' => $parent, 'label' => $gallery->get('name'), 'expanded' => $gallery->id == $this->_view->gallery->id, 'params' => array('icon' => $img, 'url' => $link)));
     }
     Horde::startBuffer();
     $tree->sort('label');
     $tree->renderTree();
     $view->tree = Horde::endBuffer();
     $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('Ansel_Ajax_Imple_ToggleOtherGalleries', array('id' => 'othergalleries-toggle'));
 }
开发者ID:horde,项目名称:horde,代码行数:34,代码来源:OtherGalleries.php

示例3: html

 /**
  * Return the HTML representing this widget.
  *
  * @return string  The HTML for this widget.
  */
 public function html()
 {
     if (!$GLOBALS['conf']['faces']['driver']) {
         return '';
     }
     $this->_faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
     $this->_owner = $this->_view->gallery->get('owner');
     try {
         $this->_count = $this->_faces->countOwnerFaces($this->_owner);
     } catch (Ansel_Exception $e) {
         Horde::log($e->getMessage(), 'ERR');
         $this->_count = 0;
     }
     if (empty($this->_count)) {
         return null;
     }
     $this->_title = Horde::url('faces/search/owner.php')->add('owner', $this->_owner)->link() . sprintf(_("People in galleries owned by %s (%d of %d)"), $this->_owner, min(12, $this->_count), number_format($this->_count)) . '</a>';
     $html = $this->_htmlBegin();
     $results = $this->_faces->ownerFaces($this->_owner, 0, 12, true);
     $html .= '<div style="display: block' . ';background:' . $this->_style->background . ';width:100%;max-height:300px;overflow:auto;" id="faces_widget_content" >';
     foreach ($results as $face) {
         $facename = htmlspecialchars($face['face_name']);
         $html .= '<a href="' . Ansel_Faces::getLink($face) . '" title="' . $facename . '">' . '<img src="' . $this->_faces->getFaceUrl($face['image_id'], $face['face_id'], 'mini') . '" style="padding-bottom: 5px; padding-left: 5px" alt="' . $facename . '" /></a>';
     }
     return $html . '</div>' . $this->_htmlEnd();
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:OwnerFaces.php

示例4: _initOb

 /**
  */
 protected function _initOb($params)
 {
     global $injector;
     $this->_params = $params;
     switch ($this->_params['driver']) {
         case 'cache':
             $ob = new Horde_Imap_Client_Cache_Backend_Cache(array_filter(array('cacheob' => $injector->getInstance('Horde_Cache'), 'lifetime' => isset($this->_params['lifetime']) ? $this->_params['lifetime'] : null)));
             break;
         case 'hashtable':
             $ob = new Horde_Imap_Client_Cache_Backend_Hashtable(array_filter(array('hashtable' => $injector->getInstance('Horde_HashTable'), 'lifetime' => isset($this->_params['lifetime']) ? $this->_params['lifetime'] : null)));
             break;
         case 'none':
             $ob = new Horde_Imap_Client_Cache_Backend_Null();
             break;
         case 'nosql':
             $ob = new Horde_Imap_Client_Cache_Backend_Mongo(array('mongo_db' => $injector->getInstance('Horde_Nosql_Adapter')));
             break;
         case 'sql':
             $ob = new Horde_Imap_Client_Cache_Backend_Db(array('db' => $injector->getInstance('Horde_Db_Adapter')));
             break;
         default:
             $this->_params['driver'] = 'none';
             Horde::log('IMAP caching has been disabled for this session due to an error', 'WARN');
             $ob = new Horde_Imap_Client_Cache_Backend_Null();
             break;
     }
     $this->backend = $ob;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:30,代码来源:Wrapper.php

示例5: _loadFB

 /**
  * Load FB content
  */
 private function _loadFB()
 {
     if ($this->_fb) {
         return true;
     }
     if (!$conf['facebook']['enabled']) {
         $this->_fb = PEAR::raiseError(_("No Facebook integration exists."));
         return false;
     }
     // Check FB user config
     $fbp = unserialize($prefs->getValue('facebook'));
     if (!$fbp || empty($fbp['uid'])) {
         $this->_fb = PEAR::raiseError(_("User has no link."));
         return false;
     }
     try {
         $facebook = $GLOBALS['injector']->getInstance('Horde_Service_Facebook');
     } catch (Horde_Exception $e) {
         $error = PEAR::raiseError($e->getMessage(), $e->getCode());
         Horde::log($error, 'ERR');
         return $error;
     }
     $this->_fb->auth->setUser($fbp['uid'], $fbp['sid'], 0);
     return true;
 }
开发者ID:horde,项目名称:horde,代码行数:28,代码来源:facebook.php

示例6: logout

 public function logout()
 {
     $entry = sprintf('User %s [%s] logged out of Horde', $GLOBALS['registry']->getAuth(), $_SERVER['REMOTE_ADDR']);
     Horde::log($entry, 'NOTICE');
     $GLOBALS['registry']->clearAuth();
     $this->urlFor(array('controller' => 'index', 'action' => 'login'))->redirect();
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:7,代码来源:IndexController.php

示例7: uploadNotification

 /**
  */
 public function uploadNotification()
 {
     global $conf, $injector, $prefs, $registry;
     $gallery = $injector->getInstance('Ansel_Storage')->getGallery($this->vars->g);
     switch ($this->vars->s) {
         case 'twitter':
             $url = Ansel::getUrlFor('view', array('view' => 'Gallery', 'gallery' => $gallery->id), true);
             if (!empty($conf['urlshortener'])) {
                 try {
                     $url = $injector->getInstance('Horde_Service_UrlShortener')->shorten($url->setRaw(true));
                 } catch (Horde_Service_UrlShortener_Exception $e) {
                     Horde::log($e, 'ERR');
                     header('HTTP/1.1 500');
                 }
             }
             $text = sprintf(_("New images uploaded to %s. %s"), $gallery->get('name'), $url);
             $token = unserialize($prefs->getValue('twitter'));
             if (empty($token['key']) && empty($token['secret'])) {
                 $pref_link = $registry->getServiceLink('prefs', 'horde')->add('group', 'twitter')->link();
                 throw new Ansel_Exception(sprintf(_("You have not properly connected your Twitter account with Horde. You should check your Twitter settings in your %s."), $pref_link . _("preferences") . '</a>'));
             }
             $twitter = $injector->getInstance('Horde_Service_Twitter');
             $auth_token = new Horde_Oauth_Token($token['key'], $token['secret']);
             $twitter->auth->setToken($auth_token);
             try {
                 return $twitter->statuses->update($text);
             } catch (Horde_Service_Twitter_Exception $e) {
                 Horde::log($e, 'ERR');
                 header('HTTP/1.1 500');
             }
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:34,代码来源:Handler.php

示例8: gc

 /**
  */
 public function gc()
 {
     global $registry;
     if (empty($this->_params['lifetime'])) {
         return;
     }
     /* Keep a file in the static directory that prevents us from doing
      * garbage collection more than once a day. */
     $curr_time = time();
     $static_dir = $registry->get('fileroot', 'horde') . '/static';
     $static_stat = $static_dir . '/gc_cachecss';
     $next_run = !is_readable($static_stat) ?: @file_get_contents($static_stat);
     if (!$next_run || $curr_time > $next_run) {
         file_put_contents($static_stat, $curr_time + 86400);
     }
     if (!$next_run || $curr_time < $next_run) {
         return;
     }
     $curr_time -= $this->_params['lifetime'];
     $removed = 0;
     foreach (glob($static_dir . '/*.css') as $file) {
         if ($curr_time > filemtime($file)) {
             @unlink($file);
             ++$removed;
         }
     }
     Horde::log(sprintf('Cleaned out static CSS files (removed %d file(s)).', $removed), 'DEBUG');
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:30,代码来源:File.php

示例9: execute

 /**
  * @throws Turba_Exception
  */
 public function execute()
 {
     // If cancel was clicked, return false.
     if ($this->_vars->get('submitbutton') == _("Cancel")) {
         Horde::url('', true)->redirect();
     }
     if (!$GLOBALS['registry']->getAuth() || $this->_addressbook->get('owner') != $GLOBALS['registry']->getAuth()) {
         throw new Turba_Exception(_("You do not have permissions to delete this address book."));
     }
     $driver = $GLOBALS['injector']->getInstance('Turba_Factory_Driver')->create($this->_addressbook->getName());
     if ($driver->hasCapability('delete_all')) {
         try {
             $driver->deleteAll();
         } catch (Turba_Exception $e) {
             Horde::log($e->getMessage(), 'ERR');
             throw $e;
         }
     }
     // Address book successfully deleted from backend, remove the share.
     try {
         $GLOBALS['injector']->getInstance('Turba_Shares')->removeShare($this->_addressbook);
     } catch (Horde_Share_Exception $e) {
         Horde::log($e->getMessage(), 'ERR');
         throw new Turba_Exception($e);
     }
     if ($GLOBALS['session']->get('turba', 'source') == Horde_Util::getFormData('deleteshare')) {
         $GLOBALS['session']->remove('turba', 'source');
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:32,代码来源:DeleteAddressBook.php

示例10: execute

 /**
  * Purge completed tasks that were completed before the configured date.
  *
  * @return boolean  Whether any messages were purged from the mailbox.
  */
 public function execute()
 {
     global $injector, $prefs;
     /* Get the current UNIX timestamp minus the number of days specified
      * in 'purge_completed_keep'.  If a task has a timestamp prior to
      * this value, it will be deleted. */
     $del_time = new Horde_Date($_SERVER['REQUEST_TIME'] - $prefs->getValue('purge_completed_keep') * 86400);
     $del_time = $del_time->timestamp();
     $tasklists = Nag::listTasklists(true, Horde_Perms::DELETE, false);
     $tasks = Nag::listTasks(array('completed' => Nag::VIEW_COMPLETE, 'tasklists' => array_keys($tasklists)));
     $factory = $GLOBALS['injector']->getInstance('Nag_Factory_Driver');
     $count = 0;
     $tasks->reset();
     while ($task = $tasks->each()) {
         if ($task->completed_date && $task->completed_date < $del_time || !$task->completed_date && $task->modified && $task->modified->timestamp() < $del_time) {
             try {
                 $factory->create($task->tasklist)->delete($task->id);
                 ++$count;
             } catch (Nag_Exception $e) {
                 Horde::log($e->getMessage(), 'ERR');
             }
         }
     }
     $GLOBALS['notification']->push(sprintf(ngettext("Purging %d completed task.", "Purging %d completed tasks.", $count), $count), 'horde.message');
     return true;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:31,代码来源:PurgeCompleted.php

示例11: log

 /**
  * Log error message.
  *
  * @param string $level  Level to log at.
  *
  * @return boolean  True if message was logged.
  */
 public function log($level = 'ERR')
 {
     if ($this->logged) {
         return false;
     }
     Horde::log($this, $level);
     $this->logged = true;
     return true;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:16,代码来源:Exception.php

示例12: quota

 /**
  * Returns data needed to output quota.
  *
  * @param string $mailbox  Mailbox to query.
  * @param boolean $force   If true, ignore 'interval' config option and
  *                         force quota display.
  *
  * @return array|boolean  Array with these keys: class, message, percent.
  *                        Returns false if no updated quota information.
  */
 public function quota($mailbox = null, $force = true)
 {
     global $injector, $session;
     $qconfig = $injector->getInstance('IMP_Factory_Imap')->create()->config->quota;
     if (!$qconfig) {
         return false;
     }
     $qlist = array();
     if (!is_null($mailbox)) {
         $mailbox = IMP_Mailbox::get($mailbox);
         if ($mailbox->nonimap) {
             return false;
         }
         if (!$force) {
             $qlist = $session->get('imp', self::SESSION_INTERVAL_KEY, $session::TYPE_ARRAY);
             if (isset($qlist[strval($mailbox)]) && time() < $qlist[strval($mailbox)]) {
                 return false;
             }
         }
     }
     try {
         $quotaDriver = $injector->getInstance('IMP_Quota');
         $quota = $quotaDriver->getQuota($mailbox);
     } catch (IMP_Exception $e) {
         Horde::log($e, 'ERR');
         return false;
     }
     $qlist[strval($mailbox)] = $qconfig['params']['interval'] + time();
     $session->set('imp', self::SESSION_INTERVAL_KEY, $qlist);
     if (empty($quota)) {
         return false;
     }
     $strings = $quotaDriver->getMessages();
     list($calc, $unit) = $quotaDriver->getUnit();
     $ret = array('class' => '', 'percent' => 0);
     if ($quota['limit'] != 0) {
         $quota['usage'] = $quota['usage'] / $calc;
         $quota['limit'] = $quota['limit'] / $calc;
         $ret['percent'] = $quota['usage'] * 100 / $quota['limit'];
         if ($ret['percent'] >= 90) {
             $ret['class'] = 'quotaalert';
         } elseif ($ret['percent'] >= 75) {
             $ret['class'] = 'quotawarn';
         }
         $ret['message'] = sprintf($strings['short'], $ret['percent'], $quota['limit'], $unit);
         $ret['percent'] = sprintf("%.2f", $ret['percent']);
     } elseif ($quotaDriver->isHiddenWhenUnlimited()) {
         return false;
     } elseif ($quota['usage'] != 0) {
         $quota['usage'] = $quota['usage'] / $calc;
         $ret['message'] = sprintf($strings['nolimit_short'], $quota['usage'], $unit);
     } else {
         $ret['message'] = _("No limit");
     }
     return $ret;
 }
开发者ID:horde,项目名称:horde,代码行数:66,代码来源:Ui.php

示例13: _handleAutoCompleter

 /**
  */
 protected function _handleAutoCompleter($input)
 {
     $locs = array();
     try {
         $locs = $GLOBALS['injector']->getInstance('Ansel_Storage')->searchLocations($input);
     } catch (Ansel_Exception $e) {
         Horde::log($e, 'ERR');
     }
     return $locs;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:12,代码来源:LocationAutoCompleter.php

示例14: validateAuth

 /**
  * Checks for triggers that may invalidate the current auth.
  * These triggers are independent of the credentials.
  *
  * @return boolean  True if the results of authenticate() are still valid.
  */
 public function validateAuth()
 {
     if (!empty($_SERVER[$this->getParam('username_header')]) && $this->_removeScope($_SERVER[$this->getParam('username_header')]) == $GLOBALS['registry']->getAuth('original')) {
         return true;
     }
     // Consider this a session expiration.
     $this->setError(Horde_Auth::REASON_SESSION);
     Horde::log('Shibboleth authentication expired for user ' . $GLOBALS['registry']->getAuth(), 'INFO');
     return false;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:16,代码来源:Shibboleth.php

示例15: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     global $conf;
     $this->active = false;
     if (!empty($conf['tos']['file'])) {
         if (file_exists($conf['tos']['file'])) {
             $this->active = true;
         } else {
             Horde::log('Terms of Service Agreement file was not found: ' . $conf['tos']['file'], 'ERR');
         }
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:15,代码来源:TosAgreement.php


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