You are here

public function OAuthStoreSQL::addLog in Lingotek Translation 7.3

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

* Add an entry to the log table * *

Parameters

array keys (osr_consumer_key, ost_token, ocr_consumer_key, oct_token): * @param string received * @param string sent * @param string base_string * @param string notes * @param int (optional) user_id

Overrides OAuthStoreAbstract::addLog

1 call to OAuthStoreSQL::addLog()
OAuthStoreAnymeta::addLog in lib/oauth-php/library/store/OAuthStoreAnyMeta.php
* Add an entry to the log table * *
1 method overrides OAuthStoreSQL::addLog()
OAuthStoreAnymeta::addLog in lib/oauth-php/library/store/OAuthStoreAnyMeta.php
* Add an entry to the log table * *

File

lib/oauth-php/library/store/OAuthStoreSQL.php, line 1654

Class

OAuthStoreSQL

Code

public function addLog($keys, $received, $sent, $base_string, $notes, $user_id = null) {
  $args = array();
  $ps = array();
  foreach ($keys as $key => $value) {
    $args[] = $value;
    $ps[] = "olg_{$key} = '%s'";
  }
  if (!empty($_SERVER['REMOTE_ADDR'])) {
    $remote_ip = $_SERVER['REMOTE_ADDR'];
  }
  else {
    if (!empty($_SERVER['REMOTE_IP'])) {
      $remote_ip = $_SERVER['REMOTE_IP'];
    }
    else {
      $remote_ip = '0.0.0.0';
    }
  }

  // Build the SQL
  $ps[] = "olg_received  \t= '%s'";
  $args[] = $this
    ->makeUTF8($received);
  $ps[] = "olg_sent   \t= '%s'";
  $args[] = $this
    ->makeUTF8($sent);
  $ps[] = "olg_base_string= '%s'";
  $args[] = $base_string;
  $ps[] = "olg_notes   \t= '%s'";
  $args[] = $this
    ->makeUTF8($notes);
  $ps[] = "olg_usa_id_ref = NULLIF(%d,0)";
  $args[] = $user_id;
  $ps[] = "olg_remote_ip  = IFNULL(INET_ATON('%s'),0)";
  $args[] = $remote_ip;
  $this
    ->query('INSERT INTO oauth_log SET ' . implode(',', $ps), $args);
}