diff --git a/sip_login_reminder.phtml b/sip_login_reminder.phtml index c8b7eac..21526ab 100644 --- a/sip_login_reminder.phtml +++ b/sip_login_reminder.phtml @@ -1,233 +1,233 @@ 'admin'); $SoapEngine = new SoapEngine('sip_accounts', $soapEngines, $login_credentials); $_class = $SoapEngine->records_class; $RECORDS = new $_class($SoapEngine); $login_credentials['sip_engine'] = $RECORDS->SoapEngine->sip_engine; if ($_REQUEST['id']) { $id = $_REQUEST['id']; $db = new DB_CDRTool(); $query="delete from memcache where `key` LIKE 'email_%' and NOW() >= `expire`"; if (!$db->query($query)) { $log = sprintf("Database error for query %s: %s (%s)\n", $query, $db->Error, $db->Errno); syslog(LOG_NOTICE, $log); } else { $log = sprintf("Purged %d records from memcache\n", $db->affected_rows()); syslog(LOG_NOTICE, $log); } $query = sprintf( "select * from memcache where `key`='email_%s'", addslashes($id) ); if (!$db->query($query)) return false; if ($db->num_rows()) { $db->next_record(); $account = json_decode($db->f('value'), true); if (!($_REQUEST['sip_password'] || $_REQUEST['web_password'])) { $RECORDS->showPasswordReminderUpdateFormEncrypted($_REQUEST['id'], $account['sip_account']); } else { $SipSettings = new SipSettings($account['sip_account'], $login_credentials, $soapEngines); dprint_r($SipSettings->result); if ($_REQUEST['sip_password']) { //print "$SipSettings->password"; if ($SipSettings->store_clear_text_passwords) { $SipSettings->result->password = $_REQUEST['sip_password']; } else { - $md1 = strtolower($SipSettings->result->id->username).':'.strtolower($SipSettings->result->id->domain).':'.$sip_password; + $md1 = strtolower($SipSettings->result->id->username).':'.strtolower($SipSettings->result->id->domain).':'.$REQUEST['sip_password']; dprint($md1); dprint(md5($md1)); $md2 = strtolower($SipSettings->result->id->username).'@'.strtolower($SipSettings->result->id->domain).':'.strtolower($SipSettings->result->id->domain).':'.$_REQUEST['sip_password']; $SipSettings->result->password = md5($md1).':'.md5($md2); } } if ($_REQUEST['web_password']) { //dprint_r($SipSettings->result->properties); if ($SipSettings->store_clear_text_passwords) { $web_password_new = $_REQUEST['web_password']; } else { $md1 = strtolower($SipSettings->result->id->username).':'.strtolower($SipSettings->result->id->domain).':'.$_REQUEST['web_password']; $md2 = strtolower($SipSettings->result->id->username).'@'.strtolower($SipSettings->result->id->domain).':'.strtolower($SipSettings->result->id->domain).':'.$_REQUEST['web_password']; $web_password_new = md5($md1).':'.md5($md2); } foreach (array_keys($SipSettings->result->properties) as $_key) { $_prop = $SipSettings->result->properties[$_key]; if ($_prop->name == 'web_password') { $newProperties[] = array( 'name'=> 'web_password', 'value' => $web_password_new ); $found = 1; } else { $newProperties[] = $_prop; } } if (!$found) { $newProperties[] = array( 'name' => 'web_password', 'value' => $web_password_new ); } //if ($SipSettings->result->properties!=$newProperties) $this->somethingChanged=1; if (!$newProperties) $newProperties = array(); $SipSettings->result->properties=$newProperties; //setPreference1('web_password',$_REQUEST['web_password']); } dprint_r($SipSettings->result); $SipSettings->SipPort->addHeader($SipSettings->SoapAuth); $result = $SipSettings->SipPort->updateAccount($SipSettings->result); dprint_r($SipSettings->result); print "
Found a SIP account having email address set to '%s':
", trim($email_filter)); } else { printf("Found multiple SIP accounts having email address set to '%s':
", trim($email_filter)); } //printf ("Found a SIP account having email address set to '%s'",trim($_REQUEST['email_filter'])); print ""; print "
Processing...
"; print "Back to login page"; } echo "