當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Debug::Audit方法代碼示例

本文整理匯總了PHP中Debug::Audit方法的典型用法代碼示例。如果您正苦於以下問題:PHP Debug::Audit方法的具體用法?PHP Debug::Audit怎麽用?PHP Debug::Audit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Debug的用法示例。


在下文中一共展示了Debug::Audit方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: audit

 /**
  * Audit Log
  * @param string $entity
  * @param int $entityId
  * @param string $message
  * @param string|object|array $object
  */
 public static function audit($entity, $entityId, $message, $object)
 {
     \Debug::Audit(sprintf('Audit Trail message recorded for %s with id %d. Message: %s', $entity, $entityId, $message));
     if (self::$_auditLogStatement == null) {
         $dbh = \PDOConnect::newConnection();
         self::$_auditLogStatement = $dbh->prepare('
             INSERT INTO `auditlog` (logDate, userId, entity, message, entityId, objectAfter)
               VALUES (:logDate, :userId, :entity, :message, :entityId, :objectAfter)
         ');
     }
     // If we aren't a string then encode
     if (!is_string($object)) {
         $object = json_encode($object);
     }
     self::$_auditLogStatement->execute(array('logDate' => time(), 'userId' => \Kit::GetParam('userid', _SESSION, _INT, 0), 'entity' => $entity, 'message' => $message, 'entityId' => $entityId, 'objectAfter' => $object));
 }
開發者ID:fignew,項目名稱:xibo-cms,代碼行數:23,代碼來源:Log.php

示例2: has

 /**
  * Does the cache have the specified key
  * @param  string $key The Key
  * @return boolean True or False
  */
 public static function has($key)
 {
     // Load the key
     self::load($key);
     if (isset(self::$_data[$key]) && self::$_data[$key] != null) {
         // If the key has expired remove it
         if (self::$_data[$key]['expires'] < time()) {
             Debug::Audit($key . ' Expired: ' . self::$_data[$key]['expires']);
             // Remove it
             self::remove($key);
             return false;
         }
         Debug::Audit($key . ' present and in date');
         return true;
     }
     Debug::Audit($key . ' not present');
     return false;
 }
開發者ID:taphier,項目名稱:xibo-cms,代碼行數:23,代碼來源:cache.class.php

示例3: request

 private function request($latitude, $longitude, $time = null, $options = array())
 {
     $request_url = self::API_ENDPOINT . '[APIKEY]' . '/' . $latitude . ',' . $longitude . (is_null($time) ? '' : ',' . $time);
     if (!empty($options)) {
         $request_url .= '?' . http_build_query($options);
     }
     \Debug::Audit('Calling API with: ' . $request_url);
     $request_url = str_replace('[APIKEY]', $this->api_key, $request_url);
     $httpOptions = array(CURLOPT_TIMEOUT => 20, CURLOPT_SSL_VERIFYPEER => true, CURLOPT_USERAGENT => 'Xibo Digital Signage', CURLOPT_HEADER => false, CURLINFO_HEADER_OUT => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $request_url);
     // Proxy support
     if (\Config::GetSetting('PROXY_HOST') != '' && !\Config::isProxyException($request_url)) {
         $httpOptions[CURLOPT_PROXY] = \Config::GetSetting('PROXY_HOST');
         $httpOptions[CURLOPT_PROXYPORT] = \Config::GetSetting('PROXY_PORT');
         if (\Config::GetSetting('PROXY_AUTH') != '') {
             $httpOptions[CURLOPT_PROXYUSERPWD] = \Config::GetSetting('PROXY_AUTH');
         }
     }
     $curl = curl_init();
     curl_setopt_array($curl, $httpOptions);
     $result = curl_exec($curl);
     // Get the response headers
     $outHeaders = curl_getinfo($curl);
     if ($outHeaders['http_code'] == 0) {
         // Unable to connect
         \Debug::Error('Unable to reach Forecast API. No Host Found (HTTP Code 0). Curl Error = ' . curl_error($curl));
         return false;
     } else {
         if ($outHeaders['http_code'] != 200) {
             \Debug::Error('ForecastIO API returned ' . $outHeaders['http_code'] . ' status. Unable to proceed. Headers = ' . var_export($outHeaders, true));
             // See if we can parse the error.
             $body = json_decode($result);
             \Debug::Error('ForecastIO Error: ' . (isset($body->errors[0]) ? $body->errors[0]->message : 'Unknown Error'));
             return false;
         }
     }
     // Parse out header and body
     $body = json_decode($result);
     return $body;
 }
開發者ID:fignew,項目名稱:xibo-cms,代碼行數:39,代碼來源:forecast.php

示例4: PhoneHome

 /**
  * PHONE_HOME if required
  */
 private function PhoneHome()
 {
     if (Config::GetSetting('PHONE_HOME') == 'On') {
         // Find out when we last PHONED_HOME :D
         // If it's been > 28 days since last PHONE_HOME then
         if (Config::GetSetting('PHONE_HOME_DATE') < time() - 60 * 60 * 24 * 28) {
             try {
                 $dbh = PDOConnect::init();
                 // Retrieve number of displays
                 $sth = $dbh->prepare('SELECT COUNT(*) AS Cnt FROM `display` WHERE `licensed` = 1');
                 $sth->execute();
                 $PHONE_HOME_CLIENTS = $sth->fetchColumn();
                 // Retrieve version number
                 $PHONE_HOME_VERSION = Config::Version('app_ver');
                 $PHONE_HOME_URL = Config::GetSetting('PHONE_HOME_URL') . "?id=" . urlencode(Config::GetSetting('PHONE_HOME_KEY')) . "&version=" . urlencode($PHONE_HOME_VERSION) . "&numClients=" . urlencode($PHONE_HOME_CLIENTS);
                 if ($this->isAuditing == 1) {
                     Debug::LogEntry("audit", "PHONE_HOME_URL " . $PHONE_HOME_URL, "xmds", "RequiredFiles");
                 }
                 // Set PHONE_HOME_TIME to NOW.
                 $sth = $dbh->prepare('UPDATE `setting` SET `value` = :time WHERE `setting`.`setting` = :setting LIMIT 1');
                 $sth->execute(array('time' => time(), 'setting' => 'PHONE_HOME_DATE'));
                 @file_get_contents($PHONE_HOME_URL);
                 if ($this->isAuditing == 1) {
                     Debug::Audit("PHONE_HOME [OUT]", $this->displayId);
                 }
             } catch (Exception $e) {
                 Debug::Error($e->getMessage(), $this->displayId);
                 return false;
             }
         }
     }
 }
開發者ID:rovak73,項目名稱:xibo-cms,代碼行數:35,代碼來源:xmdssoap4.class.php

示例5: LoginServices

 /**
  * Logs in a specific user
  * @param int $userId
  * @return bool
  */
 function LoginServices($userId)
 {
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('SELECT UserName, usertypeid, homepage FROM user WHERE userID = :userId AND Retired = 0');
         $sth->execute(array('userId' => $userId));
         if (!($results = $sth->fetch())) {
             return false;
         }
         $this->userid = $userId;
         $this->userName = Kit::ValidateParam($results['UserName'], _USERNAME);
         $this->usertypeid = Kit::ValidateParam($results['usertypeid'], _INT);
         $this->homePage = Kit::ValidateParam($results['homepage'], _WORD);
         return true;
     } catch (Exception $e) {
         Debug::Audit($e->getMessage());
         return false;
     }
 }
