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


PHP Horde::logMessage方法代码示例

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


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

示例1: _cacheError

/**
 * Output an error if no CID was specified or the data wasn't in the
 * cache.
 */
function _cacheError($cid = null)
{
    if (!is_null($cid)) {
        Horde::logMessage('CID ' . $cid . ' not found in the cache, unable to display.', __FILE__, __LINE__, PEAR_LOG_ERR);
    }
    exit;
}
开发者ID:Artea,项目名称:freebeer,代码行数:11,代码来源:cacheview.php

示例2: sprintf

    if ($auth->authenticate(Util::getPost('horde_user'), array('password' => Util::getPost('horde_pass')))) {
        $entry = sprintf('Login success for %s [%s] to Horde', Auth::getAuth(), $_SERVER['REMOTE_ADDR']);
        Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO);
        if ($url_param) {
            $url = Horde::url(Util::removeParameter($url_param, session_name()), true);
            $horde_url = Horde::applicationUrl($registry->getParam('webroot', 'horde') . '/index.php', true);
            $horde_url = Util::addParameter($horde_url, 'url', $url);
        } else {
            $horde_url = Horde::applicationUrl('index.php', true);
        }
        $horde_url = Util::addParameter($horde_url, 'frameset', Util::getFormData('frameset') ? 1 : 0);
        header('Location: ' . $horde_url);
        exit;
    } else {
        $entry = sprintf('FAILED LOGIN for %s [%s] to Horde', Util::getFormData('horde_user'), $_SERVER['REMOTE_ADDR']);
        Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_ERR);
        if ($conf['menu']['always'] && !Util::getFormData('framed')) {
            $main_page = Util::addParameter(Horde::selfUrl(), 'framed', $auth->getLogoutReasonString());
            if ($browser->hasQuirk('scrollbar_in_way')) {
                $scrollbar = 'yes';
            } else {
                $scrollbar = 'auto';
            }
            require HORDE_TEMPLATES . '/index/frames_index.inc';
            exit;
        }
    }
}
if (Auth::isAuthenticated()) {
    if ($browser->isMobile()) {
        require HORDE_BASE . '/services/portal/mobile.php';
开发者ID:Artea,项目名称:freebeer,代码行数:31,代码来源:login.php

示例3: callHook

 /**
  * Provides a standardised function to call a Horde hook, checking whether
  * a hook config file exists and whether the function itself exists. If
  * these two conditions are not satisfied it will return the specified
  * value (by default a PEAR error).
  *
  * @param string $hook  The function to call.
  * @param array  $args  An array of any arguments to pass to the hook
  *                      function.
  * @param string $app   If specified look for hooks in the config directory
  *                      of this app.
  * @param mixed $error  What to return if $app/config/hooks.php or $hook
  *                      does not exist. If this is the string 'PEAR_Error'
  *                      a PEAR error object is returned instead, detailing
  *                      the failure.
  *
  * @return mixed  Either the results of the hook or PEAR error on failure.
  */
 function callHook($hook, $args = array(), $app = 'horde', $error = 'PEAR_Error')
 {
     global $registry;
     static $hooks_loaded = array();
     if (!isset($hooks_loaded[$app])) {
         $success = Horde::loadConfiguration('hooks.php', null, $app);
         if (is_a($success, 'PEAR_Error')) {
             Horde::logMessage($success, __FILE__, __LINE__, PEAR_LOG_DEBUG);
             $hooks_loaded[$app] = false;
         } else {
             $hooks_loaded[$app] = true;
         }
     }
     if (function_exists($hook)) {
         $result = call_user_func_array($hook, $args);
         if (is_a($result, 'PEAR_Error')) {
             Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
         }
         return $result;
     }
     if (is_string($error) && strcmp($error, 'PEAR_Error') == 0) {
         $error = PEAR::raiseError(sprintf('Hook %s in application %s not called.', $hook, $app));
         Horde::logMessage($error, __FILE__, __LINE__, PEAR_LOG_DEBUG);
     }
     return $error;
 }
开发者ID:justinlyon,项目名称:scc,代码行数:44,代码来源:Horde.php

示例4: userIsInGroup

 /**
  * Say if a user is a member of a group or not.
  *
  * @param string  $user       The name of the user.
  * @param integer $gid        The ID of the group.
  * @param boolean $subgroups  Return true if the user is in any subgroups
  *                            of $group, also.
  *
  * @return boolean
  */
 function userIsInGroup($user, $gid, $subgroups = true)
 {
     Horde::logMessage('userIsInGroup', __FILE__, __LINE__, PEAR_LOG_DEBUG);
     $groups = $this->getGroupMemberships($user, false);
     return in_array($gid, $groups) || parent::userIsInGroup($user, $gid, $subgroups);
 }
开发者ID:BGCX261,项目名称:zogi-svn-to-git,代码行数:16,代码来源:zogi.php

示例5: handleError

 public function handleError($error, $sql, $values, $line)
 {
     $msg = 'SQL statement: ' . $sql . "\n";
     $msg .= print_r($values, true);
     $msg .= 'Error reported: ' . !empty($error) && is_a($error, 'PEAR_Error') ? $error->getMessage() . "\nDebug info: " . $error->getDebugInfo() : $error;
     Horde::logMessage($msg, __FILE__, $line, PEAR_LOG_ERR);
 }
开发者ID:justinlyon,项目名称:scc,代码行数:7,代码来源:QueryUtil.php

示例6: _content

 /**
  * The content to go in this block.
  *
  * @return string   The content
  */
 function _content()
 {
     if (!@(include_once 'Services/Weather.php')) {
         Horde::logMessage('The metar block will not work without Services_Weather from PEAR. Run pear install Services_Weather.', __FILE__, __LINE__, PEAR_LOG_ERR);
         return _("Metar block not available. Details have been logged for the administrator.");
     }
     global $conf;
     static $metarLocs;
     if (!isset($conf['sql'])) {
         return _("A database backend is required for this block.");
     }
     if (empty($this->_params['location'])) {
         return _("No location is set.");
     }
     if (!is_array($metarLocs)) {
         $metarLocs = $this->getParams();
     }
     require_once 'Services/Weather.php';
     $metar =& Services_Weather::service('METAR', array('debug' => 0));
     $dbString = $conf['sql']['phptype'] . '://';
     $dbString .= $conf['sql']['username'] . ':';
     $dbString .= $conf['sql']['password'] . '@';
     $dbString .= $conf['sql']['hostspec'] . '/';
     $dbString .= $conf['sql']['database'];
     $metar->setMetarDB($dbString);
     $metar->setUnitsFormat($this->_params['units']);
     $metar->setDateTimeFormat('M j, Y', 'H:i');
     $metar->setMetarSource('http');
     $units = $metar->getUnits(0, $this->_params['units']);
     $weather = $metar->getWeather($this->_params['location']);
     $html = '<table width="100%" border="0" cellpadding="0" cellspacing="0">' . '<tr><td class="control"><b>' . sprintf('%s, %s (%s)', $metarLocs['location']['values'][$this->_params['__location']][$this->_params['location']], $this->_params['__location'], $this->_params['location']) . '</td></tr></table><b>' . _("Last Updated:") . '</b> ' . $weather['update'] . '<br /><br />';
     // Wind.
     if (isset($weather['wind'])) {
         $html .= '<b>' . _("Wind:") . '</b> ';
         if ($weather['windDirection'] == 'Variable') {
             if (!empty($this->_params['knots'])) {
                 $html .= sprintf(_('%s at %s %s'), $weather['windDirection'], round($metar->convertSpeed($weather['wind'], $units['wind'], 'kt')), 'kt');
             } else {
                 $html .= sprintf(_('%s at %s %s'), $weather['windDirection'], round($weather['wind']), $units['wind']);
             }
         } elseif ($weather['windDegrees'] == '000' && $weather['wind'] == '0') {
             $html .= sprintf(_("calm"));
         } else {
             $html .= sprintf(_("from the %s (%s) at %s %s"), $weather['windDirection'], $weather['windDegrees'], empty($this->_params['knots']) ? round($weather['wind']) : round($metar->convertSpeed($weather['wind'], $units['wind'], 'kt')), empty($this->_params['knots']) ? $units['wind'] : 'kt');
         }
     }
     if (isset($weather['windGust'])) {
         if ($weather['windGust']) {
             if (!empty($this->_params['knots'])) {
                 $html .= sprintf(_(", gusting %s %s"), round($metar->convertSpeed($weather['windGust'], $units['wind'], 'kt')), 'kt');
             } else {
                 $html .= sprintf(_(", gusting %s %s"), round($weather['windGust']), $units['wind']);
             }
         }
     }
     if (isset($weather['windVariability'])) {
         if ($weather['windVariability']['from']) {
             $html .= sprintf(_(", variable from %s to %s"), $weather['windVariability']['from'], $weather['windVariability']['to']);
         }
     }
     // Visibility.
     if (isset($weather['visibility'])) {
         $html .= $this->_row(_("Visibility"), $weather['visibility'] . ' ' . $units['vis']);
     }
     // Temperature/DewPoint.
     if (isset($weather['temperature'])) {
         $html .= $this->_row(_("Temperature"), round($weather['temperature']) . '&deg;' . String::upper($units['temp']));
     }
     if (isset($weather['dewPoint'])) {
         $html .= $this->_row(_("Dew Point"), round($weather['dewPoint']) . '&deg;' . String::upper($units['temp']));
     }
     if (isset($weather['feltTemperature'])) {
         $html .= $this->_row(_("Feels Like"), round($weather['feltTemperature']) . '&deg;' . String::upper($units['temp']));
     }
     // Pressure.
     if (isset($weather['pressure'])) {
         $html .= $this->_row(_("Pressure"), $weather['pressure'] . ' ' . $units['pres']);
     }
     // Humidity.
     if (isset($weather['humidity'])) {
         $html .= $this->_row(_("Humidity"), round($weather['humidity']) . '%');
     }
     // Clouds.
     if (isset($weather['clouds'])) {
         $clouds = '';
         foreach ($weather['clouds'] as $cloud) {
             $clouds .= '<br />';
             if (isset($cloud['height'])) {
                 $clouds .= sprintf(_("%s at %s ft"), $cloud['amount'], $cloud['height']);
             } else {
                 $clouds .= $cloud['amount'];
             }
         }
         $html .= $this->_row(_("Clouds"), $clouds);
     }
//.........这里部分代码省略.........
开发者ID:Artea,项目名称:freebeer,代码行数:101,代码来源:metar.php

示例7: dispatch

 /**
  * Creates an instance of the appropriate action class
  * then invokes the "execute" method on the instance. An optional
  * framework parameter may be delegated to the action. If
  * the Action implements a method matching the given task, it
  * will be invoked rather than the "execute" method.
  *
  * The return value from the Action will be passed to a
  * corresponding Page instance (created in the same manner) via
  * its "render" method. The given task may override the target
  * method as described above.
  *
  * If the Dispatcher instance is visible in global scope, the Action
  * implementation may dynamically override the task method for the
  * subsequent Page invocation as follows:
  * <pre>
  *     global $dispatcher;
  *     $dispatcher->setTask('pageTask');
  * </pre>
  *
  * @param String $scope	 A key for finding the action/page prefix
  * @param String $task An optional target method to invoke
  */
 public function dispatch($scope, $task = null)
 {
     $timer = Horde_Timer::singleton();
     $timer->push();
     // overall timer for action+page
     $this->setTask($task);
     $this->setRedirect(null);
     $action = $this->getAction($scope);
     if (!is_subclass_of($action, 'BaseAction')) {
         trigger_error("Invalid Action class: get_class({$action})", E_USER_ERROR);
         return;
     }
     $bean = null;
     $method = $this->getTask();
     $timer->push();
     // timer for action
     if (!empty($method) && in_array($method, get_class_methods($action))) {
         $bean = $action->{$method}($this->param);
     } else {
         $bean = $action->execute($this->param);
     }
     $this->timers[$scope . ':action'] = $timer->pop();
     if ($this->getRedirect() == null || $scope == $this->getRedirect() && $task == $this->getTask()) {
         $page = $this->getPage($scope);
         if (!is_subclass_of($page, 'BasePage')) {
             trigger_error("Invalid Page class: get_class({$action})", E_USER_ERROR);
             return;
         }
         $method = $this->getTask();
         $timer->push();
         // timer for page
         if (!empty($method) && in_array($method, get_class_methods($page))) {
             $page->{$method}($bean);
         } else {
             $page->render($bean);
         }
         $this->timers[$scope . ':page'] = $timer->pop();
     } else {
         $this->dispatch($this->getRedirect(), $this->getTask());
     }
     $this->timers[$scope . ':overall'] = $timer->pop();
     Horde::logMessage("Dispatcher timing (ms) for {$scope} [{$this->task}]: " . print_r($this->timers, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
 }
开发者ID:justinlyon,项目名称:scc,代码行数:66,代码来源:BaseDispatcher.php

示例8: _

                    $perm->removeGroupPermission($group, PERMS_DELETE, false);
                }
            }
            $share->setPermission($perm);
            $share->save();
            $notification->push(sprintf(_("Updated '%s'."), $share->get('name')), 'horde.success');
            $form = 'edit.inc';
        }
        break;
}
if (is_a($share, 'PEAR_Error')) {
    $title = _("Edit Permissions");
} else {
    $title = sprintf(_("Edit Permissions for %s"), $share->get('name'));
}
$userList = $auth->listUsers();
if (is_a($userList, 'PEAR_Error')) {
    Horde::logMessage($userList, __FILE__, __LINE__, PEAR_LOG_NOTICE);
    $userList = array();
}
$groupList = $groups->listGroups();
if (is_a($groupList, 'PEAR_Error')) {
    Horde::logMessage($groupList, __FILE__, __LINE__, PEAR_LOG_NOTICE);
    $groupList = array();
}
require HORDE_TEMPLATES . '/common-header.inc';
$notification->notify(array('listeners' => 'status'));
if (!empty($form)) {
    require HORDE_TEMPLATES . '/shares/' . $form;
}
require HORDE_TEMPLATES . '/common-footer.inc';
开发者ID:Artea,项目名称:freebeer,代码行数:31,代码来源:edit.php

示例9: _content

 /**
  * The content to go in this block.
  *
  * @return string   The content
  */
 function _content()
 {
     if (!@(include_once 'Services/Weather.php')) {
         Horde::logMessage('The weather.com block will not work without Services_Weather from PEAR. Run pear install Services_Weather.', __FILE__, __LINE__, PEAR_LOG_ERR);
         return _("The weather.com block is not available.");
     }
     global $conf;
     $cacheDir = Horde::getTempDir();
     $html = '';
     if (empty($this->_params['location'])) {
         return _("No location is set.");
     }
     $weatherDotCom =& Services_Weather::service("WeatherDotCom");
     $weatherDotCom->setAccountData(isset($conf['weatherdotcom']['partner_id']) ? $conf['weatherdotcom']['partner_id'] : '', isset($conf['weatherdotcom']['license_key']) ? $conf['weatherdotcom']['license_key'] : '');
     if (!$cacheDir) {
         return PEAR::raiseError(_("No temporary directory available for cache."), 'horde.error');
     } else {
         $weatherDotCom->setCache("file", array("cache_dir" => $cacheDir . '/'));
     }
     $weatherDotCom->setDateTimeFormat("m.d.Y", "H:i");
     $weatherDotCom->setUnitsFormat($this->_params['units']);
     $units = $weatherDotCom->getUnitsFormat();
     // If the user entered a zip code for the location, no need to
     // search (weather.com accepts zip codes as location IDs).
     // The location ID should already have been validated in
     // getParams.
     $search = preg_match('/\\b(?:\\d{5}(-\\d{5})?)|(?:[A-Z]{4}\\d{4})\\b/', $this->_params['location'], $matches) ? $matches[0] : $weatherDotCom->searchLocation($this->_params['location']);
     if (is_a($search, 'PEAR_Error')) {
         return $search->getmessage();
     }
     if (is_array($search)) {
         // Several locations returned due to imprecise location parameter
         $html = _("Several locations possible with the parameter: ");
         $html .= $this->_params['location'];
         $html .= "<br/><ul>";
         foreach ($search as $id_weather => $real_location) {
             $html .= "<li>{$real_location} ({$id_weather})</li>\n";
         }
         $html .= "</ul>";
         return $html;
     }
     $location = $weatherDotCom->getLocation($search);
     if (is_a($location, 'PEAR_Error')) {
         return $location->getmessage();
     }
     $weather = $weatherDotCom->getWeather($search);
     if (is_a($weather, 'PEAR_Error')) {
         return $weather->getmessage();
     }
     $forecast = $weatherDotCom->getForecast($search, $this->_params['days']);
     if (is_a($forecast, 'PEAR_Error')) {
         return $forecast->getmessage();
     }
     // Location and local time.
     $html .= "<table width=100%><tr><td class=control>";
     $html .= '<b>' . $location['name'] . '</b>' . ' local time ' . $location['time'];
     $html .= "</b></td></tr></table>";
     // Sunrise/sunset.
     $html .= '<b>' . _("Sunrise: ") . '</b>' . Horde::img('block/sunrise/sunrise.gif', _("Sunrise")) . $location['sunrise'];
     $html .= ' <b>' . _("Sunset: ") . '</b>' . Horde::img('block/sunrise/sunset.gif', _("Sunset")) . $location['sunset'];
     // Temperature.
     $html .= '<br /><b>' . _("Temperature: ") . '</b>';
     $html .= $weather['temperature'] . '&deg;' . String::upper($units['temp']);
     // Dew point.
     $html .= ' <b>' . _("Dew point: ") . '</b>';
     $html .= $weather['dewPoint'] . '&deg;' . String::upper($units['temp']);
     // Feels like temperature.
     $html .= ' <b>' . _("Feels like: ") . '</b>';
     $html .= $weather['feltTemperature'] . '&deg;' . String::upper($units['temp']);
     // Pressure and trend.
     $html .= '<br /><b>' . _("Pressure: ") . '</b>';
     $html .= number_format($weather['pressure'], 2) . ' ' . $units['pres'];
     $html .= _(" and ") . $weather['pressureTrend'];
     // Wind.
     $html .= '<br /><b>' . _("Wind: ") . '</b>';
     if ($weather['windDirection'] == 'VAR') {
         $html .= _("Variable");
     } elseif ($weather['windDirection'] == 'CALM') {
         $html .= _("Calm");
     } else {
         $html .= _("From the ") . $weather['windDirection'];
         $html .= ' (' . $weather['windDegrees'] . ')';
     }
     $html .= _(" at ") . $weather['wind'] . ' ' . $units['wind'];
     // Humidity.
     $html .= '<br /><b>' . _("Humidity: ") . '</b>';
     $html .= $weather['humidity'] . '%';
     // Visibility.
     $html .= ' <b>' . _("Visibility: ") . '</b>';
     $html .= $weather['visibility'] . (is_numeric($weather['visibility']) ? ' ' . $units['vis'] : '');
     // UV index.
     $html .= ' <b>' . _("U.V. index: ") . '</b>';
     $html .= $weather['uvIndex'] . ' - ' . $weather['uvText'];
     // Current condition.
     $html .= '<br /><b>' . _("Current condition: ") . '</b>' . Horde::img('block/weatherdotcom/32x32/' . $weather['conditionIcon'] . '.png', _(String::lower($weather['condition'])), 'align="middle"');
//.........这里部分代码省略.........
开发者ID:Artea,项目名称:freebeer,代码行数:101,代码来源:weatherdotcom.php

示例10: copy

        }
        break;
    case 'tmp':
        /* Getting a file from Horde's temp dir. */
        $tmpdir = Horde::getTempDir();
        if (empty($action) || $action == 'resize') {
            /* Use original if no action or if resizing. */
            $file_name = $tmpdir . '/' . $file;
        } else {
            $file_name = $tmpdir . '/mod_' . $file;
            if (!file_exists($file_name)) {
                copy($tmpdir . '/' . $file, $file_name);
            }
        }
        if (!file_exists($file_name)) {
            Horde::logMessage(sprintf('Image not found [%s]', $file_name), __FILE__, __LINE__, PEAR_LOG_ERR);
            exit;
        }
        $size = filesize($file_name);
        $fp = @fopen($file_name, 'r');
        $file_data = fread($fp, $size);
        fclose($fp);
        break;
}
/* Load the image object. */
require_once HORDE_LIBS . 'Horde/Image.php';
$image =& Horde_Image::singleton('gd');
$image->loadString($file, $file_data);
/* Check if no editing action required and send the image to browser. */
if (empty($action)) {
    $image->display();
开发者ID:Artea,项目名称:freebeer,代码行数:31,代码来源:view.php


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