public function OAuthStoreOracle::addLog in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::addLog()
- 7.2 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::addLog()
- 7.3 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::addLog()
- 7.4 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::addLog()
- 7.5 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::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
File
- lib/
oauth-php/ library/ store/ OAuthStoreOracle.php, line 1421
Class
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
$olg_received = $this
->makeUTF8($received);
$olg_sent = $this
->makeUTF8($sent);
$olg_base_string = $base_string;
$olg_notes = $this
->makeUTF8($notes);
$olg_usa_id_ref = $user_id;
$olg_remote_ip = $remote_ip;
$sql = "BEGIN SP_ADD_LOG(:P_RECEIVED, :P_SENT, :P_BASE_STRING, :P_NOTES, :P_USA_ID_REF, :P_REMOTE_IP, :P_RESULT); END;";
// parse sql
$stmt = oci_parse($this->conn, $sql) or die('Can not parse query');
// Bind In and Out Variables
oci_bind_by_name($stmt, ':P_RECEIVED', $olg_received, 255);
oci_bind_by_name($stmt, ':P_SENT', $olg_sent, 255);
oci_bind_by_name($stmt, ':P_BASE_STRING', $olg_base_string, 255);
oci_bind_by_name($stmt, ':P_NOTES', $olg_notes, 255);
oci_bind_by_name($stmt, ':P_USA_ID_REF', $olg_usa_id_ref, 255);
oci_bind_by_name($stmt, ':P_REMOTE_IP', $olg_remote_ip, 255);
oci_bind_by_name($stmt, ':P_RESULT', $result, 20);
//Execute the statement
oci_execute($stmt);
}