開發者ID:rovak73,項目名稱:xibo-cms,代碼行數:24,代碼來源:module_user_general.php

示例6: LoadDefault

 public function LoadDefault()
 {
     Debug::Audit('Load Default ' . $this->type);
     try {
         $dbh = PDOConnect::init();
         // Load the config from disk
         $this->loadFromFile();
         // See if we have a default for this player type
         $sth = $dbh->prepare('SELECT * FROM `displayprofile` WHERE `type` = :type AND isdefault = 1');
         $sth->execute(array('type' => $this->type));
         if (!($row = $sth->fetch())) {
             // We don't so we should stick with the global default
             Debug::Audit('Fall back to global default');
         } else {
             // We do, so we should overwrite the global default with our stored preferences
             $this->name = Kit::ValidateParam($row['name'], _STRING);
             $this->type = Kit::ValidateParam($row['type'], _STRING);
             $this->isDefault = Kit::ValidateParam($row['isdefault'], _INT);
             $this->userId = Kit::ValidateParam($row['userid'], _INT);
             // Load the client settings into an array
             $config = Kit::ValidateParam($row['config'], _HTMLSTRING);
             $config = $config == '' ? array() : json_decode($config, true);
             // We have an array of settings that we must use to overwrite the values in our global config
             for ($i = 0; $i < count($this->config); $i++) {
                 // Does this setting exist in our store?
                 for ($j = 0; $j < count($config); $j++) {
                     if ($config[$j]['name'] == $this->config[$i]['name']) {
                         $this->config[$i]['value'] = $config[$j]['value'];
                         break;
                     }
                 }
             }
             $this->isNew = false;
         }
         return true;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
 }
開發者ID:fignew,項目名稱:xibo-cms,代碼行數:43,代碼來源:displayprofile.data.class.php

示例7: DataSetResults


//.........這裏部分代碼省略.........
                 $formula = str_replace('[DisplayGeoLocation]', $displayGeoLocation, $formula);
                 $formula = str_replace('[DisplayId]', $displayId, $formula);
                 $heading['Heading'] = $formula . ' AS \'' . $heading['Heading'] . '\'';
             } else {
                 // Value
                 $selectSQL .= sprintf("MAX(CASE WHEN DataSetColumnID = %d THEN `Value` ELSE null END) AS '%s', ", $col['DataSetColumnID'], $heading['Heading']);
             }
             $headings[] = $heading;
         }
         // Build our select statement including formulas
         foreach ($headings as $heading) {
             if ($heading['DataSetColumnTypeID'] == 2) {
                 // This is a formula, so the heading has been morphed into some SQL to run
                 $outserSelect .= ' ' . $heading['Heading'] . ',';
             } else {
                 $outserSelect .= sprintf(' `%s`,', $heading['Heading']);
             }
         }
         $outserSelect = rtrim($outserSelect, ',');
         // For each heading, put it in the correct order (according to $columns)
         foreach ($columns as $visibleColumn) {
             foreach ($headings as $heading) {
                 if ($heading['DataSetColumnID'] == $visibleColumn) {
                     $finalSelect .= sprintf(' `%s`,', $heading['Text']);
                     $results['Columns'][] = $heading;
                 }
             }
         }
         $finalSelect = rtrim($finalSelect, ',');
         // We are ready to build the select and from part of the SQL
         $SQL = "SELECT {$finalSelect} ";
         $SQL .= "  FROM ( ";
         $SQL .= "   SELECT {$outserSelect} ,";
         $SQL .= "           RowNumber ";
         $SQL .= "     FROM ( ";
         $SQL .= "      SELECT {$selectSQL} ";
         $SQL .= "          RowNumber ";
         $SQL .= "        FROM (";
         $SQL .= "          SELECT datasetcolumn.DataSetColumnID, datasetdata.RowNumber, datasetdata.`Value` ";
         $SQL .= "            FROM datasetdata ";
         $SQL .= "              INNER JOIN datasetcolumn ";
         $SQL .= "              ON datasetcolumn.DataSetColumnID = datasetdata.DataSetColumnID ";
         $SQL .= "            WHERE datasetcolumn.DataSetID = :dataSetId ";
         $SQL .= "          ) datasetdatainner ";
         $SQL .= "      GROUP BY RowNumber ";
         $SQL .= "    ) datasetdata ";
         if ($filter != '') {
             $SQL .= ' WHERE ' . $filter;
         }
         $SQL .= ' ) finalselect ';
         if ($ordering != '') {
             $order = ' ORDER BY ';
             $ordering = explode(',', $ordering);
             foreach ($ordering as $orderPair) {
                 // Sanitize the clause
                 $sanitized = str_replace(' ASC', '', str_replace(' DESC', '', $orderPair));
                 // Check allowable
                 if (!in_array($sanitized, $allowedOrderCols)) {
                     Debug::Info('Disallowed column: ' . $sanitized);
                     continue;
                 }
                 // Substitute
                 if (strripos($orderPair, ' DESC')) {
                     $order .= sprintf(' `%s`  DESC,', $sanitized);
                 } else {
                     if (strripos($orderPair, ' ASC')) {
                         $order .= sprintf(' `%s`  ASC,', $sanitized);
                     } else {
                         $order .= sprintf(' `%s`,', $sanitized);
                     }
                 }
             }
             $SQL .= trim($order, ',');
         } else {
             $SQL .= " ORDER BY RowNumber ";
         }
         if ($lowerLimit != 0 || $upperLimit != 0) {
             // Lower limit should be 0 based
             if ($lowerLimit != 0) {
                 $lowerLimit = $lowerLimit - 1;
             }
             // Upper limit should be the distance between upper and lower
             $upperLimit = $upperLimit - $lowerLimit;
             // Substitute in
             $SQL .= sprintf(' LIMIT %d, %d ', $lowerLimit, $upperLimit);
         }
         Debug::Audit($SQL . ' ' . var_export($params, true));
         $sth = $dbh->prepare($SQL);
         //$sth->debugDumpParams();
         $sth->execute($params);
         $results['Rows'] = $sth->fetchAll();
         return $results;
     } catch (Exception $e) {
         Debug::Error($e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
 }
開發者ID:fignew,項目名稱:xibo-cms,代碼行數:101,代碼來源:dataset.data.class.php

示例8: deleteUnusedForUser

 /**
  * Delete unused media for user
  * @param int $userId
  * @return bool
  */
 public function deleteUnusedForUser($userId)
 {
     foreach (Media::entriesUnusedForUser($userId) as $item) {
         Debug::Audit('Deleting unused media: ' . $item['mediaId']);
         if (!$this->Delete($item['mediaId'])) {
             return false;
         }
     }
     return true;
 }
開發者ID:taphier,項目名稱:xibo-cms,代碼行數:15,代碼來源:media.data.class.php

示例9: ReplaceMediaInAllLayouts

 /**
  * Replace media in all layouts.
  * @param <type> $oldMediaId
  * @param <type> $newMediaId
  */
 private function ReplaceMediaInAllLayouts($replaceInLayouts, $replaceBackgroundImages, $oldMediaId, $newMediaId)
 {
     $count = 0;
     Debug::LogEntry('audit', sprintf('Replacing mediaid %s with mediaid %s in all layouts', $oldMediaId, $newMediaId), 'module', 'ReplaceMediaInAllLayouts');
     try {
         $dbh = PDOConnect::init();
         // Some update statements to use
         $sth = $dbh->prepare('SELECT lklayoutmediaid, regionid FROM lklayoutmedia WHERE mediaid = :media_id AND layoutid = :layout_id');
         $sth_update = $dbh->prepare('UPDATE lklayoutmedia SET mediaid = :media_id WHERE lklayoutmediaid = :lklayoutmediaid');
         // Loop through a list of layouts this user has access to
         foreach ($this->user->LayoutList() as $layout) {
             $layoutId = $layout['layoutid'];
             // Does this layout use the old media id?
             $sth->execute(array('media_id' => $oldMediaId, 'layout_id' => $layoutId));
             $results = $sth->fetchAll();
             if (count($results) <= 0) {
                 continue;
             }
             Debug::LogEntry('audit', sprintf('%d linked media items for layoutid %d', count($results), $layoutId), 'module', 'ReplaceMediaInAllLayouts');
             // Create a region object for later use (new one each time)
             $layout = new Layout();
             $region = new region($this->db);
             // Loop through each media link for this layout
             foreach ($results as $row) {
                 // Get the LKID of the link between this layout and this media.. could be more than one?
                 $lkId = $row['lklayoutmediaid'];
                 $regionId = $row['regionid'];
                 if ($regionId == 'background') {
                     Debug::Audit('Replacing background image');
                     if (!$replaceBackgroundImages) {
                         continue;
                     }
                     // Straight swap this background image node.
                     if (!$layout->EditBackgroundImage($layoutId, $newMediaId)) {
                         return false;
                     }
                 } else {
                     if (!$replaceInLayouts) {
                         continue;
                     }
                     // Get the Type of this media
                     if (!($type = $region->GetMediaNodeType($layoutId, '', '', $lkId))) {
                         continue;
                     }
                     // Create a new media node use it to swap the nodes over
                     Debug::LogEntry('audit', 'Creating new module with MediaID: ' . $newMediaId . ' LayoutID: ' . $layoutId . ' and RegionID: ' . $regionId, 'region', 'ReplaceMediaInAllLayouts');
                     try {
                         $module = ModuleFactory::createForMedia($type, $newMediaId, $this->db, $this->user);
                     } catch (Exception $e) {
                         Debug::Error($e->getMessage());
                         return false;
                     }
                     // Sets the URI field
                     if (!$module->SetRegionInformation($layoutId, $regionId)) {
                         return false;
                     }
                     // Get the media xml string to use in the swap.
                     $mediaXmlString = $module->AsXml();
                     // Swap the nodes
                     if (!$region->SwapMedia($layoutId, $regionId, $lkId, $oldMediaId, $newMediaId, $mediaXmlString)) {
                         return false;
                     }
                 }
                 // Update the LKID with the new media id
                 $sth_update->execute(array('media_id' => $newMediaId, 'lklayoutmediaid' => $row['lklayoutmediaid']));
                 $count++;
             }
         }
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
     Debug::LogEntry('audit', sprintf('Replaced media in %d layouts', $count), 'module', 'ReplaceMediaInAllLayouts');
 }
開發者ID:rovak73,項目名稱:xibo-cms,代碼行數:82,代碼來源:module.class.php

示例10: EditEvent

 /**
  * Edits an event
  * @return 
  */
 public function EditEvent()
 {
     // Check the token
     if (!Kit::CheckToken(Kit::GetParam('token_id', _POST, _STRING))) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $eventId = Kit::GetParam('EventID', _POST, _INT, 0);
     $campaignId = Kit::GetParam('CampaignID', _POST, _INT, 0);
     $fromDT = Kit::GetParam('starttime', _POST, _STRING);
     $toDT = Kit::GetParam('endtime', _POST, _STRING);
     $displayGroupIDs = Kit::GetParam('DisplayGroupIDs', _POST, _ARRAY);
     $isPriority = Kit::GetParam('is_priority', _POST, _CHECKBOX);
     $repeatType = Kit::GetParam('rec_type', _POST, _STRING);
     $repeatInterval = Kit::GetParam('rec_detail', _POST, _INT);
     $repeatToDt = Kit::GetParam('rec_range', _POST, _STRING);
     $displayOrder = Kit::GetParam('DisplayOrder', _POST, _INT);
     $isNextButton = Kit::GetParam('next', _GET, _BOOL, false);
     // Convert our ISO strings
     $fromDT = DateManager::getTimestampFromString($fromDT);
     $toDT = DateManager::getTimestampFromString($toDT);
     if ($repeatToDt != '') {
         $repeatToDt = DateManager::getTimestampFromString($repeatToDt);
     }
     Debug::Audit('Times received are: FromDt=' . $fromDT . '. ToDt=' . $toDT . '. RepeatToDt=' . $repeatToDt);
     // Validate layout
     if ($campaignId == 0) {
         trigger_error(__("No layout selected"), E_USER_ERROR);
     }
     // check that at least one display has been selected
     if ($displayGroupIDs == '') {
         trigger_error(__("No displays selected"), E_USER_ERROR);
     }
     // validate the dates
     if ($toDT < $fromDT) {
         trigger_error(__('Can not have an end time earlier than your start time'), E_USER_ERROR);
     }
     // Check recurrence dT is in the future or empty
     if ($repeatToDt != '' && $repeatToDt < time() - 86400) {
         trigger_error(__("Your repeat until date is in the past. Cannot schedule events to repeat in to the past"), E_USER_ERROR);
     }
     // Ready to do the edit
     $scheduleObject = new Schedule($db);
     if (!$scheduleObject->Edit($eventId, $displayGroupIDs, $fromDT, $toDT, $campaignId, $repeatType, $repeatInterval, $repeatToDt, $isPriority, $this->user->userid, $displayOrder)) {
         trigger_error($scheduleObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__("The Event has been Modified."));
     $response->callBack = 'CallGenerateCalendar';
     $response->Respond();
 }
開發者ID:ajiwo,項目名稱:xibo-cms,代碼行數:56,代碼來源:schedule.class.php

示例11: getTwitterFeed

 protected function getTwitterFeed($displayId = 0, $isPreview = true)
 {
     if (!extension_loaded('curl')) {
         trigger_error(__('cURL extension is required for Twitter'));
         return false;
     }
     // Do we need to add a geoCode?
     $geoCode = '';
     $distance = $this->GetOption('tweetDistance');
     if ($distance != 0) {
         // Use the display ID or the default.
         if ($displayId != 0) {
             // Look up the lat/long
             $display = new Display();
             $display->displayId = $displayId;
             $display->Load();
             $defaultLat = $display->latitude;
             $defaultLong = $display->longitude;
         } else {
             $defaultLat = Config::GetSetting('DEFAULT_LAT');
             $defaultLong = Config::GetSetting('DEFAULT_LONG');
         }
         // Built the geoCode string.
         $geoCode = implode(',', array($defaultLat, $defaultLong, $distance)) . 'mi';
     }
     // Connect to twitter and get the twitter feed.
     $key = md5($this->GetOption('searchTerm') . $this->GetOption('resultType') . $this->GetOption('tweetCount', 15) . $geoCode);
     if (!Cache::has($key) || Cache::get($key) == '') {
         Debug::Audit('Querying API for ' . $this->GetOption('searchTerm'));
         // We need to search for it
         if (!($token = $this->getToken())) {
             return false;
         }
         // We have the token, make a tweet
         if (!($data = $this->searchApi($token, $this->GetOption('searchTerm'), $this->GetOption('resultType'), $geoCode, $this->GetOption('tweetCount', 15)))) {
             return false;
         }
         // Cache it
         Cache::put($key, $data, $this->GetSetting('cachePeriod'));
     } else {
         Debug::Audit('Served from Cache');
         $data = Cache::get($key);
     }
     Debug::Audit(var_export(json_encode($data), true));
     // Get the template
     $template = $this->GetRawNode('template');
     // Parse the text template
     $matches = '';
     preg_match_all('/\\[.*?\\]/', $template, $matches);
     // Build an array to return
     $return = array();
     // Media Object to get profile images
     $media = new Media();
     $layout = new Layout();
     // Expiry time for any media that is downloaded
     $expires = time() + $this->GetSetting('cachePeriodImages') * 60 * 60;
     // Remove URL setting
     $removeUrls = $this->GetOption('removeUrls', 1);
     // If we have nothing to show, display a no tweets message.
     if (count($data->statuses) <= 0) {
         // Create ourselves an empty tweet so that the rest of the code can continue as normal
         $user = new stdClass();
         $user->name = '';
         $user->screen_name = '';
         $user->profile_image_url = '';
         $tweet = new stdClass();
         $tweet->text = $this->GetOption('noTweetsMessage', __('There are no tweets to display'));
         $tweet->created_at = date("Y-m-d H:i:s");
         $tweet->user = $user;
         // Append to our statuses
         $data->statuses[] = $tweet;
     }
     // This should return the formatted items.
     foreach ($data->statuses as $tweet) {
         // Substitute for all matches in the template
         $rowString = $template;
         foreach ($matches[0] as $sub) {
             // Always clear the stored template replacement
             $replace = '';
             // Maybe make this more generic?
             switch ($sub) {
                 case '[Tweet]':
                     // Get the tweet text to operate on
                     $tweetText = $tweet->text;
                     // Replace URLs with their display_url before removal
                     if (isset($tweet->entities->urls)) {
                         foreach ($tweet->entities->urls as $url) {
                             $tweetText = str_replace($url->url, $url->display_url, $tweetText);
                         }
                     }
                     // Handle URL removal if requested
                     if ($removeUrls == 1) {
                         $tweetText = preg_replace("((https?|ftp|gopher|telnet|file|notes|ms-help):((\\/\\/)|(\\\\))+[\\w\\d:#\\@%\\/;\$()~_?\\+-=\\\\.&]*)", '', $tweetText);
                     }
                     $replace = emoji_unified_to_html($tweetText);
                     break;
                 case '[User]':
                     $replace = $tweet->user->name;
                     break;
                 case '[ScreenName]':
//.........這裏部分代碼省略.........
開發者ID:rovak73,項目名稱:xibo-cms,代碼行數:101,代碼來源:twitter.module.php

示例12: TidyLibrary

 public function TidyLibrary($tidyOldRevisions, $cleanUnusedFiles)
 {
     // Also run a script to tidy up orphaned media in the library
     $library = Config::GetSetting('LIBRARY_LOCATION');
     $library = rtrim($library, '/') . '/';
     $mediaObject = new Media();
     Debug::Audit('Library Location: ' . $library);
     // Dump the files in the temp folder
     foreach (scandir($library . 'temp') as $item) {
         if ($item == '.' || $item == '..') {
             continue;
         }
         Debug::Audit('Deleting temp file: ' . $item);
         unlink($library . 'temp' . DIRECTORY_SEPARATOR . $item);
     }
     $media = array();
     $unusedMedia = array();
     $unusedRevisions = array();
     // Run a query to get an array containing all of the media in the library
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('
             SELECT media.mediaid, media.storedAs, media.type, media.isedited,
                 SUM(CASE WHEN IFNULL(lklayoutmedia.lklayoutmediaid, 0) = 0 THEN 0 ELSE 1 END) AS UsedInLayoutCount,
                 SUM(CASE WHEN IFNULL(lkmediadisplaygroup.id, 0) = 0 THEN 0 ELSE 1 END) AS UsedInDisplayCount
               FROM `media`
                 LEFT OUTER JOIN `lklayoutmedia`
                 ON lklayoutmedia.mediaid = media.mediaid
                 LEFT OUTER JOIN `lkmediadisplaygroup`
                 ON lkmediadisplaygroup.mediaid = media.mediaid
             GROUP BY media.mediaid, media.storedAs, media.type, media.isedited ');
         $sth->execute(array());
         foreach ($sth->fetchAll() as $row) {
             $media[$row['storedAs']] = $row;
             // Ignore any module files or fonts
             if ($row['type'] == 'module' || $row['type'] == 'font') {
                 continue;
             }
             // Collect media revisions that aren't used
             if ($tidyOldRevisions && $row['UsedInLayoutCount'] <= 0 && $row['UsedInDisplayCount'] <= 0 && $row['isedited'] > 0) {
                 $unusedRevisions[$row['storedAs']] = $row;
             } else {
                 if ($cleanUnusedFiles && $row['UsedInLayoutCount'] <= 0 && $row['UsedInDisplayCount'] <= 0) {
                     $unusedMedia[$row['storedAs']] = $row;
                 }
             }
         }
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
     //Debug::Audit(var_export($media, true));
     //Debug::Audit(var_export($unusedMedia, true));
     // Get a list of all media files
     foreach (scandir($library) as $file) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         if (is_dir($library . $file)) {
             continue;
         }
         // Ignore thumbnails
         if (strstr($file, 'tn_') || strstr($file, 'bg_')) {
             continue;
         }
         // Is this file in the system anywhere?
         if (!array_key_exists($file, $media)) {
             // Totally missing
             Debug::Audit('Deleting file: ' . $file);
             // If not, delete it
             $mediaObject->DeleteMediaFile($file);
         } else {
             if (array_key_exists($file, $unusedRevisions)) {
                 // It exists but isn't being used any more
                 Debug::Audit('Deleting unused revision media: ' . $media[$file]['mediaid']);
                 $mediaObject->Delete($media[$file]['mediaid']);
             } else {
                 if (array_key_exists($file, $unusedMedia)) {
                     // It exists but isn't being used any more
                     Debug::Audit('Deleting unused media: ' . $media[$file]['mediaid']);
                     $mediaObject->Delete($media[$file]['mediaid']);
                 }
             }
         }
     }
     return true;
 }
開發者ID:fignew,項目名稱:xibo-cms,代碼行數:90,代碼來源:maintenance.data.class.php

示例13: isProxyException

 /**
  * Should the host be considered a proxy exception
  * @param $host
  * @return bool
  */
 public static function isProxyException($host)
 {
     $proxyException = Config::GetSetting('PROXY_EXCEPTIONS');
     Debug::Audit($host . ' in ' . $proxyException . '. Pos = ' . stripos($host, $proxyException));
     return $proxyException != '' && stripos($host, $proxyException) > -1;
 }
開發者ID:taphier,項目名稱:xibo-cms,代碼行數:11,代碼來源:config.class.php

示例14: getAccessToken

 /**
  * Exchange request token and secret for an access token and
  * secret, to sign API calls.
  *
  * @returns array("oauth_token" => "the-access-token",
  *                "oauth_token_secret" => "the-access-secret",
  *                "user_id" => "9436992",
  *                "screen_name" => "abraham")
  */
 function getAccessToken($Twitteroauth_verifier)
 {
     $parameters = array();
     $parameters['oauth_verifier'] = $Twitteroauth_verifier;
     $request = $this->TwitteroAuthRequest($this->accessTokenURL(), 'GET', $parameters);
     $token = TwitterOAuthUtil::parse_parameters($request);
     Debug::Audit(var_export($token, true));
     $this->token = new TwitterOAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
     return $token;
 }
開發者ID:fignew,項目名稱:xibo-cms,代碼行數:19,代碼來源:twitteroauth.php

示例15: ValidateDisplays

 /**
  * Assess each Display to correctly set the logged in flag based on last accessed time
  * @return
  */
 public static function ValidateDisplays()
 {
     // Maintain an array of timed out displays
     $timedOutDisplays = array();
     try {
         $dbh = PDOConnect::init();
         $statObject = new Stat();
         // Get a list of all displays and there last accessed / alert time out value
         $sth = $dbh->prepare('SELECT displayid, display, lastaccessed, alert_timeout, client_type, displayprofileid, email_alert, loggedin FROM display');
         $sthUpdate = $dbh->prepare('UPDATE display SET loggedin = 0 WHERE displayid = :displayid');
         $sth->execute(array());
         // Get the global time out (overrides the alert time out on the display if 0)
         $globalTimeout = Config::GetSetting('MAINTENANCE_ALERT_TOUT') * 60;
         $displays = $sth->fetchAll();
         foreach ($displays as $row) {
             $displayid = Kit::ValidateParam($row['displayid'], _INT);
             $lastAccessed = Kit::ValidateParam($row['lastaccessed'], _INT);
             $alertTimeout = Kit::ValidateParam($row['alert_timeout'], _INT);
             $clientType = Kit::ValidateParam($row['client_type'], _WORD);
             $loggedIn = Kit::ValidateParam($row['loggedin'], _INT);
             // Get the config object
             if ($alertTimeout == 0 && $clientType != '') {
                 $displayProfileId = empty($row['displayprofileid']) ? 0 : Kit::ValidateParam($row['displayprofileid'], _INT);
                 $display = new Display();
                 $display->displayId = $displayid;
                 $display->displayProfileId = $displayProfileId;
                 $display->clientType = $clientType;
                 $timeoutToTestAgainst = $display->GetSetting('collectInterval', $globalTimeout);
             } else {
                 $timeoutToTestAgainst = $globalTimeout;
             }
             // Store the time out to test against
             $row['timeout'] = $timeoutToTestAgainst;
             $timeOut = $lastAccessed + $timeoutToTestAgainst;
             // If the last time we accessed is less than now minus the time out
             if ($timeOut < time()) {
                 Debug::Audit('Timed out display. Last Accessed: ' . date('Y-m-d h:i:s', $lastAccessed) . '. Time out: ' . date('Y-m-d h:i:s', $timeOut));
                 // If this is the first switch (i.e. the row was logged in before)
                 if ($loggedIn == 1) {
                     // Update the display and set it as logged out
                     $sthUpdate->execute(array('displayid' => $displayid));
                     // Log the down event
                     $statObject->displayDown($displayid, $lastAccessed);
                 }
                 // Store this row
                 $timedOutDisplays[] = $row;
             }
         }
         return $timedOutDisplays;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
         return false;
     }
 }
開發者ID:fignew,項目名稱:xibo-cms,代碼行數:58,代碼來源:display.data.class.php


注:本文中的Debug::Audit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。