Page MenuHomePhabricator

No OneTemporary

diff --git a/sip_login_reminder.phtml b/sip_login_reminder.phtml
index e30ad1c..108e6f8 100644
--- a/sip_login_reminder.phtml
+++ b/sip_login_reminder.phtml
@@ -1,234 +1,236 @@
<?php
/*
- Copyright (c) 2013 AG Projects
+ Copyright (c) 2017 AG Projects
http://ag-projects.com
*/
require("/etc/cdrtool/global.inc");
require('sip_settings.php');
/*if (is_readable("/etc/cdrtool/local/header.phtml")) {
include("/etc/cdrtool/local/header.phtml");
} else {
include("header.phtml");
}
*/
include("sip_header.phtml");
if (file_exists("/etc/cdrtool/ngnpro_engines.inc")) {
require("/etc/cdrtool/ngnpro_engines.inc");
} else {
page_close();
- printf ("Error: you must copy setup/ngnpro_engines.inc.sample to /etc/cdrtool/ngnpro_engines.inc and edit it before trying again");
+ echo "Error: you must copy setup/ngnpro_engines.inc.sample to /etc/cdrtool/ngnpro_engines.inc and edit it before trying again";
exit;
}
-$login_credentials=array('login_type' => 'admin');
+$login_credentials = array('login_type' => 'admin');
-$SoapEngine = new SoapEngine('sip_accounts',$soapEngines,$login_credentials);
+$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);
+ $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());
+ $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));
+ $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);
+ $account = json_decode($db->f('value'), true);
if (!($_REQUEST['sip_password'] || $_REQUEST['web_password'])){
- $RECORDS->showPasswordReminderUpdateFormEncrypted($_REQUEST['id'],$account['sip_account']);
+ $RECORDS->showPasswordReminderUpdateFormEncrypted($_REQUEST['id'], $account['sip_account']);
} else {
- $SipSettings = new SipSettings($account['sip_account'],$login_credentials,$soapEngines);
+ $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'];
+ $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).':'.$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);
+ $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'];
+ $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);
+ $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];
+ $_prop = $SipSettings->result->properties[$_key];
if ($_prop->name == 'web_password') {
- $newProperties[]=array( 'name'=> 'web_password',
- 'value' => $web_password_new);
- $found=1;
+ $newProperties[] = array(
+ 'name'=> 'web_password',
+ 'value' => $web_password_new
+ );
+ $found = 1;
} else {
- $newProperties[]=$_prop;
+ $newProperties[] = $_prop;
}
-
}
if (!$found) {
- $newProperties[]=array('name' => 'web_password',
- 'value' => $web_password_new);
-
+ $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);
+ $result = $SipSettings->SipPort->updateAccount($SipSettings->result);
dprint_r($SipSettings->result);
print "<div class=row-fluid><div id=wrapper2><div class=\"page-header\"><h2>";
print _("Update passwords");
print "</h2></div><div class=row-fluid>";
if ((new PEAR)->isError($result)) {
$error_msg = $result->getMessage();
$error_fault= $result->getFault();
$error_code = $result->getCode();
- printf ("
- <div class=\"alert alert-error\"><strong>");
- printf ("Error (SipPort):</strong><br/> %s (%s): %s</div></div>",$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring);
+ echo "<div class=\"alert alert-error\"><strong>";
+ printf(
+ "Error (SipPort):</strong><br/> %s (%s): %s</div></div>",
+ $error_msg,
+ $error_fault->detail->exception->errorcode,
+ $error_fault->detail->exception->errorstring
+ );
return false;
} else {
- printf ("
- <div class=\"alert alert-success\"><strong>");
+ echo "<div class=\"alert alert-success\"><strong>";
print _("Success");
print "</strong><br /> ";
print _("The password(s) have been updated");
print "</div></div>";
- $query="delete from memcache where `key` LIKE 'email_$id'";
+ $query = "delete from memcache where `key` LIKE 'email_$id'";
if (!$db->query($query)) {
- $log=sprintf ("Database error for query %s: %s (%s)\n",$query,$db->Error,$db->Errno);
+ $log = sprintf("Database error for query %s: %s (%s)\n", $query, $db->Error, $db->Errno);
syslog(LOG_NOTICE,$log);
}
-
flush();
}
unset($SipSettings);
}
} else {
- print "<div class=row-fluid><div id=wrapper2><div class=\"page-header\"><h2>";
+ echo "<div class=row-fluid><div id=wrapper2><div class=\"page-header\"><h2>";
print _("Update passwords");
print "</h2></div><div class=row-fluid>";
- printf ("
- <div class=\"alert alert-error\"><strong>");
+ echo "<div class=\"alert alert-error\"><strong>";
print _("Error");
print "</strong><br /> ";
print _("ID not found in the database");
print "<br/>";
print _("or the password changing session has expired");
print "</div></div>";
flush();
}
print "<p class='grey_footer clearfix'><a href=sip_settings.phtml><u>Back</u></a> to login page";
} else {
if ($_REQUEST['email_filter'] && $_REQUEST['sip_filter']) {
sleep(2);
$accounts=$RECORDS->getAccountsForPasswordReminderEncrypted(5);
} elseif ($_REQUEST['email_filter']) {
$accounts=$RECORDS->getAccountsForPasswordReminderEncrypted(5);
}
$RECORDS->showPasswordReminderFormEncrypted($accounts);
if ($_REQUEST['email_filter'] || $_REQUEST['sip_filter']) {
if ($count=count($accounts)) {
if ($count == "1") {
- printf ("<div class='alert alert-success'><p>Found a SIP account having email address set to <strong>'%s'</strong>:</p>",trim($_REQUEST['email_filter']));
+ printf("<div class='alert alert-success'><p>Found a SIP account having email address set to <strong>'%s'</strong>:</p>", trim($_REQUEST['email_filter']));
} else {
- printf ("<div class='alert alert-success'><p>Found multiple SIP accounts having email address set to <strong>'%s'</strong>:</p>",trim($_REQUEST['email_filter']));
+ printf("<div class='alert alert-success'><p>Found multiple SIP accounts having email address set to <strong>'%s'</strong>:</p>", trim($_REQUEST['email_filter']));
}
//printf ("<p>Found a SIP account having email address set to '%s'",trim($_REQUEST['email_filter']));
print "<script type=\"text/javascript\">
$('[name=sip_filter]').attr('disabled', 'disabled');
$('[name=email_filter]').attr('disabled', 'disabled');
$('#submit').attr('disabled', 'disabled');
</script>";
print "<p id='loading'><i class='icon-spinner icon-spin'></i> Processing...</p>";
print "<ul id='list'class='hide'>";
print "<li>";
foreach ($accounts as $_account) {
- $account=$_account['username'].'@'.$_account['domain'];
+ $account = $_account['username'].'@'.$_account['domain'];
//if ($account == $_REQUEST['sip_filter']) {
$SipSettings = new SipSettings($account,$login_credentials,$soapEngines);
$success = $success + $SipSettings->sendEmail(true);
//print "$sucess";
sleep(1);
flush();
//}
}
if ($success >= "1"){
if ($success > "1"){
print "Login reminders and password resets have been sent to ";
} else {
print "Login reminder and password reset have been sent to ";
}
print $_REQUEST['email_filter'];
print "</li>";
print "<script type=\"text/javascript\">
$('[name=sip_filter]').attr('disabled', 'disabled');
$('[name=email_filter]').attr('disabled', 'disabled');
$('#submit').attr('disabled', 'disabled');
$('#submit').removeClass('btn-primary').addClass('btn-success');
$('#loading').hide();
$('#list').removeClass('hide');
</script>";
}
print "</ul></div>";
}
}
print "<p class='clearfix'><a href=sip_settings.phtml><u>Back</u></a> to login page";
}
-print "
-</body>
-</html>
-";
+echo "</body></html>";
?>

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 23, 2:17 AM (12 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3408586
Default Alt Text
(13 KB)

Event Timeline