1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- /*
- FusionPBX
- Version: MPL 1.1
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
- The Original Code is FusionPBX
- The Initial Developer of the Original Code is
- Mark J Crane <[email protected]>
- Portions created by the Initial Developer are Copyright (C) 2008-2023
- the Initial Developer. All Rights Reserved.
- Contributor(s):
- KonradSC <[email protected]>
- */
- //includes files
- require_once dirname(__DIR__, 2) . "/resources/require.php";
- require_once "resources/check_auth.php";
- //check permissions
- if (permission_exists('bulk_account_settings_extensions')) {
- //access granted
- }
- else {
- echo "access denied";
- exit;
- }
- //add multi-lingual support
- $language = new text;
- $text = $language->get();
- //check for the ids
- if (is_array($_REQUEST) && sizeof($_REQUEST) > 0) {
- $extension_uuids = $_REQUEST["id"];
- $option_selected = $_REQUEST["option_selected"];
- $new_setting = $_REQUEST["new_setting"];
- foreach($extension_uuids as $extension_uuid) {
- $extension_uuid = check_str($extension_uuid);
- if ($extension_uuid != '') {
- //get the extensions array
- $sql = "select * from v_extensions ";
- $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
- $sql .= "and extension_uuid = '".$extension_uuid."' ";
- $database = new database;
- $extensions = $database->select($sql, 'all');
- if (is_array($extensions)) {
- foreach ($extensions as &$row) {
- $extension = $row["extension"];
- $user_context = $row["user_context"];
- $number_alias = $row["number_alias"];
- }
- unset ($prep_statement);
- }
- $array["extensions"][$i]["domain_uuid"] = $domain_uuid;
- $array["extensions"][$i]["extension_uuid"] = $extension_uuid;
- $array["extensions"][$i][$option_selected] = $new_setting;
- $database = new database;
- $database->app_name = 'bulk_account_settings';
- $database->app_uuid = null;
- $database->save($array);
- $message = $database->message;
-
- //echo "<pre>".print_r($message, true)."<pre>\n";
- //exit;
-
- unset($database, $array,$i);
-
- //clear the cache
- $cache = new cache;
- $cache->delete("directory:".$extension."@".$user_context);
- if (permission_exists('number_alias') && strlen($number_alias) > 0) {
- $cache->delete("directory:".$number_alias."@".$user_context);
- }
- }
- }
- }
- //redirect the browser
- $_SESSION["message"] = $text['message-update'];
- header("Location: bulk_account_settings_extensions.php?option_selected=".$option_selected."");
- return;
- ?>
|