public function OAuthStoreSQL::listLog in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::listLog()
- 7.2 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::listLog()
- 7.3 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::listLog()
- 7.5 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::listLog()
- 7.6 lib/oauth-php/library/store/OAuthStoreSQL.php \OAuthStoreSQL::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 OAuthStoreAbstract::listLog
1 method overrides OAuthStoreSQL::listLog()
- OAuthStoreAnymeta::listLog in lib/
oauth-php/ library/ store/ OAuthStoreAnyMeta.php - * Get a page of entries from the log. Returns the last 100 records * matching the options given. * *
File
- lib/
oauth-php/ library/ store/ OAuthStoreSQL.php, line 1697
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,
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;
}