public function OAuthStorePostgreSQL::listLog in Lingotek Translation 7.5
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::listLog()
- 7.2 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::listLog()
- 7.3 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::listLog()
- 7.4 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::listLog()
- 7.6 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::listLog()
Get a page of entries from the log. Returns the last 100 records matching the options given.
Parameters
array options:
int user_id current user:
Return value
array log records
Overrides OAuthStoreAbstract::listLog
File
- lib/
oauth-php/ library/ store/ OAuthStorePostgreSQL.php, line 1696
Class
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 = $this
->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,
olg_remote_ip AS remote_ip
FROM oauth_log
WHERE ' . implode(' AND ', $where) . '
ORDER BY olg_id DESC
LIMIT 0,100', $args);
return $rs;
}