You are here

public function OAuthStoreAnymeta::listLog in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/store/OAuthStoreAnyMeta.php \OAuthStoreAnymeta::listLog()
  2. 7.2 lib/oauth-php/library/store/OAuthStoreAnyMeta.php \OAuthStoreAnymeta::listLog()
  3. 7.4 lib/oauth-php/library/store/OAuthStoreAnyMeta.php \OAuthStoreAnymeta::listLog()
  4. 7.5 lib/oauth-php/library/store/OAuthStoreAnyMeta.php \OAuthStoreAnymeta::listLog()
  5. 7.6 lib/oauth-php/library/store/OAuthStoreAnyMeta.php \OAuthStoreAnymeta::listLog()

* Get a page of entries from the log. Returns the last 100 records * matching the options given. * *

Parameters

array options: * @param int user_id current user * @return array log records

Overrides OAuthStoreSQL::listLog

File

lib/oauth-php/library/store/OAuthStoreAnyMeta.php, line 79

Class

OAuthStoreAnymeta

Code

public function listLog($options, $user_id) {
  $where = array();
  $args = array();
  if (empty($options)) {
    $where[] = 'olg_usa_id_ref = %d';
    $args[] = $user_id;
  }
  else {
    foreach ($options as $option => $value) {
      if (strlen($value) > 0) {
        switch ($option) {
          case 'osr_consumer_key':
          case 'ocr_consumer_key':
          case 'ost_token':
          case 'oct_token':
            $where[] = 'olg_' . $option . ' = \'%s\'';
            $args[] = $value;
            break;
        }
      }
    }
    $where[] = '(olg_usa_id_ref IS NULL OR olg_usa_id_ref = %d)';
    $args[] = $user_id;
  }
  $rs = any_db_query_all_assoc('
					SELECT olg_id,
							olg_osr_consumer_key 	AS osr_consumer_key,
							olg_ost_token			AS ost_token,
							olg_ocr_consumer_key	AS ocr_consumer_key,
							olg_oct_token			AS oct_token,
							olg_usa_id_ref			AS user_id,
							olg_received			AS received,
							olg_sent				AS sent,
							olg_base_string			AS base_string,
							olg_notes				AS notes,
							olg_timestamp			AS timestamp,
							INET_NTOA(olg_remote_ip) AS remote_ip
					FROM oauth_log
					WHERE ' . implode(' AND ', $where) . '
					ORDER BY olg_id DESC
					LIMIT 0,100', $args);
  return $rs;
}