Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo on DidController.php #667

Open
wants to merge 2 commits into
base: source
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified build/MagnusBilling-current.tar.gz
Binary file not shown.
11 changes: 11 additions & 0 deletions protected/commands/UpdateMysqlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -1999,6 +1999,17 @@ public function run($args)
$this->update($version);
}

//2024-01-22
if ($version == '7.8.4.5') {
$sql = "INSERT INTO pkg_configuration VALUES
(NULL, 'API allow multiple user/email', 'api_allow_same_ip', '0', 'Allow create muiltiple clients with same email via API', 'global', '1');
";
$this->executeDB($sql);

$version = '7.8.4.6';
$this->update($version);
}

}

public function executeDB($sql)
Expand Down
18 changes: 11 additions & 7 deletions protected/components/ApiAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ private function checkPermissions($modelApi)
$action = 'r';
} else if ($_POST['action'] == 'resendActivationEmail') {
$action = 'r';
} else if ($_POST['action'] == 'spyCall') {
$action = 'r';
}

if ( ! preg_match('/' . $action . '/', $modelApi->action)) {
Expand All @@ -206,17 +208,19 @@ private function createUser($baseController)

$values = $_POST;

$modelUser = User::model()->find('email = :key', [':key' => $values['email']]);
if ($config['global']['api_allow_same_ip'] == 0) {
$modelUser = User::model()->find('email = :key', [':key' => $values['email']]);

if (isset($modelUser->id)) {
if (isset($modelUser->id)) {

echo json_encode([
'success' => false,
'errors' => 'This email already in use',
]);
echo json_encode([
'success' => false,
'errors' => 'This email already in use',
]);

exit;
exit;

}
}

if (isset($values['username'])) {
Expand Down
7 changes: 4 additions & 3 deletions protected/controllers/CallOnLineController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public function actionDestroy()

public function actionSpyCall()
{
if ( ! isset($_POST['id_sip'])) {
if (isset($_POST['sipuser'])) {
$dialstr = 'SIP/' . $_POST['sipuser'];
} elseif ( ! isset($_POST['id_sip'])) {
$dialstr = 'SIP/' . $this->config['global']['channel_spy'];
} else {
$modelSip = Sip::model()->findByPk((int) $_POST['id_sip']);
Expand All @@ -142,11 +144,9 @@ public function actionSpyCall()

$call = "Action: Originate\n";
$call .= "Channel: " . $dialstr . "\n";
$call .= "Callerid: " . Yii::app()->session['username'] . "\n";
$call .= "Context: billing\n";
$call .= "Extension: 5555\n";
$call .= "Priority: 1\n";
$call .= "Set:USERNAME=" . Yii::app()->session['username'] . "\n";
$call .= "Set:SPY=1\n";
$call .= "Set:SPYTYPE=" . $_POST['type'] . "\n";
$call .= "Set:CHANNELSPY=" . $_POST['channel'] . "\n";
Expand All @@ -156,6 +156,7 @@ public function actionSpyCall()
echo json_encode([
'success' => true,
'msg' => 'Start Spy',

]);
}

Expand Down
2 changes: 1 addition & 1 deletion protected/controllers/DidController.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public function beforeDestroy($values)

if (is_array($values) && count($values) > 1) {
foreach ($values as $key => $value) {
$modelDid = Did::model()->findByPK($value['id']);
$modelDid = Did::model()->findByPK($values['id']);
if ($modelDid->reserved == 0) {
CallSummaryMonthDid::model()->deleteAll("id_did = :key", [':key' => $modelDid->id]);
DidUse::model()->deleteAll("id_did = :key", [':key' => $modelDid->id]);
Expand Down