Changeset 3174956
- Timestamp:
- 10/24/2024 12:00:04 PM (17 months ago)
- Location:
- ejabberd-account-tools/trunk/includes
- Files:
-
- 6 edited
-
admin-tools.php (modified) (2 diffs)
-
change_email.php (modified) (2 diffs)
-
delete_account.php (modified) (1 diff)
-
functions.php (modified) (4 diffs)
-
reset_password.php (modified) (1 diff)
-
webpresence.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ejabberd-account-tools/trunk/includes/admin-tools.php
r3031187 r3174956 223 223 else if($response['code'] == 0) { 224 224 // New email address different from current 225 if(empty($email) || ($email != strip_tags(json_decode($response['body'])->res))) {225 if(empty($email) || ($email != json_decode(strip_tags($response['body'])))) { 226 226 // Delete private email 227 227 if(empty($email)) { … … 303 303 else if($response['code'] == 0) { 304 304 // Private email set 305 if(true == ($email = strip_tags(json_decode($response['body'])->res))) {305 if(true == ($email = json_decode(strip_tags($response['body'])))) { 306 306 // Fetch email address 307 307 $_POST['email'] = $email; -
ejabberd-account-tools/trunk/includes/change_email.php
r3031199 r3174956 238 238 else if($response['code'] == 0) { 239 239 // New email address different from current 240 if($request['email'] != strip_tags(json_decode($response['body'])->res)) {240 if($request['email'] != json_decode(strip_tags($response['body']))) { 241 241 // Get current timestamp 242 242 $now = time(); … … 256 256 $watchers = explode(' ', get_option('ejabat_watcher')); 257 257 foreach($watchers as $watcher) { 258 ejabat_get_xmpp_data('send_message', array('type' => 'chat', 'from' => $host, 'to' => $watcher, 'subject' => '', 'body' => sprintf('[%s] User %s has requested from IP address %s to change the email address from %s to %s', wp_date('Y-m-d H:i:s', $now), $user.'@'.$host, $_SERVER['REMOTE_ADDR'], strip_tags(json_decode($response['body'])->res), $request['email'])));258 ejabat_get_xmpp_data('send_message', array('type' => 'chat', 'from' => $host, 'to' => $watcher, 'subject' => '', 'body' => sprintf('[%s] User %s has requested from IP address %s to change the email address from %s to %s', wp_date('Y-m-d H:i:s', $now), $user.'@'.$host, $_SERVER['REMOTE_ADDR'], json_decode(strip_tags($response['body'])), $request['email']))); 259 259 } 260 260 } -
ejabberd-account-tools/trunk/includes/delete_account.php
r3031199 r3174956 209 209 else if($response['code'] == 0) { 210 210 // Private email set 211 if(true == ($email = strip_tags(json_decode($response['body'])->res))) {211 if(true == ($email = json_decode(strip_tags($response['body'])))) { 212 212 // Set code transient 213 213 $code = bin2hex(openssl_random_pseudo_bytes(16)); -
ejabberd-account-tools/trunk/includes/functions.php
r3031187 r3174956 9 9 10 10 // POST request to the XMPP server 11 function ejabat_get_xmpp_data($command, $arguments = '') {11 function ejabat_get_xmpp_data($command, $arguments = array()) { 12 12 // Perform request 13 13 $response = wp_remote_post(get_option('ejabat_rest_url').'/'.$command, array( 14 14 'headers' => array( 15 15 'Authorization' => 'Basic '.base64_encode(get_option('ejabat_login').':'.get_option('ejabat_password')), 16 ' X-Admin' => 'true'16 'Content-Type' => 'application/json' 17 17 ), 18 'body' => json_encode($arguments ),18 'body' => json_encode($arguments, JSON_FORCE_OBJECT), 19 19 'redirection' => 0, 20 20 'httpversion' => '1.1' … … 25 25 } 26 26 // Verify response 27 else if(($response['response']['code'] == 200) || ($response['response']['code'] == 500)) { 28 // Return response body 29 if($response['response']['code'] == 200) { 30 if(is_numeric($response['body'])) return array('code' => $response['body'], 'body' => $response['body'], 'command' => $command, 'arguments' => $arguments); 31 else return array('code' => 0, 'body' => $response['body'], 'command' => $command, 'arguments' => $arguments); 32 } 33 else return array('code' => 1, 'body' => $response['body'], 'command' => $command, 'arguments' => $arguments); 27 else if($response['response']['code'] == 200) { 28 if(is_numeric($response['body'])) return array('code' => $response['body'], 'body' => $response['body'], 'command' => $command, 'arguments' => $arguments); 29 else return array('code' => '0', 'body' => $response['body'], 'command' => $command, 'arguments' => $arguments); 34 30 } 35 31 // Unexpected error … … 337 333 // Nickname is set 338 334 if($response['code'] == 0) { 339 return json_decode($response['body']) ->content;335 return json_decode($response['body']); 340 336 } 341 337 else { … … 344 340 // Full name is set 345 341 if($response['code'] == 0) { 346 return json_decode($response['body']) ->content;342 return json_decode($response['body']); 347 343 } 348 344 else return $user; -
ejabberd-account-tools/trunk/includes/reset_password.php
r3031199 r3174956 209 209 else if($response['code'] == 0) { 210 210 // Private email set 211 if(true == ($email = strip_tags(json_decode($response['body'])->res))) {211 if(true == ($email = json_decode(strip_tags($response['body'])))) { 212 212 // Check verification limit transient 213 213 if(true == ($transient = get_transient('ejabat_pass_'.$user.'@'.$host))) { -
ejabberd-account-tools/trunk/includes/webpresence.php
r3031199 r3174956 75 75 // Get Web Presence user settings 76 76 $response = ejabat_get_xmpp_data('private_get', array('user' => $transient['user'], 'host' => $transient['host'], 'element' => 'webpresence', 'ns' => 'css')); 77 $xml_css = @simplexml_load_string(json_decode($response['body']) ->res)->webpresence;77 $xml_css = @simplexml_load_string(json_decode($response['body']))->webpresence; 78 78 $css = $xml_css->enabled ?: 'false'; 79 79 $css_available = $xml_css->available ?: '#4caf50'; … … 84 84 $css_unavailable = $xml_css->unavailable ?: '#9e9e9e'; 85 85 $response = ejabat_get_xmpp_data('private_get', array('user' => $transient['user'], 'host' => $transient['host'], 'element' => 'webpresence', 'ns' => 'json')); 86 $json = @simplexml_load_string(json_decode($response['body']) ->res)->webpresence->enabled ?: 'false';86 $json = @simplexml_load_string(json_decode($response['body']))->webpresence->enabled ?: 'false'; 87 87 // Create configuration form 88 88 $html = '<form data-action="configure-webpresence" class="ejabat" method="post" onsubmit="return false" autocomplete="off"> … … 296 296 // Get webpresence settins from XMPP server 297 297 $response = ejabat_get_xmpp_data('private_get', array('user' => $user, 'host' => $host, 'element' => 'webpresence', 'ns' => 'css')); 298 $xml = (array)@simplexml_load_string(json_decode($response['body']) ->res)->webpresence;298 $xml = (array)@simplexml_load_string(json_decode($response['body']))->webpresence; 299 299 // Save settings to cache 300 300 $transient = array( … … 372 372 // Get webpresence settins from XMPP server 373 373 $response = ejabat_get_xmpp_data('private_get', array('user' => $user, 'host' => $host, 'element' => 'webpresence', 'ns' => 'json')); 374 $xml = (array)@simplexml_load_string(json_decode($response['body']) ->res)->webpresence;374 $xml = (array)@simplexml_load_string(json_decode($response['body']))->webpresence; 375 375 // Save settings to cache 376 376 $transient = $xml['enabled'] ?: 'false';
Note: See TracChangeset
for help on using the changeset viewer.