From e8aee11931581657a2071c0f722054d929c04a5e Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 25 Sep 2015 15:30:57 +0400 Subject: [PATCH 001/232] Add. Support intercept FIFO/CallCenter/Enterprise in load balancing mode. Change. `intercept.lua` and `intercept_group.lua` merge in one `intercept.lua` file. Call `intercept.lua` without arguments behave like `intercept_group.lua`. --- resources/install/scripts/intercept.lua | 394 ++++++++++++------ resources/install/scripts/intercept_group.lua | 219 +--------- .../scripts/resources/functions/database.lua | 111 +++++ 3 files changed, 387 insertions(+), 337 deletions(-) create mode 100644 resources/install/scripts/resources/functions/database.lua diff --git a/resources/install/scripts/intercept.lua b/resources/install/scripts/intercept.lua index a7a6695731..ce683dc5fd 100644 --- a/resources/install/scripts/intercept.lua +++ b/resources/install/scripts/intercept.lua @@ -28,145 +28,301 @@ digit_timeout = "5000"; extension = argv[1]; +-- we can use any number because other box should check sip_h_X_*** headers first + local pickup_number = '*8' -- extension and '**' or '*8' + --set the debug options debug["sql"] = false; --include config.lua require "resources.functions.config"; ---connect to the database - if (file_exists(database_dir.."/core.db")) then - --dbh = freeswitch.Dbh("core:core"); -- when using sqlite - dbh = freeswitch.Dbh("sqlite://"..database_dir.."/core.db"); - else - require "resources.functions.database_handle"; - dbh = database_handle('switch'); - end +--add the function + require "resources.functions.explode"; + require "resources.functions.trim"; + require "resources.functions.channel_utils"; --prepare the api object api = freeswitch.API(); ---add the function - require "resources.functions.trim"; - require "resources.functions.channel_utils"; +--Get intercept logger + local log = require "resources.functions.log".intercept ---exits the script if we didn't connect properly - assert(dbh:connected()); - -if ( session:ready() ) then - --answer the session - session:answer(); - - --get session variables - pin_number = session:getVariable("pin_number"); - sounds_dir = session:getVariable("sounds_dir"); - domain_uuid = session:getVariable("domain_uuid"); - domain_name = session:getVariable("domain_name"); - context = session:getVariable("context"); - sofia_profile_name = session:getVariable("sofia_profile_name"); - - --set the sounds path for the language, dialect and voice - default_language = session:getVariable("default_language"); - default_dialect = session:getVariable("default_dialect"); - default_voice = session:getVariable("default_voice"); - if (not default_language) then default_language = 'en'; end - if (not default_dialect) then default_dialect = 'us'; end - if (not default_voice) then default_voice = 'callie'; end - - --set defaults - if (digit_min_length) then - --do nothing - else - digit_min_length = "2"; - end - - if (digit_max_length) then - --do nothing - else - digit_max_length = "11"; - end - - --if the pin number is provided then require it - if (pin_number) then - --sleep - session:sleep(500); - --get the user pin number - min_digits = 2; - max_digits = 20; - digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+"); - --validate the user pin number - pin_number_table = explode(",",pin_number); - for index,pin_number in pairs(pin_number_table) do - if (digits == pin_number) then - --set the variable to true - auth = true; - --set the authorized pin number that was used - session:setVariable("pin_number", pin_number); - --end the loop - break; - end - end - --if not authorized play a message and then hangup - if (not auth) then - session:streamFile("phrase:voicemail_fail_auth:#"); - session:hangup("NORMAL_CLEARING"); - return; - end - end - - --predefined variables - uuid = ''; - call_hostname = ''; - callee_num = ''; - - --check the database to get the uuid of a ringing call - sql = "select uuid, call_uuid, hostname, callee_num, ip_addr from channels "; - sql = sql .. "where callstate in ('RINGING', 'EARLY') "; - --sql = sql .. "AND direction = 'outbound' "; - if (extension) then - sql = sql .. "and presence_id = '"..extension.."@"..domain_name.."' "; - else - if (domain_count > 1) then - sql = sql .. "and context = '"..context.."' "; - end - end - if (debug["sql"]) then - freeswitch.consoleLog("NOTICE", "sql "..sql.."\n"); - end - dbh:query(sql, function(result) - --for key, val in pairs(result) do - -- freeswitch.consoleLog("NOTICE", "result "..key.." "..val.."\n"); - --end - if result.uuid == result.call_uuid then - uuid = channel_variable(result.uuid, 'ent_originate_aleg_uuid') or - channel_variable(result.uuid, 'cc_member_session_uuid') or - channel_variable(result.uuid, 'fifo_bridge_uuid') or - result.uuid - else - uuid = result.call_uuid; - end - call_hostname = result.hostname; - callee_num = result.callee_num; - end); -end +--include database class + local Database = require "resources.functions.database" --get the hostname - hostname = trim(api:execute("hostname", "")); - freeswitch.consoleLog("NOTICE", "Hostname:"..hostname.." Call Hostname:"..call_hostname.."\n"); + local hostname = trim(api:execute("switchname", "")); + +-- redirect call to another box + local function make_proxy_call(destination, call_hostname) + destination = destination .. "@" .. domain_name + local profile, proxy = "internal", call_hostname; + local peer = CLASTER_PEERS and CLASTER_PEERS[call_hostname]; + if peer then + if type(peer) == "string" then + proxy = peer; + else + profile = peer[1] or profile; + proxy = peer[2] or proxy; + end + end + + local sip_auth_username = session:getVariable("sip_auth_username"); + local sip_auth_password = api:execute("user_data", sip_auth_username .. "@" .. domain_name .." param password"); + local auth = "sip_auth_username="..sip_auth_username..",sip_auth_password='"..sip_auth_password.."'" + dial_string = "{sip_invite_domain=" .. domain_name .. "," .. auth .. "}sofia/" .. profile .. "/" .. destination .. ";fs_path=sip:" .. proxy; + log.notice("Send call to other host...."); + session:execute("bridge", dial_string); + end + +-- check pin number if defined + local function pin(pin_number) + if not pin_number then + return true + end + + --sleep + session:sleep(500); + --get the user pin number + min_digits = 2; + max_digits = 20; + digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+"); + --validate the user pin number + pin_number_table = explode(",",pin_number); + for index,pin_number in pairs(pin_number_table) do + if (digits == pin_number) then + --set the authorized pin number that was used + session:setVariable("pin_number", pin_number); + --done + return true; + end + end + --if not authorized play a message and then hangup + session:streamFile("phrase:voicemail_fail_auth:#"); + session:hangup("NORMAL_CLEARING"); + return; + end + +-- do intercept if we get redirected request from another box + local function proxy_intercept() + -- Proceed calls from other boxes + + -- Check if this call from other box with setted intercept_uuid + local intercept_uuid = session:getVariable("sip_h_X-intercept_uuid") + + if intercept_uuid and #intercept_uuid > 0 then + log.notice("Get intercept_uuid from sip header. Do intercept....") + session:execute("intercept", intercept_uuid) + return true + end + + -- Check if this call from other box and we need parent uuid for channel + local child_intercept_uuid = session:getVariable("sip_h_X-child_intercept_uuid") + if (not child_intercept_uuid) or (#child_intercept_uuid == 0) then + return + end + + -- search parent uuid + log.notice("Get child_intercept_uuid from sip header.") + local parent_uuid = + channel_variable(child_intercept_uuid, 'ent_originate_aleg_uuid') or + channel_variable(child_intercept_uuid, 'cc_member_session_uuid') or + channel_variable(child_intercept_uuid, 'fifo_bridge_uuid') or + child_intercept_uuid + + if parent_uuid == child_intercept_uuid then + log.notice("Can not found parent call. Try intercept child.") + session:execute("intercept", child_intercept_uuid) + return true + end + + -- search parent hostname + log.notice("Found parent channel try detect parent hostname") + local dbh = Database.new('switch') + local sql = "SELECT hostname FROM channels WHERE uuid='" .. parent_uuid .. "'" + local call_hostname = dbh:first_value(sql) + dbh:release() + + if not call_hostname then + log.notice("Can not find host name. Channels is dead?") + return true + end + + if hostname == call_hostname then + log.notice("Found parent call on local machine. Do intercept....") + session:execute("intercept", parent_uuid); + return true + end + + log.noticef("Found parent call on remote machine `%s`.", call_hostname) + session:execute("export", "sip_h_X-intercept_uuid="..parent_uuid); + make_proxy_call(pickup_number, call_hostname) + return true + end + +-- return array of extensions for group + local function select_group_extensions() + -- connect to Fusion database + dbh = Database.new('system'); + + --get the call groups the extension is a member of + sql = "SELECT call_group FROM v_extensions "; + sql = sql .. "WHERE domain_uuid = '"..domain_uuid.."' "; + sql = sql .. "AND (extension = '"..caller_id_number.."'"; + sql = sql .. "OR number_alias = '"..caller_id_number.."')"; + sql = sql .. "limit 1"; + call_group = dbh:first_value(sql) or '' + log.noticef("call_group: `%s`", call_group); + call_groups = explode(",", call_group); + + --get the extensions in the call groups + sql = "SELECT extension, number_alias FROM v_extensions "; + sql = sql .. "WHERE domain_uuid = '"..domain_uuid.."' "; + sql = sql .. "AND ("; + for key,call_group in ipairs(call_groups) do + if (key > 1) then + sql = sql .. "OR "; + end + if (#call_group > 0) then + sql = sql .. "call_group like '%"..call_group.."%' "; + else + sql = sql .. "call_group = '' "; + end + end + sql = sql .. ") "; + if (debug["sql"]) then + log.notice("sql "..sql); + end + local extensions = {} + status = dbh:query(sql, function(row) + local member = row.extension + if row.number_alias and #row.number_alias > 0 then + member = row.number_alias + end + extensions[#extensions+1] = member + log.noticef("member `%s`", member) + end); + + -- release Fusion database + dbh:release() + + -- return result + return extensions + end + +--check if the session is ready + if ( session:ready() ) then + --answer the session + session:answer(); + --get session variables + domain_uuid = session:getVariable("domain_uuid"); + domain_name = session:getVariable("domain_name"); + pin_number = session:getVariable("pin_number"); + context = session:getVariable("context"); + caller_id_number = session:getVariable("caller_id_number"); + end + +--check if the session is ready + if ( session:ready() ) then + if proxy_intercept() then + return + end + end + +--check if the session is ready + if ( session:ready() ) then + --if the pin number is provided then require it + if not pin(pin_number) then + return + end + + -- select intercept mode + if not extension then + log.notice("GROUP INTERCEPT") + extensions = select_group_extensions() + else + log.noticef("INTERCEPT %s", extension) + extensions = {extension} + end + + --connect to FS database + dbh = Database.new('switch') + + --check the database to get the uuid of a ringing call + call_hostname = ""; + sql = "SELECT uuid, call_uuid, hostname, ip_addr FROM channels "; + sql = sql .. "WHERE callstate in ('RINGING', 'EARLY') "; + if not extension then + sql = sql .. "AND direction = 'outbound' "; + end + sql = sql .. "AND (1=1 "; + for key,extension in pairs(extensions) do + sql = sql .. "OR presence_id = '"..extension.."@"..domain_name.."' "; + end + sql = sql .. ") "; + sql = sql .. "and call_uuid is not null "; + sql = sql .. "limit 1 "; + if (debug["sql"]) then + log.notice("sql "..sql); + end + local is_child + dbh:query(sql, function(row) + -- for key, val in pairs(row) do + -- log.notice("row "..key.." "..val); + -- end + log.notice("-----------------------"); + is_child = (row.uuid == row.call_uuid) + uuid = row.call_uuid; + call_hostname = row.hostname; + ip_addr = row.ip_addr; + end); + + if is_child then + -- we need intercept `parent` call e.g. call in FIFO/CallCenter Queue + if (call_hostname == hostname) then + log.notice("Found child call on local machine. Try find parent channel.") + local parent_uuid = + channel_variable(uuid, 'ent_originate_aleg_uuid') or + channel_variable(uuid, 'cc_member_session_uuid') or + channel_variable(uuid, 'fifo_bridge_uuid') or + uuid + + if parent_uuid ~= uuid then + uuid = parent_uuid + local sql = "SELECT hostname FROM channels WHERE uuid='" .. uuid .. "'" + call_hostname = dbh:first_value(sql) + end + if call_hostname then + if call_hostname ~= hostname then + log.noticef("Found parent call on remote machine `%s`.", call_hostname) + else + log.notice("Found parent call on local machine.") + end + end + else + log.noticef("Found child call on remote machine `%s`.", call_hostname) + -- we can not find parent on this box because channel on other box so we have to + -- forward call to this box + session:execute("export", "sip_h_X-child_intercept_uuid="..uuid); + return make_proxy_call(pickup_number, call_hostname) + end + end + + --release FS database + dbh:release() + end + + log.noticef( "Hostname: %s Call Hostname: %s", hostname, call_hostname); --intercept a call that is ringing - if (uuid) then + if (uuid ~= nil) then if (session:getVariable("billmsec") == nil) then if (hostname == call_hostname) then session:execute("intercept", uuid); else session:execute("export", "sip_h_X-intercept_uuid="..uuid); - session:execute("export", "sip_h_X-domain_uuid="..domain_uuid); - session:execute("export", "sip_h_X-domain_name="..domain_name); - session:execute("export", "sip_h_X-callee_num="..callee_num); - port = freeswitch.getGlobalVariable(sofia_profile_name.."_sip_port"); - session:execute("bridge", "sofia/"..sofia_profile_name.."/**@"..call_hostname..":"..port); - freeswitch.consoleLog("NOTICE", "Send call to other host.... \n"); + make_proxy_call(pickup_number, call_hostname) end end end diff --git a/resources/install/scripts/intercept_group.lua b/resources/install/scripts/intercept_group.lua index 845666c96e..db4db46d05 100644 --- a/resources/install/scripts/intercept_group.lua +++ b/resources/install/scripts/intercept_group.lua @@ -14,222 +14,5 @@ -- -- The Original Code is FusionPBX -- --- The Initial Developer of the Original Code is --- Mark J Crane --- Copyright (C) 2010 - 2014 --- the Initial Developer. All Rights Reserved. --- --- Contributor(s): --- Mark J Crane ---user defined variables - max_tries = "3"; - digit_timeout = "5000"; - extension = argv[1]; - ---set the debug options - debug["sql"] = false; - ---include config.lua - require "resources.functions.config"; - ---add the function - require "resources.functions.explode"; - require "resources.functions.trim"; - require "resources.functions.channel_utils"; - ---prepare the api object - api = freeswitch.API(); - ---connect to the database - require "resources.functions.database_handle"; - dbh = database_handle('system'); - ---get the hostname - hostname = trim(api:execute("switchname", "")); - ---check if the session is ready - if ( session:ready() ) then - --answer the session - session:answer(); - - --get session variables - domain_uuid = session:getVariable("domain_uuid"); - domain_name = session:getVariable("domain_name"); - pin_number = session:getVariable("pin_number"); - sounds_dir = session:getVariable("sounds_dir"); - context = session:getVariable("context"); - caller_id_number = session:getVariable("caller_id_number"); - sofia_profile_name = session:getVariable("sofia_profile_name"); - - --set the sounds path for the language, dialect and voice - default_language = session:getVariable("default_language"); - default_dialect = session:getVariable("default_dialect"); - default_voice = session:getVariable("default_voice"); - if (not default_language) then default_language = 'en'; end - if (not default_dialect) then default_dialect = 'us'; end - if (not default_voice) then default_voice = 'callie'; end - - --set defaults - if (digit_min_length) then - --do nothing - else - digit_min_length = "2"; - end - - if (digit_max_length) then - --do nothing - else - digit_max_length = "11"; - end - - --if the pin number is provided then require it - if (pin_number) then - --sleep - session:sleep(500); - --get the user pin number - min_digits = 2; - max_digits = 20; - digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+"); - --validate the user pin number - pin_number_table = explode(",",pin_number); - for index,pin_number in pairs(pin_number_table) do - if (digits == pin_number) then - --set the variable to true - auth = true; - --set the authorized pin number that was used - session:setVariable("pin_number", pin_number); - --end the loop - break; - end - end - --if not authorized play a message and then hangup - if (not auth) then - session:streamFile("phrase:voicemail_fail_auth:#"); - session:hangup("NORMAL_CLEARING"); - return; - end - end - - --get the call groups the extension is a member of - sql = "SELECT call_group FROM v_extensions "; - sql = sql .. "WHERE domain_uuid = '"..domain_uuid.."' "; - sql = sql .. "AND (extension = '"..caller_id_number.."'"; - sql = sql .. "OR number_alias = '"..caller_id_number.."')"; - status = dbh:query(sql, function(row) - call_group = row.call_group; - freeswitch.consoleLog("NOTICE", "[intercept_group] call_group: "..call_group.."\n"); - end); - call_groups = explode(",", call_group); - - --get the extensions in the call groups - sql = "SELECT extension, number_alias FROM v_extensions "; - sql = sql .. "WHERE domain_uuid = '"..domain_uuid.."' "; - sql = sql .. "AND ("; - x = 0; - for key,call_group in pairs(call_groups) do - if (x == 0) then - if (string.len(call_group) > 0) then - sql = sql .. "call_group like '%"..call_group.."%' "; - else - sql = sql .. "call_group = '' "; - end - else - if (string.len(call_group) > 0) then - sql = sql .. "OR call_group like '%"..call_group.."%' "; - end - end - x = x + 1; - end - x = 0; - sql = sql .. ") "; - if (debug["sql"]) then - freeswitch.consoleLog("NOTICE", "[intercept_group] sql "..sql.."\n"); - end - extensions = {} - status = dbh:query(sql, function(row) - local member = row.extension - if row.number_alias and #row.number_alias > 0 then - member = row.number_alias - end - extensions[x] = member - freeswitch.consoleLog("NOTICE", "[intercept_group] member "..extensions[x].."\n"); - x = x + 1; - end); - - --connect to the database - if (file_exists(database_dir.."/core.db")) then - --dbh = freeswitch.Dbh("core:core"); -- when using sqlite - dbh = freeswitch.Dbh("sqlite://"..database_dir.."/core.db"); - else - require "resources.functions.database_handle"; - dbh = database_handle('switch'); - end - - --exits the script if we didn't connect properly - assert(dbh:connected()); - - --check the database to get the uuid of a ringing call - call_hostname = ""; - sql = "SELECT uuid, call_uuid, hostname, ip_addr FROM channels "; - sql = sql .. "WHERE callstate in ('RINGING', 'EARLY') "; - --sql = sql .. "AND direction = 'outbound' "; - sql = sql .. "AND ("; - x = 0; - for key,extension in pairs(extensions) do - if (x == 0) then - sql = sql .. " presence_id = '"..extension.."@"..domain_name.."' "; - else - sql = sql .. "OR presence_id = '"..extension.."@"..domain_name.."' "; - end - x = x + 1; - end - sql = sql .. ") "; - sql = sql .. "and call_uuid is not null "; - --if (domain_count > 1) then - -- sql = sql .. "and context = '"..context.."' "; - --end - sql = sql .. "limit 1 "; - if (debug["sql"]) then - freeswitch.consoleLog("NOTICE", "[intercept_group] sql "..sql.."\n"); - end - dbh:query(sql, function(row) - --for key, val in pairs(row) do - -- freeswitch.consoleLog("NOTICE", "row "..key.." "..val.."\n"); - --end - if row.uuid == row.call_uuid then - uuid = channel_variable(row.uuid, 'ent_originate_aleg_uuid') or - channel_variable(row.uuid, 'cc_member_session_uuid') or - channel_variable(row.uuid, 'fifo_bridge_uuid') or - row.uuid - else - uuid = row.call_uuid; - end - call_hostname = row.hostname; - ip_addr = row.ip_addr; - end); - end - - freeswitch.consoleLog("NOTICE", "Hostname:"..hostname.." Call Hostname:"..call_hostname.."\n"); - ---intercept a call that is ringing - if (uuid ~= nil) then - if (session:getVariable("billmsec") == nil) then - if (hostname == call_hostname) then - session:execute("intercept", uuid); - else - session:execute("export", "sip_h_X-intercept_uuid="..uuid); - session:execute("export", "sip_h_X-domain_uuid="..domain_uuid); - session:execute("export", "sip_h_X-domain_name="..domain_name); - port = freeswitch.getGlobalVariable(sofia_profile_name.."_sip_port"); - session:execute("bridge", "sofia/"..sofia_profile_name.."/*8@"..call_hostname..":"..port); - freeswitch.consoleLog("NOTICE", "Send call to other host.... \n"); - end - end - end - ---notes - --originate a call - --cmd = "originate user/1007@voip.example.com &intercept("..uuid..")"; - --api = freeswitch.API(); - --result = api:executeString(cmd); +require "intercept" diff --git a/resources/install/scripts/resources/functions/database.lua b/resources/install/scripts/resources/functions/database.lua new file mode 100644 index 0000000000..18b0eaa5c8 --- /dev/null +++ b/resources/install/scripts/resources/functions/database.lua @@ -0,0 +1,111 @@ +require 'resources.config' +require 'resources.functions.file_exists' +require 'resources.functions.database_handle' + +local unpack = unpack or table.unpack + +local Database = {} do + +Database.__index = Database + +function Database.new(name) + local dbh = assert(name) + if type(name) == 'string' then + if name == 'switch' and file_exists(database_dir.."/core.db") then + dbh = freeswitch.Dbh("sqlite://"..database_dir.."/core.db") + else + dbh = database_handle(name) + end + end + assert(dbh:connected()) + + local self = setmetatable({ + _dbh = dbh; + }, Database) + + return self +end + +function Database:query(sql, fn) + return self._dbh:query(sql, fn) +end + +function Database:first_row(sql) + local result + local ok, err = self:query(sql, function(row) + result = row + return 1 + end) + if not ok then return nil, err end + return result +end + +function Database:first_value(sql) + local result, err = self:first_row(sql) + if not result then return nil, err end + local k, v = next(result) + return v +end + +function Database:first(sql, ...) + local result, err = self:first_row(sql) + if not result then return nil, err end + local t, n = {}, select('#', ...) + for i = 1, n do + t[i] = result[(select(i, ...))] + end + return unpack(t, 1, n) +end + +function Database:fetch_all(sql) + local result = {} + local ok, err = self:query(sql, function(row) + result[#result + 1] = row + end) + if not ok then return nil, err end + return result +end + +function Database:release(sql) + if self._dbh then + self._dbh:release() + self._dbh = nil + end +end + +function Database:connected(sql) + return self._dbh and self._dbh:connected() +end + +function Database.__self_test__() + local db = Database.new('system') + assert(db:connected()) + + assert("1" == db:first_value("select 1 as v union all select 2 as v")) + + local t = assert(db:first_row("select 1 as v union all select 2 as v")) + assert(t.v == "1") + + t = assert(db:fetch_all("select 1 as v union all select 2 as v")) + assert(#t == 2) + assert(t[1].v == "1") + assert(t[2].v == "2") + + local a, b = assert(db:first("select 1 as b, 2 as a", 'a', 'b')) + assert(a == "2") + assert(b == "1") + + -- assert(nil == db:first_value("some non sql query")) + + db:release() + assert(not db:connected()) + print(" * databse - OK!") +end + +end + +-- if debug.self_test then +-- Database.__self_test__() +-- end + +return Database \ No newline at end of file From c38d19b8990a71d08ec98fefdc2522fa52c1e232 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 28 Sep 2015 11:35:12 +0400 Subject: [PATCH 002/232] Change. Reduce search parent host name. This can be done because child and parent channels have to be on same FS. --- resources/install/scripts/intercept.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/install/scripts/intercept.lua b/resources/install/scripts/intercept.lua index ce683dc5fd..b0955af566 100644 --- a/resources/install/scripts/intercept.lua +++ b/resources/install/scripts/intercept.lua @@ -138,6 +138,8 @@ end -- search parent hostname + call_hostname = hostname + --[[ parent and child have to be on same box so we do not search it log.notice("Found parent channel try detect parent hostname") local dbh = Database.new('switch') local sql = "SELECT hostname FROM channels WHERE uuid='" .. parent_uuid .. "'" @@ -148,6 +150,7 @@ log.notice("Can not find host name. Channels is dead?") return true end + --]] if hostname == call_hostname then log.notice("Found parent call on local machine. Do intercept....") @@ -288,18 +291,22 @@ channel_variable(uuid, 'fifo_bridge_uuid') or uuid + --[[ parent and child have to be on same box so we do not search it if parent_uuid ~= uuid then - uuid = parent_uuid local sql = "SELECT hostname FROM channels WHERE uuid='" .. uuid .. "'" call_hostname = dbh:first_value(sql) end + --]] + if call_hostname then + uuid = parent_uuid if call_hostname ~= hostname then log.noticef("Found parent call on remote machine `%s`.", call_hostname) else log.notice("Found parent call on local machine.") end end + else log.noticef("Found child call on remote machine `%s`.", call_hostname) -- we can not find parent on this box because channel on other box so we have to From 54aca5583651fd5f246314f15a64270eb8c3988a Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Sun, 25 Oct 2015 09:57:20 +0300 Subject: [PATCH 003/232] Use local variables. --- resources/install/scripts/intercept.lua | 53 +++++++++---------- .../scripts/resources/functions/database.lua | 4 +- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/resources/install/scripts/intercept.lua b/resources/install/scripts/intercept.lua index b0955af566..9c325ca25e 100644 --- a/resources/install/scripts/intercept.lua +++ b/resources/install/scripts/intercept.lua @@ -24,9 +24,7 @@ -- Errol W Samuels --user defined variables - max_tries = "3"; - digit_timeout = "5000"; - extension = argv[1]; + local extension = argv[1]; -- we can use any number because other box should check sip_h_X_*** headers first local pickup_number = '*8' -- extension and '**' or '*8' @@ -58,15 +56,6 @@ local function make_proxy_call(destination, call_hostname) destination = destination .. "@" .. domain_name local profile, proxy = "internal", call_hostname; - local peer = CLASTER_PEERS and CLASTER_PEERS[call_hostname]; - if peer then - if type(peer) == "string" then - proxy = peer; - else - profile = peer[1] or profile; - proxy = peer[2] or proxy; - end - end local sip_auth_username = session:getVariable("sip_auth_username"); local sip_auth_password = api:execute("user_data", sip_auth_username .. "@" .. domain_name .." param password"); @@ -85,11 +74,14 @@ --sleep session:sleep(500); --get the user pin number - min_digits = 2; - max_digits = 20; - digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+"); + local min_digits = 2; + local max_digits = 20; + local max_tries = "3"; + local digit_timeout = "5000"; + local digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+"); + --validate the user pin number - pin_number_table = explode(",",pin_number); + local pin_number_table = explode(",",pin_number); for index,pin_number in pairs(pin_number_table) do if (digits == pin_number) then --set the authorized pin number that was used @@ -98,6 +90,7 @@ return true; end end + --if not authorized play a message and then hangup session:streamFile("phrase:voicemail_fail_auth:#"); session:hangup("NORMAL_CLEARING"); @@ -138,7 +131,7 @@ end -- search parent hostname - call_hostname = hostname + call_hostname = hostname --[[ parent and child have to be on same box so we do not search it log.notice("Found parent channel try detect parent hostname") local dbh = Database.new('switch') @@ -167,15 +160,15 @@ -- return array of extensions for group local function select_group_extensions() -- connect to Fusion database - dbh = Database.new('system'); + local dbh = Database.new('system'); --get the call groups the extension is a member of - sql = "SELECT call_group FROM v_extensions "; + local sql = "SELECT call_group FROM v_extensions "; sql = sql .. "WHERE domain_uuid = '"..domain_uuid.."' "; sql = sql .. "AND (extension = '"..caller_id_number.."'"; sql = sql .. "OR number_alias = '"..caller_id_number.."')"; sql = sql .. "limit 1"; - call_group = dbh:first_value(sql) or '' + local call_group = dbh:first_value(sql) or '' log.noticef("call_group: `%s`", call_group); call_groups = explode(",", call_group); @@ -198,7 +191,7 @@ log.notice("sql "..sql); end local extensions = {} - status = dbh:query(sql, function(row) + dbh:query(sql, function(row) local member = row.extension if row.number_alias and #row.number_alias > 0 then member = row.number_alias @@ -239,7 +232,9 @@ if not pin(pin_number) then return end + end + if ( session:ready() ) then -- select intercept mode if not extension then log.notice("GROUP INTERCEPT") @@ -250,15 +245,18 @@ end --connect to FS database - dbh = Database.new('switch') + local dbh = Database.new('switch') --check the database to get the uuid of a ringing call call_hostname = ""; - sql = "SELECT uuid, call_uuid, hostname, ip_addr FROM channels "; + sql = "SELECT uuid, call_uuid, hostname FROM channels "; sql = sql .. "WHERE callstate in ('RINGING', 'EARLY') "; - if not extension then - sql = sql .. "AND direction = 'outbound' "; - end + -- next check should prevent pickup call from extension + -- e.g. if extension 100 dial some cell phone and some one else dial *8 + -- he can pickup this call. + -- if not extension then + -- sql = sql .. "AND direction = 'outbound' "; + -- end sql = sql .. "AND (1=1 "; for key,extension in pairs(extensions) do sql = sql .. "OR presence_id = '"..extension.."@"..domain_name.."' "; @@ -274,11 +272,10 @@ -- for key, val in pairs(row) do -- log.notice("row "..key.." "..val); -- end - log.notice("-----------------------"); + -- log.notice("-----------------------"); is_child = (row.uuid == row.call_uuid) uuid = row.call_uuid; call_hostname = row.hostname; - ip_addr = row.ip_addr; end); if is_child then diff --git a/resources/install/scripts/resources/functions/database.lua b/resources/install/scripts/resources/functions/database.lua index 18b0eaa5c8..55d04f06b6 100644 --- a/resources/install/scripts/resources/functions/database.lua +++ b/resources/install/scripts/resources/functions/database.lua @@ -77,8 +77,8 @@ function Database:connected(sql) return self._dbh and self._dbh:connected() end -function Database.__self_test__() - local db = Database.new('system') +function Database.__self_test__(name) + local db = Database.new(name or 'system') assert(db:connected()) assert("1" == db:first_value("select 1 as v union all select 2 as v")) From aaadffea1f9f308e50ebb7e3f104163e2e5491c6 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 9 Nov 2015 16:53:58 -0700 Subject: [PATCH 004/232] Update the wakeup phrases. --- .../templates/conf/lang/en/wakeup/sounds.xml | 119 ++++++++---------- 1 file changed, 55 insertions(+), 64 deletions(-) diff --git a/resources/templates/conf/lang/en/wakeup/sounds.xml b/resources/templates/conf/lang/en/wakeup/sounds.xml index 8c41736405..57d54bfd11 100644 --- a/resources/templates/conf/lang/en/wakeup/sounds.xml +++ b/resources/templates/conf/lang/en/wakeup/sounds.xml @@ -5,49 +5,34 @@ - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + - + - - - - - + + + @@ -57,13 +42,7 @@ - - - - - - - + @@ -73,13 +52,10 @@ - - - + - - - + + @@ -90,12 +66,8 @@ - - - - - - + + @@ -104,26 +76,45 @@ - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - + + - + \ No newline at end of file From 00eee7aca33f8648e362cc1c3f2169597dbd04c0 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 9 Nov 2015 18:42:29 -0700 Subject: [PATCH 005/232] Fix a problem where the ring group is only calling one external number when there are multiple to call. --- resources/install/scripts/app/ring_groups/index.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/install/scripts/app/ring_groups/index.lua b/resources/install/scripts/app/ring_groups/index.lua index 25e07493f7..9f2d3bcb03 100644 --- a/resources/install/scripts/app/ring_groups/index.lua +++ b/resources/install/scripts/app/ring_groups/index.lua @@ -497,7 +497,7 @@ local log = require "resources.functions.log".ring_group end elseif (r.dialplan_detail_type == "bridge") then if (bridge_match) then - dial_string = dial_string .. "|" .. square .."]"..dialplan_detail_data; + dial_string = dial_string .. delimiter .. square .."]"..dialplan_detail_data; square = "["; else dial_string = square .."]"..dialplan_detail_data; From 30109b452301b0e53a19196d4939830330d40497 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 10 Nov 2015 17:56:40 +0300 Subject: [PATCH 006/232] Fix. IVR menu option without arguments. --- resources/install/scripts/ivr_menu.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/resources/install/scripts/ivr_menu.lua b/resources/install/scripts/ivr_menu.lua index 554bcdc2f7..47b35679ed 100644 --- a/resources/install/scripts/ivr_menu.lua +++ b/resources/install/scripts/ivr_menu.lua @@ -407,8 +407,12 @@ if (row.ivr_menu_option_action == "menu-exec-app") then --get the action and data pos = string.find(row.ivr_menu_option_param, " ", 0, true); - action = string.sub(row.ivr_menu_option_param, 0, pos-1); - data = string.sub(row.ivr_menu_option_param, pos+1); + if pos then + action = string.sub(row.ivr_menu_option_param, 0, pos-1); + data = string.sub(row.ivr_menu_option_param, pos+1); + else + action, data = row.ivr_menu_option_param, "" + end --check if the option uses a regex regex = string.find(row.ivr_menu_option_digits, "(", 0, true); @@ -431,7 +435,11 @@ end if (action == "lua") then pos = string.find(data, " ", 0, true); - script = string.sub(data, 0, pos-1); + if pos then + script = string.sub(data, 0, pos-1); + else + script = data + end end end --if regex match From 5be99e28019ae42f599ed3bf885264f81ddf9a65 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 10 Nov 2015 19:29:06 +0300 Subject: [PATCH 007/232] Fix. hungup_rx.lua works on Windows 1. Command should use only double quotes. 2. Application should not be quoted (I am not sure may be it is bug in FS `system` command). So I use double quote on Windows and single quote on other system. Also I quote strings only if they contain spaces. To escape quote in string i just double it. `you got "some text"` become to `you got ""some text"""` --- .../app/fax/resources/scripts/hangup_rx.lua | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua index 81ac0ffd13..816c3cb406 100644 --- a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua +++ b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua @@ -41,6 +41,16 @@ --array count require "resources.functions.count"; + local IS_WINDOWS = (package.config:sub(1,1) == '\\') + + local function Q(s) + local q = IS_WINDOWS and '"' or "'" + if s:find('%s') then + s = q .. s:gsub(q, q..q) .. q + end + return s + end + -- set channel variables to lua variables domain_uuid = env:getHeader("domain_uuid"); domain_name = env:getHeader("domain_name"); @@ -181,23 +191,16 @@ end --fax to email - cmd = "'"..php_dir.."/"..php_bin.."' '"..document_root.."/secure/fax_to_email.php' "; - cmd = cmd .. "email='"..fax_email.."' "; - cmd = cmd .. "extension="..fax_extension.." "; - cmd = cmd .. "name='"..fax_file.."' "; - cmd = cmd .. "messages='result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages.."' "; - cmd = cmd .. "domain="..domain_name.." "; - cmd = cmd .. "caller_id_name='"; - if (caller_id_name ~= nil) then - cmd = cmd .. caller_id_name; - end - cmd = cmd .. "' "; - cmd = cmd .. "caller_id_number="; - if (caller_id_number ~= nil) then - cmd = cmd .. caller_id_number; - end - cmd = cmd .. " "; - if (string.len(fax_forward_number) > 0) then + + cmd = Q(php_dir.."/"..php_bin).." "..Q(document_root.."/secure/fax_to_email.php").." "; + cmd = cmd .. "email="..Q(fax_email).." "; + cmd = cmd .. "extension="..Q(fax_extension).." "; + cmd = cmd .. "name="..Q(fax_file).." "; + cmd = cmd .. "messages=" .. Q("result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages).." "; + cmd = cmd .. "domain="..Q(domain_name).." "; + cmd = cmd .. "caller_id_name=" .. Q(caller_id_name or '') .. " "; + cmd = cmd .. "caller_id_number=" .. Q(caller_id_number or '') .. " "; + if #fax_forward_number > 0 then cmd = cmd .. "fax_relay=true "; end freeswitch.consoleLog("notice", "[fax] command: " .. cmd .. "\n"); From 2fe16021a1a60734e036ec45be95fac5383ac710 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 10 Nov 2015 19:33:01 +0300 Subject: [PATCH 008/232] Fix. always escape quote. --- .../install/scripts/app/fax/resources/scripts/hangup_rx.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua index 816c3cb406..7a6dbbf0de 100644 --- a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua +++ b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua @@ -45,7 +45,7 @@ local function Q(s) local q = IS_WINDOWS and '"' or "'" - if s:find('%s') then + if s:find('%s') or s:find(q, nil, true) then s = q .. s:gsub(q, q..q) .. q end return s @@ -192,6 +192,7 @@ --fax to email + -- cmd = "lua" .. " " .. Q(scripts_dir .. "/fax_to_email.lua") .. " "; cmd = Q(php_dir.."/"..php_bin).." "..Q(document_root.."/secure/fax_to_email.php").." "; cmd = cmd .. "email="..Q(fax_email).." "; cmd = cmd .. "extension="..Q(fax_extension).." "; From 5506d7ce807deb3e8b59f36593c0b434d9817233 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 10 Nov 2015 20:49:46 +0300 Subject: [PATCH 009/232] Fix. function name --- .../app/fax/resources/scripts/hangup_rx.lua | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua index 7a6dbbf0de..5bf1a7f816 100644 --- a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua +++ b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua @@ -43,7 +43,7 @@ local IS_WINDOWS = (package.config:sub(1,1) == '\\') - local function Q(s) + local function enquote(s) local q = IS_WINDOWS and '"' or "'" if s:find('%s') or s:find(q, nil, true) then s = q .. s:gsub(q, q..q) .. q @@ -192,15 +192,15 @@ --fax to email - -- cmd = "lua" .. " " .. Q(scripts_dir .. "/fax_to_email.lua") .. " "; - cmd = Q(php_dir.."/"..php_bin).." "..Q(document_root.."/secure/fax_to_email.php").." "; - cmd = cmd .. "email="..Q(fax_email).." "; - cmd = cmd .. "extension="..Q(fax_extension).." "; - cmd = cmd .. "name="..Q(fax_file).." "; - cmd = cmd .. "messages=" .. Q("result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages).." "; - cmd = cmd .. "domain="..Q(domain_name).." "; - cmd = cmd .. "caller_id_name=" .. Q(caller_id_name or '') .. " "; - cmd = cmd .. "caller_id_number=" .. Q(caller_id_number or '') .. " "; + -- cmd = "lua" .. " " .. enquote(scripts_dir .. "/fax_to_email.lua") .. " "; + cmd = enquote(php_dir.."/"..php_bin).." "..enquote(document_root.."/secure/fax_to_email.php").." "; + cmd = cmd .. "email="..enquote(fax_email).." "; + cmd = cmd .. "extension="..enquote(fax_extension).." "; + cmd = cmd .. "name="..enquote(fax_file).." "; + cmd = cmd .. "messages=" .. enquote("result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages).." "; + cmd = cmd .. "domain="..enquote(domain_name).." "; + cmd = cmd .. "caller_id_name=" .. enquote(caller_id_name or '') .. " "; + cmd = cmd .. "caller_id_number=" .. enquote(caller_id_number or '') .. " "; if #fax_forward_number > 0 then cmd = cmd .. "fax_relay=true "; end From bea4a02056278d8bae8290ba98cc7ac065ce6a1d Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 10 Nov 2015 22:41:34 +0300 Subject: [PATCH 010/232] Fix. Intercept can find wrong channel. --- resources/install/scripts/intercept.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/install/scripts/intercept.lua b/resources/install/scripts/intercept.lua index 9c325ca25e..ca9af9d38b 100644 --- a/resources/install/scripts/intercept.lua +++ b/resources/install/scripts/intercept.lua @@ -257,7 +257,7 @@ -- if not extension then -- sql = sql .. "AND direction = 'outbound' "; -- end - sql = sql .. "AND (1=1 "; + sql = sql .. "AND (1<>1 "; for key,extension in pairs(extensions) do sql = sql .. "OR presence_id = '"..extension.."@"..domain_name.."' "; end From ca48132e40933da863e120bd2755fc005348dc85 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 10 Nov 2015 13:37:25 -0700 Subject: [PATCH 011/232] Change enquote to quote. --- .../app/fax/resources/scripts/hangup_rx.lua | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua index 5bf1a7f816..628822955c 100644 --- a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua +++ b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua @@ -43,7 +43,7 @@ local IS_WINDOWS = (package.config:sub(1,1) == '\\') - local function enquote(s) + local function quote(s) local q = IS_WINDOWS and '"' or "'" if s:find('%s') or s:find(q, nil, true) then s = q .. s:gsub(q, q..q) .. q @@ -192,15 +192,15 @@ --fax to email - -- cmd = "lua" .. " " .. enquote(scripts_dir .. "/fax_to_email.lua") .. " "; - cmd = enquote(php_dir.."/"..php_bin).." "..enquote(document_root.."/secure/fax_to_email.php").." "; - cmd = cmd .. "email="..enquote(fax_email).." "; - cmd = cmd .. "extension="..enquote(fax_extension).." "; - cmd = cmd .. "name="..enquote(fax_file).." "; - cmd = cmd .. "messages=" .. enquote("result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages).." "; - cmd = cmd .. "domain="..enquote(domain_name).." "; - cmd = cmd .. "caller_id_name=" .. enquote(caller_id_name or '') .. " "; - cmd = cmd .. "caller_id_number=" .. enquote(caller_id_number or '') .. " "; + -- cmd = "lua" .. " " .. quote(scripts_dir .. "/fax_to_email.lua") .. " "; + cmd = quote(php_dir.."/"..php_bin).." "..quote(document_root.."/secure/fax_to_email.php").." "; + cmd = cmd .. "email="..quote(fax_email).." "; + cmd = cmd .. "extension="..quote(fax_extension).." "; + cmd = cmd .. "name="..quote(fax_file).." "; + cmd = cmd .. "messages=" .. quote("result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages).." "; + cmd = cmd .. "domain="..quote(domain_name).." "; + cmd = cmd .. "caller_id_name=" .. quote(caller_id_name or '') .. " "; + cmd = cmd .. "caller_id_number=" .. quote(caller_id_number or '') .. " "; if #fax_forward_number > 0 then cmd = cmd .. "fax_relay=true "; end From 0215800778ba30923e3f0d287d017e91bd8c9084 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 10 Nov 2015 17:04:42 -0700 Subject: [PATCH 012/232] Change the Database:query to make the fn optional which will make it more backwards compatible with current code. This fixes an issue with recent movement to the database class in call_forward.lua. --- resources/install/scripts/resources/functions/database.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/install/scripts/resources/functions/database.lua b/resources/install/scripts/resources/functions/database.lua index 89b5456193..f8939126ff 100644 --- a/resources/install/scripts/resources/functions/database.lua +++ b/resources/install/scripts/resources/functions/database.lua @@ -27,7 +27,11 @@ function Database.new(name) end function Database:query(sql, fn) - return self._dbh:query(sql, fn) + if (fn == nil) then + return self._dbh:query(sql) + else + return self._dbh:query(sql, fn) + end end function Database:first_row(sql) From c385f5fc0f85ce18c561ca67f8e6abd6016506c6 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 10 Nov 2015 17:26:39 -0700 Subject: [PATCH 013/232] New database class was implemented in call_forward.lua when using first_value must change select * from with the specific value desired. --- resources/install/scripts/call_forward.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/install/scripts/call_forward.lua b/resources/install/scripts/call_forward.lua index fc4f693f38..bd1dd11142 100644 --- a/resources/install/scripts/call_forward.lua +++ b/resources/install/scripts/call_forward.lua @@ -108,7 +108,7 @@ --check to see if the pin number is correct if not session:ready() then return end - local sql = "SELECT * FROM v_voicemails "; + local sql = "SELECT voicemail_password FROM v_voicemails "; sql = sql .. "WHERE domain_uuid = '" .. domain_uuid .."' "; sql = sql .. "AND voicemail_id = '" .. extension .."' "; if (debug["sql"]) then From 4fde7dfc80de4a5dbf70435fb03a7a9c2fe86ccb Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 12 Nov 2015 14:00:01 +0300 Subject: [PATCH 014/232] Fix. multiple calls fax_send caused error. Fix. require EventSocket implicitly. Fix. require `test` class. --- app/fax/fax_emails.php | 1 + app/fax/fax_send.php | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index 906a7eb013..3c615a8e75 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -29,6 +29,7 @@ include "root.php"; require_once "resources/require.php"; require_once "resources/functions/object_to_array.php"; require_once "resources/functions/parse_attachments.php"; +require_once "resources/classes/text.php"; //get accounts to monitor $sql = "select * from v_fax "; diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index e134e37bbe..315737f933 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -98,21 +98,28 @@ if (!$included) { $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.((count($_SESSION["domains"]) > 1) ? '/'.$_SESSION['domain_name'] : null); } - -function correct_path($p) { - global $IS_WINDOWS; - if ($IS_WINDOWS) { - return str_replace('/', '\\', $p); - } - return $p; +else { + require_once "resources/classes/EventSocket.php"; } -function gs_cmd($args) { - global $IS_WINDOWS; - if ($IS_WINDOWS) { - return 'gswin32c '.$args; +if(!function_exists('correct_path')) { + function correct_path($p) { + global $IS_WINDOWS; + if ($IS_WINDOWS) { + return str_replace('/', '\\', $p); + } + return $p; + } +} + +if(!function_exists('gs_cmd')) { + function gs_cmd($args) { + global $IS_WINDOWS; + if ($IS_WINDOWS) { + return 'gswin32c '.$args; + } + return 'gs '.$args; } - return 'gs '.$args; } //get the fax extension From 04fbd896dfd484e95dc48722ab951c7c6ec26a0f Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 12 Nov 2015 11:10:34 +0000 Subject: [PATCH 015/232] made button elements render the same as input.btn --- themes/enhanced/template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/enhanced/template.php b/themes/enhanced/template.php index 3b5579bcb9..e5cf267146 100644 --- a/themes/enhanced/template.php +++ b/themes/enhanced/template.php @@ -251,7 +251,7 @@ form { margin: 0; } -input.btn, input.button { +input.btn, input.button, button { font-family: Candara, Calibri, Segoe, "Segoe UI", Optima, Arial, sans-serif; padding: 2px 6px 3px 6px; color: #fff; @@ -273,7 +273,7 @@ input.btn, input.button { -moz-opacity: 0.9; } -input.btn:hover, input.button:hover, img.list_control_icon:hover { +input.btn:hover, input.button:hover, img.list_control_icon:hover, button:hover { box-shadow: 0 0 5px #cddaf0; -webkit-box-shadow: 0 0 5px #cddaf0; -moz-box-shadow: 0 0 5px #cddaf0; From 31a039257709f608a074b2e8cf6265df57bf869b Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 12 Nov 2015 14:11:05 +0300 Subject: [PATCH 016/232] Fix. Call intercept - a scenario where an outgoing call can be intercepted This is same changes as in #1209. --- resources/install/scripts/intercept.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/install/scripts/intercept.lua b/resources/install/scripts/intercept.lua index ca9af9d38b..326d93b985 100644 --- a/resources/install/scripts/intercept.lua +++ b/resources/install/scripts/intercept.lua @@ -254,9 +254,9 @@ -- next check should prevent pickup call from extension -- e.g. if extension 100 dial some cell phone and some one else dial *8 -- he can pickup this call. - -- if not extension then - -- sql = sql .. "AND direction = 'outbound' "; - -- end + if not extension then + sql = sql .. "AND direction = 'outbound' "; + end sql = sql .. "AND (1<>1 "; for key,extension in pairs(extensions) do sql = sql .. "OR presence_id = '"..extension.."@"..domain_name.."' "; From c13ed1323f4c3bdbc5a9962cd69f3542f644c657 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 12 Nov 2015 16:40:02 -0700 Subject: [PATCH 017/232] Add additional Polycom key types. --- app/devices/app_languages.php | 91 +++++++++++++++++++ app/devices/device_edit.php | 7 ++ .../provision/polycom/4.x/{$mac}.cfg | 31 +++++-- .../provision/polycom/5.x/{$mac}.cfg | 31 +++++-- 4 files changed, 144 insertions(+), 16 deletions(-) diff --git a/app/devices/app_languages.php b/app/devices/app_languages.php index 577792fd96..7b7118fae8 100644 --- a/app/devices/app_languages.php +++ b/app/devices/app_languages.php @@ -1728,6 +1728,97 @@ $text['label-automata']['de-at'] = "automata"; $text['label-automata']['ar-eg'] = ""; $text['label-automata']['he'] = ""; +$text['label-messages']['en-us'] = "Messages"; +$text['label-messages']['es-cl'] = "Messages"; +$text['label-messages']['pt-pt'] = "Messages"; +$text['label-messages']['fr-fr'] = "Messages"; +$text['label-messages']['pt-br'] = "Messages"; +$text['label-messages']['pl'] = "Messages"; +$text['label-messages']['uk'] = "Messages"; +$text['label-messages']['sv-se'] = "Messages"; +$text['label-messages']['ro'] = "Messages"; +$text['label-messages']['de-at'] = "Messages"; +$text['label-messages']['ar-eg'] = "Messages"; +$text['label-messages']['he'] = "Messages"; + +$text['label-micmute']['en-us'] = "MicMute"; +$text['label-micmute']['es-cl'] = "MicMute"; +$text['label-micmute']['pt-pt'] = "MicMute"; +$text['label-micmute']['fr-fr'] = "MicMute"; +$text['label-micmute']['pt-br'] = "MicMute"; +$text['label-micmute']['pl'] = "MicMute"; +$text['label-micmute']['uk'] = "MicMute"; +$text['label-micmute']['sv-se'] = "MicMute"; +$text['label-micmute']['ro'] = "MicMute"; +$text['label-micmute']['de-at'] = "MicMute"; +$text['label-micmute']['ar-eg'] = "MicMute"; +$text['label-micmute']['he'] = "MicMute"; + +$text['label-redial']['en-us'] = "Redial"; +$text['label-redial']['es-cl'] = "Redial"; +$text['label-redial']['pt-pt'] = "Redial"; +$text['label-redial']['fr-fr'] = "Redial"; +$text['label-redial']['pt-br'] = "Redial"; +$text['label-redial']['pl'] = "Redial"; +$text['label-redial']['uk'] = "Redial"; +$text['label-redial']['sv-se'] = "Redial"; +$text['label-redial']['ro'] = "Redial"; +$text['label-redial']['de-at'] = "Redial"; +$text['label-redial']['ar-eg'] = "Redial"; +$text['label-redial']['he'] = "Redial"; + +$text['label-null']['en-us'] = "Null"; +$text['label-null']['es-cl'] = "Null"; +$text['label-null']['pt-pt'] = "Null"; +$text['label-null']['fr-fr'] = "Null"; +$text['label-null']['pt-br'] = "Null"; +$text['label-null']['pl'] = "Null"; +$text['label-null']['uk'] = "Null"; +$text['label-null']['sv-se'] = "Null"; +$text['label-null']['ro'] = "Null"; +$text['label-null']['de-at'] = "Null"; +$text['label-null']['ar-eg'] = "Null"; +$text['label-null']['he'] = "Null"; + +$text['label-speeddial']['en-us'] = "SpeedDial"; +$text['label-speeddial']['es-cl'] = "SpeedDial"; +$text['label-speeddial']['pt-pt'] = "SpeedDial"; +$text['label-speeddial']['fr-fr'] = "SpeedDial"; +$text['label-speeddial']['pt-br'] = "SpeedDial"; +$text['label-speeddial']['pl'] = "SpeedDial"; +$text['label-speeddial']['uk'] = "SpeedDial"; +$text['label-speeddial']['sv-se'] = "SpeedDial"; +$text['label-speeddial']['ro'] = "SpeedDial"; +$text['label-speeddial']['de-at'] = "SpeedDial"; +$text['label-speeddial']['ar-eg'] = "SpeedDial"; +$text['label-speeddial']['he'] = "SpeedDial"; + +$text['label-speeddialmenu']['en-us'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['es-cl'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['pt-pt'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['fr-fr'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['pt-br'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['pl'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['uk'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['sv-se'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['ro'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['de-at'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['ar-eg'] = "SpeedDialMenu"; +$text['label-speeddialmenu']['he'] = "SpeedDialMenu"; + +$text['label-url']['en-us'] = "URL"; +$text['label-url']['es-cl'] = "URL"; +$text['label-url']['pt-pt'] = "URL"; +$text['label-url']['fr-fr'] = "URL"; +$text['label-url']['pt-br'] = "URL"; +$text['label-url']['pl'] = "URL"; +$text['label-url']['uk'] = "URL"; +$text['label-url']['sv-se'] = "URL"; +$text['label-url']['ro'] = "URL"; +$text['label-url']['de-at'] = "URL"; +$text['label-url']['ar-eg'] = "URL"; +$text['label-url']['he'] = "URL"; + $text['label-auto_answer']['en-us'] = "Auto Answer"; $text['label-auto_answer']['es-cl'] = "Respuesta Automática"; $text['label-auto_answer']['pt-pt'] = "Resposta Automática"; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index af2231ef23..20fc4e00c1 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -964,6 +964,13 @@ require_once "resources/require.php"; + + + + + + + "; } } diff --git a/resources/templates/provision/polycom/4.x/{$mac}.cfg b/resources/templates/provision/polycom/4.x/{$mac}.cfg index b5d9431b66..868b864a97 100644 --- a/resources/templates/provision/polycom/4.x/{$mac}.cfg +++ b/resources/templates/provision/polycom/4.x/{$mac}.cfg @@ -1,9 +1,9 @@ \ No newline at end of file diff --git a/resources/templates/provision/polycom/5.x/{$mac}.cfg b/resources/templates/provision/polycom/5.x/{$mac}.cfg index b5d9431b66..868b864a97 100755 --- a/resources/templates/provision/polycom/5.x/{$mac}.cfg +++ b/resources/templates/provision/polycom/5.x/{$mac}.cfg @@ -1,9 +1,9 @@ \ No newline at end of file From 286283bcf08261f736a4f807ee6436566f1fd427 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 12 Nov 2015 18:51:44 -0700 Subject: [PATCH 018/232] Correct polycom template logic and change the && (and) to || (or). --- resources/templates/provision/polycom/4.x/{$mac}.cfg | 2 +- resources/templates/provision/polycom/5.x/{$mac}.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/templates/provision/polycom/4.x/{$mac}.cfg b/resources/templates/provision/polycom/4.x/{$mac}.cfg index 868b864a97..c8f8e4a624 100644 --- a/resources/templates/provision/polycom/4.x/{$mac}.cfg +++ b/resources/templates/provision/polycom/4.x/{$mac}.cfg @@ -60,7 +60,7 @@ feature.enhancedFeatureKeys.enabled="1" {foreach $keys as $row} {if $row.device_key_category == "line"} - {if $row.device_key_type == "automata" && $row.device_key_type == "normal"} + {if $row.device_key_type == "automata" || $row.device_key_type == "normal"} attendant.resourceList.{$row.device_key_id}.address="{$row.device_key_value}" attendant.resourceList.{$row.device_key_id}.callAddress="" attendant.resourceList.{$row.device_key_id}.label="{$row.device_key_label}" diff --git a/resources/templates/provision/polycom/5.x/{$mac}.cfg b/resources/templates/provision/polycom/5.x/{$mac}.cfg index 868b864a97..c8f8e4a624 100755 --- a/resources/templates/provision/polycom/5.x/{$mac}.cfg +++ b/resources/templates/provision/polycom/5.x/{$mac}.cfg @@ -60,7 +60,7 @@ feature.enhancedFeatureKeys.enabled="1" {foreach $keys as $row} {if $row.device_key_category == "line"} - {if $row.device_key_type == "automata" && $row.device_key_type == "normal"} + {if $row.device_key_type == "automata" || $row.device_key_type == "normal"} attendant.resourceList.{$row.device_key_id}.address="{$row.device_key_value}" attendant.resourceList.{$row.device_key_id}.callAddress="" attendant.resourceList.{$row.device_key_id}.label="{$row.device_key_label}" From ffe25a3d2e3d029edefd7bd0030a2fe65f6ce5fa Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 12 Nov 2015 19:11:31 -0700 Subject: [PATCH 019/232] Polycom key type capitalize the first letter of Automata and Normal. --- app/devices/app_languages.php | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/devices/app_languages.php b/app/devices/app_languages.php index 7b7118fae8..c0667a6139 100644 --- a/app/devices/app_languages.php +++ b/app/devices/app_languages.php @@ -789,17 +789,17 @@ $text['label-orbit']['de-at'] = "Park + Orbit"; $text['label-orbit']['ar-eg'] = ""; $text['label-orbit']['he'] = ""; -$text['label-normal']['en-us'] = "normal"; -$text['label-normal']['es-cl'] = "normal"; -$text['label-normal']['pt-pt'] = "normal"; -$text['label-normal']['fr-fr'] = "normal"; +$text['label-normal']['en-us'] = "Normal"; +$text['label-normal']['es-cl'] = "Normal"; +$text['label-normal']['pt-pt'] = "Normal"; +$text['label-normal']['fr-fr'] = "Normal"; $text['label-normal']['pt-br'] = "Normal"; -$text['label-normal']['pl'] = "normalny"; -$text['label-normal']['uk'] = "звичайно"; -$text['label-normal']['sv-se'] = "normal"; -$text['label-normal']['de-at'] = "normal"; -$text['label-normal']['ar-eg'] = ""; -$text['label-normal']['he'] = ""; +$text['label-normal']['pl'] = "Normalny"; +$text['label-normal']['uk'] = "Звичайно"; +$text['label-normal']['sv-se'] = "Normal"; +$text['label-normal']['de-at'] = "Normal"; +$text['label-normal']['ar-eg'] = "Normal"; +$text['label-normal']['he'] = "Normal"; $text['label-none']['en-us'] = "None"; $text['label-none']['es-cl'] = "Ninguno"; @@ -1715,18 +1715,18 @@ $text['label-xfer']['de-at'] = ""; $text['label-xfer']['ar-eg'] = ""; $text['label-xfer']['he'] = ""; -$text['label-automata']['en-us'] = "automata"; -$text['label-automata']['es-cl'] = "automata"; -$text['label-automata']['pt-pt'] = "automata"; -$text['label-automata']['fr-fr'] = "automata"; +$text['label-automata']['en-us'] = "Automata"; +$text['label-automata']['es-cl'] = "Automata"; +$text['label-automata']['pt-pt'] = "Automata"; +$text['label-automata']['fr-fr'] = "Automata"; $text['label-automata']['pt-br'] = "Automata"; -$text['label-automata']['pl'] = "automaty"; -$text['label-automata']['uk'] = ""; +$text['label-automata']['pl'] = "Automaty"; +$text['label-automata']['uk'] = "Automata"; $text['label-automata']['sv-se'] = "Automata"; -$text['label-automata']['ro'] = ""; -$text['label-automata']['de-at'] = "automata"; -$text['label-automata']['ar-eg'] = ""; -$text['label-automata']['he'] = ""; +$text['label-automata']['ro'] = "Automata"; +$text['label-automata']['de-at'] = "Automata"; +$text['label-automata']['ar-eg'] = "Automata"; +$text['label-automata']['he'] = "Automata"; $text['label-messages']['en-us'] = "Messages"; $text['label-messages']['es-cl'] = "Messages"; From 7581e815224e0d5803787a60adecec4f740318dc Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 12 Nov 2015 19:27:29 -0700 Subject: [PATCH 020/232] Add the additional key types to the device key profile. --- app/devices/device_profile_edit.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/devices/device_profile_edit.php b/app/devices/device_profile_edit.php index db58b6063a..bfe703b584 100644 --- a/app/devices/device_profile_edit.php +++ b/app/devices/device_profile_edit.php @@ -454,6 +454,13 @@ require_once "resources/require.php"; + + + + + + + "; } } From 8273ba4e59fa6d83d6bdf5470b6b6125618cba6a Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 14 Nov 2015 17:18:32 -0700 Subject: [PATCH 021/232] Fix call center queue delete. --- app/call_centers/call_center_queue_delete.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/call_centers/call_center_queue_delete.php b/app/call_centers/call_center_queue_delete.php index 5abb84093f..ced29c5cbf 100644 --- a/app/call_centers/call_center_queue_delete.php +++ b/app/call_centers/call_center_queue_delete.php @@ -66,7 +66,7 @@ if (strlen($id) > 0) { //delete the call center queue $sql = "delete from v_call_center_queues "; $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and dialplan_uuid = '$dialplan_uuid' "; + $sql .= "and call_center_queue_uuid = '$id' "; $db->query($sql); unset($sql); From 75b2742fbf6f17af373fcd63ca60cca5bbefbbf8 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 14 Nov 2015 17:56:20 -0700 Subject: [PATCH 022/232] Correct the consistency of the indentation. --- app/call_centers/call_center_queue_delete.php | 91 ++++++++++--------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/app/call_centers/call_center_queue_delete.php b/app/call_centers/call_center_queue_delete.php index ced29c5cbf..e00655459a 100644 --- a/app/call_centers/call_center_queue_delete.php +++ b/app/call_centers/call_center_queue_delete.php @@ -43,59 +43,60 @@ else { $id = check_str($_GET["id"]); } -if (strlen($id) > 0) { +//delete the data + if (strlen($id) > 0) { - //get the dialplan uuid - $sql = "select * from v_call_center_queues "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and call_center_queue_uuid = '$id' "; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) { - $queue_name = $row['queue_name']; - $dialplan_uuid = $row['dialplan_uuid']; - } + //get the dialplan uuid + $sql = "select * from v_call_center_queues "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and call_center_queue_uuid = '$id' "; + $prep_statement = $db->prepare($sql); + $prep_statement->execute(); + while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) { + $queue_name = $row['queue_name']; + $dialplan_uuid = $row['dialplan_uuid']; + } - //delete the tier from the database - $sql = "delete from v_call_center_tiers "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and queue_name = '$queue_name' "; - $db->query($sql); - unset($sql); + //delete the tier from the database + $sql = "delete from v_call_center_tiers "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and queue_name = '$queue_name' "; + $db->query($sql); + unset($sql); - //delete the call center queue - $sql = "delete from v_call_center_queues "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and call_center_queue_uuid = '$id' "; - $db->query($sql); - unset($sql); + //delete the call center queue + $sql = "delete from v_call_center_queues "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and call_center_queue_uuid = '$id' "; + $db->query($sql); + unset($sql); - //delete the dialplan entry - $sql = "delete from v_dialplans "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and dialplan_uuid = '$dialplan_uuid' "; - $db->query($sql); - unset($sql); + //delete the dialplan entry + $sql = "delete from v_dialplans "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and dialplan_uuid = '$dialplan_uuid' "; + $db->query($sql); + unset($sql); - //delete the dialplan details - $sql = "delete from v_dialplan_details "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and dialplan_uuid = '$dialplan_uuid' "; - $db->query($sql); - unset($sql); + //delete the dialplan details + $sql = "delete from v_dialplan_details "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and dialplan_uuid = '$dialplan_uuid' "; + $db->query($sql); + unset($sql); - //clear the cache - $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); - remove_config_from_cache('configuration:callcenter.conf'); + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); + remove_config_from_cache('configuration:callcenter.conf'); - //synchronize configuration - save_dialplan_xml(); - save_call_center_xml(); + //synchronize configuration + save_dialplan_xml(); + save_call_center_xml(); - //apply settings reminder - $_SESSION["reload_xml"] = true; -} + //apply settings reminder + $_SESSION["reload_xml"] = true; + } //redirect the browser $_SESSION["message"] = $text['message-delete']; From 4b8e61b094683b19c150c937cdd76f2f1aad4fb5 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 14 Nov 2015 20:18:31 -0700 Subject: [PATCH 023/232] Fix the call center dialplan creation when adding a call center queue. --- app/call_centers/call_center_queue_edit.php | 34 ++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index e37cf5f245..6f9a00809d 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -255,7 +255,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $db->exec(check_sql($sql)); unset($sql); - //syncrhonize the configuration + //synchronize the configuration save_call_center_xml(); remove_config_from_cache('configuration:callcenter.conf'); @@ -311,20 +311,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } unset ($prep_statement); - //dialplan add or update - $c = new call_center; - $c->db = $db; - $c->domain_uuid = $_SESSION['domain_uuid']; - $c->call_center_queue_uuid = $call_center_queue_uuid; - $c->dialplan_uuid = $dialplan_uuid; - $c->queue_name = $queue_name; - $c->queue_name = $queue_name; - $c->queue_cid_prefix = $queue_cid_prefix; - $c->queue_timeout_action = $queue_timeout_action; - $c->queue_description = $queue_description; - $c->destination_number = $queue_extension; - $a = $c->dialplan(); - //synchronize the configuration save_call_center_xml(); remove_config_from_cache('configuration:callcenter.conf'); @@ -337,6 +323,20 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $_SESSION["message"] = $text['message-update']; } //if ($action == "update") + //dialplan add or update + $c = new call_center; + $c->db = $db; + $c->domain_uuid = $_SESSION['domain_uuid']; + $c->call_center_queue_uuid = $call_center_queue_uuid; + $c->dialplan_uuid = $dialplan_uuid; + $c->queue_name = $queue_name; + $c->queue_name = $queue_name; + $c->queue_cid_prefix = $queue_cid_prefix; + $c->queue_timeout_action = $queue_timeout_action; + $c->queue_description = $queue_description; + $c->destination_number = $queue_extension; + $a = $c->dialplan(); + //add agent/tier to queue $agent_name = check_str($_POST["agent_name"]); $tier_level = check_str($_POST["tier_level"]); @@ -399,8 +399,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //redirect - header("Location: call_center_queue_edit.php?id=".$call_center_queue_uuid); - return; + header("Location: call_center_queue_edit.php?id=".$call_center_queue_uuid); + return; } //if ($_POST["persistformvar"] != "true") } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) From b53999069ca1b7218475ecd27afcbbd91ea4b788 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Mon, 16 Nov 2015 09:41:34 +0000 Subject: [PATCH 024/232] Enhancements to language support (for future use) optimized the text.php to check the language code once, not every time --- resources/classes/text.php | 15 +++++++++------ resources/install.php | 2 +- themes/flags/ar-eg.png | Bin 0 -> 506 bytes themes/flags/de-at.png | Bin 0 -> 403 bytes themes/flags/en-us.png | Bin 0 -> 609 bytes themes/flags/es-cl.png | Bin 0 -> 450 bytes themes/flags/fr-fr.png | Bin 0 -> 545 bytes themes/flags/nl-nl.png | Bin 0 -> 453 bytes themes/flags/pl.png | Bin 0 -> 374 bytes themes/flags/pt-br.png | Bin 0 -> 593 bytes themes/flags/pt-pt.png | Bin 0 -> 554 bytes themes/flags/sv-se.png | Bin 0 -> 542 bytes themes/flags/uk.png | Bin 0 -> 446 bytes 13 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 themes/flags/ar-eg.png create mode 100644 themes/flags/de-at.png create mode 100644 themes/flags/en-us.png create mode 100644 themes/flags/es-cl.png create mode 100644 themes/flags/fr-fr.png create mode 100644 themes/flags/nl-nl.png create mode 100644 themes/flags/pl.png create mode 100644 themes/flags/pt-br.png create mode 100644 themes/flags/pt-pt.png create mode 100644 themes/flags/sv-se.png create mode 100644 themes/flags/uk.png diff --git a/resources/classes/text.php b/resources/classes/text.php index dcff4a97be..e78095afd3 100644 --- a/resources/classes/text.php +++ b/resources/classes/text.php @@ -30,6 +30,8 @@ class text { * @var string $app_path examples: app/exec or core/domains */ public function get($language_code = null, $app_path = null) { + //get the global app_languages.php + include $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/app_languages.php"; //get the app_languages.php if ($app_path != null) { include $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/".$app_path."/app_languages.php"; @@ -49,15 +51,16 @@ class text { } $_SESSION['app']['languages'] = array_unique($app_languages); + //check the session language + if(isset($_SESSION['domain'])){ + $language_code = $_SESSION['domain']['language']['code']; + }elseif($language_code == null){ + $language_code = 'en-us'; + } //reduce to specific language if ($language_code != 'all') { foreach($text as $key => $value) { - if ($language_code == null) { - $text[$key] = $value[$_SESSION['domain']['language']['code']]; - } - else { - $text[$key] = $value[$language_code]; - } + $text[$key] = $value[$language_code]; } } diff --git a/resources/install.php b/resources/install.php index 5680e4162d..614b78f280 100644 --- a/resources/install.php +++ b/resources/install.php @@ -1745,7 +1745,7 @@ EOL; $theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes'; if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) { while (false !== ($dir_name = readdir($handle))) { - if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && $dir_name != ".git" && is_readable($theme_dir.'/'.$dir_name)) { + if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && $dir_name != ".git" && $dir_name != "flags" && is_readable($theme_dir.'/'.$dir_name)) { $dir_label = str_replace('_', ' ', $dir_name); $dir_label = str_replace('-', ' ', $dir_label); if ($dir_name == $install_template_name) { diff --git a/themes/flags/ar-eg.png b/themes/flags/ar-eg.png new file mode 100644 index 0000000000000000000000000000000000000000..e5ef8f1fcddb9fa0b89c353430e9640c122445cc GIT binary patch literal 506 zcmVNL7TW{{R0! zJP>i}(MpzaSkj z=eqvqa`^|6{{QbQRQ11q3~Vg_kG}Z}5I`(hw}ncX8D4$|h64jUK>or*=^r$dfI%n0 z$3MKz;!F0w91GjkkV%_X`@4 wKR^hm`X5LwD9*v?4;TUC6Bz$&3;+QJ0QLcJ=WT{TU;qFB07*qoM6N<$f>3bX%K!iX literal 0 HcmV?d00001 diff --git a/themes/flags/de-at.png b/themes/flags/de-at.png new file mode 100644 index 0000000000000000000000000000000000000000..0f15f34f2883c4b4360fc871d7105309f1533282 GIT binary patch literal 403 zcmV;E0c`$>P)@|4`Xj5kLT%`al?B=W5I`&prl$WjwHQRjfmQ&G0jUOA z@&|Dug_Rm`2Y251|$~)1M2@@6mI}!8O6olw6y^Q z5X--d7nzS8`+x5q12kBmVFD!~j6c5_fMKno0(1^Q0I>i=is|LjXX40RRttS6cG0UZ?;7002ovPDHLkV1fxUnjZiF literal 0 HcmV?d00001 diff --git a/themes/flags/en-us.png b/themes/flags/en-us.png new file mode 100644 index 0000000000000000000000000000000000000000..10f451fe85c41c6c9a06d543a57114ae2f87ecc1 GIT binary patch literal 609 zcmV-n0-pVeP){qW|y?pud`Sa)3|NY&vWd%S0u>b>P!2!lUe;6EF*#G_c zFVXVt@6Q{uX@40W{p0iY2Aa+A^Cu7i8KT+YH}2j52q4BskM2rJ$^k9;2Xxc_|Np=M z&VaLlA*IO5FlECMfB<5VUNC{tBZO(|zW*;@GJN;|bTJ71`0*d;`d`2P!x=ymOA`2> z+y@9C##^^8%gd{MW@Y91_2d742B2~OQNf=-zkmD?Vqkdk_wPTUNeuu2#KPTG{_;O4 v7C%8E5*DLB7#Kb?Fnj}}-(W6879hX?8lYRg`Y`<~00000NkvXXu0mjfD6Jtx literal 0 HcmV?d00001 diff --git a/themes/flags/es-cl.png b/themes/flags/es-cl.png new file mode 100644 index 0000000000000000000000000000000000000000..29c6d61bd4f16075228cdc6e526aafc3443029d7 GIT binary patch literal 450 zcmV;z0X_bSP)FfafF5DUYXKh;r+@n*scPQUy6`!63S zGXn!71H*qtMn-04W+o=4|487=moEST#KiEAA;m(3;Xgy1iO{3BKc9a12~-UM7^Z`) z1qdLZI~bN-c=z}J|D88K{QmR*&tHcBxB*ZDKmf5Ya0q<-!`is-{h$8~f7m(x{QZSX zH3Jv`1P}|uy*o^wIGI2G`1kie)4zYe_&EQ6|NftW0ohon1}3I|Z{7d|5aVBlgG%);U`26kn-@hOg zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8# zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj% z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&Z@|4`Xj5kLTv#?55wQzKoX38|NjLffBpXj6#2y{D-E;(Ab?mHL=FGT z$TP6>fK>na1GWK({(upf0nrSU5*Gz(00%w4e}91F-@gjtJbOE500a;V!?RECzy5mt@dro_q~YJM-#~SLe}OeX zNT7y4|NilCvNABd0|+1%hF>6clER!2lYo}|1|zVkK=SXOfB*mf{rC6ZKVbL)odgg- vjKFAPVE6?_e~=h|kVO7~qZmRm0R$KTYszPUy89K;00000NkvXXu0mjfB$dbi literal 0 HcmV?d00001 diff --git a/themes/flags/pl.png b/themes/flags/pl.png new file mode 100644 index 0000000000000000000000000000000000000000..d413d010b5b097c4e0a4604eba86dad79567ed16 GIT binary patch literal 374 zcmV-+0g3*JP)Ab?mv3iQ8Nu5A{|6C_|Nk>HFfjc`0biay0|+1% z2B@O{$c+Ek03##gzdwHf0*Hl3)etG5lK=vU1?W~rxN0!OqXDP`Ab?mH`1u+7`u;zA z_W#cxhChG)!_n{G|9=A+zrl>(AX#bYe+w4^1Q6Is4VEzI_51&? zUm!LT$@u9L&^Z7B1a=Zw2xL66B2?87%l|Mi00a<712fnG3~)u5+Wr7F{AKw27w8;- z00L=X`u&GNQW9*;Uxq&*os3{386YGO{rw9;K*az7#P}5)xp2gQ%0-g`0)PMm0MPYZ UsK>Njp#T5?07*qoM6N<$g4HXSwg3PC literal 0 HcmV?d00001 diff --git a/themes/flags/pt-br.png b/themes/flags/pt-br.png new file mode 100644 index 0000000000000000000000000000000000000000..9b1a5538b264a295021f4f717d4299bb8ed98d98 GIT binary patch literal 593 zcmV-X0j-HAXl7XJGjM{~r+i{r~sxzrQwG-&h#_Y&p;L z=ieV7_s^f-zyJOD{rC5(+EoAn1k&)I;s3Kw&;LT?{{2}P{Pq8T&j0^^J4?LvUd;UK z&+k8ffB*XXONL(tXahh1fi?X94^$0Q>Z$uRRO)Y4)uapmB!2(-ul(c1=C+V!kAF`) z$PCo;`_FHns{jIs3Fu;wy-Z(c2YwAz{&V4aXk?bejFO*Op&u`@i~PecqBpL@DIoojb8mb+WHGK%fG2>)a3=iVf_~v+`s?*1;!`?Kmai^I3i*ZIYtpN f{g(k500bBS@op82)aAGO;3n0AgYI#891D4N?IF|Ns4E{L7&Dm*MXp#y@|U|NLS4 z{rmr)KmTFmmra`h0*Hly38?u0llM=#nEx6H|J4!x{U`A6pVzdvv{Rd?JIrI9L zs`Fos+0`Q4a^C}Q0+k5A1KaQ$>Lf<6lK=vUh2aka(D+|}f9<^YM_B9kC$A?0Z|}3+ z`ptao7t>dSY6f5^0o~2O01!YR8-T_G^}PA>yZ7X8cHUpx=KlJ_{+sC?ST#h$AD{+c zSpNn30U&@_7``$5{_{tYU-I{#-$2g*Lz_YNHw#c5FVJd`!65YaF9ZRd1Q0-s48{x$ s?-&?Px# literal 0 HcmV?d00001 diff --git a/themes/flags/sv-se.png b/themes/flags/sv-se.png new file mode 100644 index 0000000000000000000000000000000000000000..1994653dac1fc1c6ee3c9fcb35c8af97f16eefc7 GIT binary patch literal 542 zcmV+(0^$9MP)a|fPuet^$h(7pHv_{jfB<3vn*8q{15ov!pR5qo|Ns4BVf^v!57RHO zo?l?}`yWs<(7C?=0*LYNK?X*pGKOD3v;Q#s|MUOfZxH$qCjb2cBQWFtZ$@_cPkRpn z1P}|u9|n-AAQdnT|9?TXAyk7H4FCQBl>h_~&`AvcLF)bhMS(&{8jwh^2qVzve;5D) zh>=0RIIAq+{+o}$pxEl(3%2T)`P!1-fBt~{@Pp~sA7J?W`}60ovKZgl)=2;X#KQ37 z&mWM7{{H^+4`$e}UqIEMAo>Rk|KALM|1kdh!vsX^3=B^I0*D0|DL|!?{M^6*VPKPH z00z{*-?BnHps)wJ`QKllIe-8D1EGJQNCgNWMh3}bctpOPvlbWzK!=K^+cJPc;};D5 g19O2S13-WQ0NlBGh$rR(5C8xG07*qoM6N<$f_QiWUjP6A literal 0 HcmV?d00001 diff --git a/themes/flags/uk.png b/themes/flags/uk.png new file mode 100644 index 0000000000000000000000000000000000000000..09563a21941f2a94c937d43aceda1aa546246302 GIT binary patch literal 446 zcmV;v0YUzWP))t0eYh-DxnQ(+0I@JIfmA>F`X8wD?>`2h#NWRRzyE`zA&Pzh5tt#% z!^rUCA3y+sZ1@LM1hf`pHc0ia|NsB|1uKPX0CRu;1-SztfLMSo`wOxir1}rsY$VlC z667idh7Sw?0mQ-}a!Q0#;n&}vAb0=!_Zy@WNd5!6=O2ju7s{65Vq=gx0uVrqe;+b1 z$mIY3|KLBvF9x7j{{!v#g_UGtQhI;<6hHv607H@yECdWlR7EJN!LomVp$!l~APvkQ z4p0cL2#YobhQA>6hXEjfKpL3-19eKmL_s!=;22W8vp Date: Mon, 16 Nov 2015 16:59:11 -0700 Subject: [PATCH 025/232] Add voicemail record-silence-threshold variable and change the default threshold from 30 to 300. --- resources/install/scripts/app/voicemail/index.lua | 4 ++++ .../voicemail/resources/functions/record_greeting.lua | 3 +-- .../app/voicemail/resources/functions/record_message.lua | 9 ++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/resources/install/scripts/app/voicemail/index.lua b/resources/install/scripts/app/voicemail/index.lua index ee9e79e5cd..2cddb544c1 100644 --- a/resources/install/scripts/app/voicemail/index.lua +++ b/resources/install/scripts/app/voicemail/index.lua @@ -78,6 +78,10 @@ if (not vm_disk_quota) then vm_disk_quota = session:getVariable("vm_disk_quota"); end + record_silence_threshold = session:getVariable("record-silence-threshold"); + if (not record_silence_threshold) then + record_silence_threshold = 300; + end voicemail_authorized = session:getVariable("voicemail_authorized"); if (not vm_message_ext) then vm_message_ext = 'wav'; end diff --git a/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua b/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua index da41ef98fb..efa6da0e36 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/record_greeting.lua @@ -63,11 +63,10 @@ --prepare to record the greeting if (session:ready()) then max_len_seconds = 30; - silence_threshold = 30; silence_seconds = 5; mkdir(voicemail_dir.."/"..voicemail_id); -- syntax is session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs) - result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".tmp.wav", max_len_seconds, silence_threshold, silence_seconds); + result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".tmp.wav", max_len_seconds, record_silence_threshold, silence_seconds); --session:execute("record", voicemail_dir.."/"..uuid.." 180 200"); end end diff --git a/resources/install/scripts/app/voicemail/resources/functions/record_message.lua b/resources/install/scripts/app/voicemail/resources/functions/record_message.lua index 4b830f5297..397e52c32e 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/record_message.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/record_message.lua @@ -143,10 +143,9 @@ --save the recording -- syntax is session:recordFile(file_name, max_len_secs, silence_threshold, silence_secs) max_len_seconds = 300; - silence_threshold = 30; silence_seconds = 5; if (storage_path == "http_cache") then - result = session:recordFile(storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, silence_threshold, silence_seconds); + result = session:recordFile(storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, record_silence_threshold, silence_seconds); else mkdir(voicemail_dir.."/"..voicemail_id); if (vm_message_ext == "mp3") then @@ -154,10 +153,10 @@ if (shout_exists == "true") then freeswitch.consoleLog("notice", "using mod_shout for mp3 encoding\n"); --record in mp3 directly - result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3", max_len_seconds, silence_threshold, silence_seconds); + result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".mp3", max_len_seconds, record_silence_threshold, silence_seconds); else --create initial wav recording - result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav", max_len_seconds, silence_threshold, silence_seconds); + result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav", max_len_seconds, record_silence_threshold, silence_seconds); --use lame to encode, if available if (file_exists("/usr/bin/lame")) then freeswitch.consoleLog("notice", "using lame for mp3 encoding\n"); @@ -176,7 +175,7 @@ end end else - result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, silence_threshold, silence_seconds); + result = session:recordFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, max_len_seconds, record_silence_threshold, silence_seconds); end end From e66b2f831aacd28d0bfae3f5943a38cb9ebc7742 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 17 Nov 2015 16:01:03 +0000 Subject: [PATCH 026/232] added support to name the languages added remaining flags i have from the famfamfam set and renamed them to country names --- core/app_languages.php | 18 ++++++++++++++ resources/classes/text.php | 22 ++++++++++-------- themes/flags/Afghanistan.png | Bin 0 -> 604 bytes themes/flags/Aland Islands.png | Bin 0 -> 663 bytes themes/flags/Albania.png | Bin 0 -> 600 bytes themes/flags/Algeria.png | Bin 0 -> 582 bytes themes/flags/American Samoa.png | Bin 0 -> 647 bytes themes/flags/Andorra.png | Bin 0 -> 643 bytes themes/flags/Angola.png | Bin 0 -> 428 bytes themes/flags/Anguilla.png | Bin 0 -> 643 bytes themes/flags/Antigua and Barbuda.png | Bin 0 -> 591 bytes themes/flags/Argentina.png | Bin 0 -> 506 bytes themes/flags/Armenia.png | Bin 0 -> 497 bytes themes/flags/Aruba.png | Bin 0 -> 524 bytes themes/flags/Australia.png | Bin 0 -> 673 bytes themes/flags/Austria.png | Bin 0 -> 403 bytes themes/flags/Azerbaijan.png | Bin 0 -> 589 bytes themes/flags/Bahamas.png | Bin 0 -> 526 bytes themes/flags/Bahrain.png | Bin 0 -> 457 bytes themes/flags/Bangladesh.png | Bin 0 -> 504 bytes themes/flags/Barbados.png | Bin 0 -> 585 bytes themes/flags/Belarus.png | Bin 0 -> 514 bytes themes/flags/Belgium.png | Bin 0 -> 449 bytes themes/flags/Belize.png | Bin 0 -> 600 bytes themes/flags/Benin.png | Bin 0 -> 486 bytes themes/flags/Bermuda.png | Bin 0 -> 611 bytes themes/flags/Bhutan.png | Bin 0 -> 631 bytes .../flags/Bolivia, Plurinational State of.png | Bin 0 -> 500 bytes themes/flags/Bosnia and Herzegovina.png | Bin 0 -> 593 bytes themes/flags/Botswana.png | Bin 0 -> 443 bytes themes/flags/Bouvet Island.png | Bin 0 -> 512 bytes themes/flags/Brazil.png | Bin 0 -> 593 bytes .../flags/British Indian Ocean Territory.png | Bin 0 -> 658 bytes themes/flags/Brunei Darussalam.png | Bin 0 -> 639 bytes themes/flags/Bulgaria.png | Bin 0 -> 462 bytes themes/flags/Burkina Faso.png | Bin 0 -> 497 bytes themes/flags/Burundi.png | Bin 0 -> 675 bytes themes/flags/Cabo Verde.png | Bin 0 -> 529 bytes themes/flags/Cambodia.png | Bin 0 -> 549 bytes themes/flags/Cameroon.png | Bin 0 -> 525 bytes themes/flags/Canada.png | Bin 0 -> 628 bytes themes/flags/Cayman Islands.png | Bin 0 -> 643 bytes themes/flags/Central African Republic.png | Bin 0 -> 614 bytes themes/flags/Chad.png | Bin 0 -> 570 bytes themes/flags/Chile.png | Bin 0 -> 450 bytes themes/flags/China.png | Bin 0 -> 472 bytes themes/flags/Christmas Island.png | Bin 0 -> 608 bytes themes/flags/Cocos (Keeling) Islands.png | Bin 0 -> 625 bytes themes/flags/Colombia.png | Bin 0 -> 483 bytes themes/flags/Comoros.png | Bin 0 -> 577 bytes .../Congo, the Democratic Republic of the.png | Bin 0 -> 528 bytes themes/flags/Congo.png | Bin 0 -> 521 bytes themes/flags/Cook Islands.png | Bin 0 -> 586 bytes themes/flags/Costa Rica.png | Bin 0 -> 477 bytes themes/flags/Cote d'Ivoire.png | Bin 0 -> 453 bytes themes/flags/Croatia.png | Bin 0 -> 524 bytes themes/flags/Cuba.png | Bin 0 -> 563 bytes themes/flags/Cyprus.png | Bin 0 -> 428 bytes themes/flags/Czech Republic.png | Bin 0 -> 476 bytes themes/flags/Denmark.png | Bin 0 -> 495 bytes themes/flags/Djibouti.png | Bin 0 -> 572 bytes themes/flags/Dominica.png | Bin 0 -> 620 bytes themes/flags/Dominican Republic.png | Bin 0 -> 508 bytes themes/flags/Ecuador.png | Bin 0 -> 500 bytes themes/flags/Egypt.png | Bin 0 -> 465 bytes themes/flags/El Salvador.png | Bin 0 -> 501 bytes themes/flags/Equatorial Guinea.png | Bin 0 -> 537 bytes themes/flags/Eritrea.png | Bin 0 -> 653 bytes themes/flags/Estonia.png | Bin 0 -> 429 bytes themes/flags/Ethiopia.png | Bin 0 -> 592 bytes themes/flags/Falkland Islands (Malvinas).png | Bin 0 -> 648 bytes themes/flags/Faroe Islands.png | Bin 0 -> 474 bytes themes/flags/Fiji.png | Bin 0 -> 610 bytes themes/flags/Finland.png | Bin 0 -> 489 bytes themes/flags/France.png | Bin 0 -> 545 bytes themes/flags/French Guiana.png | Bin 0 -> 545 bytes themes/flags/French Polynesia.png | Bin 0 -> 498 bytes themes/flags/French Southern Territories.png | Bin 0 -> 527 bytes themes/flags/Gabon.png | Bin 0 -> 489 bytes themes/flags/Gambia.png | Bin 0 -> 493 bytes themes/flags/Georgia.png | Bin 0 -> 594 bytes themes/flags/Germany.png | Bin 0 -> 545 bytes themes/flags/Ghana.png | Bin 0 -> 490 bytes themes/flags/Gibraltar.png | Bin 0 -> 463 bytes themes/flags/Greece.png | Bin 0 -> 487 bytes themes/flags/Greenland.png | Bin 0 -> 470 bytes themes/flags/Grenada.png | Bin 0 -> 637 bytes themes/flags/Guadeloupe.png | Bin 0 -> 488 bytes themes/flags/Guam.png | Bin 0 -> 509 bytes themes/flags/Guatemala.png | Bin 0 -> 493 bytes themes/flags/Guinea-Bissau.png | Bin 0 -> 516 bytes themes/flags/Guinea.png | Bin 0 -> 480 bytes themes/flags/Guyana.png | Bin 0 -> 645 bytes themes/flags/Haiti.png | Bin 0 -> 487 bytes .../Heard Island and McDonald Islands.png | Bin 0 -> 673 bytes themes/flags/Holy See.png | Bin 0 -> 553 bytes themes/flags/Honduras.png | Bin 0 -> 537 bytes themes/flags/Hong Kong.png | Bin 0 -> 527 bytes themes/flags/Hungary.png | Bin 0 -> 432 bytes themes/flags/Iceland.png | Bin 0 -> 532 bytes themes/flags/India.png | Bin 0 -> 503 bytes themes/flags/Indonesia.png | Bin 0 -> 430 bytes themes/flags/Iran, Islamic Republic of.png | Bin 0 -> 512 bytes themes/flags/Iraq.png | Bin 0 -> 515 bytes themes/flags/Ireland.png | Bin 0 -> 481 bytes themes/flags/Israel.png | Bin 0 -> 431 bytes themes/flags/Italy.png | Bin 0 -> 420 bytes themes/flags/Jamaica.png | Bin 0 -> 637 bytes themes/flags/Japan.png | Bin 0 -> 420 bytes themes/flags/Jordan.png | Bin 0 -> 473 bytes themes/flags/Kazakhstan.png | Bin 0 -> 616 bytes themes/flags/Kenya.png | Bin 0 -> 569 bytes themes/flags/Kiribati.png | Bin 0 -> 656 bytes ...Korea, Democratic People's Republic of.png | Bin 0 -> 561 bytes themes/flags/Korea, Republic of.png | Bin 0 -> 592 bytes themes/flags/Kuwait.png | Bin 0 -> 486 bytes themes/flags/Kyrgyzstan.png | Bin 0 -> 510 bytes .../Lao People's Democratic Republic.png | Bin 0 -> 563 bytes themes/flags/Latvia.png | Bin 0 -> 465 bytes themes/flags/Lebanon.png | Bin 0 -> 517 bytes themes/flags/Lesotho.png | Bin 0 -> 628 bytes themes/flags/Liberia.png | Bin 0 -> 466 bytes themes/flags/Libya.png | Bin 0 -> 419 bytes themes/flags/Liechtenstein.png | Bin 0 -> 537 bytes themes/flags/Lithuania.png | Bin 0 -> 508 bytes themes/flags/Luxembourg.png | Bin 0 -> 481 bytes themes/flags/Macao.png | Bin 0 -> 588 bytes ...donia, the former Yugoslav Republic of.png | Bin 0 -> 664 bytes themes/flags/Madagascar.png | Bin 0 -> 453 bytes themes/flags/Malawi.png | Bin 0 -> 529 bytes themes/flags/Malaysia.png | Bin 0 -> 571 bytes themes/flags/Maldives.png | Bin 0 -> 542 bytes themes/flags/Mali.png | Bin 0 -> 474 bytes themes/flags/Malta.png | Bin 0 -> 420 bytes themes/flags/Marshall Islands.png | Bin 0 -> 628 bytes themes/flags/Martinique.png | Bin 0 -> 655 bytes themes/flags/Mauritania.png | Bin 0 -> 569 bytes themes/flags/Mauritius.png | Bin 0 -> 496 bytes themes/flags/Mayotte.png | Bin 0 -> 593 bytes themes/flags/Mexico.png | Bin 0 -> 574 bytes .../flags/Micronesia, Federated States of.png | Bin 0 -> 552 bytes themes/flags/Moldova, Republic of.png | Bin 0 -> 566 bytes themes/flags/Monaco.png | Bin 0 -> 380 bytes themes/flags/Mongolia.png | Bin 0 -> 492 bytes themes/flags/Montenegro.png | Bin 0 -> 448 bytes themes/flags/Montserrat.png | Bin 0 -> 614 bytes themes/flags/Morocco.png | Bin 0 -> 432 bytes themes/flags/Mozambique.png | Bin 0 -> 584 bytes themes/flags/Myanmar.png | Bin 0 -> 483 bytes themes/flags/Namibia.png | Bin 0 -> 647 bytes themes/flags/Nauru.png | Bin 0 -> 527 bytes themes/flags/Nepal.png | Bin 0 -> 443 bytes themes/flags/Netherlands.png | Bin 0 -> 453 bytes themes/flags/New Caledonia.png | Bin 0 -> 591 bytes themes/flags/New Zealand.png | Bin 0 -> 639 bytes themes/flags/Nicaragua.png | Bin 0 -> 508 bytes themes/flags/Niger.png | Bin 0 -> 537 bytes themes/flags/Nigeria.png | Bin 0 -> 482 bytes themes/flags/Niue.png | Bin 0 -> 572 bytes themes/flags/Norfolk Island.png | Bin 0 -> 602 bytes themes/flags/Northern Mariana Islands.png | Bin 0 -> 597 bytes themes/flags/Norway.png | Bin 0 -> 512 bytes themes/flags/Oman.png | Bin 0 -> 478 bytes themes/flags/Pakistan.png | Bin 0 -> 569 bytes themes/flags/Palau.png | Bin 0 -> 550 bytes themes/flags/Palestine, State of.png | Bin 0 -> 472 bytes themes/flags/Panama.png | Bin 0 -> 519 bytes themes/flags/Papua New Guinea.png | Bin 0 -> 593 bytes themes/flags/Paraguay.png | Bin 0 -> 473 bytes themes/flags/Peru.png | Bin 0 -> 397 bytes themes/flags/Philippines.png | Bin 0 -> 538 bytes themes/flags/Pitcairn.png | Bin 0 -> 657 bytes themes/flags/Poland.png | Bin 0 -> 374 bytes themes/flags/Portugal.png | Bin 0 -> 554 bytes themes/flags/Puerto Rico.png | Bin 0 -> 556 bytes themes/flags/Qatar.png | Bin 0 -> 450 bytes themes/flags/Reunion.png | Bin 0 -> 545 bytes themes/flags/Romania.png | Bin 0 -> 495 bytes themes/flags/Russian Federation.png | Bin 0 -> 420 bytes themes/flags/Rwanda.png | Bin 0 -> 533 bytes ...Helena, Ascension and Tristan da Cunha.png | Bin 0 -> 645 bytes themes/flags/Saint Kitts and Nevis.png | Bin 0 -> 604 bytes themes/flags/Saint Lucia.png | Bin 0 -> 520 bytes themes/flags/Saint Pierre and Miquelon.png | Bin 0 -> 689 bytes .../Saint Vincent and the Grenadines.png | Bin 0 -> 577 bytes themes/flags/Samoa.png | Bin 0 -> 476 bytes themes/flags/San Marino.png | Bin 0 -> 502 bytes themes/flags/Sao Tome and Principe.png | Bin 0 -> 584 bytes themes/flags/Saudi Arabia.png | Bin 0 -> 551 bytes themes/flags/Senegal.png | Bin 0 -> 532 bytes themes/flags/Serbia.png | Bin 0 -> 423 bytes themes/flags/Seychelles.png | Bin 0 -> 608 bytes themes/flags/Sierra Leone.png | Bin 0 -> 436 bytes themes/flags/Singapore.png | Bin 0 -> 468 bytes themes/flags/Slovakia.png | Bin 0 -> 562 bytes themes/flags/Slovenia.png | Bin 0 -> 510 bytes themes/flags/Solomon Islands.png | Bin 0 -> 624 bytes themes/flags/Somalia.png | Bin 0 -> 527 bytes themes/flags/South Africa.png | Bin 0 -> 642 bytes ...Georgia and the South Sandwich Islands.png | Bin 0 -> 630 bytes themes/flags/Spain.png | Bin 0 -> 469 bytes themes/flags/Sri Lanka.png | Bin 0 -> 627 bytes themes/flags/Sudan.png | Bin 0 -> 492 bytes themes/flags/Suriname.png | Bin 0 -> 513 bytes themes/flags/Svalbard and Jan Mayen.png | Bin 0 -> 512 bytes themes/flags/Swaziland.png | Bin 0 -> 643 bytes themes/flags/Sweden.png | Bin 0 -> 542 bytes themes/flags/Switzerland.png | Bin 0 -> 367 bytes themes/flags/Syrian Arab Republic.png | Bin 0 -> 422 bytes themes/flags/Taiwan, Province of China.png | Bin 0 -> 465 bytes themes/flags/Tajikistan.png | Bin 0 -> 496 bytes themes/flags/Tanzania, United Republic of.png | Bin 0 -> 642 bytes themes/flags/Thailand.png | Bin 0 -> 452 bytes themes/flags/Timor-Leste.png | Bin 0 -> 514 bytes themes/flags/Togo.png | Bin 0 -> 562 bytes themes/flags/Tokelau.png | Bin 0 -> 638 bytes themes/flags/Tonga.png | Bin 0 -> 426 bytes themes/flags/Trinidad and Tobago.png | Bin 0 -> 617 bytes themes/flags/Tunisia.png | Bin 0 -> 495 bytes themes/flags/Turkey.png | Bin 0 -> 492 bytes themes/flags/Turkmenistan.png | Bin 0 -> 593 bytes themes/flags/Turks and Caicos Islands.png | Bin 0 -> 624 bytes themes/flags/Tuvalu.png | Bin 0 -> 536 bytes themes/flags/Uganda.png | Bin 0 -> 531 bytes themes/flags/Ukraine.png | Bin 0 -> 446 bytes themes/flags/United Arab Emirates.png | Bin 0 -> 408 bytes ... of Great Britain and Northern Ireland.png | Bin 0 -> 599 bytes .../United States Minor Outlying Islands.png | Bin 0 -> 571 bytes themes/flags/United States of America.png | Bin 0 -> 609 bytes themes/flags/Uruguay.png | Bin 0 -> 532 bytes themes/flags/Uzbekistan.png | Bin 0 -> 515 bytes themes/flags/Vanuatu.png | Bin 0 -> 604 bytes .../Venezuela, Bolivarian Republic of.png | Bin 0 -> 528 bytes themes/flags/Viet Nam.png | Bin 0 -> 474 bytes themes/flags/Virgin Islands, British.png | Bin 0 -> 630 bytes themes/flags/Virgin Islands, U.S..png | Bin 0 -> 616 bytes themes/flags/Wallis and Futuna.png | Bin 0 -> 554 bytes themes/flags/Western Sahara.png | Bin 0 -> 508 bytes themes/flags/Yemen.png | Bin 0 -> 413 bytes themes/flags/Zambia.png | Bin 0 -> 500 bytes themes/flags/Zimbabwe.png | Bin 0 -> 574 bytes themes/flags/an.png | Bin 0 -> 488 bytes themes/flags/catalonia.png | Bin 0 -> 398 bytes themes/flags/cs.png | Bin 0 -> 439 bytes themes/flags/england.png | Bin 0 -> 496 bytes themes/flags/europeanunion.png | Bin 0 -> 479 bytes themes/flags/fam.png | Bin 0 -> 532 bytes themes/flags/scotland.png | Bin 0 -> 649 bytes themes/flags/wales.png | Bin 0 -> 652 bytes 249 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 core/app_languages.php create mode 100644 themes/flags/Afghanistan.png create mode 100644 themes/flags/Aland Islands.png create mode 100644 themes/flags/Albania.png create mode 100644 themes/flags/Algeria.png create mode 100644 themes/flags/American Samoa.png create mode 100644 themes/flags/Andorra.png create mode 100644 themes/flags/Angola.png create mode 100644 themes/flags/Anguilla.png create mode 100644 themes/flags/Antigua and Barbuda.png create mode 100644 themes/flags/Argentina.png create mode 100644 themes/flags/Armenia.png create mode 100644 themes/flags/Aruba.png create mode 100644 themes/flags/Australia.png create mode 100644 themes/flags/Austria.png create mode 100644 themes/flags/Azerbaijan.png create mode 100644 themes/flags/Bahamas.png create mode 100644 themes/flags/Bahrain.png create mode 100644 themes/flags/Bangladesh.png create mode 100644 themes/flags/Barbados.png create mode 100644 themes/flags/Belarus.png create mode 100644 themes/flags/Belgium.png create mode 100644 themes/flags/Belize.png create mode 100644 themes/flags/Benin.png create mode 100644 themes/flags/Bermuda.png create mode 100644 themes/flags/Bhutan.png create mode 100644 themes/flags/Bolivia, Plurinational State of.png create mode 100644 themes/flags/Bosnia and Herzegovina.png create mode 100644 themes/flags/Botswana.png create mode 100644 themes/flags/Bouvet Island.png create mode 100644 themes/flags/Brazil.png create mode 100644 themes/flags/British Indian Ocean Territory.png create mode 100644 themes/flags/Brunei Darussalam.png create mode 100644 themes/flags/Bulgaria.png create mode 100644 themes/flags/Burkina Faso.png create mode 100644 themes/flags/Burundi.png create mode 100644 themes/flags/Cabo Verde.png create mode 100644 themes/flags/Cambodia.png create mode 100644 themes/flags/Cameroon.png create mode 100644 themes/flags/Canada.png create mode 100644 themes/flags/Cayman Islands.png create mode 100644 themes/flags/Central African Republic.png create mode 100644 themes/flags/Chad.png create mode 100644 themes/flags/Chile.png create mode 100644 themes/flags/China.png create mode 100644 themes/flags/Christmas Island.png create mode 100644 themes/flags/Cocos (Keeling) Islands.png create mode 100644 themes/flags/Colombia.png create mode 100644 themes/flags/Comoros.png create mode 100644 themes/flags/Congo, the Democratic Republic of the.png create mode 100644 themes/flags/Congo.png create mode 100644 themes/flags/Cook Islands.png create mode 100644 themes/flags/Costa Rica.png create mode 100644 themes/flags/Cote d'Ivoire.png create mode 100644 themes/flags/Croatia.png create mode 100644 themes/flags/Cuba.png create mode 100644 themes/flags/Cyprus.png create mode 100644 themes/flags/Czech Republic.png create mode 100644 themes/flags/Denmark.png create mode 100644 themes/flags/Djibouti.png create mode 100644 themes/flags/Dominica.png create mode 100644 themes/flags/Dominican Republic.png create mode 100644 themes/flags/Ecuador.png create mode 100644 themes/flags/Egypt.png create mode 100644 themes/flags/El Salvador.png create mode 100644 themes/flags/Equatorial Guinea.png create mode 100644 themes/flags/Eritrea.png create mode 100644 themes/flags/Estonia.png create mode 100644 themes/flags/Ethiopia.png create mode 100644 themes/flags/Falkland Islands (Malvinas).png create mode 100644 themes/flags/Faroe Islands.png create mode 100644 themes/flags/Fiji.png create mode 100644 themes/flags/Finland.png create mode 100644 themes/flags/France.png create mode 100644 themes/flags/French Guiana.png create mode 100644 themes/flags/French Polynesia.png create mode 100644 themes/flags/French Southern Territories.png create mode 100644 themes/flags/Gabon.png create mode 100644 themes/flags/Gambia.png create mode 100644 themes/flags/Georgia.png create mode 100644 themes/flags/Germany.png create mode 100644 themes/flags/Ghana.png create mode 100644 themes/flags/Gibraltar.png create mode 100644 themes/flags/Greece.png create mode 100644 themes/flags/Greenland.png create mode 100644 themes/flags/Grenada.png create mode 100644 themes/flags/Guadeloupe.png create mode 100644 themes/flags/Guam.png create mode 100644 themes/flags/Guatemala.png create mode 100644 themes/flags/Guinea-Bissau.png create mode 100644 themes/flags/Guinea.png create mode 100644 themes/flags/Guyana.png create mode 100644 themes/flags/Haiti.png create mode 100644 themes/flags/Heard Island and McDonald Islands.png create mode 100644 themes/flags/Holy See.png create mode 100644 themes/flags/Honduras.png create mode 100644 themes/flags/Hong Kong.png create mode 100644 themes/flags/Hungary.png create mode 100644 themes/flags/Iceland.png create mode 100644 themes/flags/India.png create mode 100644 themes/flags/Indonesia.png create mode 100644 themes/flags/Iran, Islamic Republic of.png create mode 100644 themes/flags/Iraq.png create mode 100644 themes/flags/Ireland.png create mode 100644 themes/flags/Israel.png create mode 100644 themes/flags/Italy.png create mode 100644 themes/flags/Jamaica.png create mode 100644 themes/flags/Japan.png create mode 100644 themes/flags/Jordan.png create mode 100644 themes/flags/Kazakhstan.png create mode 100644 themes/flags/Kenya.png create mode 100644 themes/flags/Kiribati.png create mode 100644 themes/flags/Korea, Democratic People's Republic of.png create mode 100644 themes/flags/Korea, Republic of.png create mode 100644 themes/flags/Kuwait.png create mode 100644 themes/flags/Kyrgyzstan.png create mode 100644 themes/flags/Lao People's Democratic Republic.png create mode 100644 themes/flags/Latvia.png create mode 100644 themes/flags/Lebanon.png create mode 100644 themes/flags/Lesotho.png create mode 100644 themes/flags/Liberia.png create mode 100644 themes/flags/Libya.png create mode 100644 themes/flags/Liechtenstein.png create mode 100644 themes/flags/Lithuania.png create mode 100644 themes/flags/Luxembourg.png create mode 100644 themes/flags/Macao.png create mode 100644 themes/flags/Macedonia, the former Yugoslav Republic of.png create mode 100644 themes/flags/Madagascar.png create mode 100644 themes/flags/Malawi.png create mode 100644 themes/flags/Malaysia.png create mode 100644 themes/flags/Maldives.png create mode 100644 themes/flags/Mali.png create mode 100644 themes/flags/Malta.png create mode 100644 themes/flags/Marshall Islands.png create mode 100644 themes/flags/Martinique.png create mode 100644 themes/flags/Mauritania.png create mode 100644 themes/flags/Mauritius.png create mode 100644 themes/flags/Mayotte.png create mode 100644 themes/flags/Mexico.png create mode 100644 themes/flags/Micronesia, Federated States of.png create mode 100644 themes/flags/Moldova, Republic of.png create mode 100644 themes/flags/Monaco.png create mode 100644 themes/flags/Mongolia.png create mode 100644 themes/flags/Montenegro.png create mode 100644 themes/flags/Montserrat.png create mode 100644 themes/flags/Morocco.png create mode 100644 themes/flags/Mozambique.png create mode 100644 themes/flags/Myanmar.png create mode 100644 themes/flags/Namibia.png create mode 100644 themes/flags/Nauru.png create mode 100644 themes/flags/Nepal.png create mode 100644 themes/flags/Netherlands.png create mode 100644 themes/flags/New Caledonia.png create mode 100644 themes/flags/New Zealand.png create mode 100644 themes/flags/Nicaragua.png create mode 100644 themes/flags/Niger.png create mode 100644 themes/flags/Nigeria.png create mode 100644 themes/flags/Niue.png create mode 100644 themes/flags/Norfolk Island.png create mode 100644 themes/flags/Northern Mariana Islands.png create mode 100644 themes/flags/Norway.png create mode 100644 themes/flags/Oman.png create mode 100644 themes/flags/Pakistan.png create mode 100644 themes/flags/Palau.png create mode 100644 themes/flags/Palestine, State of.png create mode 100644 themes/flags/Panama.png create mode 100644 themes/flags/Papua New Guinea.png create mode 100644 themes/flags/Paraguay.png create mode 100644 themes/flags/Peru.png create mode 100644 themes/flags/Philippines.png create mode 100644 themes/flags/Pitcairn.png create mode 100644 themes/flags/Poland.png create mode 100644 themes/flags/Portugal.png create mode 100644 themes/flags/Puerto Rico.png create mode 100644 themes/flags/Qatar.png create mode 100644 themes/flags/Reunion.png create mode 100644 themes/flags/Romania.png create mode 100644 themes/flags/Russian Federation.png create mode 100644 themes/flags/Rwanda.png create mode 100644 themes/flags/Saint Helena, Ascension and Tristan da Cunha.png create mode 100644 themes/flags/Saint Kitts and Nevis.png create mode 100644 themes/flags/Saint Lucia.png create mode 100644 themes/flags/Saint Pierre and Miquelon.png create mode 100644 themes/flags/Saint Vincent and the Grenadines.png create mode 100644 themes/flags/Samoa.png create mode 100644 themes/flags/San Marino.png create mode 100644 themes/flags/Sao Tome and Principe.png create mode 100644 themes/flags/Saudi Arabia.png create mode 100644 themes/flags/Senegal.png create mode 100644 themes/flags/Serbia.png create mode 100644 themes/flags/Seychelles.png create mode 100644 themes/flags/Sierra Leone.png create mode 100644 themes/flags/Singapore.png create mode 100644 themes/flags/Slovakia.png create mode 100644 themes/flags/Slovenia.png create mode 100644 themes/flags/Solomon Islands.png create mode 100644 themes/flags/Somalia.png create mode 100644 themes/flags/South Africa.png create mode 100644 themes/flags/South Georgia and the South Sandwich Islands.png create mode 100644 themes/flags/Spain.png create mode 100644 themes/flags/Sri Lanka.png create mode 100644 themes/flags/Sudan.png create mode 100644 themes/flags/Suriname.png create mode 100644 themes/flags/Svalbard and Jan Mayen.png create mode 100644 themes/flags/Swaziland.png create mode 100644 themes/flags/Sweden.png create mode 100644 themes/flags/Switzerland.png create mode 100644 themes/flags/Syrian Arab Republic.png create mode 100644 themes/flags/Taiwan, Province of China.png create mode 100644 themes/flags/Tajikistan.png create mode 100644 themes/flags/Tanzania, United Republic of.png create mode 100644 themes/flags/Thailand.png create mode 100644 themes/flags/Timor-Leste.png create mode 100644 themes/flags/Togo.png create mode 100644 themes/flags/Tokelau.png create mode 100644 themes/flags/Tonga.png create mode 100644 themes/flags/Trinidad and Tobago.png create mode 100644 themes/flags/Tunisia.png create mode 100644 themes/flags/Turkey.png create mode 100644 themes/flags/Turkmenistan.png create mode 100644 themes/flags/Turks and Caicos Islands.png create mode 100644 themes/flags/Tuvalu.png create mode 100644 themes/flags/Uganda.png create mode 100644 themes/flags/Ukraine.png create mode 100644 themes/flags/United Arab Emirates.png create mode 100644 themes/flags/United Kingdom of Great Britain and Northern Ireland.png create mode 100644 themes/flags/United States Minor Outlying Islands.png create mode 100644 themes/flags/United States of America.png create mode 100644 themes/flags/Uruguay.png create mode 100644 themes/flags/Uzbekistan.png create mode 100644 themes/flags/Vanuatu.png create mode 100644 themes/flags/Venezuela, Bolivarian Republic of.png create mode 100644 themes/flags/Viet Nam.png create mode 100644 themes/flags/Virgin Islands, British.png create mode 100644 themes/flags/Virgin Islands, U.S..png create mode 100644 themes/flags/Wallis and Futuna.png create mode 100644 themes/flags/Western Sahara.png create mode 100644 themes/flags/Yemen.png create mode 100644 themes/flags/Zambia.png create mode 100644 themes/flags/Zimbabwe.png create mode 100644 themes/flags/an.png create mode 100644 themes/flags/catalonia.png create mode 100644 themes/flags/cs.png create mode 100644 themes/flags/england.png create mode 100644 themes/flags/europeanunion.png create mode 100644 themes/flags/fam.png create mode 100644 themes/flags/scotland.png create mode 100644 themes/flags/wales.png diff --git a/core/app_languages.php b/core/app_languages.php new file mode 100644 index 0000000000..ebdcde1c04 --- /dev/null +++ b/core/app_languages.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/resources/classes/text.php b/resources/classes/text.php index e78095afd3..e873cea00b 100644 --- a/resources/classes/text.php +++ b/resources/classes/text.php @@ -1,19 +1,16 @@ $key); } } - /** * Get a specific item from the cache * @var string $language_code examples: en-us, es-cl, fr-fr, pt-pt @@ -39,7 +35,6 @@ class text { else { include getcwd().'/app_languages.php'; } - //get the available languages krsort($text); foreach ($text as $lang_label => $lang_codes) { @@ -50,7 +45,6 @@ class text { } } $_SESSION['app']['languages'] = array_unique($app_languages); - //check the session language if(isset($_SESSION['domain'])){ $language_code = $_SESSION['domain']['language']['code']; @@ -63,12 +57,20 @@ class text { $text[$key] = $value[$language_code]; } } - + if ($language_code != 'all') { + foreach($language_name as $code => $value) { + $text["language-$code"] = $value; + } + }else{ + foreach($language_name as $code => $value) { + foreach($language_name as $c_code => $value) { + $text["language-$code"][$c_code] = $value; + } + } + } + //return the array of translations return $text; - } - } - ?> \ No newline at end of file diff --git a/themes/flags/Afghanistan.png b/themes/flags/Afghanistan.png new file mode 100644 index 0000000000000000000000000000000000000000..a4742e299f517aee16c248e40eccad39ac34c9e9 GIT binary patch literal 604 zcmV-i0;BzjP)&5HW|5#c7{r(N){s9YCi84$~U|{$Glm>AD0*K|^yLU}ZO+eP) ze;~;4`#0mCzs$dX{r~-&?f370zkUTM{{OB1_1E8DKmYz*JbN)f0I>i8Q1#1Kum1f0 z{pZggpt}FRe*ORX>;JEx|9}4c_w(m__W!pfKK=atLxM{ZXbC_7vHbh@@9*EgK-ECy zzkh)Y{?EYhFEQc&-#`EN9{7Lq7*OE*@9)2U|NQmmC(vO40VtezBLF}U2%?OI(TG)& zJC>!~;SYmN-)zb6gc(7A-^Q(#z0vHb9!CJ#T#ii{@&pjek8j`pfX)5|H00+GpnLvt za{MtfWBC4qk%R63j~{=2{QLgr`wyTb*amx2hce{;{QL3a|BhWh#6A5bKmf5of*%NgdVm^$Zuo!gI_LQd|G=96g51yWl0Agf71rLE? q3XWqq@&Lw?Iyk0*94-cc00RK~MQKxxUU$F%0000^@RCwBA zRL|V|7QjV)*ul;Rlceqc6W0{`~_8AeMg& z|LUXE8U8c=`}dziv6P|mEu%JjM}pqh@65md|Ni~w->=_)fBgZXe?Nc!ot?WGAOHX{ z0M7pe`uG9>{{ZXo`u+d?{`u+u=j#9V2j%Sc^797z|N8p+{rLO+`TP9&`u!FW2mk>3 z0#G;xDFDDQ2vg|)-@5Zw?JVTrAxNs~5&|AZ;5uWfQ`vUsMGm`>aGWoI7=P|oW>%~E z|KkPbXFRCwBA zyv)hK@{fUmi2(>${xJOc&A`II@PmN?BKC`c;SU)710$d~Kmf4-r6niy16BY3`}g0! ze=L9h&Uybegp-Ns@87v^zGQMU|NZla@z1Y+zkdVKmFbHB0*HkH4F0@)&iwE1;&GRLuzkX(OGXMMa``@o$|Ni_2x(y(Jn3#TnHT?el|IhC;U%pHK`}6Df z@2@|9J^lXU=Z~KvfBzi*^!4A*U;lv`e*Fge3Lt=(82$q_`~m9z|ND;$!(WEqze~6o ze}X|JFO$H(U+VvX#{c{avi3L7@c;n?3L&6l7=Hix`}emN<6i~#|7+iUWBL8-&##}m zKKx5zXJr5LA80nvkwCM6egFs{po9Y?& zL6B;olm7ns#=rm&Kp-3b{RIXY(1{??Ha=$NKfkS+|9@us$Mfg+93j@fzkY#y2y!;i z&kO(o1PWH5>zPHwn7|>;0Mz;WPl13iP!Y(WKYy4&4hBXMSPugOKmaiw2gk!dq!|4J mj$lZu82tM4=f|&Ke}8;oX5+eBw}y?G6)5=s|Nnnr@aNATAPEpaEN{Mj=m^OD z&%p5S|G&Tg{{H#<7bL;LEGj9<&cFmz{_j5mJbLs9Ab?m{m{|TZ{D1lB9Z2clKfnI{ z`ThHs^2c9)q;CF`l>Eoa3N#g>nv07INCE^93jWH3lKe}28-VENu!{qxMpm&svFOiawo%#4hT5U&FS z5Yzu(KY%Xz`RDh~-yl6N|NT~b@qz9A2lm1$Hf43G`D-AmnZXVNY5)izCWas1fbRMA z8?52ykLBVV-&q+tkKFpbbOC=r`2SzOfQo=l0_p*hfB*gk2q2IKpzD7Eo%H+Hk6%A8 za57|Q3rv;f;d1r)FDv_xg9F*eKs^8f#KQ37)2~0jMR){${rwHH2k3S7pO3`Z{#jf7 z{|`16Y&=9YkOT-IMh0&|hF9+yelRe6V}O#tcxPkSx96}BCoe=1&?OKCkOT-Y05IoG U$(*n^qyPW_07*qoM6N<$f?|9Y@c;k- literal 0 HcmV?d00001 diff --git a/themes/flags/American Samoa.png b/themes/flags/American Samoa.png new file mode 100644 index 0000000000000000000000000000000000000000..32f30e4ce4eedd22d4f09c4f3a46c52dd064f113 GIT binary patch literal 647 zcmV;20(kw2P);Rmc0RI30 z|Nj5|{Q>>`0R8>{{QLs@`vM01^D6+%Ap+Y10Qw3Sr3ED)s=c}b05Jg0{{#dC0RR60 z)z$y}`~dv>0Q&p?0Q>ne0Khr|#}EMN1`-ttJvaFq6VTDg`OMJS*4F}vg#m0fQ1$QM z42u6QTCg3Kt8+Li1J#Y_zUd>4Lw{URe1tEjLbKmY(S0M7pd(g2qsJ0|z;{R`~d z`n<6E*3bb41p*Zr{{R344LkeqyaMyV01O!W0PZ0+TjlEQ0st`p&i?@b0Q{Gi0m{n% z`T6-B``1JQx+4kM0{rp_FfRy7P6Qq%_1|&<`|JPx`Uew8u)+%h2+ zdiAI7xt}_}e|$CmbI9$2>u h*D)|iF)#oG7yty8`q2#I8zBGy002ovPDHLkV1j5VEF}N{ literal 0 HcmV?d00001 diff --git a/themes/flags/Andorra.png b/themes/flags/Andorra.png new file mode 100644 index 0000000000000000000000000000000000000000..625ca84f9ec596848d4b967b5556fda897ca7183 GIT binary patch literal 643 zcmV-}0(||6P)S}{rU-#^xW|9%5S{`_G8k=zVG=|5luWB>#JF#yj01oZa& zTu&JQ008~}|NQ&{0055x0sR95`v3p?1_t~7{`v!N`v3d-{`&g=`T6amqXIBA$0h)T zKokWRkpoMx|Go@O4FvhR>O1p+i7`B6t^3)y2dJ<#?4I?d4x-E}Az98Z`2`TmzkmP! z{`(J9{pauh-+zJD{JOYLhW+QSzkh#x`Y&wke*WLjpZ~u9`2XuCr@{^OJ|MkZb_UGR@Z=V>fB*iaq<8P{*B}2u-uMnu#J~U$KrBDL0bT$1_irEqiZcM6WEF7g<|*+% zzkjHi-TwRc=f7_t9|K*?`1?07lmG&V<)V$q< zM7LZb@rX?|r)2RP-+aO3(7q?c3+$-Vv0E)PxM3SDV%@s`#GkZvw_x^WBa~uq3^l}t zWdf(j(=(>^SgETc#5#EZT(4ObRkfxbzP9G;yza0;Ygc8-_*?EP(ca#`l6-Z6D0{tL zQ4|~MCSi!9Q9YkW=V$ix#EqZ!rc?eWA0TwdVID+3aqrYUXUhCI)Ad5!(cP!BhhW$Ayb2&r8kK!bz*2`~UE W(Ndrek0Jg50000ocPy#thD++(+#W%SS0Qvp^`1%0+_yGC)0QUL-|M&m^ z`T_tk0M7pe&iDc7fh@K74M*k&0{8f*88BG;;GY6ve?;&4{{Q>_{{8&^`u+g@|Ns5} z|C?Nv0*Gb#mu+n4z6ZW~#qjy_|6ji&ZeIEMk16oyzH)i@Pk$MNxLARR?a#kwpMS72 zF)}cG2M8dRUN*~81wCz%$A2$f`_IL|A|w6j^RHtc7{2`lYG-KkQ{(*knSqh%3kzr7 zs%s1kKL7#%F#yj00-^B^D;pD^^AqC)4C(?1m>@q26ceiU4*2{4`u_d~@vQ*ykp&A1 z3h$o${r~^~`vQo?Pm-bY@cm79zVQG5%l!B6)Riap%L`bGemnT<@2|iAfl64!%YWS~ z`p0YY_dig_cYpw5WYAmG*lPLk!;jy8|NZ#~MF0Q%{rCG1ko^Di`(Fhkd3F{?py0c9Vg{{gA~^#>F<|Nj5KapBR^@Bf~CXSi|t;lF=C z8-4)<5DUX^V9+rDCI3RuUy#}V{s46X!}R~}@4ug&fA|+@;n!b(1zCZ900KKMX({{sIILBZE*UQbc|SngJt$+`m9Kz!<;5 dBm+Qz0RWL%NC2%sdjkLf002ovPDHLkV1lARHI@JX literal 0 HcmV?d00001 diff --git a/themes/flags/Antigua and Barbuda.png b/themes/flags/Antigua and Barbuda.png new file mode 100644 index 0000000000000000000000000000000000000000..556d5504dc28d89be22ec1883f12e8d8c07d5f41 GIT binary patch literal 591 zcmV-V0= z`}|7!`YQYT5C8xIh~*yx1DgQ1_jkSr_QgN{Gn)!7=zkRT=l(yS{y%^Jd$>%yrP!)vVq~xpZ~xA{{HjZ>hB|)Z~OQoBLBm{yCqA0{k;C`&+mV~|1$jj15^wU zKukakbkF}kzkmk({q_6zmUTZaUWBOraqa5!?(V-pgMR}R{04?0&`AIR#PSE^hrdi> z;*7t4gLVFSJ$J5DTibsorq@%ai5h7B2l^1G@*gM=fUW@uAjYc<48V{DX@ijvE(11_ dg@FMezyQzuBHsGv+i3s*002ovPDHLkV1jTADB=JB literal 0 HcmV?d00001 diff --git a/themes/flags/Argentina.png b/themes/flags/Argentina.png new file mode 100644 index 0000000000000000000000000000000000000000..e5ef8f1fcddb9fa0b89c353430e9640c122445cc GIT binary patch literal 506 zcmVNL7TW{{R0! zJP>i}(MpzaSkj z=eqvqa`^|6{{QbQRQ11q3~Vg_kG}Z}5I`(hw}ncX8D4$|h64jUK>or*=^r$dfI%n0 z$3MKz;!F0w91GjkkV%_X`@4 wKR^hm`X5LwD9*v?4;TUC6Bz$&3;+QJ0QLcJ=WT{TU;qFB07*qoM6N<$f>3bX%K!iX literal 0 HcmV?d00001 diff --git a/themes/flags/Armenia.png b/themes/flags/Armenia.png new file mode 100644 index 0000000000000000000000000000000000000000..344a2a86c43d52f490455d0fe582da93e07175b2 GIT binary patch literal 497 zcmVE0R~eis zC&uN{cDQ8`!@ZNLOqwtoG6nhzPx}SV-d6yzFfcIz75{(rngJyDkKrFw8iaoThHCr$ zo8k9wMhS^O3=9AP!~%5B|9}4(ASQtkLN$m1CV&5705X362095KfLKJhW;OjWdGY7l zzrX*$DuLu*pcFC#NdEr)SL!$SY=)lz0mSm_*B_u)|AM4J^}0h@W9fA9JOn#opKkr#VO<{LPm{QLg}EdH3Vb1Zzpp zqiZ+XNBm%5{`ViKi{bCTe}Dh~2a+HyfB%6Q|9}7eKVjxEfB<6Q<6r}-{{7;G=hB{; zLB+p+|Ni^;|DXT={s75;AoBO$f4@PDf8sps4FCQC1Q64wUw^h*hy4HZXO3U)@85qw zD*pci8U|DWQu_BVi2MUWKoOv;00M{w=;|*lY_o%kegGx^{`&*A{SSok_usF-P)oof z|A86+0*K|;FQAM6fB*FtoEI&bZG5mq328#as{}<$F zWDQ{Ffz1MH001phxCBNdC_2H6U$AI~GQbEJqg*Ti0R{kQ(yH?TRrCY^ O0000>fJ3En$GhGS>sbE%%m3$AD)q?8M9y>88-}kR7#RKlk!P~Y_PLuF7~U~3`~nC7 zF#yj00ZUDdpLsm{7ajP|&HwoK0Usg|6%f4L_{`Mi{rvv-`ukf=Ed&Gs-sA7L!Q7*a zj{*QO0M7pb%?Sw^g@yy{>ihEY{`vU@3=8@G0rvO$i3mOL`~mv-`W+b$Mmr&io5dg< z5v!7q0*L95jt`TzK8Kd(Utv)OSp_aLv){6ccV+Z`{Q2+asKUU&aO3`Kpz6wW8wp`< z28M3{0mSqnB#A*-c*8%1=RD#sSOwMznKA3=e&iEzwo{cA=PgXK`2OQ}gqId83!|%* zA_Kz@fB*n70M7pdECCwp4H&@R`1|(w-}M5x*74i)0}%fAt;XafA{48))#>Z>?CD#}*e}Ret0tl$#*RMZ7}Jl7Z|M45`5*URzH9L z{rmSnPy;{!u>dsyO%meg+00000NkvXX Hu0mjfN{&}S literal 0 HcmV?d00001 diff --git a/themes/flags/Austria.png b/themes/flags/Austria.png new file mode 100644 index 0000000000000000000000000000000000000000..0f15f34f2883c4b4360fc871d7105309f1533282 GIT binary patch literal 403 zcmV;E0c`$>P)@|4`Xj5kLT%`al?B=W5I`&prl$WjwHQRjfmQ&G0jUOA z@&|Dug_Rm`2Y251|$~)1M2@@6mI}!8O6olw6y^Q z5X--d7nzS8`+x5q12kBmVFD!~j6c5_fMKno0(1^Q0I>i=is|LjXX40RRttS6cG0UZ?;7002ovPDHLkV1fxUnjZiF literal 0 HcmV?d00001 diff --git a/themes/flags/Azerbaijan.png b/themes/flags/Azerbaijan.png new file mode 100644 index 0000000000000000000000000000000000000000..4ee9fe5ced2610a60ff99e6cc4fbe80d7d53c624 GIT binary patch literal 589 zcmV-T08dq@aG@HzdsB>fj@shYzX-a%=q<(frSYmfLIv5{HbzQ${~M_P_y6C&m>3uU0*DFd0+8#0#Gk)^|NLQBRAyCBeB9H+Wn{=Mr@*PJ_ZKV< zB>w@GFfafF5Ks>TBP0ZV{bBt5_ve*sKkwd`OiO#eX6=u=cfX!E#rX3NBT(umNC7Yu z0Ro8S7X#4ce?Xr63$phg)Bk64X8r&5``_O`AFf^jc>p5y?+^38KVKLa00M}`wU!~x z=I_1Fe}Df4D*yZI@1I|PfBgnRptt`0`2{iqNs{bTs^2gCr95H^s6Fo1}O2_S$Nfl}4;<}o-r{^R8Q_xtzX z|Nnu?|Ni^;2gm@D3=F@4EC#P1& zzuV{ie)#0qf2Lnh)j(~3VeG$ufPMl9Aczeh3x56n#l!R`HRQLfpFjVwfkN;%I39k( zVgne^e?jDThF>oL0*Hk{T6(^^8pGqq44*zhqZ1OZzkZ>_F(mFeH~<0+0A4S6=>Lb* QN&o-=07*qoM6N<$f&=*Yr2qf` literal 0 HcmV?d00001 diff --git a/themes/flags/Bahrain.png b/themes/flags/Bahrain.png new file mode 100644 index 0000000000000000000000000000000000000000..ea8ce68761bbd8ee06f80c487c24d4493abfb52d GIT binary patch literal 457 zcmV;)0XF`LP)&-#|8y{IY2iKmf5omHz(^qAp)ym^JhN+jk7Vet{H$(Z8=>|AV=V zva&!M00M{!p&AHub^kXuF^G#pRQ&(-8^nMkpk@XJfB<6o_wOIv5C1P;X6Wwu|KUB< zc%X*g2-OTg#J~U$KumBafq;(A|A`a+OH08N{X($;=pP0KfB<5Fs|GR7oM!0i{{QYB zSm|$=!=N@Wf}I2qKuka<{f7YtBjf)QCj1u{`~UM7nrdKh0c`*VF+c!8{Q&j%sZ;-Z zd;dRshENS5{{S`og~Sg)05QIL^-54s5b7kL(8GuS8yfz9{>%Ui`+q-vfW*P*^_43C z0mK4S`s2qBh&}(NP5W0_$$%QQ@R)`GfB*vkck5Jby^kNv00000NkvXXu0mjfy0pt~ literal 0 HcmV?d00001 diff --git a/themes/flags/Bangladesh.png b/themes/flags/Bangladesh.png new file mode 100644 index 0000000000000000000000000000000000000000..076a8bf87c0cedcce47099c6b74b59f2c9d1dbce GIT binary patch literal 504 zcmVCcfPV}OzZe+)fYC1)`hmpw%>WR9L@~Dk00x0r!@5ksR;+hV0>ZLfIcBS@orh;x zv}95za5W)x_7^}bV3YqpdH?h;NZnuSC%?V#{+0gl`~RQckJx{&l>NO~;@7XgzkdJz zEh{VwR0LSuiyWGR{aKQ z00-R5+27mwp+3@G@Um)kt zzdstU{yWl9SIB_0ft3II3)BD*KrA2|{``^Tm;4PDy`=a1tTre>fEI#8 u{{2z<2NVVaum*qtVq}m+iAaI~Aiw~?reC_kVQV=60000 zj51&U|NhG$_=oZTA7 z0mJ{l|Ns2{|Nr-Y#^3*c{=WU_!>_-;fvROCxPdkR1P~M0Xa=C_KR`47{sXG+pY!Yf zqu=)*{%)W0>;M0szkdJy_507SKYxDz`3KYh5I`&-cY{^``2$3Z|NsB`^ZWO@y}$qd z{r%_nFQBC$4Is{6hz5WF0@(mI8^j0N`~Tl>LzQ1Ye}a&q>MtPo*RQ`|OMu4x1!@2Y zAfSdne}TsT{`c$8-(P?J0c~)w`~?J`zx?#Dg*yp^z&88=2q2IKpt(TRKniTbum8-y z1bBWi0e#F0wgIH{FVJ|Pxj-8L0tgsNfByUdJMs7b-@h3^8h-!E3i%CU{QCW$1*GB6 ze~`2PfHeF82q2&aU>N+96yg32bmdP5238q{|Gydk0=52OVEN6!@<&OA7Z~7wL16>b z@DCt>7#SFn85mf=5eY;LZ#OUe_l@D-2Zn#Y82<4v{9|E|jkRQ8_`$&N0jL_N03g5s XX0T^_9W~6o00000NkvXXu0mjfXpthO literal 0 HcmV?d00001 diff --git a/themes/flags/Belarus.png b/themes/flags/Belarus.png new file mode 100644 index 0000000000000000000000000000000000000000..504774ec10efa9fdbedf75295ac88848f23a3908 GIT binary patch literal 514 zcmV+d0{#7oP);EBlXu0U&@_82I`BfBC|Yn~P8llm?myQ3_K18=`^X_ivyEfB<6p_xd%%#*GZ! z-C&_V5IGPDK|g;X*gypg3;+Sd!XPTj0Q7fK5>&$Y{sHB| zjK9DB00sa3QR4q|tc?L6fSCSm+3>HW`NxbYpP7GsX8sK%KS9yYPfWi)GJ)AFzdp14 z{>t>1fsFwmfLQ*Ci!yxq#8guv=_mQ;-(Rp{AoSgsB+3J~Dn`pdxgmx19A{hgns>oXkhsL8>j&wfIu2Rsv+R_ zAB5T1GyoL?1Q1BWpFe+p|Nf1n;TJ-~Kd@?uhChFRHUI<=#0HS!U%!8$YJib28yLY( z0tg_G2B7i3e*FSj@aq@44gY_`jRywQ69xu=0D?FP=vyd&x*M*V6|CV8P{Uu4OBfgc z0tjNmA4y3`us8lPG6H?}8%zRafgb(Cp!5f*6oP{xAq} rF#LPR@IoIX4%E%Yz;K6w0U*EtuUcjA`-_J300000NkvXXu0mjf+>pV; literal 0 HcmV?d00001 diff --git a/themes/flags/Belize.png b/themes/flags/Belize.png new file mode 100644 index 0000000000000000000000000000000000000000..be63ee1c623af897a81d80c8e60506d2c9bc0a43 GIT binary patch literal 600 zcmV-e0;m0nP)PbXFRCwBA z{KboB21 z`ppP*BG3|`!vO*asNvt=e_;3gWsp&PA@E<2jYs6ilRy6-zmSku5?~OOP=5aV@4sI_ zSN#QP00zQ!JD>SpAKYgR_QStF|9~F;2M|Ck zz%U1e+FyoWe;B_0VVclq;}vp_kNy3hKMWrj7*{kqJbMcaQ;_Pve;I)x1Q0+h46j}> zeiN4E1lkA+>|e|*mzJsW^M3)l^W_^hf&c&c`Mv->`48yHFF-%s0|+3-*GLfwiRNz% m3}3(u4lrUsie?}H2rvLBbQv(L;??y40000@P)7S@!~g$((Ud|+28Q224FCZIGXF0FQ1zcbfB*dX_lJRr z;s3wCNa|2D02KoSAbE^!0Dxf-mZ69ApkCb5fP^9ydGO$cm6w`kGj(t#`M{tFlLo%j z*4%mm2&CaJSn02SzkrtfWBLcO;r%bLy5Gnoqrh)qC;VKmZT`F#yj00W%wG zw4zx17##T6*Z=hN0Tvey7!|wG?K;V)0{r{_`}_X<{Qmp<|NQ*_`}@YSvI2-@&cAgG z*R?p0?_>V(@&EVlEP?{x|1esA`||VNU68t8zyJRJ_3zg&hTp&0WMzR?0R#}s1|E|% zRV}tRkH6o2#3;(nsVMXI-pgBmh17ms`TzTu!pfBl%*_9R;OEbWDJei#0R#}sGpDd$ z96Spi@~bn7G5z{~^_!ZLy2#s;5B~o8&G`G*|6f0Ap0WS=_rFd2C(ubi4FCZEF#yj0 z1a!1=2e0}MwgDi3SU@2S4mePl{012eQ4J-3 z|Mm`933BS6zyJRJ1;ztF0D(08|NVzmQWB*4&)@%$um=Y`lmy1W-@hDx{{qQh3=9AP x#JH7#;TJ3-|G=X54_FW_j)5c_0|P*S0RT0dOSD~(4;cUe002ovPDHLkV1hfJDkcB` literal 0 HcmV?d00001 diff --git a/themes/flags/Bhutan.png b/themes/flags/Bhutan.png new file mode 100644 index 0000000000000000000000000000000000000000..1d512dfff42db1ea3e7c59fa7dd69319e789ee12 GIT binary patch literal 631 zcmV--0*L*IP)?&DC3JV7l?ccjcgB=Qq4l4w|Q;eOZ4z|IjsEI`#PYSloM|AFHF zfy)2>XZQ=$@t;lU|F1tRzpnmg{PUOLH{-8A|F{4CvUU?d0I>k|0TuuM^_1cNUy$nm zzZn?*{^!*ACzSEy$NyhHzB0Wn`TXRU=!%=n%Ci4h82|!^32gR%glZtk^6USnb00o@ z{`LDW>%U)&BK_|-y-75RkKVi&O=|xC<=6keK+72b0*D2q;Xlai|Ns9mF#h@fM(h;aV>^!x1-zNu02XV-n@ zm3imZ@&EI0hChG)|NZlafdL?Zn1I0yH26P<=DUx29QQsc%}izF;QV-S-hYOl|1V4z zX|a-<=Kf#g*Z)7i{{y|szyJ_HEKEEM|C#>$KmJzoZa)M2-~Wm-e7Cl+vi)L|kY`}} z&A$F20RV*|BkB*O Rz6SsR002ovPDHLkV1m;fPLlut literal 0 HcmV?d00001 diff --git a/themes/flags/Bolivia, Plurinational State of.png b/themes/flags/Bolivia, Plurinational State of.png new file mode 100644 index 0000000000000000000000000000000000000000..ce7ba522aa7e948d581478432643c230eed1a658 GIT binary patch literal 500 zcmV^3LvnC{|x`%yaFl$ss8ha0V@6XKS=c-5cwO(_{}IL0ki=i zfLOjo{AE-9^-mn=h(G`Tfz|!{{r?|W+uz?{^yeR#!Nm9NlRN`J0I_^YV&Ikj@%Q)F z|Ns9m{0FN3^Z!3k!*8HnFvf4N5xas50L!z?-wXsAPk7$ ze<1l+iQ((fPYeJ7#KQ200VpKFA^{3Nph^G!{9^b86oDW}(Ek1R7ZiL9e}Ret0*H}e qBRB&8AR!3%7c6cef(%d+Aiw~vBYd|xMihYn0000MpRNPo|?TW>MPOFW(r1_!xlT-yep5|G*@e%^SFxf#DC32@n7=0M7pe00011 zNe=7o{FIuhzQ(sjF~t7>`T+s_0sj00{`>*}`~Uy^|Ni?^Z7Tcx|FW0O0tlpm;s5{T z+df{s^E1rDZN;v4VP>0|8GkY`{`&t1s2YfV{r~st=KUYCl59Xr00M{!Xv@F<41fPH zoWA^R$>xvtF5yd$xc~X{7o-}f=ig7DY9RXc``_>1K-c{N2q2&ahQEIq{`~z1RCDs; zw*~7zIJ!sAKj8J}&!7K)enC|K{|nUc|Mwq|27mwp*#K1f8;Jh=2byv8+}GKw-@AGz z%-rMu^XK3HKtBLA{Qvdq*I%FsKn(x^1k&&qY(LP_Uw?q)|3jz0PF?=a(?4bU?qHzN z5I+E=z&88?2q2IKpz*){`~&I%+VJc5-=Dw#?LYB#!lHLRL7BZ8-NZ5x*TXaKmf6TZ20qEQj`^F;~x-W z05U+*fBxNj@_W(7kJ(ujGnWgh$g%(Z2hso#K#U9wI~hQ+`3Dk_7z`j1tL#*2FTcgW f@C+EF009O7>dRn2w6d?H00000NkvXXu0mjfueTzu literal 0 HcmV?d00001 diff --git a/themes/flags/Botswana.png b/themes/flags/Botswana.png new file mode 100644 index 0000000000000000000000000000000000000000..fcb103941523e24b03726fbbd88ef213dd476577 GIT binary patch literal 443 zcmV;s0Yv_ZP)k6 zPW&$KB`I@TtA?2x@Q~7pdcWi#1>DDZ2>MuG0I@IumHuaV^&7|soAMvT0IK){RtF@1 zgH;3B;_Qq-34j1%{P^)BFE1~|NkA(gBv!!4$aw$$eSiRB1ga=2D|__l(H|iA4T2Ex z>lc`SQ9x2&UjE?0g8%`<0`lvhzd$}*14J4{IhY2@0~G@V5J82%q9O=a{vExMP2%`MCSoB^FIcLe_%lf;|~%E5I`(IQNh}3Ao>6Q|DFUXMn*>AqQd`w z|1kXd^B;tM|Njjl{{hM0zwd6?1Q0+hV1xeud-4=Wy?p-%sO`^#2S61Jzk!N?s)6X& zzhA%p|N6}=D+{y%Ab`Lc{sL9~1=0UN4*CD*7s%9KAf+JHKs~=eB-8KTKvw|-5R1&; zzd&a|ob(5%^Z$Q=wHy9p13+aOpFRNu5F>N&`Tk_-7w>=n{RejQzkfh&Kn{rf10?_b z{tFTZibx5v&dxav5I~H7|Ney-|DWN1$%1FyagzUW0464;_wU~W1Q5$TW@eGxtUvee z3vAf*8|igK9~@*rr66bh|NrkNM8z+V zAV?>O@ek;bKfu6d00j-HAXl7XJGjM{~r+i{r~sxzrQwG-&h#_Y&p;L z=ieV7_s^f-zyJOD{rC5(+EoAn1k&)I;s3Kw&;LT?{{2}P{Pq8T&j0^^J4?LvUd;UK z&+k8ffB*XXONL(tXahh1fi?X94^$0Q>Z$uRRO)Y4)uapmB!2(-ul(c1=C+V!kAF`) z$PCo;`_FHns{jIs3Fu;wy-Z(c2YwAz{&V4aXk?bejFO*Op&u`@i~PecqBpL@DIoojb8mb+WHGK%fG2>)a3=iVf_~v+`s?*1;!`?Kmai^I3i*ZIYtpN f{g(k500bBS@e!0?Mfa}mS!7%=x2KmY(S z0M7pbTSu9imq`K?75n7n_u%3MB_szB3#hl|A07@E6$<6-<>30S5egmg@cSkZL+Ix9 z0st`p&i@3O7{&wE8wU3C1oia^`T7CwI=ckcau@Q71iA1L?!*;{7^Nm*&$?GLJd|NjPb3=0E0KfCb4 z#nAu(05Jg0{{-+tQ26`)!^rI-{P_e371QGlF%9qW_x;Sb;QRdk{r*xJJ*zy?_rWgu z&$=$1lYjzR(%pFe+p|Ni$IOoG{eTR0XemVUia$~;LXXZeDO z0096o0M7peXKyl1N+90g@dyY5ARP|N&gc{s2^<#+#>?j*9u48*^A9U5-*(6(kqBPq zC^|QM0*Gbi#3NFYyicBf1{wyk;Wx-spzFb0kX0fvuWZ`CzyHEKd)}3G%ew&r05Jg0 z{{dZPvvzMc=Kqyj=IHYZ2nGGUe(f)J7ZwZK+v5TV s=!a5B6v9X#`iH^&14cjw13-WQ0BQ>oQ(TIK+W-In07*qoM6N<$f`&OQ8n_8%|dG+hlCr-g% z|9<~wU<9iE{r}%DMphZ1Jpcj3%*DZBWo-@72DFWlk(-gj@!ngb-$#D&C_i9e{QvLY zw|{?r|NHlgiHY~?^IHG`05Jg0{{(k=dF}7->+9=cXlNG}79t%T{rC3_t(pA#`tSX# z4jKOh|NsB|;rr`({{a5__y7Wk5omBxQSrlv5B>nb??0VZ8qCZrpS+?}gatn>o%-+B zPl=+||6st##PspQ2Y>)#{Cu5(QJ~_^?faD-pMV;E|7MwLubjQ@B-gLso$mVYgECpU zxpfp2fEt*XnBKpC4-fz`0M7pb@zVeZ8g>5r-~k2r`Sbhd;{WmN02I(80QmHEv)Ik{ z>H7Nm`}_MdF)?FhWi>T50*LYBMFw`s0-y$le?J(QfB$Fr_2c8e-`_!j`0PG|ckZ*_ zzkY$-`sc5Tips@{7Xbo@1sGC5IYwrQfB%2{|MTZR!ygX*-%McG4cZmTY ZzyK0(F$K@T-Dv;-002ovPDHLkV1la=J3;^e literal 0 HcmV?d00001 diff --git a/themes/flags/Bulgaria.png b/themes/flags/Bulgaria.png new file mode 100644 index 0000000000000000000000000000000000000000..0469f0607dc76eb60327c29e04d9585f3ef25dc7 GIT binary patch literal 462 zcmV;<0WtoGP)WfB*UmB!B(-`wPhZ^#?@C^U5EbbPyl_g=3Hc01Sh${{P9=HB%4| z34*<3-m=C?^;L%miR{xQv2*hU;8+Y&0Dxf-W~KjsusWFAC4@j0#9_j;X5z6SjRhH> zd}sd(7FPhVFdSi!*Zj@;_Sc`kfByUdk|3A-`STmZ_yb~qxIp9o{E-p)bLt=iKmf7) z+|Ix(`{&<1pm88mK&}8g1WG~}e||Ik`OB#Cw~m1UAb?na(Zlrn4}+v6P!1@{@CT$5 z@|4`Xj5kLT%`al?B=W5I`(ov;U*021-Lr1*!W5(gW7O z@cTDV13&<=05Ky_HBiN$KMcQt819e>gHP`g_|Np;&&;0(C^$RHS>olZ*Q41X9v27}ar6#W9}0h{^{OajIK0?h(y z_zOe~zZd`lhy{p$|NA4!EeST}?;nUxkP49VfMx;1;V%&U|N9rH;SU2q05LM8GXV8K n(H~UyA0);fa6B_H00bBSQ>$p&$wbBBJ zMTk#;k4<3e#ePFE;{?TciOx=-NpIdg`t|#dcz^$YFqm+of7AU<7UGr+0t^5F#PsJM z(2)${Jd)SmT+KY5@!|h>po)L5-!r~>3uJux|0`&Jz~QGy6a*CiGyVtq1|Wc#zWw|0 z_y6C2|NnAvaR2)A>-NX%|3Ci{R?!hvH~jzU``ypCK7Rkq&&~h)FDNvCApj5nF#yj0 z0_X_*{{Q{_|NQXv@Av-qBMmR$teo!O*6-%u-J+8r3n~2s`s?uP{Qmp>{`~+900M{! zNC9;}eE(3IS9-C{62AZc<>Jx>%af}0@?r&05Jg0 z{{#T;0Os`NWh`ko4>SM%|Kw(60099Kad7|t0qcf^`tR-^sIP`Fhru7lkI#w#>Hq?W zkzqQ+@08y_|9v}t;{CEE%)%nTc=-MC*82p^=00=`tlmIeOf&y&dk@6oT z&CV8YCOfMzZ7b-;WHc4ffO0*K`UGc#9pHKW{n=1`s=Y4`sB0UGuD|F2(+4xFrs{6A+r|Fh*S$P>SRGs(%l z+O-QHfEa)O{tdAK=ovi517(5A-n@AO5I`)f0sl(Vm><0RZzq2;(QtLuuFT6X6;y@p zb-8u)9gSFj-3}5^z@SqUX4qfA01!aT3<}j|#!Osn3@^V(zxysO&hx#~ZN`f)vS*$d zpLlA?$HBnM&cM&k$j1o^^oKjY0t65vgZ)>ehy*ei5K#*ZyWju7F%Ll?01#jRixNU5 T4U6zw00000NkvXXu0mjf>cZT~ literal 0 HcmV?d00001 diff --git a/themes/flags/Cambodia.png b/themes/flags/Cambodia.png new file mode 100644 index 0000000000000000000000000000000000000000..30f6bb1b9b6c5bf355f67a17531fa73beafa6639 GIT binary patch literal 549 zcmV+=0^0qFP)P;@arD~1pHxO_zPr1&>t9y%wPZrAQpyS3=Ms1K-T|%K*j%o>i_=z2W0&D^Y8ax zhQELQ{rLl7|Ns5_-|C4+00M}Gf#D0s|6k8u{RAokD*W^JKSaeZAp18+HBcQ8{rdA) zTAYJ{;SE3lu^j&CtN66?*W<_k{(=kvTJiVSPc{h&pyuy)ZZrJ(`}gOM|G$0#rP$=; zY#H_d1P~L*>3>1SGXDMzbOE=49-9EaM0J&9T`emwH;=g~P!Ocy*DnU30tNVGcpOKXK;IXGH`G*aB%Pig@_cF{AXeP^XnG~{rU5QfdL?ZSim;?VE{Sy z7c(ax6CWR+s|%BWAkauYPfsQR0VXz9sPSMM00M{!7+@fO0fqklmFn#S3Nf;>{s#gU z7DjgV{|pRrOO`MKef9?wUO?vn1P~(w!@{x_lZQ{f0d@UhVEX<0FF08K{sNMJKnNIa zzrX(mdR{@6d*A9+009Ja65pra?7SkZU^!3-{)PrTC`>`Y0b%_6|LHH#J`sQb0@|>a n0T_AEh(trkF%3aX009O7j5IT?Rho+J00000NkvXXu0mjf2r}#E literal 0 HcmV?d00001 diff --git a/themes/flags/Cameroon.png b/themes/flags/Cameroon.png new file mode 100644 index 0000000000000000000000000000000000000000..f65c5bd5a79e2885060515be55f03a3ea4a15d95 GIT binary patch literal 525 zcmV+o0`mQdP)Mp0ssVo0Ek~;W>Z#0SJsA+2j`G% zv|UVeYYs-#Sn6_J90h1VosR?LBU7{U1rQ6+R0f9sPrg3=`~UA>#=n0a|7Q67_y6zT zP{j57|G!`V{{zu)Mn+knB>(|98e;E17s>tTLaMG-~Y>h{r`!g0jL-tfS4HmF#P%V_xIo5zyJLP zk|2W%e*G8w^1X|KC618W{eAoCFX+EI literal 0 HcmV?d00001 diff --git a/themes/flags/Canada.png b/themes/flags/Canada.png new file mode 100644 index 0000000000000000000000000000000000000000..1f204193ae58c87efdd88d46700ccb48c2e1d0d8 GIT binary patch literal 628 zcmV-)0*n2LP)e`b1WGV} ze#gbd^&bp=ef-GykAYc$@BhDltSqdeSy?RXJpcawy+5fJAb?mHcsPJ&{d@EF@4HtJ z)qno||1xd*zaM|Ot4f#|8A1AQ-~Pubz$7IBv;-i4SQvovfB*ge{fFVtAE4aNE7yPi z`^Eg=5yP(^Ur(Q5`TLjM%#`8#_rHuB|9}1hItd_vSpNO`#qjs<|KGp=|NIHm@MXqK z79K7}ZvOwQ9Df%s{`~lX*xI%KzW-!k{Lc96Cr|@G0I@Lq`0?-epMSr9|NHeD?&umBG}6iH(DSogJte zDERNk_kV0Zng09%Itd_vSb&=T{rt@+B*66dJ0my{fpNkvBm!jpV_;xnVgd@XDk?Dx zh=IJyzyJ_HjJJUrz)|>#fr0nRl^;KTz#|yK`2G9$BS%LzureS32rvK^u`=B;c)+&+ O00000{QUt82Kj15^L?rd`uqE`oNxjFF#yj0 z1e^fI2i-9Q(8&Vs@%;Dq2on+Z{QuwM00sm0@b~}!1OzrH#hk+X+Tt}E6bb+U_yPbi z0M7pcvI;2tA|wYPA^Z*x0300&EGqR875n@A_WS?(`uvdQq*oFTSt1&p=b-!h{Qv;{ z0st`p&i?}PGCBeX39IA)-~tZg`v#`;6$Tz2`uqI%`ThF(|NnA-^wR?L!uSAshx_~g z0000205Jg0{{tif814-hz}E2g`1#%M`@GEN)${-9=jr|Z1Nim(?*qH%B39iMC&AR2 z>ggNf+PVUWW##cF5^jI~{P}h24a1+`jKBZ?zJB$|uU|aB82|la`WF`1`0wBUe?VZ- zRnf8uXahh1u`n?Z4sYX?@pO{;x_8g;0tl$# z2T+})81L`j|Nel$KOpz_zrTNegN!(Tli}h6pb7teeq#K~3=Aa(fB<4-V9 d!wLWb3;+YKCC*ol*cJc)002ovPDHLkV1loTFLeL_ literal 0 HcmV?d00001 diff --git a/themes/flags/Central African Republic.png b/themes/flags/Central African Republic.png new file mode 100644 index 0000000000000000000000000000000000000000..da687bdce928e32e4a2bcbed2f3d2d97f42d340c GIT binary patch literal 614 zcmV-s0-61ZP)@|NZ~|iEi8i zh~?j3h8^dV0y&$fY|i?}`2XK;hJSzm|G$6#|L@;V)&KqZ3sU;$?>`_ZF38C6g#jRd z7@s_ODJ3Nev=9gw8UKSQhX4P)z5oCE{eQ>y|1j|H-+x9%#`EXT0R#{W1H*5i5@u$g zs{agN2m-%;fixfipeaCQpFe*F2q2cU!)f`}`5%6M06O*WzrTN({{8*;CkCkD_wPBk z=llWket~@P=ieVecEOTuB>(}$vTge|RYlbYUmpDW_v_E!KfnL|{{8n?G|>28zowm@ z_UrGj-+zAtrGTUoztWctUjPD#h2amw@BhDn5OHz(52cFPg zot=T34qlT?57Mzkg5?0ssOG0Ftp>paW8OyZ`_I07*qoM6N<$f+2k} AjsO4v literal 0 HcmV?d00001 diff --git a/themes/flags/Chad.png b/themes/flags/Chad.png new file mode 100644 index 0000000000000000000000000000000000000000..667f21fd9d552df546386174e506a6b5b606a258 GIT binary patch literal 570 zcmV-A0>%A_P)?P zUwuVdAkKe=-@h3}_C6p$AOxEwQo+UIeHT5%mg3lYGL;@HP(LjqG0$?6F}(Ht8A z0K*^*BsuTDFa|;zm9Mc;PRcq|KMMBO%8|{GkrU*a2x&r-3HS3`xnqW1|R~39RolBu`vAj19S<{HjoWK z4L}tj8-Qm20eTwfuYbROLyY(bwgDi3SQvf*HG+%>>H*pSauQI_zkmNAP67ugNCPlf z{{97O00g6G8FFbZ~XHln?_bqJeH^V)*lb;YTJ&0)m(r7ytqc06HRil3NF`RsaA107*qo IM6N<$g5!7R+W-In literal 0 HcmV?d00001 diff --git a/themes/flags/Chile.png b/themes/flags/Chile.png new file mode 100644 index 0000000000000000000000000000000000000000..29c6d61bd4f16075228cdc6e526aafc3443029d7 GIT binary patch literal 450 zcmV;z0X_bSP)FfafF5DUYXKh;r+@n*scPQUy6`!63S zGXn!71H*qtMn-04W+o=4|487=moEST#KiEAA;m(3;Xgy1iO{3BKc9a12~-UM7^Z`) z1qdLZI~bN-c=z}J|D88K{QmR*&tHcBxB*ZDKmf5Ya0q<-!`is-{h$8~f7m(x{QZSX zH3Jv`1P}|uy*o^wIGI2G`1kie)4zYe_&EQ6|NftW0ohon1}3I|Z{7d|5aVB6P)$bmtfBa_T{rmsVufH!rO2O)W0!b+P{TrwO zAb?mv&i(NBbu;G`sX*)cv$d*%>MiL-(QdhpkjakVmyu%k;sfcNRj;yhJaxT5MTg0u5&QfH8#Bf O0000Uz~~Q*L}q{yKmai^Fs!d`Rbj9@@=xl~KZbvQ|NZ^*|L@=bfBpc` zKOp-38^rz{DEepVv)`L`Yyt=%76t}3hHqR?<~aN{I`!9n&u`}MKs~?z|Ni|Cihlk3 z1w?Q7fI4M?HUI<=3&<7!82Y{{Q;@?^mDN?|=V) z{r~^ll=rtu5CcE}F#**BRkyY(adR>Mc_H{~T5^XRV~oVFSgBv#s=t2z{grn0SJIVV z|Ni~D^5u8)5(a<(0%_pmV<{@S{pr)+Nt0E6|KyV7{&xHKulY}Z0S*2Ic2cIyuhSoY z&3*a@=p=vu0%~ALNs$10lZEA9e*W!WzkWV{%9A7hYlh}ewm<)V{rd@2{rBIm&Idr} z{RV0P2mmnv&i?}d08{q%2kh+oUtbt0DGA2L@2{yn^Xv%Q%_4hjZ2Q{KfBuh*0fWjOcoPYi>{Qk`ejtlm`TPy!Q@c0|K1n4Ay00P>u ul!4(JQe+}W>@P40kp+Sq42=5$0t^6?P(4CrvcmZQ0000Vbu`-)NXk-Y`p?2$B#e1 z{(buQ`}e;;zyJNd_UF(2w_nb@VUiUP2igD-Kuin_BL6vl`zgIQV*mR8|8G|2U!T7I zn`-)Ow$bxne}9LGfB5z5*XcJ*K(;aeSD>o^0st`p&i@1e@&c~g4N@7~{}B9V!5sbp z`j|K8<@Nq-&kt=P>@pAZ`T7Q#;RiPl^j;kSgdzX}05Jg0{{#R8=f>y-z~LG0`u_d< z{QLg=2?6_k)DH^)`=sFo8YTUi-v;{r`o8J{6Wj>^)c^vB2^cJY|Nnmc_5b@He}DY@ z_51JdufKoSslWR1>-W9)3`r;XfsXn0`_Fc($H!lT!V@5Xn1Igu{qOIuf50&L{qg7D z?|*(LofMGa_%_k-*{}b_0g?9mMSwvE)Bq4bEIr*1})*zF_+U)&LMdEMOb{Nb-vOh6FrNC(tkd{&4;N%g_D$&)>g> z0^hO}m?z%iIsOJ1mka;_#K>R{i_RZNQ42x8VJSe8f#Ern2@qfa%&RHCyvg>Q00000 LNkvXXu0mjf=TkSf literal 0 HcmV?d00001 diff --git a/themes/flags/Colombia.png b/themes/flags/Colombia.png new file mode 100644 index 0000000000000000000000000000000000000000..a118ff4a146fbd40ce865ea3c93b9d20ab3f14a0 GIT binary patch literal 483 zcmV<90UZ8`P)XbC_7v4G9~kE;3? z$h?1GrT>4y7{3|*{r>Zd0U&@_82$jY{AFPH^Plk#hy=QU5o|Ds0oDLyFn~2M0QE2c z1P~*G;PKK9g@-SH{rUU<_aC4k|G@~v`1Kn|{`&=C|M{yZ!G37cNq_)iVfexD=MNA8 zh5p0Hf4_c1v;p<}|Ak}_F!%rh2&CcXZ-(!`821r;P)}L!W`0l>rF;|7So3KrTcC!ho;=0*Gbf0S0@;YBwbYEs=i=3_$ev|Np-X41fOr z{{tp}0~v7g%iT=?0mQ<{9!@# z-(SD~{`vL)_wRqdfBpaan?+XX#@15+0mRIp%kY{1qrJR?xs-YLhQhSVzk_f6;`sgh z57Tc3#$ODKzZsZ*F#y?2e^`Y0-&}tV5I|5HD)yDjz7nmS1pU~~aVF#A6wD&YtO00ImETIDprOD_2B P00000NkvXXu0mjfKOhx^ literal 0 HcmV?d00001 diff --git a/themes/flags/Congo, the Democratic Republic of the.png b/themes/flags/Congo, the Democratic Republic of the.png new file mode 100644 index 0000000000000000000000000000000000000000..5e489424884d2ec9e429f70d69af00edf242a077 GIT binary patch literal 528 zcmV+r0`L8aP)JkPqeYl28iLgD=0{><0$P44T5yOrT$dE?(KkwMFdoG^-J zGv9P)Kk|i5`lcNgUUAbboca5{hI)v&h!9!~`Yg)Ld}$VwYqqXn@gVLi>3LSVGm1W? z3qnDJAk6chH(u7f~FohUBCxfQDx8?5BQsCcprAnfVhO SHC~zk0000i@P`2b{=v9^Ktp0uZ001fLMSM)r!?%mH+B91 z=ii?+(ckX8zrd=&8g~5t-|*}I50LQ;KzRlRfB=Hn08;wv->)Q*Kc0LLgTdsU-~VfV z{r~#=|1XdRMzE6r0tlo5X#B6gzhXrG`18Y*0!g6iieLY~Kvgqz}`W zLWO>Z3Lv@r7+CdZpiy8Ae}EeP0z(_<2Y>)#Vfe-1#`njMUlORAfdMG=o8iiD#%aG9 z#Q!h|feZ$rzkeYJ=p=vuV)VVruXo6{KsbP_-SF+DJF`pL$*;0gaz z7NKVhyo`U;4*0+SK#>rfF&@8$XA^gF6?xq}zd#y5N`WeVBbyB+frxZH0- literal 0 HcmV?d00001 diff --git a/themes/flags/Cote d'Ivoire.png b/themes/flags/Cote d'Ivoire.png new file mode 100644 index 0000000000000000000000000000000000000000..3f2c62eb4d7dc192036af889b593b782dbe8abac GIT binary patch literal 453 zcmV;$0XqJPP)^Az=(+fAb?mHzA!MjRs*H~|NF=I z{~td;@BjZG-hUVsqZ#w(|L@=b|NQ>{d(*K^00G3pzycQk`jp|{UxvSb;p*Vv_V?Sr z{{Q;@@3$6WKrBG#F*5vR z`2XiW&+@|4`Xj5kLU3fF!G{fyDoR{}_Q36Vv~H|Ns5{^Z)NZrr*Dqe*gae=g)r_`DNuw zfB*t(VEF(4$y0{Ee}M=nS{mB(NB;kxJOBSE{F_{n`2Y8>|G$0##TjK~fi?gH5EIz! z|8Uj6|NiY-l-<0|OxA@1MWlzkmOI;leLR z$De1;{4g{7^y$;LZ{NOt{rct07a;lk`E!5(f@%OM1_PkhC8`eE9egqWbga z&p;hdpFRZ$Adm)#>fe8W4*Ct02B|hR1*-n0rS<;(dx&bFRY1n$$BzL5h>;=uaC^Mc z(+@v?|NZ~x@4w%F|9yUZW7+yTpo@LH>e(bUfFghX{rmIxzpNnpimU?w0mQ=a>kp9s z8>AGffmuv7DrFgv!3yU7{`2q8f1ngFoPlxn4bRVNjfdgKH->)<41fMG{Q1Z53yA)}NHF>VM86o=*Z=~EMTLRklg;&|8vY-+ zh5rBh|L@=bKM?ZoKOp1JpMQV<{rmmr|L=eQfFkpA_5cJB<7Wm2?&_*f&z|!oCH%Iq zVPN&@1^xa7gnxhi`TP6#zh6KNfByZH;9_972M|CY z4S#m*VEXjw_teQhfB)LctFzlGTKpda#8eRa1F`|=V+j!s1_l{`0AhU0z`&K2_5c3; z?|=UACdB;@3Hy%?Ffai9!1(6P8-M@;JL%7#4}bn}Wu*W1^8Nqk|9@zxfJk8Yg2Rge z5=!5G`~e6c79IwMkAMHSMfCl8%kXF6O^EHl82Alg`~}6s-@pI={`>#;Kf}J}IRF8~ zc$$I1RCFdZQi0L={}0epF!T#d{sWT?V3G+SzyRi{Q|!NXWpDrh002ovPDHLkV1m+z B7Bv6> literal 0 HcmV?d00001 diff --git a/themes/flags/Cyprus.png b/themes/flags/Cyprus.png new file mode 100644 index 0000000000000000000000000000000000000000..5b1ad6c07886e6963db439afff55d7056e3c5cd4 GIT binary patch literal 428 zcmV;d0aN~oP)s1`2Y9I{~ve$KWO@Yukru?KTxgz{s9CK3*7Y} zZC_6Qf4TJkuQ&gHzW)Di+kXz$|9k=eg(Cm|XMz~|=g%L20Ahjo4`KiVr|y5|U;qEV z`p@?NKb!P_9;^R?@o<+hfSm*oKp+h;f&YIQ*bg)L>I;A4WVP82*P-nR{;Wu@%{Vvyu7@~4txIf`R>OD+-01E zIfRil07L2S-Mat*#Q65@TRuKMWMi;}EJy%|ff@h;2;_%%@7_UT@edf{0+7H22rvMY Ws9gjvbyTka0000? z0048MLcfb{@Lpld*gfdL?Z zSQvhRtN^J#x6%GQNHxSfxHgc;AD{-1tAIKH0tl!9q}uD*5!1Kl8Kk6va!f$;fJ%WL z`2Cv^NdEc54D$xi27mx!VfgXqT8ME7!~2)OPy-`SXu#NiAkhzFFflLy1Q-A_8F>@M S6G{sJ0000h!ZNvLM`<}kPiIA3?K?Zl!VJuS0ABN12uI2v;s z000mK68GQM4oDR3?|C6;zBc4LR82Q1eETXSa+3nD0Ad8%4|Ml`Fn}2U{~ypshW{9V zk%{T!hYtV&#KHiVV*o?2zW>+&Bgm+K00G4EikX==E9>w5`yf~S`o*<00G4K6dZ++hy)_Bw{QPEdi2K7 l5H1Kw2asrHVqgFWFaQRwS@oh;XP^K8002ovPDHLkV1foV*8Tth literal 0 HcmV?d00001 diff --git a/themes/flags/Djibouti.png b/themes/flags/Djibouti.png new file mode 100644 index 0000000000000000000000000000000000000000..582af364f8a9cb680628beae33cc9a2dbe0559f4 GIT binary patch literal 572 zcmV-C0>k}@P);we;9uK`S<6~zaM{qBL9B<0yBR7V`E_e2q4D) z|Nnpa!Ep64!{fLA8NdLj;oraifB*mg`;Xx-kn#6Fhzn-q&in!pKrBENJRA&WD*ySo z7*5@0`26EP69WTC_22)0z>5C-g{l_hVFa245I`UeKudt6h7^Mc@BgDW81BCO4-x~L z`sXhc{R3+I%fRsKA3y*x{R6rHsA1>M|6jifb2E4w{z{xB{`~z5CPC;Y7bk|9<`c2PXgjR$^CT@Hzz$KrBEfF#?VC z^aSdB^z+g5SJMxCJOGqNsQwQkfr0#&=?~CJ009Kjz|71H^!MIRd#Ajb^76;aUyQ$y z%m(TN#spBq-#`C>zGeUjAdrR+|30kwu=eoBL!3-pGMq9%bs!`E|ACMovw

4;Zk2 z8GbPU1Q5%#7t@Nb6*GKbU;u{yA29j{CVzn$|6qa)V3LCYAiw~8(_SNKujRx50000< KMNUMnLSTY(1rd4x literal 0 HcmV?d00001 diff --git a/themes/flags/Dominica.png b/themes/flags/Dominica.png new file mode 100644 index 0000000000000000000000000000000000000000..5fbffcba3cb0f20016c9717614127b89db4c9664 GIT binary patch literal 620 zcmV-y0+aoTP)yt}{r~U(pZ|aU z{rk@#!dhJXj+vP`D&$&!2yPR?Jud5I`&tqo00z_V3?cpb$_)%#~li z5Bw?p&G@T5&5h~tB<;UIJ-`3_mgbQL+5iwhOdtm^{QZlh+Tg>NcGo{qR#UR9ewx4g zlzHy^uRp(j{rmOj?;oHBfB*n70M7pb{ow!s5r+W$=Kufw0RQ~_o$a1N^GPoTT-yiw z&XGVBSbe$r0&xrf|M~#~9P-zx0st`p&i?@b004Y@cH`sX`~3X;`}>j`1PlZ1WGkKd zF1~FN+w&9T}cJeJULy4V8r?0tNHM6WN&<2126ppbC05A-~q$vMCOd&N)3^rn&3WaiZo>@dB zxpL5=L>h@#UjVT%{Q39iA58Ths0J3s|NohoLF&Lt!8(8c18V>XAjZFc|1vT%{s#lF z^Kb%2CZ>-cJ^%y|<6Q;@;r#qR4;}z*|Nr|B$h_ab1b6QI%fu2>dIV_O?>~RR1sCzZm}g`N!}J$oTi?|G$4gL7*^D3`7C}Kmf5Y{CmeN)&f@km*M|^ zrvE_l-~a!AA&BAspa1{=fXIJ9!9O2vbOQts3j+fX{b%^|8m0my0Yd-4N`WN9@BjaR z=no^SIM8~400P%s(0a|A0FHhM?*o#se9Q zEZ;b|7ytr@MWm#zEz$bb`!9d~{{Q>$@1MW_!07MqKOpw+zkh)g(B$8L|49h*Ov!x= z5I`*NZ%IALAHVtk{r`=k{y)(2e*gi*sIRYISXlV_^=qKp{(!;n-+xj9 zUjemETFMXP0$m6sfwJP_;%#kh009JYeOg-Dy?gh5gTXH_fG|KLm<2Qhs6|CZ<>JMQ z009IFR-loRl9E6vpeV=!FaTTi8)D~Q7yv2;2q2OXK!5=N{?|@pNV(X=00000NkvXX Hu0mjfG@sA` literal 0 HcmV?d00001 diff --git a/themes/flags/El Salvador.png b/themes/flags/El Salvador.png new file mode 100644 index 0000000000000000000000000000000000000000..24987990b733244b23f8e03059f4924804662c75 GIT binary patch literal 501 zcmVAxVx?>``QKoX4p z{r>$=Qj`^FFF*h>?mzuiS(feBuYdplGyMPm{~rVab^il$89+1;fd$yvm=2wM1rR`t zfB*hvWMl+7=|4yZ16bGpcem@l{$rO?srZisfXY67`UDU_ED+y9gdmKw*T0{<`x@v9 zlkZkl}Tegi}1FC>)y z`~`;fe+5al?K4jS1P}|@5C%z67NEr6KmWj?{{J^f1u*QH|Ne!BH7L;kfnp0FfEXE= rk23safJY>Z`~zeELt=n*00bBSq*!cC{}>3t00000NkvXXu0mjfg_GrH literal 0 HcmV?d00001 diff --git a/themes/flags/Equatorial Guinea.png b/themes/flags/Equatorial Guinea.png new file mode 100644 index 0000000000000000000000000000000000000000..ebe20a28de06f3e6e520cea360cfc57586a5bec3 GIT binary patch literal 537 zcmV+!0_OdRP)u-`~Ig{`~p> z=MRwl_xtx>F!}G#@4vq{&D;bKKrBFA+{}CzK0Nsg1pog2{{I_D14*DX1pWH^3y6RW zSzcL&Zwvqd#Pa7K10w^wlkmIISh(4kI3GTJhN2$mzJLD! z0*D0|DC|s(0(}1j8UFtJ4HA_S5@P=M@9)2VV#30}-~k05FvNkXnV5ck`2-L^EDTKl zn1259n3DG7^QXUm{{H**3#f&(jx%j7OGE_~DVuFcQkgj@33fJv($pjj zgoNxWFM>pG#K4X+%S_Ys!f>f$mib36%ekHNec$;y5njB{!+Y`YzVGwA&4mTVh%ikU z03gD2Hn&LPeNu%hDG7PUvzrphs|^(-as$IIo1LmPya%Hc0Qn*6qc4XX3oKoa+Z)_XBQk8 znPA)XelBh#6J<)fj|w>7X+~Yun^@Bp4$+N z6L8rb{%QnJN{fql*fJH1L*2YjUlB~CXS&&LY)1V3h&68|x1_5-(4l3HUgs~3JvLXI z$_D=zL{dTnq9RK`-w~w|sCYqqA;@OoAE0!{9Gi+cF%zA>5*8OAiXWs z!A~!@Tb_6WJ;mn(q~>CYJ~Oq(|Mc`miY)G1d$)?S_lf*=dz3nd-8+hwz5w#U=!7L- z+Ve0W8Werm#o=KvYxRVVNtM9!poHk%m;Y{gxKdXC|Y{ fc0^aUlspXz7vm>S7OoCUZUIwXLGJ6E%Z+~lY(hhH literal 0 HcmV?d00001 diff --git a/themes/flags/Estonia.png b/themes/flags/Estonia.png new file mode 100644 index 0000000000000000000000000000000000000000..0c82efb7dde983e6ab0f6bebb3b2eb326ce3874a GIT binary patch literal 429 zcmV;e0aE^nP)X?Fbu$UUAQCA3`wxix_2=I& zAouq_SzðCcuS!~%52Kai0?gF&VORsRAR2~rJG2PFT1^!)w@)C_d-AAkU2Vc75Z z*R<@y`9z1vevIh)-p7{p`5C+7f|6l;f1_&?! X)GmJPc-xs)00000NkvXXu0mjfGFPrC literal 0 HcmV?d00001 diff --git a/themes/flags/Ethiopia.png b/themes/flags/Ethiopia.png new file mode 100644 index 0000000000000000000000000000000000000000..2e893fa056c3d27448b6b9b6579486439ac6e490 GIT binary patch literal 592 zcmV-W0k7RCwBA zWQbH``0|MX0{;DB`1Ob3-!Fz=zZw28fY1*HhF@R=VQ?@21P}|ur+3w` z_wT=dfByab`{x&s{PXYspTB>919^Y{{Qd`I{N9v10U&@_7=ExZ{APUe{`KE~Al1MB z{rb!Jhml3<_uqeCzux)%bv7|NkFAvw@aK@N+YWG5`bsF#yj00sZ{|0ReUZ0OJ4u`~d&_lgxzd z_7grGtKje;)ax=32IqJ>VE_O6|Nr{|0Uz@6!2*a0?AgCSJ_s@V{`!jztXlEUzkg2h zOW%AK0ILQg2A~)NKmdU>0L=y=29PKt(~s@sMWK)O87MU|4G0ImPt*+y7s`{{I1L_{;G9FVHyv z0R+;(^!pEkq$JpwzYKqVGyVRp{reTr#sB4{{{Q&{G@Ah!GGGK$3=lw!Ux87Egcwk{ eXi`7`5MTfy3O%OUuKb?>0000fB<4-V2A|A=r2_C101z~ iU~vp#0R6xN5MThlzdwv9U#bcK0000BE0lK=nzFYgc)d0A2*B+AFf z2joHok-@WP&j1351!6Wt`q9fjf1W;g`1ALFY=DuG5oiNI0I|ST{|2JJ|Ni~?`|A$_ zRt*pr0t5gt0M7pe4IJopi4@}M{rvp?{Qds``}+I+|3-D|`uqR;{Qmm<|NHy?`uqO- z{Qn;q1i_Qs0*LV@1A}N|@t-FT{{IC^{`vn0sPGp^)o&2vABgb_!eEtCyu9%!Kmf6* zGhfda5_|CT&#%8A#S0%rhKer*8VNG{57cZ3sU*g7is3Rq0I|G(Bf-nd3vr@r@vHy8 ze*OIQ@9-oMOb-A(eJ@7=Ab?mP;SCW2x*O<#U%#>Y7zqCS`2!F@APw*!ml9!S{vjhP z$_zA&0R;fLP(1(v#Q5^%OL#2G%0Af7VC%@R_vTF*2C05Lr?a%1G+Sb3M_ z-f!*)-&mJ@lxC7weD@!u;s2li|9<}wjr{Zf&o8mqKR`Cn4*&rGF#yj01QaSLwCD}R z0w(ww8v*|PzTN}jB`Pj8{QK|!{{8;|gOCLd|L9jy6{oELG6Dcq@B)aDq496GGsCmb z5T7wXTnzN$?|=Wl{r{i6vr6{G)xV#={AXc)t!L+QBoiQjSb+Zc`=1dU2n>I~p8E|B z6OfY_{`1$ji1Pn`9_T5yZrhJfj0}g~00a;V(9A!7nZZWFG{8az7^c++|9dI@cmDl* z!Nvb)UorrL86bdIfbsI1fk}{;;V;BV|AE?oY(}v2K-{x07*6Kx`SFP2AE)Ir2{}>qlLBSs|`Qg(SfB<4)VqlOE;Q=cD|Nnn$ zna02W|Nj1E&`=Tpav_4q;M$#E00G4E4{SI@`q`VGKvVzz{r4XmU}R+c_2(Zz0I~c7 zs`v*r?Dty(;z&PFFXX zRA5t=4x{1SIibD)Vqy6A2V^D4P_SySA|L?j2ip1XFA)9%V~_%1r~w2J3=}{2Oiu1 f7(RXZ0uW#T>&I!FfdIJb00000NkvXXu0mjfj-u42 literal 0 HcmV?d00001 diff --git a/themes/flags/France.png b/themes/flags/France.png new file mode 100644 index 0000000000000000000000000000000000000000..8332c4ec23c853944c29b02d7b32a88033f48a71 GIT binary patch literal 545 zcmV++0^a?JP)lgG%);U`26kn-@hOg zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8# zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj% z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&ZlgG%);U`26kn-@hOg zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8# zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj% z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&Z3lobsI zohi_A`bB&J!~)dH$ngL7lczwX3_#UDxxarw>LBRX?|;94{rmL`$Yzn1{l&ll5I~Ht zU%nI;6$RPw9|VBf|1(_vbYnFmA3K-0+yDOt{~_StKSoBzkDopP1Q63dnCt(82%zd$ zpFb}6I_2!oo##J&nDhVtbEpQW0tSEpVuGrMivIupee<8UpWZS`Uj1hH_v_am-&g;K z1CTfW0R#{WvT7jw$rQ2Wy6P|4+kZd)xq2}(*g=aGrk)Yxu73al#Db(Bq?4D0-N;b? z5G()RfB&pB<@s4TkY)e;`2!F@EcYcO{->q=ymt>64xqsK^^5b@FIO-F$h{9?`~e2* zUv?FhqZcm%1P~}#|Nj2NBq_=8`#0mCzd$+0-@loGnqiRuWPl>)F9-k?0|XG`aR!E8 ou!#JF#Q1|6-w+1S#{dBa0Kx%7Vg$%BF8}}l07*qoM6N<$g2}Akn*aa+ literal 0 HcmV?d00001 diff --git a/themes/flags/French Southern Territories.png b/themes/flags/French Southern Territories.png new file mode 100644 index 0000000000000000000000000000000000000000..80529a4361941e01d1def5d581bf2847cf99fef6 GIT binary patch literal 527 zcmV+q0`UEbP)KfiwinSYl|od6I(APxT+{=azr6>87_{|pZw{QvzM zh#vfW|M&NwU%!FG-`~IfN=xzq?EwhD!Wi2C0Dv&)|Bp?Zs+hPi0R-LQn75%cY-O8s zAPsw;Q!9X27=Hcx_y6DDzyCn0!4P6RP{Xg^fBpb%_yyDhbQs7f8-Qku33L4cS@IvK z8OZ(n2kOgTzyGb@ek0IRW9ouaN6$P0x*s5bfH4)06qlIj4>;1{Yyp4(0|4dQTo>gF RMrQy3002ovPDHLkV1fdR=hFZH literal 0 HcmV?d00001 diff --git a/themes/flags/Gabon.png b/themes/flags/Gabon.png new file mode 100644 index 0000000000000000000000000000000000000000..0e0d434363abd6766f9e8a8c8c9ad7275d23702a GIT binary patch literal 489 zcmVk)EZ(2O=d>QH$KN3zEi7S9u{+2K>GX4ds`2QcM z=+A$K-~a!^(JwH9Fn%*K{{Cdb01!YdV9)*qi~a#?`wdg{8%Z^Y!NB>w;@|&31~6!UgVwRhhvIeu00_fCKU~B)yH$s9sXS^B!W{?M(W&}hPbMwO z;*cg65E@7haJ!!XVgYOW|Le(9kkY?@fpY);{sqc`6amR!K*q2CzkUI^Y_hUI(*XjA zMdSH%VNp?r|Ns620Z1T|}fB<6Q zlw#oF`Oo_sVk+2%KTsoq3?TP6gz@)3Ki_`_=6?VI#CZSdeQ9y&f57m8xf%uh13`xW zAjrhTbmsgSfB<4-$Y)3kNW1sx-tWJ^f#}!YUqA$5fJva>FJQR-`S({vK;>fVMSuWe z0mcW=Ig;FxKxv@ppTFP`1*!N0BL9M&0|dYz`1hCL7Xv^5F*2kxF#KQuvOqEU3km&! jiTr^fV1zR<00bBS-TrJ5MX@2w00000NkvXXu0mjfGz`_@ literal 0 HcmV?d00001 diff --git a/themes/flags/Georgia.png b/themes/flags/Georgia.png new file mode 100644 index 0000000000000000000000000000000000000000..728d97078df1d07241ae605dff2f2cac463be72e GIT binary patch literal 594 zcmV-Y0^8x|9^h-OG^F+g7@$L?BC01YQ`Wbb?43;K=s|G$6#bNnb!1Cx>Qe>QfY2m>?Izi&U8 z1o&Rm*8l_%%a6%3nS?}u4*37)&;Q?l7=Q-<`}?1Z>;KQLY|KmGQ@ZWEch0Jnt zUmm{%2p|@g=ujpTGX@n^21dqzKYxO4`1a@2NuYivJ4XgKw*UYBFf%g!{qd7YP>5~& zE`R_4F#yj00OjT7{QUg;`}^~|xBB|}`T6Q!vcs262Lz;t$n|1+qbnVARhhy8{z5C(*C%JTg?tEV3%;s64O@&5h$(1-*>2%Ak`A87BFlP7^( gh&l)WvH=1N0MfQja}g1cO8@`>07*qoM6N<$g4hNuZ2$lO literal 0 HcmV?d00001 diff --git a/themes/flags/Germany.png b/themes/flags/Germany.png new file mode 100644 index 0000000000000000000000000000000000000000..ac4a977362738ca7daa20784717f10f9617136b4 GIT binary patch literal 545 zcmV++0^a?JP)h<6BFn%a z@b8~2SoNP@zd$;E{sbbRuHQd?{QCI=sNwhbA3*&Qe}GP900=;09NYi^fU@pUdVa9*13;+Sd!tjgXKhXQEMobL97(p6<{RLvMGBN!7 j!N9=G@a-1^K!5=NcXWu!7_DDe00000NkvXXu0mjfeQx^H literal 0 HcmV?d00001 diff --git a/themes/flags/Ghana.png b/themes/flags/Ghana.png new file mode 100644 index 0000000000000000000000000000000000000000..4e2f8965914ddd3bd6be97674d2e40a9a3f7d26f GIT binary patch literal 490 zcmVRCwBA z{Lg>@|4`Xj5kLT%`al?B=W5I`(ov;U*021*0XgD3^5{teN< z@cTDV13&-@;@|`T5QYI@3O)ok?1DO<2trehc#kXh!0Z4iC6of!=I9L4Jz5Qk(jP`l zJOKo8(qFLXAF#IH8`u5XwDI@PAHNy@|4L4RsD^0x1N0+605O4m05bkR14QCiMDQ;; z>0h$aKjWi;+@CNFzZm}i25JBZAQt8_hOB_!_dovn^Y72^zrTL{{r&6TuiuWpfB*e$ zwD}j1{Ph<^0%eu?|D0`P00`k|9}4iHT+`$2p~p=WCoxfpgkZGj{YEt g{DC2GLI4Ob02tU}a;hkw5&!@I07*qoM6N<$g4!w08~^|S literal 0 HcmV?d00001 diff --git a/themes/flags/Gibraltar.png b/themes/flags/Gibraltar.png new file mode 100644 index 0000000000000000000000000000000000000000..e76797f62fedcbfca8c83c51951680d6a6e9081f GIT binary patch literal 463 zcmV;=0WkiFP)VoB37QQ+R{;bN6GSUi z+kb{HA3p-oUOth}-@kwP{0U71P%%INK{Y@H82)oDp3V0Dt?T`39Pi$;RTl%zL?{P4 z2_S%&kW~Z0x6qjPzkeV9`s>}VU!Q7P|1&Wm)PrpR2q2b!5Hle5FfeebsWZ)5spT9vc*+3O2}Iw&|Nr{sqx*C2&8&?7c>c4n{QvVC zD9-TjFQbI?+i42`0*K|`>)%Y*uQL4o{r~rGhChE9{`~$Pz`@Ka$@uLpb; literal 0 HcmV?d00001 diff --git a/themes/flags/Greece.png b/themes/flags/Greece.png new file mode 100644 index 0000000000000000000000000000000000000000..8651ade7cbe030e85efc811a844d8f366c97a50c GIT binary patch literal 487 zcmV!E|`n6Mz6>fhdBj29g(UfB*aM-=Dw#|NaG$fByXc1LXhxFC@THKjjKQ05P&# zA9gbr+SsEBRPB^?1!&T?30hEBFhHFGv5AR^>DH}B00G4E=NHV45I6k$@0N4rAH*g9 z{zDN+_&*OP%Y{RC0Ro8e#fvv0A_7PTA~XKMG0?q08}8kE2oOLl>koag&}IJi^WT4% zN&g{c!yE%t3}J9_Fdy0V1t5S}4xV|TB*XjR%dfvcU;YDm6wdeu;Q~GU4J{teTOL@z0+>00G1VRSiT77W_YWkm2*^|KGm- zfAHXcOY8ruSJ7+$Itd_vn4oTd_U!+mLkz$F{Qvdq|L@-*^6S_C%a&nk00990)`(*=-xesBS%qG0|gf?f~#iu^9N|j9|i`10Ac}ZUz>% literal 0 HcmV?d00001 diff --git a/themes/flags/Grenada.png b/themes/flags/Grenada.png new file mode 100644 index 0000000000000000000000000000000000000000..9ab57f5489bb9ebb6450cb27f4efe0cfb466144e GIT binary patch literal 637 zcmV-@0)qXCP)@|2i2MUNJEAGBA`g{QJZ3ub1IpEW7h{~Z4K zJ3#Qa=Q1XS-;5h0el2+U>(Te$zyAID&HDTIKad810Ad2W{jW5`@9y)AKr^5J{4Kqa z;cw*UKQW)B)-pW&@%z{RUqB7N{{H&&_Ycr?fB*vd;rG8kGw%JlqX`uK!_D~nn&&T_ z*-Q+-7;nUX=6mt$`7e;3-;BTi{QC{m01!YRC;j>JdmqEEKMa4Icz%Tm{+4F_^}h({ z_1{sye%WyRp84|E^4Gur0Kxx1e;6150*D2Oe>41%=Kmef^V^IA7&yOx!2%AYU;o*D z%dq`!;`!w)_PhDb-(PS30!;@9Adn3rpZ_$9NHVegX88Y?;V;N+#{WPzFy?-P;*ar< zJ?CFrnZE^h{{CWM00h;Fvzl@K2fHp9I6dqaaxb00=Mu XLcuQ~?TP?t00000NkvXXu0mjf`7udf literal 0 HcmV?d00001 diff --git a/themes/flags/Guadeloupe.png b/themes/flags/Guadeloupe.png new file mode 100644 index 0000000000000000000000000000000000000000..dbb086d0012637103c0bebca861c10116ed3d527 GIT binary patch literal 488 zcmVP)fLk0D%}*I7ff3uKv?i+N*~ULWZ>4 zW5%k%a3T{@*`z6pma6eF$JtK+F@C*&o=d^t|Ns9GOCXH@*Z?CVuP#7nB5Y|1kmu|NQ^=?>FP0zrYX%2q2aZH;)P`n*#-K1r9WbfYOYN z??RUX1P~*`M}`*mir*mb{sxCVG>rbhqT(MY2L1y54rHu+wi6(L7#SX-$0bVa{(;3h egu%oB5MTiLH(5{VMZMqv00006R*AQp(xFW-Wt{{mJ2|NHk};Jc-)O#kPzME?5A`1{ZQ-#|To{!0im{$XGM z2p}eq*?*y`{{RjC%V7Pj<(}hvo^Z>=hrJ-xK=d0#0&M^~2_S%&fR6tAp8=>2$p8C? z0q7F5H=q9h`}OesIT^OczkdG%sRkpU6i@>|0I@Lq1-k@j0La}yZU2}V|JX_T{{Q!% z>EEtDfBydd!vuBJUq+w?fB<6o2X+#W53~WS;s2M<|9d72Yseq)`11cZJHs!aS-+wF z1}X*!ASNLG{ST%Ze}QTk7ytqY|9}7f|M~m>&%ghRD!%{(5DNnfNcHoNKp}=7 ze;EG#|IZ9j4hBF)cVB@t{Qmo2T96TF4?qC109^ty;2+Qi2B0xObN{1)Uw^{8{`KJ4gZ0H zP(J{D2s9NSfWR7{27t^!x8NVhN&g{E`Ueb#e*ggla?+pwj3Cv27=VUhwE^V&zaVoN z82$hR5DUYve}Dck14V%vK+Z)23?LgAK*7ZT@-zbjKmf4-BkT7+CNVw+pd~+kF)%WM zL>VCz0|PT7gS-eZm>Gd?16jcE4PH%g~!@=<9&!2x_@aEGW jS9>vVD)@{}>p)on&BOV)*xm;om>72$%sP!HhqD7ytr@1teTu4J7{m`^Wh2AGglm{~UiA z82u;s5_9PZ|FH1)~3de={)r1*?FgUtsi`kx>?C4?qC1 zfX)8@|LZe*d2K>lZN0{{I4*^b@QIr~;(tA5`a`e}Ddhy$ldQAPvkwr9kh3`~WiS7Zcc2 zh-#qDKOj^7{QC<;3||-k0tlpm>GvN7NlB2NKYyjTe{-?^h8PLd@aHekus?tQg2Ee! zfN=^CK#X6(5e!Gd)(i|h;JEn(j5jcXFhHq*fkB7?Aiw}&uW^ngBcx#f0000@|A6>41A`El{SSoRd}EL3@|NdrR`1}9=ZwUJP z@AvHwzkdDu1yn7|BMY<#Ab?oFX8(t({tZ$6>;L~hU=2XVuU~(E|N0Bk07O6y00G1T zbT=bV^`Afg|NLS2{ReI~M8m&-NE-fuGynt;*hzmtW+Q3%1=j#1fvO=I{`~y|)Bq4b zU?=?r84r{KY4``%041R|`~%zYhXEjfz)k`h|LYgXRlk0r+3@c_)IERx{rUUv4^RU@ z0D&|xgN*;p0Mzyy>QQ8EKn=iP{qyfH5CNS85I`UeOuzpyNJ@hA{P_#yFfjaPWc&?| zr{By>f0X$D{QV0G@4r9|{}=!Qi18~pg5ikaD#Jf9Xfy-Svu_Nh0nj)GNi#731Q-A_ W8E1tdJ(&;y0000J&k9ol;AaCAG*Vvs6lsG2f+AJUecp&K4&zS7@MzJZZ+RCHJO2~-cn~)8*ZB# z%#~(Seaqctb3On>xdArM!+zLfe2=iS%3k1HK82I)yo62#|&;D2*%o~N(LQ$HrxFU=@<#wgQDty7s|5?>qxBTrc>UoBZ!}1le z#)a`Pq~$aEPO=D0fO80I7h5SSMqU=q48*j9Qb*%7#+Pi|ervSf?0bSFwKsAPn1FO| zKH_&kh#AJmvOUSnl~!1AmcaNJM5awz`0DF46>zWZuCh$z(7uBp0to4w2iu-uj zV9oc#M;CkJ!OT_8;~(;r&Cw`0K3r=(%@VWyiIA#;S}+n)^}q>|)QZ|IaYyyY!;frq z6mATysX~aM!z!n$rJ$=27fpoIr3iB{q|Gr32uDRa3PcNj==OQGHve|07^1DbtUgzuEQ=j%rDF literal 0 HcmV?d00001 diff --git a/themes/flags/Haiti.png b/themes/flags/Haiti.png new file mode 100644 index 0000000000000000000000000000000000000000..416052af772d719132c152e26649635a97a63a94 GIT binary patch literal 487 zcmVAoS-S!;e2821p2q{((sbfB+=MK@k8U5Cg$|VB~~? z2XKWZk_lAZtGhi{|56nPieMKY$Bq=4KgZ0muK;2JYWn}5;nka8K-GUCa!{rJenZIL z|9<}gF~mh#ftCOS5DU<%|Ns8~1)2?0{RgZLWF&|Ls)lL+iU2hL1Q5&LKMX(>AUTM^ zNU9+S#0FXN@8@rz^Zx+^5DWL07wmsTIe-5EX@IBzTJ`52%kO`z5F362$-h7b*KaNc zh6exv#P}EJiR%3Sk01R1^NZmZ(C**=fB*Xb3rzn04HN{CU^bJS()(Sf00M~R4FdxY z(0f3MKYtkh0!g5OAQFsz{e$TF`x|H}%fCO*7#IKo2o$W~FaxWA8VofRr202h8w1#j zz=!|{Ah3qte;CCj89_$={rBfLBSbS$5J>(7`GW}-*g)q41Q6q6a2)=FMdm+9l%onl dL?8elzyJ+{hsuy4pm6{I002ovPDHLkV1h>fJ3En$GhGS>sbE%%m3$AD)q?8M9y>88-}kR7#RKlk!P~Y_PLuF7~U~3`~nC7 zF#yj00ZUDdpLsm{7ajP|&HwoK0Usg|6%f4L_{`Mi{rvv-`ukf=Ed&Gs-sA7L!Q7*a zj{*QO0M7pb%?Sw^g@yy{>ihEY{`vU@3=8@G0rvO$i3mOL`~mv-`W+b$Mmr&io5dg< z5v!7q0*L95jt`TzK8Kd(Utv)OSp_aLv){6ccV+Z`{Q2+asKUU&aO3`Kpz6wW8wp`< z28M3{0mSqnB#A*-c*8%1=RD#sSOwMznKA3=e&iEzwo{cA=PgXK`2OQ}gqId83!|%* zA_Kz@fB*n70M7pdECCwp4H&@R`1|(w-}M5x*74i)0}%fAt;XafA{48))#>Z>?CD#}*e}Ret0tl$#*RMZ7}Jl7Z|M45`5*URzH9L z{rmSnPy;{!u>dsyO%meg+00000NkvXX Hu0mjfN{&}S literal 0 HcmV?d00001 diff --git a/themes/flags/Holy See.png b/themes/flags/Holy See.png new file mode 100644 index 0000000000000000000000000000000000000000..b31eaf225d6fd770e0557c2baf8747c91ce88983 GIT binary patch literal 553 zcmV+^0@nSBP)|05Jg_ z#sD@3Z1&&(|Ni{{_Zx)%v%Gr!NnLzkb;C z@#QWhJ{xI9$+*)bNX$S?E90e{K^EMkYok78VXhR-hjM0*K`g z$j^Tmm_>oEVgxdn{xJOg$-v0L$jHRN$OsH@P9Y&+^ne@=1^@xXcy~X;zaPM$WdOPj ri2i^{AeYDB@IM9-yNpn^YtfB*U? zE6K^g@B<)#SlTBTcsfda`|@_0R#{e$UZ3l|Ic6l=B#}T zWCl5lg}RFY8S^$g{qgfJOdc2ve*glAv3c@IFK6|y-~NDH^$#cn3{a5k!L9^_5>O@B z$^W^zSlTD;0tg^R28Q0WdbfK|zW)9V43odV{`~*->+kR1AO=tbO#T4}-G3E1?u#4x z0Ro5x7#++k42m+GppXWk{}2W^;6Y*k7i(1vOT1`b$6{=&w9#5#oJ b00=Mu*}Zhb7k&Za00000NkvXXu0mjfKokPk literal 0 HcmV?d00001 diff --git a/themes/flags/Hong Kong.png b/themes/flags/Hong Kong.png new file mode 100644 index 0000000000000000000000000000000000000000..d5c380ca9d84d30674f05b95c2f645b500626c07 GIT binary patch literal 527 zcmV+q0`UEbP)00;JD`K-EmLvOuK( z0R&e6?>|)a-@i;iz|8zVIqAQ;I)|_@BNM~FU%wy-s0ZjAfB<3vx(uZH&mV?Ae;64V zIcsYEzkmP#{)7J;N}0Ju0muUq%~ z^Jl0Zz)k`PASO^y0(FCg{s2v4J zf4+RlSW)rg;lp2_Kl2?q^5yYkpazCNzyJOD%k=jzP%%INf#Tuc?>~%^l1w0DfWH6z z1E^V4lvz;l%d1x`a&jQQ{ROE8h7C|LKmaj5WMKG(8n4KVKd5of#=rm&U;y%qJ?5>3 RVzdAN002ovPDHLkV1mTk^F06n literal 0 HcmV?d00001 diff --git a/themes/flags/Hungary.png b/themes/flags/Hungary.png new file mode 100644 index 0000000000000000000000000000000000000000..7baafe44ddcaec29ad9f187f759a7fa3a1a5df00 GIT binary patch literal 432 zcmV;h0Z;ykP)P90PyYjz{{0J*12TXlP$`i71!VmC|LYf!%PK1iv=Z0I@Lq zVgLrRB#$I8Q2qeT`3KSlX8!?(3s3+U9e@9T1Mx3N13&;VGFUSJ^?=Y134s{hykP}!$Xp8x`g@iqg4NJaUd z$B+Mm%>4cD_iu*Zzrl=O|9^qF|9<`Y547mdFIIVlOMCYL1Q5sui18rvfj0Ph3vJwt z)dnUeruXmP0|XEYv&@95W{1bGfWG{@sKWZ+FOVO6s`df7U=M&0& zKrFzJ{`2=AL>j0Rl^KlW*80IEmzVa(K3*_6 zG7fg0I9Zj&0woGah`r_&Kwu3FK=xChQigwjfh>?7kc!_h@)sEWW@MKI+5iwhEdRtz z89B8WSj7JS|MwrL=l|b3uZ7Osk^B4auaUxSRgtG4v;Y11_x}$gi|9Y8?EnG9`1|i) zCPv2p|ADsrhuF4k`@Nr^zUpfTpS$xp!A}Wj4A3Yb2~_s}<0pUsVqyY2p8>1`g1&zJ zsVvR4Yya)fUw{4wtNss>0tLxGfB<5GmnRH!zxweH8<(Mq0N7e&^ba6_ z7#WHgIs!VLeti1p-=9B!fB*jb=l8$ge}LrQ-#`%%`S%Y9{re-sFSERHIY0ohF#KVF z2*K4Ml>Ykz*ZJq)UtlmW{9*tIAQm77@Wr{r~&-|6d^ahvDC! z|G)qK`}^nrA0Ybu|2K$nd)6X=0AgWa1{?O`IRi-PU$8V7{r&w9sOb0ae<0Pr|Nr{M zEF}%J0U&@_82&N|Y=e#y>zg27mx!0Xgp5*S}vr z{r~fq0csvl>92pk!P<5VDfB!NI2#TFQ3lKnzfB%Al=06ZHfFW+c#KiRe{d<4_V)^&)A0s0pNIe5S)eu>r zF8~6F38(?TQZ#J<0R*xEXct5e0}KG|WIzExE=U%r7$AT^8h-rv@ecwRzz_$3Xaxu` Y0RLik?wUgPu>b%707*qoM6N<$f;0ZTz5oCK literal 0 HcmV?d00001 diff --git a/themes/flags/Iran, Islamic Republic of.png b/themes/flags/Iran, Islamic Republic of.png new file mode 100644 index 0000000000000000000000000000000000000000..c5fd136aee534ecb59914e336cad18d18ead2a4a GIT binary patch literal 512 zcmV+b0{{JqP)r;gUH{1e{Y(x2_S%2fSMQ?7@vH7`tSc=xS~J*|Ni>>`_JFszyAFKs{8d9NdA)L zm1AIH00;mv0M7pew_3Ln1`-ek5ajjb8VVZW^Whu|9pCfc910uY_2L}~8{YEX9t$4Z z@!Kj9D)d(L0*LYN-@lBEj6f&-|Nox>4F7-s`Ty{t|Ns8~x3>Pz!S){pfXY67`UDU_ zOc38f#US*GW&hv2{?Eqpf6;>f$N=n5fB<4bR}BO)G5?=F{eR-b|HMQT_5c3^H2?$< zb1geNgNn-kGiMln{`!CM;{TsNL8PAke-;*?JV+Z*eYOvhv$==KunT1sF?AKYlWZiGf7_{AKv_o8k9wMiBcC z1B3*kzkfmK*Ds)AfB<6r3XWMgVnF4hNdW;sfB^vU;z%SnI0)(h0000@|4`Xj5kLT%`al?B=W5P+gNxB&nJfgpGfTOih;e`=>T z5jZ8;?_>v5xi(~iU^udv!6f5$jpNVh2O?$m1OPDr&i?@Y{r&#_{`vm=wBfh>{Qda+ z{Pz3$!R5rm=Ee2+`0e-d?)LGV)1LD5^!4@i=jZ1F2;wA$U5|F$_;B;f&rf1p(qbG! zCte(9VPa-y5lGpbZn4ZFhzcT9$vfdqmuG z@j$ZG>u9())mkwqmYHSd7eFi*FJ3%$?AX0~_kM%HFED^GKqQ#;=g)7T_f%9=fX)F3 zAdr)QMoCIaf{X{6{|BNG$o>N%f#5F;02KoS5XlH2zyJ$0KZ{``H1_}i002ovPDHLk FV1nFR>VE(L literal 0 HcmV?d00001 diff --git a/themes/flags/Ireland.png b/themes/flags/Ireland.png new file mode 100644 index 0000000000000000000000000000000000000000..26baa31e182ddd14106e67de1ac092a7da8e4899 GIT binary patch literal 481 zcmV<70UrK|P)1Ab?mHSU}=WzCQi??=KL1`SXRBmG?g! zeExSVgb4YXfjasA0Ybs`#&c5^XvcLUqDM3{{9AP00d^^H2e48-+%sM)d02u=%hct8G!N( z3;+QH((o5-_OE}xfO;@2_y=+i*h!3FCjkTyNW*WSt$#tPfB*dj3@CIxKqoQ$2DuvO z1O^6x00KJ+r1UogVe!Ksu!etsL5P6?Ab?navG)7lA4zUWkT?GPWdcP410y3N0|YR! zFo-FE!v&-P=p=vuVq_>~VE6=zV^DnmVAx)=U5ZNz6vaS)0m(NHWW2-wfs+9Q00bBS XO2cxg3=*#z00000NkvXXu0mjf|9Z^l literal 0 HcmV?d00001 diff --git a/themes/flags/Israel.png b/themes/flags/Israel.png new file mode 100644 index 0000000000000000000000000000000000000000..2ca772d0b79b255872cde2fb29060bbbbad950f2 GIT binary patch literal 431 zcmV;g0Z{&lP)WlqUuh`uiUU82D1+EBLb>EWz|Nj3k zj6%@>aVJ0ku|Ql5RsEk~{?`9D9{=ZO{V&1vKX2lHHJSgJ0SFC1p8y096I?Y|?05b{XcgblKTHZ zfByjpAQrd=h&?HOAa>`R|6Hv9XB30N3RxDY7$AV4en1PH(j<7uAT&Tc4G=&q@-F{c z8i9e$01Rv(35=ybe;NM%WdxES!M~uG0dj%y@b5pvikg1_0mOLw_HE>d#AF}?ph|!M Z0{|%qc@l5wel7q2002ovPDHLkV1m6PxaI%= literal 0 HcmV?d00001 diff --git a/themes/flags/Italy.png b/themes/flags/Italy.png new file mode 100644 index 0000000000000000000000000000000000000000..89692f74f051cd43503744c3dab65c8ba773b7e2 GIT binary patch literal 420 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~o!2~3KHq6QcQY`6?zK#qG>ra@ocD)4hB}-f* zN`mv#O3D+9QW+dm@{>{(JaZG%Q-e|yQz{EjrrIztFq(O~IEGZ*N=lh=;=qSyMwWku z27eMOW_|f0uQeek^e_9g7KH|eq{JVG0^UaP2Jy4}|L^JL_3uCblfVD@mnS9t`~UCn z|MT(+KT|KOfz%~1cG~~^_2vEk{SFNQ?Cjg~|NsBWy<%2im{vp^YdeS=hk-Cyo6U`Hgs{l4FR(w#{P`G0;a3G2@YSmzI~fu(ZE1> L{an^LB{Ts58L6#6 literal 0 HcmV?d00001 diff --git a/themes/flags/Jamaica.png b/themes/flags/Jamaica.png new file mode 100644 index 0000000000000000000000000000000000000000..7be119e03d203695325568174b72522124bb2f12 GIT binary patch literal 637 zcmV-@0)qXCP){QLU}0{l%6`#}@@_VD{9F|q;xF#yj01gpgWJ+A*m zGUYZW{T>4SpXmF{^Zon(`}_X;`}_MY3j1pm`Wy}V&B*(tydCWT00ICp0M7pd0000m zGd#J&@cQ@tG$8vu6a54J`qTCN{{H)06Z&u*`VIU0o2UAMn)~_v4c^|~0*D2u;qTwS zKYspMz5CDEtAAp>e+Mf5)@1$t_wR2Fu3uNK{_0!&`}CDxK-+|V{{|`s2p}dP{`2SW zZ!oxe=XdSY-}fK=Qse!l!T0O_!(X}WAk`4?=MOLh7ytr@32Xz9{pZ*3U(#Z~DiVIl zOa8j^;n%JAKjo!$j^Xni)Y$z6WB&k?3JlvV7}WR}00ImE Xyv9Bjb9W)}00000NkvXXu0mjf@Xt#6 literal 0 HcmV?d00001 diff --git a/themes/flags/Japan.png b/themes/flags/Japan.png new file mode 100644 index 0000000000000000000000000000000000000000..325fbad3ffd3075a4a84d8d898ad26ef7d3e0d56 GIT binary patch literal 420 zcmV;V0bBlwP)9whYk?f=!Q|Ns8||JN@lTD;`{R1ZWk|EGa3dAO8ObDh3E3Cb;oH_5X#1 z|NHy@|M?558b}5Q|Cf`4hZv9q2p|@?lb|{i68>{>{ol0lx`{mi O0000M00|Ni~>`!`VeZ#eh`f&K#;fdS|pfB*tJ>FU-06DIsWc#z@uumAs9{`&>~&q~MQB#;&cfB*tH z31sk|Jq+K!KjiuK-^&B5YLK~LCjkTy3s3{|pFco7yH$Tr@L>D>cm1y|D}MvS>F@7f ze}Db{_vg<)5c|)+zsmedM_Y~p1Q1BWd$vDo!X?isvq}Pk|KA^w>VH5L!1(y{_x~TD z9$-NK{r~sxzrPHB7ytr@v6F$JJdlAwh=Ji34E;f3{DCq4fk_4ifB*vkxQ1J~H9>i| P00000NkvXXu0mjf0T$ba literal 0 HcmV?d00001 diff --git a/themes/flags/Kazakhstan.png b/themes/flags/Kazakhstan.png new file mode 100644 index 0000000000000000000000000000000000000000..45a8c887424cff6eb0471f5a1535139b965e241e GIT binary patch literal 616 zcmV-u0+;=XP)g01!ZoKn?Fz`<^k#?O_Q1 z`=8<8e}=z6_5c2{{QvRuAM+0emcRf01JR%V|9}7gKjGLHfB<4)U|@L0AiL;yFw=jq zasNSbGXHKG{NMlfpWxpAK41Q^gEaj6FV4=$@arEy05LIu!2gi{Gync$`1$|;-~a#q z|NCw7f0xa__4fbPn*ZDO{onuJ|3JnA^#F|o2q31v4F4ql-&_7K9cVD)|KCjiesKSP ztM&iLe}uy71TZ z|DRv){|H?Bqoe!x=x?wkfBu3(0w91`fMN3Vzue;gQUCt^|MZVr;{RRU{|DCmOS=6} z@%2BU5C8a_|1a6~&;1YB8$b;J0mKBvKpP_e^#OhS_CN2(f86)~DtrE)Yx94t!v9OT z|MTDe69TJd_zQH>zdry01PrBrQvYt3|7!q-C@@&>{!_XBPnqZ6E6@K61pYml`M2uu ze+NdW22lI}1Q5_kK)3wPV4bt}e=;a?{xkdrMUmL?|7pP3c>kYY0b~&4U$AjN34j1% zWLW#P{SRLy(>r)v0s|Y${(}_LK*N79FfcIy1Q-CnX=G`P)0NEt6k^VGA)9E1hT9ocRoN>wSfaWv)?-raRm?)Slj<6Po6w} z{P+i;{`~nD6~!ec29@~tkBNo($fnHz0mS%{fq}QS{_m4#|Ns2?|K~SQUHy-* z`HU>AfB)8feAoK(-@hL}|Nr_0bQ_Dj+^xMk00K}f2RQ&hFc1JYLgN3=lsJ)M+p3uR zWC5ydAM*!ly4H1hsiEFvIU^1)HH_GYz!QMsIYt5i1c4ZMLC4DfztdU-q)WGxxg;|L zi3%uAJ2fm~N8&I2%AdL;`{4^9#;e!&D=C-&Lk8;9|NlO`c*HPy9@C${KeOWnB;`P2 zATRu9VP-jSWFD-S8kh{*zoh2aO#pT8A28t@U|NsC0_uv12fBrK4XN%za&+zB_ z{P)aXfBpaa=ii?{|9}7d|NHmt1seeZhy|?e|DWei8UFwK|L5=jKYtkh{P{kK2}m(L z`||tm?|;94|Ns5#-_IY+QnEm+00M{!r2OxHhJR4iK=k+TZ>A77)*#lue}Db^^$Tb= zko*TE|NI8J3LpSOb8Z9x2m%4nC$a{*Gqe90@enzQH`ta%tA$7d{Sv5iP&~x@8dMF~ z(;dfh&fyCHF#yj00oRR-9sTeJMNR(n^YxvS3U`G57YhIQc>VqR{rPSM@(uBDU=5F+ z{|5&5hj_*A{sI6o0M7pbe|x2IYDAmA_)R$v7XIy^!u#*~18PtP{r&xWnDPVw`hiji zey{rM^8J)$5m8%@0*JA9=57`qRaXnayHCFDJ@r1pR}vUfQ&&Fu_xE3Vu+-%{U$!58 zQy3!)avcufO?mzv0@a%gl z1HS+N7!IC&H?5`#AOHX{0M7pb00(zPR4BWp;5AJa{{8^XwcY>#`eSh{`1tyzm&^bF q{8L{tuE6I1;oe7AG|b!z0t^7P6ga05`yJ%~0000Cs@aq@DuRlQczuzDZ5@KTj2q4CTH~*`MftCON|DS>3-+w6c z9|(gO{~7-O`v>9vKX&5_Kmaj*WME|P@B8=S6~kYUnG7sU|G#_z>G}QV|KC3#^7rq5 ze}4b}^_xjb^7)+E00G1Tlwy4KiiwGVIVgltUY_yi&tI!o|Jl8p;n#15-@icU*KbCk z6Mz3^`1ON{fdL?ZnEnBs@%JyYzyH5mxBfr4|7*t%=AfYeY;6C2{Q{!DKY#uG1wwy- z+}}Xm3;+QH(!lWNFN3HElfM4XRjZk-tp4-xFo=l!{|(XrbkBdVP9XXJ&!0aG3;+Sd z1adCWtuJ2w-n@w=AmGpT?F`?)|9k%Y-_M^QML&N+RfBB+Dh3E3pdT0*fp#rf!j_o$ zUs8faP3>oG?f*A#7{O)(oeuE;(0C>wVqgFWAQqr4|9E)*J$m%5y#o|bz~KAxm4S=v zKP&4$usU!k0b}RSKS4oYgaHH)%c-;9wWL`3={r0|OreK!5=N4TMk7RCwBA z{P_JV0}}Z6?;n_iu%H+Q{s1vR05Jij`8c?M=-GouSI=K${m;n9!7aeW#m~(x$j!^i z%zXLG*~fS9it_V|2?zl-00a;V#NgMjUvJ&I^~3uQB4T37ii-d5-u?gQ&wmw_XD?o^ zUAsm=P*7M%NJdr`Xazt3fo%By|Nn;%AAbM-ZD?YwEG7BBxA%WR!T-FR|8><0Vxn$d zUT@yKdH&)BP#Mq$fB<3y`hl076R7Rgt5;mSyo`Gea7>-}|M%}Nf0%y${3VbO@hKwm zAWK?W z+TGp#<;$01Vv<1pdP-ancZ!Qkd3bmLHK?nrgX5I}Ab=R3zkQ1wk#LIP517FKVgLC9 eRt>}e0R{ktF&Q^6#MUGL0000@P)xg`upqGzh6Lx zERQVE2><~E((v!!|G%IA{@M07EI*V_ln=0RjjdN{oM|h)7EO z{{7?6U#34`ML_iD4-=RKMg|km5|FijfgS(|AV#2u+YAh13=HqUkqe1m1{eb(!T=Kl c0)PMm0G()MDW>>^I{*Lx07*qoM6N<$g4p`a`Tzg` literal 0 HcmV?d00001 diff --git a/themes/flags/Kyrgyzstan.png b/themes/flags/Kyrgyzstan.png new file mode 100644 index 0000000000000000000000000000000000000000..0a818f67ea37e1bf1398b3e2f92a52e331abf4e7 GIT binary patch literal 510 zcmVW0o(w3 z|5bef!~)j#|KF3RAf-U``!@sYUq;#A42-}3UHtv;%kTfcfBpOQ3nmTE<|1vNq z0ns0zZx{dq2xP;5h!=kY&G_~A;V*`-zy9<8Vi5ZI|I4p`PkusG11$kMn1KNxfWUtE z{TpHc!>?a|&i!W8{>5bQ`~TnHf3N=fz5nHq%!z>% literal 0 HcmV?d00001 diff --git a/themes/flags/Lao People's Democratic Republic.png b/themes/flags/Lao People's Democratic Republic.png new file mode 100644 index 0000000000000000000000000000000000000000..e28acd018a21b62d2cc4b76eec7bbe1f714dfc6c GIT binary patch literal 563 zcmV-30?hr1P){(%t#68R664G@6GIJN-*24NrwB3rW+v!ydOp^Ef6{n_)(btIFVjHa=pdp6)} zz^!@$h^2tpKUmc4)64h&|Ni?2LVth#{QKwk-@kwU{{Q=j;qSk{fBpc`pWlD@C4}l3 zHUR_xF#yj01d}3g9TFqw{rUX<|NZ>{`TG464+L38761SLpR(uO=J){s0Q&s>`~3bJ z6bIb^kphT`;m^O{e;I!LWBmP>@yDNkj7*H>@iN-VTtHNrD96Ue^ySz8pMMxZ=pRTg zKmaiT)&Bj@@b3@E4ZnZ>72sjw}n?8s2>T{qV)lKMV{%|NQ?241(YPff@h;hz00Cp!a_N2HF7% zr}y9gR8D)C;wJ_Sx5=xYz5MWpi4mv-=yjk&KmiL7K#aZ&_9^w5@1DH=3l15e)xUl~ z-0=7B?|)4HL4sh3f5LL21siGr0*GY=!$H*K#ZR;BJ~dv8zS`wDeeIR3;>TuF);jrk;v#5jAUY900)zv`N|Ns31p}&9s{rUUv@1OsF{`>=? z-@pHYNg(_0@82^wZ2|}&78a1v|Gz$Y3Q`J0Kshi8lm?N%fQ(=Ne*FS+xn*U6mIDM3 z3(!4({{8=rtQsf{G!?8Agn$gN2Dab7KQS->1Q6rPlP7uPKoY|E^ZWmwzrbJwx)~sVSb)*-|Mwp*NlCCVfB*i0>4ZfB zFhYR-gakS;`Tzomv6O+~6D%TsAw}vh)M$o8KMw-~K!5=Nd?1y|KC3hK=RLTAp0Mf zWcc&@%EC-|_DIyI;S5 zZoa(f#*3@};Q;9GfBygi2&4h78pxV*WHQhn|Nk-k{`>pa-{0-~I{v`b{|EZ(4?qC1 zz%@X;G0|`0)6dV-R;K{9rJ5v|%9;KB_nVP{8R7~c2@pVx*BKb3t8)H6dH@UxP=NgY z{qNULVEFv`^^@@rIK+N~gX`}f7I~!;+fM-m5DPFa{(t+%C?E(7W+q^;{`t)a3di3} zzd^yz010JK%>4cT^&8LzfB<5=h#HaqkRlk)Wq^@D01#jR5K~0vg#SK#00000NkvXX Hu0mjf%Ubyh literal 0 HcmV?d00001 diff --git a/themes/flags/Lesotho.png b/themes/flags/Lesotho.png new file mode 100644 index 0000000000000000000000000000000000000000..33fdef101f74e38e2422bb85dc8a31bbf1da326b GIT binary patch literal 628 zcmV-)0*n2LP)NT^udI6UX~&u_xA`izWBNXkIq%g^6Y%Pu{8|3yZC zlYxl^Ab?nacHcU-^!@XD|Nj5|`r(zVwkHE4BV6^xC+~{3+xxCp=yQ1PA~B|JUd6PoU1p;PCnS`uh0!`Wt}y4#)fi z@&Nb%0tn=Xmv@c{N@*}KFh0M&kIP1>YRmQG4?lbdn);9N*SEXB6{h}Te)Ie9Zy;d! z#Q+chF#yj01pfa18Ye&*C_n-K{_XVnU82h1@caA!0{i;;`V*Y{7}WX#^!xhz{Qms? z{`>&^00Ic4fsvW@|G$6Ruf6C#{P_EiKfi$f`+Dz}{FL7;Z+`vz4fMjFe?Sd?fe5Gp zAb>y`UVr&E@!c&!7K){sO`Ozkh)melY+9 z5KGUl3lpbYV0iHf6xF}JF{n*t;A3C_dhHtn&^!?O1t$N2Nj?UE00RIWZBXJNY9>Gc O00002Y|A4{o z-@kwT`t|eY&mTX2eEM}Kp+i!_T03wQQEla((gZiC0cs^;{c3|jAkj>009Kl@aN){ zC);;k0UG-E&);Xo*&wq)roznr3pD=Ezu&)DC1p;}S_BY4jKAN$W)>8Nm;toyKW@Ot z#Ps&Y4S)b*xg;zq)7SR<*)x!NAa?^@4{|ZkY%l|8FPQu15397y$%U%{0*LYZ>zAxx z8}J(slm+_X#f@tK0mO1iR9wET{^!#tU}GSb{Q3uSG}s1+e?a74b~(9Y%Qpf95aZY9 zPuWDo(ENa58%O|%pI^NU5I`*FB&GkLM&}>Ys6}P~0YHEO0B+J}4VS0Fk^lez07*qo IM6N<$g3a05u>b%7 literal 0 HcmV?d00001 diff --git a/themes/flags/Libya.png b/themes/flags/Libya.png new file mode 100644 index 0000000000000000000000000000000000000000..b163a9f8a0660fc223c2648b22ed6a074fe28b21 GIT binary patch literal 419 zcmV;U0bKrxP)C`~#DJkl4QvBtQTT<=hAW5C&pkLRXaMS_oX@ePCublh%7`S0>4^BHJ{X z&jSWU1bzAnAdrUt4F8|~c=q?-U!ZD;3Wy>I`UNEa{sJFg8g4-`_wR00IcC z0c`wlknw+DNZ2$-$7NDlT|NlUo0ap!i1F~k2r~my1Y5)izkcK~h z{{rRU9);Krw*=%9uq;py&^Z7B1lI8X4~o-~jQ<6)85pKOHYf~%iU9%$qyZ=)&LIKv z04P8aRsoF!DgoLL3cdee4gVMb0*H~J5hWs_B!uw~i3^Ex1_pot0|0+0kn{N-xWWJc N002ovPDHLkV1lkWn<4-J literal 0 HcmV?d00001 diff --git a/themes/flags/Liechtenstein.png b/themes/flags/Liechtenstein.png new file mode 100644 index 0000000000000000000000000000000000000000..6469909c013eb9b752ca001694620a229f5792c7 GIT binary patch literal 537 zcmV+!0_OdRP)sI{|q~>>TZ2$qp!tjsj_dmuxH+6SkQv+K1^Dpafp!@&+{r#8W&u@@le*a|z zk$)I|{ss9HAb?mjKkZQc#wYOgBhb-*|NQ;?=l9<~e?U(E{r5MB3DgSYf*4|4g1Z=I z0R#}sfv@v<-|;cLeDMG8um8XQ{Qv#?|LOa4L zz5|hefaLFgf557NB#8Tm`R|`M3=9AP!~zPVKOloaN+E`UP5lQo8*B+s^WVQre?jpA z5I`*dz#16EB$ zKY#!H`S<7dzuzGA_xCRl`Rmu;Um!M^l;`6=xPSp5fLIuQF#P%V7sv;y25A5(1xW+7 z{Q_w~Xakza@Pz>&fLMUe`uqRSpZ|Y=>VQIE8-4+ehiC(l5cdDyKm=3_5I`(zTN!l! z|Nj0Es0O49Xx6_!5M^MM5b`fj@gGk4KbtNx00a<=83P0Vn?HYFf{Xx4|Nr&tKga?w z11|FC_y0eCSvdcCFfafF5XlYnMRN&=-B{`>{W0U03nA0WvHB!TYz`r< y{$OAL2q4DW;E4VQBmbdt8IZ(*2pDGo0R{jiB6maa(%qQ=0000! literal 0 HcmV?d00001 diff --git a/themes/flags/Luxembourg.png b/themes/flags/Luxembourg.png new file mode 100644 index 0000000000000000000000000000000000000000..4cabba98ae70837922beadc41453b5f848f03854 GIT binary patch literal 481 zcmV<70UrK|P)?-#?r-wgj45C|ZESQtLMVW?~Zs{a4) zALIXj41fOq2a1uNeOQW%&E= z|DQh$fB%40fEE4z10q3;-;ClCKpOx8h=su~@}N>;ErcnO|V^hXG82+5i4Q+5aFU0|N&GK!5=N X;lz1sunOP500000NkvXXu0mjf*7env literal 0 HcmV?d00001 diff --git a/themes/flags/Macao.png b/themes/flags/Macao.png new file mode 100644 index 0000000000000000000000000000000000000000..deb801dda2457f619d53bc176cc889d362cfa032 GIT binary patch literal 588 zcmV-S0<-;zP)My5DUW>hHBSpkmCRUfavf4zkmMxWn=;={POe9 zpZ~vq|NHajABg<@_xGlmn*aic1*nOE;s2AbPk~B-;NSn>+$?|p{{I~>&N%tu*Drs5 zfBO0B*Z*HY)v`RYKsx~fhzW>+Cjb5S_s>6&>Le+qufKnBv&bF%YWVBlABO)w3uGC7 z{rLq%Ks`WL0R#{e(EPs)fB*akI^_5N|9=)g|N8#t9~WuY61}otf4Tqs`!(tD7m$X( zzkdG%X#fZyCZKPCW&?Et`7z=QS^~DI8Yx-=nhgK{7whGvYgWDg!B8&G1k~{7FHk81 zKmY(S0M7pd06qXVA~x>%?)v`v$?y7WENVL!I|c#<=Jn<;5-<%03=swpg4MkH|N9RH z59P$=0*D2u3CIB%01Ag+CC5rQSvY_G`T70NcNRvLcR${}{{9+hIZ*cRKadRo0R++j zv0Gk5I)>DQ+oULEUYSww-@{VeP#&z`*?j4i%tcfB<3v#u_k;CAlSmszIWE zes6rZ@!!9HKqG(r{Q)GE1e8GG4GeUkhF=T-0mR5q%E0gm7LmVTk@^EErhg$tKMw;y afB^u%K|axUkwLit0000p}y_ZxVsQQo9l8qD!tQ%&&F2zEbEdU-v3mY$p-gb*;wwp?LFG<9EeNpZLj7Q z>zeacpNZ>XJG@0bcmXcALo;Ad(L@#C92p0~G#aM!FfF0T7^YIJVVFaIl|0gRpSyF_ z@0dgJ{oT}qqUk#4;-a-U9Fej5EJ`tIE9)E!qDfL@GEq>vEDI}q@P8EmenIHxu!*Cc zLK?@%1j7u0A`mPlm`kyT;5daWs;EH!+LV0IWO0Zyj4+sHxRqia#e9ki#cu?^6YQn9 zOfZ8&4uw%r9nR_}FG?tJ1sBpnAsdGMh7pA$Mlm3ABvgz9aj&GrxaT8{1^YB+UzPEM zQQ5*0;(QnblJRNh>E*%16wccXl466KPu9Lk=M%$}%9~Z3xs9na6KbZ+^U;AoQ+JVg=BO3kgY$Vuu?iP6r(sQV=EH;Iwf|hcN2Nd zPl_EfW;$kS3zh=H4ojC&faCz48MN^H2?$<3((yN)j;^`52o304M1f80R+|X9}Iwu*X+N)@cjDs2c+lU z?_dAGBv9wyKfl@e{~Tjr001}1@4rADVDj%Tpgtwu-=}^u z00a=o2DtG+^6#HtKYxRyQB?o^{pa7Gzs!FaUNHa!5W-0i5^f%h1nT_t=O0kRUm#-m z!vGLKP#fTS#5u+P{rv~@0nkXGhChFS;q~V)5d8o97pUPE13&;VK7Rc89~k`k^9M+( vx2Q8b0Y@nl1JFDW`UNKcfk_?)fB*vkB(P&2-J7g<00000NkvXXu0mjfGX%sy literal 0 HcmV?d00001 diff --git a/themes/flags/Malawi.png b/themes/flags/Malawi.png new file mode 100644 index 0000000000000000000000000000000000000000..13886e9f8bf65186eb96071d4399fbe077ec92a3 GIT binary patch literal 529 zcmV+s0`C2ZP)rNibE_6+kRtZU3J46>yw zfWS`r^B2emYGC;Nhw;yEHn21ZK^Q<1%m5k+3<-b$0%`dF7h*inus>j>Kov-;VIf zD*pWek$*v<0SxiK|NjEzfQkVEh>@X`f#DO--wX`DVCWAL;}4AS4@`0~00bBSj-y@M TF2~k{00000NkvXXu0mjf^ET$> literal 0 HcmV?d00001 diff --git a/themes/flags/Malaysia.png b/themes/flags/Malaysia.png new file mode 100644 index 0000000000000000000000000000000000000000..9034cbab2c02704b65fba6ecc4a7a1c1d053b6c5 GIT binary patch literal 571 zcmV-B0>u4^P)Z-xKO+5@Bcl`=5c~|G$6#Vc^TNX8-{JF#yj01a@w+002>mTdm0Dxpa1{C#)An)W@eTA0)PNwiNI_f1h_u_DTrb&+z}xv;{Wj zFGj0Cgf$G002ov JPDHLkV1gu%1+M@A literal 0 HcmV?d00001 diff --git a/themes/flags/Maldives.png b/themes/flags/Maldives.png new file mode 100644 index 0000000000000000000000000000000000000000..5073d9ec47c3b98e18bd3cd8499433d463ab8e67 GIT binary patch literal 542 zcmV+(0^$9MP)WzhA$B4g=Z%5I`U&fgJtk z_g|1x{{H;?U6oxK=&at?J**6@V8K5Oe}Dh~1#%?NbbtT?*#Hy-y7l+}Kff9N{$pgg z_WK6Ie}+7v0!uEdpa1{-Wc>4s0pu$NunhnK1op#kuysJ&8U8Z;`FH#0jm^LQ>Tv2E z__*)izhD3U{sq|pR0FmFAb=oF`osMFS8?ijP~d>v`s?4X6Tl#928Ghke_*>=zWoA* zI8ZS_0I~c5+3<%^Qj!Z4X!7Bd!`~OdX{VxLp z5dC3f{KL%rhe`hT|Cm4jfB*jf2Sk3^vlaWpqpU2@27mx!VE|eEAE^2d5dHlPWd8sE>;L~hU=6?i|N8~f1J=Os z`!`SnKmdWv|I6_A575egAcQa*n+Bj_fB<3vdK75(@4vtQ{Do`yh0yRHtQw*LD9^wE z5I`Uef5B$|`u7W{2T22%M6!Vq>?D8y0%`dD|M#!IAl1MB{`!Yz!@u8fUYwuxex*z#9GlH2{4I3~mO10Ac~g+V6jVB)KI)-uUyEi4o|t-;5vIo>l+&W2PtRx|M&0z2M_*#`0)SN z@BhDl{r~j~sG3n$7H9)N0I@K!uxMy#e*W?mp&AJO{R1fisrv=e1J=Os`!`SnKmf7) z1AD;K%nYO&458rnZ>;h=xCZfJy-Z2&4h30>ylo1|%C8 z!A=4QAQtS#|N9SD2R9xVP=6R000Ic%Boqz*|DhQF2dLpM!{5I^H2?v`f~*=Iag5B& z3^Fndyu3hzLFn&a2m+c75I`Us-n@D94+enNf~Z%o__l08i(?1?2rvLmwOi|Xk;8TX O0000qpJCu1p{#SASZ=3QjbPhlO05Jg0{{#T~{M_a8tGL(@4F<^6===Qr`uzX+`vVjI z>RSuFND|!tCprH%UjG&-`Tqfgkh}r_F#yj01OWa1_W1j+!`}P+|NQ*@_xS<*{r*D) z#ao8o+xY#_%t@QS?0~yfBW+Wj{_zyJQv%*f2f%)|)v=^uaq0&4j6{l|Ybrbh`TZ`2ITPyN!~wBya;Q+wXO z|N8qsP{n^H7N*~zApZOB??0dhfB*t%@KJoPW~Y4ZyXB%oU++J<@%!g5F#%3te)iws z==lAQ0jwGr+CT&T00a=DyL0x5XB;1||6pKv0FF^K^bd&vjBEyg00RK!=O6aq+V@KU O0000$g8u&g1qF5h0Q6aJN-{1Mbz`Ie0O|k$ z{sM@ZfzzR@(T$Ir&B098+eukMUeMl2+1^x^fq~&CAE%jZ{^O4ipMU-bgNM&P{`mQajg9%ivrm#DT>t+4XJGgP z5I`&pzyAFG^Do#{Ra%^vg_(hwneqG2-w+MozW@IH=Wj)-86P+6=Wo9l8G*Kb0|+3- z*{jc+=}JF+`H7W<>HmKQUT#*P1{)(8poaY?9|3*x^4(W97N$Rc|4EDS&R=&5Ab=SE z{{73y$Ox4F`Rgyx2o@H`|EK_{=f}^#%*+g|tSlctd;ka_mU(L~nd(ak@UpY9GCq0n z(2rN05Jg0{{a96b$W_S@ACL(Rxa}M z`G=gy|Nj54lTiQv|3YG^`}+MH7z}h_G^4TA+~V=RqI&{}iQ&&bpkF?J{dw&CQ*JI+ z5dlsHn4|vw{rBhJzZb8+p1k+fF;B_XE! z42<9q0s8Xa-+!garV_&3Uw`~!Vgv;%KmY+HvKbgYfiyF)F);jMVE6!x-Ip&{0DU4U p=>-f&1_my$6wo1$fFwYG0RX)13*@;vt7rfK002ovPDHLkV1lt{Hh%yB literal 0 HcmV?d00001 diff --git a/themes/flags/Mauritania.png b/themes/flags/Mauritania.png new file mode 100644 index 0000000000000000000000000000000000000000..319546b100864f32c26f29b54b87fe1aee73af21 GIT binary patch literal 569 zcmV-90>=G`P)rBb0vs`uywH-=91j zzd+y*NDt6q00G1Vbl+cwzkmM!`SbO+m+YTk|9<^u`R%^_m*bXSzgT|#{QE0P`4>nh zQ2ZZA13&;V0loO=-(MgHX#3gMzn3`u{`KzHucyC$Kl}CT<*&8wzt6n|ss8o%*Pp+C zfTjZk5DUl#p#T2<`NjV0^vyqym4EMy|26&E??3;3WoiC?{O#A4)4zWSfZPMI0U&@t z8bCe+8UPFj-d`E(e|zZv%GLeN@c(z$rC;+8f>rHtN0D&|BIS>OtI{AOC zx$tZGDUcCBkzc|7XAeyp!)#=hy@sHz%Z8Nmi!G71?uGb{rk^vkcEsO8W!D1Ad0T=%Vj%gtVfB*vk>3V2g53(}_00000NkvXX Hu0mjfpCtxQ literal 0 HcmV?d00001 diff --git a/themes/flags/Mauritius.png b/themes/flags/Mauritius.png new file mode 100644 index 0000000000000000000000000000000000000000..b7fdce1bdd7d174a894a4a075743695301d32450 GIT binary patch literal 496 zcmVwT1SlAdCl&Y)$gVg>5qW^#Y{{Qp$|KC6V{`~n5M8AIn z$$wxH$UeVm6F>m5>|$VWV&MJy|4IE<4N06-W9 zfN4+=|Nq*iiwn$Q2C&jbT&$=TD3oCSlHOGFpRx(;BY;>KBo9alsWSh04>T2o{{H<9 zq`@}){__Va_~#GM1}QP2gACgN0*LYNU!Z^U|NnpRpWzq7|3Cl#|Nj5~7gmyqN$LIj zQvd{pWi2U{IKN}lRCnF;x&=P&!(V3Rv&T;|GP6K500a;d#1A^U zy8js%fB*jT=jRXRU*A|5K#2L*r(ZvQ{P_O!=da%umKG4l0|XG%NkAKznV4BvSbj4y zawHV~fBoj~uiyXJSQwZYIoR0QIXM3O{tc7`Dgy{0# literal 0 HcmV?d00001 diff --git a/themes/flags/Mexico.png b/themes/flags/Mexico.png new file mode 100644 index 0000000000000000000000000000000000000000..5bc58ab3e3552b74d990d28a0f500e9eb6209dfe GIT binary patch literal 574 zcmV-E0>S->P)LFc1LT4cKmY-iGBrkbGB7ay`}g

Nzrc?B z!}RAj&|v@p#KiFL&)@$*g@6D2{reke@BjagZ=QH_|HA5tt#{7v1Ul>guV4Ru|Ni&u z_rKqNfHnXG5DUYvUm)ZE{sF26>H%tC6A=5t#K$G4Eg-G_A87rbKVS#^0WyF#00a;d z1Ca3#WHt~1jRI=eclPL04k1AU{avRH{sTG*Y{UOQAO!R;KmY+XFaVtnvEdic(+vNe zOr8IIc?-17*~$Z`|L?Eg|G`fB4^+g!01!YxCouq>54Pd=FQ6a({TC7tjr5F#2GXxz z|3N{=01TJ^fBykB00a<7!|#88#Ce2)8ovGh$;ikEv=>5x7)(s8a literal 0 HcmV?d00001 diff --git a/themes/flags/Micronesia, Federated States of.png b/themes/flags/Micronesia, Federated States of.png new file mode 100644 index 0000000000000000000000000000000000000000..066bb247389893b9ac33893fe346732ef394d8d6 GIT binary patch literal 552 zcmV+@0@wYCP)}CO1*!he@c;k+ zfB*mg{rg{#hxPwIh8G{d0|o#7{Raep|AEAFCm#U_AQp((@4x;AD*Xo({rB(3@4q1y z(m>63@(hzyJPYWMEi%>@iRTXyxzU zAo>qT2S^W413&<={Q1WKlmMyz`(Hzv@8AD_R~~+N^7b200Z@m&0zc4{Q@7rNwftxJ z^$Q??fEu9g1Db8CAq;fMkDq@pJa`8*&sI~^TtyHla^%`8uswf)HUI<=3()%@Pl0^! zf8Ui?K|l%XeRX{Qd(n@juAHz(D*15I`UefB!>$cK-hRUqIf!|Kj}Y zKt+#Ue>r^ZHOMRf{y`i940V72V*2%m0pg)Q5O4ka4>U8*PAAEH2(%ZZ;ol#C0AiF(UW*)& q3=s4Oj6m#vP&UxAe?ZIt5MTgFMVEBke8_SD0000M*00(~<{@!wBU}0eR!0_)M!#^$%c|o1wA4mpD0t66HlA)zv9Z3HD2a;wKuKxf3 zKLhV?#{Ykr|9@us&njQ==l`GI|Ns8^_xsQFIm-b82&94GKf}}4zyJRI4@Cd}JZ511 zyk#BtzrVk|eZKww|NG~I-~WGu5Q~)bF9rsH0Ad2#1T-6>`p@704FCVWdiqyE_S>%? zzn?t&`v3p0|G$6zgQ7n`R{;bN6VP4%{xkdmsRoGvjXbc2Q*ib#i+$e?>}LD_@7KRy zzyJOE_4n5=pu>QE00u!g^X8F}1){Re7)$pq2>GzRP>hz5WF0{Q`{ z7%1`&WXbP;Kox)fFb41M1d2p!76A1_RfAN3oCFX+Kn)0M$tdvjY9_8yH^9QVjn@nfZP*{rmI(|3?O9b~d@cVAX$tK?&3V z5I~F!3@gDg2t{v?r~d;6^$&1NgV7;ZP#i-L5C8-i0C2iwRaxXp%>V!Z07*qoM6N<$ Eg62#MXaE2J literal 0 HcmV?d00001 diff --git a/themes/flags/Monaco.png b/themes/flags/Monaco.png new file mode 100644 index 0000000000000000000000000000000000000000..1aa830f121ab8ee0107d03251a03fee7cbcf790b GIT binary patch literal 380 zcmV-?0fYXDP)@|4`Xj5kLT%`al?B=W5I`(ov;U*021*0XgD3^5{teN< z@cTDV13&<=05Ky_HBiN$KMcQtBo?#b8i1w)1P}`YD=UMn?0*)P|9^oV_=9jUlG7n1 zgOt?2g9iZui1GF7*Fr)<|ABx33~>V{CZ_AxuLA@S%fEmBAbhajaRP`eP%%INfiyrk z1T_G`pFe*90tjjYTn_{=GBPrt03a7C3lKmc4KH52_yY$2zyM+rgbiXafFO_o^aD@| aAix0StzUbk+v2SN0000@{}>pU8D26lh`@M2^zAEy;6E4#hyVhJ1te8n&0xjw|I|OmAOC9q@qGTx`1kMs zKYtki{9$JJ&B6L7=Kt^CKt7QCvS|}Q0D(0y{Qoccl;O=^hIfA-|M~k7Bn3tPfBpOS z`}Y4|zknP@Sy`YB00G1VQttboLEtY##9yH3?>`J++5f+PL6rRiQNLgu1_potVgX{t z{eKx$|NOuHhk@zOpC3@OA=>```VZI207MK7009KDfg$woe}>=xgMa@Q`TZMV99$1f z=+7UZ=>P!)^22||KmS$!{Ac;a@cR$YT8L7JY6c`57{N{g2q3VN{s9Bw7X!l|paf9r z=TC&I7$7zP9Rm!dKY#u(FaQJ)NCWfVKmVWoW?%y` zm}dTA_#*kA1?Z>0QqoLZAnySq0pv->KTM2<4l$FJ^m&#tWvBA4C(n)b76qu^ z3TjKJi*u=MzAs;^(tHqT@6cZ|8AHxz+0T%zR}I9mkc`8w!6%f1G{My^>{rmp(`~Up={s8&+{Qm#<{R63-jRF8M0M7pe zp74|h+7SfEy9M#{{`U3;5)b(M0y+2j#`QMv`vWF8IQ;$o{QUp?{QmLR&;S7V0*Gk~ zkHv3!H5OU9Kb*Y(q-ELEH9vC;U*%N({+r?VuV26a{F4-VqagC^H&EN}zd$De1Q633 zj~FHafsLPJA96}RV-#A)X~v?X^MOAye@1K9u&05Jg0{{zeC zH7h(V@9+2F_Xpti2mAc}=j!&)<^S{h0sZ;_Q7ob~2($C-{v8Cq(%>lF*}4LV2^e-j zV}AbzqQAd@=ogUu2Vs2v^{02G<;{1(|2aQ(EV23Z2N=G800M{wXv^O}|A7VrH9+)$ z7=NG)mcRcxm)QV402KN07wDuv009Kl@CPU%A;t|Pff9c}I{*Fo2PXf3L>PYm|M&kd z6T{yxzy1Ri0|XEw14AS%MzNxQNDQDd27mwq0OfZ^Ej7^!+W-In07*qoM6N<$g6Gg9 AMF0Q* literal 0 HcmV?d00001 diff --git a/themes/flags/Morocco.png b/themes/flags/Morocco.png new file mode 100644 index 0000000000000000000000000000000000000000..f386770280b92a96a02b13032e056c3adfebfa18 GIT binary patch literal 432 zcmV;h0Z;ykP)@|4`Xj5kLT%`al?B=W5I`(ov;U*0{`Ko0*gOW1x?dnY zU=0kve*-lD1P}`lGXhluRs8wG@Eb_}{{H{>S-s!?{`@vR^^5K2FR(pO4M5WY0*DFZ zqCZG(`2G8?)UU4`zrJw%x*-cw4MBhY08Ix7Ah47E{sH^x7s!U+ztwL3`tbkv-#@=J zum1jzWCJ7ENdN%^b`n?!d!0?ZO;SY>NM!#Sr3j;s^4&s;y01$=&U~zyG1R{bN8&$-J2AZUB z{O~2s*67}BSLujJh!l{(TM_&V!SLx<0I@JIFetqFAHVYHe9OP56#xDPD){#oDEIpx z82$bI>))?me}4fPvfQ#j8vp_bq~ZU+|9p&pvv&RstuJJil>ZL~|9}umff)b({bONa zxh{1bAb?oDF)-ZV`m5;k=ljw>l6BpeezVN}{rlPPKR~N~|N8X{NCKH4>bI<%?516t z00M{!=o3jd#=5m)yzyNB8Nca#eH--U&Fe3(f#?+keR}os(@P+F`}Hl*IRF8~0t}ng zTmN>%etWlrgX7)b6MtD}{$cp_8-#v?7>pqD50GU3{f7;x0U&@Fe=;yIS7rUbaG!zu z&%cJ+j{>}Z{{3SByBg&1|Nj_3~Dr2e;Gh>zZrofD5`!lF#Z7{ z2B7#~hM#}`yX%A}^sE-TCS?;peW@7xO)zGwLT z>;Lb2Aa%cf{|B;v0lB{!Wo3aj00dxJ4sHN|VGstA{YR$4C2D_2_!cBcz(8l;%*ju; z_5-pDt^fjRVEX=(;rPk#zkV}({q}dw+K<0~Gco-B2UY|%8?FIpIzRw{{P+Lo&pY>j zzJB!i)2Bb*-v4F%#qjU=2Y>(qX<+*Ohe1*jY|LMVKOmiqU?UkIBoO`m3qe4|00G4K6*VFmu*EK13J3rK Z3;;9iRuWt9^;rM_002ovPDHLkV1h$@)rkNA literal 0 HcmV?d00001 diff --git a/themes/flags/Namibia.png b/themes/flags/Namibia.png new file mode 100644 index 0000000000000000000000000000000000000000..63358c67df905515b49cf50cd766834dea8c18ce GIT binary patch literal 647 zcmV;20(kw2P)~Cfd!0!j9&~4{}>qlfDw=_GI6Spo7yiaSL1(R34j0qF#yj00RRApetkm@ z3-<^I`04Bn_xS?+{Qmv@{`~y?GBy}bOB@O2-v*J4|MK+z`}_2=vH}QbDjOT??*y+^ z9PHma=D0k1DE9l$Z%$6;=mbqObq>D1hX4By|NHgp|L;GHwRPtz;{gH)sDXiz;U6Qz zZ)V2dKoY20MNK$ASA+NcQ;z)f|Igq2|MmO7w9@DL!aL%O?v>U60R+_W>(dw3rWqbw zY+vs`7YYhj_p}$}TRP+a`c40T|N0L!J1pWwjPJac>kgmX!|;RwAb@}x{`~&)@5xJE z5fO>bZXLnj?>WlS|KEEGbn$;~p|4%Vx0QJ+&gI^Ic|%b^5f~5v0R*z)@87>RPSSB9 z(mdPNGA>^D|K~4|Gn`ysXGCuKcCvq8=a*k!egj?m?>8{m00Ic8fvd1cUx@iTXM5HE z^H)FyGjo2eEq-FG+;YA1)Puvn7=8hj{`vO@7;-=x00M~R?)3!82NxK-n*V?K1yZeJ z{HiGaByR2;1J+u>UitA{$OPI`~Tk`F#7!u z%=q{3H<BYX7n!%ts-g52=?&#%8AHvnDo=g*(t zU{@(f3Lcro01!Y-3_uV4{%5PNloM>zp5gQNALI8Qf4=|z|KsPsAHV+n`1$wy&wt;4 zfzU5-=mP{0FqD1)U3&iJ)0b~Q-+l7x$B&=CVSxxV`w!S3U{3%6(9;Y60R+_W0~jFx z85t(6Ir{$dcL`zMKcF!E2U7}WK$QOlX#fZyMg|5;)aZo7D4hMD0TloQ7ytwKAO>U2WB)$@6+CBT{3ok>^7H@y{~6FRKmalQ{r8#S z4^Xx6Je&%q%J2@E@iKAb=Rv<(vO+e^|@#56B5{*~0Mg z@|4`Xj5kLTv#?55wQzKoX38|NjLffBpXj6#2y{D-E;(Ab?mHL=FGT z$TP6>fK>na1GWK({(upf0nrSU5*Gz(00%w4e}91F-@gjtJbOE500a;V!?RECzy5mt@dro_q~YJM-#~SLe}OeX zNT7y4|NilCvNABd0|+1%hF>6clER!2lYo}|1|zVkK=SXOfB*mf{rC6ZKVbL)odgg- vjKFAPVE6?_e~=h|kVO7~qZmRm0R$KTYszPUy89K;00000NkvXXu0mjfB$dbi literal 0 HcmV?d00001 diff --git a/themes/flags/New Caledonia.png b/themes/flags/New Caledonia.png new file mode 100644 index 0000000000000000000000000000000000000000..2cad28378232e91848d9a2c8bd9d72a9e6a635f8 GIT binary patch literal 591 zcmV-V0sHUNMy48Q{FH!M8N)Pwp9Y)wTFo81A^+}-HTA|tp~ zO4-IyLWKVGUAVv#KrFzpU^vb8&*4vW%&*_Sfp-5+Oa#jR{(FIy5oqwQKVTa`BqPut z3=9AP#KLU;d%N^MnR|>Uj{MoN{TEQv&!4|iQhqnS=35v13ux)DKYxDz{qyJVA7#|2T literal 0 HcmV?d00001 diff --git a/themes/flags/New Zealand.png b/themes/flags/New Zealand.png new file mode 100644 index 0000000000000000000000000000000000000000..10d6306d17429012904035e4097bf93a8d205971 GIT binary patch literal 639 zcmV-_0)YLAP)vY&wh05Jg0 z{{*4}t^?F62l4F%@9_Wk_yrLV`1}4n_xiEzG57obO$p>A_3H5V5SZl@9UBk;0Q>>~ zF#yj00jE58tx;oDUfVAO7ZA^g)(IQ}Y8G-;ZB^s|2r!a55}@Ef&J{K=uDyPxdE3 z4FCZEF#yj011R$m=m{0X((d>7`QGgNy~*X%==~K4{m|+BO$p;F|LeE!5zX@o6aMwK z|0Cnry8?)1@m-dDW`RF^3@85Z{`vj)H~*iTuYX^D_V?HC|LG63e*OOQ`}ZH9+h%{4 zR^kLX2_S%&fc^l6#;?EsK&pTL{q^hL&)-1T|AVLlN&WsC!*d@f`}fa3pay^dVgYLS z^XKpHUw?lCNw6Z2x?f-t$o}(Zg7`(je_wy{{yg~C5U2qlfPfml0Rvc4oChck)CmlD zkWL^2sNoMV9{$c|wex0wa`2z{-@pGE82$nT5F-OaFayIEq`3SAj@nQDb&XuwlP!fzJKM z`1`}(|Np-K;|B=>MS!;cWf13KY+LvSAb?md?)rCHn)&`aU^p;VI>1V00D#b-){yc34R8!1Sqb680000pTI(!tjlO;rIXl@1HV&)cpmDGW-GR z`3+L^2aNvy`v2$G|KGnEMPz|W00M~d>&=s#l8OvKbwEpiHvESG2>tK>|GyyO9|$ut zvpzk42q1u17-V!9I61+pfvQ08|BZwH@16Yr=jVTUlmA*S|6zcEk@1g`6+i&7`~&$E zYA%%V^7j8zTmS$3{hyirzos*?2B2bq00L=%yMh7Y5+V8jy0-s+|NJkm_8$o_f}Hjb zAb?n|yt|^zto-ZmuYW+t0)q+&<<KJ>BgrQT zRQ>1Q-#;J~AoSE-@kt#fq(zr{dlL|rVbPb$^K$sU||3VAQpx%4ArjH z5b1ya|A`BUvomopF#HDspdkBi_LzW}KMcQr|NHa%@9#}BHvt3?3s4hK`pMU)fB*dj z0+88E|KR{Ac>Ck+U;lpn{`Xs!M;2%gKmf4-G0FZ zKmdWv|I6_A&;LJv{(%shYM_N64Szv401;3FKmf4-Jp?oxsQb@fum%PU8~*%)I0>i# zs2CuCKpOsn%?64Bg>X9QKhy?*00Lh)xZD#`v33$e!wuw~|G$AI0?h>~ z1_&UqlR!#;Ll9OQ{s1-n2ZahyF+c#Z0Amdp#**BUAaDHn%gD$G3dPzV3};X@Gl13bFaQJ? Y0MmSSAW;3b&Hw-a07*qoM6N<$g7#Lk}@P)zKX@%&%DST%gMqDF&nJ<9}^SM9e)7=i1G97Xij+!pc8>s z0}TKw06GH{9{>J;c@WiqflO8wrXNp!0t65X1H*raF>uuoM}q1_&UQ zzyE+PV}l7nR6|1@Xe}f}K_mmn5Fh~%KtLN9K+(a>4Du5*FzA2|{m;zE0Q4slD+}03 zKxJTefLQ+k0*D1@+|Oq}Kt_TL2e}yHXa<;L{(_`6pHRCwBA zU~p!DquG0BzkdJv^XJbWKYo1u_VxSs@1MSW+P$@#L70Jomw|zm0SEvBhy{qNbE|>m zzkmO1v}^=;1(+C_zx@3C{m*wPUMbGM98Q`}5v}3B|NZ&>_xGmUO#lG|(!jv*|H=EO zfB*gc{`33)|Nj{n|Mza|{r>BFYe?(AfB!%K_3?Y%L>Z^l>!7{V2qIffI$#e zz5f4~?wt{_jNwA=k=tvV8m;04hxH1ClNsp|jaD0d_yUND;Sa;#|9^ps{`~n3bQJ?5 z!?D}Pp1*tk?A@~oJ0>vvX8@W7)C|%C)&LMdARGSt{R`y$`S<5P0|@TEy!-p_?>~S2 z1lj|1A`hhCuT1`^U1^@yK06yzfAV)~#?EnA(07*qoM6N<$f^cITh5!Hn literal 0 HcmV?d00001 diff --git a/themes/flags/Northern Mariana Islands.png b/themes/flags/Northern Mariana Islands.png new file mode 100644 index 0000000000000000000000000000000000000000..298d588b14b9b19e04c26ab36266ace317b81d59 GIT binary patch literal 597 zcmV-b0;>IqP)p`2X)eQ1zd`|Kz0p8A$%R z`bTZnZKVTj3KfeK`2Ky*5B&e@&)?sFfZ#7s13&;VG5q=W=RZg_5SU54z5Mv&imk%` z|FW?#NF2HHZpKX|PKHOnfBpIO`|qDW|9~0*0*DFdzkh#$Hv9ux`j_+Xe->2}ZC)XM zHV0!dKPS0Ur}$Y}|Nr_6wBa96o`K;HKmdVl_zUt7(16dMgtTSeTz>rQ?Z?ko?mjsC zklD%d+V79-zd^=BZ2$-$7GT%`Z2%eY=kMmT9MVkp=Y%mFes6g9+4CZ|=Y~?>`*tz_ z9Sja7kOqJN0yzojravHW{k?SeQ|&okK5=fKkARLe6n%c?uEf?;0ubZ>f;9XA2p|@Q zU%!CHiwJW41sn7GB}e}J|9v$?qW1mmH(Bw2pdk4RbO%twKY##YWMEE2jz}>2 jgG53Y5Cqh~01#jRFwa04;J&RL00000NkvXXu0mjf4K^ZQ literal 0 HcmV?d00001 diff --git a/themes/flags/Norway.png b/themes/flags/Norway.png new file mode 100644 index 0000000000000000000000000000000000000000..160b6b5b79db15e623fa55e5774e5d160b933180 GIT binary patch literal 512 zcmV+b0{{JqP)O=a{vExMP2%`MCSoB^FIcLe_%lf;|~%E5I`(IQNh}3Ao>6Q|DFUXMn*>AqQd`w z|1kXd^B;tM|Njjl{{hM0zwd6?1Q0+hV1xeud-4=Wy?p-%sO`^#2S61Jzk!N?s)6X& zzhA%p|N6}=D+{y%Ab`Lc{sL9~1=0UN4*CD*7s%9KAf+JHKs~=eB-8KTKvw|-5R1&; zzd&a|ob(5%^Z$Q=wHy9p13+aOpFRNu5F>N&`Tk_-7w>=n{RejQzkfh&Kn{rf10?_b z{tFTZibx5v&dxav5I~H7|Ney-|DWN1$%1FyagzUW0464;_wU~W1Q5$TW@eGxtUvee z3vAf*8|igK9~@*rr66bh|NrkNM8z+V zAV?>O@ek;bKfu6d00=l%a5DE9w9oI(Q6o;?Ey zAdrT?A3yTg*!;YE_t&FGSk*xQBO~LVKYsuMhzTgoEGG70+cq{OrGLMF<5CR)KqmnN z5F^kJDrIFqfoA{t^Z)mszkh!J|NR@N^WQHZ-f!>?ZqK&!y&{zFIzP0wn(b{R37FH0BS}Z;-(ZzkW0R z`o;JgO8$qifBy!003d+C8bA*C^$+NzU%!${e*gOW>-S%fvmgwhvw&=%Tb23#oNZ?S z2p~`>{R0^fayL*XP!U2MkOb-c1#;`ZzkmMzW%$Pc5I_(c{;*0)g6#S8SB49$^)FDx zACSQydx0wd{{073{+Hno13&;Vu4Mp{AoLGRCWbOF`~tJSfrb9TxDaUu27mwq0KDvZ UcsT?Vy#N3J07*qoM6N<$f`X&bC;$Ke literal 0 HcmV?d00001 diff --git a/themes/flags/Pakistan.png b/themes/flags/Pakistan.png new file mode 100644 index 0000000000000000000000000000000000000000..e9df70ca4d63a979e6bcea2399263c081ce5eaeb GIT binary patch literal 569 zcmV-90>=G`P)`{xe>ko^7oADI06=l8$gn`UeR2p|@S@&Et-|M&0Ts{jIsi2(+HrUEqpC9EW^)CAOaJl^^9-%lBC8BHP081)#ChQGgo zHUI<=3(zGH+B`^Tu)Z%{q{PpYS&%;j+KluCr=pK*_e;5D)h=t+bKO_wx|Lu6N(?HnJ zN6`lu;-7zgR^V0GaA(7wCwqWF2h;!%KrH_l5Kj8_?>EpHKuhXR);;uSzaAK9KY#yZW@T0p zQ2G1+FVF^n0AhUp{`o&J`0?k5YKbbt8;l4>j(9ExfB*vkhsr>Vq>*li00000NkvXX Hu0mjfu=^7c literal 0 HcmV?d00001 diff --git a/themes/flags/Palau.png b/themes/flags/Palau.png new file mode 100644 index 0000000000000000000000000000000000000000..6178b254a5dd2d91eeaa2a2adf124b6dba0af27f GIT binary patch literal 550 zcmV+>0@?kEP)~nkZ zGRMDC%7~XK0S0Tx8Wd7-QG59jKr9SQAk|O4{{Q=*0jSzY^rW5C9>)KFc0aM(`^fh9 z|Np=Kfe=u&EDs~YzkdJ$!~!z=-~YcrJO42FE6xsAYGq`2_Mbt_P-yG_e|4Mhx&31J z|LZSE!|%TgKvw|-5ED@OU$BE2n0|Z9O=M(v1mpqrFfl%gR9?uy{Oi{rkOq*RfB%6# z1PCA|pp${Bfd()#{N!P|4fj41<69Aq$E=K>;Tryc4F(7xpbZRv|AD;q^*8I6-->Vz zfB*5n`o{nM2Peo6f5F}W+3*h_fS7<7;^vxc*?8?`g7w0kCk@cHxaHDByoH$n$~K0fYN5BQR!wAqjL2Kmai^lz(OTgcO%Q oK%!9YKcr{|u^AZn7ytqc0H_5zuk@Q*SpWb407*qoM6N<$f;OS^T>t<8 literal 0 HcmV?d00001 diff --git a/themes/flags/Palestine, State of.png b/themes/flags/Palestine, State of.png new file mode 100644 index 0000000000000000000000000000000000000000..f5f547762ed3a7f556b1cb8b12fb80ed17fe1c4e GIT binary patch literal 472 zcmV;}0Vn>6P)M00|Ni~>`!`VeZ#eh`fLE8Q){QmQQ=eGY$|NqCtU}^v=1iBd@fS3^8`SJ7r@8ADF ze*C{^(f_{w|JZZ@y#o+HED**2KY#i6{~yEeU;qEJ{Pzp|pOucqNnlF=0*DFdB%s0n ze*I+l{{11(um4^iSXF}z{SS2YKY#!N`GNV*AE2Jys=p_Au>JnK{@0e3zk%WO_xG>A zzkdJw^XDIk{pa6bWqzfjEk^+Y2&CaX+n+VzlIN6JC4s^J?+-}zKcEU=eEj+Q{|`_P zFrfeb|NHmfUxq&n00G3<$-qz^$iN`P!0-!({va{_z!?9)Bm)CLfB^vHpj0t%_B3$- O0000|lVPPN>g8sl5Km-s#EI@faK0YA%?%RKmGG2!N|AD;!zX}Teef|3X z_wWCI{=muCn>GOi5DUcMXP^GBIsf;|&;M~|Oj3M||NsC0d;h_|&!7JP`u*?sum8V( z0aY`}$^xwd2q2IKptK|}gRT_Am!FIf)j$AI2PS_*H2ec11_potVu8EfUYUvEKf`}G z`1lE^`X5*+Sm$r%-@k!200a<=Rv$}~=bu-f|Ns5_|IfewfBrH6Nrpdvs+^pde*a>f6qSrfAZn~Z?Fa+2||AuS*t4lqXH%-ra!^K00G3r z@ax~7e+)2nAoSxWko^y??$?YNza~t8coi7j009Kl08{<<|1U847wF+XP}P60U;n*# z@9*{N{$9Nb{(u|?WHSN*&{SqkP0pSkP;|=6L&63i zfEXEE-vV95@Z%rDuRkCLl>P7efnPxL{(%8d!yj-G00Mvj0{}mHT?%@XEt>!U002ov JPDHLkV1lK4=}rIu literal 0 HcmV?d00001 diff --git a/themes/flags/Papua New Guinea.png b/themes/flags/Papua New Guinea.png new file mode 100644 index 0000000000000000000000000000000000000000..10d6233496c10e52ead975c5a504459fad68ffb8 GIT binary patch literal 593 zcmV-X0Hv=@BjaQ|F{1AU+wpQ{$Kys{`!CTH>0fVKL!SX0Ad1a`1cQJ=-<7ptZmH9SAnX3 z{Q_yQ`~BbL*ME+m|K)!Dcl`DLKS&U$0U&@t8vg$M`{&P}#F!W*N5{%vzvln`{r&f^ z{||ospYrSf)?fc0{rZ3A*Z(w-2B2bq00L=XVPVP4%$zZO`i8aZ($dmav$E#>{B`Z@ zum6{R{h$5&|A}A!9e(}a_zUO_pbY>4IGm#s06-9cg3a4XeYH!D;D>_*`V5R3;NTtr z%*@^Mq=>M$LXVh`5jChqDeaf800L?F_U+sH_3M8E<^KOyQ&ao$p literal 0 HcmV?d00001 diff --git a/themes/flags/Paraguay.png b/themes/flags/Paraguay.png new file mode 100644 index 0000000000000000000000000000000000000000..cb8723c06408828ce68a932ff472daabecc64139 GIT binary patch literal 473 zcmV;~0Ve*5P)@|4`Xj5kLT%`al?B=W5I`&pU%&omV`KRD53KJ$2txq_ zg7fbmh|k3I@68*40Al&@kBy(1nSq%Zss!k?M~{APS@-YvZ#JJG201x|0gQ}qez5@r z5EI0wa6>`h%cteq@9Mue|Ns2{KQdro`19u4 z9*F+^0|+3-w;#WAv9bOIX#?r_2Xj8qX@CF21pWab0}C_Lljko10*H}8@M3d^)Z>@G zf!6*0!vH4#gGo5!|DS*V{{HzdC&9L6!fAj26p=v+03Zy*=I{f8|9_}7o838uP_pBd z=z9{Sra^iHOE|+IC{@|A6@UbB2E)`X3x9D*gjYK@dOyv49j-R|ARv|Nb!om5Pi12buAo@&A8j1_q}8 z|NqCt{Qv#?|DQiV^2?@8009Kn!0`Y7lcx-S{{qo}h;n3b`}Y4|zksS4Wo3aj00a;V z*zEsM)xUqEs|Es~YOn@|-@kzx00M{wh#7&Zfj0j6!|?mhe@uX+0cadR0D+zK=P$&S z1T_5l12i2VfWS`r`v>f&U-&gJf}I2qKwu{UjsNuvF#Z0+ASnqp<}V}$85tQ7(W#^a2}2+PDh3E3#;-`R r2#VqJ=b;e{^dbb<+Crtk03g5s0zF}bJ8sS=00000NkvXXu0mjfKVzU% literal 0 HcmV?d00001 diff --git a/themes/flags/Philippines.png b/themes/flags/Philippines.png new file mode 100644 index 0000000000000000000000000000000000000000..b89e15935d9daf25173f89a36d8111824fda5db5 GIT binary patch literal 538 zcmV+#0_FXQP)N~0_Y@w0Al+04@f;`V3_{@|8#9F=K6XQ9UY*azdwKd1Cc)=8bAo50U&@_7#Kb? zFg*PK|H1$NTnr5Nxw#FRn^&xvtbK0f`#-;cuKxpc)t_H~fDExeq6ZmH0|XFI1NZ;` zGXMXp{AUnj_^>}zDz4B$`$1}#7U0X2MOU=aELU!7sY=Kr&1{QvMCSsj$|2dLpM12Fg)7ytqY zsKMy}yX6c^FZ@4woIyZ63`(G)I*8l(j07*qoM6N<$f~Z~XumAu6 literal 0 HcmV?d00001 diff --git a/themes/flags/Pitcairn.png b/themes/flags/Pitcairn.png new file mode 100644 index 0000000000000000000000000000000000000000..aa9344f575bc92f4c1a5043e6e7d0a8b239daa64 GIT binary patch literal 657 zcmV;C0&e|@P)$VEDzr@CQtS7ytnPF#yj0 z0a0(~eP|Fd7x&oU`XvhO+V>M05dgm54eRCe)!y3s`vCp^_5Az)`uqj_{QRhrlmY-T z0M7pd#W4OILofm6?eh2PFCO>E*7Xbx0@lgN z0st`p&i?}F01o{F1pxvB0QdR->g@pe`}O_>?Enew{R9F2_ajBO3l7@{2K78Gz9u`z z008^~05Jg0{{!Vds4FN77!dx<`5YAi^1B#F4D8&$5I)oT72fOU?&Jm;1k~m5*82ws z?b$fe$;$!&F#yj01PbEP9OVUy$0!>9?*iHF&;9=9{2wXIjNS}D{P+g={1WdM4-6DF z>gCe?_5uI^`T_tk0M7per>)2uHb&;=(#87${QNQl(a`kw{Py}Y1nctu{`UwC>ihis z2n-DS{QU(1_5c9-0*DC|aR2`P{`;Tl?{DV6zkmJy$H?%Xjq&fFKfk|zXRCbma58?r#f z00G1Tv;`<3F2eQa&)+|P|NZ&>@AqGj(m#Ly0)zk56?XydpHmj-@bfY4J_0oTA3y*x rGBBhgMAb?mv3iQ8Nu5A{|6C_|Nk>HFfjc`0biay0|+1% z2B@O{$c+Ek03##gzdwHf0*Hl3)etG5lK=vU1?W~rxN0!OqXDP`Ab?mH`1u+7`u;zA z_W#cxhChG)!_n{G|9=A+zrl>(AX#bYe+w4^1Q6Is4VEzI_51&? zUm!LT$@u9L&^Z7B1a=Zw2xL66B2?87%l|Mi00a<712fnG3~)u5+Wr7F{AKw27w8;- z00L=X`u&GNQW9*;Uxq&*os3{386YGO{rw9;K*az7#P}5)xp2gQ%0-g`0)PMm0MPYZ UsK>Njp#T5?07*qoM6N<$g4HXSwg3PC literal 0 HcmV?d00001 diff --git a/themes/flags/Portugal.png b/themes/flags/Portugal.png new file mode 100644 index 0000000000000000000000000000000000000000..ece79801506ecf8c42397349b4fa2cfe8176b999 GIT binary patch literal 554 zcmV+_0@eMAP)op82)aAGO;3n0AgYI#891D4N?IF|Ns4E{L7&Dm*MXp#y@|U|NLS4 z{rmr)KmTFmmra`h0*Hly38?u0llM=#nEx6H|J4!x{U`A6pVzdvv{Rd?JIrI9L zs`Fos+0`Q4a^C}Q0+k5A1KaQ$>Lf<6lK=vUh2aka(D+|}f9<^YM_B9kC$A?0Z|}3+ z`ptao7t>dSY6f5^0o~2O01!YR8-T_G^}PA>yZ7X8cHUpx=KlJ_{+sC?ST#h$AD{+c zSpNn30U&@_7``$5{_{tYU-I{#-$2g*Lz_YNHw#c5FVJd`!65YaF9ZRd1Q0-s48{x$ s?-&?Px# literal 0 HcmV?d00001 diff --git a/themes/flags/Puerto Rico.png b/themes/flags/Puerto Rico.png new file mode 100644 index 0000000000000000000000000000000000000000..82d9130da452fc294baa03a349ec2e71259a80af GIT binary patch literal 556 zcmV+{0@MA8P)-@1KAF z|M~a-&+mVKfs8*8^zZj?AObQ@tXl^VK#U9w|7)um9zFT5!1JoGnu}M2{r|uJ|AC@F z;y(;9F@d=M{=L6-3m|})KsNsS&&$bh^PO0375Ag3EPt6;7?_!X=sz3*^#j#0Gyh{@ z0SF+Vlm3Z`F-Ar(?BDbM+y#c5od5B%>y$nn=KcNZ|L>nr$AC#T8JS}%RsaMLPy>UR z34^BAe{Qb-hmSD)`~82~jewZHH;sOtVgB{~2T_Lx z^M7~ue_6TzObGu%0nl7VM#g8?t^ouP$PYjMFazDG!uzbThlgL98zlelKgeJZ;~z*Z zSPxJG!?$k$0R+;(`ulr= z-`~G~{{ZRVfB*dX11A6d`CYbrEkFRVK#Yg0UeQ$d`q2ZhA|Uz&)bIy{egR1#X&Imb zfB<4bR{ihazwp{dkXn!mkfPsU#_wMs1hfID1|Wb~;Esc6TU=EJGWFLlunkbN!Q9_} zL0)432p}e)sSwo=4bd$f5a~a^fBpd(3|0LbOac`E1P}{Q!+)sq|NsB}pI=e{a>g%& z)4?|U{s;0mNCQ9sG5v!Z57O~Jp}QY!5N0Be0)lgG%);U`26kn-@hOg zU%!6+4+cOs(0HIde9xZz`}Onxub&LUB0x(30+2WcIRJn#2ut|?gWYu1Cf+!-K%B8# zdf?1WA}#uZ8oj7u>$I1i0Al&`=O0k%-@icgAIJnM0xA6maSq6BK-ECw|NZ*S`0Lj% z1_pot6puj;05Ax`F!=umqj7^frO?t|3^&I1kxUq9yECc+jQpY84SWH_0#pxl$?v~F z@*hy-KN0|X07U)z`4{NpU%#2aHUI<=%a31wK(7Du52Oc(|3O^?R1IN+RRjI-n*kVB z3=9AP#PZ|EACPLGJ%9cJNh|>9B%spYzZw7h1%?tp0I_@ndg9MNE>313@6R75NcceF zkr51-#U+7;F#`Sf7i0rK0I_`g_NQ&Zji7_t0d_@@ozArL?Su`s;*Q{AKpRQ~TD44PX+*q00taD0I@Lq1k(S2nt`tR{g)9*1H=ZfhCe_Je;NM%1^NLXfPkU&2dGq1gcanC zzsyWb(hLmW7#V^70~+_6f#nZ_(jSmgFakOWAb=Pd7`8Gn`~pjZT=;x%FbfOAzdzu3 l1(F{a{)I#17yX|NRSO0LlM<{-BURBqYRGSojej zfLOL~|EH_V_~;P>Nc10*D0|Jxss< zFi1)Q<$$6LU}rIc*dU*QNFV}+9T))>0|XG`SD?F)5CbX~O$rDA0t^5@iDe$xIAIn5 O0000N_~0!B1ZtR02zJmAl3i>|Nr}+@!x-t zvcLa8?7#n*fB$3p|L;$z$Rx)9zm`4EX`B2HAb?mPX21FhQ~^@@2dMNf!=L~E|NQ+A zWdHd6KUK1c=hsc9f8Rnyezh^=0R#{e(Ek5GMIci_s{j0D`2GL?@4p}ozrlKzzsUIh zhw0@n(cNzYfer%*AeP_1{{8vS`0Fp&84w#lmi+$#)ARI~X!Y&+KyeWsW`<9n00M~d z^G^m==F0#79{mS71ZX;t`~_q%fY`tPf!Mzw;*3o4FJA8j2p|?NkT1UdXZrG=;TOYy zh@M|qNhT&CJ~jq`0Ac}pl#vl6#K7 zFA)9u_3syi0VMzY2QmHtx&Qtu@&7&0&HxaAAvs6^7=(cU7?W7&6Z-$piRe`dyDK`^ zN$WO$zWL=wEu!PO?Vu9@iVSM&8cWvf2p~p=WCn&G3_$lI&>tl77dYY}Tp)vm0U*Et X__=7oxWDB`00000NkvXXu0mjfV`BRN literal 0 HcmV?d00001 diff --git a/themes/flags/Saint Helena, Ascension and Tristan da Cunha.png b/themes/flags/Saint Helena, Ascension and Tristan da Cunha.png new file mode 100644 index 0000000000000000000000000000000000000000..4b1d2a29107be96413eb86e64a75ac7a3ba5793d GIT binary patch literal 645 zcmYL{Z%9*77>Cd9?woAXO+#E-F%m^1b0Xy*Qky9{B^@hJqB6}jOKKPc70u1CS|Ug( z7>SA^1`5-}4+VvY=3G*k2%(8O!OWTIn!4?td(P>GANugV4?p-l@2B^fCONIbD;IAODX_{rV|BCn_NC>%qlWoHrzH=l|0Y^Rhgkwr%>N3 z(d)FjlCqjgyY4&yRH!;rb)|Z-v~HjxIkvar`*JLyzxBc-B?Ix`3*qGz4q3JAd`#LY+Xw^k(ph!n`d2H7`aI`Eh(LrOLs%9g zj93;8ws%s88WHkIqXqnSf?YSjh=@dF-}4L7dS0HFB@iNj8OY*&4>%Dn8t&*i)aXz6 zSX_wQ?~e=9UcwhrAtAf8XLVoTbE5+<^|-KK=D&>)yX6u!zrPCrbEr|4Yi(XyIGTQI zFEDsraAY{)DhUd*DN;Q?!uSxvkoT|31dF#>2L0DGeRcNZNehm>xm~}-9q?gtV@Qz` zv-lB19|m}3LHcg92}TUOb+%v(0bnUhB(5rQI9?ZY)h~Hw=%2Au&~WB@t;^kVE@F0Y z%=8f1ZN}R1MniiNxkJ!a;3!XFerfimE2A;1XJChGXJ=)MAVRubE8WFo1T(1Cmhdfa ztzC{Qms6asjkstFkFp5L#maeek84Y+NtW^Wf=SRytjpC1=BCX4NH^VxnQ`+YXocAv zR?lKskkKZN7D>{S3>4;4+gPYYq0_5iq@jsB^}M0yMT0|p`lM;R_dwbVrBg^4RRbsq Y$WB%-43-yHbAJTXS^1gPjGK@C0`m$%7XSbN literal 0 HcmV?d00001 diff --git a/themes/flags/Saint Kitts and Nevis.png b/themes/flags/Saint Kitts and Nevis.png new file mode 100644 index 0000000000000000000000000000000000000000..febd5b486f3f90056637b23caa26d838fbadd7d0 GIT binary patch literal 604 zcmV-i0;BzjP)h(K@ANy8uaQvQ^_nWcs z*Z-GL)eL_?t_B7*Kmf7KbznHW;LqhtK<$TZ9ej=*TGLweOZn#S|EVB#AOzI#2dDw) z)4xDJ00a;t5ND<*{rU5ogY7p9)8EGU->gS|Gwk>cG!LX2Y%nmu8NlfEl`8-N#0ZOI q248)K1w0H4M?n#d6+r+%fB^s&Q!OA|2rzyC0000#-NSZgwz{Qh@GSmETWyIzrrS!pkkqDDw`CEYY|A1Dxfxke?UP9EWUlaZ{K@! zXYTRdfWyFioqIm+xW_M=V(hYvbO?~5ZHkEt37xh?rY1@PqM%`P+i2w@_wXJJO#nzA zheNt~+w1B3H|fqGMx=x!lms6SMy;uqQ4R``NH&49%B_cditsDHI6DHXLNubec}E0~ zb8dy|txA`rTkZMN{rCM3FV`MqlfuwZrz$X1)+?ntF|UvTkD3M?FxSaem74ag}Vzy5sA+`s~GjvDl6>(E?=UGu{=w?r5#MJIwhn?GrT#s zeRSo}v&#TUmcjL&mxEF>2%EIxN+SI=O=izlM$T5JH;yv-C%^zTfK|9CLa`qJ0000< KMNUMnLSTZ|5$YcR literal 0 HcmV?d00001 diff --git a/themes/flags/Saint Pierre and Miquelon.png b/themes/flags/Saint Pierre and Miquelon.png new file mode 100644 index 0000000000000000000000000000000000000000..ba91d2c7a0de26e554979f6351d42a1a4e22de3b GIT binary patch literal 689 zcmV;i0#5yjP)#D@XkmAv!xDMMW8-mEZ&mK%|%B2@pa*J{pUD?(_ahBqlG}*TVt; zF#yj00{;H~{{a8``T70x^5Ww5-{JLFN2dS#-{Io#@$TjE?&8zZ_V@JO>E`A8`2YX_ z`~rx{;oS`3$G61pUY_{!-0$E2{{CbX;QPSJ^3BEStfg-V`n;-q6+;t+Xyw zOy)sS^8$#8OF-b~@87@v{bTs||L?z_Zq~=&zGIaZd&b4_{m<{;|Ns5^`sL5xKflEU zUjXHSP67x3F#yj01nBVe84eEr00I90|NZ{}FelkBB-0BC^O2xB85HWz)f)HsDi#s! zMLEolpK<^Iq5=Rh0M7pb=>Px;h=2d#;^FNBZtPGJ5bKP1n*{>+?(qio_5k|){tF25 z`1Sjqtv%A&PR-7P0st`p&i?}b008M5=kFQg|M&R&{r=?U4x6PnhWa{`B$w z?CApk{rU?E^8f<&008;|hy@rKe}6M^a>=kt2+9et{QJXr>zQ5ua`W#$8JQS={rbi5 z^Ctr{)6XBj7@3%V17i>%fEb@MFnj<<;{gVSbOv{z8Q{qN1r~!u@ISB;HgNQF0R$KT X>6#2<48ze<00000NkvXXu0mjf$fQr4 literal 0 HcmV?d00001 diff --git a/themes/flags/Saint Vincent and the Grenadines.png b/themes/flags/Saint Vincent and the Grenadines.png new file mode 100644 index 0000000000000000000000000000000000000000..8fa17b0612bd318a649571fbc4f68e4512c65c5b GIT binary patch literal 577 zcmV-H0>1r;P))4B5XW#s0WPsWLbObPT z00IbN14#96puqp%TKvBf)PA*{`~CO-uM~~n%6z|m{re4Z55!3T0R+GV5`UO(`=kK4te?c|?1P~}#f$jmC10=!0@{8gBFK@Zu z-~WJALqveC|MTzfA7GIDVE_mqkOrW8BqZ2?K4D^#WMJTBVE7%b47BbKBg1c?EHl#| zW&XdQF#ikE01!Zo3=CVrargu%_x5NZPzVyc@Ms2-@>E69JA<-5ee*C|6>(%ey48MQ<`3*E1sOaY}WDP*a00a=wNxxYB{9yb2 zOU?HFZD2h;3gJl2w`NO~f5I`Ue%-|qnfGfh(_6MlpFT>xzKtBKk z5J&^l?>`KZl3-*0GW-GQWCR<@03m_s?_UT4Dh3E3#;>Rm$$$~H$WlN65MTgr(_Ikn S3@&c~0000PEol7!5I{@}e;EG$`~Mq){{FvoV+so& z6Zek;JYV*``O13q$!wq?2!V|I&+z9TKmf4-@!$W9Km&lr1Ie!(IeUNcyZo#F`{&0p z?&{CqnEw9%50U)~((nf$fIu4l{AK07*qoM6N<$g2hARp#T5? literal 0 HcmV?d00001 diff --git a/themes/flags/Sao Tome and Principe.png b/themes/flags/Sao Tome and Principe.png new file mode 100644 index 0000000000000000000000000000000000000000..2978557b19d7d4283aa9a00ca78dcdd2580edc7a GIT binary patch literal 584 zcmV-O0=NB%P)=x{`~^7feaw| z@9%GBrr%pd7ytr@3Fu&;D>$G0;d%9&ckUlP_FsJLznOpkI<);49~%fU|NOOg<1c>p zU%YI;<@gu?0tjRS1JJ?0e*b^_hvDg;|Nnpg`SWY#%HJzjff!!CzZWj}wP?w&U%!5b zMg95nhXEjfKpOu4{R2W=zZm2}8km@V1qJfIu3a z^ZvQT`ny}__wU`%Fad@Sg!~P3A(#OSI%WR9r+OFw0*K`e1H&7RKZ`vj#ee<&!}=E_ z2M*0Ye}N7Llfc;c2aF@2)L(`#3;+SdxR!w-xR`4!1u&@QJ10&`rk^HbMk8Ee|uIe&H zS+;4$DbWCt7$DsBz5oJg0IGiW@flDZ69W^F_wDDmUw?kFvatRB^XvPsAO9KtfBpI8 z%a6}8Lb5=`00G1TbjJVx|9}4ZVWnuJEUfzZ$EVZx<$*voWzTGcp~$d(=+V{_?X+ z3y#kPS_RYq5I`UeU<=TsD9Bk~@o?qi&=DPd(?v86a{(`&&3I*E&g8|Wo?Sn;v*0j086Wc~d66UYT>006{xSen|M~Ox&!2yPfTn)={d@hr-#`EU4p90fz>J~+=oo+i0%`d3@9*!wzk#ZO z2WQUEDXOGe*gO;$t?-?1~^z5 zels!xNuY7SApXOk^arFAjDSu82p~p=WCoxfknArIdOZOgR-T)##NTdjqb^wzQ(`1@?t)Ix4MUXz556teM9A7Ic zq_@itH|pv>q+zrjZJ^Hx5bj=fD{5McI3ol<@^-l_@~tZGV7p>1CU&qG~{YccyC-q z$8~P)6sG{nMmQy85K$E6L33rja$x-b9$ literal 0 HcmV?d00001 diff --git a/themes/flags/Seychelles.png b/themes/flags/Seychelles.png new file mode 100644 index 0000000000000000000000000000000000000000..39ee37184e09c39dd05425db127288def220abb7 GIT binary patch literal 608 zcmV-m0-ybfP)|s1eh2YzMVW-Z(;)C{QJl7?-Rp6DTaSP8U8UK5I_L2Ffe?nu66~hU^Xzg zV`^IR|NmbGhChsd{xGln!xZ`Z|DQkqe?!SHn>GOi5KsdU{eSZ0I}_6%bMu4$|G#2j z_zP0e_xu0e-~WI8{{Q>e|6jj=B8;-KKpOx8hy`TyKZd`5nT(9?%F2RO|M~TQ@}K{E zz)C@?e?v4d{QeEp01!YxcLP=bXJGj0<#nFn|DXSVfvSK1-v%}nhwkOu|GvKejg0<-0ptJwK&1cy1oE`H<`Z?5M+~$7{9gq& zn~(3mv&(;P@Bi|05T(EW{(k!9>4UEid{_Ab1OPDr&i@1e0Q5gX)c>UW0I2)_6d3&w~i*%}NQ0G05Jg0{{#gAwk6j%|K36Wcrx-Z zDBuV5-R-~I;@8;l*yr}=_xShx{`~y_{Td7!{r>#`1^@zxvDKIVAJ?B1c2ZXvZZlkB uU;qZ}2Vg*eW0eWa_yywvNgf7(00RJ0?>)A@UfIF`0000@n0006p>>h67sJD!pI8@uK6+#GPW%ce@CEFZM znTD)%K!F4J_qpc@AQp(ZPk%rA2T{TB=kLG2fBygZ4O9eD_xsnsUl6u5yEM=SfB<5# z6|+@gR}o|u1R4pn+XF1YrQf2oylS zAbS3(sBkhcTmc9mV6grHN=r(zLW3F{=D&YK84x>x_WT70A}|U80*H};VI?9O(a}F7 e1_Utx1Q-B;QgQb4eH!Wj0000dtOYis{Le*Dj#JuDs`KNc)tl9OYUmifJZ zA4uJ=-~WIA`uFP>kj*SB3$z3vfIu4l|NYA>FaP8D^M5;ba1<8<4f|GC2UPm+H&ER# zkRGsxe?Y{*01!YRC;dKnkj2`X)zkCW_8s5b+Wvn23^5y|0jv~A0#!5q{{4%A0U&@_ zfL8pya^=_l{r?#l8F+XY{;)G~as30ko(ZTFY%s&0Ka9WsFiJ`S6$1niy`;Hnv5 zfRT}r0R;fL{~@sn5I`&p|Ni}W_wFAQ`~gBVzyJ~jk&qMs5MThRyiZo6SsHx+0000< KMNUMnLSTY6dB!#X literal 0 HcmV?d00001 diff --git a/themes/flags/Slovakia.png b/themes/flags/Slovakia.png new file mode 100644 index 0000000000000000000000000000000000000000..7ccbc8274ad8f76f28960b83f2bba2a619029d87 GIT binary patch literal 562 zcmV-20?qx2P)2F*|Nr~{=Pyu%qcHbB24G}l{PX7zKmY(S0M7peLS*D^UKK~y z+6(XH|9gD^r>6bY*OZ>+`2GX^{Qmv@{`~#_{QUm>{r(dW1b1xK0st`p&i@3&%J4-( z6Giy=|7vRh4-WrbUHx`??d0*<@CX3>{QLa=`~Cm?`~Ld;{u~zu0R89!i0SVi2B1U! z{r&fU#+3gbKmA|6l!@v8=U+^J{{8>`mjUR&KfnL~{sUtC1qTg400I5L26X!4i0my} zo;{uZo#CfPX{7DT1DwDAf(-fnkMZ|^ra%9I0mS$d6bftr0mQhUfkCOfiE zM%HqlKU{maemr>kAILSo!3gZ8-+$N@WcKe}3J^dnRtyZx@9+FOdynDWy$P0%j62V; zZC)?>`}hA}zy1SB2;m9@#;PEzrU@Gx(rNA|FHo^Mn<3|00G3vEO>ZAhtlWIf1*N!=PZ8p<;&lH z{~7-L`S<7dzu$lU0~x=8==VP$LqeQ==EOq)0mSn6{g=m2e$<)X`O9Zpu5&$Np~P9Kn=gZ0kf<1I-4a zUtk1c`~{K>fBu3(0U&^Y8d(1RW7^4V^6LZG89>!QBmXe{`pfY9FT=0Dj8O6)!|#7g zK*az7#L~(T&^E24DBZ$$%)DV9SRUYEY{Wn z85tspN%!Z^Q&_X+!-^Gee*b1;`1hkUW~HJ2(d(c7|`w2)m##KhU^#s+`19}IpFa%0{xSUi1L7diFBr+f01$veIX40Tgn<}np4MoMn3N`o$god9 zrkzn;+j{#q5F}xeh49xZuI$05IKi0v3Lq917Le*!UxBJYN`Vr8|1$jj50VD5fvSOw z-(ZF~46zx($8#~-kUKOh9u19TNY0I~dG z`1hBA5y<}g_y4cI3}({*g*gAq^Z#dL_#dnH|JmpNJMaAe2etv|3x;0|00G4G>kr86 zzYquf`+xk=e@^EAQat}9xc>97{@;He<|?3qzo3u+2q2a}APrzwf*tnl_y6c6m z5?7266~G|=0}2mdsDK;{bP_-SF*1~XW%vY(NDyK`u#uw~6h{mUJPZH<1^~BhcCfuwe;F7c=r;qyPX>nX3=Cfx7(O#Fd}LsF&%p4OfdL?Z7#j~W z{9>KL@b8bfkaUokt?1q(EJu$q{Qdp^&mV?AfBydlG2rBvO`8A$h{fmzgIW0J+B07s zK74uV#pQB`MAdI!SdN|k|KJ`--LK#OfB*Xb>lcvCC@cGqfdL=@05Jg0{{a910Lj6A zAt&mC*9zzO1pWQ@b1`Tn1`iV6=KuBe|Nj2}{{8>`{{Q~|0SOB6tE&PCq@k>=Oh@B| zgDu0v2b@p;u)h2C^Y4EK4rY$O|Ni{`3qc?^$?%A8m^2X}fLMSU{`~p7aqHLD@0rW| zzIWc|c>Ry-$DePXKfn0(_xG>AzksTL{re5n#{Tyw!wUw000L?F`}dEV6O*(3zu6Di z9{gne@#pKG|NpqSh1vf81DXBz&mW+Me}8zmL>PD&00Ic4!QY)xLzl7RCikV!EWdtz zoorLj&BXoYF88-DfB*gk`{Eza7yo#;S!C4G00M|*elvr*8B6X-zBgb0FtGkEHc8mM zoOScs_b*;Q0~!ksq<=swfJjA!^Ww!_00G4E&x@hvA~zQkvxU59n3VsHd7Nj?ec|R~ zkmuqAx#JHo0{#K*`TG}00$uYDAb=PdGJ(Ek5Vx?d6PS=4{E7kSFNS|$^b5xL14ayB ck_{lh0N_F{UmK66LjV8(07*qoM6N<$f>aVd=Kufz literal 0 HcmV?d00001 diff --git a/themes/flags/South Georgia and the South Sandwich Islands.png b/themes/flags/South Georgia and the South Sandwich Islands.png new file mode 100644 index 0000000000000000000000000000000000000000..7ef0bf598d9aa7c12264551d5db06f44307911d1 GIT binary patch literal 630 zcmV-+0*U>JP)J`S$qz^!f=A3G?{>83*rF;63vB|NHv-`~3j>`uzF%_#GV;x3_Tu z05Jg0{{&$2KZ#9J4f5RdzRdzC6Ae5p=(o+T{uB7y^ZNSwN=h$cVmJ#62-nx+ob%l!TKAE1V~I16T$|E1+i#l`u&y!03t z7ytqQF#yj01Tv_Ick58z;rzG}_y7F-%)*RRAv1X@1^f8;`}+eA4+yBm#PKA>w6y_L zQ&a!|00ICp0M7peY0>I$KneW(?7rp&{QCm?`vUdU)NRiG`uYI-`}gbY@;Dai8vP{| z4h7uY=>Px#0*Hx$0pxvffc*LW3+PFp{}_J#0ty11^n2!vLjod>mX_Jy|Cz2{eHy3% zAb?mH7=HZ$2N_TWSP@V&gaITO7A`uvc=2f<_uIFxDk_pd4FCZI)bI_+mz3lOl7E0f z{^u`PGlT&Y`3GeD{rm6lUtS;y)Bq4bz=+dkVE6#Ehk@Y-82x6z3jhKP0OI&0DF;s+ Q-T(jq07*qoM6N<$f)`^cRsaA1 literal 0 HcmV?d00001 diff --git a/themes/flags/Spain.png b/themes/flags/Spain.png new file mode 100644 index 0000000000000000000000000000000000000000..c2de2d7111e3cb59cf6511dd2ab045e824bdb43e GIT binary patch literal 469 zcmV;`0V@89P)@|4`Xj5kLT%`al?B=W5I`&pe;NKW0^Ri&h`xRJ_x;0v zUa?=y?0^3M|NZ~}FE9c#{{3cP{Qd6}13&;Vf!z&M{pZWqKYu4MFm$tgedF}w=P#IQ z7-9gT-$11R0mKA$(qEu4%ok$*y!^wMRm*x;`R7|k6yu?K{s8?55I{^|9{?Tjhec2I zv+6&FhFWG_BbNVc|Ns94tNRJp!0`V!Py;{!F#$2enB#XZaohg-5%Tlk#oa&nzQW9g zl0Y{D4gK?n0U&@Fe=;yIr=|V7caH%YEYL84k`Tt9-wc2LGODP&y?7BIfLMT@X8Qey zK~fSFpuiXa$^kcmd~05Jg0{{#R40Cvt10RRAw z`u+d`{`)-+^5ON`yb$y0|Ni^@{rvm=`~3g>{0I^G8ZGb(2;2e)q~Yi9|KETAVEFqN zi2na)xwe&yo%hS1uZ%yx{Q;WF%<}W+mp@!0-yWP|m)B$h2q2(_|NnsK|6hiGKudoE zUGn9{-`6*oEmQ72y~rUb^YQPmzn@?Idwh=T>wA{p3V#3shzY3p@87?_|NZ&@_cy~| zpmRZP`1kJ@JI^@8AFa{s9OeCZO+ts{j1?4b<=-Nd5zA z`2GL?FD{9%H@9*#{QvEce@o8hC9n7wpg7QIfB<3vS^!iHvfyK-U8V5ZH#le}4S|yXQB^Nt}W|`Q?5-JjKDn&hY;a$Df~n9-WqyG5z}b zHWMS`AAkU20!9tv|KD6JO#c`e|FbePFfi-*z4`Hxjg_16|9{rM|5*PsvHt$a@%k1I zzvO#v;hz8j#Q5o)BT__yf)$AVfxHBa6HpujodJ?%_y>%AV59*A7yy`5b5c`Z!JhyC N002ovPDHLkV1l?nIh6na literal 0 HcmV?d00001 diff --git a/themes/flags/Sudan.png b/themes/flags/Sudan.png new file mode 100644 index 0000000000000000000000000000000000000000..eaab69eb78776f8593b41c8fdc3fd65a86119a0a GIT binary patch literal 492 zcmV`tbb&P~tyW8d(D~GxMiUp8x`gh2bB=pZ|ZjUUI!&{yK1G;4d%$ zIuA;MS%3cg{`2Rrii*m`ix&X`h=t(`1IH^)u0vdsLXv;@{sQG7;18Jf2Mqqg05F6A i0*HaZmVqPy5MTgGElxU<64PS<0000kWKq{Jk|L6Yw|Nrm*vcLXk{sL#*k)f0!)jRF?KX6FHLLC_7zyJOQ#RJf}AnqSv4E_E0 z_d>^cfB<4-C}v>z1dGUDNRj#r9OZBkNc8hC00bBS^Nnc?6(4BA00000NkvXXu0mjf DMO=a{vExMP2%`MCSoB^FIcLe_%lf;|~%E5I`(IQNh}3Ao>6Q|DFUXMn*>AqQd`w z|1kXd^B;tM|Njjl{{hM0zwd6?1Q0+hV1xeud-4=Wy?p-%sO`^#2S61Jzk!N?s)6X& zzhA%p|N6}=D+{y%Ab`Lc{sL9~1=0UN4*CD*7s%9KAf+JHKs~=eB-8KTKvw|-5R1&; zzd&a|ob(5%^Z$Q=wHy9p13+aOpFRNu5F>N&`Tk_-7w>=n{RejQzkfh&Kn{rf10?_b z{tFTZibx5v&dxav5I~H7|Ney-|DWN1$%1FyagzUW0464;_wU~W1Q5$TW@eGxtUvee z3vAf*8|igK9~@*rr66bh|NrkNM8z+V zAV?>O@ek;bKfu6d00 z|Nj36M1Mf!|33`>e*gaqWCO|HKwFtO#a&sZ0t5gt0M7pel4t!zdFAutyc%F2ByLSib7d z-@iY8{9s{WsjaVha_-{UlG^LGvEO)A^**!$6$1ni3ljqaFhGRYPy6$qf&JG{kKey{ z|N8ae_ixs}{}``bdDhkT?#VOp#VvoBm>H#|fo1~)5aY*A1~#Xrf1jTKgW~`H-wePI z{Ri~aZw6pM{r$!84-_k)u=@Ltg1)Cf2{xiF#iKZ95W~`fDE7~ z|1pDN1{?_>vH!pR*Zxoe2p~qo;+=0k{eVOy5dHe~@Bg1a48OqWACLsaJOfY!7)!uZ dz{3I%U;rfUVNTmRI(Yy9002ovPDHLkV1m_xKPvzL literal 0 HcmV?d00001 diff --git a/themes/flags/Sweden.png b/themes/flags/Sweden.png new file mode 100644 index 0000000000000000000000000000000000000000..1994653dac1fc1c6ee3c9fcb35c8af97f16eefc7 GIT binary patch literal 542 zcmV+(0^$9MP)a|fPuet^$h(7pHv_{jfB<3vn*8q{15ov!pR5qo|Ns4BVf^v!57RHO zo?l?}`yWs<(7C?=0*LYNK?X*pGKOD3v;Q#s|MUOfZxH$qCjb2cBQWFtZ$@_cPkRpn z1P}|u9|n-AAQdnT|9?TXAyk7H4FCQBl>h_~&`AvcLF)bhMS(&{8jwh^2qVzve;5D) zh>=0RIIAq+{+o}$pxEl(3%2T)`P!1-fBt~{@Pp~sA7J?W`}60ovKZgl)=2;X#KQ37 z&mWM7{{H^+4`$e}UqIEMAo>Rk|KALM|1kdh!vsX^3=B^I0*D0|DL|!?{M^6*VPKPH z00z{*-?BnHps)wJ`QKllIe-8D1EGJQNCgNWMh3}bctpOPvlbWzK!=K^+cJPc;};D5 g19O2S13-WQ0NlBGh$rR(5C8xG07*qoM6N<$f_QiWUjP6A literal 0 HcmV?d00001 diff --git a/themes/flags/Switzerland.png b/themes/flags/Switzerland.png new file mode 100644 index 0000000000000000000000000000000000000000..242ec01aaf5ad351cb978a4eb650ad801a438b09 GIT binary patch literal 367 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1SHkYJtzcHEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+AuIMGJ3i=hE&{2`g6X4;eWtQ0TuxV z9fi13(+NNRzn525R_^%t+x&39d{6y9ga1E2r+>?7U|?FE@Zm|i>fBlzF zc~M_qKf%h=bAcoS;}NE7f8|yFe%B9?;;8%o@BeG_!|(4qhyo=(h-XBmKHXpc{~y!A z`THH3fsDVeudko)ARzm9UL&JI!+~uEM*rBES1=kd6zV%LH0J*N$gIQAc0y}k9qTFv z4h1oVG?rB#zNY^8{QUp5wE>>R#S4NZQd1i@F)*?OF@6y}@zmk^!Gr7L9asuAf!ae1 z{{CbBBH@|4`Xj5kLT%`al?B=W5I`)SK7Qoo3V-qKd5l^# zgv$taFhBq?zJ2?apPwJU>mjm?jEr~g+yMw6Mj$IKE$!aDd%wZp7Z^YoAQH^_^XK=U zKYvwJR4!h;2oOM^VEz63kEEm|Pzoptl!JgjVAdZn_zMF-#Q*_BG6D!N0MDLEDh$KY Qwg3PC07*qoM6N<$f<~s!0-E7R}a|Ns2?4|9|}gs%Dgx1=;`*KrBFO{{8#+``2Fv2B6@-@8AFY{`(K80jdYk13&(5Af|u+{y|g&!S9Ft%(8imf-XR*|Ns8{XO&`< ztN44b9;zJZ^?&~W0*LYB$B#TbJpUo){|D*(`>^x>w|gKB?9z<#wQ%E^n3(S0zYh>V zEO6uD3`W^f29Wmu3`mZF`w$?27#UO<(rVJ~y}I}N&+p%VfB*XP3y6U1Uw^?QNbuL6 zzrX+d{i`Cbal7Zfib@b53s27mx! mU=U|u;Adc9XCM*)1Q-C-v^a{iiydVE0000NH4;SYnOGgJvc0I@K9VW@Vk1}Xmk4~YK$|NH0P z-@pI<0D+Rop8&DnA}oIvEc_iD{O9-Y-=|4+U?1uFgf@9*z_zyJRJ z%fS3QR^zuR^Y0tyerNXndi(YlP_?gzto2+5fB<3vIsj-gQ0X6_*?&Q*d^>boB3^zoi8Kq^tbl{qlR!{9jwQ|Nij< z=(=A?F~8j-MSe1{Hl8Yc@zaXo%Ljk}VgUvb(2HJbe?0kqy?_3vsPXrUmq2rWE6M!I zE@4*I;Mw}vw&7&iFGdC>zW)rr{s9CK3xfnhrsi*1wqMhx{@J=6sPgxpU%z6)f4fBr zzxpd#a3tyYE8}0lKnA+|-+zWbe*glA<)R0}-=}{Pnt#7~1q_Mb;=;f3i~oshNgsS> zIr~z~(_bRL|NZ|1LO_>;A_pLVSoBpHQd9nLa7ao@{lMMx#__lBLe9Cjx?EiU z71{s)`Oon8FXP|;z>s7BItd_v7-5mj(Adb}701wVj$!S*>kNN{fN~5FV@|4`Xj5kLTn#2^O%5QJf({+!S7KyMr1NSdb0?wsyYS6cNVdko7wub89?$EL;)x)00Ic8;m6; z*ldXL$Yz5{poPB}7`^}m5DPc2nu@9r4=+1782$pC1a=$HjDKJ@i17#P6G=(#Q>V-T z0*LYF&!5c9%>VxV!xcCX0F(uW(%ZLh0Ro8SA3Hl!NeKhQjeq|#{05SL7=Ql;MhF4{ ujRQ&nZP~jQAb=RZqDCa1IEDa#00RK>mSUL#9?hx%0000W z@b~ZkKS1)&|37~i{`~p>`}cn&^2?@800G1T)Nta$zvt>t<757@uK4@^{4bCmpb7~3 z1tfp{|Md&VW|Wov$G`v(Kp+kO{{26+>+jbuf7A2+upj>Wf7$Q%RxoV1$N0e}Fas1Q1BW)@@rKJa|xATBWA`D>(WW1JFHv zzy7cP0k+{MTm!^O009K@!>LoJmn~avX#S_9;5YZ-KmTX``u`YaHjD&?*dJiPF#rS* zNW;&cKP?=87yABYZ~OCq-%n(9P{tpi22h9t6$1niNQ1e-pD1xDrvBdy@BT2zfI@>2 zY$OAO1fsuxAqeOsfB<52Wnfst00RHO2+qJn5C9Nh04p0wT74^6IRF3v07*qoM6N<$ Ef~oTCkN^Mx literal 0 HcmV?d00001 diff --git a/themes/flags/Togo.png b/themes/flags/Togo.png new file mode 100644 index 0000000000000000000000000000000000000000..3aa00ad4dface0a9c23744ab451cec0443f187bf GIT binary patch literal 562 zcmV-20?qx2P)@|6mN}b_RwI3=Dr@=ogG+VE_mq7La^(HIVqv%*^=nCj$%1|9}7Uoj(8m`RC6+ zAo~61@1NiQe*Xrt|Nh=Ea}z)Sfi-Y&{FjhmFg0aZxaj}$=L~=U)(L)O`TP6-zu*7= z1Ib@N^zYwqCU)6YF9v`BVgi}{>lcH)J%gU!|J)p)>i@rg^Kt&>WCWsLoQyxgk29dnvBpN5vQb0*LYVQ3gi&tp7jnGyMMp z@*mKbe}4Uk_!#8f-w;8De}5R+mEP<>2M|CkH{LKvi2wQh{WmZi827ytqc0C8?ZF&p#S!~g&Q07*qoM6N<$g49|K A6951J literal 0 HcmV?d00001 diff --git a/themes/flags/Tokelau.png b/themes/flags/Tokelau.png new file mode 100644 index 0000000000000000000000000000000000000000..67b8c8cb5191080a1cf33125cfd05efe0b9a76e0 GIT binary patch literal 638 zcmV-^0)hRBP)+lNu{Qmp=|FW6D0*D1<1Ovm9m%kYQ|7p*Yo3ikU z7~kiESLFZv{{Q#iA0zqwf4<*Xu-*CD8$MYncA&8U0mQ`ckKy0n|9}7f|MB&2MbDkQ z1j{KKBL!IA2(Z7F;(zkuBe#mo9TT;SzkoLU{s(jwKmai@{QdX$=kGt?etVi7(p9*e z(|o73K&5wiaQBkXEB9so{`tH8jIplb^d$ZPi5h|uLD4*o5RnOS|{Qd{@Cr~j!0D)}y0}8T#$FHit{lE#dc*g~k_utsL zxj&Wpto`+k?f2h5mv;mM4gK>M6!-uE1hnA~P_?8O+wWh(`!4wX{Cn2j=z=is`~Uxb zzx=@K_DcEUJ7IZAUZAu8{sn~+Kmai^Fsw$4O9qB73=GeJhA}V*Ffg!yW&gnt6F`6g Y0QOrYft$MNbN~PV07*qoM6N<$f;FEdh6SO{nUiXv3iAlW}aH!uJM5J&?vILH{_iZHeP0c!XQ3PuJ7 zfB*t%VEX-sK~fTI%wL8-Af1e0BN-qh5dHlNK|sX-0mS$fH6j^sMDRaYQUC}r0RA0L U-~OCsp8x;=07*qoM6N<$f)6&Rz5oCK literal 0 HcmV?d00001 diff --git a/themes/flags/Trinidad and Tobago.png b/themes/flags/Trinidad and Tobago.png new file mode 100644 index 0000000000000000000000000000000000000000..2a11c1e20ac7f5a4761049adf5e326654b94069b GIT binary patch literal 617 zcmV-v0+#)WP)$7pYF;Nfxh(xqFs zZUMDjzjMbfEbRY>5C0Dx`v3aP|JSeozj_5kj66I)?%V+g05Jg0{{w&k0RJ5w0P^!X zSy|WJ-R9=z(aMV97z{4myy=pj4$^bx3|zy{hYtY)h`Ao9!QA5iyLbPuTmkB_PfP?Vee~$j z!-o&gUAyj)n+wu&>J&%=KmU)%j{yP*q=CWA45Z=rFNTYkfO?!$Q_o+&{s0WlT)E;? zRQUhj|NkdWF!J+%fBF<4fS7B68jOwqzkLe|6QI@S&;S4b-#s()-1Y1C!Qjl5tA6F> zpisYc>&x@!00G2Y!@$5~Xb92(47=Z8{{bD%z~Ggi4>bPny?b}>+&OjWQc!g@0~6Et z-Maw-h`Ac5K~JB7o9jOp7XvpB0}lu>-nqlT$mpA&|LpDCZ{NOs`t<42?c44-IbZwx z0Rjj;B7x{N1H(%OhUW|nPgz+XA3Vr_1a9x%4G>@ep<^{rq?UTJ00000NkvXXu0mjf Doa;3l literal 0 HcmV?d00001 diff --git a/themes/flags/Tunisia.png b/themes/flags/Tunisia.png new file mode 100644 index 0000000000000000000000000000000000000000..183cdd3dc98c6957bde83f375a431e543a3ce9e4 GIT binary patch literal 495 zcmV@|4`Xj5kLT%gT|L_r@28Q3iff@h;hzaCwplYy<4FCT9KXmB7 zhQ|Nt)Bg(#gN*m^{Qvt8$Of<_K(zn?!~}BDpT8hi0uj&>pxItt|NHv>A2{&e(C|Mm zFGw7s;m;qS=>P!)((wQ9AF!W(0sZ}7M&|#9_5TYB{zpfHZ20g2t^wjCfB*tH2_nSs z8?4R7=Kq6S{f9wP5^T(0hI#XVIvK%6GC)WrB}f@|4`Xj5kLT%yy% zCxE~j7#aURc>+`lQtjr(@bBOM9XtMi`UFz<>-YcPzyAOF1!ObI$^vZw2q2J#|6qeb zs-vSBOie-Rl$HN?bb!_U0_g#3VEFwTr~x2=m_Y6Zss`GqsL0^t^nd#F|4B*zH*EO- z_3QuT%m4H6g6)A?0#pkSKujPf{rCwIb#eU5`( z{s2t}2q2J#|9}60{Pg58FvR|AYlEDjruP5RC6KEgJ^H_IA4CJhNdN)F0>q49OBog~ z{?Etvzo-c07$As@{Qu?4|3!FoS~(Xu$ujuK&Ki|5;fVKiqu&g@GZ_kb&V31Gky(*8`UselaloV1SZ886W^4001!n&i@1e004Y* zk0R&!|NaLC5DIk$@CyeC@AU9ebDYiJ)zswL{Qdm<{`>p<{rmm%TMiuO{1voVt6d+$)WVk%^O){nwx0zkdJv^%rQ#Z=eQ%0Ac}Z`19}Y zkI%oqe*ekA`2WvehFzDBOo*xZ{rB(cQ`_&qdGhP`Z=jyvAOx}jAb?nae){+CFDvWc zZ(siLa{c@D=g;LQw^HX+sY@u`d-M3!$G1SGAWQ!Ifj9{ufLMTG0<_`#=U?|Ye)D|< z8pH7G?=PVA*@stt1I-4xpA0e#40jk9 f${7d%fB*vk3(!F(w2U8u00000NkvXXu0mjf+94t7 literal 0 HcmV?d00001 diff --git a/themes/flags/Turks and Caicos Islands.png b/themes/flags/Turks and Caicos Islands.png new file mode 100644 index 0000000000000000000000000000000000000000..8fc1156bec3389e54d3c5bb8339901773a881e68 GIT binary patch literal 624 zcmV-$0+0QPP)Mt z2Fbqp@bUfi_XiXZ_x%As_WHU2H1hfc9TM^w3-JC0{^0Bg`~MgK0Qv%mWs{6kqN+Cc z+b3Uc-enXLWmi^s_2~6APR{Qy8GilxQ)j#p({t5y7`^LQ4&lw9Z0Ra5^`SSP!?%<&3?fU!$2L%N9{QCa@0Qv%mW$D2m zA^~iFet$Uihac>@UpF6ozx?O#ufL4HfBpRUndtzp5U;>@#TUPR{|1KG4}bt-0)`aO z`@jDF|MM3p^6S^{zdwKf{q+mXVfa4fgq7?27ZxvH%|34Sm*EEk!#{ukVgYLS^A{)$ z3^fq>3urc&4I=;kz4MwgW4X`2zkh%J`Om=vauPrQ0X6*k{pY`=2p7mzpv3Mmw05Sgm{~xFtLc$sUu>nR##!sI<0R#{WMEdpj-yJ7j ze)|0V&%b{_!~X#7`1>EofS_N0|E)GoUH&SsFy}2m05O4F@}ffYb$qvjbfSUipMQUU zgY^9U_4m&&5D8KZ)HC5u^uad<48Q&W1P~L@hOIAb7eDp_T4W)^*Xg48{r4ZBJ-_}k z{QCPJq~Q-pPnz693xQJ%zkUG(5aZwHtqd&u|9`*u&+TyOvq{_Ghd=&6oB?#w{~Yv(xYPgr|NRH*haKioowt*& z{dC`3v>70P7=Ql!$;`|Q@(GT>fdHT^FqGcDeG3pkjNS|k>E&sEfzAeo{ckY&=g(gd z`CCrwmxA8!XLtTy-uM6CzrVnM%iVPzAb=R%ks=j>et^j`MFs;Wh8c4i)_^1XKP)u> a1Q-A&>r+tW$-Nl>0000XP)6RGKQPvx1q)UK1Q6rb{|u}Q zRsa7#{m<~1f#L7}|GzNK{&HxZVEKJ4>jAefr9{u_M=MTegAo-i2ynN}MJ5kZm z42KRel$J95{>|{~*Z<$Y8RdVo9Ap3pAeIsa2H!t_KmPs=bot-kKnMR0GBy2s>sC=w zQFmwO;@`jj{`v(%zkl=p`BTQg01!Yd{Xp;j{qx|@pI^U!0X_En_iwRd$6{h)tX8f( zaOhC?&!0e%U%!3phy1#1%V=eK#YHXK~n$!{#(ib5I~Gyfqp)t0eYh-DxnQ(+0I@JIfmA>F`X8wD?>`2h#NWRRzyE`zA&Pzh5tt#% z!^rUCA3y+sZ1@LM1hf`pHc0ia|NsB|1uKPX0CRu;1-SztfLMSo`wOxir1}rsY$VlC z667idh7Sw?0mQ-}a!Q0#;n&}vAb0=!_Zy@WNd5!6=O2ju7s{65Vq=gx0uVrqe;+b1 z$mIY3|KLBvF9x7j{{!v#g_UGtQhI;<6hHv607H@yECdWlR7EJN!LomVp$!l~APvkQ z4p0cL2#YobhQA>6hXEjfKpL3-19eKmL_s!=;22W8vp@{}>pUYZ(~+fDw@M3(WY1!T<=sp}f-o0K!lJ3<>Jc!&VtMslE3ph2^H3FGe(F z4|^}slF1@l1Nxc}^5hjjU=0la|37)k@b@neJ^1|l@87?_{{z(l6@kcKe}Db@_Y267 z<&g#201!YdV6*>2R0EZ*bYA%%2Vi7me5m>mAb?naPGtnD20MY__n-f`0mzg8{s9CK z*hzmtW)s%H$oS{aAAkS?JLxaT`2W9u;n%DD1Q-B%#%TuGpFSS|0000U(k2*|8J(R-+sudaynhucHbwAMTnor{mwqO^w7JHzaBsT z{O^B8RYf5+LvDs&KmRKVd78=o{`1#HTiEo_OolaGleS)G+IQ#sUI`b*pv<`1zCJ=H0jd{{2S>p`ri%{LsXJ%FbMS z$#S`6f|?OG!^Jxczkf6Q`UNF{l0Sd`ad7zm>({^EzyAS6{{CgrkluOb3l1A>ZU2~A zK+FZ=zkmP!`TOVhpFbzBzFaPmD2$N3;+$pK?>zdet`f0002ovPDHLkV1gy;I?Vt8 literal 0 HcmV?d00001 diff --git a/themes/flags/United States Minor Outlying Islands.png b/themes/flags/United States Minor Outlying Islands.png new file mode 100644 index 0000000000000000000000000000000000000000..c1dd9654b0705371876d3e3d06f950be02de2a73 GIT binary patch literal 571 zcmV-B0>u4^P)1J@ZrOUii!$=0Ad7ci1(2A^!3kwFaT->5i7Ttz54h6XL$JkA3s3o z=g)t?e>01U3h&zo5I`(I-#Hr#t~u}$WXZu-Kyv1Rm&rE5wcB1YFI@@=0EYkn8G$4- z^Xb{M0Ro8S57@^*QJ}#<$Im$M^4iKw z00a=@`Sa(sw6y;I{R{T)e~6KA2AmBHF`#D(ii!XNh(#nN}rF)(}plRy9vU;su%e@J`J?dSji002ov JPDHLkV1n4Y8}|SJ literal 0 HcmV?d00001 diff --git a/themes/flags/United States of America.png b/themes/flags/United States of America.png new file mode 100644 index 0000000000000000000000000000000000000000..10f451fe85c41c6c9a06d543a57114ae2f87ecc1 GIT binary patch literal 609 zcmV-n0-pVeP){qW|y?pud`Sa)3|NY&vWd%S0u>b>P!2!lUe;6EF*#G_c zFVXVt@6Q{uX@40W{p0iY2Aa+A^Cu7i8KT+YH}2j52q4BskM2rJ$^k9;2Xxc_|Np=M z&VaLlA*IO5FlECMfB<5VUNC{tBZO(|zW*;@GJN;|bTJ71`0*d;`d`2P!x=ymOA`2> z+y@9C##^^8%gd{MW@Y91_2d742B2~OQNf=-zkmD?Vqkdk_wPTUNeuu2#KPTG{_;O4 v7C%8E5*DLB7#Kb?Fnj}}-(W6879hX?8lYRg`Y`<~00000NkvXXu0mjfD6Jtx literal 0 HcmV?d00001 diff --git a/themes/flags/Uruguay.png b/themes/flags/Uruguay.png new file mode 100644 index 0000000000000000000000000000000000000000..31d948a067fe02d067a8c2e69f28cca446bc7c57 GIT binary patch literal 532 zcmV+v0_**WP)_vmzq~N}&z08z z0*LYY{pZr+B0$d}2MCnI@DC;m3N;oM#uMkR0R#{ugY)L9Y<*xj0QCR^`!^)W!R$Za z5CobHbl5+T3;%B|S`QFFjQ1Zt|MTw;G#Vi+hCg5i(ELAtfD|ak8UBG;ObiSF0R{lf Wla#5zB1?M!0000JMe1P}`Y1HZufM;3|NZsr4^XwNEI-g5fB<4iWtjhPj`qjL zFGT_P{{Q>;-(R370Ro7T!5$Ws$Po%5A+Zb!3j_cNFaSC{Z(fWD@s$7o002ovPDHLk FV1jsy^u+)G literal 0 HcmV?d00001 diff --git a/themes/flags/Vanuatu.png b/themes/flags/Vanuatu.png new file mode 100644 index 0000000000000000000000000000000000000000..b3397bc63d718b344e604266259134e653925c9d GIT binary patch literal 604 zcmV-i0;BzjP)7(YpZ_rO%ce~L0mQ<@*ghnz= zZvXM=_iyVze?clB=ogUu_5ar|Ae&KE_8$WSKmaiTHT?Vg|MaE5OE>+VAUAUr;?j4FCZIvLVX%uQ>mocOU*NTK^}%njy93_oP3+fBpUa=kKpye|`ZO zzyE?r`Mc+5Xcyo_v6>E-#|Nl{r(LkAS94bRQz)6 z1Oq?-fi&zp{`>yDUnV+0)eJF{zWfaN_0t9DjNiZhfxY|}ME?2z=O_CghC>Vh0R+*Gr#1lu5DU{kh6%sopXB}uDxAo`@Bt_a*7F+) z{Q{%kjEu5C8vp``Wse8Lf5q7h438n|z~nEOsZga5l7ZnjPy;{!05Jg0{{a91!FF~d z;^O)I`~dv>{`>s@o}L{E2?GEB|Mm6!N=n`P`~Ld+{`>p?A0G$7!M*~B3FM_eAU;q6 zNCH*w+4I@c^Ny?Q?QPpWZQiU1R1HBuWkA0H1P}`l|NYDG=gP=Ihyj(0CItil0R{kn^jdV2 S*Eqib0000@|4`Xj5kLT%B_22*h{r-RE_y1qN|Ns8=|JN^|IHRmA&<212VgZ}|A4N4# z+WpUe-rxU^{Q|504bi~x`!`SnKmf4-F(Xhl(8fQ1fG+vp^85d{-~aW0|NsB{f9tRR zg1`PJA~XO^2M8drlm7gLxRT-bpa1p0|1bLmQVm3Azy5pw{{IQ;B%q-{(*XjA3FM@| zf53hMJK)W)|CK-uK=ku}!>|93eu7kk5yVLV0R(o^Z;+)RSAk6exg_KF|98LtFaPy_ z#c#OrKtum9FaQJ)NCPuC$bbfbRI>n`@$3IHusZAC|2cmD|MKhqAD{+Mr~sV<5I`Ue zOuzpyNJ@f@0s0=KlTj9AB*>SXe;D}wK*A7+fQkVEi190GMB<5K2mlB$03I1qT8uIj Q5C8xG07*qoM6N<$f}XY6qW}N^ literal 0 HcmV?d00001 diff --git a/themes/flags/Virgin Islands, British.png b/themes/flags/Virgin Islands, British.png new file mode 100644 index 0000000000000000000000000000000000000000..415690798657a5921fd007b8ae85a5e5d414e7fa GIT binary patch literal 630 zcmX|3_-&c2+@O*Bba;fM%rBo$$qwJnuekcf#0k*RG7MM`2+5Y7dK4k?R% z*@ue~6f;u_A~T0evP6qS=VxXnGS_mt>CSmS&gmG`kLSL)e_Vf_=c&!fKB7`4C;*C(7s2O*P zOs1$U0urzb3<=a`d9ABG4Q$eK<6~5Cg~V%B8`UqrfRSN8f&?QTVICs^VT=&p*?Eut zt4Ur&-BL_ON(Z|Xfgo93lf|gRkT$Mz-7^OQoD^XMF@}g>R?uoU0094KbXv)l?aF0E zh@GXQVr04m@05R(Rjxq*p|CCIRfv;QJmH1kf!hsqX*sha?_l;f%e5i5I~4YG#H4;6sPG2&U~bv( zNr`eMXGIX9?wP^zPQP(6+&$05Jg0{{;N}{t6CR|M}we`P%>f+X)5&j)Fc04NUj< zI`HZ2Woe@k6UF22`V|Qe2MTi(6bb?WF#yj00*Hv<{QLmnFd+P z9@fS%;@9^E|H1b5`Vk8^2@Yw;#}(}C_yUN9iGkt%y>Cxm>T2lO13mifZBc!n`jhHL z!MK>$6Z_d%|GfHMapIVnqod%T-`{|q1_&S~IR%b4Z+;63vi@iI?>jBz=eJjkjQ{>J z{QUQa@gMhBW_GSe5B=V~`@+h~@c%z3lmG&V@$K8U{QUg?|NjRX|KX9x@@rf{MxIY^ z?fG>3gQ&3ruaE-Yw>fW_PfAH~0~Or8dmA8tSRg?T(ZDLQOiOw%6RWM9%$i>kkAMHu z-oH0qLBYb*loP0ck&zJ?LI42-(g0BnBsn<*tTlsx%zxbLe*S!R<%*E3>|Z7(9Y#iG zpdch>0Ro8e`Sa&!arp;m4%k`<1H=Xjf<=G;Aix0Vb{`Xo7A9K&0000`!~0W%8&aG{{H+4 zRPp!M??1nPG5q=k)Wabw3seITKp+kO{xLwc{r>&$?_UrCGJgGL;^k4Qujka#`tk7L zjnovNAkb9+0R(gvNCCu>f4~1QF);xde}DY=^Xr#I=|`5hhp|NZyp>({@(egUPqbabS$v+tIbNu;L>xVSv%=>ggR z5I`*V_U`A@(fj`3!N1?XfHr^}17rYw{OcFcC69Z0BvMmfELgy8V88%&5l9HrLN(5b9xs8l&q^Gm-@&XkD1Q1BW|346ee?wJ+H2_`p`^l3V z+1Wtu|3AMO{`_T8Q2{Cj2q2bUARGR$NlJo(=nv2bFrDDw2U!bb{QV0-KNuJQ0*G-b s1H(6@xcrC2{sj~H2V-zBFaQJ?0G2^Lae{Q+uK)l507*qoM6N<$f;6K8u>b%7 literal 0 HcmV?d00001 diff --git a/themes/flags/Western Sahara.png b/themes/flags/Western Sahara.png new file mode 100644 index 0000000000000000000000000000000000000000..90a1195b47a6f12c70d06cb0bd0e4ea88d7bfb03 GIT binary patch literal 508 zcmV`hKmn*~pz%QT=MPXRKmaj;?1ifa0xhloNlE|L zuK&--1mwx?-uoV+`qwW8u#*4+i1F_GyFwg7fByafIr{%Uh)$p>Ae%w(|Nq~=m~|`# z{`_H7QhIal96$iEC^sml1*F~kc<(nb4FCQ91q_kDz!3TkBLDsd`Sky<|4qNomi`s~ z`xoeVfB<3v8uI)9A4wibp!A=AfB%5B0nwj-e?TNKsQ>@@`|oeijK3Q@{{o!^5I~F! y*$fQd7#Mzm(H|HCnf(WhfND7yc3x%x2rvM-AWsdQI)rrq00004%P)h=Z!r1m*T3JtfNUmdS)dI70mLHE z+xy?%p5eHez0mS(A>sL-rPOy{yGk_s3 zz{tq>=+Ps90Al&~?;k`pNCN|I|RMxbJV00L=%3E(v!XamT}{{RArWx|9$7ZLz(k0+Rp#|Nr~{@4x^5fB>iy$Oe)U zA3pkg`SAPSuU~)vaR2(F*|!oPfLI`Azxw(Lr25~#KmY#x{rl(7|GyyW-|wp|{||Bf z=)Cuc_0O*fYWnY`7ytr@1!(pEfB(To0uBE22c#NA{{8#+_rKq)zyAFG`zKdY6euFW z2yzlY0I`6SGJqWbGV%`;{r&ytA5hcp-u`P`AAdOg`t|1D?}h2=^+y>10tjRS&?yMj zfBygt2HEouXg1LCzyJLD1w#LR1MLR}1V8|>0KE@nffPa916Bvu_V4#Epof105yNkw zzknJ50tl=DS->P)FK#X6%e&u3i|I74$@9uP0*YE!se={)r{r~?r68Z&3 zzZn^2KYiK`5I`&p3=IF7JHD>uaSofgtUAf*-w!6nU;qF7`S<(x|35&+uYZ4j|Njjl zS;T)|pU40ZKrEjoRWbQ1@P?oGFzcPCjLiCzcU8ZC{rmejNW<@6e}U*1kPT$~=Kk_~ z83O}A05QHjx|ikdd7h}_|NsB_wl9j+&d<}^`}fbEzkmP!1q4tEL@O#P9zA*#Ab?m{ zv`qe9Isj6Ah@Z*IdsTw}WYHgB8-D!*lmGvK*?)d>i2vThzyJ_HEdLn(@uk-N0|t-& z`$Yv&?#y3UfPVP*`ya#a|BS!>G5-DsFR)1c1&eHCHYDzO7ytqc0P0;>l>h9)WB>pF M07*qoM6N<$g71PE`~Uy| literal 0 HcmV?d00001 diff --git a/themes/flags/an.png b/themes/flags/an.png new file mode 100644 index 0000000000000000000000000000000000000000..633e4b89fded98256a8d142dfb60a8058f7e6b67 GIT binary patch literal 488 zcmVP)(}33zy1Lc&_o7? zKL7y)bkd){fBym<_v`mxpbeRs`+WRVot-5A{r$IX$CJFg13u{3eX_{0R++j zR}GCkSy{&4zk!krKoTg(2n-k?g31B}5JW!NMq0d0000d94tALrX!Wj0S6V-v9sr07*qoM6N<$f?*uARsaA1 literal 0 HcmV?d00001 diff --git a/themes/flags/cs.png b/themes/flags/cs.png new file mode 100644 index 0000000000000000000000000000000000000000..8254790ca72f98d9e79d94bdfcb8839b1fd434ad GIT binary patch literal 439 zcmV;o0Z9IdP)|s3jQ%L{DG0k=ogG+0SLgMnA-pV!aytqt1(q3VU5g2cTadE%W~lnu`}m; z-504zOD10s2K8+~RqF^K7O;8$o;>*sR0>r0`!|sM`x~eNg#P~i_4n8BzrTI~MgGdl z@-i@d0|+1%Q&SyHO(9WHu7Cgk{{@--A8b6x2B1zb1BygNIks=N00WJ{7y^0)%zz1kWJN^&bany+5X-;o*O`wU`+x5q12BMq=+`e0f-vAB ze||Ik`OBc90(3J#0I>iAmFf2%21!Yv97q%>_xm>^i2a8FLV}HlAfRG^0Al&KpNnxA)<^73~VwoKqoOWF#%15i9uxn0tlqx)vH&?arx`ryF**H{9<5mxO9m@ mNC@PFfB*h~9RdUZ0R{j9;Y1$IN+(bN0000W@Y84;!#FdBh{DWNV{85G^eR=U#)*62qRvoaLX5p!7Lm^{g>IM$Q zMs{Q_?l?+2NRuC{19iOmU$>t9;*>tnC_qaIU+T2fR7nFyd0Z0-b-MgLN zL~_)yI%8}kwU1=sY!YIJllUc_pyhtI4TcZ)*Lyi~^>58dcXu!D%H5T!AO`R!zyPR# VdiZ30KxO~{002ovPDHLkV1g_p%GUq@ literal 0 HcmV?d00001 diff --git a/themes/flags/fam.png b/themes/flags/fam.png new file mode 100644 index 0000000000000000000000000000000000000000..cf50c759eb28b5962720aa1ce0617a29003e477d GIT binary patch literal 532 zcmV+v0_**WP)SU^I57#IKohy|#uQJDd#=|98& zUrgMLRb~JG{$u$2m+|*M=0AU#{`@s%|H#1h=ih%I`g`z86F>lpk-UOTf}FCMD80)oDIYC+&q4vMR0s0&DpH|L=c>-#`S^3sJ`m zRPz_88i@Y=|MmYr*an6_AO0`^1P}|uzkh%JGXi;k8UFtPIt#4m|G)nbm0000~{{6QA+oUi>E@sC6|Npy9I|mRz%!e*p z2Rq5%zu9WWBC0CAb^-aHZc7E^YzcK`=8X^WVaOP zAZs{XYh)0l^y~V&U!Q;f1_jw4fB*tH>G!)IzutbUPS7xun>*B|^YmYFnaxh5oFnsv|ie?b{2U7L_4Fkgm jhERtq_4+^_K!5=N1|KO))1zs%00000NkvXXu0mjf8-+Z0 literal 0 HcmV?d00001 diff --git a/themes/flags/wales.png b/themes/flags/wales.png new file mode 100644 index 0000000000000000000000000000000000000000..e0d7cee1107205e017c840042272f12476ee0aa0 GIT binary patch literal 652 zcmV;70(1R|P)AWw znBTkss=gWN$ME*Y`(NAt{QjkN;J}02MB(&;Kdc-80mKB<@b~YZKMV}g5wYSaSzrGC z<#lj=zkTD+H$ND}dANT6R9Lq3!_gzJFJEF25d}I4Ab>y`n3$OVE?Nk3?w(!me*OA# z|pNg&$Q z5()=&no#y6=Krof_F9Achf)A{nF9v;`|P8;$Q9J(&$2e@kA>cu?oN0tdr?p!r`I00M}SAs-l}3=F@( m=nn?tAB_7COfoP41Q-C;+8YpPdg;0V0000 Date: Tue, 17 Nov 2015 17:01:33 +0000 Subject: [PATCH 027/232] Initial Rewrite --- core/install/app_config.php | 28 + core/install/app_languages.php | 557 ++++++++++ core/install/app_menu.php | 10 + core/install/index.php | 102 ++ core/install/install_first_time.php | 377 +++++++ .../resources/classes/detect_switch.php | 155 +++ .../resources/classes/install_fusionpbx.php | 992 ++++++++++++++++++ .../resources/classes/install_switch.php | 252 +++++ .../resources/classes/iso_countries.php | 250 +++++ .../page_parts/install_config_database.php | 251 +++++ .../page_parts/install_config_detail.php | 146 +++ .../page_parts/install_event_socket.php | 101 ++ .../page_parts/install_select_language.php | 69 ++ core/install/root.php | 50 + index.php | 2 +- themes/enhanced/app_defaults.php | 93 +- 16 files changed, 3400 insertions(+), 35 deletions(-) create mode 100644 core/install/app_config.php create mode 100644 core/install/app_languages.php create mode 100644 core/install/app_menu.php create mode 100644 core/install/index.php create mode 100644 core/install/install_first_time.php create mode 100644 core/install/resources/classes/detect_switch.php create mode 100644 core/install/resources/classes/install_fusionpbx.php create mode 100644 core/install/resources/classes/install_switch.php create mode 100644 core/install/resources/classes/iso_countries.php create mode 100644 core/install/resources/page_parts/install_config_database.php create mode 100644 core/install/resources/page_parts/install_config_detail.php create mode 100644 core/install/resources/page_parts/install_event_socket.php create mode 100644 core/install/resources/page_parts/install_select_language.php create mode 100644 core/install/root.php diff --git a/core/install/app_config.php b/core/install/app_config.php new file mode 100644 index 0000000000..a65a67c8bc --- /dev/null +++ b/core/install/app_config.php @@ -0,0 +1,28 @@ + \ No newline at end of file diff --git a/core/install/app_languages.php b/core/install/app_languages.php new file mode 100644 index 0000000000..3a48d9625b --- /dev/null +++ b/core/install/app_languages.php @@ -0,0 +1,557 @@ + \ No newline at end of file diff --git a/core/install/app_menu.php b/core/install/app_menu.php new file mode 100644 index 0000000000..e76450bd70 --- /dev/null +++ b/core/install/app_menu.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/core/install/index.php b/core/install/index.php new file mode 100644 index 0000000000..9011dd9574 --- /dev/null +++ b/core/install/index.php @@ -0,0 +1,102 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane + Matthew Vale +*/ +require_once "root.php"; +require_once "resources/require.php"; +require_once "resources/check_auth.php"; + +//detect install state + +$first_time_install = true; +if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { + $first_time_install = false; +} elseif (file_exists("/etc/fusionpbx/config.php")) { + //linux + $first_time_install = false; +} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { + $first_time_install = false; +} + +if($first_time_install) { + header("Location: ".PROJECT_PATH."/core/install/install_first_time.php"); + exit; +} +require_once "resources/check_auth.php"; +if (!if_group("superadmin")) { + echo "access denied"; + exit; +} + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//includes and title + require_once "resources/header.php"; + $document['title'] = $text['title-install']; + + echo "".$text['header-install'].""; + echo "

"; + echo $text['description-install']; + echo "

"; + + echo "

\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo "\n"; + echo "
\n"; + echo " "; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo "\n"; + echo "
\n"; + echo " "; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + + echo "

"; + + echo "

WiP

"; + +//include the footer + require_once "resources/footer.php"; +?> \ No newline at end of file diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php new file mode 100644 index 0000000000..18e4d28c3e --- /dev/null +++ b/core/install/install_first_time.php @@ -0,0 +1,377 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane + Matthew Vale +*/ +require_once "root.php"; +require_once "resources/functions.php"; +require_once "resources/classes/text.php"; + +//initialize varibles we are going to use + $event_host = ''; + $event_port = ''; + $event_password = ''; + $install_language = 'en-us'; + $admin_username = ''; + $admin_password = ''; + $install_default_country = 'US'; + $install_template_name = ''; + $domain_name = ''; + $db_type = ''; + $db_path = ''; + $db_host = ''; + $db_port = ''; + $db_name = ''; + $db_username = ''; + $db_password = ''; + $db_create_username = ''; + $db_create_password = ''; + +//detect the iso country code from the locale +//TBD $locale = Locale::getDefault(); +$timezone = 'UTC'; +if (is_link('/etc/localtime')) { + // Mac OS X (and older Linuxes) + // /etc/localtime is a symlink to the + // timezone in /usr/share/zoneinfo. + $filename = readlink('/etc/localtime'); + if (strpos($filename, '/usr/share/zoneinfo/') === 0) { + $timezone = substr($filename, 20); + } +} elseif (file_exists('/etc/timezone')) { + // Ubuntu / Debian. + $data = file_get_contents('/etc/timezone'); + if ($data) { + $timezone = $data; + } +} elseif (file_exists('/etc/sysconfig/clock')) { + // RHEL / CentOS + $data = parse_ini_file('/etc/sysconfig/clock'); + if (!empty($data['ZONE'])) { + $timezone = $data['ZONE']; + } +} + +date_default_timezone_set($timezone); + +//detect install state +$first_time_install = true; +if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { + $first_time_install = false; +} elseif (file_exists("/etc/fusionpbx/config.php")) { + //linux + $first_time_install = false; +} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { + $first_time_install = false; +} + +if(!$first_time_install) { + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + if (!if_group("superadmin")) { + echo "access denied"; + exit; + } +} + +$install_step = ''; +$return_install_step = ''; + +if (count($_POST)>0) { + $install_language = check_str($_POST["install_language"]); + $install_step = check_str($_POST["install_step"]); + $return_install_step = check_str($_POST["return_install_step"]); + if(isset($_POST["event_host"])){ + $event_host = check_str($_POST["event_host"]); + $event_port = check_str($_POST["event_port"]); + $event_password = check_str($_POST["event_password"]); + } + if(isset($_POST["db_type"])){ + $db_type = $_POST["db_type"]; + $admin_username = $_POST["admin_username"]; + $admin_password = $_POST["admin_password"]; + $install_default_country = $_POST["install_default_country"]; + $install_template_name = $_POST["install_template_name"]; + $domain_name = $_POST["domain_name"]; + } +} + +if(!$install_step) { $install_step = 'select_language'; } + + $_SESSION['domain']['language']['code'] = $install_language; + +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//set a default template + $default_template = 'enhanced'; + if (isset($_SESSION['domain']['template']['name']) and strlen($_SESSION['domain']['template']['name']) != 0) { + $default_template = $_SESSION['domain']['template']['name']; + } + +//set a default enviroment if first_time + if($first_time_install){ + //grab the default theme + $set_session_theme = 1; + $domains_processed = 1; + include "themes/enhanced/app_defaults.php"; + unset($set_session_theme, $domains_processed); + //initialize some defaults so we can be 'logged in' + $_SESSION['username'] = 'first_time_install'; + $_SESSION['permissions'][]['permission_name'] = 'superadmin'; + $_SESSION['menu'] = ''; + //initialize some varibles to cut down on warnings + $_SESSION['message'] = ''; + $v_link_label_play = ''; + $v_link_label_pause = ''; + $default_login = 0; + $footer = ''; + $onload = ''; + } + +//get the contents of the template and save it to the template variable + $template = file_get_contents($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes/'.$default_template.'/template.php'); + +//buffer the content + ob_end_clean(); //clean the buffer + ob_start(); + + $messages = array(); + if (!extension_loaded('PDO')) { + $messages[] = "PHP PDO was not detected. Please install it before proceeding"; + } + + echo "
\n"; + $msg = ''; + //make sure the includes directory is writable so the config.php file can be written. + if (!is_writable($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/pdo.php")) { + $messages[] = "Write access to ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH." and its sub-directories are required during the install."; + } + //test for selinux + if (file_exists('/usr/sbin/getenforce')) { + $enforcing; + exec('getenforce', $enforcing); + if($enforcing[0] == 'Enforcing'){ + $messages[] = "SELinux is enabled and enforcing you must have a policy installed to let the webserver connect to the switch event socket
". + "You can use the following to find what ports are allowed
semanage port -l | grep '^http_port_t'
"; + } + } + + //action code + if($return_install_step == 'config_detail'){ + //check for all required data + $existing_errors = count($messages); + if (strlen($admin_username) == 0) { $messages[] = "Please provide the Admin Username"; } + if (strlen($admin_password) == 0) { $messages[] = "Please provide the Admin Password"; } + elseif (strlen($admin_password) < 5) { $messages[] = "Please provide an Admin Password that is 5 or more characters.
\n"; } + if ( count($messages) > $existing_errors) { $install_step = 'config_detail'; } + } + + if($install_step =='execute') + { + //start the rocket launch! + + //set the max execution time to 1 hour + ini_set('max_execution_time',3600); + + } + + + + //display messages + if (count($messages)>0) { + echo "
\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Messages
    \n"; + foreach ($messages as $message){ + echo "
  • $message
  • \n"; + } + echo "
\n"; + echo "
\n"; + } + +//includes and title + $document['title'] = $text['title-install_first_time']; + + //view code + if($install_step == 'select_language'){ + include "resources/page_parts/install_select_language.php"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + }elseif($install_step == 'detect_config'){ + include "resources/page_parts/install_event_socket.php"; + if($detect_ok){ + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + } + } + elseif($install_step == 'config_detail'){ + if(!$domain_name){ + //get the domain + $domain_array = explode(":", $_SERVER["HTTP_HOST"]); + $domain_name = $domain_array[0]; + } + include "resources/page_parts/install_config_detail.php"; + } + elseif($install_step == 'config_database'){ + include "resources/page_parts/install_config_database.php"; + } + elseif($install_step == 'execute'){ + echo "

".$text['header-installing']."

\n"; + //$protocol = 'http'; + //if($_SERVER['HTTPS']) { $protocol = 'https'; } + //echo ""; + require_once "core/install/resources/classes/detect_switch.php"; + $switch_detect = new detect_switch($event_host, $event_port, $event_password); + $detect_ok = true; + try { + $switch_detect->detect(); + } catch(Exception $e){ + echo "

Failed to detect confgiuration detect_switch reported: " . $e->getMessage() . "

\n"; + $detect_ok = false; + } + if($detect_ok){ + $install_ok = true; + echo "
\n";
+			function error_handler($err_severity, $errstr, $errfile, $errline ) {
+				if (0 === error_reporting()) { return false;}
+				switch($err_severity)
+				{
+					case E_ERROR:               throw new Exception ($errstr . " in $errfile line: $errline");
+					case E_PARSE:               throw new Exception ($errstr . " in $errfile line: $errline");
+					case E_CORE_ERROR:          throw new Exception ($errstr . " in $errfile line: $errline");
+					case E_COMPILE_ERROR:       throw new Exception ($errstr . " in $errfile line: $errline");
+					case E_USER_ERROR:          throw new Exception ($errstr . " in $errfile line: $errline");
+					case E_STRICT:              throw new Exception ($errstr . " in $errfile line: $errline");
+					case E_RECOVERABLE_ERROR:   throw new Exception ($errstr . " in $errfile line: $errline");
+					default: 					return false;
+				}
+			}
+			set_error_handler("error_handler");
+			try {
+				$domain_uuid = uuid();
+				require_once "resources/classes/install_fusionpbx.php";
+				$fusionPBX = new install_fusionpbx($domain_name, $domain_uuid, $switch_detect);
+				$fusionPBX->debug = true;
+				$fusionPBX->admin_username = $admin_username;
+				$fusionPBX->admin_password = $admin_password;
+				$fusionPBX->default_country = $install_default_country;
+				$fusionPBX->install_language = $install_language;
+				$fusionPBX->template_name = $install_template_name;
+				foreach($_POST as $key=>$value){
+					if(substr($key,0,3) == "db_"){
+						$fusionPBX->$key = $value;
+					}
+				}
+				$fusionPBX->install();
+		
+				require_once "resources/classes/install_switch.php";
+				$switch = new install_switch($domain_name, $domain_uuid, $switch_detect);
+				$switch->debug = true;
+				$switch->install();
+			}catch(Exception $e){
+				echo "
\n"; + echo "

Failed to install
" . $e->getMessage() . "

\n"; + try { + require_once "resources/classes/install_fusionpbx.php"; + $fusionPBX = new install_fusionpbx($domain_name, $domain_uuid, $switch_detect); + $fusionPBX->remove_config(); + }catch(Exception $e){ + echo "

Failed to remove config: " . $e->getMessage() . "

\n"; + } + $install_ok = false; + } + restore_error_handler(); + if($install_ok){ + echo "\n"; + header("Location: ".PROJECT_PATH."/logout.php"); + $_SESSION['message'] = 'Install complete'; + }else{ + echo "
\n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + } + } + }else{ + echo "

Unkown install_step '$install_step'

\n"; + } + +// add the content to the template and then send output + $body = ob_get_contents(); //get the output from the buffer + ob_end_clean(); //clean the buffer + + //replace known used constants + $body = str_replace ("", PROJECT_PATH, $body); //defined in /resources/menu.php + + ob_start(); + eval('?>' . $template . '", $document['title'], $template); // defined in each individual page + $output = str_replace ("", $custom_head, $output); // defined in each individual page + $output = str_replace ("", $_SESSION["menu"], $output); //defined in /resources/menu.php + $output = str_replace ("", PROJECT_PATH, $output); //defined in /resources/menu.php + + $pos = strrpos($output, ""); + if ($pos === false) { + $output = $body; //if tag not found just show the body + } + else { + //replace the body + $output = str_replace ("", $body, $output); + } + + echo $output; + unset($output); + +?> \ No newline at end of file diff --git a/core/install/resources/classes/detect_switch.php b/core/install/resources/classes/detect_switch.php new file mode 100644 index 0000000000..9d3dd3775c --- /dev/null +++ b/core/install/resources/classes/detect_switch.php @@ -0,0 +1,155 @@ + + Copyright (C) 2010-2015 + All Rights Reserved. + + Contributor(s): + Matthew Vale + +*/ +require_once "root.php"; +require_once "resources/classes/EventSocket.php"; + +//define the install class + class detect_switch { + + // version information + protected $_major; + protected $_minor; + + // folders + protected $_base_dir = ''; + protected $_cache_dir = ''; + protected $_certs_dir = ''; + protected $_conf_dir = ''; + protected $_db_dir = ''; + protected $_external_ssl_dir = ''; + protected $_grammar_dir = ''; + protected $_htdocs_dir = ''; + protected $_internal_ssl_dir = ''; + protected $_log_dir = ''; + protected $_mod_dir = ''; + protected $_recordings_dir = ''; + protected $_run_dir = ''; + protected $_script_dir = ''; + protected $_sounds_dir = ''; + protected $_storage_dir = ''; + protected $_temp_dir = ''; + + function major() { return $this->_major; } + function minor() { return $this->_minor; } + function base_dir() { return $this->_base_dir; } + function cache_dir() { return $this->_cache_dir; } + function certs_dir() { return $this->_certs_dir; } + function conf_dir() { return $this->_conf_dir; } + function db_dir() { return $this->_db_dir; } + function external_ssl_dir() { return $this->_external_ssl_dir; } + function grammar_dir() { return $this->_grammar_dir; } + function htdocs_dir() { return $this->_htdocs_dir; } + function internal_ssl_dir() { return $this->_internal_ssl_dir; } + function log_dir() { return $this->_log_dir; } + function mod_dir() { return $this->_mod_dir; } + function recordings_dir() { return $this->_recordings_dir; } + function run_dir() { return $this->_run_dir; } + function script_dir() { return $this->_script_dir; } + function sounds_dir() { return $this->_sounds_dir; } + function storage_dir() { return $this->_storage_dir; } + function temp_dir() { return $this->_temp_dir; } + + // event socket + public $event_host = 'localhost'; + public $event_port = '8021'; + public $event_password = 'ClueCon'; + protected $event_socket; + + public function __construct($event_host, $event_port, $event_password) { + if($event_host){ $this->event_host = $event_host; } + if($event_port){ $this->event_port = $event_port; } + if($event_password){ $this->event_password = $event_password; } + $this->connect_event_socket(); + if(!$this->event_socket){ + $this->detect_event_socket(); + } + } + + protected function detect_event_socket() { + //perform searches for user's config here + } + + public function detect() { + $this->connect_event_socket(); + if(!$this->event_socket){ + throw new Exception('Failed to use event socket'); + } + $FS_Version = $this->event_socket_request('api version'); + preg_match("/FreeSWITCH Version (\d+)\.(\d(?:\.\d+)?)/", $FS_Version, $matches); + $this->_major = $matches[1]; + $this->_minor = $matches[2]; + $FS_Vars = $this->event_socket_request('api global_getvar'); + foreach (explode("\n",$FS_Vars) as $FS_Var){ + preg_match("/(\w+_dir)=(.*)/", $FS_Var, $matches); + if(count($matches) > 0 and property_exists($this, "_" . $matches[1])){ + $field = "_" . $matches[1]; + $this->$field = $matches[2]; + } + } + } + + public function show_config() { + $buffer = ''; + $buffer .= "FreeSWITCH Verson => " . $this->_major . "." . $this->_minor . "\n"; + $buffer .= "base_dir => " . $this->_base_dir ."\n"; + $buffer .= "cache_dir => " . $this->_cache_dir ."\n"; + $buffer .= "certs_dir => " . $this->_certs_dir ."\n"; + $buffer .= "conf_dir => " . $this->_conf_dir ."\n"; + $buffer .= "db_dir => " . $this->_db_dir ."\n"; + $buffer .= "external_ssl_dir => " . $this->_external_ssl_dir ."\n"; + $buffer .= "grammar_dir => " . $this->_grammar_dir ."\n"; + $buffer .= "htdocs_dir => " . $this->_htdocs_dir ."\n"; + $buffer .= "internal_ssl_dir => " . $this->_internal_ssl_dir ."\n"; + $buffer .= "log_dir => " . $this->_log_dir ."\n"; + $buffer .= "mod_dir => " . $this->_mod_dir ."\n"; + $buffer .= "recordings_dir => " . $this->_recordings_dir ."\n"; + $buffer .= "run_dir => " . $this->_run_dir ."\n"; + $buffer .= "script_dir => " . $this->_script_dir ."\n"; + $buffer .= "sounds_dir => " . $this->_sounds_dir ."\n"; + $buffer .= "storage_dir => " . $this->_storage_dir ."\n"; + $buffer .= "temp_dir => " . $this->_temp_dir ."\n"; + return $buffer; + } + + protected function connect_event_socket(){ + $esl = new EventSocket; + if ($esl->connect($this->event_host, $this->event_port, $this->event_password)) { + $this->event_socket = $esl->reset_fp(); + return true; + } + return false; + } + + protected function event_socket_request($cmd) { + $esl = new EventSocket($this->event_socket); + $result = $esl->request($cmd); + $esl->reset_fp(); + return $result; + } + + } +?> \ No newline at end of file diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php new file mode 100644 index 0000000000..0d4e74d75e --- /dev/null +++ b/core/install/resources/classes/install_fusionpbx.php @@ -0,0 +1,992 @@ + + Copyright (C) 2010-2015 + All Rights Reserved. + + Contributor(s): + Mark J Crane + Matthew Vale +*/ +include "root.php"; + +//define the install class + class install_fusionpbx { + + protected $domain_uuid; + protected $domain_name; + protected $detect_switch; + protected $config_php; + protected $menu_uuid = 'b4750c3f-2a86-b00d-b7d0-345c14eca286'; + protected $dbh; + + public $debug = false; + + public $install_msg; + public $install_language = 'en-us'; + public $admin_username; + public $admin_password; + public $default_country = 'US'; + public $template_name = 'enhanced'; + + public $db_type; + public $db_path; + public $db_host; + public $db_port; + public $db_name; + public $db_username; + public $db_password; + + function __construct($domain_name, $domain_uuid, $detect_switch) { + if(!is_a($detect_switch, 'detect_switch')){ + throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)'); + } + $this->domain_uuid = $domain_uuid; + $this->domain_name = $domain_name; + $this->detect_switch = $detect_switch; + if (is_dir("/etc/fusionpbx")){ + $this->config_php = "/etc/fusionpbx/config.php"; + } elseif (is_dir("/usr/local/etc/fusionpbx")){ + $this->config_php = "/usr/local/etc/fusionpbx/config.php"; + } + elseif (is_dir($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources")) { + $this->config_php = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/config.php"; + } + else { + $this->config_php = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/config.php"; + } + } + + function write_debug($message) { + if($this->debug){ + echo "$message\n"; + } + } + + function write_progress($message) { + echo "$message\n"; + } + + function install() { + ini_set('max_execution_time',3600); + $this->create_config_php(); + $this->create_database(); + $this->create_domain(); + $this->create_superuser(); + require "resources/require.php"; + $this->create_menus(); + $this->post_create(); + } + + protected function create_config_php() { + $tmp_config = "db_type."'; //sqlite, mysql, pgsql, others with a manually created PDO connection\n"; + $tmp_config .= "\n"; + if ($this->db_type == "sqlite") { + $tmp_config .= " //sqlite: the db_name and db_path are automatically assigned however the values can be overidden by setting the values here.\n"; + $tmp_config .= " \$db_name = '".$this->db_name."'; //host name/ip address + '.db' is the default database filename\n"; + $tmp_config .= " \$db_path = '".$this->db_path."'; //the path is determined by a php variable\n"; + } + $tmp_config .= "\n"; + $tmp_config .= " //mysql: database connection information\n"; + if ($this->db_type == "mysql") { + if ($this->db_host == "localhost") { + //if localhost is used it defaults to a Unix Socket which doesn't seem to work. + //replace localhost with 127.0.0.1 so that it will connect using TCP + $this->db_host = "127.0.0.1"; + } + $tmp_config .= " \$db_host = '".$this->db_host."';\n"; + $tmp_config .= " \$db_port = '".$this->db_port."';\n"; + $tmp_config .= " \$db_name = '".$this->db_name."';\n"; + $tmp_config .= " \$db_username = '".$this->db_username."';\n"; + $tmp_config .= " \$db_password = '".$this->db_password."';\n"; + } + else { + $tmp_config .= " //\$db_host = '';\n"; + $tmp_config .= " //\$db_port = '';\n"; + $tmp_config .= " //\$db_name = '';\n"; + $tmp_config .= " //\$db_username = '';\n"; + $tmp_config .= " //\$db_password = '';\n"; + } + $tmp_config .= "\n"; + $tmp_config .= " //pgsql: database connection information\n"; + if ($this->db_type == "pgsql") { + $tmp_config .= " \$db_host = '".$this->db_host."'; //set the host only if the database is not local\n"; + $tmp_config .= " \$db_port = '".$this->db_port."';\n"; + $tmp_config .= " \$db_name = '".$this->db_name."';\n"; + $tmp_config .= " \$db_username = '".$this->db_username."';\n"; + $tmp_config .= " \$db_password = '".$this->db_password."';\n"; + } + else { + $tmp_config .= " //\$db_host = '".$this->db_host."'; //set the host only if the database is not local\n"; + $tmp_config .= " //\$db_port = '".$this->db_port."';\n"; + $tmp_config .= " //\$db_name = '".$this->db_name."';\n"; + $tmp_config .= " //\$db_username = '".$this->db_username."';\n"; + $tmp_config .= " //\$db_password = '".$this->db_password."';\n"; + } + $tmp_config .= "\n"; + $tmp_config .= " //show errors\n"; + $tmp_config .= " ini_set('display_errors', '1');\n"; + $tmp_config .= " //error_reporting (E_ALL); // Report everything\n"; + $tmp_config .= " //error_reporting (E_ALL ^ E_NOTICE); // Report everything\n"; + $tmp_config .= " error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings"; + $tmp_config .= "\n"; + $tmp_config .= "?>"; + + if((file_exists($this->config_php) and !is_writable($this->config_php)) + or !is_writable(dirname($this->config_php)) + ){ + throw new Exception("cannot write to '" . $this->config_php . "'" ); + } + $this->write_progress("Creating " . $this->config_php); + $fout = fopen($this->config_php,"w"); + fwrite($fout, $tmp_config); + unset($tmp_config); + fclose($fout); + } + + protected function create_database() { + require $this->config_php; + $this->write_progress("creating database as " . $this->db_type); + $function = "create_database_" . $this->db_type; + $this->$function(); + global $db; + $db = $this->dbh; + } + protected function create_database_sqlite() { + //sqlite database will be created when the config.php is loaded and only if the database file does not exist + try { + $this->dbh = new PDO('sqlite:'.$this->db_path.'/'.$this->db_name); //sqlite 3 + //$this->dbh = new PDO('sqlite::memory:'); //sqlite 3 + } + catch (PDOException $error) { + throw Exception("Failed to create database: " . $error->getMessage()); + } + + //add additional functions to SQLite - bool PDO::sqliteCreateFunction ( string function_name, callback callback [, int num_args] ) + if (!function_exists('php_now')) { + function php_now() { + if(function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) { + @date_default_timezone_set(@date_default_timezone_get()); + } + return date("Y-m-d H:i:s"); + } + } + $this->dbh->sqliteCreateFunction('now', 'php_now', 0); + + //add the database structure + require_once "resources/classes/schema.php"; + $schema = new schema; + $schema->db = $this->dbh; + $schema->db_type = $this->db_type; + $schema->sql(); + $schema->exec(); + + //get the contents of the sql file + if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/sqlite.sql')){ + $filename = "/usr/share/examples/fusionpbx/resources/install/sql/sqlite.sql"; + } + else { + $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/sqlite.sql'; + } + $file_contents = file_get_contents($filename); + unset($filename); + + //replace \r\n with \n then explode on \n + $file_contents = str_replace("\r\n", "\n", $file_contents); + + //loop line by line through all the lines of sql code + $this->dbh->beginTransaction(); + $string_array = explode("\n", $file_contents); + $x = 0; + foreach($string_array as $sql) { + try { + $this->dbh->query($sql); + } + catch (PDOException $error) { + throw new Exception("error creating database: " . $error->getMessage() . "\n" . $sql ); + } + $x++; + } + unset ($file_contents, $sql); + $this->dbh->commit(); + + //set the file permissions + chmod($this->db_path.'/'.$this->db_name, 0777); + } + + protected function create_database_pgsql() { + + //if $this->db_create_username provided, attempt to create new PG role and database + if (strlen($this->db_create_username) > 0) { + try { + if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } + if (strlen($this->db_host) > 0) { + $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} user={".$this->db_create_username."} password={".$this->db_create_password."} dbname=template1"); + } else { + $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={".$this->db_create_username."} password={".$this->db_create_password."} dbname=template1"); + } + } catch (PDOException $error) { + throw new Exception("error connecting to database: " . $error->getMessage()); + } + + //create the database, user, grant perms + $this->dbh->exec("CREATE DATABASE {$this->db_name}"); + $this->dbh->exec("CREATE USER {$this->db_username} WITH PASSWORD '{$this->db_password}'"); + $this->dbh->exec("GRANT ALL ON {$this->db_name} TO {$this->db_username}"); + + //close database connection_aborted + $this->dbh = null; + } + + //open database connection with $this->db_name + try { + if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } + if (strlen($this->db_host) > 0) { + $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} dbname={$this->db_name} user={$this->db_username} password={$this->db_password}"); + } else { + $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_username} password={$this->db_password} dbname={$this->db_name}"); + } + } + catch (PDOException $error) { + throw new Exception("error connecting to database: " . $error->getMessage()); + } + + //add the database structure + require_once "resources/classes/schema.php"; + $schema = new schema; + $schema->db = $this->dbh; + $schema->db_type = $this->db_type; + $schema->sql(); + $schema->exec(); + + //get the contents of the sql file + if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql')){ + $filename = "/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql"; + } + else { + $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql'; + } + $file_contents = file_get_contents($filename); + + //replace \r\n with \n then explode on \n + $file_contents = str_replace("\r\n", "\n", $file_contents); + + //loop line by line through all the lines of sql code + $string_array = explode("\n", $file_contents); + $x = 0; + foreach($string_array as $sql) { + if (strlen($sql) > 3) { + try { + $this->dbh->query($sql); + } + catch (PDOException $error) { + throw new Exception("error creating database: " . $error->getMessage() . "\n" . $sql ); + } + } + $x++; + } + unset ($file_contents, $sql); + } + + protected function create_database_mysql() { + //database connection + try { + if (strlen($this->db_host) == 0 && strlen($this->db_port) == 0) { + //if both host and port are empty use the unix socket + if (strlen($this->db_create_username) == 0) { + $this->dbh = new PDO("mysql:host=$this->db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $this->db_username, $this->db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + } + else { + $this->dbh = new PDO("mysql:host=$this->db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $this->db_create_username, $this->db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + } + } + else { + if (strlen($this->db_port) == 0) { + //leave out port if it is empty + if (strlen($this->db_create_username) == 0) { + $this->dbh = new PDO("mysql:host=$this->db_host;", $this->db_username, $this->db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + } + else { + $this->dbh = new PDO("mysql:host=$this->db_host;", $this->db_create_username, $this->db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } + } + else { + if (strlen($this->db_create_username) == 0) { + $this->dbh = new PDO("mysql:host=$this->db_host;port=$this->db_port;", $this->db_username, $this->db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + } + else { + $this->dbh = new PDO("mysql:host=$this->db_host;port=$this->db_port;", $this->db_create_username, $this->db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + } + } + } + $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); + } + catch (PDOException $error) { + throw new Exception("error creating database: " . $error->getMessage() . "\n" . $sql ); + } + + //create the table, user and set the permissions only if the db_create_username was provided + if (strlen($this->db_create_username) > 0) { + //select the mysql database + try { + $this->dbh->query("USE mysql;"); + } + catch (PDOException $error) { + if ($this->debug) { + throw new Exception("error conencting to database: " . $error->getMessage()); + } + } + + //create user and set the permissions + try { + $tmp_sql = "CREATE USER '".$this->db_username."'@'%' IDENTIFIED BY '".$this->db_password."'; "; + $this->dbh->query($tmp_sql); + } + catch (PDOException $error) { + if ($this->debug) { + print "error: " . $error->getMessage() . "
"; + } + } + + //set account to unlimited use + try { + if ($this->db_host == "localhost" || $this->db_host == "127.0.0.1") { + $tmp_sql = "GRANT USAGE ON * . * TO '".$this->db_username."'@'localhost' "; + $tmp_sql .= "IDENTIFIED BY '".$this->db_password."' "; + $tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; "; + $this->dbh->query($tmp_sql); + + $tmp_sql = "GRANT USAGE ON * . * TO '".$this->db_username."'@'127.0.0.1' "; + $tmp_sql .= "IDENTIFIED BY '".$this->db_password."' "; + $tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; "; + $this->dbh->query($tmp_sql); + } + else { + $tmp_sql = "GRANT USAGE ON * . * TO '".$this->db_username."'@'".$this->db_host."' "; + $tmp_sql .= "IDENTIFIED BY '".$this->db_password."' "; + $tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; "; + $this->dbh->query($tmp_sql); + } + } + catch (PDOException $error) { + if ($this->debug) { + print "error: " . $error->getMessage() . "
"; + } + } + + //create the database and set the create user with permissions + try { + $tmp_sql = "CREATE DATABASE IF NOT EXISTS ".$this->db_name."; "; + $this->dbh->query($tmp_sql); + } + catch (PDOException $error) { + if ($this->debug) { + print "error: " . $error->getMessage() . "
"; + } + } + + //set user permissions + try { + $this->dbh->query("GRANT ALL PRIVILEGES ON ".$this->db_name.".* TO '".$this->db_username."'@'%'; "); + } + catch (PDOException $error) { + if ($this->debug) { + print "error: " . $error->getMessage() . "
"; + } + } + + //make the changes active + try { + $tmp_sql = "FLUSH PRIVILEGES; "; + $this->dbh->query($tmp_sql); + } + catch (PDOException $error) { + if ($this->debug) { + print "error: " . $error->getMessage() . "
"; + } + } + + } //if (strlen($this->db_create_username) > 0) + + //select the database + try { + $this->dbh->query("USE ".$this->db_name.";"); + } + catch (PDOException $error) { + if ($this->debug) { + print "error: " . $error->getMessage() . "
"; + } + } + + //add the database structure + require_once "resources/classes/schema.php"; + $schema = new schema; + $schema->db = $this->dbh; + $schema->db_type = $this->db_type; + $schema->sql(); + $schema->exec(); + + //add the defaults data into the database + //get the contents of the sql file + if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/mysql.sql')){ + $filename = "/usr/share/examples/fusionpbx/resources/install/sql/mysql.sql"; + } + else { + $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/mysql.sql'; + } + $file_contents = file_get_contents($filename); + + //replace \r\n with \n then explode on \n + $file_contents = str_replace("\r\n", "\n", $file_contents); + + //loop line by line through all the lines of sql code + $string_array = explode("\n", $file_contents); + $x = 0; + foreach($string_array as $sql) { + if (strlen($sql) > 3) { + try { + if ($this->debug) { + $this->write_debug( $sql."\n"); + } + $this->dbh->query($sql); + } + catch (PDOException $error) { + //echo "error on line $x: " . $error->getMessage() . " sql: $sql
"; + //die(); + } + } + $x++; + } + unset ($file_contents, $sql); + } + + + protected function create_domain() { + $this->write_progress("checking if domain exists '" . $this->domain_name . "'"); + $sql = "select count(*) from v_domains "; + $sql .= "where domain_name = '".$this->domain_name."' "; + + $this->write_debug($sql); + $prep_statement = $this->dbh->prepare(check_sql($sql)); + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($sql, $prep_statement); + if ($row['num_rows'] == 0) { + $this->write_progress("creating domain '" . $this->domain_name . "'"); + $sql = "insert into v_domains "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "domain_name, "; + $sql .= "domain_description "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$this->domain_uuid."', "; + $sql .= "'".$this->domain_name."', "; + $sql .= "'' "; + $sql .= ");"; + + $this->write_debug($sql); + $this->dbh->exec(check_sql($sql)); + unset($sql); + + //domain settings + $x = 0; + $tmp[$x]['name'] = 'uuid'; + $tmp[$x]['value'] = $this->menu_uuid; + $tmp[$x]['category'] = 'domain'; + $tmp[$x]['subcategory'] = 'menu'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'name'; + $tmp[$x]['category'] = 'domain'; + $tmp[$x]['subcategory'] = 'time_zone'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'code'; + $tmp[$x]['value'] = 'en-us'; + $tmp[$x]['category'] = 'domain'; + $tmp[$x]['subcategory'] = 'language'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'iso_code'; + $tmp[$x]['value'] = $this->default_country; + $tmp[$x]['category'] = 'domain'; + $tmp[$x]['subcategory'] = 'country'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'name'; + $tmp[$x]['value'] = $this->template_name; + $tmp[$x]['category'] = 'domain'; + $tmp[$x]['subcategory'] = 'template'; + $tmp[$x]['enabled'] = 'true'; + $x++; + + //switch settings + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $switch_bin_dir; + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'bin'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->base_dir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'base'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->conf_dir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'conf'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->db_dir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'db'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->log_dir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'log'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->mod_dir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'mod'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->script_dir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'scripts'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->grammar_dir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'grammar'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->storage_dir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'storage'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->storage_dir(), 'voicemail'); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'voicemail'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->recordings_dir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'recordings'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->sounds_dir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'sounds'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = ''; + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'provision'; + $tmp[$x]['enabled'] = 'false'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->conf_dir(), "/directory"); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'extensions'; + $tmp[$x]['enabled'] = 'false'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->conf_dir(), "/sip_profiles"); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'sip_profiles'; + $tmp[$x]['enabled'] = 'false'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->conf_dir(), "/dialplan"); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'dialplan'; + $tmp[$x]['enabled'] = 'false'; + $x++; + + //server settings + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->temp_dir(); + $tmp[$x]['category'] = 'server'; + $tmp[$x]['subcategory'] = 'temp'; + $tmp[$x]['enabled'] = 'true'; + $x++; + #throw new Exception("I don't know how to find /etc/init.d for server > startup_scripts"); + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = ''; + $tmp[$x]['category'] = 'server'; + $tmp[$x]['subcategory'] = 'startup_script'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = sys_get_temp_dir(); + $tmp[$x]['category'] = 'server'; + $tmp[$x]['subcategory'] = 'backup'; + $tmp[$x]['enabled'] = 'true'; + $x++; + + $this->dbh->beginTransaction(); + foreach($tmp as $row) { + $sql = "insert into v_default_settings "; + $sql .= "("; + $sql .= "default_setting_uuid, "; + $sql .= "default_setting_name, "; + $sql .= "default_setting_value, "; + $sql .= "default_setting_category, "; + $sql .= "default_setting_subcategory, "; + $sql .= "default_setting_enabled "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'".$row['name']."', "; + $sql .= "'".$row['value']."', "; + $sql .= "'".$row['category']."', "; + $sql .= "'".$row['subcategory']."', "; + $sql .= "'".$row['enabled']."' "; + $sql .= ");"; + $this->write_debug($sql); + $this->dbh->exec(check_sql($sql)); + unset($sql); + } + $this->dbh->commit(); + unset($tmp); + + //get the list of installed apps from the core and mod directories + $config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php"); + $x=0; + foreach ($config_list as $config_path) { + include($config_path); + $x++; + } + + //add the groups + $x = 0; + $tmp[$x]['group_name'] = 'superadmin'; + $tmp[$x]['group_description'] = 'Super Administrator Group'; + $x++; + $tmp[$x]['group_name'] = 'admin'; + $tmp[$x]['group_description'] = 'Administrator Group'; + $x++; + $tmp[$x]['group_name'] = 'user'; + $tmp[$x]['group_description'] = 'User Group'; + $x++; + $tmp[$x]['group_name'] = 'public'; + $tmp[$x]['group_description'] = 'Public Group'; + $x++; + $tmp[$x]['group_name'] = 'agent'; + $tmp[$x]['group_description'] = 'Call Center Agent Group'; + $this->dbh->beginTransaction(); + foreach($tmp as $row) { + $sql = "insert into v_groups "; + $sql .= "("; + $sql .= "group_uuid, "; + $sql .= "group_name, "; + $sql .= "group_description "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'".$row['group_name']."', "; + $sql .= "'".$row['group_description']."' "; + $sql .= ");"; + $this->write_debug($sql); + $this->dbh->exec(check_sql($sql)); + unset($sql); + } + unset($tmp); + $this->dbh->commit(); + //assign the default permissions to the groups + $this->dbh->beginTransaction(); + foreach($apps as $app) { + if ($app['permissions']) { + foreach ($app['permissions'] as $row) { + if ($this->debug) { + $this->write_debug( "v_group_permissions\n"); + $this->write_debug( json_encode($row)."\n\n"); + } + if ($row['groups']) { + foreach ($row['groups'] as $group) { + //add the record + $sql = "insert into v_group_permissions "; + $sql .= "("; + $sql .= "group_permission_uuid, "; + $sql .= "permission_name, "; + $sql .= "group_name "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'".$row['name']."', "; + $sql .= "'".$group."' "; + $sql .= ");"; + if ($this->debug) { + $this->write_debug( $sql."\n"); + } + $this->dbh->exec(check_sql($sql)); + unset($sql); + } + } + } + } + } + $this->dbh->commit(); + } + } + + protected function create_superuser() { + //check if it exists first? + $this->write_progress("creating super user '" . $this->admin_username . "'"); + //add a user and then add the user to the superadmin group + //prepare the values + $this->admin_uuid = uuid(); + $contact_uuid = uuid(); + //set a sessiong variable + $_SESSION["user_uuid"] = $user_uuid; + //salt used with the password to create a one way hash + $salt = generate_password('20', '4'); + //add the user account + $sql = "insert into v_users "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "user_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "username, "; + $sql .= "password, "; + $sql .= "salt, "; + $sql .= "add_date, "; + $sql .= "add_user "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$this->domain_uuid."', "; + $sql .= "'".$this->admin_uuid."', "; + $sql .= "'$contact_uuid', "; + $sql .= "'".$this->admin_username."', "; + $sql .= "'".md5($salt.$this->admin_password)."', "; + $sql .= "'$salt', "; + $sql .= "now(), "; + $sql .= "'".$this->admin_username."' "; + $sql .= ");"; + $this->write_debug( $sql."\n"); + $this->dbh->exec(check_sql($sql)); + unset($sql); + + //add to contacts + $sql = "insert into v_contacts "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "contact_type, "; + $sql .= "contact_name_given, "; + $sql .= "contact_nickname "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$this->domain_uuid."', "; + $sql .= "'$contact_uuid', "; + $sql .= "'user', "; + $sql .= "'".$this->admin_username."', "; + $sql .= "'".$this->admin_username."' "; + $sql .= ")"; + $this->dbh->exec(check_sql($sql)); + unset($sql); + + //add the user to the superadmin group + $sql = "insert into v_group_users "; + $sql .= "("; + $sql .= "group_user_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "user_uuid, "; + $sql .= "group_name "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'".$this->domain_uuid."', "; + $sql .= "'".$this->admin_uuid."', "; + $sql .= "'superadmin' "; + $sql .= ");"; + $this->write_debug( $sql."\n"); + $this->dbh->exec(check_sql($sql)); + unset($sql); + } + + protected function create_menus() { + $this->write_progress("creating menus"); + //set the defaults + $menu_name = 'default'; + $menu_language = 'en-us'; + $menu_description = 'Default Menu Set'; + //add the parent menu + $sql = "insert into v_menus "; + $sql .= "("; + $sql .= "menu_uuid, "; + $sql .= "menu_name, "; + $sql .= "menu_language, "; + $sql .= "menu_description "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$this->menu_uuid."', "; + $sql .= "'$menu_name', "; + $sql .= "'$menu_language', "; + $sql .= "'$menu_description' "; + $sql .= ");"; + if ($this->debug) { + $this->write_debug( $sql."\n"); + } + $this->dbh->exec(check_sql($sql)); + unset($sql); + + //add the menu items + require_once "resources/classes/menu.php"; + $menu = new menu; + $menu->db = $this->dbh; + $menu->menu_uuid = $this->menu_uuid; + $menu->restore(); + unset($menu); + } + + protected function post_create() { + $this->write_progress("running post steps"); + //login the user account + $_SESSION["username"] = $this->admin_username; + + //get the groups assigned to the user and then set the groups in $_SESSION["groups"] + $sql = "SELECT * FROM v_group_users "; + $sql .= "where domain_uuid=:domain_uuid "; + $sql .= "and user_uuid=:user_uuid "; + $prep_statement = $this->dbh->prepare(check_sql($sql)); + $prep_statement->bindParam(':domain_uuid', $this->domain_uuid); + $prep_statement->bindParam(':user_uuid', $this->admin_uuid); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $_SESSION["groups"] = $result; + unset($sql, $row_count, $prep_statement); + + //get the permissions assigned to the groups that the user is a member of set the permissions in $_SESSION['permissions'] + $x = 0; + $sql = "select distinct(permission_name) from v_group_permissions "; + foreach($_SESSION["groups"] as $field) { + if (strlen($field['group_name']) > 0) { + if ($x == 0) { + $sql .= "where (domain_uuid = '".$this->domain_uuid."' and group_name = '".$field['group_name']."') "; + } + else { + $sql .= "or (domain_uuid = '".$this->domain_uuid."' and group_name = '".$field['group_name']."') "; + } + $x++; + } + } + $prep_statementsub = $this->dbh->prepare($sql); + $prep_statementsub->execute(); + $_SESSION['permissions'] = $prep_statementsub->fetchAll(PDO::FETCH_NAMED); + unset($sql, $prep_statementsub); + + //make sure the database schema and installation have performed all necessary tasks + $display_results = false; + $display_type = 'none'; + require_once "resources/classes/schema.php"; + $obj = new schema; + $obj->schema($this->dbh, $this->db_type, $this->db_name, $display_type); + + //run all app_defaults.php files + $default_language = $this->install_language; + require_once "resources/classes/domains.php"; + $domain = new domains; + $domain->upgrade(); + + //synchronize the config with the saved settings + save_switch_xml(); + + //do not show the apply settings reminder on the login page + $_SESSION["reload_xml"] = false; + + //clear the menu + $_SESSION["menu"] = ""; + } + + public function remove_config() { + if (file_exists('/bin/rm')) { + $this->write_debug('rm -f ' . $this->config_php); + exec ('rm -f ' . $this->config_php); + } + elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){ + $this->write_debug("del /S /F /Q '$dir'"); + exec("del /F /Q '" . $this->config_php . "'"); + } + else { + $this->write_debug("delete file: ".$file); + unlink($this->config_php); + } + clearstatcache(); + } + } +?> \ No newline at end of file diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php new file mode 100644 index 0000000000..61cad71e9a --- /dev/null +++ b/core/install/resources/classes/install_switch.php @@ -0,0 +1,252 @@ + + Copyright (C) 2010-2015 + All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +include "root.php"; + +//define the install class + class install_switch { + + protected $domain_uuid; + protected $domain_name; + protected $detect_switch; + + public $debug = false; + + function __construct($domain_name, $domain_uuid, $detect_switch) { + if(!is_a($detect_switch, 'detect_switch')){ + throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)'); + } + $this->domain_uuid = $domain_uuid; + $this->domain = $domain_name; + $this->detect_switch = $detect_switch; + } + + //utility Functions + + function write_debug($message) { + if($this->debug){ + echo "$message\n"; + } + } + + function write_progress($message) { + echo "$message\n"; + } + + //$options '-n' --no-clobber + protected function recursive_copy($src, $dst, $options = '') { + if (file_exists('/bin/cp')) { + if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') { + //copy -R recursive, preserve attributes for SUN + $cmd = 'cp -Rp '.$src.'/* '.$dst; + } else { + //copy -R recursive, -L follow symbolic links, -p preserve attributes for other Posix systemss + $cmd = 'cp -RLp '.$options.' '.$src.'/* '.$dst; + } + $this->write_debug($cmd); + exec ($cmd); + } + elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){ + exec("copy /L '$src' '$dst'"); + } + else { + $dir = opendir($src); + if (!$dir) { + if (!mkdir($src, 0755, true)) { + throw new Exception("recursive_copy() source directory '".$src."' does not exist."); + } + } + if (!is_dir($dst)) { + if (!mkdir($dst, 0755, true)) { + throw new Exception("recursive_copy() failed to create destination directory '".$dst."'"); + } + } + //This looks wrong, essentially if we can't use /bin/cp it manually fils dirs, not correct + $scripts_dir_target = $_SESSION['switch']['scripts']['dir']; + $scripts_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'); + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src)) as $file_path_source) { + if ( + substr_count($file_path_source, '/..') == 0 && + substr_count($file_path_source, '/.') == 0 && + substr_count($file_path_source, '/.svn') == 0 && + substr_count($file_path_source, '/.git') == 0 + ) { + if ($dst != $src.'/resources/config.lua') { + $this->write_debug($file_path_source.' ---> '.$dst); + copy($file_path_source, $dst); + chmod($dst, 0755); + } + } + } + + while(false !== ($file = readdir($dir))) { + if (($file != '.') && ($file != '..')) { + if (is_dir($src.'/'.$file)) { + $this->recursive_copy($src.'/'.$file, $dst.'/'.$file); + } + else { + //copy only missing files -n --no-clobber + if (strpos($options,'-n') !== false) { + if (!file_exists($dst.'/'.$file)) { + $this->write_debug("copy(".$src."/".$file.", ".$dst."/".$file.")"); + copy($src.'/'.$file, $dst.'/'.$file); + } + } + else { + copy($src.'/'.$file, $dst.'/'.$file); + } + } + } + } + closedir($dir); + } + } + + protected function recursive_delete($dir) { + if (file_exists('/bin/rm')) { + $this->write_debug('rm -Rf '.$dir.'/*'); + exec ('rm -Rf '.$dir.'/*'); + } + elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){ + $this->write_debug("del /S /F /Q '$dir'"); + exec("del /S /F /Q '$dir'"); + } + else { + foreach (glob($dir) as $file) { + if (is_dir($file)) { + $this->write_debug("rm dir: ".$file); + $this->recursive_delete("$file/*"); + rmdir($file); + } else { + $this->write_debug("delete file: ".$file); + unlink($file); + } + } + } + clearstatcache(); + } + + protected function backup_dir($dir, $backup_name){ + if (!is_readable($dir)) { + throw new Exception("backup_dir() source directory '".$dir."' does not exist."); + } + $dst_tar = join( DIRECTORY_SEPARATOR, array(sys_get_temp_dir(), "$backup_name.tar")); + //pharData is the correct ay to do it, but it keeps creating incomplete archives + //$tar = new PharData($dst_tar); + //$tar->buildFromDirectory($dir); + $this->write_debug("backingup to $dst_tar"); + if (file_exists('/bin/tar')) { + exec('tar -cvf ' .$dst_tar. ' -C '.$dir .' .'); + }else{ + $this->write_debug('WARN: old config could not be compressed'); + $dst_dir = join( DIRECTORY_SEPARATOR, array(sys_get_temp_dir(), "$backup_name")); + recursive_copy($dir, $dst_dir); + } + } + + function install() { + $this->copy_conf(); + $this->copy_scripts(); + } + + function upgrade() { + $this->copy_scripts(); + } + + function copy_conf() { + $this->write_progress("Copying Config"); + //make a backup of the config + if (file_exists($this->detect_switch->conf_dir())) { + $this->backup_dir($this->detect_switch->conf_dir(), 'fusionpbx_switch_config'); + $this->recursive_delete($this->detect_switch->conf_dir()); + } + //make sure the conf directory exists + if (!is_dir($this->detect_switch->conf_dir())) { + if (!mkdir($this->detect_switch->conf_dir(), 0774, true)) { + throw new Exception("Failed to create the switch conf directory '".$this->detect_switch->conf_dir()."'. "); + } + } + //copy resources/templates/conf to the freeswitch conf dir + if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')){ + $src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf"; + } + else { + $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf"; + } + $dst_dir = $this->detect_switch->conf_dir(); + if (is_readable($dst_dir)) { + $this->recursive_copy($src_dir, $dst_dir); + unset($src_dir, $dst_dir); + } + $fax_dir = join( DIRECTORY_SEPARATOR, array($this->detect_switch->storage_dir(), 'fax')); + if (!is_readable($fax_dir)) { mkdir($fax_dir,0777,true); } + $voicemail_dir = join( DIRECTORY_SEPARATOR, array($this->detect_switch->storage_dir(), 'voicemail')); + if (!is_readable($voicemail_dir)) { mkdir($voicemail_dir,0777,true); } + + //create the dialplan/default.xml for single tenant or dialplan/domain.xml + if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/dialplan")) { + $dialplan = new dialplan; + $dialplan->domain_uuid = $this->domain_uuid; + $dialplan->domain = $this->domain_name; + $dialplan->switch_dialplan_dir = join( DIRECTORY_SEPARATOR, array($this->detect_switch->conf_dir(), "/dialplan")); + $dialplan->restore_advanced_xml(); + if($this->_debug){ + print_r($dialplan->result, $message); + $this->write_debug($message); + } + } + + //write the xml_cdr.conf.xml file + if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/xml_cdr")) { + xml_cdr_conf_xml(); + } + + //write the switch.conf.xml file + if (file_exists($this->detect_switch->conf_dir())) { + switch_conf_xml(); + } + + } + + function copy_scripts() { + $this->write_progress("Copying Scripts"); + if (file_exists($this->detect_switch->script_dir())) { + if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){ + $src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts'; + } + else { + $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'; + } + $dst_dir = $this->detect_switch->script_dir(); + if (is_readable($this->detect_switch->script_dir())) { + $this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']); + unset($src_dir, $dst_dir); + } + chmod($dst_dir, 0774); + } + } + + } +?> \ No newline at end of file diff --git a/core/install/resources/classes/iso_countries.php b/core/install/resources/classes/iso_countries.php new file mode 100644 index 0000000000..3609754ab7 --- /dev/null +++ b/core/install/resources/classes/iso_countries.php @@ -0,0 +1,250 @@ + 'Afghanistan', + 'AX' => 'Aland Islands', + 'AL' => 'Albania', + 'DZ' => 'Algeria', + 'AS' => 'American Samoa', + 'AD' => 'Andorra', + 'AO' => 'Angola', + 'AI' => 'Anguilla', + 'AQ' => 'Antarctica', + 'AG' => 'Antigua And Barbuda', + 'AR' => 'Argentina', + 'AM' => 'Armenia', + 'AW' => 'Aruba', + 'AU' => 'Australia', + 'AT' => 'Austria', + 'AZ' => 'Azerbaijan', + 'BS' => 'Bahamas', + 'BH' => 'Bahrain', + 'BD' => 'Bangladesh', + 'BB' => 'Barbados', + 'BY' => 'Belarus', + 'BE' => 'Belgium', + 'BZ' => 'Belize', + 'BJ' => 'Benin', + 'BM' => 'Bermuda', + 'BT' => 'Bhutan', + 'BO' => 'Bolivia', + 'BA' => 'Bosnia And Herzegovina', + 'BW' => 'Botswana', + 'BV' => 'Bouvet Island', + 'BR' => 'Brazil', + 'IO' => 'British Indian Ocean Territory', + 'BN' => 'Brunei Darussalam', + 'BG' => 'Bulgaria', + 'BF' => 'Burkina Faso', + 'BI' => 'Burundi', + 'KH' => 'Cambodia', + 'CM' => 'Cameroon', + 'CA' => 'Canada', + 'CV' => 'Cape Verde', + 'KY' => 'Cayman Islands', + 'CF' => 'Central African Republic', + 'TD' => 'Chad', + 'CL' => 'Chile', + 'CN' => 'China', + 'CX' => 'Christmas Island', + 'CC' => 'Cocos (Keeling) Islands', + 'CO' => 'Colombia', + 'KM' => 'Comoros', + 'CG' => 'Congo', + 'CD' => 'Congo, Democratic Republic', + 'CK' => 'Cook Islands', + 'CR' => 'Costa Rica', + 'CI' => 'Cote D\'Ivoire', + 'HR' => 'Croatia', + 'CU' => 'Cuba', + 'CY' => 'Cyprus', + 'CZ' => 'Czech Republic', + 'DK' => 'Denmark', + 'DJ' => 'Djibouti', + 'DM' => 'Dominica', + 'DO' => 'Dominican Republic', + 'EC' => 'Ecuador', + 'EG' => 'Egypt', + 'SV' => 'El Salvador', + 'GQ' => 'Equatorial Guinea', + 'ER' => 'Eritrea', + 'EE' => 'Estonia', + 'ET' => 'Ethiopia', + 'FK' => 'Falkland Islands (Malvinas)', + 'FO' => 'Faroe Islands', + 'FJ' => 'Fiji', + 'FI' => 'Finland', + 'FR' => 'France', + 'GF' => 'French Guiana', + 'PF' => 'French Polynesia', + 'TF' => 'French Southern Territories', + 'GA' => 'Gabon', + 'GM' => 'Gambia', + 'GE' => 'Georgia', + 'DE' => 'Germany', + 'GH' => 'Ghana', + 'GI' => 'Gibraltar', + 'GR' => 'Greece', + 'GL' => 'Greenland', + 'GD' => 'Grenada', + 'GP' => 'Guadeloupe', + 'GU' => 'Guam', + 'GT' => 'Guatemala', + 'GG' => 'Guernsey', + 'GN' => 'Guinea', + 'GW' => 'Guinea-Bissau', + 'GY' => 'Guyana', + 'HT' => 'Haiti', + 'HM' => 'Heard Island & Mcdonald Islands', + 'VA' => 'Holy See (Vatican City State)', + 'HN' => 'Honduras', + 'HK' => 'Hong Kong', + 'HU' => 'Hungary', + 'IS' => 'Iceland', + 'IN' => 'India', + 'ID' => 'Indonesia', + 'IR' => 'Iran, Islamic Republic Of', + 'IQ' => 'Iraq', + 'IE' => 'Ireland', + 'IM' => 'Isle Of Man', + 'IL' => 'Israel', + 'IT' => 'Italy', + 'JM' => 'Jamaica', + 'JP' => 'Japan', + 'JE' => 'Jersey', + 'JO' => 'Jordan', + 'KZ' => 'Kazakhstan', + 'KE' => 'Kenya', + 'KI' => 'Kiribati', + 'KR' => 'Korea', + 'KW' => 'Kuwait', + 'KG' => 'Kyrgyzstan', + 'LA' => 'Lao People\'s Democratic Republic', + 'LV' => 'Latvia', + 'LB' => 'Lebanon', + 'LS' => 'Lesotho', + 'LR' => 'Liberia', + 'LY' => 'Libyan Arab Jamahiriya', + 'LI' => 'Liechtenstein', + 'LT' => 'Lithuania', + 'LU' => 'Luxembourg', + 'MO' => 'Macao', + 'MK' => 'Macedonia', + 'MG' => 'Madagascar', + 'MW' => 'Malawi', + 'MY' => 'Malaysia', + 'MV' => 'Maldives', + 'ML' => 'Mali', + 'MT' => 'Malta', + 'MH' => 'Marshall Islands', + 'MQ' => 'Martinique', + 'MR' => 'Mauritania', + 'MU' => 'Mauritius', + 'YT' => 'Mayotte', + 'MX' => 'Mexico', + 'FM' => 'Micronesia, Federated States Of', + 'MD' => 'Moldova', + 'MC' => 'Monaco', + 'MN' => 'Mongolia', + 'ME' => 'Montenegro', + 'MS' => 'Montserrat', + 'MA' => 'Morocco', + 'MZ' => 'Mozambique', + 'MM' => 'Myanmar', + 'NA' => 'Namibia', + 'NR' => 'Nauru', + 'NP' => 'Nepal', + 'NL' => 'Netherlands', + 'AN' => 'Netherlands Antilles', + 'NC' => 'New Caledonia', + 'NZ' => 'New Zealand', + 'NI' => 'Nicaragua', + 'NE' => 'Niger', + 'NG' => 'Nigeria', + 'NU' => 'Niue', + 'NF' => 'Norfolk Island', + 'MP' => 'Northern Mariana Islands', + 'NO' => 'Norway', + 'OM' => 'Oman', + 'PK' => 'Pakistan', + 'PW' => 'Palau', + 'PS' => 'Palestinian Territory, Occupied', + 'PA' => 'Panama', + 'PG' => 'Papua New Guinea', + 'PY' => 'Paraguay', + 'PE' => 'Peru', + 'PH' => 'Philippines', + 'PN' => 'Pitcairn', + 'PL' => 'Poland', + 'PT' => 'Portugal', + 'PR' => 'Puerto Rico', + 'QA' => 'Qatar', + 'RE' => 'Reunion', + 'RO' => 'Romania', + 'RU' => 'Russian Federation', + 'RW' => 'Rwanda', + 'BL' => 'Saint Barthelemy', + 'SH' => 'Saint Helena', + 'KN' => 'Saint Kitts And Nevis', + 'LC' => 'Saint Lucia', + 'MF' => 'Saint Martin', + 'PM' => 'Saint Pierre And Miquelon', + 'VC' => 'Saint Vincent And Grenadines', + 'WS' => 'Samoa', + 'SM' => 'San Marino', + 'ST' => 'Sao Tome And Principe', + 'SA' => 'Saudi Arabia', + 'SN' => 'Senegal', + 'RS' => 'Serbia', + 'SC' => 'Seychelles', + 'SL' => 'Sierra Leone', + 'SG' => 'Singapore', + 'SK' => 'Slovakia', + 'SI' => 'Slovenia', + 'SB' => 'Solomon Islands', + 'SO' => 'Somalia', + 'ZA' => 'South Africa', + 'GS' => 'South Georgia And Sandwich Isl.', + 'ES' => 'Spain', + 'LK' => 'Sri Lanka', + 'SD' => 'Sudan', + 'SR' => 'Suriname', + 'SJ' => 'Svalbard And Jan Mayen', + 'SZ' => 'Swaziland', + 'SE' => 'Sweden', + 'CH' => 'Switzerland', + 'SY' => 'Syrian Arab Republic', + 'TW' => 'Taiwan', + 'TJ' => 'Tajikistan', + 'TZ' => 'Tanzania', + 'TH' => 'Thailand', + 'TL' => 'Timor-Leste', + 'TG' => 'Togo', + 'TK' => 'Tokelau', + 'TO' => 'Tonga', + 'TT' => 'Trinidad And Tobago', + 'TN' => 'Tunisia', + 'TR' => 'Turkey', + 'TM' => 'Turkmenistan', + 'TC' => 'Turks And Caicos Islands', + 'TV' => 'Tuvalu', + 'UG' => 'Uganda', + 'UA' => 'Ukraine', + 'AE' => 'United Arab Emirates', + 'GB' => 'United Kingdom', + 'US' => 'United States', + 'UM' => 'United States Outlying Islands', + 'UY' => 'Uruguay', + 'UZ' => 'Uzbekistan', + 'VU' => 'Vanuatu', + 'VE' => 'Venezuela', + 'VN' => 'Viet Nam', + 'VG' => 'Virgin Islands, British', + 'VI' => 'Virgin Islands, U.S.', + 'WF' => 'Wallis And Futuna', + 'EH' => 'Western Sahara', + 'YE' => 'Yemen', + 'ZM' => 'Zambia', + 'ZW' => 'Zimbabwe', +); +?> \ No newline at end of file diff --git a/core/install/resources/page_parts/install_config_database.php b/core/install/resources/page_parts/install_config_database.php new file mode 100644 index 0000000000..ad8e632734 --- /dev/null +++ b/core/install/resources/page_parts/install_config_database.php @@ -0,0 +1,251 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane + Matthew Vale +*/ + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($db_type == "sqlite") { + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + if ($db_type == "mysql") { + + //set defaults + if (strlen($db_host) == 0) { $db_host = 'localhost'; } + if (strlen($db_port) == 0) { $db_port = '3306'; } + //if (strlen($db_name) == 0) { $db_name = 'fusionpbx'; } + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + } + + if ($db_type == "pgsql") { + if (strlen($db_host) == 0) { $db_host = 'localhost'; } + if (strlen($db_port) == 0) { $db_port = '5432'; } + if (strlen($db_name) == 0) { $db_name = 'fusionpbx'; } + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo "
".$text['header-config_database']." 
\n"; + echo " Database Filename\n"; + echo "\n"; + echo "
\n"; + echo " Set the database filename. The file extension should be '.db'.\n"; + echo "\n"; + echo "
\n"; + echo " Database Directory\n"; + echo "\n"; + echo "
\n"; + echo " Set the path to the database directory.\n"; + echo "
\n"; + echo " Database Host\n"; + echo "\n"; + echo "
\n"; + echo " Enter the host address for the database server.\n"; + echo "\n"; + echo "
\n"; + echo " Database Port\n"; + echo "\n"; + echo "
\n"; + echo " Enter the port number. It is optional if the database is using the default port.\n"; + echo "\n"; + echo "
\n"; + echo " Database Name\n"; + echo "\n"; + echo "
\n"; + echo " Enter the name of the database.\n"; + echo "\n"; + echo "
\n"; + echo " Database Username\n"; + echo "\n"; + echo "
\n"; + echo " Enter the database username. \n"; + echo "\n"; + echo "
\n"; + echo " Database Password\n"; + echo "\n"; + echo "
\n"; + echo " Enter the database password.\n"; + echo "\n"; + echo "
\n"; + echo " Create Database Username\n"; + echo "\n"; + echo "
\n"; + echo " Optional, this username is used to create the database, a database user and set the permissions. \n"; + echo " By default this username is 'root' however it can be any account with permission to add a database, user, and grant permissions. \n"; + echo "
\n"; + echo " Create Database Password\n"; + echo "\n"; + echo "
\n"; + echo " Enter the create database password.\n"; + echo "\n"; + echo "
\n"; + echo " Database Host\n"; + echo "\n"; + echo "
\n"; + echo " Enter the host address for the database server.\n"; + echo "\n"; + echo "
\n"; + echo " Database Port\n"; + echo "\n"; + echo "
\n"; + echo " Enter the port number. It is optional if the database is using the default port.\n"; + echo "\n"; + echo "
\n"; + echo " Database Name\n"; + echo "\n"; + echo "
\n"; + echo " Enter the name of the database.\n"; + echo "\n"; + echo "
\n"; + echo " Database Username\n"; + echo "\n"; + echo "
\n"; + echo " Enter the database username.\n"; + echo "\n"; + echo "
\n"; + echo " Database Password\n"; + echo "\n"; + echo "
\n"; + echo " Enter the database password.\n"; + echo "\n"; + echo "
\n"; + echo " Create Database Username\n"; + echo "\n"; + echo "
\n"; + echo " Optional, this username is used to create the database, a database user and set the permissions. \n"; + echo " By default this username is 'pgsql' however it can be any account with permission to add a database, user, and grant permissions. \n"; + echo " Leave blank if the user and empty database already exist and you do not want them created. \n"; + echo "
\n"; + echo " Create Database Password\n"; + echo "\n"; + echo "
\n"; + echo " Enter the create database password.\n"; + echo "\n"; + echo "
"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; +?> \ No newline at end of file diff --git a/core/install/resources/page_parts/install_config_detail.php b/core/install/resources/page_parts/install_config_detail.php new file mode 100644 index 0000000000..e59ddb1a80 --- /dev/null +++ b/core/install/resources/page_parts/install_config_detail.php @@ -0,0 +1,146 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane + Matthew Vale +*/ + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "
".$text['header-config_detail']." 
\n"; + echo " Username\n"; + echo "\n"; + echo "
\n"; + echo " Enter the username to use when logging in with the browser.
\n"; + echo "
\n"; + echo " Password\n"; + echo "\n"; + echo "
\n"; + echo " Enter the password to use when logging in with the browser.
\n"; + echo "
\n"; + echo " Country\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo " Select ISO country code used to initialize calling contry code variables.
\n"; + echo "
\n"; + echo " Theme: \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo " Select a theme to set as the default.
\n"; + echo "
\n"; + echo " Domain name\n"; + echo "\n"; + echo "
\n"; + echo " Enter the default domain name. \n"; + echo "\n"; + echo "
\n"; + echo " Database Type\n"; + echo "\n"; + echo "
\n"; + echo " Select the database type.\n"; + echo "\n"; + echo "
"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; +?> \ No newline at end of file diff --git a/core/install/resources/page_parts/install_event_socket.php b/core/install/resources/page_parts/install_event_socket.php new file mode 100644 index 0000000000..b191eb914e --- /dev/null +++ b/core/install/resources/page_parts/install_event_socket.php @@ -0,0 +1,101 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Matthew Vale +*/ + echo "

Detected Configuration

"; + //fetch the values + require_once "core/install/resources/classes/detect_switch.php"; + $switch_detect = new detect_switch($event_host, $event_port, $event_password); + //$switch_detect->event_port = 2021; + echo "
";
+	$detect_ok = true;
+	try {
+		$switch_detect->detect();
+	} catch(Exception $e){
+		echo "Failed to detect confgiuration detect_switch reported: " . $e->getMessage() . "\n";
+		$detect_ok = false;
+	}
+	if($detect_ok){
+		echo $switch_detect->show_config();
+	}
+	echo "
"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo " \n"; + echo " \n"; + echo " "; + + echo "
".$text['header-event_socket']."

"; + echo " \n"; + echo "
\n"; + echo " ".$text['label-event_host']."\n"; + echo "\n"; + echo " event_host."\" onchange='JavaScript:disable_next()'/>\n"; + echo "
\n"; + echo $text['description-event_host']."\n"; + echo "
\n"; + echo " ".$text['label-event_port']."\n"; + echo "\n"; + echo " event_port."\" onchange='JavaScript:disable_next()'/>\n"; + echo "
\n"; + echo $text['description-event_port']."\n"; + echo "
\n"; + echo " ".$text['label-event_password']."\n"; + echo "\n"; + echo " event_password."\" onchange='JavaScript:disable_next()'/>\n"; + echo "
\n"; + echo $text['description-event_password']."\n"; + echo "
\n"; + echo "
"; + echo "
"; + echo "
"; +?> \ No newline at end of file diff --git a/core/install/resources/page_parts/install_select_language.php b/core/install/resources/page_parts/install_select_language.php new file mode 100644 index 0000000000..bcb5628c53 --- /dev/null +++ b/core/install/resources/page_parts/install_select_language.php @@ -0,0 +1,69 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Matthew Vale +*/ + + echo "
\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "
".$text['header-select_language']."

"; + echo " \n"; + echo "
\n"; + echo " ".$text['label-select_language']."\n"; + echo "\n"; + echo "
"; + foreach($_SESSION['app']['languages'] as $lang_code){ + echo "
"; + echo " \n"; + echo "
"; + } + echo "
"; + echo "
\n"; + echo $text['description-select_language']."\n"; + echo "
"; + echo "

"; + echo "
"; +?> \ No newline at end of file diff --git a/core/install/root.php b/core/install/root.php new file mode 100644 index 0000000000..884d2b08a3 --- /dev/null +++ b/core/install/root.php @@ -0,0 +1,50 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +// make sure the PATH_SEPARATOR is defined + if (!defined("PATH_SEPARATOR")) { + if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + } + +// make sure the document_root is set + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); + //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; + //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; + //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + +// if the project directory exists then add it to the include path otherwise add the document root to the include path + if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ + if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } + set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); + } + else { + if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } + set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); + } + +?> \ No newline at end of file diff --git a/index.php b/index.php index 0e64a38080..d8b23953cb 100644 --- a/index.php +++ b/index.php @@ -41,7 +41,7 @@ include "root.php"; } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { //bsd } else { - header("Location: ".PROJECT_PATH."/resources/install.php"); + header("Location: ".PROJECT_PATH."/core/install/install_first_time.php"); exit; } diff --git a/themes/enhanced/app_defaults.php b/themes/enhanced/app_defaults.php index f08e217176..ed8a9dad06 100644 --- a/themes/enhanced/app_defaults.php +++ b/themes/enhanced/app_defaults.php @@ -182,24 +182,37 @@ if ($domains_processed == 1) { $array[$x]['default_setting_enabled'] = 'false'; $array[$x]['default_setting_description'] = 'Set the opacity of the main menu (decimal, Minimized theme only).'; - //iterate and add each, if necessary - foreach ($array as $index => $default_settings) { - //add theme default settings - $sql = "select count(*) as num_rows from v_default_settings "; - $sql .= "where default_setting_category = 'theme' "; - $sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' "; - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - unset($prep_statement); - if ($row['num_rows'] == 0) { - $orm = new orm; - $orm->name('default_settings'); - $orm->save($array[$index]); - $message = $orm->message; + if($set_session_theme){ + foreach ($array as $index => $default_settings) { + $sub_category = $array[$index]['default_setting_subcategory']; + $name = $array[$index]['default_setting_name']; + if($array[$index]['default_setting_enabled'] == 'true'){ + $_SESSION['theme'][$sub_category][$name] = $array[$index]['default_setting_value']; + }else{ + $_SESSION['theme'][$sub_category][$name] = ''; + } + } + } + else{ + //iterate and add each, if necessary + foreach ($array as $index => $default_settings) { + //add theme default settings + $sql = "select count(*) as num_rows from v_default_settings "; + $sql .= "where default_setting_category = 'theme' "; + $sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] == 0) { + $orm = new orm; + $orm->name('default_settings'); + $orm->save($array[$index]); + $message = $orm->message; + } + unset($row); } - unset($row); } } @@ -222,25 +235,37 @@ if ($domains_processed == 1) { $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_description'] = 'Set a secondary background (HTML compatible) color, for a gradient effect.'; - //add secondary background color separately, if missing - $sql = "select count(*) as num_rows from v_default_settings "; - $sql .= "where default_setting_category = 'theme' "; - $sql .= "and default_setting_subcategory = 'background_color' "; - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - unset($prep_statement); - if ($row['num_rows'] == 0) { - $orm = new orm; - $orm->name('default_settings'); - foreach ($array as $index => $null) { - $orm->save($array[$index]); + if($set_session_theme){ + foreach ($array as $index => $default_settings) { + $sub_category = $array[$index]['default_setting_subcategory']; + $idx = $array[$index]['default_setting_order']; + if($array[$index]['default_setting_enabled'] == 'true'){ + $_SESSION['theme'][$sub_category][$idx] = $array[$index]['default_setting_value']; } - $message = $orm->message; - //print_r($message); } - unset($row); + return; + } + else{ + //add secondary background color separately, if missing + $sql = "select count(*) as num_rows from v_default_settings "; + $sql .= "where default_setting_category = 'theme' "; + $sql .= "and default_setting_subcategory = 'background_color' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] == 0) { + $orm = new orm; + $orm->name('default_settings'); + foreach ($array as $index => $null) { + $orm->save($array[$index]); + } + $message = $orm->message; + //print_r($message); + } + unset($row); + } } //get the background images From 9c1277f85cbb1c5f5ee9cb4b19a30e4465eb8470 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 17 Nov 2015 17:02:05 +0000 Subject: [PATCH 028/232] removed old installers --- resources/classes/install.php | 207 ---- resources/install.php | 2113 --------------------------------- 2 files changed, 2320 deletions(-) delete mode 100644 resources/classes/install.php delete mode 100644 resources/install.php diff --git a/resources/classes/install.php b/resources/classes/install.php deleted file mode 100644 index a6b2d210b4..0000000000 --- a/resources/classes/install.php +++ /dev/null @@ -1,207 +0,0 @@ - - Copyright (C) 2010-2015 - All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -include "root.php"; - -//define the install class - class install { - - var $result; - var $domain_uuid; - var $domain; - var $switch_conf_dir; - var $switch_scripts_dir; - var $switch_sounds_dir; - - //$options '-n' --no-clobber - public function recursive_copy($src, $dst, $options = '') { - if (file_exists('/bin/cp')) { - if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') { - //copy -R recursive, preserve attributes for SUN - $cmd = 'cp -Rp '.$src.'/* '.$dst; - } else { - //copy -R recursive, -L follow symbolic links, -p preserve attributes for other Posix systemss - $cmd = 'cp -RLp '.$options.' '.$src.'/* '.$dst; - } - exec ($cmd); - //echo $cmd."\n"; - } - else { - $dir = opendir($src); - if (!$dir) { - if (!mkdir($src, 0755, true)) { - throw new Exception("recursive_copy() source directory '".$src."' does not exist."); - } - } - if (!is_dir($dst)) { - if (!mkdir($dst, 0755, true)) { - throw new Exception("recursive_copy() failed to create destination directory '".$dst."'"); - } - } - $scripts_dir_target = $_SESSION['switch']['scripts']['dir']; - $scripts_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'); - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src)) as $file_path_source) { - if ( - substr_count($file_path_source, '/..') == 0 && - substr_count($file_path_source, '/.') == 0 && - substr_count($file_path_source, '/.svn') == 0 && - substr_count($file_path_source, '/.git') == 0 - ) { - if ($dst != $src.'/resources/config.lua') { - //echo $file_path_source.' ---> '.$dst.'
'; - copy($file_path_source, $dst); - chmod($dst, 0755); - } - } - } - - while(false !== ($file = readdir($dir))) { - if (($file != '.') && ($file != '..')) { - if (is_dir($src.'/'.$file)) { - $this->recursive_copy($src.'/'.$file, $dst.'/'.$file); - } - else { - //copy only missing files -n --no-clobber - if (strpos($options,'-n') !== false) { - if (!file_exists($dst.'/'.$file)) { - copy($src.'/'.$file, $dst.'/'.$file); - //echo "copy(".$src."/".$file.", ".$dst."/".$file.");
\n"; - } - } - else { - copy($src.'/'.$file, $dst.'/'.$file); - } - } - } - } - closedir($dir); - } - } - - function recursive_delete($dir) { - if (file_exists('/bin/rm')) { - exec ('rm -Rf '.$dir.'/*'); - } - else { - foreach (glob($dir) as $file) { - if (is_dir($file)) { - $this->recursive_delete("$file/*"); - rmdir($file); - //echo "rm dir: ".$file."\n"; - } else { - //echo "delete file: ".$file."\n"; - unlink($file); - } - } - } - clearstatcache(); - } - - function copy() { - $this->copy_scripts(); - //$this->copy_sounds(); - } - - function copy_conf() { - if (file_exists($this->switch_conf_dir)) { - //make a backup copy of the conf directory - $src_dir = $this->switch_conf_dir; - $dst_dir = $this->switch_conf_dir.'.orig'; - if (is_readable($src_dir)) { - $this->recursive_copy($src_dir, $dst_dir); - $this->recursive_delete($src_dir); - } - else { - if ($src_dir != "/conf") { - mkdir($src_dir, 0774, true); - } - } - //make sure the conf directory exists - if (!is_dir($this->switch_conf_dir)) { - if (!mkdir($this->switch_conf_dir, 0774, true)) { - throw new Exception("Failed to create the switch conf directory '".$this->switch_conf_dir."'. "); - } - } - //copy resources/templates/conf to the freeswitch conf dir - if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')){ - $src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf"; - } - else { - $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf"; - } - $dst_dir = $this->switch_conf_dir; - if (is_readable($dst_dir)) { - $this->recursive_copy($src_dir, $dst_dir); - } - //print_r($install->result); - } - } - // added /examples/ into the string - function copy_scripts() { - if (file_exists($this->switch_scripts_dir)) { - if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){ - $src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts'; - } - else { - $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'; - } - $dst_dir = $this->switch_scripts_dir; - if (is_readable($this->switch_scripts_dir)) { - $this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']); - unset($src_dir, $dst_dir); - } - chmod($dst_dir, 0774); - } - } - - //function copy_sounds() { - // if (file_exists($this->switch_sounds_dir)) { - // if (file_exists('/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/')){ - // $src_dir = '/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/'; - // changes the output dir for testing - // $dst_dir = $this->switch_sounds_dir.'/en/us/fusionpbx/custom/'; - // } - // else { - // $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sounds/en/us/callie/custom/'; - // $dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/'; - // } - // $this->recursive_copy($src_dir, $dst_dir, "-n"); - // if (is_readable($this->switch_sounds_dir)) { - // $this->recursive_copy($src_dir, $dst_dir); - // chmod($dst_dir, 0664); - // } - // } - //} - } - -//how to use the class - //$install = new install; - //$install->domain_uuid = $domain_uuid; - //$install->switch_conf_dir = $switch_conf_dir; - //$install->switch_scripts_dir = $switch_scripts_dir; - //$install->switch_sounds_dir = $switch_sounds_dir; - //$install->copy(); - //print_r($install->result); -?> \ No newline at end of file diff --git a/resources/install.php b/resources/install.php deleted file mode 100644 index 5680e4162d..0000000000 --- a/resources/install.php +++ /dev/null @@ -1,2113 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2014 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -include "root.php"; -require_once "resources/functions.php"; - -//include required classes - require_once "resources/classes/text.php"; - -//set debug to true or false - $v_debug = true; - -//set the default domain_uuid - $_SESSION["domain_uuid"] = uuid(); - -//add the menu uuid - $menu_uuid = 'b4750c3f-2a86-b00d-b7d0-345c14eca286'; - -//error reporting - ini_set('display_errors', '1'); - //error_reporting (E_ALL); // Report everything - error_reporting (E_ALL ^ E_NOTICE); // Report everything - //error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings - -//set the default time zone - date_default_timezone_set('UTC'); - -//if the config file exists then disable the install page - $config_exists = false; - if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { - $config_exists = true; - } elseif (file_exists("/etc/fusionpbx/config.php")) { - //linux - $config_exists = true; - } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { - $config_exists = true; - } - if ($config_exists) { - $msg .= "Already Installed"; - header("Location: ".PROJECT_PATH."/index.php?msg=".urlencode($msg)); - exit; - } - -//set the max execution time to 1 hour - ini_set('max_execution_time',3600); - -//save an install log if debug is true - if ($v_debug) { - $fp = fopen(sys_get_temp_dir()."/install.log", "w"); - } - -//set php variables with data from http post - $db_type = $_POST["db_type"]; - $admin_username = $_POST["admin_username"]; - $admin_password = $_POST["admin_password"]; - $db_name = $_POST["db_name"]; - $db_host = $_POST["db_host"]; - $db_port = $_POST["db_port"]; - $db_name = $_POST["db_name"]; - $domain_name = $_POST["domain_name"]; - $db_username = $_POST["db_username"]; - $db_password = $_POST["db_password"]; - $db_create_username = $_POST["db_create_username"]; - $db_create_password = $_POST["db_create_password"]; - $db_path = $_POST["db_path"]; - $install_step = $_POST["install_step"]; - $install_tmp_dir = $_POST["install_tmp_dir"]; - $install_backup_dir = $_POST["install_backup_dir"]; - $install_switch_base_dir = $_POST["install_switch_base_dir"]; - $install_default_country = $_POST["install_default_country"]; - $install_template_name = $_POST["install_template_name"]; - - if(!$domain_name){ - //get the domain - $domain_array = explode(":", $_SERVER["HTTP_HOST"]); - $domain_name = $domain_array[0]; - } - -//clean up the values - if (strlen($install_switch_base_dir) > 0) { - $install_switch_base_dir = realpath($install_switch_base_dir); - $install_switch_base_dir = str_replace("\\", "/", $install_switch_base_dir); - } - - $install_tmp_dir = realpath($_POST["install_tmp_dir"]); - $install_tmp_dir = str_replace("\\", "/", $install_tmp_dir); - - $install_backup_dir = realpath($_POST["install_backup_dir"]); - $install_backup_dir = str_replace("\\", "/", $install_backup_dir); - -//set the default db_name - if ($db_type == "sqlite") { - if (strlen($db_name) == 0) { $db_name = "fusionpbx.db"; } - } - -//set the required directories - - //set the freeswitch bin directory - if (file_exists('/usr/local/freeswitch/bin')) { - $install_switch_base_dir = '/usr/local/freeswitch'; - $switch_bin_dir = '/usr/local/freeswitch/bin'; - } - if (file_exists('/opt/freeswitch')) { - $install_switch_base_dir = '/opt/freeswitch'; - $switch_bin_dir = '/opt/freeswitch/bin'; - } - - //set the default startup script directory - if (file_exists('/usr/local/etc/rc.d')) { - $startup_script_dir = '/usr/local/etc/rc.d'; - } - if (file_exists('/etc/init.d')) { - $startup_script_dir = '/etc/init.d'; - } - - //set the default directories - $switch_bin_dir = $install_switch_base_dir.'/bin'; //freeswitch bin directory - $switch_conf_dir = $install_switch_base_dir.'/conf'; - $switch_db_dir = $install_switch_base_dir.'/db'; - $switch_log_dir = $install_switch_base_dir.'/log'; - $switch_mod_dir = $install_switch_base_dir.'/mod'; - $switch_extensions_dir = $switch_conf_dir.'/directory'; - $switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles'; - $switch_dialplan_dir = $switch_conf_dir.'/dialplan'; - $switch_scripts_dir = $install_switch_base_dir.'/scripts'; - $switch_grammar_dir = $install_switch_base_dir.'/grammar'; - $switch_storage_dir = $install_switch_base_dir.'/storage'; - $switch_voicemail_dir = $install_switch_base_dir.'/storage/voicemail'; - $switch_recordings_dir = $install_switch_base_dir.'/recordings'; - $switch_sounds_dir = $install_switch_base_dir.'/sounds'; - $install_tmp_dir = realpath(sys_get_temp_dir()); - $install_backup_dir = realpath(sys_get_temp_dir()); - $v_download_path = ''; - - //set specific alternative directories as required - switch (PHP_OS) { - case "Linux": - //set the default db_path - if (strlen($db_path) == 0) { - if (file_exists('/var/lib/fusionpbx/db')) { - $db_path = '/var/lib/fusionpbx/db'; - } - } - //set the other default directories - if (file_exists('/usr/bin')) { - $switch_bin_dir = '/usr/bin'; //freeswitch bin directory - } - //new - if (file_exists('/etc/fusionpbx/switch/conf')) { - $switch_conf_dir = '/etc/fusionpbx/switch/conf'; - $switch_extensions_dir = $switch_conf_dir.'/directory'; - $switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles'; - $switch_dialplan_dir = $switch_conf_dir.'/dialplan'; - } - //old - //if (file_exists('/etc/freeswitch/vars.xml')) { - // $switch_conf_dir = '/etc/freeswitch'; - // $switch_extensions_dir = $switch_conf_dir.'/directory'; - // $switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles'; - // $switch_dialplan_dir = $switch_conf_dir.'/dialplan'; - //} - if (file_exists('/var/lib/freeswitch/db')) { - $switch_db_dir = '/var/lib/freeswitch/db'; - } - if (file_exists('/var/log/freeswitch')) { - $switch_log_dir = '/var/log/freeswitch'; - } - if (file_exists('/usr/lib/freeswitch/mod')) { - $switch_mod_dir = '/usr/lib/freeswitch/mod'; - } - //new - if (file_exists('/var/lib/fusionpbx/scripts')) { - $switch_scripts_dir = '/var/lib/fusionpbx/scripts'; - } - //old - //if (file_exists('/usr/share/freeswitch/scripts')) { - // $switch_scripts_dir = '/usr/share/freeswitch/scripts'; - //} - //new - if (file_exists('/usr/share/freeswitch/grammar')) { - $switch_grammar_dir = '/usr/share/freeswitch/grammar'; - } - //old - //if (file_exists('/usr/share/freeswitch/grammar')) { - // $switch_grammar_dir = '/usr/share/freeswitch/grammar'; - //} - //new - if (file_exists('/var/lib/fusionpbx/storage')) { - $switch_storage_dir = '/var/lib/fusionpbx/storage'; - $switch_voicemail_dir = $switch_storage_dir.'/voicemail'; - } - //old - //if (file_exists('/var/lib/freeswitch/storage')) { - // $switch_storage_dir = '/var/lib/freeswitch/storage'; - // $switch_voicemail_dir = $switch_storage_dir.'/voicemail'; - //} - //new - if (file_exists('/var/lib/fusionpbx/recordings')) { - $switch_recordings_dir = '/var/lib/fusionpbx/recordings'; - } - //old - //if (file_exists('/var/lib/freeswitch/recordings')) { - // $switch_recordings_dir = '/var/lib/freeswitch/recordings'; - //} - if (file_exists('/usr/share/freeswitch/sounds')) { - $switch_sounds_dir = '/usr/share/freeswitch/sounds'; - } - break; - case "FreeBSD": - //if the FreeBSD port is installed use the following paths by default. - if (file_exists('/var/db/freeswitch')) { - //FreeBSD port - //set the default db_path - if (strlen($db_path) == 0) { - $db_path = '/var/db/fusionpbx'; - if (!is_readable($db_path)) { mkdir($db_path,0774,true); } - } - //set the other default directories - $switch_bin_dir = '/usr/local/bin'; //freeswitch bin directory - $switch_conf_dir = '/usr/local/etc/freeswitch'; - $switch_db_dir = '/var/db/freeswitch'; - $switch_log_dir = '/var/log/freeswitch'; - $switch_mod_dir = '/usr/local/lib/freeswitch/mod'; - $switch_extensions_dir = $switch_conf_dir.'/directory'; - $switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles'; - $switch_dialplan_dir = $switch_conf_dir.'/dialplan'; - $switch_scripts_dir = '/var/cache/freeswitch/scripts'; - $switch_grammar_dir = '/usr/local/share/freeswitch/grammar'; - $switch_storage_dir = '/var/cache/freeswitch/storage'; - $switch_recordings_dir = '/var/cache/freeswitch/recordings'; - $switch_sounds_dir = '/usr/local/share/freeswitch/sounds'; - } - elseif (file_exists('/data/freeswitch')) { - //FreeBSD embedded - //set the default db_path - if (strlen($db_path) == 0) { - $db_path = '/data/db/fusionpbx'; - if (!is_readable($db_path)) { mkdir($db_path,0777,true); } - } - //set the other default directories - $switch_bin_dir = '/usr/local/bin'; //freeswitch bin directory - $switch_conf_dir = '/usr/local/etc/freeswitch/conf'; - $switch_db_dir = '/data/freeswitch/db'; - if (is_readable('/var/log/freeswitch')) { - $switch_log_dir = '/var/log/freeswitch'; - } - else { - $switch_log_dir = '/data/freeswitch/log'; - } - $switch_mod_dir = '/usr/local/lib/freeswitch/mod'; - $switch_extensions_dir = $switch_conf_dir.'/directory'; - $switch_sip_profiles_dir = $switch_conf_dir.'/sip_profiles'; - $switch_dialplan_dir = $switch_conf_dir.'/dialplan'; - $switch_scripts_dir = '/usr/local/etc/freeswitch/scripts'; - $switch_grammar_dir = '/usr/local/etc/freeswitch/grammar'; - $switch_storage_dir = '/data/freeswitch'; - $switch_voicemail_dir = '/data/freeswitch/voicemail'; - $switch_recordings_dir = '/data/freeswitch/recordings'; - $switch_sounds_dir = '/data/freeswitch/sounds'; - } - else { - //set the default db_path - if (strlen($db_path) == 0) { - $db_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/secure'; - } - } - break; - case "NetBSD": - $startup_script_dir = ''; - //set the default db_path - if (strlen($db_path) == 0) { - $db_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/secure'; - } - break; - case "OpenBSD": - $startup_script_dir = ''; - //set the default db_path - if (strlen($db_path) == 0) { - $db_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/secure'; - } - break; - default: - //set the default db_path - if (strlen($db_path) == 0) { - $db_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/secure'; - } - } - // - // CYGWIN_NT-5.1 - // Darwin - // FreeBSD - // HP-UX - // IRIX64 - // Linux - // NetBSD - // OpenBSD - // SunOS - // Unix - // WIN32 - // WINNT - // Windows - // CYGWIN_NT-5.1 - // IRIX64 - // SunOS - // HP-UX - // OpenBSD (not in Wikipedia) - - //set the dir defaults for windows - if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { - if (substr($_SERVER["DOCUMENT_ROOT"], -3) == "www") { - //integrated installer - $install_switch_base_dir = realpath($_SERVER["DOCUMENT_ROOT"]."/.."); - $startup_script_dir = ''; - } elseif (is_readable('C:/program files/FreeSWITCH')) { - $install_switch_base_dir = 'C:/program files/FreeSWITCH'; - $startup_script_dir = ''; - } elseif (is_readable('D:/program files/FreeSWITCH')) { - $install_switch_base_dir = 'D:/program files/FreeSWITCH'; - $startup_script_dir = ''; - } elseif (is_readable('E:/program files/FreeSWITCH')) { - $install_switch_base_dir = 'E:/program files/FreeSWITCH'; - $startup_script_dir = ''; - } elseif (is_readable('F:/program files/FreeSWITCH')) { - $install_switch_base_dir = 'F:/program files/FreeSWITCH'; - $startup_script_dir = ''; - } elseif (is_readable('C:/FreeSWITCH')) { - $install_switch_base_dir = 'C:/FreeSWITCH'; - $startup_script_dir = ''; - } elseif (is_readable('D:/FreeSWITCH')) { - $install_switch_base_dir = 'D:/FreeSWITCH'; - $startup_script_dir = ''; - } elseif (is_readable('E:/FreeSWITCH')) { - $install_switch_base_dir = 'E:/FreeSWITCH'; - $startup_script_dir = ''; - } elseif (is_readable('F:/FreeSWITCH')) { - $install_switch_base_dir = 'F:/FreeSWITCH'; - $startup_script_dir = ''; - } - } -$msg = ''; -if ($_POST["install_step"] == "2" && count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { - //check for all required data - if (strlen($admin_username) == 0) { $msg .= "Please provide the Admin Username
\n"; } - if (strlen($admin_password) == 0) { - $msg .= "Please provide the Admin Password
\n"; - } - else { - if (strlen($admin_password) < 5) { - $msg .= "Please provide an Admin Password that is 5 or more characters.
\n"; - } - } - //define the step to return to - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { - $_POST["install_step"] = ""; - } -} -if ($_POST["install_step"] == "3" && count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { - //check for all required data - if (strlen($db_type) == 0) { $msg .= "Please provide the Database Type
\n"; } - if (PHP_OS == "FreeBSD" && file_exists('/usr/local/etc/freeswitch/conf')) { - //install_switch_base_dir not required for the freebsd freeswitch port; - } - if (strlen($install_tmp_dir) == 0) { $msg .= "Please provide the Temp Directory.
\n"; } - if (strlen($install_backup_dir) == 0) { $msg .= "Please provide the Backup Directory.
\n"; } - if (strlen($install_template_name) == 0) { $msg .= "Please provide the Theme.
\n"; } - //define the step to return to - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { - $_POST["install_step"] = "2"; - } -} -//show the error message if one exists - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { - require_once "resources/persist_form_var.php"; - echo "
\n"; - echo "
\n"; - echo "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - exit; - } - -if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { - - //generate the config.php - $tmp_config = ""; - - if (is_dir("/etc/fusionpbx")){ - $config = "/etc/fusionpbx/config.php"; - } elseif (is_dir("/usr/local/etc/fusionpbx")){ - $config = "/usr/local/etc/fusionpbx/config.php"; - } - elseif (is_dir($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources")) { - $config = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/config.php"; - } - else { - $config = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/config.php"; - } - $fout = fopen($config,"w"); - fwrite($fout, $tmp_config); - unset($tmp_config); - fclose($fout); - - //include the new config.php file - require $config; - - //create the sqlite database - if ($db_type == "sqlite") { - //sqlite database will be created when the config.php is loaded and only if the database file does not exist - try { - $db_tmp = new PDO('sqlite:'.$db_path.'/'.$db_name); //sqlite 3 - //$db_tmp = new PDO('sqlite::memory:'); //sqlite 3 - } - catch (PDOException $error) { - print "error: " . $error->getMessage() . "
"; - die(); - } - - //add additional functions to SQLite - bool PDO::sqliteCreateFunction ( string function_name, callback callback [, int num_args] ) - if (!function_exists('php_now')) { - function php_now() { - if(function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) { - @date_default_timezone_set(@date_default_timezone_get()); - } - return date("Y-m-d H:i:s"); - } - } - $db_tmp->sqliteCreateFunction('now', 'php_now', 0); - - //add the database structure - require_once "resources/classes/schema.php"; - $schema = new schema; - $schema->db = $db_tmp; - $schema->db_type = $db_type; - $schema->sql(); - $schema->exec(); - - //get the contents of the sql file - if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/sqlite.sql')){ - $filename = "/usr/share/examples/fusionpbx/resources/install/sql/sqlite.sql"; - } - else { - $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/sqlite.sql'; - } - $file_contents = file_get_contents($filename); - unset($filename); - - //replace \r\n with \n then explode on \n - $file_contents = str_replace("\r\n", "\n", $file_contents); - - //loop line by line through all the lines of sql code - $db_tmp->beginTransaction(); - $string_array = explode("\n", $file_contents); - $x = 0; - foreach($string_array as $sql) { - try { - $db_tmp->query($sql); - } - catch (PDOException $error) { - echo "error: " . $error->getMessage() . " sql: $sql
"; - //die(); - } - $x++; - } - unset ($file_contents, $sql); - $db_tmp->commit(); - - //set the file permissions - chmod($db_path.'/'.$db_name, 0777); - } - - //create the pgsql database - if ($db_type == "pgsql") { - - //echo "DB Name: {$db_name}
"; - //echo "DB Host: {$db_host}
"; - //echo "DB User: {$db_username}
"; - //echo "DB Pass: {$db_password}
"; - //echo "DB Port: {$db_port}
"; - //echo "DB Create User: {$db_create_username}
"; - //echo "DB Create Pass: {$db_create_password}
"; - - //if $db_create_username provided, attempt to create new PG role and database - if (strlen($db_create_username) > 0) { - try { - if (strlen($db_port) == 0) { $db_port = "5432"; } - if (strlen($db_host) > 0) { - $db_tmp = new PDO("pgsql:host={$db_host} port={$db_port} user={$db_create_username} password={$db_create_password} dbname=template1"); - } else { - $db_tmp = new PDO("pgsql:host=localhost port={$db_port} user={$db_create_username} password={$db_create_password} dbname=template1"); - } - } catch (PDOException $error) { - print "error: " . $error->getMessage() . "
"; - die(); - } - - //create the database, user, grant perms - $db_tmp->exec("CREATE DATABASE {$db_name}"); - $db_tmp->exec("CREATE USER {$db_username} WITH PASSWORD '{$db_password}'"); - $db_tmp->exec("GRANT ALL ON {$db_name} TO {$db_username}"); - - //close database connection_aborted - $db_tmp = null; - } - - //open database connection with $db_name - try { - if (strlen($db_port) == 0) { $db_port = "5432"; } - if (strlen($db_host) > 0) { - $db_tmp = new PDO("pgsql:host={$db_host} port={$db_port} dbname={$db_name} user={$db_username} password={$db_password}"); - } else { - $db_tmp = new PDO("pgsql:host=localhost port={$db_port} user={$db_username} password={$db_password} dbname={$db_name}"); - } - } - catch (PDOException $error) { - print "error: " . $error->getMessage() . "
"; - die(); - } - - //add the database structure - require_once "resources/classes/schema.php"; - $schema = new schema; - $schema->db = $db_tmp; - $schema->db_type = $db_type; - $schema->sql(); - $schema->exec(); - - //get the contents of the sql file - if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql')){ - $filename = "/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql"; - } - else { - $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql'; - } - $file_contents = file_get_contents($filename); - - //replace \r\n with \n then explode on \n - $file_contents = str_replace("\r\n", "\n", $file_contents); - - //loop line by line through all the lines of sql code - $string_array = explode("\n", $file_contents); - $x = 0; - foreach($string_array as $sql) { - if (strlen($sql) > 3) { - try { - $db_tmp->query($sql); - } - catch (PDOException $error) { - echo "error: " . $error->getMessage() . " sql: $sql
"; - die(); - } - } - $x++; - } - unset ($file_contents, $sql); - } - - //create the mysql database - if ($db_type == "mysql") { - //database connection - try { - if (strlen($db_host) == 0 && strlen($db_port) == 0) { - //if both host and port are empty use the unix socket - if (strlen($db_create_username) == 0) { - $db_tmp = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $db_username, $db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - else { - $db_tmp = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $db_create_username, $db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - } - else { - if (strlen($db_port) == 0) { - //leave out port if it is empty - if (strlen($db_create_username) == 0) { - $db_tmp = new PDO("mysql:host=$db_host;", $db_username, $db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - else { - $db_tmp = new PDO("mysql:host=$db_host;", $db_create_username, $db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } - } - else { - if (strlen($db_create_username) == 0) { - $db_tmp = new PDO("mysql:host=$db_host;port=$db_port;", $db_username, $db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - else { - $db_tmp = new PDO("mysql:host=$db_host;port=$db_port;", $db_create_username, $db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - } - } - $db_tmp->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $db_tmp->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); - } - catch (PDOException $error) { - if ($v_debug) { - print "error: " . $error->getMessage() . "
"; - } - } - - //create the table, user and set the permissions only if the db_create_username was provided - if (strlen($db_create_username) > 0) { - //select the mysql database - try { - $db_tmp->query("USE mysql;"); - } - catch (PDOException $error) { - if ($v_debug) { - print "error: " . $error->getMessage() . "
"; - } - } - - //create user and set the permissions - try { - $tmp_sql = "CREATE USER '".$db_username."'@'%' IDENTIFIED BY '".$db_password."'; "; - $db_tmp->query($tmp_sql); - } - catch (PDOException $error) { - if ($v_debug) { - print "error: " . $error->getMessage() . "
"; - } - } - - //set account to unlimited use - try { - if ($db_host == "localhost" || $db_host == "127.0.0.1") { - $tmp_sql = "GRANT USAGE ON * . * TO '".$db_username."'@'localhost' "; - $tmp_sql .= "IDENTIFIED BY '".$db_password."' "; - $tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; "; - $db_tmp->query($tmp_sql); - - $tmp_sql = "GRANT USAGE ON * . * TO '".$db_username."'@'127.0.0.1' "; - $tmp_sql .= "IDENTIFIED BY '".$db_password."' "; - $tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; "; - $db_tmp->query($tmp_sql); - } - else { - $tmp_sql = "GRANT USAGE ON * . * TO '".$db_username."'@'".$db_host."' "; - $tmp_sql .= "IDENTIFIED BY '".$db_password."' "; - $tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; "; - $db_tmp->query($tmp_sql); - } - } - catch (PDOException $error) { - if ($v_debug) { - print "error: " . $error->getMessage() . "
"; - } - } - - //create the database and set the create user with permissions - try { - $tmp_sql = "CREATE DATABASE IF NOT EXISTS ".$db_name."; "; - $db_tmp->query($tmp_sql); - } - catch (PDOException $error) { - if ($v_debug) { - print "error: " . $error->getMessage() . "
"; - } - } - - //set user permissions - try { - $db_tmp->query("GRANT ALL PRIVILEGES ON ".$db_name.".* TO '".$db_username."'@'%'; "); - } - catch (PDOException $error) { - if ($v_debug) { - print "error: " . $error->getMessage() . "
"; - } - } - - //make the changes active - try { - $tmp_sql = "FLUSH PRIVILEGES; "; - $db_tmp->query($tmp_sql); - } - catch (PDOException $error) { - if ($v_debug) { - print "error: " . $error->getMessage() . "
"; - } - } - - } //if (strlen($db_create_username) > 0) - - //select the database - try { - $db_tmp->query("USE ".$db_name.";"); - } - catch (PDOException $error) { - if ($v_debug) { - print "error: " . $error->getMessage() . "
"; - } - } - - //add the database structure - require_once "resources/classes/schema.php"; - $schema = new schema; - $schema->db = $db_tmp; - $schema->db_type = $db_type; - $schema->sql(); - $schema->exec(); - - //add the defaults data into the database - //get the contents of the sql file - if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/mysql.sql')){ - $filename = "/usr/share/examples/fusionpbx/resources/install/sql/mysql.sql"; - } - else { - $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/mysql.sql'; - } - $file_contents = file_get_contents($filename); - - //replace \r\n with \n then explode on \n - $file_contents = str_replace("\r\n", "\n", $file_contents); - - //loop line by line through all the lines of sql code - $string_array = explode("\n", $file_contents); - $x = 0; - foreach($string_array as $sql) { - if (strlen($sql) > 3) { - try { - if ($v_debug) { - fwrite($fp, $sql."\n"); - } - $db_tmp->query($sql); - } - catch (PDOException $error) { - //echo "error on line $x: " . $error->getMessage() . " sql: $sql
"; - //die(); - } - } - $x++; - } - unset ($file_contents, $sql); - } - - //replace back slashes with forward slashes - $install_switch_base_dir = str_replace("\\", "/", $install_switch_base_dir); - $startup_script_dir = str_replace("\\", "/", $startup_script_dir); - $install_tmp_dir = str_replace("\\", "/", $install_tmp_dir); - $install_backup_dir = str_replace("\\", "/", $install_backup_dir); - - //add the domain - $sql = "insert into v_domains "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "domain_name, "; - $sql .= "domain_description "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$_SESSION["domain_uuid"]."', "; - $sql .= "'".$domain_name."', "; - $sql .= "'' "; - $sql .= ");"; - if ($v_debug) { - fwrite($fp, $sql."\n"); - } - $db_tmp->exec(check_sql($sql)); - unset($sql); - - //get the web server protocol - //$install_server_protocol = $_SERVER["SERVER_PORT"]; - //$server_protocol_array = explode('/', $_SERVER["SERVER_PROTOCOL"]); - //$install_server_protocol = strtolower($server_protocol[0]); - //unset($server_protocol_array); - - //add the default settings - $x = 0; - $tmp[$x]['name'] = 'uuid'; - $tmp[$x]['value'] = $menu_uuid; - $tmp[$x]['category'] = 'domain'; - $tmp[$x]['subcategory'] = 'menu'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'name'; - $tmp[$x]['category'] = 'domain'; - $tmp[$x]['subcategory'] = 'time_zone'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'code'; - $tmp[$x]['value'] = 'en-us'; - $tmp[$x]['category'] = 'domain'; - $tmp[$x]['subcategory'] = 'language'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'iso_code'; - $tmp[$x]['value'] = $install_default_country; - $tmp[$x]['category'] = 'domain'; - $tmp[$x]['subcategory'] = 'country'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'name'; - $tmp[$x]['value'] = $install_template_name; - $tmp[$x]['category'] = 'domain'; - $tmp[$x]['subcategory'] = 'template'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $install_tmp_dir; - $tmp[$x]['category'] = 'server'; - $tmp[$x]['subcategory'] = 'temp'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $startup_script_dir; - $tmp[$x]['category'] = 'server'; - $tmp[$x]['subcategory'] = 'startup_script'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $install_backup_dir; - $tmp[$x]['category'] = 'server'; - $tmp[$x]['subcategory'] = 'backup'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_bin_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'bin'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $install_switch_base_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'base'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_conf_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'conf'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_db_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'db'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_log_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'log'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_extensions_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'extensions'; - $tmp[$x]['enabled'] = 'false'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_sip_profiles_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'sip_profiles'; - $tmp[$x]['enabled'] = 'false'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_dialplan_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'dialplan'; - $tmp[$x]['enabled'] = 'false'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_mod_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'mod'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_scripts_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'scripts'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_grammar_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'grammar'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_storage_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'storage'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_voicemail_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'voicemail'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_recordings_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'recordings'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $switch_sounds_dir; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'sounds'; - $tmp[$x]['enabled'] = 'true'; - $x++; - $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = ''; - $tmp[$x]['category'] = 'switch'; - $tmp[$x]['subcategory'] = 'provision'; - $tmp[$x]['enabled'] = 'false'; - $x++; - $db_tmp->beginTransaction(); - foreach($tmp as $row) { - $sql = "insert into v_default_settings "; - $sql .= "("; - $sql .= "default_setting_uuid, "; - $sql .= "default_setting_name, "; - $sql .= "default_setting_value, "; - $sql .= "default_setting_category, "; - $sql .= "default_setting_subcategory, "; - $sql .= "default_setting_enabled "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'".$row['name']."', "; - $sql .= "'".$row['value']."', "; - $sql .= "'".$row['category']."', "; - $sql .= "'".$row['subcategory']."', "; - $sql .= "'".$row['enabled']."' "; - $sql .= ");"; - if ($v_debug) { - fwrite($fp, $sql."\n"); - } - $db_tmp->exec(check_sql($sql)); - unset($sql); - } - $db_tmp->commit(); - unset($tmp); - - //get the list of installed apps from the core and mod directories - $config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php"); - $x=0; - foreach ($config_list as $config_path) { - include($config_path); - $x++; - } - - //add the groups - $x = 0; - $tmp[$x]['group_name'] = 'superadmin'; - $tmp[$x]['group_description'] = 'Super Administrator Group'; - $x++; - $tmp[$x]['group_name'] = 'admin'; - $tmp[$x]['group_description'] = 'Administrator Group'; - $x++; - $tmp[$x]['group_name'] = 'user'; - $tmp[$x]['group_description'] = 'User Group'; - $x++; - $tmp[$x]['group_name'] = 'public'; - $tmp[$x]['group_description'] = 'Public Group'; - $x++; - $tmp[$x]['group_name'] = 'agent'; - $tmp[$x]['group_description'] = 'Call Center Agent Group'; - $db_tmp->beginTransaction(); - foreach($tmp as $row) { - $sql = "insert into v_groups "; - $sql .= "("; - $sql .= "group_uuid, "; - $sql .= "group_name, "; - $sql .= "group_description "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'".$row['group_name']."', "; - $sql .= "'".$row['group_description']."' "; - $sql .= ");"; - if ($v_debug) { - fwrite($fp, $sql."\n"); - } - $db_tmp->exec(check_sql($sql)); - unset($sql); - } - unset($tmp); - $db_tmp->commit(); - - //add a user and then add the user to the superadmin group - //prepare the values - $user_uuid = uuid(); - $contact_uuid = uuid(); - //set a sessiong variable - $_SESSION["user_uuid"] = $user_uuid; - //salt used with the password to create a one way hash - $salt = generate_password('20', '4'); - //add the user account - $sql = "insert into v_users "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "user_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "username, "; - $sql .= "password, "; - $sql .= "salt, "; - $sql .= "add_date, "; - $sql .= "add_user "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$_SESSION["domain_uuid"]."', "; - $sql .= "'$user_uuid', "; - $sql .= "'$contact_uuid', "; - $sql .= "'".$admin_username."', "; - $sql .= "'".md5($salt.$admin_password)."', "; - $sql .= "'$salt', "; - $sql .= "now(), "; - $sql .= "'".$admin_username."' "; - $sql .= ");"; - if ($v_debug) { - fwrite($fp, $sql."\n"); - } - $db_tmp->exec(check_sql($sql)); - unset($sql); - - //add to contacts - $sql = "insert into v_contacts "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "contact_type, "; - $sql .= "contact_name_given, "; - $sql .= "contact_nickname "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$_SESSION["domain_uuid"]."', "; - $sql .= "'$contact_uuid', "; - $sql .= "'user', "; - $sql .= "'$admin_username', "; - $sql .= "'$admin_username' "; - $sql .= ")"; - $db_tmp->exec(check_sql($sql)); - unset($sql); - - //add the user to the superadmin group - $sql = "insert into v_group_users "; - $sql .= "("; - $sql .= "group_user_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "user_uuid, "; - $sql .= "group_name "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'".$_SESSION["domain_uuid"]."', "; - $sql .= "'".$_SESSION["user_uuid"]."', "; - $sql .= "'superadmin' "; - $sql .= ");"; - if ($v_debug) { - fwrite($fp, $sql."\n"); - } - $db_tmp->exec(check_sql($sql)); - unset($sql); - - //assign the default permissions to the groups - $db_tmp->beginTransaction(); - foreach($apps as $app) { - if ($app['permissions']) { - foreach ($app['permissions'] as $row) { - if ($v_debug) { - fwrite($fp, "v_group_permissions\n"); - fwrite($fp, json_encode($row)."\n\n"); - } - if ($row['groups']) { - foreach ($row['groups'] as $group) { - //add the record - $sql = "insert into v_group_permissions "; - $sql .= "("; - $sql .= "group_permission_uuid, "; - $sql .= "permission_name, "; - $sql .= "group_name "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'".$row['name']."', "; - $sql .= "'".$group."' "; - $sql .= ");"; - if ($v_debug) { - fwrite($fp, $sql."\n"); - } - $db_tmp->exec(check_sql($sql)); - unset($sql); - } - } - } - } - } - $db_tmp->commit(); - - //unset the temporary database connection - unset($db_tmp); - - //include additional files - require "resources/require.php"; - - //set the defaults - $menu_name = 'default'; - $menu_language = 'en-us'; - $menu_description = ''; - //add the parent menu - $sql = "insert into v_menus "; - $sql .= "("; - $sql .= "menu_uuid, "; - $sql .= "menu_name, "; - $sql .= "menu_language, "; - $sql .= "menu_description "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$menu_uuid."', "; - $sql .= "'$menu_name', "; - $sql .= "'$menu_language', "; - $sql .= "'$menu_description' "; - $sql .= ");"; - if ($v_debug) { - fwrite($fp, $sql."\n"); - } - $db->exec(check_sql($sql)); - unset($sql); - - //add the menu items - require_once "resources/classes/menu.php"; - $menu = new menu; - $menu->db = $db; - $menu->menu_uuid = $menu_uuid; - $menu->restore(); - unset($menu); - - //setup the switch config directory if it exists - if (file_exists($switch_conf_dir) && $switch_conf_dir != "/conf") { - if ($v_debug) { - fwrite($fp, "switch_base_dir: ".$install_switch_base_dir."\n"); - fwrite($fp, "switch_conf_dir: ".$switch_conf_dir."\n"); - fwrite($fp, "switch_dialplan_dir: ".$switch_dialplan_dir."\n"); - fwrite($fp, "switch_scripts_dir: ".$switch_scripts_dir."\n"); - fwrite($fp, "switch_sounds_dir: ".$switch_sounds_dir."\n"); - fwrite($fp, "switch_recordings_dir: ".$switch_recordings_dir."\n"); - } - - //create the necessary directories - if (!is_readable($install_tmp_dir)) { mkdir($install_tmp_dir,0777,true); } - if (!is_readable($install_backup_dir)) { mkdir($install_backup_dir,0777,true); } - if (is_readable($switch_log_dir)) { - if (!is_readable($switch_scripts_dir.'') && $switch_scripts_dir != "/scripts") { mkdir($switch_scripts_dir.'',0777,true); } - // if (!is_readable($switch_sounds_dir.'/en/us/callie/custom/8000') && $switch_scripts_dir != "/sounds") { mkdir($switch_sounds_dir.'/en/us/callie/custom/8000',0777,true); } - // if (!is_readable($switch_sounds_dir.'/en/us/callie/custom/16000') && $switch_scripts_dir != "/sounds") { mkdir($switch_sounds_dir.'/en/us/callie/custom/16000',0777,true); } - // if (!is_readable($switch_sounds_dir.'/en/us/callie/custom/32000') && $switch_scripts_dir != "/sounds") { mkdir($switch_sounds_dir.'/en/us/callie/custom/32000',0777,true); } - // if (!is_readable($switch_sounds_dir.'/en/us/callie/custom/48000') && $switch_scripts_dir != "/sounds") { mkdir($switch_sounds_dir.'/en/us/callie/custom/48000',0777,true); } - if (!is_readable($switch_storage_dir.'/fax/') && $switch_scripts_dir != "/storage") { mkdir($switch_storage_dir.'/fax',0777,true); } - if (!is_readable($switch_recordings_dir.'') && $switch_scripts_dir != "/recordings") { mkdir($switch_recordings_dir.'',0777,true); } - } - - //copy the files and directories from resources/install - require_once "resources/classes/install.php"; - $install = new install; - $install->domain_uuid = $_SESSION["domain_uuid"]; - $install->domain = $domain_name; - $install->switch_conf_dir = $switch_conf_dir; - $install->switch_scripts_dir = $switch_scripts_dir; - // $install->switch_sounds_dir = $switch_sounds_dir; - $install->copy_conf(); - $install->copy(); - - //create the dialplan/default.xml for single tenant or dialplan/domain.xml - if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/dialplan")) { - $dialplan = new dialplan; - $dialplan->domain_uuid = $_SESSION["domain_uuid"]; - $dialplan->domain = $domain_name; - $dialplan->switch_dialplan_dir = $switch_dialplan_dir; - $dialplan->restore_advanced_xml(); - //print_r($dialplan->result); - } - - //write the xml_cdr.conf.xml file - if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/xml_cdr")) { - xml_cdr_conf_xml(); - } - - //write the switch.conf.xml file - if (file_exists($switch_conf_dir)) { - switch_conf_xml(); - } - } - - //login the user account - $_SESSION["username"] = $admin_username; - - //get the groups assigned to the user and then set the groups in $_SESSION["groups"] - $sql = "SELECT * FROM v_group_users "; - $sql .= "where domain_uuid=:domain_uuid "; - $sql .= "and user_uuid=:user_uuid "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->bindParam(':domain_uuid', $_SESSION["domain_uuid"]); - $prep_statement->bindParam(':user_uuid', $_SESSION["user_uuid"]); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $_SESSION["groups"] = $result; - unset($sql, $row_count, $prep_statement); - - //get the permissions assigned to the groups that the user is a member of set the permissions in $_SESSION['permissions'] - $x = 0; - $sql = "select distinct(permission_name) from v_group_permissions "; - foreach($_SESSION["groups"] as $field) { - if (strlen($field['group_name']) > 0) { - if ($x == 0) { - $sql .= "where (domain_uuid = '".$_SESSION["domain_uuid"]."' and group_name = '".$field['group_name']."') "; - } - else { - $sql .= "or (domain_uuid = '".$_SESSION["domain_uuid"]."' and group_name = '".$field['group_name']."') "; - } - $x++; - } - } - $prep_statementsub = $db->prepare($sql); - $prep_statementsub->execute(); - $_SESSION['permissions'] = $prep_statementsub->fetchAll(PDO::FETCH_NAMED); - unset($sql, $prep_statementsub); - - //make sure the database schema and installation have performed all necessary tasks - $display_results = false; - $display_type = 'none'; - require_once "resources/classes/schema.php"; - $obj = new schema; - $obj->schema($db, $db_type, $db_name, $display_type); - - //run all app_defaults.php files - require_once "resources/classes/domains.php"; - $domain = new domains; - $domain->upgrade(); - - //synchronize the config with the saved settings - save_switch_xml(); - - //do not show the apply settings reminder on the login page - $_SESSION["reload_xml"] = false; - - //clear the menu - $_SESSION["menu"] = ""; - - //redirect to the login page - $msg = "install complete"; - header("Location: ".PROJECT_PATH."/logout.php?msg=".urlencode($msg)); -} - -//set a default template - if (strlen($_SESSION['domain']['template']['name']) == 0) { $_SESSION['domain']['template']['name'] = 'enhanced'; } - -//get the contents of the template and save it to the template variable - $template = file_get_contents($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes/'.$_SESSION['domain']['template']['name'].'/template.php'); - -//buffer the content - ob_end_clean(); //clean the buffer - ob_start(); - -//show the html form - if (!is_writable($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/header.php")) { - $install_msg .= "
  • Write access to ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/ is required during the install.
  • \n"; - } - if (!extension_loaded('PDO')) { - $install_msg .= "
  • PHP PDO was not detected. Please install it before proceeding.
  • "; - } - - if ($install_msg) { - echo "
    \n"; - echo "
    \n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
    Message
      $install_msg
    \n"; - echo "
    \n"; - } - - echo "
    \n"; - $msg = ''; - //make sure the includes directory is writable so the config.php file can be written. - if (!is_writable($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/pdo.php")) { - $msg .= "Write access to ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."
    "; - $msg .= "and its sub-directories are required during the install.

    \n"; - } - - //display the message - if (strlen($msg) > 0) { - //echo "not writable"; - echo $msg; - echo "
    \n"; - echo "
    \n"; - unset($msg); - //exit; - } - -// step 1 - if ($_POST["install_step"] == "") { - echo "
    \n"; - echo "
    \n"; - echo "\n"; - - //echo "\n"; - //echo "\n"; - //echo "\n"; - echo "\n"; - echo "\n"; - echo " \n"; - //echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - //echo "\n"; - echo "\n"; - - $db_type = $_POST["db_type"]; - $install_step = $_POST["install_step"]; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo " \n"; - echo " \n"; - echo " "; - - echo "
    Installation
    \n"; - echo " The installation is a simple two step process. \n"; - echo "
      \n"; - echo "
    • Step 1 is used for selecting the database engine to use. After making that section then ensure the paths are correct and then press next.
    • "; - echo "
    • Step 2 requests the database specific settings. When finished press save. The installation will then complete the tasks required to do the install.
    Step 1 
    \n"; - echo " Database Type\n"; - echo "\n"; - echo "
    \n"; - echo " Select the database type.\n"; - echo "\n"; - echo "
    \n"; - echo " Username\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the username to use when logging in with the browser.
    \n"; - echo "
    \n"; - echo " Password\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the password to use when logging in with the browser.
    \n"; - echo "
    \n"; - echo " Country\n"; - echo "\n"; - echo " \n"; - echo "
    \n"; - echo " Select ISO country code used to initialize calling contry code variables.
    \n"; - echo "
    \n"; - echo " Theme: \n"; - echo " \n"; - echo " \n"; - echo "
    \n"; - echo " Select a theme to set as the default.
    \n"; - echo "
    \n"; - echo " Domain name\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the default domain name. \n"; - echo "\n"; - echo "
    \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
    "; - echo "
    "; - echo "
    "; - } - -// step 2, sqlite - if ($_POST["install_step"] == "2" && $_POST["db_type"] == "sqlite") { - echo "
    \n"; - echo "
    \n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo " \n"; - echo " \n"; - echo " "; - - echo "
    Installation: Step 2 - SQLite
    \n"; - echo " Database Filename\n"; - echo "\n"; - echo "
    \n"; - echo " Set the database filename. The file extension should be '.db'.\n"; - echo "\n"; - echo "
    \n"; - echo " Database Directory\n"; - echo "\n"; - echo "
    \n"; - echo " Set the path to the database directory.\n"; - echo "
    \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
    "; - echo "
    "; - echo "
    "; - } - -// step 2, mysql - if ($_POST["install_step"] == "2" && $_POST["db_type"] == "mysql") { - - //set defaults - if (strlen($db_host) == 0) { $db_host = 'localhost'; } - if (strlen($db_port) == 0) { $db_port = '3306'; } - //if (strlen($db_name) == 0) { $db_name = 'fusionpbx'; } - - //echo "However if preferred the database can be created manually with the mysql.sql script. "; - echo "
    \n"; - echo "
    \n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo " \n"; - echo " \n"; - echo " "; - - echo "
    Installation: Step 2 - MySQL
    \n"; - echo " Database Host\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the host address for the database server.\n"; - echo "\n"; - echo "
    \n"; - echo " Database Port\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the port number. It is optional if the database is using the default port.\n"; - echo "\n"; - echo "
    \n"; - echo " Database Name\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the name of the database.\n"; - echo "\n"; - echo "
    \n"; - echo " Database Username\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the database username. \n"; - echo "\n"; - echo "
    \n"; - echo " Database Password\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the database password.\n"; - echo "\n"; - echo "
    \n"; - echo " Create Database Username\n"; - echo "\n"; - echo "
    \n"; - echo " Optional, this username is used to create the database, a database user and set the permissions. \n"; - echo " By default this username is 'root' however it can be any account with permission to add a database, user, and grant permissions. \n"; - echo "
    \n"; - echo " Create Database Password\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the create database password.\n"; - echo "\n"; - echo "
    \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
    "; - echo "
    "; - echo "
    "; - } - -// step 2, pgsql - if ($_POST["install_step"] == "2" && $_POST["db_type"] == "pgsql") { - if (strlen($db_host) == 0) { $db_host = 'localhost'; } - if (strlen($db_port) == 0) { $db_port = '5432'; } - if (strlen($db_name) == 0) { $db_name = 'fusionpbx'; } - - echo "
    \n"; - echo "
    \n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo " \n"; - echo " \n"; - echo " "; - - echo "
    Installation: Step 2 - Postgres
    \n"; - echo " Database Host\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the host address for the database server.\n"; - echo "\n"; - echo "
    \n"; - echo " Database Port\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the port number. It is optional if the database is using the default port.\n"; - echo "\n"; - echo "
    \n"; - echo " Database Name\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the name of the database.\n"; - echo "\n"; - echo "
    \n"; - echo " Database Username\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the database username.\n"; - echo "\n"; - echo "
    \n"; - echo " Database Password\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the database password.\n"; - echo "\n"; - echo "
    \n"; - echo " Create Database Username\n"; - echo "\n"; - echo "
    \n"; - echo " Optional, this username is used to create the database, a database user and set the permissions. \n"; - echo " By default this username is 'pgsql' however it can be any account with permission to add a database, user, and grant permissions. \n"; - echo " Leave blank if the user and empty database already exist and you do not want them created. \n"; - echo "
    \n"; - echo " Create Database Password\n"; - echo "\n"; - echo "
    \n"; - echo " Enter the create database password.\n"; - echo "\n"; - echo "
    \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
    "; - echo "
    "; - echo "
    "; - } - - echo "
    \n"; - echo "
    \n"; - echo "
    \n"; - echo "
    \n"; - echo "
    \n"; - echo "
    \n"; - echo "
    \n"; - echo "
    \n"; - -// add the content to the template and then send output - $body = $content_from_db.ob_get_contents(); //get the output from the buffer - ob_end_clean(); //clean the buffer - - ob_start(); - eval('?>' . $template . '", $custom_title, $template); // defined in each individual page - $output = str_replace ("", $custom_head, $output); // defined in each individual page - $output = str_replace ("", $_SESSION["menu"], $output); //defined in /resources/menu.php - $output = str_replace ("", PROJECT_PATH, $output); //defined in /resources/menu.php - - $pos = strrpos($output, ""); - if ($pos === false) { - $output = $body; //if tag not found just show the body - } - else { - //replace the body - $output = str_replace ("", $body, $output); - } - - echo $output; - unset($output); - -?> From 17f435fb2214d7fb9d7fe2d6f41baf00e8f5a7e7 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 18 Nov 2015 15:37:41 +0300 Subject: [PATCH 029/232] Add. Web UI to configure fax_queue. --- app/fax/app_config.php | 79 +++++++++++++++++++++++++++ app/fax/app_defaults.php | 49 +++++++++++++++++ app/fax/fax_edit.php | 42 +++++++++++++- app/fax/fax_emails.php | 1 + app/fax/fax_send.php | 115 ++++++++++++++++++++++++++++++++------- 5 files changed, 264 insertions(+), 22 deletions(-) diff --git a/app/fax/app_config.php b/app/fax/app_config.php index 8567a0023d..dc9b788ffa 100644 --- a/app/fax/app_config.php +++ b/app/fax/app_config.php @@ -277,6 +277,14 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "fax_send_greeting"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "fax_send_channels"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; //$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "fax_keep_local"; //$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "fax_local"; //$apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; @@ -499,4 +507,75 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $y = 4; //table array index + $z = 0; //field array index + $apps[$x]['db'][$y]['table'] = 'v_fax_tasks'; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_fax'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'fax_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'FAX server primary key'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_next_time'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'timestamp'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_lock_time'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'timestamp'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_fax_file'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_wav_file'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_uri'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_dial_string'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_dtmf'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_interrupted'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_status'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_no_answer_counter'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_no_answer_retry_counter'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_retry_counter'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_description'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; ?> \ No newline at end of file diff --git a/app/fax/app_defaults.php b/app/fax/app_defaults.php index b3ab8cd98c..d688de4388 100644 --- a/app/fax/app_defaults.php +++ b/app/fax/app_defaults.php @@ -60,6 +60,55 @@ if ($domains_processed == 1) { $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_description'] = 'Keep the file after sending or receiving the fax.'; $x++; + $array[$x]['default_setting_category'] = 'fax'; + $array[$x]['default_setting_subcategory'] = 'send_mode'; + $array[$x]['default_setting_name'] = 'text'; + $array[$x]['default_setting_value'] = 'queue'; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = ''; + $x++; + $array[$x]['default_setting_category'] = 'fax'; + $array[$x]['default_setting_subcategory'] = 'send_retry_limit'; + $array[$x]['default_setting_name'] = 'numeric'; + $array[$x]['default_setting_value'] = '5'; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'Number of attempts to send fax (count only calls with answer)'; + $x++; + $array[$x]['default_setting_category'] = 'fax'; + $array[$x]['default_setting_subcategory'] = 'send_retry_interval'; + $array[$x]['default_setting_name'] = 'numeric'; + $array[$x]['default_setting_value'] = '15'; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'Delay before we make next call after answered call'; + $x++; + $array[$x]['default_setting_category'] = 'fax'; + $array[$x]['default_setting_subcategory'] = 'send_no_answer_retry_limit'; + $array[$x]['default_setting_name'] = 'numeric'; + $array[$x]['default_setting_value'] = '3'; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'Number of unanswered attempts in sequence'; + $x++; + $array[$x]['default_setting_category'] = 'fax'; + $array[$x]['default_setting_subcategory'] = 'send_no_answer_retry_interval'; + $array[$x]['default_setting_name'] = 'numeric'; + $array[$x]['default_setting_value'] = '30'; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'Delay before we make next call after no answered call'; + $x++; + $array[$x]['default_setting_category'] = 'fax'; + $array[$x]['default_setting_subcategory'] = 'send_no_answer_limit'; + $array[$x]['default_setting_name'] = 'numeric'; + $array[$x]['default_setting_value'] = '3'; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'Giveup reach the destination after this number of sequences'; + $x++; + $array[$x]['default_setting_category'] = 'fax'; + $array[$x]['default_setting_subcategory'] = 'send_no_answer_interval'; + $array[$x]['default_setting_name'] = 'numeric'; + $array[$x]['default_setting_value'] = '300'; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'Delay before next call sequence'; + $x++; //get an array of the default settings $sql = "select * from v_default_settings "; $prep_statement = $db->prepare($sql); diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index 27ffdc8ca4..28d7613324 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -135,8 +135,10 @@ else { } else { $forward_prefix = $forward_prefix.$fax_forward_number.'#'; //found } - $fax_local = check_str($_POST["fax_local"]); + $fax_local = check_str($_POST["fax_local"]); //! @todo check in database $fax_description = check_str($_POST["fax_description"]); + $fax_send_greeting = check_str($_POST["fax_send_greeting"]); + $fax_send_channels = check_str($_POST["fax_send_channels"]); } //delete the user from the fax users @@ -274,6 +276,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (strlen($fax_forward_number) > 0) { $sql .= "fax_forward_number, "; } + $sql .= "fax_send_greeting,"; + $sql .= "fax_send_channels,"; $sql .= "fax_description "; $sql .= ")"; $sql .= "values "; @@ -305,6 +309,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (strlen($fax_forward_number) > 0) { $sql .= "'$fax_forward_number', "; } + $sql .= (strlen($fax_send_greeting)==0?'NULL':"'$fax_send_greeting'") . ","; + $sql .= (strlen($fax_send_channels)==0?'NULL':"'$fax_send_channels'") . ","; + $sql .= "'$fax_description' "; $sql .= ")"; $db->exec(check_sql($sql)); @@ -345,9 +352,16 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { else { $sql .= "fax_forward_number = null, "; } + $tmp = strlen($fax_send_greeting)==0?'NULL':"'$fax_send_greeting'"; + $sql .= "fax_send_greeting = $tmp,"; + $tmp = strlen($fax_send_channels)==0?'NULL':"'$fax_send_channels'"; + $sql .= "fax_send_channels = $tmp,"; + $sql .= "fax_description = '$fax_description' "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and fax_uuid = '$fax_uuid' "; + $db->exec(check_sql($sql)); unset($sql); } @@ -426,9 +440,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $fax_caller_id_number = $row["fax_caller_id_number"]; $fax_forward_number = $row["fax_forward_number"]; $fax_description = $row["fax_description"]; + $fax_send_greeting = $row["fax_send_greeting"]; + $fax_send_channels = $row["fax_send_channels"]; } unset ($prep_statement); } + else{ + $fax_send_channels = 10; + } //replace the dash with a space $fax_name = str_replace("-", " ", $fax_name); @@ -678,6 +697,27 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo " ".$text['label-fax_send_greeting']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
    \n"; + echo " ".$text['description-fax_send_greeting']."\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo " ".$text['label-fax_send_channels']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
    \n"; + echo " ".$text['description-fax_send_channels']."\n"; + echo "\n"; + echo "\n"; } echo " \n"; diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index 3c615a8e75..f1762bc8fd 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -74,6 +74,7 @@ if (sizeof($result) != 0) { $fax_email_connection_mailbox = $row["fax_email_connection_mailbox"]; $fax_email_outbound_subject_tag = $row["fax_email_outbound_subject_tag"]; $fax_email_outbound_authorized_senders = $row["fax_email_outbound_authorized_senders"]; + $fax_send_greeting = $row["fax_send_greeting"]; //load default settings, then domain settings over top unset($_SESSION); diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 315737f933..0e710bcf07 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -84,21 +84,27 @@ if (!$included) { } foreach ($result as &$row) { //set database fields as variables + $fax_uuid = $row["fax_uuid"]; $fax_extension = $row["fax_extension"]; $fax_caller_id_name = $row["fax_caller_id_name"]; $fax_caller_id_number = $row["fax_caller_id_number"]; $fax_accountcode = $row["accountcode"]; + $fax_send_greeting = $row["fax_send_greeting"]; //limit to one row break; } unset ($prep_statement); + $fax_send_mode = $_SESSION['fax']['send_mode']['text']; + if(strlen($fax_send_mode) == 0){ + $fax_send_mode = 'direct'; + } } //set the fax directory $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.((count($_SESSION["domains"]) > 1) ? '/'.$_SESSION['domain_name'] : null); } -else { +else{ require_once "resources/classes/EventSocket.php"; } @@ -534,7 +540,7 @@ if(!function_exists('gs_cmd')) { } //preview, if requested - if ($_REQUEST['submit'] == $text['button-preview']) { + if (($_REQUEST['submit'] != '') && ($_REQUEST['submit'] == $text['button-preview'])) { unset($file_type); if (file_exists($dir_fax_temp.'/'.$fax_instance_uuid.'.pdf')) { $file_type = 'pdf'; @@ -599,29 +605,96 @@ if(!function_exists('gs_cmd')) { } //send the fax + $fax_file = $dir_fax_temp."/".$fax_instance_uuid.".tif"; + $common_dial_string = "for_fax=1,"; + $common_dial_string .= "accountcode='" . $fax_accountcode . "',"; + $common_dial_string .= "sip_h_X-accountcode='" . $fax_accountcode . "',"; + $common_dial_string .= "domain_uuid=" . $_SESSION["domain_uuid"] . ","; + $common_dial_string .= "domain_name=" . $_SESSION["domain_name"] . ","; + $common_dial_string .= "mailto_address='" . $mailto_address . "',"; + $common_dial_string .= "mailfrom_address='" . $mailfrom_address . "',"; + $common_dial_string .= "origination_caller_id_name='" . $fax_caller_id_name . "',"; + $common_dial_string .= "origination_caller_id_number='" . $fax_caller_id_number . "',"; + $common_dial_string .= "fax_ident='" . $fax_caller_id_number . "',"; + $common_dial_string .= "fax_header='" . $fax_caller_id_name . "',"; + $common_dial_string .= "fax_file='" . $fax_file . "',"; + foreach ($fax_numbers as $fax_number) { - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - //prepare the fax command - $route_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $fax_prefix.$fax_number); - $fax_file = $dir_fax_temp."/".$fax_instance_uuid.".tif"; - if (count($route_array) == 0) { - //send the internal call to the registered extension - $fax_uri = "user/".$fax_number."@".$_SESSION['domain_name']; - $t38 = ""; + $dial_string = $common_dial_string; + + //prepare the fax command + $route_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $fax_prefix . $fax_number); + + if (count($route_array) == 0) { + //send the internal call to the registered extension + $fax_uri = "user/".$fax_number."@".$_SESSION['domain_name']; + $t38 = ""; + } + else { + //send the external call + $fax_uri = $route_array[0]; + $t38 = "fax_enable_t38=true,fax_enable_t38_request=true,"; + } + $tail_dial_string = $fax_uri." &txfax('".$fax_file."')"; + + if ($fax_send_mode != 'queue') { + $dial_string .= $t38; + $dial_string .= "fax_uri=" . $fax_uri . ","; + $dial_string .= "fax_retry_attempts=1" . ","; + $dial_string .= "fax_retry_limit=20" . ","; + $dial_string .= "fax_retry_sleep=180" . ","; + $dial_string .= "fax_verbose=true" . ","; + $dial_string .= "fax_use_ecm=off" . ","; + $dial_string .= "api_hangup_hook='lua fax_retry.lua'"; + $dial_string = "{" . $dial_string . "}" . $tail_dial_string; + + $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); + if ($fp) { + $cmd = "api originate " . $dial_string; + // echo($cmd . "
    \n"); + //send the command to event socket + $response = event_socket_request($fp, $cmd); + $response = str_replace("\n", "", $response); + $uuid = str_replace("+OK ", "", $response); } - else { - //send the external call - $fax_uri = $route_array[0]; - $t38 = "fax_enable_t38=true,fax_enable_t38_request=true,"; - } - $cmd = "api originate {for_fax=1,accountcode='".$fax_accountcode."',sip_h_X-accountcode='".$fax_accountcode."',domain_uuid=".$_SESSION["domain_uuid"].",domain_name=".$_SESSION["domain_name"].",mailto_address='".$mailto_address."',mailfrom_address='".$mailfrom_address."',origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')"; - //send the command to event socket - $response = event_socket_request($fp, $cmd); - $response = str_replace("\n", "", $response); - $uuid = str_replace("+OK ", "", $response); fclose($fp); } + else{ // enqueue + $task_uuid = uuid(); + $dial_string .= "task_uuid='" . $task_uuid . "',"; + $wav_file = ''; //! @todo add custom message + $dtmf = ''; //! @todo add generate dtmf + $description = ''; //! @todo add description + $sql = <<prepare($sql); + $i = 0; + $stmt->bindValue(++$i, $task_uuid); + $stmt->bindValue(++$i, $fax_uuid); + $stmt->bindValue(++$i, $fax_file); + $stmt->bindValue(++$i, $wav_file); + $stmt->bindValue(++$i, $fax_uri); + $stmt->bindValue(++$i, $dial_string); + $stmt->bindValue(++$i, $dtmf); + $stmt->bindValue(++$i, $description); + if ($stmt->execute()) { + $response = 'Enqueued'; + } + else{ + //! @todo log error + $response = 'Fail enqueue'; + } + } } //wait for a few seconds From e769a0eafe6adb3620d1c11b83f9a0eb7868090e Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 18 Nov 2015 16:27:55 +0300 Subject: [PATCH 030/232] Add. Lua part of fax_queue. To poll active task you can run `luarun fax_queue_poll_once.lua` --- resources/install/scripts/fax_queue/exec.lua | 185 ++++++++++ resources/install/scripts/fax_queue/next.lua | 69 ++++ resources/install/scripts/fax_queue/retry.lua | 345 ++++++++++++++++++ resources/install/scripts/fax_queue/tasks.lua | 223 +++++++++++ .../install/scripts/fax_queue_poll_once.lua | 1 + .../scripts/resources/functions/cache.lua | 8 +- .../scripts/resources/functions/database.lua | 237 ++++++++---- .../scripts/resources/functions/esl.lua | 159 ++++++++ .../resources/functions/lazy_settings.lua | 172 +++++++++ .../scripts/resources/functions/log.lua | 11 +- .../scripts/resources/functions/sleep.lua | 15 + 11 files changed, 1340 insertions(+), 85 deletions(-) create mode 100644 resources/install/scripts/fax_queue/exec.lua create mode 100644 resources/install/scripts/fax_queue/next.lua create mode 100644 resources/install/scripts/fax_queue/retry.lua create mode 100644 resources/install/scripts/fax_queue/tasks.lua create mode 100644 resources/install/scripts/fax_queue_poll_once.lua create mode 100644 resources/install/scripts/resources/functions/esl.lua create mode 100644 resources/install/scripts/resources/functions/lazy_settings.lua create mode 100644 resources/install/scripts/resources/functions/sleep.lua diff --git a/resources/install/scripts/fax_queue/exec.lua b/resources/install/scripts/fax_queue/exec.lua new file mode 100644 index 0000000000..2ecf66bcc7 --- /dev/null +++ b/resources/install/scripts/fax_queue/exec.lua @@ -0,0 +1,185 @@ +-- @usage without queue +-- api: originate {fax_file='',wav_file='',fax_dtmf=''}user/108@domain.local &lua(fax_task.lua) +-- @usage with queue task +-- api: originate {task_uuid=''}user/108@domain.local &lua(fax_task.lua) +-- @fax_dtmf +-- 0-9*# - dtmf symbols +-- @200 - dtmf duration in ms +-- p - pause 500 ms +-- P - pause 1000 ms +-- +-- example: pause 5 sec dial 008 pause 2 sec paly greeting +-- PPPPP008@300PP +-- +-- api: originate {fax_file='d:/fax/file1.tiff',wav_file='c:/FreeSWITCH/sounds/music/8000/suite-espanola-op-47-leyenda_x8.wav',fax_dtmf=''}user/101@sip.office.intelcom-tg.ru &lua(fax_task.lua) + +require "resources.functions.config" +local log = require "resources.functions.log".fax_task + +-- If we handle queue task +local task_uuid = session:getVariable('task_uuid') +local task if task_uuid then + local Tasks = require "fax_queue.tasks" + task = Tasks.select_task(task_uuid) + if not task then + log.warningf("Can not found fax task: %q", tostring(task_uuid)) + return + end +end + +if task then + local str = 'Queue task :' + for k, v in pairs(task) do + str = str .. ('\n %q = %q'):format(k, v) + end + log.info(str) +else + log.info('Not queued task') +end + +local function empty(t) return (not t) or (#t == 0) end + +local function not_empty(t) if not empty(t) then return t end end + +local dtmf, wav_file, fax_file + +if task then + dtmf = not_empty(task.dtmf) + wav_file = not_empty(task.wav_file) or not_empty(task.greeting) + fax_file = not_empty(task.fax_file) +else + dtmf = not_empty(session:getVariable('fax_dtmf')) + wav_file = not_empty(session:getVariable('wav_file')) + fax_file = not_empty(session:getVariable('fax_file')) +end + +if not (wav_file or fax_file) then + log.warning("No fax or wav file") + return +end + +local function decode_dtmf(dtmf) + local r, sleep, seq = {} + dtmf:gsub('P', 'pp'):gsub('.', function(ch) + -- print(ch) + if ch == ';' or ch == ',' then + r[#r + 1] = sleep or seq + sleep, seq = nil + elseif ch == 'p' then + r[#r + 1] = seq + sleep = (sleep or 0) + 500 + seq = nil + else + r[#r + 1] = sleep + seq = (seq or '') .. ch + sleep = nil + end + end) + r[#r + 1] = sleep or seq + return r +end + +local function send_fax() + session:execute("txfax", fax_file) +end + +local function start_fax_detect(detect_duration) + if not tone_detect_cb then + function tone_detect_cb(s, type, obj, arg) + if type == "event" then + if obj:getHeader('Event-Name') == 'DETECTED_TONE' then + return "false" + end + end + end + end + + log.notice("Start detecting fax") + + detect_duration = detect_duration or 60000 + + session:setInputCallback("tone_detect_cb") + session:execute("tone_detect", "txfax 2100 r +" .. tostring(detect_duration) .. " set remote_fax_detected=txfax") + session:execute("tone_detect", "rxfax 1100 r +" .. tostring(detect_duration) .. " set remote_fax_detected=rxfax") + session:setVariable("sip_api_on_image", "uuid_break " .. session:getVariable("uuid") .. " all") +end + +local function stop_fax_detect() + session:unsetInputCallback() + session:execute("stop_tone_detect") + session:setVariable("sip_api_on_image", "") +end + +local function fax_deteced() + if session:getVariable('has_t38') == 'true' then + log.noticef('Detected t38') + session:setVariable('remote_fax_detected', 'txfax') + end + + if fax_file and session:getVariable('remote_fax_detected') then + log.noticef("Detected %s", session:getVariable('remote_fax_detected')) + if session:getVariable('remote_fax_detected') == 'txfax' then + send_fax() + else + log.warning('Remote fax try send fax') + end + return true + end +end + +local function check() + if not session:ready() then return false end + if fax_deteced() then return false end + return true +end + +local function task() + session:waitForAnswer(session) + + while not session:answered() do + if not session:ready() then return end + session:sleep(500) + end + + log.notice("11111") + if not (session:ready() and session:answered()) then return end + log.notice("2222") + + if fax_file and wav_file then + start_fax_detect() + end + + if dtmf then + dtmf = decode_dtmf(dtmf) + for _, element in ipairs(dtmf) do + if type(element) == 'number' then + session:streamFile("silence_stream://" .. tostring(element)) + else + session:execute("send_dtmf", element) + end + if not check() then return end + end + end + + if wav_file then + session:streamFile(wav_file) + if not check() then return end + end + + if fax_file then + if wav_file then + stop_fax_detect() + end + send_fax() + end +end + +log.noticef("START TASK") +log.notice("Fax:" .. tostring(fax_file)) +log.notice("Wav:" .. tostring(wav_file)) + +task() + +log.noticef("STOP TASK") +log.notice("Ready: " .. tostring(session:ready())) +log.notice("answered: " .. tostring(session:answered())) diff --git a/resources/install/scripts/fax_queue/next.lua b/resources/install/scripts/fax_queue/next.lua new file mode 100644 index 0000000000..0067d0e9b4 --- /dev/null +++ b/resources/install/scripts/fax_queue/next.lua @@ -0,0 +1,69 @@ +require "resources.functions.config" + +require "resources.functions.sleep" +local log = require "resources.functions.log".next_fax_task +local Tasks = require "fax_queue.tasks" +local Esl = require "resources.functions.esl" + +local FAX_OPTIONS = { + "fax_use_ecm=false,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=default"; + "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=false"; + "fax_use_ecm=true,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false"; + "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=true"; + "fax_use_ecm=false,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false"; +} + +local function next_task() + local task, err = Tasks.next_task() + + if not task then + if err then + log.noticef('Can not select next task: %s', tostring(err)) + else + log.notice("No task") + end + return + end + + local esl + local ok, err = pcall(function() + + for k, v in pairs(task) do + print(string.format(" `%s` => `%s`", tostring(k), tostring(v))) + end + + local mode = (task.retry_counter % #FAX_OPTIONS) + 1 + local dial_string = '{' .. + task.dial_string .. "api_hangup_hook='lua fax_queue/retry.lua'," .. + FAX_OPTIONS[mode] .. + '}' .. task.uri + + local originate = 'originate ' .. dial_string .. ' &lua(fax_queue/exec.lua)' + + log.notice(originate) + esl = assert(Esl.new()) + local ok, err = esl:api(originate) + log.notice(ok or err) + end) + + if esl then esl:close() end + + if not ok then + Tasks.release_task(task) + log.noticef("Error execute task: %s", tostring(err)) + end + + return true +end + +local function poll_once() + Tasks.cleanup_tasks() + while next_task() do + sleep(5000) + end + Tasks.release_db() +end + +return { + poll_once = poll_once; +} diff --git a/resources/install/scripts/fax_queue/retry.lua b/resources/install/scripts/fax_queue/retry.lua new file mode 100644 index 0000000000..2adcd45b27 --- /dev/null +++ b/resources/install/scripts/fax_queue/retry.lua @@ -0,0 +1,345 @@ +-- include libraries + require "resources.functions.config"; + require "resources.functions.explode"; + require "resources.functions.split"; + require "resources.functions.count"; + + local log = require "resources.functions.log".fax_retry + local Database = require "resources.functions.database" + local Settings = require "resources.functions.lazy_settings" + local Tasks = require "fax_queue.tasks" + + local task_uuid = env:getHeader('task_uuid') + local task = Tasks.select_task(task_uuid) + if not task then + log.warningf("Can not find fax task: %q", tostring(task_uuid)) + return + end + +-- show all channel variables + if debug["fax_serialize"] then + log.noticef("info:\n%s", env:serialize()) + end + + local dbh = Database.new('system') + +-- Channel/FusionPBX variables + local uuid = env:getHeader("uuid") + local domain_uuid = env:getHeader("domain_uuid") or task.domain_uuid + local domain_name = env:getHeader("domain_name") or task.domain_name + local origination_caller_id_name = env:getHeader("origination_caller_id_name") or '000000000000000' + local origination_caller_id_number = env:getHeader("origination_caller_id_number") or '000000000000000' + local accountcode = env:getHeader("accountcode") + local duration = tonumber(env:getHeader("billmsec")) or 0 + local sip_to_user = env:getHeader("sip_to_user") + local bridge_hangup_cause = env:getHeader("bridge_hangup_cause") + local hangup_cause_q850 = tonumber(env:getHeader("hangup_cause_q850")) + local answered = duration > 0 + +-- fax variables + local fax_success = env:getHeader('fax_success') + local has_t38 = env:getHeader('has_t38') or 'false' + local t38_broken_boolean = env:getHeader('t38_broken_boolean') or '' + local fax_result_code = tonumber(env:getHeader('fax_result_code')) or 2 + local fax_result_text = env:getHeader('fax_result_text') or 'FS_NOT_SET' + local fax_ecm_used = env:getHeader('fax_ecm_used') or '' + local fax_local_station_id = env:getHeader('fax_local_station_id') or '' + local fax_document_transferred_pages = env:getHeader('fax_document_transferred_pages') or nil + local fax_document_total_pages = env:getHeader('fax_document_total_pages') or nil + local fax_image_resolution = env:getHeader('fax_image_resolution') or '' + local fax_image_size = env:getHeader('fax_image_size') or nil + local fax_bad_rows = env:getHeader('fax_bad_rows') or nil + local fax_transfer_rate = env:getHeader('fax_transfer_rate') or nil + local fax_v17_disabled = env:getHeader('fax_v17_disabled') or '' + local fax_ecm_requested = env:getHeader('fax_ecm_requested') or '' + local fax_remote_station_id = env:getHeader('fax_remote_station_id') or '' + + local fax_options = ("fax_use_ecm=%s,fax_enable_t38=%s,fax_enable_t38_request=%s,fax_disable_v17=%s"):format( + env:getHeader('fax_use_ecm') or '', + env:getHeader('fax_enable_t38') or '', + env:getHeader('fax_enable_t38_request') or '', + env:getHeader('fax_disable_v17') or '' + ) + +-- Fax task params + local fax_uri = env:getHeader("fax_uri") or task.uri + local fax_file = env:getHeader("fax_file") or task.fax_file + local wav_file = env:getHeader("wav_file") or task.wav_file + local fax_uuid = task.fax_uuid + +-- Email variables + local email_address = env:getHeader("mailto_address") + local from_address = env:getHeader("mailfrom_address") or email_address + local number_dialed = fax_uri:match("/([^/]-)%s*$") + local email_message_fail = "We are sorry the fax failed to go through. It has been attached. Please check the number "..number_dialed..", and if it was correct you might consider emailing it instead." + local email_message_success = "We are happy to report the fax was sent successfully. It has been attached for your records." + + log.noticef([[<<< CALL RESULT >>> + uuid: = '%s' + answered: = '%s' + fax_file: = '%s' + wav_file: = '%s' + fax_uri: = '%s' + sip_to_user: = '%s' + accountcode: = '%s' + origination_caller_id_name: = '%s' + origination_caller_id_number: = '%s' + mailfrom_address: = '%s' + mailto_address: = '%s' + hangup_cause_q850: = '%s' + fax_options = '%s' +]], + tostring(uuid) , + tostring(answered) , + tostring(fax_file) , + tostring(wav_file) , + tostring(fax_uri) , + tostring(sip_to_user) , + tostring(accountcode) , + tostring(origination_caller_id_name) , + tostring(origination_caller_id_number) , + tostring(mailfrom_address) , + tostring(mailto_address) , + tostring(hangup_cause_q850) , + fax_options +) + + if fax_success then + log.noticef([[<<< FAX RESULT >>> + fax_success = '%s' + has_t38 = '%s' + t38_broken_boolean = '%s' + fax_result_code = '%s' + fax_result_text = '%s' + fax_ecm_used = '%s' + fax_local_station_id = '%s' + fax_document_transferred_pages = '%s' + fax_document_total_pages = '%s' + fax_image_resolution = '%s' + fax_image_size = '%s' + fax_bad_rows = '%s' + fax_transfer_rate = '%s' + fax_v17_disabled = '%s' + fax_ecm_requested = '%s' + fax_remote_station_id = '%s' + '%s' +]], + fax_success , + has_t38 , + t38_broken_boolean , + fax_result_code , + fax_result_text , + fax_ecm_used , + fax_local_station_id , + fax_document_transferred_pages , + fax_document_total_pages , + fax_image_resolution , + fax_image_size , + fax_bad_rows , + fax_transfer_rate , + fax_v17_disabled , + fax_ecm_requested , + fax_remote_station_id , + '---------------------------------' + ) + end + +--get the values from the fax file + if not (fax_uuid and domain_name) then + local array = split(fax_file, "[\\/]+") + domain_name = domain_name or array[#array - 3] + local fax_extension = fax_extension or array[#array - 2] + + if not fax_uuid then + local sql = "SELECT fax_uuid FROM v_fax " + sql = sql .. "WHERE domain_uuid = '" .. domain_uuid .. "' " + sql = sql .. "AND fax_extension = '" .. fax_extension .. "' " + fax_uuid = dbh:first_value(sql); + end + end + +--get the domain_uuid using the domain name required for multi-tenant + if domain_name and not domain_uuid then + local sql = "SELECT domain_uuid FROM v_domains "; + sql = sql .. "WHERE domain_name = '" .. domain_name .. "' " + domain_uuid = dbh:first_value(sql) + end + + assert(domain_name and domain_uuid) + +--settings + local settings = Settings.new(dbh, domain_name, domain_uuid) + local keep_local = settings:get('fax', 'keep_local','boolean') + local storage_type = (keep_local == "false") and "" or settings:get('fax', 'storage_type', 'text') + +--be sure accountcode is not empty + if (accountcode == nil) then + accountcode = domain_name + end + + local function opt(v, default) + if v then return "'" .. v .. "'" end + return default or 'NULL' + end + + local function now_sql() + return (database["type"] == "sqlite") and "'"..os.date("%Y-%m-%d %X").."'" or "now()"; + end + +--add to fax logs + do + local fields = { + "fax_log_uuid"; + "domain_uuid"; + "fax_uuid"; + "fax_success"; + "fax_result_code"; + "fax_result_text"; + "fax_file"; + "fax_ecm_used"; + "fax_local_station_id"; + "fax_document_transferred_pages"; + "fax_document_total_pages"; + "fax_image_resolution"; + "fax_image_size"; + "fax_bad_rows"; + "fax_transfer_rate"; + "fax_retry_attempts"; + "fax_retry_limit"; + "fax_retry_sleep"; + "fax_uri"; + "fax_date"; + "fax_epoch"; + } + + local values = { + "'"..uuid .. "'"; + "'"..domain_uuid .. "'"; + opt(fax_uuid); + opt(fax_success); + opt(fax_result_code); + opt(fax_result_text); + opt(fax_file); + opt(fax_ecm_used); + opt(fax_local_station_id); + opt(fax_document_transferred_pages, "'0'"); + opt(fax_document_total_pages, "'0'"); + opt(fax_image_resolution); + opt(fax_image_size); + opt(fax_bad_rows); + opt(fax_transfer_rate); + opt(fax_retry_attempts); + opt(fax_retry_limit); + opt(fax_retry_sleep); + opt(fax_uri); + now_sql(); + "'"..os.time().."' "; + } + + local sql = "insert into v_fax_logs(" .. table.concat(fields, ",") .. ")" .. + "values(" .. table.concat(values, ",") .. ")" + + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[FAX] retry: "..sql.."\n"); + end + dbh:query(sql); + end + +-- add the fax files + if fax_success == "1" then + + if storage_type == "base64" then + --include the base64 function + require "resources.functions.base64"; + + --base64 encode the file + local f = io.open(fax_file, "rb"); + if not f then + log.waitng("Can not find file %s", fax_file) + storage_type = nil + else + local file_content = f:read("*all"); + f:close() + fax_base64 = base64.encode(file_content) + end + end + + -- build SQL + local sql do + sql = { + "insert into v_fax_files("; + "fax_file_uuid"; ","; + "fax_uuid"; ","; + "fax_mode"; ","; + "fax_destination"; ","; + "fax_file_type"; ","; + "fax_file_path"; ","; + "fax_caller_id_name"; ","; + "fax_caller_id_number"; ","; + "fax_date"; ","; + "fax_epoch"; ","; + "fax_base64"; ","; + "domain_uuid"; " "; + ") values ("; + opt(uuid); ","; + opt(fax_uuid); ","; + "'tx'"; ","; + opt(sip_to_user); ","; + "'tif'"; ","; + opt(fax_file); ","; + opt(origination_caller_id_name); ","; + opt(origination_caller_id_number); ","; + now_sql(); ","; + "'" .. os.time() .. "'"; ","; + opt(fax_base64); ","; + opt(domain_uuid); " "; + ")" + } + + sql = table.concat(sql, "\n"); + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[FAX] SQL: " .. sql .. "\n"); + end + end + + if storage_type == "base64" then + local db_type, db_cnn = split_first(database["system"], "://", true) + local luasql = require ("luasql." .. db_type); + local env = assert (luasql[db_type]()); + local dbh = env:connect(db_cnn); + dbh:execute(sql) + dbh:close() + env:close() + else + result = dbh:query(sql) + end + end + + if fax_success == "1" then + --Success + log.info("RETRY STATS SUCCESS: GATEWAY[%s] VARS[%s]", fax_options, fax_trial); + + if keep_local == "false" then + os.remove(fax_file); + end + + Tasks.remove_task(task) + end + + if fax_success ~= "1" then + if not answered then + log.noticef("no answer: %d", hangup_cause_q850) + else + if not fax_success then + log.noticef("Fax not detected: %s", fax_options) + else + log.noticef("fax fail %s", fax_options) + end + end + + Tasks.wait_task(task, answered, hangup_cause_q850) + if task.status ~= 0 then + Tasks.remove_task(task) + end + end + diff --git a/resources/install/scripts/fax_queue/tasks.lua b/resources/install/scripts/fax_queue/tasks.lua new file mode 100644 index 0000000000..31eeb70009 --- /dev/null +++ b/resources/install/scripts/fax_queue/tasks.lua @@ -0,0 +1,223 @@ +local Database = require "resources.functions.database" +local Settings = require "resources.functions.lazy_settings" + +local db + +local Q850_TIMEOUT = { + [17] = 60; +} + +local select_task_common_sql = [[ +select + t1.task_uuid as uuid, + t1.fax_uuid as fax_uuid, + t3.domain_name, + t3.domain_uuid, + t1.task_status as status, + t1.task_uri as uri, + t1.task_dial_string as dial_string, + t1.task_dtmf as dtmf, + t1.task_fax_file as fax_file, + t1.task_wav_file as wav_file, + t1.task_no_answer_counter as no_answer_counter, + t1.task_no_answer_retry_counter as no_answer_retry_counter, + t1.task_retry_counter as retry_counter, + t2.fax_send_greeting as greeting +from v_fax_tasks t1 + inner join v_fax t2 on t2.fax_uuid = t1.fax_uuid + inner join v_domains t3 on t2.domain_uuid = t3.domain_uuid +where t1.task_interrupted <> 'true' +]] + +local next_task_sql = select_task_common_sql .. [[ +and t1.task_status = 0 and t1.task_next_time < NOW() +and t2.fax_send_channels > (select count(*) from v_fax_tasks as tasks + where tasks.fax_uuid = t1.fax_uuid and + tasks.task_status > 0 and tasks.task_status <= 2 +) +order by t1.task_next_time +]] + +local select_task_sql = select_task_common_sql .. "and t1.task_uuid='%s'" + +local aquire_task_sql = [[ + update v_fax_tasks set task_status = 1, task_lock_time = NOW() + where task_uuid = '%s' and task_status = 0 +]] + +local wait_task_sql = [[ + update v_fax_tasks + set task_status = %s, + task_lock_time = NULL, + task_no_answer_counter = %s, + task_no_answer_retry_counter = %s, + task_retry_counter = %s, + task_next_time = NOW() + interval '%s second' + where task_uuid = '%s' +]] + +local remove_task_task_sql = [[ + delete from v_fax_tasks + where task_uuid = '%s' +]] + +local release_task_sql = [[ + update v_fax_tasks + set task_status = 0, task_lock_time = NULL, + task_next_time = NOW() + interval '%s second' + where task_uuid = '%s' +]] + +local release_stuck_tasks_sql = [[ + update v_fax_tasks + set task_status = 0, task_lock_time = NULL, + task_next_time = NOW() + where task_lock_time < NOW() + interval '3600 second' +]] + +local remove_finished_tasks_sql = [[ + delete from v_fax_tasks where task_status > 3 +]] + +local function get_db() + if not db then + db = assert(Database.new('system')) + end + return db +end + +local function next_task() + local db = get_db() + + while true do + local task, err = db:first_row(next_task_sql) + if not task then return nil, err end + local ok, err = db:query( aquire_task_sql:format(task.uuid) ) + if not ok then return nil, err end + if db:affected_rows() == 1 then + task.no_answer_counter = tonumber(task.no_answer_counter) + task.no_answer_retry_counter = tonumber(task.no_answer_retry_counter) + task.retry_counter = tonumber(task.retry_counter) + return task + end + end +end + +local function select_task(task_uuid) + local db = get_db() + + local task, err = db:first_row(select_task_sql:format(task_uuid)) + if not task then return nil, err end + + task.no_answer_counter = tonumber(task.no_answer_counter) + task.no_answer_retry_counter = tonumber(task.no_answer_retry_counter) + task.retry_counter = tonumber(task.retry_counter) + + return task +end + +local function wait_task(task, answered, q850) + local db = get_db() + + local interval = 30 + + local settings = Settings.new(db, task.domain_name, task.domain_uuid) + task.status = 0 + + if not answered then + interval = Q850_TIMEOUT[q850 or 17] or interval + end + + if not answered then + local fax_send_no_answer_retry_limit = tonumber(settings:get('fax', 'send_no_answer_retry_limit', 'numeric')) or 0 + task.no_answer_retry_counter = task.no_answer_retry_counter + 1 + + if task.no_answer_retry_counter >= fax_send_no_answer_retry_limit then + task.no_answer_retry_counter = 0 + task.no_answer_counter = task.no_answer_counter + 1 + local fax_send_no_answer_limit = tonumber(settings:get('fax', 'send_no_answer_limit', 'numeric')) or 0 + if task.no_answer_counter >= fax_send_no_answer_limit then + task.status = 4 + else + interval = tonumber(settings:get('fax', 'send_no_answer_interval', 'numeric')) or interval + end + else + interval = tonumber(settings:get('fax', 'send_no_answer_retry_interval', 'numeric')) or interval + end + else + task.retry_counter = task.retry_counter + 1 + local fax_send_retry_limit = tonumber(settings:get('fax', 'send_retry_limit', 'numeric')) or 0 + + if task.retry_counter >= fax_send_retry_limit then + task.status = 4 + else + interval = tonumber(settings:get('fax', 'send_retry_interval', 'numeric')) or interval + task.task_seq_call_counter = 0 + end + end + + local sql = wait_task_sql:format( + tostring(task.status), + tostring(task.no_answer_counter), + tostring(task.no_answer_retry_counter), + tostring(task.retry_counter), + tostring(interval), + task.uuid + ) + + print(sql) + + local ok, err = db:query( sql ) + + if not ok then return nil, err end + + return task +end + +local function remove_task(task) + local db = get_db() + + local sql = remove_task_task_sql:format(task.uuid) + local ok, err = db:query( sql ) + if not ok then return nil, err end + return db:affected_rows() +end + +local function release_task(task) + local db = get_db() + + local interval = 30 + + local sql = release_task_sql:format( + tostring(interval), + task.uuid + ) + + local ok, err = db:query( sql ) + + if not ok then return nil, err end + + return task +end + +local function cleanup_tasks() + local db = get_db() + + db:query(release_stuck_tasks_sql) + db:query(remove_finished_tasks_sql) +end + +return { + release_db = function() + if db then + db:release() + db = nil + end + end; + next_task = next_task; + wait_task = wait_task; + select_task = select_task; + remove_task = remove_task; + release_task = release_task; + cleanup_tasks = cleanup_tasks; +} diff --git a/resources/install/scripts/fax_queue_poll_once.lua b/resources/install/scripts/fax_queue_poll_once.lua new file mode 100644 index 0000000000..c42ee62c72 --- /dev/null +++ b/resources/install/scripts/fax_queue_poll_once.lua @@ -0,0 +1 @@ +require "fax_queue.next".poll_once() \ No newline at end of file diff --git a/resources/install/scripts/resources/functions/cache.lua b/resources/install/scripts/resources/functions/cache.lua index 06548af1cd..6d121eb995 100644 --- a/resources/install/scripts/resources/functions/cache.lua +++ b/resources/install/scripts/resources/functions/cache.lua @@ -8,7 +8,13 @@ require "resources.functions.trim"; -local api = api or freeswitch.API(); +local api = api +if (not api) and freeswitch then api = freeswitch.API() else +api = {} +function api:execute() + return '-ERR UNSUPPORTTED' +end +end local function send_event(action, key) local event = freeswitch.Event("MEMCACHE", action); diff --git a/resources/install/scripts/resources/functions/database.lua b/resources/install/scripts/resources/functions/database.lua index f8939126ff..17abe280ba 100644 --- a/resources/install/scripts/resources/functions/database.lua +++ b/resources/install/scripts/resources/functions/database.lua @@ -1,115 +1,190 @@ require 'resources.functions.config' -require 'resources.functions.file_exists' -require 'resources.functions.database_handle' -local unpack = unpack or table.unpack +----------------------------------------------------------- +local OdbcDatabase = {} if not freeswitch then +OdbcDatabase.__index = OdbcDatabase -local Database = {} do +local odbc = require "odbc.dba" -Database.__index = Database +function OdbcDatabase.new(name) + local self = setmetatable({}, OdbcDatabase) -function Database.new(name) - local dbh = assert(name) - if type(name) == 'string' then - if name == 'switch' and file_exists(database_dir.."/core.db") then - dbh = freeswitch.Dbh("sqlite://"..database_dir.."/core.db") - else - dbh = database_handle(name) - end - end - assert(dbh:connected()) + local connection_string = assert(database[name]) - local self = setmetatable({ - _dbh = dbh; - }, Database) + local typ, dsn, user, password = connection_string:match("^(.-)://(.-):(.-):(.-)$") + assert(typ == 'odbc', "unsupported connection string:" .. connection_string) - return self + self._dbh = odbc.Connect(dsn, user, password) + + return self end -function Database:query(sql, fn) - if (fn == nil) then - return self._dbh:query(sql) - else - return self._dbh:query(sql, fn) - end +function OdbcDatabase:query(sql, fn) + self._rows_affected = nil + if fn then + return self._dbh:neach(sql, function(row) + local o = {} + for k, v in pairs(row) do + if v == odbc.NULL then + o[k] = nil + else + o[k] = tostring(v) + end + end + return fn(o) + end) + end + local ok, err = self._dbh:exec(sql) + if not ok then return nil, err end + self._rows_affected = ok + return self._rows_affected +end + +function OdbcDatabase:affected_rows() + return self._rows_affected; +end + +function OdbcDatabase:release() + if self._dbh then + self._dbh:destroy() + self._dbh = nil + end +end + +function OdbcDatabase:connected() + return self._dbh and self._dbh:connected() +end + +end +----------------------------------------------------------- + +----------------------------------------------------------- +local FsDatabase = {} if freeswitch then + +require "resources.functions.file_exists" +require "resources.functions.database_handle" + +FsDatabase.__index = FsDatabase + +function FsDatabase.new(name) + local dbh = assert(name) + if type(name) == 'string' then + if name == 'switch' and file_exists(database_dir.."/core.db") then + dbh = freeswitch.Dbh("sqlite://"..database_dir.."/core.db") + else + dbh = database_handle(name) + end + end + assert(dbh:connected()) + + local self = setmetatable({ + _dbh = dbh; + }, FsDatabase) + + return self +end + +function FsDatabase:query(sql, fn) + if fn then + return self._dbh:query(sql, fn) + end + return self._dbh:query(sql) +end + +function FsDatabase:affected_rows() + if self._dbh then + return self._dbh:affected_rows() + end +end + +function FsDatabase:release() + if self._dbh then + self._dbh:release() + self._dbh = nil + end +end + +function FsDatabase:connected() + return self._dbh and self._dbh:connected() +end + +end +----------------------------------------------------------- + +----------------------------------------------------------- +local Database = {} do +Database.__index = Database +Database.__base = freeswitch and FsDatabase or OdbcDatabase +Database = setmetatable(Database, Database.__base) + +function Database.new(...) + local self = Database.__base.new(...) + setmetatable(self, Database) + return self end function Database:first_row(sql) - local result - local ok, err = self:query(sql, function(row) - result = row - return 1 - end) - if not ok then return nil, err end - return result + local result + local ok, err = self:query(sql, function(row) + result = row + return 1 + end) + if not ok then return nil, err end + return result end function Database:first_value(sql) - local result, err = self:first_row(sql) - if not result then return nil, err end - local k, v = next(result) - return v + local result, err = self:first_row(sql) + if not result then return nil, err end + local k, v = next(result) + return v end function Database:first(sql, ...) - local result, err = self:first_row(sql) - if not result then return nil, err end - local t, n = {}, select('#', ...) - for i = 1, n do - t[i] = result[(select(i, ...))] - end - return unpack(t, 1, n) + local result, err = self:first_row(sql) + if not result then return nil, err end + local t, n = {}, select('#', ...) + for i = 1, n do + t[i] = result[(select(i, ...))] + end + return unpack(t, 1, n) end function Database:fetch_all(sql) - local result = {} - local ok, err = self:query(sql, function(row) - result[#result + 1] = row - end) - if not ok then return nil, err end - return result + local result = {} + local ok, err = self:query(sql, function(row) + result[#result + 1] = row + end) + if (not ok) and err then return nil, err end + return result end -function Database:release(sql) - if self._dbh then - self._dbh:release() - self._dbh = nil - end -end +function Database.__self_test__(...) + local db = Database.new(...) + assert(db:connected()) -function Database:connected(sql) - return self._dbh and self._dbh:connected() -end + assert("1" == db:first_value("select 1 as v union all select 2 as v")) -function Database.__self_test__(name) - local db = Database.new(name or 'system') - assert(db:connected()) + local t = assert(db:first_row("select '1' as v union all select '2' as v")) + assert(t.v == "1") - assert("1" == db:first_value("select 1 as v union all select 2 as v")) + t = assert(db:fetch_all("select '1' as v union all select '2' as v")) + assert(#t == 2) + assert(t[1].v == "1") + assert(t[2].v == "2") - local t = assert(db:first_row("select 1 as v union all select 2 as v")) - assert(t.v == "1") + local a, b = assert(db:first("select '1' as b, '2' as a", 'a', 'b')) + assert(a == "2") + assert(b == "1") - t = assert(db:fetch_all("select 1 as v union all select 2 as v")) - assert(#t == 2) - assert(t[1].v == "1") - assert(t[2].v == "2") + -- assert(nil == db:first_value("some non sql query")) - local a, b = assert(db:first("select 1 as b, 2 as a", 'a', 'b')) - assert(a == "2") - assert(b == "1") - - -- assert(nil == db:first_value("some non sql query")) - - db:release() - assert(not db:connected()) - print(" * databse - OK!") + db:release() + assert(not db:connected()) + print(" * databse - OK!") end end - --- if debug.self_test then --- Database.__self_test__() --- end +----------------------------------------------------------- return Database \ No newline at end of file diff --git a/resources/install/scripts/resources/functions/esl.lua b/resources/install/scripts/resources/functions/esl.lua new file mode 100644 index 0000000000..fcd4898754 --- /dev/null +++ b/resources/install/scripts/resources/functions/esl.lua @@ -0,0 +1,159 @@ +local function class(base) + local t = base and setmetatable({}, base) or {} + t.__index = t + t.__class = t + t.__base = base + + function t.new(...) + local o = setmetatable({}, t) + if o.__init then + if t == ... then -- we call as Class:new() + return o:__init(select(2, ...)) + else -- we call as Class.new() + return o:__init(...) + end + end + return o + end + + return t +end + +local EventSocket = class() do + +if not freeswitch then + +local socket = require "socket" +local ESLParser = require "lluv.esl".ESLParser +local split_status = require "lluv.esl.utils".split_status +local Database = require "resources.functions.database" + +local EOL = '\n' + +local host, port, auth + +function EventSocket:__init() + if not host then + local db = Database.new('system') + local settings, err = db:first_row("select event_socket_ip_address, event_socket_port, event_socket_password from v_settings") + if not settings then return nil, err end + host, port, auth = settings.event_socket_ip_address, settings.event_socket_port, settings.event_socket_password + end + + return self:_connect(host, port, auth) +end + +function EventSocket:_connect(host, port, password) + local err + self._cnn, err = socket.connect(host, port) + if not self._cnn then return nil, err end + + self._cnn:settimeout(1) + + self._parser = ESLParser.new() + local auth + while true do + local event + event, err = self:_recv_event() + if not event then break end + + local ct = event:getHeader('Content-Type') + if ct == 'auth/request' then + self._cnn:send('auth ' .. password .. EOL .. EOL) + elseif ct == 'command/reply' then + local reply = event:getHeader('Reply-Text') + if reply then + local ok, status, msg = split_status(reply) + if ok then auth = true else err = msg end + else + err = 'invalid response' + end + break + end + end + + if not auth then + self._cnn:close() + self._cnn = nil + return nil, err + end + + return self +end + +function EventSocket:_recv_event() + local event, err = self._parser:next_event() + + while event == true do + local str, rst + str, err, rst = self._cnn:receive("*l") + if str then self._parser:append(str):append(EOL) end + if rst then self._parser:append(rst) end + if err and err ~= 'timeout' then + break + end + event = self._parser:next_event() + end + + if (not event) or (event == true) then + return nil, err + end + + return event +end + +function EventSocket:_request(cmd) + if not self._cnn then return nil, 'closed' end + + for str in (cmd .. '\n'):gmatch("(.-)\n") do + self._cnn:send(str .. EOL) + end + self._cnn:send(EOL) + + return self:_recv_event() +end + +function EventSocket:api(cmd) + local event, err = self:_request('api ' .. cmd) + if not event then return nil, err end + local body = event:getBody() + if body then return body end + return event:getReply() +end + +function EventSocket:close() + if self._cnn then + self._cnn:close() + self._cnn = nil + end +end + +end + +if freeswitch then + +local api + +function EventSocket:__init() + self._api = api or freeswitch.API() + api = self._api + return self +end + +function EventSocket:api(cmd) + local result = self._api:executeString(cmd) + if result and result:sub(1, 4) == '-ERR' then + return nil, result:sub(5) + end + return result +end + +function EventSocket:close() + self._api = nil +end + +end + +end + +return EventSocket diff --git a/resources/install/scripts/resources/functions/lazy_settings.lua b/resources/install/scripts/resources/functions/lazy_settings.lua new file mode 100644 index 0000000000..3d3b72b342 --- /dev/null +++ b/resources/install/scripts/resources/functions/lazy_settings.lua @@ -0,0 +1,172 @@ +-- -- Global settings +-- local settings = Settings.new('system') +-- print(settings:get('switch', 'base', 'dir')) +-- +-- Domain settings (to `fax_retry.lua`) +-- local Settings = require "resources.functions.settings" +-- local settings = Settings.new(dbh, domain_name, domain_uuid) +-- storage_type = settings:get('fax', 'storage_type', 'text') or '' +-- storage_path = settings:get('fax', 'storage_path', 'text') or '' +-- storage_path = storage_path +-- :gsub("${domain_name}", domain_name) +-- :gsub("${voicemail_id}", voicemail_id) +-- :gsub("${voicemail_dir}", voicemail_dir) + +local Database = require "resources.functions.database" +local cache = require "resources.functions.cache" +require "resources.functions.split" + +----------------------------------------------------------- +local Settings = {} do +Settings.__index = Settings + +local NONE = '15783958-912c-4893-8866-4ccd1ca73c6e' + +local function append(t, v) + t[#t+1] = v + return t +end + +local function append_setting(array, category, subcategory, name, value) + --add the category array + if not array[category] then + array[category] = {} + end + + --add the subcategory array + if not array[category][subcategory] then + array[category][subcategory] = {} + end + + --set the name and value + if (name == "array") then + if not array[category][subcategory][name] then + array[category][subcategory][name] = {} + end + append(array[category][subcategory][name], value); + elseif value ~= nil then + array[category][subcategory][name] = value; + end +end + +function Settings.new(db, domain_name, domain_uuid) + local self = setmetatable({}, Settings) + self._array = {} + self._db = db + self._domain_name = domain_name + self._domain_uuid = domain_uuid + + return self +end + +function Settings:_cache_key(category, subcategory, name) + return 'setting:' .. (self._domain_name or '') .. ':' .. category .. ':' .. subcategory .. ':' .. name +end + +function Settings:set(category, subcategory, name, value) + append_setting(self._array, category, subcategory, name, value) + return self +end + +function Settings:get(category, subcategory, name) + local a = self._array + local v = a[category] and a[category][subcategory] and a[category][subcategory][name] + if v == NONE then return nil end + if v ~= nil then return v end + + local key = self:_cache_key(category, subcategory, name) + + v = cache.get(key) + if v then + if v ~= NONE and name == 'array' then + v = split(v, '/+/', true) + end + self:set(category, subcategory, name, v) + if v == NONE then return nil end + return v + end + + return self:_load(category, subcategory, name) +end + +function Settings:_load(category, subcategory, name) + local domain_uuid = self._domain_uuid + local db = self._db + if type(self._db) == 'string' then + db = Database.new(self._db) + end + + local found = false + --get the domain settings + if domain_uuid then + sql = "SELECT domain_setting_uuid,domain_setting_category,domain_setting_subcategory,domain_setting_name,domain_setting_value " + sql = sql .. "FROM v_domain_settings "; + sql = sql .. "WHERE domain_uuid = '" .. domain_uuid .. "'"; + sql = sql .. "AND domain_setting_enabled = 'true' "; + sql = sql .. "AND domain_setting_category = '" .. category .."'"; + sql = sql .. "AND domain_setting_subcategory = '" .. subcategory .. "'"; + sql = sql .. "AND domain_setting_name = '" .. name .. "'"; + sql = sql .. "AND domain_setting_value is not null "; + sql = sql .. "ORDER BY domain_setting_category, domain_setting_subcategory ASC "; + + db:query(sql, function(row) + found = true; + self:set( + row.domain_setting_category, + row.domain_setting_subcategory, + row.domain_setting_name, + row.domain_setting_value + ) + end) + end + + if not found then + local sql = "SELECT default_setting_uuid,default_setting_category,default_setting_subcategory,default_setting_name,default_setting_value " + sql = sql .. "FROM v_default_settings "; + sql = sql .. "WHERE default_setting_enabled = 'true' "; + sql = sql .. "AND default_setting_category = '" .. category .."'"; + sql = sql .. "AND default_setting_subcategory = '" .. subcategory .. "'"; + sql = sql .. "AND default_setting_name = '" .. name .. "'"; + sql = sql .. "AND default_setting_value is not null "; + sql = sql .. "ORDER BY default_setting_category, default_setting_subcategory ASC"; + + db:query(sql, function(row) + found = true; + self:set( + row.default_setting_category, + row.default_setting_subcategory, + row.default_setting_name, + row.default_setting_value + ) + end) + end + + if not found then + self:set(category, subcategory, name, NONE) + end + + local a = self._array + local v = a[category] and a[category][subcategory] and a[category][subcategory][name] + + if cache.support() then + local key = self:_cache_key(category, subcategory, name) + local value = v + if v ~= NONE and name == 'array' then + value = table.concat(v, '/+/') + end + local exp = expire and expire["settings"] or 3600 + cache.set(key, value, exp) + end + + if type(self._db) == 'string' then + db:release() + end + + if v == NONE then return nil end + return v +end + +end +----------------------------------------------------------- + +return Settings diff --git a/resources/install/scripts/resources/functions/log.lua b/resources/install/scripts/resources/functions/log.lua index b6cb59652b..b88818447b 100644 --- a/resources/install/scripts/resources/functions/log.lua +++ b/resources/install/scripts/resources/functions/log.lua @@ -3,9 +3,14 @@ -- log.noticef("%s %s", "hello", "world") -- -- log if debug.SQL or debug.xml_handler.SQL then -- log.tracef("SQL", "SQL is %s", sql) - -local function log(name, level, msg) - freeswitch.consoleLog(level, "[" .. name .. "] " .. msg .. "\n") +local log if freeswitch then + log = function (name, level, msg) + freeswitch.consoleLog(level, "[" .. name .. "] " .. msg .. "\n") + end +else + log = function (name, level, msg) + print(os.date("%Y-%m-%d %X") .. '[' .. level:upper() .. '] [' .. name .. '] ' .. msg) + end end local function logf(name, level, ...) diff --git a/resources/install/scripts/resources/functions/sleep.lua b/resources/install/scripts/resources/functions/sleep.lua new file mode 100644 index 0000000000..e7ace57abd --- /dev/null +++ b/resources/install/scripts/resources/functions/sleep.lua @@ -0,0 +1,15 @@ +if freeswitch then + +function sleep(ms) + freeswitch.msleep(ms) +end + +else + +local socket = require "socket" + +function sleep(ms) + socket.sleep(ms/1000) +end + +end From 21e3c628161673a53bdb89d705d652dcff6dab73 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 18 Nov 2015 16:32:00 +0300 Subject: [PATCH 031/232] Rome some comments. --- resources/install/scripts/fax_queue/exec.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/install/scripts/fax_queue/exec.lua b/resources/install/scripts/fax_queue/exec.lua index 2ecf66bcc7..47dcf54e48 100644 --- a/resources/install/scripts/fax_queue/exec.lua +++ b/resources/install/scripts/fax_queue/exec.lua @@ -11,7 +11,6 @@ -- example: pause 5 sec dial 008 pause 2 sec paly greeting -- PPPPP008@300PP -- --- api: originate {fax_file='d:/fax/file1.tiff',wav_file='c:/FreeSWITCH/sounds/music/8000/suite-espanola-op-47-leyenda_x8.wav',fax_dtmf=''}user/101@sip.office.intelcom-tg.ru &lua(fax_task.lua) require "resources.functions.config" local log = require "resources.functions.log".fax_task @@ -61,7 +60,6 @@ end local function decode_dtmf(dtmf) local r, sleep, seq = {} dtmf:gsub('P', 'pp'):gsub('.', function(ch) - -- print(ch) if ch == ';' or ch == ',' then r[#r + 1] = sleep or seq sleep, seq = nil From 1944c01820ea852e7e17ed747523d4de86e6f92d Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 18 Nov 2015 16:41:13 +0300 Subject: [PATCH 032/232] Remove some log. --- resources/install/scripts/fax_queue/exec.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/resources/install/scripts/fax_queue/exec.lua b/resources/install/scripts/fax_queue/exec.lua index 47dcf54e48..a47dc92148 100644 --- a/resources/install/scripts/fax_queue/exec.lua +++ b/resources/install/scripts/fax_queue/exec.lua @@ -1,7 +1,7 @@ -- @usage without queue --- api: originate {fax_file='',wav_file='',fax_dtmf=''}user/108@domain.local &lua(fax_task.lua) +-- api: originate {fax_file='',wav_file='',fax_dtmf=''}user/108@domain.local &lua(fax_queue/exec.lua) -- @usage with queue task --- api: originate {task_uuid=''}user/108@domain.local &lua(fax_task.lua) +-- api: originate {task_uuid=''}user/108@domain.local &lua(fax_queue/exec.lua) -- @fax_dtmf -- 0-9*# - dtmf symbols -- @200 - dtmf duration in ms @@ -139,9 +139,7 @@ local function task() session:sleep(500) end - log.notice("11111") if not (session:ready() and session:answered()) then return end - log.notice("2222") if fax_file and wav_file then start_fax_detect() @@ -180,4 +178,4 @@ task() log.noticef("STOP TASK") log.notice("Ready: " .. tostring(session:ready())) -log.notice("answered: " .. tostring(session:answered())) +log.notice("Answered: " .. tostring(session:answered())) From 9db81bdcb6e563d1cb292f49e6be46c9fb20fea7 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 18 Nov 2015 17:05:10 +0000 Subject: [PATCH 033/232] re-added file to file conflict --- resources/classes/install.php | 207 ++++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 resources/classes/install.php diff --git a/resources/classes/install.php b/resources/classes/install.php new file mode 100644 index 0000000000..a6b2d210b4 --- /dev/null +++ b/resources/classes/install.php @@ -0,0 +1,207 @@ + + Copyright (C) 2010-2015 + All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +include "root.php"; + +//define the install class + class install { + + var $result; + var $domain_uuid; + var $domain; + var $switch_conf_dir; + var $switch_scripts_dir; + var $switch_sounds_dir; + + //$options '-n' --no-clobber + public function recursive_copy($src, $dst, $options = '') { + if (file_exists('/bin/cp')) { + if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') { + //copy -R recursive, preserve attributes for SUN + $cmd = 'cp -Rp '.$src.'/* '.$dst; + } else { + //copy -R recursive, -L follow symbolic links, -p preserve attributes for other Posix systemss + $cmd = 'cp -RLp '.$options.' '.$src.'/* '.$dst; + } + exec ($cmd); + //echo $cmd."\n"; + } + else { + $dir = opendir($src); + if (!$dir) { + if (!mkdir($src, 0755, true)) { + throw new Exception("recursive_copy() source directory '".$src."' does not exist."); + } + } + if (!is_dir($dst)) { + if (!mkdir($dst, 0755, true)) { + throw new Exception("recursive_copy() failed to create destination directory '".$dst."'"); + } + } + $scripts_dir_target = $_SESSION['switch']['scripts']['dir']; + $scripts_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'); + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src)) as $file_path_source) { + if ( + substr_count($file_path_source, '/..') == 0 && + substr_count($file_path_source, '/.') == 0 && + substr_count($file_path_source, '/.svn') == 0 && + substr_count($file_path_source, '/.git') == 0 + ) { + if ($dst != $src.'/resources/config.lua') { + //echo $file_path_source.' ---> '.$dst.'
    '; + copy($file_path_source, $dst); + chmod($dst, 0755); + } + } + } + + while(false !== ($file = readdir($dir))) { + if (($file != '.') && ($file != '..')) { + if (is_dir($src.'/'.$file)) { + $this->recursive_copy($src.'/'.$file, $dst.'/'.$file); + } + else { + //copy only missing files -n --no-clobber + if (strpos($options,'-n') !== false) { + if (!file_exists($dst.'/'.$file)) { + copy($src.'/'.$file, $dst.'/'.$file); + //echo "copy(".$src."/".$file.", ".$dst."/".$file.");
    \n"; + } + } + else { + copy($src.'/'.$file, $dst.'/'.$file); + } + } + } + } + closedir($dir); + } + } + + function recursive_delete($dir) { + if (file_exists('/bin/rm')) { + exec ('rm -Rf '.$dir.'/*'); + } + else { + foreach (glob($dir) as $file) { + if (is_dir($file)) { + $this->recursive_delete("$file/*"); + rmdir($file); + //echo "rm dir: ".$file."\n"; + } else { + //echo "delete file: ".$file."\n"; + unlink($file); + } + } + } + clearstatcache(); + } + + function copy() { + $this->copy_scripts(); + //$this->copy_sounds(); + } + + function copy_conf() { + if (file_exists($this->switch_conf_dir)) { + //make a backup copy of the conf directory + $src_dir = $this->switch_conf_dir; + $dst_dir = $this->switch_conf_dir.'.orig'; + if (is_readable($src_dir)) { + $this->recursive_copy($src_dir, $dst_dir); + $this->recursive_delete($src_dir); + } + else { + if ($src_dir != "/conf") { + mkdir($src_dir, 0774, true); + } + } + //make sure the conf directory exists + if (!is_dir($this->switch_conf_dir)) { + if (!mkdir($this->switch_conf_dir, 0774, true)) { + throw new Exception("Failed to create the switch conf directory '".$this->switch_conf_dir."'. "); + } + } + //copy resources/templates/conf to the freeswitch conf dir + if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')){ + $src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf"; + } + else { + $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf"; + } + $dst_dir = $this->switch_conf_dir; + if (is_readable($dst_dir)) { + $this->recursive_copy($src_dir, $dst_dir); + } + //print_r($install->result); + } + } + // added /examples/ into the string + function copy_scripts() { + if (file_exists($this->switch_scripts_dir)) { + if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){ + $src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts'; + } + else { + $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'; + } + $dst_dir = $this->switch_scripts_dir; + if (is_readable($this->switch_scripts_dir)) { + $this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']); + unset($src_dir, $dst_dir); + } + chmod($dst_dir, 0774); + } + } + + //function copy_sounds() { + // if (file_exists($this->switch_sounds_dir)) { + // if (file_exists('/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/')){ + // $src_dir = '/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/'; + // changes the output dir for testing + // $dst_dir = $this->switch_sounds_dir.'/en/us/fusionpbx/custom/'; + // } + // else { + // $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sounds/en/us/callie/custom/'; + // $dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/'; + // } + // $this->recursive_copy($src_dir, $dst_dir, "-n"); + // if (is_readable($this->switch_sounds_dir)) { + // $this->recursive_copy($src_dir, $dst_dir); + // chmod($dst_dir, 0664); + // } + // } + //} + } + +//how to use the class + //$install = new install; + //$install->domain_uuid = $domain_uuid; + //$install->switch_conf_dir = $switch_conf_dir; + //$install->switch_scripts_dir = $switch_scripts_dir; + //$install->switch_sounds_dir = $switch_sounds_dir; + //$install->copy(); + //print_r($install->result); +?> \ No newline at end of file From 75efd1bd58f180713e0830050e9b80d582eed8a8 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 18 Nov 2015 17:30:43 +0000 Subject: [PATCH 034/232] Resolved install issues, environment now in tact enough to run app_defaults --- core/install/install_first_time.php | 32 +- .../resources/classes/detect_switch.php | 9 +- .../resources/classes/install_fusionpbx.php | 315 +++++++++++------- .../resources/classes/install_switch.php | 6 +- resources/classes/install.php | 207 ------------ 5 files changed, 222 insertions(+), 347 deletions(-) delete mode 100644 resources/classes/install.php diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php index 18e4d28c3e..045c15caa1 100644 --- a/core/install/install_first_time.php +++ b/core/install/install_first_time.php @@ -133,15 +133,6 @@ if(!$install_step) { $install_step = 'select_language'; } //set a default enviroment if first_time if($first_time_install){ - //grab the default theme - $set_session_theme = 1; - $domains_processed = 1; - include "themes/enhanced/app_defaults.php"; - unset($set_session_theme, $domains_processed); - //initialize some defaults so we can be 'logged in' - $_SESSION['username'] = 'first_time_install'; - $_SESSION['permissions'][]['permission_name'] = 'superadmin'; - $_SESSION['menu'] = ''; //initialize some varibles to cut down on warnings $_SESSION['message'] = ''; $v_link_label_play = ''; @@ -277,7 +268,7 @@ if(!$install_step) { $install_step = 'select_language'; } } if($detect_ok){ $install_ok = true; - echo "
    \n";
    +			echo "
    \n";
     			function error_handler($err_severity, $errstr, $errfile, $errline ) {
     				if (0 === error_reporting()) { return false;}
     				switch($err_severity)
    @@ -292,12 +283,12 @@ if(!$install_step) { $install_step = 'select_language'; }
     					default: 					return false;
     				}
     			}
    -			set_error_handler("error_handler");
    +			#set_error_handler("error_handler");
     			try {
    -				$domain_uuid = uuid();
     				require_once "resources/classes/install_fusionpbx.php";
    -				$fusionPBX = new install_fusionpbx($domain_name, $domain_uuid, $switch_detect);
    -				$fusionPBX->debug = true;
    +				$fusionPBX = new install_fusionpbx($domain_name, null, $switch_detect);
    +				$domain_uuid = $fusionPBX->domain_uuid();
    +				//$fusionPBX->debug = true;
     				$fusionPBX->admin_username = $admin_username;
     				$fusionPBX->admin_password = $admin_password;
     				$fusionPBX->default_country = $install_default_country;
    @@ -312,7 +303,7 @@ if(!$install_step) { $install_step = 'select_language'; }
     		
     				require_once "resources/classes/install_switch.php";
     				$switch = new install_switch($domain_name, $domain_uuid, $switch_detect);
    -				$switch->debug = true;
    +				//$switch->debug = true;
     				$switch->install();
     			}catch(Exception $e){
     				echo "
    \n"; @@ -344,6 +335,17 @@ if(!$install_step) { $install_step = 'select_language'; } echo "

    Unkown install_step '$install_step'

    \n"; } +if($first_time_install){ + //grab the default theme + $set_session_theme = 1; + $domains_processed = 1; + include "themes/enhanced/app_defaults.php"; + unset($set_session_theme, $domains_processed); + //initialize some defaults so we can be 'logged in' + $_SESSION['username'] = 'first_time_install'; + $_SESSION['permissions'][]['permission_name'] = 'superadmin'; + $_SESSION['menu'] = ''; +} // add the content to the template and then send output $body = ob_get_contents(); //get the output from the buffer ob_end_clean(); //clean the buffer diff --git a/core/install/resources/classes/detect_switch.php b/core/install/resources/classes/detect_switch.php index 9d3dd3775c..4297cc4cec 100644 --- a/core/install/resources/classes/detect_switch.php +++ b/core/install/resources/classes/detect_switch.php @@ -150,6 +150,13 @@ require_once "resources/classes/EventSocket.php"; $esl->reset_fp(); return $result; } - + + public function restart_switch() { + $this->connect_event_socket(); + if(!$this->event_socket){ + throw new Exception('Failed to use event socket'); + } + $this->event_socket_request('api fsctl shutdown restart elegant'); + } } ?> \ No newline at end of file diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 0d4e74d75e..6d62060939 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -29,12 +29,14 @@ include "root.php"; //define the install class class install_fusionpbx { - protected $domain_uuid; + protected $_domain_uuid; protected $domain_name; protected $detect_switch; protected $config_php; protected $menu_uuid = 'b4750c3f-2a86-b00d-b7d0-345c14eca286'; protected $dbh; + + public function domain_uuid() { return $this->_domain_uuid; } public $debug = false; @@ -57,7 +59,8 @@ include "root.php"; if(!is_a($detect_switch, 'detect_switch')){ throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)'); } - $this->domain_uuid = $domain_uuid; + if($domain_uuid == null){ $domain_uuid = uuid(); } + $this->_domain_uuid = $domain_uuid; $this->domain_name = $domain_name; $this->detect_switch = $detect_switch; if (is_dir("/etc/fusionpbx")){ @@ -91,7 +94,7 @@ include "root.php"; $this->create_superuser(); require "resources/require.php"; $this->create_menus(); - $this->post_create(); + $this->app_defaults(); } protected function create_config_php() { @@ -196,7 +199,7 @@ include "root.php"; protected function create_database() { require $this->config_php; - $this->write_progress("creating database as " . $this->db_type); + $this->write_progress("Creating database as " . $this->db_type); $function = "create_database_" . $this->db_type; $this->$function(); global $db; @@ -512,17 +515,23 @@ include "root.php"; protected function create_domain() { - $this->write_progress("checking if domain exists '" . $this->domain_name . "'"); - $sql = "select count(*) from v_domains "; + $this->write_progress("Checking if domain exists '" . $this->domain_name . "'"); + $sql = "select * from v_domains "; $sql .= "where domain_name = '".$this->domain_name."' "; - + $sql .= "limit 1"; $this->write_debug($sql); $prep_statement = $this->dbh->prepare(check_sql($sql)); $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + $result = $prep_statement->fetch(PDO::FETCH_NAMED); unset($sql, $prep_statement); - if ($row['num_rows'] == 0) { - $this->write_progress("creating domain '" . $this->domain_name . "'"); + if ($result) { + $this->_domain_uuid = $result['domain_uuid']; + $this->write_progress("... domain exists as '" . $this->_domain_uuid . "'"); + if($result['domain_enabled'] != 'true'){ + throw new Exception("Domain already exists but is disabled, this is unexpected"); + } + }else{ + $this->write_progress("... creating domain"); $sql = "insert into v_domains "; $sql .= "("; $sql .= "domain_uuid, "; @@ -531,7 +540,7 @@ include "root.php"; $sql .= ") "; $sql .= "values "; $sql .= "("; - $sql .= "'".$this->domain_uuid."', "; + $sql .= "'".$this->_domain_uuid."', "; $sql .= "'".$this->domain_name."', "; $sql .= "'' "; $sql .= ");"; @@ -801,123 +810,180 @@ include "root.php"; } protected function create_superuser() { - //check if it exists first? - $this->write_progress("creating super user '" . $this->admin_username . "'"); - //add a user and then add the user to the superadmin group - //prepare the values - $this->admin_uuid = uuid(); - $contact_uuid = uuid(); - //set a sessiong variable - $_SESSION["user_uuid"] = $user_uuid; - //salt used with the password to create a one way hash + $this->write_progress("Checking if superuser exists '" . $this->domain_name . "'"); + $sql = "select * from v_users "; + $sql .= "where domain_uuid = '".$this->_domain_uuid."' "; + $sql .= "and username = '".$this->admin_username."' "; + $sql .= "limit 1 "; + $this->write_debug($sql); + $prep_statement = $this->dbh->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetch(PDO::FETCH_NAMED); + unset($sql, $prep_statement); $salt = generate_password('20', '4'); - //add the user account - $sql = "insert into v_users "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "user_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "username, "; - $sql .= "password, "; - $sql .= "salt, "; - $sql .= "add_date, "; - $sql .= "add_user "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$this->domain_uuid."', "; - $sql .= "'".$this->admin_uuid."', "; - $sql .= "'$contact_uuid', "; - $sql .= "'".$this->admin_username."', "; - $sql .= "'".md5($salt.$this->admin_password)."', "; - $sql .= "'$salt', "; - $sql .= "now(), "; - $sql .= "'".$this->admin_username."' "; - $sql .= ");"; - $this->write_debug( $sql."\n"); - $this->dbh->exec(check_sql($sql)); - unset($sql); - - //add to contacts - $sql = "insert into v_contacts "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "contact_type, "; - $sql .= "contact_name_given, "; - $sql .= "contact_nickname "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$this->domain_uuid."', "; - $sql .= "'$contact_uuid', "; - $sql .= "'user', "; - $sql .= "'".$this->admin_username."', "; - $sql .= "'".$this->admin_username."' "; - $sql .= ")"; - $this->dbh->exec(check_sql($sql)); - unset($sql); - - //add the user to the superadmin group - $sql = "insert into v_group_users "; - $sql .= "("; - $sql .= "group_user_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "user_uuid, "; - $sql .= "group_name "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'".$this->domain_uuid."', "; - $sql .= "'".$this->admin_uuid."', "; - $sql .= "'superadmin' "; - $sql .= ");"; - $this->write_debug( $sql."\n"); - $this->dbh->exec(check_sql($sql)); - unset($sql); + if ($result) { + $this->admin_uuid = $result['user_uuid']; + $this->write_progress("... superuser exists as '" . $this->admin_uuid . "', updating password"); + $sql = "update v_users "; + $sql .= "set password = '".md5($salt.$this->admin_password)."' "; + $sql .= "set salt = '$salt' "; + $sql .= "where USER_uuid = '".$this->admin_uuid."' "; + $this->write_debug($sql); + $this->dbh->exec(check_sql($sql)); + }else{ + $this->write_progress("... creating super user '" . $this->admin_username . "'"); + //add a user and then add the user to the superadmin group + //prepare the values + $this->admin_uuid = uuid(); + $contact_uuid = uuid(); + //set a sessiong variable + $_SESSION["user_uuid"] = $user_uuid; + //salt used with the password to create a one way hash + //add the user account + $sql = "insert into v_users "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "user_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "username, "; + $sql .= "password, "; + $sql .= "salt, "; + $sql .= "add_date, "; + $sql .= "add_user "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$this->_domain_uuid."', "; + $sql .= "'".$this->admin_uuid."', "; + $sql .= "'$contact_uuid', "; + $sql .= "'".$this->admin_username."', "; + $sql .= "'".md5($salt.$this->admin_password)."', "; + $sql .= "'$salt', "; + $sql .= "now(), "; + $sql .= "'".$this->admin_username."' "; + $sql .= ");"; + $this->write_debug( $sql."\n"); + $this->dbh->exec(check_sql($sql)); + unset($sql); + } + $this->write_progress("Checking if superuser contact exists"); + $sql = "select count(*) from v_contacts "; + $sql .= "where domain_uuid = '".$this->_domain_uuid."' "; + $sql .= "and contact_name_given = '".$this->admin_username."' "; + $sql .= "and contact_nickname = '".$this->admin_username."' "; + $sql .= "limit 1 "; + $this->write_debug($sql); + $prep_statement = $this->dbh->prepare(check_sql($sql)); + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['count'] == 0) { + $sql = "insert into v_contacts "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "contact_type, "; + $sql .= "contact_name_given, "; + $sql .= "contact_nickname "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$this->_domain_uuid."', "; + $sql .= "'$contact_uuid', "; + $sql .= "'user', "; + $sql .= "'".$this->admin_username."', "; + $sql .= "'".$this->admin_username."' "; + $sql .= ")"; + $this->dbh->exec(check_sql($sql)); + unset($sql); + } + $this->write_progress("Checking if superuser is in the correct group"); + $sql = "select count(*) from v_group_users "; + $sql .= "where domain_uuid = '".$this->_domain_uuid."' "; + $sql .= "and user_uuid = '".$this->admin_uuid."' "; + $sql .= "and group_name = 'superadmin' "; + $sql .= "limit 1 "; + $this->write_debug($sql); + $prep_statement = $this->dbh->prepare(check_sql($sql)); + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['count'] == 0) { + //add the user to the superadmin group + $sql = "insert into v_group_users "; + $sql .= "("; + $sql .= "group_user_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "user_uuid, "; + $sql .= "group_name "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'".$this->_domain_uuid."', "; + $sql .= "'".$this->admin_uuid."', "; + $sql .= "'superadmin' "; + $sql .= ");"; + $this->write_debug( $sql."\n"); + $this->dbh->exec(check_sql($sql)); + unset($sql); + } } protected function create_menus() { - $this->write_progress("creating menus"); + $this->write_progress("Creating menus"); //set the defaults $menu_name = 'default'; $menu_language = 'en-us'; $menu_description = 'Default Menu Set'; - //add the parent menu - $sql = "insert into v_menus "; - $sql .= "("; - $sql .= "menu_uuid, "; - $sql .= "menu_name, "; - $sql .= "menu_language, "; - $sql .= "menu_description "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$this->menu_uuid."', "; - $sql .= "'$menu_name', "; - $sql .= "'$menu_language', "; - $sql .= "'$menu_description' "; - $sql .= ");"; - if ($this->debug) { - $this->write_debug( $sql."\n"); + + $this->write_progress("Checking if menu exists"); + $sql = "select count(*) from v_menus "; + $sql .= "where menu_uuid = '".$this->menu_uuid."' "; + $sql .= "limit 1 "; + $this->write_debug($sql); + $prep_statement = $this->dbh->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetch(PDO::FETCH_NAMED); + unset($sql, $prep_statement); + if ($result['count'] == 0) { + $this->write_progress("... creating menu '" . $menu_name. "'"); + $sql = "insert into v_menus "; + $sql .= "("; + $sql .= "menu_uuid, "; + $sql .= "menu_name, "; + $sql .= "menu_language, "; + $sql .= "menu_description "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$this->menu_uuid."', "; + $sql .= "'$menu_name', "; + $sql .= "'$menu_language', "; + $sql .= "'$menu_description' "; + $sql .= ");"; + if ($this->debug) { + $this->write_debug( $sql."\n"); + } + $this->dbh->exec(check_sql($sql)); + unset($sql); + + //add the menu items + require_once "resources/classes/menu.php"; + $menu = new menu; + $menu->db = $this->dbh; + $menu->menu_uuid = $this->menu_uuid; + $menu->restore(); + unset($menu); } - $this->dbh->exec(check_sql($sql)); - unset($sql); - - //add the menu items - require_once "resources/classes/menu.php"; - $menu = new menu; - $menu->db = $this->dbh; - $menu->menu_uuid = $this->menu_uuid; - $menu->restore(); - unset($menu); } - protected function post_create() { - $this->write_progress("running post steps"); - //login the user account + protected function app_defaults() { + $this->write_progress("Running app_defaults"); + + //set needed session settings $_SESSION["username"] = $this->admin_username; + $_SESSION["domain_uuid"] = $this->_domain_uuid; + require $this->config_php; + require "resources/require.php"; //get the groups assigned to the user and then set the groups in $_SESSION["groups"] $sql = "SELECT * FROM v_group_users "; @@ -949,17 +1015,19 @@ include "root.php"; $prep_statementsub->execute(); $_SESSION['permissions'] = $prep_statementsub->fetchAll(PDO::FETCH_NAMED); unset($sql, $prep_statementsub); - - //make sure the database schema and installation have performed all necessary tasks - $display_results = false; - $display_type = 'none'; + + + + + require_once "resources/classes/schema.php"; - $obj = new schema; - $obj->schema($this->dbh, $this->db_type, $this->db_name, $display_type); + global $db, $db_type, $db_name, $db_username, $db_password, $db_host, $db_path, $db_port; + + $schema = new schema; + echo $schema->schema(); //run all app_defaults.php files $default_language = $this->install_language; - require_once "resources/classes/domains.php"; $domain = new domains; $domain->upgrade(); @@ -971,6 +1039,7 @@ include "root.php"; //clear the menu $_SESSION["menu"] = ""; + } public function remove_config() { diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 61cad71e9a..b13c36b23d 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -156,7 +156,7 @@ include "root.php"; //pharData is the correct ay to do it, but it keeps creating incomplete archives //$tar = new PharData($dst_tar); //$tar->buildFromDirectory($dir); - $this->write_debug("backingup to $dst_tar"); + $this->write_debug("backing up to $dst_tar"); if (file_exists('/bin/tar')) { exec('tar -cvf ' .$dst_tar. ' -C '.$dir .' .'); }else{ @@ -166,9 +166,13 @@ include "root.php"; } } + function install() { $this->copy_conf(); $this->copy_scripts(); + //tell freeswitch to restart + $this->write_progress("Restarting switch"); + $this->detect_switch->restart_switch(); } function upgrade() { diff --git a/resources/classes/install.php b/resources/classes/install.php deleted file mode 100644 index a6b2d210b4..0000000000 --- a/resources/classes/install.php +++ /dev/null @@ -1,207 +0,0 @@ - - Copyright (C) 2010-2015 - All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -include "root.php"; - -//define the install class - class install { - - var $result; - var $domain_uuid; - var $domain; - var $switch_conf_dir; - var $switch_scripts_dir; - var $switch_sounds_dir; - - //$options '-n' --no-clobber - public function recursive_copy($src, $dst, $options = '') { - if (file_exists('/bin/cp')) { - if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') { - //copy -R recursive, preserve attributes for SUN - $cmd = 'cp -Rp '.$src.'/* '.$dst; - } else { - //copy -R recursive, -L follow symbolic links, -p preserve attributes for other Posix systemss - $cmd = 'cp -RLp '.$options.' '.$src.'/* '.$dst; - } - exec ($cmd); - //echo $cmd."\n"; - } - else { - $dir = opendir($src); - if (!$dir) { - if (!mkdir($src, 0755, true)) { - throw new Exception("recursive_copy() source directory '".$src."' does not exist."); - } - } - if (!is_dir($dst)) { - if (!mkdir($dst, 0755, true)) { - throw new Exception("recursive_copy() failed to create destination directory '".$dst."'"); - } - } - $scripts_dir_target = $_SESSION['switch']['scripts']['dir']; - $scripts_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'); - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src)) as $file_path_source) { - if ( - substr_count($file_path_source, '/..') == 0 && - substr_count($file_path_source, '/.') == 0 && - substr_count($file_path_source, '/.svn') == 0 && - substr_count($file_path_source, '/.git') == 0 - ) { - if ($dst != $src.'/resources/config.lua') { - //echo $file_path_source.' ---> '.$dst.'
    '; - copy($file_path_source, $dst); - chmod($dst, 0755); - } - } - } - - while(false !== ($file = readdir($dir))) { - if (($file != '.') && ($file != '..')) { - if (is_dir($src.'/'.$file)) { - $this->recursive_copy($src.'/'.$file, $dst.'/'.$file); - } - else { - //copy only missing files -n --no-clobber - if (strpos($options,'-n') !== false) { - if (!file_exists($dst.'/'.$file)) { - copy($src.'/'.$file, $dst.'/'.$file); - //echo "copy(".$src."/".$file.", ".$dst."/".$file.");
    \n"; - } - } - else { - copy($src.'/'.$file, $dst.'/'.$file); - } - } - } - } - closedir($dir); - } - } - - function recursive_delete($dir) { - if (file_exists('/bin/rm')) { - exec ('rm -Rf '.$dir.'/*'); - } - else { - foreach (glob($dir) as $file) { - if (is_dir($file)) { - $this->recursive_delete("$file/*"); - rmdir($file); - //echo "rm dir: ".$file."\n"; - } else { - //echo "delete file: ".$file."\n"; - unlink($file); - } - } - } - clearstatcache(); - } - - function copy() { - $this->copy_scripts(); - //$this->copy_sounds(); - } - - function copy_conf() { - if (file_exists($this->switch_conf_dir)) { - //make a backup copy of the conf directory - $src_dir = $this->switch_conf_dir; - $dst_dir = $this->switch_conf_dir.'.orig'; - if (is_readable($src_dir)) { - $this->recursive_copy($src_dir, $dst_dir); - $this->recursive_delete($src_dir); - } - else { - if ($src_dir != "/conf") { - mkdir($src_dir, 0774, true); - } - } - //make sure the conf directory exists - if (!is_dir($this->switch_conf_dir)) { - if (!mkdir($this->switch_conf_dir, 0774, true)) { - throw new Exception("Failed to create the switch conf directory '".$this->switch_conf_dir."'. "); - } - } - //copy resources/templates/conf to the freeswitch conf dir - if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')){ - $src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf"; - } - else { - $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf"; - } - $dst_dir = $this->switch_conf_dir; - if (is_readable($dst_dir)) { - $this->recursive_copy($src_dir, $dst_dir); - } - //print_r($install->result); - } - } - // added /examples/ into the string - function copy_scripts() { - if (file_exists($this->switch_scripts_dir)) { - if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){ - $src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts'; - } - else { - $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'; - } - $dst_dir = $this->switch_scripts_dir; - if (is_readable($this->switch_scripts_dir)) { - $this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']); - unset($src_dir, $dst_dir); - } - chmod($dst_dir, 0774); - } - } - - //function copy_sounds() { - // if (file_exists($this->switch_sounds_dir)) { - // if (file_exists('/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/')){ - // $src_dir = '/usr/share/examples/fusionpbx/resources/install/sounds/en/us/callie/custom/'; - // changes the output dir for testing - // $dst_dir = $this->switch_sounds_dir.'/en/us/fusionpbx/custom/'; - // } - // else { - // $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sounds/en/us/callie/custom/'; - // $dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/'; - // } - // $this->recursive_copy($src_dir, $dst_dir, "-n"); - // if (is_readable($this->switch_sounds_dir)) { - // $this->recursive_copy($src_dir, $dst_dir); - // chmod($dst_dir, 0664); - // } - // } - //} - } - -//how to use the class - //$install = new install; - //$install->domain_uuid = $domain_uuid; - //$install->switch_conf_dir = $switch_conf_dir; - //$install->switch_scripts_dir = $switch_scripts_dir; - //$install->switch_sounds_dir = $switch_sounds_dir; - //$install->copy(); - //print_r($install->result); -?> \ No newline at end of file From ed13cbc5ff5772a1ab2d65c7b8f891549c5ed176 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 19 Nov 2015 12:36:35 +0300 Subject: [PATCH 035/232] Fix. Display description as last item on fax_server page --- app/fax/fax_edit.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index 28d7613324..e690d06739 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -686,17 +686,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } } - echo "\n"; - echo "\n"; - echo " ".$text['label-description']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
    \n"; - echo "".$text['description-info']."\n"; - echo "\n"; - echo "\n"; - echo "\n"; echo "\n"; echo " ".$text['label-fax_send_greeting']."\n"; @@ -718,6 +707,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " ".$text['description-fax_send_channels']."\n"; echo "\n"; echo "\n"; + + echo "\n"; + echo "\n"; + echo " ".$text['label-description']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
    \n"; + echo "".$text['description-info']."\n"; + echo "\n"; + echo "\n"; } echo " \n"; From aaa333eda17a1429f42600953a513c40bac787a7 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 19 Nov 2015 13:13:47 +0300 Subject: [PATCH 036/232] Fix. Use fax_send_mode option in fax_send.php file. --- app/fax/fax_emails.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index f1762bc8fd..a403ffac07 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -55,6 +55,11 @@ if (sizeof($result) != 0) { $event_socket['password'] = $record['event_socket_password']; unset($sql, $prep_statement, $record); + $fax_send_mode_default = $_SESSION['fax']['send_mode']['text']; + if(strlen($fax_send_mode_default) == 0){ + $fax_send_mode_default = 'direct'; + } + foreach ($result as $row) { //get fax server and account connection details $fax_uuid = $row["fax_uuid"]; @@ -81,6 +86,11 @@ if (sizeof($result) != 0) { $_SESSION = $default_settings; load_domain_settings($domain_uuid); + $fax_send_mode = $_SESSION['fax']['send_mode']['text']; + if(strlen($fax_send_mode) == 0){ + $fax_send_mode = $fax_send_mode_default; + } + //load event socket connection parameters $_SESSION['event_socket_ip_address'] = $event_socket['ip_address']; $_SESSION['event_socket_port'] = $event_socket['port']; From 82d858c2b8338a26d29c9a83e0360db766e38a29 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 19 Nov 2015 13:19:59 +0300 Subject: [PATCH 037/232] Add. Basic fax_queue_monitor script. To start From cli: `luarun fax_queue_monitor.lua` Autostart with FS: Add `` to `lua.conf.xml` From shell: call from `script_dir` `lua fax_queue_monitor.lua` (require installed Lua and some additional libraries). To stop remove `fax_queue.tmp` file from `script_dir/run` --- .../install/scripts/fax_queue_monitor.lua | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 resources/install/scripts/fax_queue_monitor.lua diff --git a/resources/install/scripts/fax_queue_monitor.lua b/resources/install/scripts/fax_queue_monitor.lua new file mode 100644 index 0000000000..1f4371d2b7 --- /dev/null +++ b/resources/install/scripts/fax_queue_monitor.lua @@ -0,0 +1,42 @@ + local sleep_interval = 60; + +--include config.lua + require "resources.functions.config"; + +--general functions + require "resources.functions.file_exists"; + require "resources.functions.mkdir"; + require "resources.functions.sleep"; + + local log = require "resources.functions.log".fax_queue_monitor + local Next = require "fax_queue.next" + + mkdir(scripts_dir .. "/run"); + +--define the run file + local run_file = scripts_dir .. "/run/fax_queue.tmp"; + +--used to stop the lua service + local file = assert(io.open(run_file, "w")); + file:write("remove this file to stop the script"); + file:close() + + log.notice("Start") + + while true do + local ok, err = pcall(function() + Next.poll_once() + end) + + if not ok then + log.errf("fail poll queue: %s", tostring(err)) + end + + if not file_exists(run_file) then + break; + end + + sleep(sleep_interval * 1000) + end + + log.notice("Stop") From c146f9fc4f43db9d4a761158ae03ad21be26d1d3 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 19 Nov 2015 14:30:06 +0300 Subject: [PATCH 038/232] Add. Allow specify DTMF in parentheses in phone number. E.g. `123456 (PP789)` --- app/fax/fax_send.php | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 0e710bcf07..e7fb27c8ef 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -177,14 +177,6 @@ if(!function_exists('gs_cmd')) { if (($_POST['action'] == "send")) { $fax_numbers = $_POST['fax_numbers']; - if (sizeof($fax_numbers) > 0) { - foreach ($fax_numbers as $index => $fax_number) { - $fax_numbers[$index] = preg_replace("~[^0-9]~", "", $fax_number); - if ($fax_numbers[$index] == '') { unset($fax_numbers[$index]); } - } - sort($fax_numbers); - } - $fax_uuid = check_str($_POST["id"]); $fax_caller_id_name = check_str($_POST['fax_caller_id_name']); $fax_caller_id_number = check_str($_POST['fax_caller_id_number']); @@ -206,6 +198,28 @@ if(!function_exists('gs_cmd')) { $continue = true; } + // cleanup numbers + if (isset($fax_numbers)) { + foreach ($fax_numbers as $index => $fax_number) { + $tmp=array(); + $fax_dtmf = ''; + if(preg_match('/^\s*(.*?)\s*\((.*)\)\s*$/', $fax_number, $tmp)){ + $fax_number = $tmp[1]; + $fax_dtmf = $tmp[2]; + } + $fax_number = preg_replace("~[^0-9]~", "", $fax_number); + $fax_dtmf = preg_replace("~[^0-9Pp*#]~", "", $fax_dtmf); + if ($fax_number != ''){ + if ($fax_dtmf != '') {$fax_number .= " (" . $fax_dtmf . ")";} + $fax_numbers[$index] = $fax_number; + } + else{ + unset($fax_numbers[$index]); + } + } + sort($fax_numbers); + } + if ($continue) { //determine page size switch ($fax_page_size) { @@ -621,6 +635,12 @@ if(!function_exists('gs_cmd')) { foreach ($fax_numbers as $fax_number) { $dial_string = $common_dial_string; + $tmp = array(); + $fax_dtmf = ''; + if(preg_match('/^\s*(.*?)\s*\((.*)\)\s*$/', $fax_number, $tmp)){ + $fax_number = $tmp[1]; + $fax_dtmf = $tmp[2]; + } //prepare the fax command $route_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $fax_prefix . $fax_number); @@ -663,7 +683,6 @@ if(!function_exists('gs_cmd')) { $task_uuid = uuid(); $dial_string .= "task_uuid='" . $task_uuid . "',"; $wav_file = ''; //! @todo add custom message - $dtmf = ''; //! @todo add generate dtmf $description = ''; //! @todo add description $sql = <<bindValue(++$i, $wav_file); $stmt->bindValue(++$i, $fax_uri); $stmt->bindValue(++$i, $dial_string); - $stmt->bindValue(++$i, $dtmf); + $stmt->bindValue(++$i, $fax_dtmf); $stmt->bindValue(++$i, $description); if ($stmt->execute()) { $response = 'Enqueued'; From caacf5e64e8f46d455bb4831646c6a33f8e3e2d3 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 19 Nov 2015 11:33:07 +0000 Subject: [PATCH 039/232] Optimized control of background images It is now possible to have the default setting to enable background images (via theme > enable_background_images) but have a domain turn it off again as they want to use gradients or specific images. Upgrading any installation that already has any background_image enabled will cause enable_background_images to turn on to let it continue to work. Including support code that the new install system will utilize, should not affect existing systems. --- themes/enhanced/app_defaults.php | 201 +++++++++++++++++++------------ themes/enhanced/template.php | 2 +- 2 files changed, 122 insertions(+), 81 deletions(-) diff --git a/themes/enhanced/app_defaults.php b/themes/enhanced/app_defaults.php index f08e217176..5d13f453a9 100644 --- a/themes/enhanced/app_defaults.php +++ b/themes/enhanced/app_defaults.php @@ -26,7 +26,64 @@ if ($domains_processed == 1) { + //get the background images + $relative_path = PROJECT_PATH.'/themes/enhanced/images/backgrounds'; + $backgrounds = opendir($_SERVER["DOCUMENT_ROOT"].'/'.$relative_path); + unset($array); + $x = 0; + while (false !== ($file = readdir($backgrounds))) { + if ($file != "." AND $file != ".."){ + $new_path = $dir.'/'.$file; + $level = explode('/',$new_path); + $ext = pathinfo($file, PATHINFO_EXTENSION); + if ($ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "gif") { + $x++; + $array[$x]['default_setting_category'] = 'theme'; + $array[$x]['default_setting_subcategory'] = 'background_image'; + $array[$x]['default_setting_name'] = 'array'; + $array[$x]['default_setting_value'] = $relative_path.'/'.$file; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.'; + } + if ($x > 300) { break; }; + } + } + + if(!$set_session_theme){ + //get default settings + $sql = "select * from v_default_settings "; + $sql .= "where default_setting_category = 'theme' "; + $sql .= "and default_setting_subcategory = 'background_image' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset($prep_statement); + + $enable_background_images = false; + //add theme default settings + foreach ($array as $row) { + $found = false; + foreach ($default_settings as $field) { + if ($field["default_setting_value"] == $row["default_setting_value"]) { + $found = true; + } + //enable_background_image is a new setting, if a user has any background images enabled we should turn it on + if ($field["default_setting_enabled"] == 'enabled') { + $enable_background_images = true; + } + } + if (!$found) { + $orm = new orm; + $orm->name('default_settings'); + $orm->save($row); + $message = $orm->message; + //print_r($message); + } + } + } + //define array of settings + unset($array); $x = 0; $array[$x]['default_setting_category'] = 'theme'; $array[$x]['default_setting_subcategory'] = 'login_opacity'; @@ -181,25 +238,46 @@ if ($domains_processed == 1) { $array[$x]['default_setting_value'] = '0.96'; $array[$x]['default_setting_enabled'] = 'false'; $array[$x]['default_setting_description'] = 'Set the opacity of the main menu (decimal, Minimized theme only).'; + $x++; + $array[$x]['default_setting_category'] = 'theme'; + $array[$x]['default_setting_subcategory'] = 'enable_background_images'; + $array[$x]['default_setting_name'] = 'boolean'; + $array[$x]['default_setting_value'] = 'true'; + $array[$x]['default_setting_enabled'] = 'false'; + if($enable_background_images) { $array[$x]['default_setting_enabled'] = 'true'; } + $array[$x]['default_setting_description'] = 'Enable use of background images.'; - //iterate and add each, if necessary - foreach ($array as $index => $default_settings) { - //add theme default settings - $sql = "select count(*) as num_rows from v_default_settings "; - $sql .= "where default_setting_category = 'theme' "; - $sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' "; - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - unset($prep_statement); - if ($row['num_rows'] == 0) { - $orm = new orm; - $orm->name('default_settings'); - $orm->save($array[$index]); - $message = $orm->message; + if($set_session_theme){ + foreach ($array as $index => $default_settings) { + $sub_category = $array[$index]['default_setting_subcategory']; + $name = $array[$index]['default_setting_name']; + if($array[$index]['default_setting_enabled'] == 'true'){ + $_SESSION['theme'][$sub_category][$name] = $array[$index]['default_setting_value']; + }else{ + $_SESSION['theme'][$sub_category][$name] = ''; + } + } + } + else{ + //iterate and add each, if necessary + foreach ($array as $index => $default_settings) { + //add theme default settings + $sql = "select count(*) as num_rows from v_default_settings "; + $sql .= "where default_setting_category = 'theme' "; + $sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] == 0) { + $orm = new orm; + $orm->name('default_settings'); + $orm->save($array[$index]); + $message = $orm->message; + } + unset($row); } - unset($row); } } @@ -222,73 +300,36 @@ if ($domains_processed == 1) { $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_description'] = 'Set a secondary background (HTML compatible) color, for a gradient effect.'; - //add secondary background color separately, if missing - $sql = "select count(*) as num_rows from v_default_settings "; - $sql .= "where default_setting_category = 'theme' "; - $sql .= "and default_setting_subcategory = 'background_color' "; - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - unset($prep_statement); - if ($row['num_rows'] == 0) { - $orm = new orm; - $orm->name('default_settings'); - foreach ($array as $index => $null) { - $orm->save($array[$index]); + if($set_session_theme){ + foreach ($array as $index => $default_settings) { + $sub_category = $array[$index]['default_setting_subcategory']; + $idx = $array[$index]['default_setting_order']; + if($array[$index]['default_setting_enabled'] == 'true'){ + $_SESSION['theme'][$sub_category][$idx] = $array[$index]['default_setting_value']; } - $message = $orm->message; - //print_r($message); } - unset($row); + return; } - - //get the background images - $relative_path = PROJECT_PATH.'/themes/enhanced/images/backgrounds'; - $backgrounds = opendir($_SERVER["DOCUMENT_ROOT"].'/'.$relative_path); - unset($array); - $x = 0; - while (false !== ($file = readdir($backgrounds))) { - if ($file != "." AND $file != ".."){ - $new_path = $dir.'/'.$file; - $level = explode('/',$new_path); - $ext = pathinfo($file, PATHINFO_EXTENSION); - if ($ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "gif") { - $x++; - $array[$x]['default_setting_category'] = 'theme'; - $array[$x]['default_setting_subcategory'] = 'background_image'; - $array[$x]['default_setting_name'] = 'array'; - $array[$x]['default_setting_value'] = $relative_path.'/'.$file; - $array[$x]['default_setting_enabled'] = 'false'; - $array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.'; + else{ + //add secondary background color separately, if missing + $sql = "select count(*) as num_rows from v_default_settings "; + $sql .= "where default_setting_category = 'theme' "; + $sql .= "and default_setting_subcategory = 'background_color' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] == 0) { + $orm = new orm; + $orm->name('default_settings'); + foreach ($array as $index => $null) { + $orm->save($array[$index]); + } + $message = $orm->message; + //print_r($message); } - if ($x > 300) { break; }; - } - } - - //get default settings - $sql = "select * from v_default_settings "; - $sql .= "where default_setting_category = 'theme' "; - $sql .= "and default_setting_subcategory = 'background_image' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); - unset($prep_statement); - - //add theme default settings - foreach ($array as $row) { - $found = false; - foreach ($default_settings as $field) { - if ($field["default_setting_value"] == $row["default_setting_value"]) { - $found = true; - } - } - if (!$found) { - $orm = new orm; - $orm->name('default_settings'); - $orm->save($row); - $message = $orm->message; - //print_r($message); + unset($row); } } diff --git a/themes/enhanced/template.php b/themes/enhanced/template.php index e5cf267146..e33e6e390f 100644 --- a/themes/enhanced/template.php +++ b/themes/enhanced/template.php @@ -1424,7 +1424,7 @@ if (strlen($_SESSION['message']) > 0) { Date: Thu, 19 Nov 2015 14:48:41 +0300 Subject: [PATCH 040/232] Fix. fax_emails.php relay on number cleanup in fax_send.php --- app/fax/fax_emails.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index a403ffac07..69bc60defe 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -170,10 +170,6 @@ if (sizeof($result) != 0) { else { $fax_numbers[] = $tmp; } - foreach ($fax_numbers as $index => $fax_number) { - $fax_numbers[$index] = preg_replace("~[^0-9]~", "", $fax_number); - if ($fax_numbers[$index] == '') { unset($fax_numbers[$index]); } - } unset($fax_subject); //clear so not on cover page //get email body (if any) for cover page From 85056052022fb577bc752036c2fb5dcaea8f317b Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 19 Nov 2015 13:17:01 +0000 Subject: [PATCH 041/232] BugFix + Optional Enable extensions appear in directory BugFix to respect http_domain_filter when auto creating setting provision> directory_extensions populates $extensions as a contacts array in provisioning --- app/provision/app_defaults.php | 7 ++++ app/provision/resources/classes/provision.php | 41 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/app/provision/app_defaults.php b/app/provision/app_defaults.php index 7e80fd2e59..da82965d6e 100644 --- a/app/provision/app_defaults.php +++ b/app/provision/app_defaults.php @@ -179,6 +179,13 @@ $array[$x]['default_setting_enabled'] = 'false'; $array[$x]['default_setting_description'] = ''; $x++; + $array[$x]['default_setting_category'] = 'provision'; + $array[$x]['default_setting_subcategory'] = 'directory_extensions'; + $array[$x]['default_setting_name'] = 'boolean'; + $array[$x]['default_setting_value'] = 'true'; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = 'allow extensions to be provisioned as contacts as $extensions in provision templates'; + $x++; $array[$x]['default_setting_category'] = 'ntp_server_primary'; $array[$x]['default_setting_subcategory'] = 'directory'; $array[$x]['default_setting_name'] = 'text'; diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 66fa4645cb..6905a786ed 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -180,11 +180,17 @@ include "root.php"; if (strlen($device_template) == 0) { $sql = "SELECT * FROM v_devices "; $sql .= "WHERE device_mac_address=:mac "; + if($provision['http_domain_filter'] == "true") { + $sql .= "AND domain_uuid=:domain_uuid "; + } //$sql .= "WHERE device_mac_address= '$mac' "; $prep_statement_2 = $this->db->prepare(check_sql($sql)); if ($prep_statement_2) { //use the prepared statement $prep_statement_2->bindParam(':mac', $mac); + if($provision['http_domain_filter'] == "true") { + $prep_statement_2->bindParam(':domain_uuid', $domain_uuid); + } $prep_statement_2->execute(); $row = $prep_statement_2->fetch(); //set the variables from values in the database @@ -300,8 +306,14 @@ include "root.php"; if (strlen($device_uuid) > 0) { $sql = "SELECT * FROM v_devices "; $sql .= "WHERE device_uuid = '".$device_uuid."' "; + if($provision['http_domain_filter'] == "true") { + $sql .= "AND domain_uuid=:domain_uuid "; + } $prep_statement_3 = $this->db->prepare(check_sql($sql)); if ($prep_statement_3) { + if($provision['http_domain_filter'] == "true") { + $prep_statement_3->bindParam(':domain_uuid', $domain_uuid); + } $prep_statement_3->execute(); $row = $prep_statement_3->fetch(); $device_uuid_alternate = $row["device_uuid_alternate"]; @@ -311,8 +323,14 @@ include "root.php"; //get the new devices information $sql = "SELECT * FROM v_devices "; $sql .= "WHERE device_uuid = '".$device_uuid."' "; + if($provision['http_domain_filter'] == "true") { + $sql .= "AND domain_uuid=:domain_uuid "; + } $prep_statement_4 = $this->db->prepare(check_sql($sql)); if ($prep_statement_4) { + if($provision['http_domain_filter'] == "true") { + $prep_statement_4->bindParam(':domain_uuid', $domain_uuid); + } $prep_statement_4->execute(); $row = $prep_statement_4->fetch(); $device_label = $row["device_label"]; @@ -455,6 +473,29 @@ include "root.php"; unset ($prep_statement); } + //get the extensions array and add to the template engine + if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory_extensions']['boolean'] == "true") { + //get contacts from the database + $sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, e.extension "; + $sql .= "from v_contacts as c, v_extension_users as cte, v_extensions as e, v_users as u "; + $sql .= "where c.domain_uuid = '".$domain_uuid."' "; + $sql .= "and c.contact_uuid = u.contact_uuid "; + $sql .= "and u.user_uuid = cte.user_uuid "; + $sql .= "and cte.extension_uuid = e.extension_uuid "; + $sql .= "and e.directory_visible = 'true' "; + foreach ($lines as $line){ + $sql .= "and e.extension != '" . $line['user_id']. "' "; + } + $sql .= "order by c.contact_organization desc, c.contact_name_given asc, c.contact_name_family asc "; + $prep_statement = $this->db->prepare(check_sql($sql)); + $prep_statement->execute(); + $extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + + //assign the contacts array + $view->assign("extensions", $extensions); + } + //get the provisioning information from device keys if (strlen($device_uuid) > 0) { //get the device keys array From 116298f721d7ca56fecb4bfda5d5166e34337164 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 19 Nov 2015 13:57:23 +0000 Subject: [PATCH 042/232] Added External IPv6 support created the external IPv6 profile --- app/sip_profiles/app_defaults.php | 7 +- .../xml/sip_profiles/external-ipv6.xml | 23 +++++ .../sip_profiles/external-ipv6.xml.noload | 94 +++++++++++++++++++ 3 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 app/sip_profiles/resources/xml/sip_profiles/external-ipv6.xml create mode 100644 resources/templates/conf/sip_profiles/external-ipv6.xml.noload diff --git a/app/sip_profiles/app_defaults.php b/app/sip_profiles/app_defaults.php index 24d9cf2d80..3de33883bb 100644 --- a/app/sip_profiles/app_defaults.php +++ b/app/sip_profiles/app_defaults.php @@ -92,15 +92,18 @@ $sip_profile_description = "The Internal IPV6 profile binds to the IP version 6 address and is similar to the Internal profile.\n"; break; case "external": - $sip_profile_description .= "The External profile external provides anonymous calling in the public context. "; + $sip_profile_description = "The External profile external provides anonymous calling in the public context. "; $sip_profile_description .= "By default the External profile binds to port 5080. "; $sip_profile_description .= "Calls can be sent using a SIP URL \"voip.domain.com:5080\" "; break; + case "external-ipv6": + $sip_profile_description = "The External IPV6 profile binds to the IP version 6 address and is similar to the External profile.\n"; + break; case "lan": $sip_profile_description = "The LAN profile is the same as the Internal profile except that it is bound to the LAN IP.\n"; break; default: - $sip_profile_description .= ''; + $sip_profile_description = ''; } //add the sip profile if it is not false diff --git a/app/sip_profiles/resources/xml/sip_profiles/external-ipv6.xml b/app/sip_profiles/resources/xml/sip_profiles/external-ipv6.xml new file mode 100644 index 0000000000..f48bc7ed0e --- /dev/null +++ b/app/sip_profiles/resources/xml/sip_profiles/external-ipv6.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + +{v_sip_profile_settings} + + diff --git a/resources/templates/conf/sip_profiles/external-ipv6.xml.noload b/resources/templates/conf/sip_profiles/external-ipv6.xml.noload new file mode 100644 index 0000000000..4a4b4028ee --- /dev/null +++ b/resources/templates/conf/sip_profiles/external-ipv6.xml.noload @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 850a1af0c0872f7b9b7201147c080bf6c0e715f7 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 19 Nov 2015 14:54:04 +0000 Subject: [PATCH 043/232] Added more ringer types corrected reference to ssl dir to use $conf_dir moved countries list out to its own file so it can be maintained easier (and used by other apps) --- app/vars/app_defaults.php | 502 ++++++--------------- resources/countries.php | 916 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 1057 insertions(+), 361 deletions(-) create mode 100644 resources/countries.php diff --git a/app/vars/app_defaults.php b/app/vars/app_defaults.php index 96309fd365..bac1fac58f 100644 --- a/app/vars/app_defaults.php +++ b/app/vars/app_defaults.php @@ -43,12 +43,34 @@ $vars = <<=2;+=.1;%(1400,0,350,440)","var_cat":"Defaults","var_enabled":"true","var_description":""}, {"var_name":"sit","var_value":"%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)","var_cat":"Defaults","var_enabled":"true","var_description":""}, {"var_name":"sip_tls_version","var_value":"tlsv1","var_cat":"SIP","var_enabled":"true","var_description":"U0lQIGFuZCBUTFMgc2V0dGluZ3Mu"}, @@ -56,12 +78,12 @@ $vars = <<prepare(check_sql($sql)); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + + if ($row['num_rows'] == 0) { + $sql = "insert into v_vars "; + $sql .= "("; + $sql .= "var_uuid, "; + $sql .= "var_name, "; + $sql .= "var_value, "; + $sql .= "var_cat, "; + $sql .= "var_enabled, "; + $sql .= "var_order, "; + $sql .= "var_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'default_country', "; + $sql .= "'".$country["isocode"]."', "; + $sql .= "'Defaults', "; + $sql .= "'true', "; + $sql .= "'".$x."', "; + $sql .= "'' "; + $sql .= ");"; + $db->exec(check_sql($sql)); + unset($sql, $row); + $x++; + } } - } - - if ( !$found ) { - return; - } - - // Set default Country ISO code - $sql = "select count(*) as num_rows from v_vars "; - $sql .= "where var_name = 'default_country' "; - $sql .= "and var_cat = 'Defaults' "; - $prep_statement = $db->prepare(check_sql($sql)); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - - if ($row['num_rows'] == 0) { - $sql = "insert into v_vars "; - $sql .= "("; - $sql .= "var_uuid, "; - $sql .= "var_name, "; - $sql .= "var_value, "; - $sql .= "var_cat, "; - $sql .= "var_enabled, "; - $sql .= "var_order, "; - $sql .= "var_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'default_country', "; - $sql .= "'".$country["isocode"]."', "; - $sql .= "'Defaults', "; - $sql .= "'true', "; - $sql .= "'".$x."', "; - $sql .= "'' "; - $sql .= ");"; - $db->exec(check_sql($sql)); - unset($sql, $row); - $x++; + unset($prep_statement, $sql); + + // Set default Country code + $sql = "select count(*) as num_rows from v_vars "; + $sql .= "where var_name = 'default_countrycode' "; + $sql .= "and var_cat = 'Defaults' "; + $prep_statement = $db->prepare(check_sql($sql)); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] == 0) { + $sql = "insert into v_vars "; + $sql .= "("; + $sql .= "var_uuid, "; + $sql .= "var_name, "; + $sql .= "var_value, "; + $sql .= "var_cat, "; + $sql .= "var_enabled, "; + $sql .= "var_order, "; + $sql .= "var_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'default_countrycode', "; + $sql .= "'".$country["countrycode"]."', "; + $sql .= "'Defaults', "; + $sql .= "'true', "; + $sql .= "'".$x."', "; + $sql .= "'' "; + $sql .= ");"; + $db->exec(check_sql($sql)); + unset($sql, $row); + $x++; + } } - } - unset($prep_statement, $sql); - - // Set default Country code - $sql = "select count(*) as num_rows from v_vars "; - $sql .= "where var_name = 'default_countrycode' "; - $sql .= "and var_cat = 'Defaults' "; - $prep_statement = $db->prepare(check_sql($sql)); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - if ($row['num_rows'] == 0) { - $sql = "insert into v_vars "; - $sql .= "("; - $sql .= "var_uuid, "; - $sql .= "var_name, "; - $sql .= "var_value, "; - $sql .= "var_cat, "; - $sql .= "var_enabled, "; - $sql .= "var_order, "; - $sql .= "var_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'default_countrycode', "; - $sql .= "'".$country["countrycode"]."', "; - $sql .= "'Defaults', "; - $sql .= "'true', "; - $sql .= "'".$x."', "; - $sql .= "'' "; - $sql .= ");"; - $db->exec(check_sql($sql)); - unset($sql, $row); - $x++; + unset($prep_statement, $sql); + + // Set default International Direct Dialing code + $sql = "select count(*) as num_rows from v_vars "; + $sql .= "where var_name = 'default_exitcode' "; + $sql .= "and var_cat = 'Defaults' "; + $prep_statement = $db->prepare(check_sql($sql)); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] == 0) { + $sql = "insert into v_vars "; + $sql .= "("; + $sql .= "var_uuid, "; + $sql .= "var_name, "; + $sql .= "var_value, "; + $sql .= "var_cat, "; + $sql .= "var_enabled, "; + $sql .= "var_order, "; + $sql .= "var_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'default_exitcode', "; + $sql .= "'".$country["exitcode"]."', "; + $sql .= "'Defaults', "; + $sql .= "'true', "; + $sql .= "'".$x."', "; + $sql .= "'' "; + $sql .= ");"; + $db->exec(check_sql($sql)); + unset($sql, $row); + $x++; + } } + unset($prep_statement, $sql); + + unset($countries); } - unset($prep_statement, $sql); - - // Set default International Direct Dialing code - $sql = "select count(*) as num_rows from v_vars "; - $sql .= "where var_name = 'default_exitcode' "; - $sql .= "and var_cat = 'Defaults' "; - $prep_statement = $db->prepare(check_sql($sql)); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - if ($row['num_rows'] == 0) { - $sql = "insert into v_vars "; - $sql .= "("; - $sql .= "var_uuid, "; - $sql .= "var_name, "; - $sql .= "var_value, "; - $sql .= "var_cat, "; - $sql .= "var_enabled, "; - $sql .= "var_order, "; - $sql .= "var_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'default_exitcode', "; - $sql .= "'".$country["exitcode"]."', "; - $sql .= "'Defaults', "; - $sql .= "'true', "; - $sql .= "'".$x."', "; - $sql .= "'' "; - $sql .= ");"; - $db->exec(check_sql($sql)); - unset($sql, $row); - $x++; - } - } - unset($prep_statement, $sql); - - unset($countries); } } diff --git a/resources/countries.php b/resources/countries.php new file mode 100644 index 0000000000..88f144c60a --- /dev/null +++ b/resources/countries.php @@ -0,0 +1,916 @@ + \ No newline at end of file From 18c7a500b78b0a062069fdbbb6b5f18c484dfaca Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 19 Nov 2015 14:57:47 +0000 Subject: [PATCH 044/232] Bugfix --- app/vars/app_defaults.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vars/app_defaults.php b/app/vars/app_defaults.php index bac1fac58f..1a0c840845 100644 --- a/app/vars/app_defaults.php +++ b/app/vars/app_defaults.php @@ -99,7 +99,7 @@ EOD; // Set country depend variables as country code and international direct dialing code (exit code) if (!function_exists('set_country_vars')) { function set_country_vars($db, $x) { - require "resources/classes/countries.php"; + require "resources/countries.php"; // $country_iso=$_SESSION['domain']['country']['iso_code']; From 1484a784820e7ac142118dd1e4443b24755be3e7 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 19 Nov 2015 10:34:28 -0700 Subject: [PATCH 045/232] Change setting enable_background_images to background_image_enabled. This keeps the code consistent as 'enabled' is used throughout the code as a suffix. It also displays this setting next to the background_image setting. --- themes/enhanced/app_defaults.php | 8 ++++---- themes/enhanced/template.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/enhanced/app_defaults.php b/themes/enhanced/app_defaults.php index 5d13f453a9..333fb6efca 100644 --- a/themes/enhanced/app_defaults.php +++ b/themes/enhanced/app_defaults.php @@ -59,7 +59,7 @@ if ($domains_processed == 1) { $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset($prep_statement); - $enable_background_images = false; + $background_image_enabled = false; //add theme default settings foreach ($array as $row) { $found = false; @@ -69,7 +69,7 @@ if ($domains_processed == 1) { } //enable_background_image is a new setting, if a user has any background images enabled we should turn it on if ($field["default_setting_enabled"] == 'enabled') { - $enable_background_images = true; + $background_image_enabled = true; } } if (!$found) { @@ -240,11 +240,11 @@ if ($domains_processed == 1) { $array[$x]['default_setting_description'] = 'Set the opacity of the main menu (decimal, Minimized theme only).'; $x++; $array[$x]['default_setting_category'] = 'theme'; - $array[$x]['default_setting_subcategory'] = 'enable_background_images'; + $array[$x]['default_setting_subcategory'] = 'background_image_enabled'; $array[$x]['default_setting_name'] = 'boolean'; $array[$x]['default_setting_value'] = 'true'; $array[$x]['default_setting_enabled'] = 'false'; - if($enable_background_images) { $array[$x]['default_setting_enabled'] = 'true'; } + if($background_image_enabled) { $array[$x]['default_setting_enabled'] = 'true'; } $array[$x]['default_setting_description'] = 'Enable use of background images.'; if($set_session_theme){ diff --git a/themes/enhanced/template.php b/themes/enhanced/template.php index e33e6e390f..beefeb7c01 100644 --- a/themes/enhanced/template.php +++ b/themes/enhanced/template.php @@ -1424,7 +1424,7 @@ if (strlen($_SESSION['message']) > 0) { Date: Thu, 19 Nov 2015 13:45:06 -0800 Subject: [PATCH 046/232] Update y000000000028.cfg --- .../provision/yealink/t46g/y000000000028.cfg | 86 +++++++++++++------ 1 file changed, 60 insertions(+), 26 deletions(-) diff --git a/resources/templates/provision/yealink/t46g/y000000000028.cfg b/resources/templates/provision/yealink/t46g/y000000000028.cfg index 7e540ed1fe..3ff3e5e195 100644 --- a/resources/templates/provision/yealink/t46g/y000000000028.cfg +++ b/resources/templates/provision/yealink/t46g/y000000000028.cfg @@ -26,8 +26,45 @@ network.pc_port.speed_duplex = network.pc_port.dhcp_server = 1 network.static_dns_enable = 0 +{if isset($vlan_port_id) } ####################################################################################### -## VLAN ## +## VLAN ENABLED ## +####################################################################################### +network.vlan.internet_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.internet_port_vid = {$vlan_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.internet_port_priority = + +#Enable or disable the VLAN of PC port; 0-Disabled (default), 1-Enabled; +#Require reboot; +network.vlan.pc_port_enable = 1 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.pc_port_vid = {$vlan_pc_port_id} + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.pc_port_priority = + +#Enable or disable the DHCP to obtain the information of the VLAN; 0-Disabled; 1-Enabled (default); +#Require reboot; +network.vlan.dhcp_enable = + +#Configure the DHCP option to obtain the information of the VLAN. It ranges from 0 to 255. +#Multiple options separated by a comma. It supports up to 5 options in all. +#Require reboot; +network.vlan.dhcp_option = + +{else} + +####################################################################################### +## VLAN ENABLED ## ####################################################################################### network.vlan.internet_port_enable = 0 @@ -60,6 +97,8 @@ network.vlan.dhcp_enable = #Require reboot; network.vlan.dhcp_option = +{/if} + ####################################################################################### ## WEB Port ## ####################################################################################### @@ -521,30 +560,25 @@ bw.directory_enable = 0 ####################################################################################### ## LDAP ## ####################################################################################### -#Configure the search criteria for name and number lookups. -ldap.enable = -ldap.name_filter = -ldap.number_filter = -ldap.host = 0.0.0.0 -ldap.port = 389 -ldap.base = -ldap.user = -ldap.password = - -#Specify the maximum of the displayed search results. It ranges from 1 to 32000, the default value is 50. -ldap.max_hits = -ldap.name_attr = -ldap.numb_attr = -ldap.display_name = - -#Configure the LDAP version. The valid value is 2 or 3 (default). -ldap.version = - -#Enable or disable the phone to query the contact name from the LDAP server when receiving an incoming call; 0-Disabled (default), 1-Enabled; -ldap.call_in_lookup = - -#Enable or disable the phone to sort the search results in alphabetical order; 0-Disabled (default), 1-Enabled; -ldap.ldap_sort = +#Configure the backlight time (in seconds). The valid values are: 1-Always on, 60 (default), 120, 300, 600, 1800. +security.trust_certificates = 0 +phone_setting.backlight_time = 0 +ldap.name_filter = {$ldap_namefilter} +ldap.number_filter = {$ldap_numberfilter} +ldap.host = {$ldap_host} +ldap.base = {$ldap_base} +ldap.user = {$ldap_user} +ldap.password = {$ldap_password} +ldap.display_name = {$ldap_display_name} +ldap.version = {$ldap_version} +ldap.call_in_lookup = {$ldap_call_in_lookup} +ldap.dial_lookup = {$ldap_dial_lookup} +ldap.enable = {$ldap_enable} +ldap.ldap_sort = {$ldap_sort} +ldap.port = {$ldap_port} +ldap.max_hits = {$ldap_max_hits} +ldap.name_attr = {$ldap_name_attr} +ldap.numb_attr = {$ldap_numb_attr} ####################################################################################### ## Features ## @@ -1525,7 +1559,7 @@ super_search.url = ## Directory Setting ## ####################################################################################### #Configure the access URL of the directory setting file. -directory_setting.url = +directory_setting.url ={$yealink_directory_settingurl} ####################################################################################### ## Configure the access URL of firmware ## From e93e22551503743f993c7d5de6839750f52c2ac4 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 19 Nov 2015 15:20:14 -0700 Subject: [PATCH 047/232] Add underscore between the words in the variables. {$ldap_name_filter} {$ldap_number_filter} {$yealink_directory_setting_url} --- .../templates/provision/yealink/t46g/y000000000028.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/templates/provision/yealink/t46g/y000000000028.cfg b/resources/templates/provision/yealink/t46g/y000000000028.cfg index 3ff3e5e195..4fdd27011c 100644 --- a/resources/templates/provision/yealink/t46g/y000000000028.cfg +++ b/resources/templates/provision/yealink/t46g/y000000000028.cfg @@ -563,8 +563,8 @@ bw.directory_enable = 0 #Configure the backlight time (in seconds). The valid values are: 1-Always on, 60 (default), 120, 300, 600, 1800. security.trust_certificates = 0 phone_setting.backlight_time = 0 -ldap.name_filter = {$ldap_namefilter} -ldap.number_filter = {$ldap_numberfilter} +ldap.name_filter = {$ldap_name_filter} +ldap.number_filter = {$ldap_number_filter} ldap.host = {$ldap_host} ldap.base = {$ldap_base} ldap.user = {$ldap_user} @@ -1559,7 +1559,7 @@ super_search.url = ## Directory Setting ## ####################################################################################### #Configure the access URL of the directory setting file. -directory_setting.url ={$yealink_directory_settingurl} +directory_setting.url ={$yealink_directory_setting_url} ####################################################################################### ## Configure the access URL of firmware ## From 13725701cf5f13e06da981bd26f2dc9e776aa73d Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 19 Nov 2015 22:32:34 -0700 Subject: [PATCH 048/232] Time condition fix alignment of the arrow button by adding style nowrap and 3 pixel padding. --- app/time_conditions/time_condition_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index f3e70b9f77..1a3178ddcb 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -860,7 +860,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { echo " ".$text['label-group']."\n"; echo " "; echo " "; - echo " "; + echo " "; //$destination = new destinations; echo $destination->select('dialplan', 'dialplan_action['.$group_id.']', $dialplan_action); echo " "; From 748e286ae9842f6b21a93fc056bb482834be9e14 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 19 Nov 2015 22:42:33 -0700 Subject: [PATCH 049/232] Add style white-space: nowrap; to destination edit. --- app/destinations/destination_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index d6051689c1..3d48fb6059 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -679,7 +679,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if ($row["dialplan_detail_tag"] != "condition") { if ($row["dialplan_detail_tag"] == "action" && $row["dialplan_detail_type"] == "set" && strpos($row["dialplan_detail_data"], "accountcode") == 0) { continue; } //exclude set:accountcode actions echo " \n"; - echo " \n"; + echo " \n"; if (strlen($row['dialplan_detail_uuid']) > 0) { echo " \n"; } From b3cc3a88878699b24b0e4e950d5747ebb5eb18f9 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 20 Nov 2015 10:38:51 +0300 Subject: [PATCH 050/232] Add. Supports MySQL/SQLite to fax queue. --- app/fax/fax_send.php | 11 +++++++- resources/install/scripts/fax_queue/tasks.lua | 28 +++++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index e7fb27c8ef..d7f6d1827d 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -684,6 +684,15 @@ if(!function_exists('gs_cmd')) { $dial_string .= "task_uuid='" . $task_uuid . "',"; $wav_file = ''; //! @todo add custom message $description = ''; //! @todo add description + if ($db_type == "pgsql") { + $date_utc_now_sql = "NOW() at time zone 'utc'"; + } + if ($db_type == "mysql") { + $date_utc_now_sql = "UTC_TIMESTAMP()"; + } + if ($db_type == "sqlite") { + $date_utc_now_sql = "datetime('now')"; + } $sql = << 'true' ]] local next_task_sql = select_task_common_sql .. [[ -and t1.task_status = 0 and t1.task_next_time < NOW() +and t1.task_status = 0 and t1.task_next_time < ]] .. date_utc_now_sql .. [[ and t2.fax_send_channels > (select count(*) from v_fax_tasks as tasks where tasks.fax_uuid = t1.fax_uuid and tasks.task_status > 0 and tasks.task_status <= 2 @@ -41,7 +57,7 @@ order by t1.task_next_time local select_task_sql = select_task_common_sql .. "and t1.task_uuid='%s'" local aquire_task_sql = [[ - update v_fax_tasks set task_status = 1, task_lock_time = NOW() + update v_fax_tasks set task_status = 1, task_lock_time = ]] .. date_utc_now_sql .. [[ where task_uuid = '%s' and task_status = 0 ]] @@ -52,7 +68,7 @@ local wait_task_sql = [[ task_no_answer_counter = %s, task_no_answer_retry_counter = %s, task_retry_counter = %s, - task_next_time = NOW() + interval '%s second' + task_next_time = ]] .. now_add_sec_sql .. [[ where task_uuid = '%s' ]] @@ -64,15 +80,15 @@ local remove_task_task_sql = [[ local release_task_sql = [[ update v_fax_tasks set task_status = 0, task_lock_time = NULL, - task_next_time = NOW() + interval '%s second' + task_next_time = ]] .. now_add_sec_sql .. [[ where task_uuid = '%s' ]] local release_stuck_tasks_sql = [[ update v_fax_tasks set task_status = 0, task_lock_time = NULL, - task_next_time = NOW() - where task_lock_time < NOW() + interval '3600 second' + task_next_time = ]] .. date_utc_now_sql .. [[ + where task_lock_time < ]] .. now_add_sec_sql:format('3600') .. [[ ]] local remove_finished_tasks_sql = [[ From 2f88d1d985396e7e9b2ee8becab62178d36d564e Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 20 Nov 2015 14:45:06 +0300 Subject: [PATCH 051/232] Fix. Decode email message from quoted-printable/base64. Fix. Allow set custom fonts to support non latin alphabet. --- app/fax/app_defaults.php | 7 ++++ app/fax/fax_emails.php | 15 +++++--- app/fax/fax_send.php | 30 ++++++++++----- app/fax/resources/functions/parse_message.php | 38 +++++++++++++++++++ 4 files changed, 75 insertions(+), 15 deletions(-) create mode 100644 app/fax/resources/functions/parse_message.php diff --git a/app/fax/app_defaults.php b/app/fax/app_defaults.php index d688de4388..9efab50752 100644 --- a/app/fax/app_defaults.php +++ b/app/fax/app_defaults.php @@ -12,6 +12,13 @@ if ($domains_processed == 1) { $array[$x]['default_setting_description'] = 'Path to image/logo file displayed in the header of the cover sheet.'; $x++; $array[$x]['default_setting_category'] = 'fax'; + $array[$x]['default_setting_subcategory'] = 'cover_font'; + $array[$x]['default_setting_name'] = 'text'; + $array[$x]['default_setting_value'] = 'times'; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = 'Font used to generate cover page. Can be full path to .ttf file or font name alredy installed.'; + $x++; + $array[$x]['default_setting_category'] = 'fax'; $array[$x]['default_setting_subcategory'] = 'cover_footer'; $array[$x]['default_setting_name'] = 'text'; $array[$x]['default_setting_value'] = "The information contained in this facsimile is intended for the sole confidential use of the recipient(s) designated above, and may contain confidential and legally privileged information. If you are not the intended recipient, you are hereby notified that the review, disclosure, dissemination, distribution, copying, duplication in any form, and taking of any action in regards to the contents of this document - except with respect to its direct delivery to the intended recipient - is strictly prohibited. Please notify the sender immediately and destroy this cover sheet and all attachments. If stored or viewed electronically, please permanently delete it from your system."; diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index 69bc60defe..269827e493 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -29,6 +29,7 @@ include "root.php"; require_once "resources/require.php"; require_once "resources/functions/object_to_array.php"; require_once "resources/functions/parse_attachments.php"; +require_once "resources/functions/parse_message.php"; require_once "resources/classes/text.php"; //get accounts to monitor @@ -59,6 +60,7 @@ if (sizeof($result) != 0) { if(strlen($fax_send_mode_default) == 0){ $fax_send_mode_default = 'direct'; } + $fax_cover_font_default = $_SESSION['fax']['cover_font']['text']; foreach ($result as $row) { //get fax server and account connection details @@ -91,6 +93,11 @@ if (sizeof($result) != 0) { $fax_send_mode = $fax_send_mode_default; } + $fax_cover_font = $_SESSION['fax']['cover_font']['text']; + if(strlen($fax_cover_font) == 0){ + $fax_cover_font = $fax_cover_font_default; + } + //load event socket connection parameters $_SESSION['event_socket_ip_address'] = $event_socket['ip_address']; $_SESSION['event_socket_port'] = $event_socket['port']; @@ -173,15 +180,11 @@ if (sizeof($result) != 0) { unset($fax_subject); //clear so not on cover page //get email body (if any) for cover page - $fax_message = imap_fetchbody($connection, $email_id, '1.1', FT_UID); - $fax_message = strip_tags($fax_message); - $fax_message = trim($fax_message); + $fax_message = parse_message($connection, $email_id, FT_UID); if ($fax_message == '') { - $fax_message = imap_fetchbody($connection, $email_id, '1', FT_UID); $fax_message = strip_tags($fax_message); - $fax_message = trim($fax_message); + $fax_message = str_replace("\r\n\r\n","\r\n", $fax_message); } - $fax_message = str_replace("\r\n\r\n","\r\n", $fax_message); // set fax directory (used for pdf creation - cover and/or attachments) $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.(($domain_name != '') ? '/'.$domain_name : null); diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index d7f6d1827d..a059e7ad40 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -103,6 +103,8 @@ if (!$included) { //set the fax directory $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.((count($_SESSION["domains"]) > 1) ? '/'.$_SESSION['domain_name'] : null); + // set fax cover font to generate pdf + $fax_cover_font = $_SESSION['fax']['cover_font']['text']; } else{ require_once "resources/classes/EventSocket.php"; @@ -342,6 +344,19 @@ if(!function_exists('gs_cmd')) { $pdf -> setPrintFooter(false); $pdf -> SetMargins(0, 0, 0, true); + if(strlen($fax_cover_font) > 0){ + if(substr($fax_cover_font, -4) == '.ttf'){ + $pdf_font = TCPDF_FONTS::addTTFfont($fax_cover_font); + } + else{ + $pdf_font = $fax_cover_font; + } + } + + if(!$pdf_font){ + $pdf_font = 'times'; + } + //add blank page $pdf -> AddPage('P', array($page_width, $page_height)); @@ -349,9 +364,6 @@ if(!function_exists('gs_cmd')) { $x = 0; $y = 0; - // output grid - //showgrid($pdf); - //logo $display_logo = false; if (!isset($_SESSION['fax']['cover_logo']['text'])) { @@ -395,23 +407,23 @@ if(!function_exists('gs_cmd')) { //header if ($fax_header != '') { $pdf -> SetLeftMargin(0.5); - $pdf -> SetFont("times", "", 10); + $pdf -> SetFont($pdf_font, "", 10); $pdf -> Write(0.3, $fax_header); } //fax, cover sheet $pdf -> SetTextColor(0,0,0); - $pdf -> SetFont("times", "B", 55); + $pdf -> SetFont($pdf_font, "B", 55); $pdf -> SetXY($x + 4.55, $y + 0.25); $pdf -> Cell($x + 3.50, $y + 0.4, $text['label-fax-fax'], 0, 0, 'R', false, null, 0, false, 'T', 'T'); - $pdf -> SetFont("times", "", 12); + $pdf -> SetFont($pdf_font, "", 12); $pdf -> SetFontSpacing(0.0425); $pdf -> SetXY($x + 4.55, $y + 1.0); $pdf -> Cell($x + 3.50, $y + 0.4, $text['label-fax-cover-sheet'], 0, 0, 'R', false, null, 0, false, 'T', 'T'); $pdf -> SetFontSpacing(0); //field labels - $pdf -> SetFont("times", "B", 12); + $pdf -> SetFont($pdf_font, "B", 12); if ($fax_recipient != '' || sizeof($fax_numbers) > 0) { $pdf -> Text($x + 0.5, $y + 2.0, strtoupper($text['label-fax-recipient']).":"); } @@ -426,7 +438,7 @@ if(!function_exists('gs_cmd')) { } //field values - $pdf -> SetFont("times", "", 12); + $pdf -> SetFont($pdf_font, "", 12); $pdf -> SetXY($x + 2.0, $y + 1.95); if ($fax_recipient != '') { $pdf -> Write(0.3, $fax_recipient); @@ -466,7 +478,7 @@ if(!function_exists('gs_cmd')) { //message $pdf -> Rect($x + 0.5, $y + 3.4, 7.5, 6.25, 'D'); if ($fax_message != '') { - $pdf -> SetFont("times", "", 12); + $pdf -> SetFont($pdf_font, "", 12); $pdf -> SetXY($x + 0.75, $y + 3.65); $pdf -> MultiCell(7, 5.75, $fax_message, 0, 'L', false); } diff --git a/app/fax/resources/functions/parse_message.php b/app/fax/resources/functions/parse_message.php new file mode 100644 index 0000000000..c2945e76b2 --- /dev/null +++ b/app/fax/resources/functions/parse_message.php @@ -0,0 +1,38 @@ +parts) && count($structure->parts)) { + for($i = 0; $i < count($structure->parts); $i++) { + $msg = ''; + $part = $structure->parts[$i]; + if($part->type == TYPETEXT){ + $msg = imap_fetchbody($connection, $message_number, $i+1, $option); + if($part->encoding == ENCBASE64){ + $msg = base64_decode($msg); + } + else if($part->encoding == ENCQUOTEDPRINTABLE){ + $msg = quoted_printable_decode($msg); + } + if($msg && $to_charset){ + $charset = ''; + if(isset($part->parameters) && count($part->parameters)) { + foreach($part->parameters as &$parameter){ + if($parameter->attribute == 'CHARSET') { + $charset = $parameter->value; + break; + } + } + } + if($charset){ + $msg = mb_convert_encoding($msg, $to_charset, $charset); + } + } + + if($msg){ + return $msg; + } + } + } + } +} From 64f91c3ed2c718acf51cdc1093dc14d3f7230173 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 20 Nov 2015 15:22:09 +0300 Subject: [PATCH 052/232] Fix. Poll several mail at once. Problem causes by fax_send.php which change current dir and second call can not finding libraries. --- app/fax/fax_emails.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/fax/fax_emails.php b/app/fax/fax_emails.php index 269827e493..234367e7b8 100644 --- a/app/fax/fax_emails.php +++ b/app/fax/fax_emails.php @@ -210,8 +210,12 @@ if (sizeof($result) != 0) { } //send fax + $cwd = getcwd(); $included = true; require("fax_send.php"); + if($cwd){ + chdir($cwd); + } //reset variables unset($fax_numbers); From ff9e3027688b037604547218e20197a50442cd15 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 20 Nov 2015 09:23:41 -0700 Subject: [PATCH 053/232] Add Mitel 5324 and 5340 templates. --- .../provision/mitel/5324/MN_${mac}.cfg | 366 ++++++++++++++++++ .../provision/mitel/5340/MN_${mac}.cfg | 366 ++++++++++++++++++ 2 files changed, 732 insertions(+) create mode 100644 resources/templates/provision/mitel/5324/MN_${mac}.cfg create mode 100644 resources/templates/provision/mitel/5340/MN_${mac}.cfg diff --git a/resources/templates/provision/mitel/5324/MN_${mac}.cfg b/resources/templates/provision/mitel/5324/MN_${mac}.cfg new file mode 100644 index 0000000000..e6e9c4746d --- /dev/null +++ b/resources/templates/provision/mitel/5324/MN_${mac}.cfg @@ -0,0 +1,366 @@ + + 1 + 1 + 0 + 1 + 02.00.00.24 + R7.2.02.00.00.24 + 0 + 0 + 0 + 5060 + 0 + -1 + -1 + sip1 + -example.com + 0 + 0 + operator@example.com + 0 + + + + + + + + 1 + 12 + 1 + 1 + 0 + 1 + http://rss.news.yahoo.com/rss/topstories + 135.199.77.12 + 135.199.77.12 + 128.138.141.172 + {$mitel_time_zone} + 2 + 120 + + 0.0.0.0 + 5060 + 5 + 20 + 0 + 0 + 101 + 0 + 0 + + 0 + 0 + 10 + + 1 + 60 + 0 + + ****** + 0 + 0 + 0 + 0 + admin + Administrator + 510731ac096ebcb3989fb1ed5b7075bb + 0 + + 0 + + 0 + 0 + 16 + + 0 + 0 + 0 + + 0 + 0 + 0 + + 0 + 0 + 0 + + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 80 + 443 + 1 + 4 + 1 + 0 + 0 + + 0 + 213.192.59.75 + + 0 + 20000 + 20998 + 0 + 0 + 3 + 0 + en_US + US + 1 + 3 + 2 + 1 + 11 + 1 + 1 + 2 + 201 + sipdnld.mitel.com + sipdnld.mitel.com + 1 + + 0 + 3 + 0 + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 1 + 1 + 0 + ****** + 1440 + 1 + 1440 + 23 + 59 + 1 + + 5d41402abc4b2a76b9719d911017c592 + + + sip + {$voicemail_number} + 1 + + 90 + + {foreach $lines as $row} + + + {/foreach} + + + {/foreach} + + + 7.2 + \ No newline at end of file diff --git a/resources/templates/provision/mitel/5340/MN_${mac}.cfg b/resources/templates/provision/mitel/5340/MN_${mac}.cfg new file mode 100644 index 0000000000..e643b73d5f --- /dev/null +++ b/resources/templates/provision/mitel/5340/MN_${mac}.cfg @@ -0,0 +1,366 @@ + + 1 + 1 + 0 + 1 + 02.00.00.24 + R7.2.02.00.00.24 + 0 + 0 + 0 + 5060 + 0 + -1 + -1 + sip1 + -example.com + 0 + 0 + operator@example.com + 0 + + + + + + + + 1 + 12 + 1 + 1 + 0 + 1 + http://rss.news.yahoo.com/rss/topstories + 135.199.77.12 + 135.199.77.12 + 128.138.141.172 + {$mitel_time_zone} + 2 + 120 + + 0.0.0.0 + 5060 + 5 + 20 + 0 + 0 + 101 + 0 + 0 + + 0 + 0 + 10 + + 1 + 60 + 0 + + ****** + 0 + 0 + 0 + 0 + admin + Administrator + 510731ac096ebcb3989fb1ed5b7075bb + 0 + + 0 + + 0 + 0 + 16 + + 0 + 0 + 0 + + 0 + 0 + 0 + + 0 + 0 + 0 + + 0 + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 80 + 443 + 1 + 4 + 1 + 0 + 0 + + 0 + 213.192.59.75 + + 0 + 20000 + 20998 + 0 + 0 + 3 + 0 + en_US + US + 1 + 3 + 2 + 1 + 11 + 1 + 1 + 2 + 201 + sipdnld.mitel.com + sipdnld.mitel.com + 1 + + 0 + 3 + 0 + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 1 + 1 + 0 + ****** + 1440 + 1 + 1440 + 23 + 59 + 1 + + 5d41402abc4b2a76b9719d911017c592 + + + sip + {$voicemail_number} + 1 + + 90 + + {foreach $lines as $row} + + + {/foreach} + + + {/foreach} + + + 7.2 + \ No newline at end of file From 93ff09e8b1a8c3b0affab9ef5fb8e8ecfd867b81 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 20 Nov 2015 10:50:35 -0700 Subject: [PATCH 054/232] Add a new variable mitel_vlan_id. --- resources/templates/provision/mitel/5324/MN_${mac}.cfg | 3 +-- resources/templates/provision/mitel/5340/MN_${mac}.cfg | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_${mac}.cfg b/resources/templates/provision/mitel/5324/MN_${mac}.cfg index e6e9c4746d..b081d013c3 100644 --- a/resources/templates/provision/mitel/5324/MN_${mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_${mac}.cfg @@ -11,7 +11,7 @@ 5060 0 -1 - -1 + {if isset($mitel_vlan_id)}{$mitel_vlan_id}{else}-1{/if} sip1 -example.com 0 @@ -349,7 +349,6 @@ --> - {/foreach} - {/foreach} ]]); + end) + + --direct dial + if (ivr_menu_direct_dial == "true") then + table.insert(xml, [[\n"); + end + end) + table.insert(xml, [[ ]]); + + --close the extension tag if it was left open + table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); + table.insert(xml, [[]]); + XML_STRING = table.concat(xml, "\n"); + if (debug["xml_string"]) then + freeswitch.consoleLog("notice", "[xml_handler] XML_STRING: " .. XML_STRING .. "\n"); + end + + --close the database connection + dbh:release(); + --freeswitch.consoleLog("notice", "[xml_handler]"..api:execute("eval ${dsn}")); + + --set the cache + result = trim(api:execute("memcache", "set configuration:ivr.conf:" .. hostname .." '"..XML_STRING:gsub("'", "'").."' ".."expire['ivr.conf']")); + + --send the xml to the console + if (debug["xml_string"]) then + local file = assert(io.open(temp_dir .. "/ivr.conf.xml", "w")); + file:write(XML_STRING); + file:close(); + end + + --send to the console + if (debug["cache"]) then + freeswitch.consoleLog("notice", "[xml_handler] configuration:ivr.conf:" .. hostname .." source: database\n"); + end + else + --replace the ' back to a single quote + XML_STRING = XML_STRING:gsub("'", "'"); + --send to the console + if (debug["cache"]) then + freeswitch.consoleLog("notice", "[xml_handler] configuration:ivr.conf source: memcache\n"); + end + end --if XML_STRING From ddcd8a5f2345ef5fbe9e044aff852f413d3873b0 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 27 Nov 2015 19:25:16 -0700 Subject: [PATCH 105/232] Update the config php class. --- resources/classes/config.php | 65 ++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/resources/classes/config.php b/resources/classes/config.php index b7027186bb..f82b787ccb 100644 --- a/resources/classes/config.php +++ b/resources/classes/config.php @@ -4,12 +4,13 @@ * destinations * * @method get config.php - * @method exists check to see if the config.php exists + * @method exists determin if the the config.php file exists + * @method exists determin if the the config.php file exists */ class config { /** - * destinations array + * database variables and config path */ public $db_type; public $db_name; @@ -18,6 +19,7 @@ class config { public $db_host; public $db_path; public $db_port; + public $config_path; /** * Called when the object is created @@ -47,31 +49,44 @@ class config { * @var string $db_port - network port to connect to the database */ public function get() { - if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { - include($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php"); - } elseif (file_exists("/etc/fusionpbx/config.php")) { - include("/etc/fusionpbx/config.php"); - } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { - include("/usr/local/etc/fusionpbx/config.php"); + $this->find(); + if ($this->exists) { + include($this->path); + $this->db_type = $db_type; + $this->db_name = $db_name; + $this->db_username = $db_username; + $this->db_password = $db_password; + $this->db_host = $db_host; + $this->db_path = $db_path; + $this->db_port = $db_port; + } } - $this->db_type = $db_type; - $this->db_name = $db_name; - $this->db_username = $db_username; - $this->db_password = $db_password; - $this->db_host = $db_host; - $this->db_path = $db_path; - $this->db_port = $db_port; + } + + /** + * determine if the config.php exists + * @var string $config_path - full path to the config.php file + */ + public function find() { + if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { + $this->config_path = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php"; + } elseif (file_exists("/etc/fusionpbx/config.php")) { + $this->config_path = "/etc/fusionpbx/config.php"; + } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { + $this->config_path = "/usr/local/etc/fusionpbx/config.php"; + } + else { + $this->config_path = ''; + } + return $this->config_path; } /** * Determine whether the config.php exists */ public function exists() { - if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { - return true; - } elseif (file_exists("/etc/fusionpbx/config.php")) { - return true; - } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { + $this->find(); + if (strlen($this->config_path) > 0) { return true; } else { @@ -81,8 +96,16 @@ class config { } /* $config = new config; -$config = $config->get; $config_exists = $config->exists(); +$config_path = $config->find(); +$config->get(); +$db_type = $config->db_type; +$db_name = $config->db_name; +$db_username = $config->db_username; +$db_password = $config->db_password; +$db_host = $config->db_host; +$db_path = $config->db_path; +$db_port = $config->db_port; */ ?> \ No newline at end of file From c0394ba790497dab3307bfd022304bb179db30c8 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 27 Nov 2015 19:29:56 -0700 Subject: [PATCH 106/232] Remove some of the comments and an extra curly bracket. --- resources/classes/config.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/resources/classes/config.php b/resources/classes/config.php index f82b787ccb..b9961e02cd 100644 --- a/resources/classes/config.php +++ b/resources/classes/config.php @@ -1,10 +1,10 @@ find(); - if ($this->exists) { - include($this->path); - $this->db_type = $db_type; - $this->db_name = $db_name; - $this->db_username = $db_username; - $this->db_password = $db_password; - $this->db_host = $db_host; - $this->db_path = $db_path; - $this->db_port = $db_port; - } + $this->find(); + if ($this->exists) { + include($this->path); + $this->db_type = $db_type; + $this->db_name = $db_name; + $this->db_username = $db_username; + $this->db_password = $db_password; + $this->db_host = $db_host; + $this->db_path = $db_path; + $this->db_port = $db_port; } } /** - * determine if the config.php exists + * Find the path to the config.php * @var string $config_path - full path to the config.php file */ public function find() { From 9d9f2597bb310646ac14a96fbe4ac135678fb2f5 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 27 Nov 2015 19:48:22 -0700 Subject: [PATCH 107/232] Correct the variable name and add the additional code examples. --- resources/classes/config.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/resources/classes/config.php b/resources/classes/config.php index b9961e02cd..8396bf01e7 100644 --- a/resources/classes/config.php +++ b/resources/classes/config.php @@ -51,7 +51,7 @@ class config { public function get() { $this->find(); if ($this->exists) { - include($this->path); + require $this->config_path; $this->db_type = $db_type; $this->db_name = $db_name; $this->db_username = $db_username; @@ -105,6 +105,19 @@ $db_password = $config->db_password; $db_host = $config->db_host; $db_path = $config->db_path; $db_port = $config->db_port; +echo "config_path: ".$config_path."\n"; +if ($config_exists) { + echo "config_exists: true\n"; +} else { + echo "config_exists: false\n"; +} +echo "db_type: ".$db_type."\n"; +echo "db_name: ".$db_name."\n"; +echo "db_username: ".$db_username."\n"; +echo "db_password: ".$db_password."\n"; +echo "db_host: ".$db_host."\n"; +echo "db_path: ".$db_path."\n"; +echo "db_port: ".$db_port."\n"; */ ?> \ No newline at end of file From 82e602e93ab07527051921771f8308d376f2d67e Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 27 Nov 2015 19:53:30 -0700 Subject: [PATCH 108/232] Missed a set of round brackets on this->exists. --- core/install/resources/classes/install_fusionpbx.php | 10 ++++------ resources/classes/config.php | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 4e24c7ba4b..f0e4ca1597 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -1014,11 +1014,10 @@ include "root.php"; $x++; } } - $prep_statementsub = $this->dbh->prepare($sql); - $prep_statementsub->execute(); - $_SESSION['permissions'] = $prep_statementsub->fetchAll(PDO::FETCH_NAMED); - unset($sql, $prep_statementsub); - + $prep_statement_sub = $this->dbh->prepare($sql); + $prep_statement_sub->execute(); + $_SESSION['permissions'] = $prep_statement_sub->fetchAll(PDO::FETCH_NAMED); + unset($sql, $prep_statement_sub); //include the config.php $db_type = $this->db_type; @@ -1031,7 +1030,6 @@ include "root.php"; //add the database structure require_once "resources/classes/schema.php"; - global $db, $db_type, $db_name, $db_username, $db_password, $db_host, $db_path, $db_port; $schema = new schema; echo $schema->schema(); diff --git a/resources/classes/config.php b/resources/classes/config.php index 8396bf01e7..5254ed945a 100644 --- a/resources/classes/config.php +++ b/resources/classes/config.php @@ -50,7 +50,7 @@ class config { */ public function get() { $this->find(); - if ($this->exists) { + if ($this->exists()) { require $this->config_path; $this->db_type = $db_type; $this->db_name = $db_name; From 1691c3e5f03f4c988f7b5b342503cc0c20c998e4 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 27 Nov 2015 19:59:50 -0700 Subject: [PATCH 109/232] Use the new config class in the domains and schema classes. --- resources/classes/config.php | 26 +++++++++++++++----------- resources/classes/domains.php | 15 ++++++++++++++- resources/classes/schema.php | 16 ++++++++++++++-- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/resources/classes/config.php b/resources/classes/config.php index 5254ed945a..a63ba0d03e 100644 --- a/resources/classes/config.php +++ b/resources/classes/config.php @@ -67,17 +67,21 @@ class config { * @var string $config_path - full path to the config.php file */ public function find() { - if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { - $this->config_path = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php"; - } elseif (file_exists("/etc/fusionpbx/config.php")) { - $this->config_path = "/etc/fusionpbx/config.php"; - } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { - $this->config_path = "/usr/local/etc/fusionpbx/config.php"; - } - else { - $this->config_path = ''; - } - return $this->config_path; + //get the PROJECT PATH + include "root.php"; + // find the file + if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) { + $this->config_path = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php"; + } elseif (file_exists("/etc/fusionpbx/config.php")) { + $this->config_path = "/etc/fusionpbx/config.php"; + } elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) { + $this->config_path = "/usr/local/etc/fusionpbx/config.php"; + } + else { + $this->config_path = ''; + } + //return the path + return $this->config_path; } /** diff --git a/resources/classes/domains.php b/resources/classes/domains.php index eecf800459..5ea36058bf 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -215,7 +215,20 @@ public function upgrade() { //set the global variable - global $db, $db_type, $db_name, $db_username, $db_password, $db_host, $db_path, $db_port; + global $db; + + //get the db variables + $config = new config; + $config_exists = $config->exists(); + $config_path = $config->find(); + $config->get(); + $db_type = $config->db_type; + $db_name = $config->db_name; + $db_username = $config->db_username; + $db_password = $config->db_password; + $db_host = $config->db_host; + $db_path = $config->db_path; + $db_port = $config->db_port; //get the PROJECT PATH include "root.php"; diff --git a/resources/classes/schema.php b/resources/classes/schema.php index df8f51835b..282d7dde05 100644 --- a/resources/classes/schema.php +++ b/resources/classes/schema.php @@ -448,8 +448,20 @@ include "root.php"; public function schema ($format) { //set the global variable - global $db, $db_type, $db_name, $db_username, $db_password; - global $db_host, $db_path, $db_port, $upgrade_data_types, $text; + global $db, $upgrade_data_types, $text; + + //get the db variables + $config = new config; + $config_exists = $config->exists(); + $config_path = $config->find(); + $config->get(); + $db_type = $config->db_type; + $db_name = $config->db_name; + $db_username = $config->db_username; + $db_password = $config->db_password; + $db_host = $config->db_host; + $db_path = $config->db_path; + $db_port = $config->db_port; //get the PROJECT PATH include "root.php"; From a5d6c85e6f0c534651318e0ac7b10428b8ef8cc9 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Sat, 28 Nov 2015 11:17:46 +0300 Subject: [PATCH 110/232] Change. Rename v_mailto.bat to mailto.bat --- resources/switch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/switch.php b/resources/switch.php index 9088a49638..bf96fa85a3 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -1273,7 +1273,7 @@ if (!function_exists('switch_conf_xml')) { $secure_path = path_join($_SERVER["DOCUMENT_ROOT"], PROJECT_PATH, 'secure'); - $v_mail_bat = path_join($secure_path, 'v_mailto.bat'); + $v_mail_bat = path_join($secure_path, 'mailto.bat'); $v_mail_cmd = '@' . '"' . str_replace('/', '\\', path_join($bindir, 'php.exe')) . '" ' . '"' . str_replace('/', '\\', path_join($secure_path, 'v_mailto.php')) . '" '; From 85634c801e77400d54990fbc064f9229014fc7cd Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Sat, 28 Nov 2015 11:40:54 +0300 Subject: [PATCH 111/232] Change. Move fax_queue to app/fax. --- .../{fax_queue => app/fax/resources/scripts/queue}/exec.lua | 6 +++--- .../{fax_queue => app/fax/resources/scripts/queue}/next.lua | 6 +++--- .../fax/resources/scripts/queue}/retry.lua | 2 +- .../fax/resources/scripts/queue}/tasks.lua | 0 resources/install/scripts/fax_queue_monitor.lua | 2 +- resources/install/scripts/fax_queue_poll_once.lua | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) rename resources/install/scripts/{fax_queue => app/fax/resources/scripts/queue}/exec.lua (91%) rename resources/install/scripts/{fax_queue => app/fax/resources/scripts/queue}/next.lua (84%) rename resources/install/scripts/{fax_queue => app/fax/resources/scripts/queue}/retry.lua (96%) rename resources/install/scripts/{fax_queue => app/fax/resources/scripts/queue}/tasks.lua (100%) diff --git a/resources/install/scripts/fax_queue/exec.lua b/resources/install/scripts/app/fax/resources/scripts/queue/exec.lua similarity index 91% rename from resources/install/scripts/fax_queue/exec.lua rename to resources/install/scripts/app/fax/resources/scripts/queue/exec.lua index 98de09adb7..5ff3fab443 100644 --- a/resources/install/scripts/fax_queue/exec.lua +++ b/resources/install/scripts/app/fax/resources/scripts/queue/exec.lua @@ -1,7 +1,7 @@ -- @usage without queue --- api: originate {fax_file='',wav_file='',fax_dtmf=''}user/108@domain.local &lua(fax_queue/exec.lua) +-- api: originate {fax_file='',wav_file='',fax_dtmf=''}user/108@domain.local &lua(app/fax/resources/scripts/queue/exec.lua) -- @usage with queue task --- api: originate {fax_task_uuid=''}user/108@domain.local &lua(fax_queue/exec.lua) +-- api: originate {fax_task_uuid=''}user/108@domain.local &lua(app/fax/resources/scripts/queue/exec.lua) -- @fax_dtmf -- 0-9*# - dtmf symbols -- @200 - dtmf duration in ms @@ -18,7 +18,7 @@ local log = require "resources.functions.log".fax_task -- If we handle queue task local fax_task_uuid = session:getVariable('fax_task_uuid') local task if fax_task_uuid then - local Tasks = require "fax_queue.tasks" + local Tasks = require "app.fax.resources.scripts.queue.tasks" task = Tasks.select_task(fax_task_uuid) if not task then log.warningf("Can not found fax task: %q", tostring(fax_task_uuid)) diff --git a/resources/install/scripts/fax_queue/next.lua b/resources/install/scripts/app/fax/resources/scripts/queue/next.lua similarity index 84% rename from resources/install/scripts/fax_queue/next.lua rename to resources/install/scripts/app/fax/resources/scripts/queue/next.lua index 9d5c0adfff..bb5607f5ca 100644 --- a/resources/install/scripts/fax_queue/next.lua +++ b/resources/install/scripts/app/fax/resources/scripts/queue/next.lua @@ -2,7 +2,7 @@ require "resources.functions.config" require "resources.functions.sleep" local log = require "resources.functions.log".next_fax_task -local Tasks = require "fax_queue.tasks" +local Tasks = require "app.fax.resources.scripts.queue.tasks" local Esl = require "resources.functions.esl" local FAX_OPTIONS = { @@ -30,11 +30,11 @@ local function next_task() local mode = (task.retry_counter % #FAX_OPTIONS) + 1 local dial_string = '{' .. - task.dial_string .. "api_hangup_hook='lua fax_queue/retry.lua'," .. + task.dial_string .. "api_hangup_hook='lua app/fax/resources/scripts/queue/retry.lua'," .. FAX_OPTIONS[mode] .. '}' .. task.uri - local originate = 'originate ' .. dial_string .. ' &lua(fax_queue/exec.lua)' + local originate = 'originate ' .. dial_string .. ' &lua(app/fax/resources/scripts/queue/exec.lua)' log.notice(originate) esl = assert(Esl.new()) diff --git a/resources/install/scripts/fax_queue/retry.lua b/resources/install/scripts/app/fax/resources/scripts/queue/retry.lua similarity index 96% rename from resources/install/scripts/fax_queue/retry.lua rename to resources/install/scripts/app/fax/resources/scripts/queue/retry.lua index 018cec372e..feb8f6ef4f 100644 --- a/resources/install/scripts/fax_queue/retry.lua +++ b/resources/install/scripts/app/fax/resources/scripts/queue/retry.lua @@ -7,7 +7,7 @@ local log = require "resources.functions.log".fax_retry local Database = require "resources.functions.database" local Settings = require "resources.functions.lazy_settings" - local Tasks = require "fax_queue.tasks" + local Tasks = require "app.fax.resources.scripts.queue.tasks" local fax_task_uuid = env:getHeader('fax_task_uuid') local task = Tasks.select_task(fax_task_uuid) diff --git a/resources/install/scripts/fax_queue/tasks.lua b/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua similarity index 100% rename from resources/install/scripts/fax_queue/tasks.lua rename to resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua diff --git a/resources/install/scripts/fax_queue_monitor.lua b/resources/install/scripts/fax_queue_monitor.lua index 1f4371d2b7..a9250d455e 100644 --- a/resources/install/scripts/fax_queue_monitor.lua +++ b/resources/install/scripts/fax_queue_monitor.lua @@ -9,7 +9,7 @@ require "resources.functions.sleep"; local log = require "resources.functions.log".fax_queue_monitor - local Next = require "fax_queue.next" + local Next = require "app.fax.resources.scripts.queue.next" mkdir(scripts_dir .. "/run"); diff --git a/resources/install/scripts/fax_queue_poll_once.lua b/resources/install/scripts/fax_queue_poll_once.lua index c42ee62c72..b8453bdafd 100644 --- a/resources/install/scripts/fax_queue_poll_once.lua +++ b/resources/install/scripts/fax_queue_poll_once.lua @@ -1 +1 @@ -require "fax_queue.next".poll_once() \ No newline at end of file +require "app.fax.resources.scripts.queue.next".poll_once() \ No newline at end of file From dde6c07a3f372fa1949e1514d3b0c0351e37e2f2 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 16:50:50 -0700 Subject: [PATCH 112/232] Clear the SIPDefault.cnf better to have full control per device of all setttings. --- .../provision/cisco/7940/SIPDefault.cnf | 131 --------------- .../provision/cisco/7940/SIP{$mac}.cnf | 153 ++++++++++++++++-- 2 files changed, 141 insertions(+), 143 deletions(-) diff --git a/resources/templates/provision/cisco/7940/SIPDefault.cnf b/resources/templates/provision/cisco/7940/SIPDefault.cnf index 489f5c97ea..e69de29bb2 100644 --- a/resources/templates/provision/cisco/7940/SIPDefault.cnf +++ b/resources/templates/provision/cisco/7940/SIPDefault.cnf @@ -1,131 +0,0 @@ -# Image Version -image_version: "P0S3-08-7-00" - -# Proxy Server -proxy1_address: "192.168.1.1" - -# Proxy Server Port (default - 5060) -proxy1_port:"5060" - -# Emergency Proxy info -proxy_emergency: "192.168.1.1" -proxy_emergency_port: "5060" - -# Backup Proxy info -proxy_backup: "192.168.1.1" -proxy_backup_port: "5060" - -# Outbound Proxy info -outbound_proxy: "" -outbound_proxy_port: "5060" - -# NAT/Firewall Traversal -nat_enable: "0" -nat_address: "" -voip_control_port: "5060" -start_media_port: "16384" -end_media_port: "32766" -nat_received_processing: "0" - -# Proxy Registration (0-disable (default), 1-enable) -proxy_register: "1" - -# Phone Registration Expiration [1-3932100 sec] (Default - 3600) -timer_register_expires: "80" - -# Codec for media stream (g711ulaw (default), g711alaw, g729) -preferred_codec: "none" - -# TOS bits in media stream [0-5] (Default - 5) -tos_media: "5" - -# Enable VAD (0-disable (default), 1-enable) -enable_vad: "0" - -# Allow for the bridge on a 3way call to join remaining parties upon hangup -cnf_join_enable: "1" ; 0-Disabled, 1-Enabled (default) - -# Allow Transfer to be completed while target phone is still ringing -semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default) - -# Telnet Level (enable or disable the ability to telnet into this phone -telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged - -# Inband DTMF Settings (0-disable, 1-enable (default)) -dtmf_inband: "1" - -# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt ) -dtmf_outofband: "avt" - -# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up) -dtmf_db_level: "3" - -# SIP Timers -timer_t1: "500" ; Default 500 msec -timer_t2: "4000" ; Default 4 sec -sip_retx: "10" ; Default 11 -sip_invite_retx: "6" ; Default 7 -timer_invite_expires: "180" ; Default 180 sec - -# Setting for Message speeddial to UOne box -messages_uri: "*97" - -# TFTP Phone Specific Configuration File Directory -tftp_cfg_dir: "" - -# Time Server -sntp_mode: "unicast" -sntp_server: "192.168.1.1" -time_zone: "EST" -dst_offset: "1" -dst_start_month: "Mar" -dst_start_day: "" -dst_start_day_of_week: "Sun" -dst_start_week_of_month: "2" -dst_start_time: "02" -dst_stop_month: "Nov" -dst_stop_day: "" -dst_stop_day_of_week: "Sunday" -dst_stop_week_of_month: "1" -dst_stop_time: "2" -dst_auto_adjust: "1" - -# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control) -dnd_control: "2" ; Default 0 (Do Not Disturb feature is off) - -# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control) -callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous) - -# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control) -anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls) - -# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control) -call_waiting: "1" ; Default 1 (Call Waiting enabled) - -# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127) -dtmf_avt_payload: "101" ; Default 100 - -# XML file that specifies the dialplan desired -dial_template: "dialplan" - -# Network Media Type (auto, full100, full10, half100, half10) -network_media_type: "auto" - -#Autocompletion During Dial (0-off, 1-on [default]) -autocomplete: "1" - -#Time Format (0-12hr, 1-24hr [default]) -time_format_24hr: "0" - -# URL for external Phone Services -#services_url: "http://{$domain_name}/app/provision/?file=services.php" - -# URL for external Directory location -directory_url: "http://{$domain_name}/app/provision/?file=directory.php" - -# URL for branding logo -#logo_url: "http://{$domain_name}/app/provision/logo.bmp" - -# Remote Party ID -remote_party_id: 1 ; 0-Disabled (default), 1-Enabled - diff --git a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf index 66cdbae8a0..7a74fb4cf7 100644 --- a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf @@ -1,19 +1,148 @@ -phone_label: "{$display_name_1}" -proxy1_address: "{$server_address_1}" + +# Image version +{if isset($cisco_time_zone)} +image_version: "{$cisco_image_version}" +{/if} + +# Phone settings +phone_label: "{$device_label}" proxy_register: 1 timer_register_expires: 300 preferred_codec: g711ulaw enable_vad: 0 dial_template: "dialplan" -line1_name: "{$user_id_1}" -line1_displayname: "{$user_id_1}" -line1_shortname: "{$short_name_1}" -line1_authname: "{$auth_id_1}" -line1_password: "{$user_password_1}" +{foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.display_name}" +#registration information +proxy{$row.line_number}_address: "{$server_address_1}" +proxy{$row.line_number}_port:"5060" +line{$row.line_number}_name: "{$user_id_1}" +line{$row.line_number}_displayname: "{$row.user_id}" +line{$row.line_number}_shortname: "{$row.display_name}" +line{$row.line_number}_authname: "{$row.auth_id}" +line{$row.line_number}_password: "{$row.user_password}" -line2_name: "{$user_id_2}" -line2_displayname: "{$user_id_2}" -line2_shortname: "{$short_name_2}" -line2_authname: "{$auth_id_2}" -line2_password: "{$user_password_2}" \ No newline at end of file +{/foreach} +# Emergency Proxy info +proxy_emergency: "{$proxy_emergency}" +proxy_emergency_port: "{$proxy_emergency_port}" + +# Backup Proxy info +proxy_backup: "{$proxy_backup}" +proxy_backup_port: "{$proxy_backup_port}" + +# Outbound Proxy info +outbound_proxy: "{$outbound_proxy}" +outbound_proxy_port: "{$outbound_proxy_port}" + +# NAT/Firewall Traversal +nat_enable: "{$nat_enable}" +nat_address: "{$nat_nat_address}" +voip_control_port: "5060" +start_media_port: "16384" +end_media_port: "32768" +nat_received_processing: "0" + +# Proxy Registration (0-disable (default), 1-enable) +proxy_register: "1" + +# Phone Registration Expiration [1-3932100 sec] (Default - 3600) +timer_register_expires: "80" + +# Codec for media stream (g711ulaw (default), g711alaw, g729) +preferred_codec: "none" + +# TOS bits in media stream [0-5] (Default - 5) +tos_media: "5" + +# Enable VAD (0-disable (default), 1-enable) +enable_vad: "0" + +# Allow for the bridge on a 3way call to join remaining parties upon hangup +cnf_join_enable: "1" ; 0-Disabled, 1-Enabled (default) + +# Allow Transfer to be completed while target phone is still ringing +semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default) + +# Telnet Level (enable or disable the ability to telnet into this phone +telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged + +# Inband DTMF Settings (0-disable, 1-enable (default)) +dtmf_inband: "1" + +# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt ) +dtmf_outofband: "avt" + +# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up) +dtmf_db_level: "3" + +# SIP Timers +timer_t1: "500" ; Default 500 msec +timer_t2: "4000" ; Default 4 sec +sip_retx: "10" ; Default 11 +sip_invite_retx: "6" ; Default 7 +timer_invite_expires: "180" ; Default 180 sec + +# Setting for Message speeddial to UOne box +messages_uri: "*97" + +# TFTP Phone Specific Configuration File Directory +tftp_cfg_dir: "" + +# Time Server +sntp_mode: "unicast" +sntp_server: "{$sntp_server}" +{if isset($cisco_time_zone)} +time_zone: "{$cisco_time_zone}" +{/if} +dst_offset: "1" +dst_start_month: "Mar" +dst_start_day: "" +dst_start_day_of_week: "Sun" +dst_start_week_of_month: "2" +dst_start_time: "02" +dst_stop_month: "Nov" +dst_stop_day: "" +dst_stop_day_of_week: "Sunday" +dst_stop_week_of_month: "1" +dst_stop_time: "2" +dst_auto_adjust: "1" + +# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control) +dnd_control: "2" ; Default 0 (Do Not Disturb feature is off) + +# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control) +callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous) + +# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control) +anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls) + +# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control) +call_waiting: "1" ; Default 1 (Call Waiting enabled) + +# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127) +dtmf_avt_payload: "101" ; Default 100 + +# XML file that specifies the dialplan desired +dial_template: "dialplan" + +# Network Media Type (auto, full100, full10, half100, half10) +network_media_type: "auto" + +#Autocompletion During Dial (0-off, 1-on [default]) +autocomplete: "1" + +#Time Format (0-12hr, 1-24hr [default]) +time_format_24hr: "0" + +# URL for external Phone Services +#services_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=services.php" + +# URL for external Directory location +directory_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=directory.php" + +# URL for branding logo +#logo_url: "http://{$domain_name}/app/provision/logo.bmp" + +# Remote Party ID +remote_party_id: 1 ; 0-Disabled (default), 1-Enabled From f94933498955c7ae7ab62e3b9207e0ad0f45c432 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 17:08:41 -0700 Subject: [PATCH 113/232] Update the Cisco 7940 template. --- .../templates/provision/cisco/7940/SIP{$mac}.cnf | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf index 7a74fb4cf7..b7c95eed8b 100644 --- a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf @@ -1,6 +1,5 @@ - -# Image version {if isset($cisco_time_zone)} +# Image version image_version: "{$cisco_image_version}" {/if} @@ -14,13 +13,13 @@ dial_template: "dialplan" {foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.display_name}" #registration information -proxy{$row.line_number}_address: "{$server_address_1}" -proxy{$row.line_number}_port:"5060" -line{$row.line_number}_name: "{$user_id_1}" +proxy{$row.line_number}_address: "{$row.server_address}" +proxy{$row.line_number}_port:"{$row.sip_port}" +line{$row.line_number}_name: "{$row.user_id}" line{$row.line_number}_displayname: "{$row.user_id}" line{$row.line_number}_shortname: "{$row.display_name}" line{$row.line_number}_authname: "{$row.auth_id}" -line{$row.line_number}_password: "{$row.user_password}" +line{$row.line_number}_password: "{$row.password}" {/foreach} # Emergency Proxy info From be5fb172d50c94ffe672a8e758793762dcf4c8eb Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 17:31:31 -0700 Subject: [PATCH 114/232] Fix the device label for the Cisco 7940. --- resources/templates/provision/cisco/7940/SIP{$mac}.cnf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf index b7c95eed8b..d9ef2441d3 100644 --- a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf @@ -4,7 +4,7 @@ image_version: "{$cisco_image_version}" {/if} # Phone settings -phone_label: "{$device_label}" +phone_label: "{$label}" proxy_register: 1 timer_register_expires: 300 preferred_codec: g711ulaw From 20eae285a9e647803451e28f3c6e8aa6e83ccc18 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 17:53:44 -0700 Subject: [PATCH 115/232] Set nat_enabled = 1 as a default, and add sync 1 to the Cisco 7940 template. --- resources/templates/provision/cisco/7940/SIP{$mac}.cnf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf index d9ef2441d3..dfc433da1d 100644 --- a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf @@ -35,12 +35,15 @@ outbound_proxy: "{$outbound_proxy}" outbound_proxy_port: "{$outbound_proxy_port}" # NAT/Firewall Traversal -nat_enable: "{$nat_enable}" -nat_address: "{$nat_nat_address}" voip_control_port: "5060" start_media_port: "16384" end_media_port: "32768" nat_received_processing: "0" +{if isset($nat_enable)}nat_enable: "{$nat_enable}"{else}1{/if} +nat_address: "{$nat_nat_address}" + +# Sync value of the phone used for remote reset +sync: 1 ; Default 1 # Proxy Registration (0-disable (default), 1-enable) proxy_register: "1" From 71b7e1c0ff7f276c025fb64439f75f331e6dfcc8 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 18:03:47 -0700 Subject: [PATCH 116/232] Another adjustment to the Cisco 7940 template for nat_enable. --- resources/templates/provision/cisco/7940/SIP{$mac}.cnf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf index dfc433da1d..c16df58d48 100644 --- a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf @@ -39,7 +39,7 @@ voip_control_port: "5060" start_media_port: "16384" end_media_port: "32768" nat_received_processing: "0" -{if isset($nat_enable)}nat_enable: "{$nat_enable}"{else}1{/if} +nat_enable: "{if isset($nat_enable)}{$nat_enable}{else}1{/if}" nat_address: "{$nat_nat_address}" # Sync value of the phone used for remote reset From 6d3494fff9ec6aa99876a9236dab4f878bdc546a Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 18:29:15 -0700 Subject: [PATCH 117/232] Add the contact_category to contacts array in the provision class. --- app/provision/resources/classes/provision.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 5167454297..62a8118182 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -402,7 +402,7 @@ include "root.php"; //get the contacts array and add to the template engine if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory']['boolean'] == "true") { //get contacts from the database - $sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, p.phone_number, p.phone_extension "; + $sql = "select c.contact_category, c.contact_organization, c.contact_name_given, c.contact_name_family, p.phone_number, p.phone_extension "; $sql .= "from v_contacts as c, v_contact_phones as p "; $sql .= "where c.domain_uuid = '".$domain_uuid."' "; $sql .= "and c.contact_uuid = p.contact_uuid "; From 7ac51b5664b419a2a5608f0b9953fb3b315bb748 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 18:39:38 -0700 Subject: [PATCH 118/232] Improve the white space handling in the 7940 directory.xml files. --- .../cisco/7940/directory-enterprise.xml | 34 +++++++++--------- .../cisco/7940/directory-personal.xml | 34 +++++++++--------- .../cisco/7940/directory-speed_dial.xml | 35 +++++++++---------- 3 files changed, 51 insertions(+), 52 deletions(-) diff --git a/resources/templates/provision/cisco/7940/directory-enterprise.xml b/resources/templates/provision/cisco/7940/directory-enterprise.xml index 7b84648f36..4c145c770d 100644 --- a/resources/templates/provision/cisco/7940/directory-enterprise.xml +++ b/resources/templates/provision/cisco/7940/directory-enterprise.xml @@ -6,23 +6,23 @@ SoftKey:Select 1 - {assign var=x value=1} - {foreach $contacts as $row} - {if $row.contact_category == "enterprise"} - - {if $row.contact_name_given != ""} - {$row.contact_name_given} {$row.contact_name_family} - {else} - {$row.contact_organization} - {/if} - {if $row.phone_number != ""} - Dial:{$row.phone_number}# - {else} - Dial:{$row.phone_extension}# - {/if} - - {/if} - {/foreach} +{assign var=x value=1} +{foreach $contacts as $row}{if $row.contact_category == "enterprise"} + +{if $row.contact_name_given != ""} + {$row.contact_name_given} {$row.contact_name_family} +{else} + {$row.contact_organization} +{/if} +{if $row.phone_number != ""} + Dial:{$row.phone_number}# +{else} + Dial:{$row.phone_extension}# +{/if} + +{/if} +{assign var=x value=$x+1} +{/foreach} Exit SoftKey:Exit diff --git a/resources/templates/provision/cisco/7940/directory-personal.xml b/resources/templates/provision/cisco/7940/directory-personal.xml index 9d774ab56a..5bbde47349 100644 --- a/resources/templates/provision/cisco/7940/directory-personal.xml +++ b/resources/templates/provision/cisco/7940/directory-personal.xml @@ -6,23 +6,23 @@ SoftKey:Select 1 - {assign var=x value=1} - {foreach $contacts as $row} - {if $row.contact_category == "personal"} - - {if $row.contact_name_given != ""} - {$row.contact_name_given} {$row.contact_name_family} - {else} - {$row.contact_organization} - {/if} - {if $row.phone_number != ""} - Dial:{$row.phone_number}# - {else} - Dial:{$row.phone_extension}# - {/if} - - {/if} - {/foreach} +{assign var=x value=1} +{foreach $contacts as $row}{if $row.contact_category == "personal"} + +{if $row.contact_name_given != ""} + {$row.contact_name_given} {$row.contact_name_family} +{else} + {$row.contact_organization} +{/if} +{if $row.phone_number != ""} + Dial:{$row.phone_number}# +{else} + Dial:{$row.phone_extension}# +{/if} + +{/if} +{assign var=x value=$x+1} +{/foreach} Exit SoftKey:Exit diff --git a/resources/templates/provision/cisco/7940/directory-speed_dial.xml b/resources/templates/provision/cisco/7940/directory-speed_dial.xml index f100c38cd6..ab7714c740 100644 --- a/resources/templates/provision/cisco/7940/directory-speed_dial.xml +++ b/resources/templates/provision/cisco/7940/directory-speed_dial.xml @@ -6,24 +6,23 @@ SoftKey:Select 1 - {assign var=x value=1} - {foreach $contacts as $row} - {if $row.contact_category == "speed dial"} - - {if $row.contact_name_given != ""} - {$row.contact_name_given} {$row.contact_name_family} - {else} - {$row.contact_organization} - {/if} - {if $row.phone_number != ""} - Dial:{$row.phone_number}# - {else} - Dial:{$row.phone_extension}# - {/if} - - {/if} - {assign var=x value=$x+1} - {/foreach} +{assign var=x value=1} +{foreach $contacts as $row}{if $row.contact_category == "speed dial"} + +{if $row.contact_name_given != ""} + {$row.contact_name_given} {$row.contact_name_family} +{else} + {$row.contact_organization} +{/if} +{if $row.phone_number != ""} + Dial:{$row.phone_number}# +{else} + Dial:{$row.phone_extension}# +{/if} + +{/if} +{assign var=x value=$x+1} +{/foreach} Exit SoftKey:Exit From 7e67cbc16fc9d4f49d5837ace2a06c52e37e0374 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 18:47:52 -0700 Subject: [PATCH 119/232] Correct the paths to the Cisco 7940 directory xml files. --- resources/templates/provision/cisco/7940/SIP{$mac}.cnf | 4 ++-- resources/templates/provision/cisco/7940/directory.xml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf index c16df58d48..dc21518c07 100644 --- a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf @@ -138,10 +138,10 @@ autocomplete: "1" time_format_24hr: "0" # URL for external Phone Services -#services_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=services.php" +#services_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=services.xml" # URL for external Directory location -directory_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=directory.php" +directory_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=directory.xml" # URL for branding logo #logo_url: "http://{$domain_name}/app/provision/logo.bmp" diff --git a/resources/templates/provision/cisco/7940/directory.xml b/resources/templates/provision/cisco/7940/directory.xml index 9c90716c7c..f3f7b94470 100644 --- a/resources/templates/provision/cisco/7940/directory.xml +++ b/resources/templates/provision/cisco/7940/directory.xml @@ -4,16 +4,16 @@ Enterprise - http://{$domain_name}/app/provision?file=directory-enterprise&mac={$mac} + http://{$domain_name}/app/provision?mac={$mac}&file=directory-enterprise.xml Speed Dial - http://{$domain_name}/app/provision/?file=directory-speed_dial&mac={$mac} + http://{$domain_name}/app/provision/?mac={$mac}&file=directory-speed_dial.xml Select From 4d7688a3ef4172a1e8ac780fd60fb64e415d59c7 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 19:15:29 -0700 Subject: [PATCH 120/232] Add a missing = so that the file is only provided as a download when the content type is set to application/octet-stream in the url. --- app/provision/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/provision/index.php b/app/provision/index.php index 366ed87183..efd76559bd 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -283,7 +283,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0); //deliver the customized config over HTTP/HTTPS //need to make sure content-type is correct - if ($_REQUEST['content_type'] = 'application/octet-stream') { + if ($_REQUEST['content_type'] == 'application/octet-stream') { $file_name = str_replace("{\$mac}",$mac,$file); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); From 42b0cf5c769e741bc7ad0b3124b6592ab5b0913c Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 19:31:07 -0700 Subject: [PATCH 121/232] Escape the & in the directory url with & --- resources/templates/provision/cisco/7940/SIP{$mac}.cnf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf index dc21518c07..f4a5ef6034 100644 --- a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf @@ -138,10 +138,10 @@ autocomplete: "1" time_format_24hr: "0" # URL for external Phone Services -#services_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=services.xml" +#services_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=services.xml" # URL for external Directory location -directory_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=directory.xml" +directory_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=directory.xml" # URL for branding logo #logo_url: "http://{$domain_name}/app/provision/logo.bmp" From 1a46a38c04beddb71d849432271cb1df46a1c0e2 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 19:48:45 -0700 Subject: [PATCH 122/232] Add option to get the mac address from &name=SEPxxxxx --- app/provision/index.php | 9 +++++++++ resources/templates/provision/cisco/7940/directory.xml | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/provision/index.php b/app/provision/index.php index efd76559bd..df3d72fa91 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -42,6 +42,15 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0); // $device_template = check_str($_REQUEST['template']); //} +//get the mac address for Cisco 79xx in the URL as &name=SEP000000000000 + if (empty($mac)){ + $name = check_str($_REQUEST['name']); + if (substr($name, 0, 3) == "SEP") { + $mac = substr($name, 3, 12); + unset($name); + } + } + //check alternate MAC source if (empty($mac)){ //set the http user agent diff --git a/resources/templates/provision/cisco/7940/directory.xml b/resources/templates/provision/cisco/7940/directory.xml index f3f7b94470..2aeda06113 100644 --- a/resources/templates/provision/cisco/7940/directory.xml +++ b/resources/templates/provision/cisco/7940/directory.xml @@ -4,16 +4,16 @@ Enterprise - http://{$domain_name}/app/provision?mac={$mac}&file=directory-enterprise.xml + http://{$domain_name}/app/provision?file=directory-enterprise.xml Speed Dial - http://{$domain_name}/app/provision/?mac={$mac}&file=directory-speed_dial.xml + http://{$domain_name}/app/provision/?file=directory-speed_dial.xml Select From 37741c09269113101d3e220e94705aed681905d7 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 19:56:06 -0700 Subject: [PATCH 123/232] Remove the mac address from the path in one more location. --- resources/templates/provision/cisco/7940/SIP{$mac}.cnf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf index f4a5ef6034..8cbd66528b 100644 --- a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf @@ -138,10 +138,10 @@ autocomplete: "1" time_format_24hr: "0" # URL for external Phone Services -#services_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=services.xml" +#services_url: "http://{$domain_name}/app/provision/?file=services.xml" # URL for external Directory location -directory_url: "http://{$domain_name}/app/provision/?mac={$mac}&file=directory.xml" +directory_url: "http://{$domain_name}/app/provision/?file=directory.xml" # URL for branding logo #logo_url: "http://{$domain_name}/app/provision/logo.bmp" From 918cc484cb077459120a53620acaa51aee43d84c Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 20:08:24 -0700 Subject: [PATCH 124/232] Set the mac address to lower case. --- app/provision/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/provision/index.php b/app/provision/index.php index df3d72fa91..ae17fefba2 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -46,7 +46,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0); if (empty($mac)){ $name = check_str($_REQUEST['name']); if (substr($name, 0, 3) == "SEP") { - $mac = substr($name, 3, 12); + $mac = strtolower(substr($name, 3, 12)); unset($name); } } From f9a5aa2461d1d426607049f71aa3ad0ba39db8b1 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 21:09:12 -0700 Subject: [PATCH 125/232] Complete the directory for Cisco 7940 template. --- .../provision/cisco/7940/SIP{$mac}.cnf | 4 +-- .../cisco/7940/directory-enterprise.xml | 26 +++++++------------ .../cisco/7940/directory-personal.xml | 25 +++++++----------- .../cisco/7940/directory-speed_dial.xml | 22 +++++----------- .../provision/cisco/7940/directory.xml | 21 ++++----------- 5 files changed, 32 insertions(+), 66 deletions(-) diff --git a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf index 8cbd66528b..2d9adbd63f 100644 --- a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf @@ -138,10 +138,10 @@ autocomplete: "1" time_format_24hr: "0" # URL for external Phone Services -#services_url: "http://{$domain_name}/app/provision/?file=services.xml" +#services_url: "http://{$domain_name}/app/provision/file/services.xml" # URL for external Directory location -directory_url: "http://{$domain_name}/app/provision/?file=directory.xml" +directory_url: "http://{$domain_name}/app/provision/file/directory.xml" # URL for branding logo #logo_url: "http://{$domain_name}/app/provision/logo.bmp" diff --git a/resources/templates/provision/cisco/7940/directory-enterprise.xml b/resources/templates/provision/cisco/7940/directory-enterprise.xml index 4c145c770d..5c977112b0 100644 --- a/resources/templates/provision/cisco/7940/directory-enterprise.xml +++ b/resources/templates/provision/cisco/7940/directory-enterprise.xml @@ -1,31 +1,25 @@ - + Enterprise Please choose... - - Dial - SoftKey:Select - 1 - {assign var=x value=1} {foreach $contacts as $row}{if $row.contact_category == "enterprise"} - + {if $row.contact_name_given != ""} {$row.contact_name_given} {$row.contact_name_family} {else} {$row.contact_organization} {/if} {if $row.phone_number != ""} - Dial:{$row.phone_number}# + {$row.phone_number} {else} - Dial:{$row.phone_extension}# + {$row.phone_extension} {/if} - + {/if} {assign var=x value=$x+1} {/foreach} - - Exit - SoftKey:Exit - 4 - - + + + + + diff --git a/resources/templates/provision/cisco/7940/directory-personal.xml b/resources/templates/provision/cisco/7940/directory-personal.xml index 5bbde47349..2e6750eb98 100644 --- a/resources/templates/provision/cisco/7940/directory-personal.xml +++ b/resources/templates/provision/cisco/7940/directory-personal.xml @@ -1,31 +1,24 @@ - + Personal Please choose... - - Dial - SoftKey:Select - 1 - {assign var=x value=1} {foreach $contacts as $row}{if $row.contact_category == "personal"} - + {if $row.contact_name_given != ""} {$row.contact_name_given} {$row.contact_name_family} {else} {$row.contact_organization} {/if} {if $row.phone_number != ""} - Dial:{$row.phone_number}# + {$row.phone_number} {else} - Dial:{$row.phone_extension}# + {$row.phone_extension} {/if} - + {/if} {assign var=x value=$x+1} {/foreach} - - Exit - SoftKey:Exit - 4 - - + + + + diff --git a/resources/templates/provision/cisco/7940/directory-speed_dial.xml b/resources/templates/provision/cisco/7940/directory-speed_dial.xml index ab7714c740..16138ed111 100644 --- a/resources/templates/provision/cisco/7940/directory-speed_dial.xml +++ b/resources/templates/provision/cisco/7940/directory-speed_dial.xml @@ -1,31 +1,21 @@ - + Speed Dial Please choose... - - Dial - SoftKey:Select - 1 - {assign var=x value=1} {foreach $contacts as $row}{if $row.contact_category == "speed dial"} - + {if $row.contact_name_given != ""} {$row.contact_name_given} {$row.contact_name_family} {else} {$row.contact_organization} {/if} {if $row.phone_number != ""} - Dial:{$row.phone_number}# + {$row.phone_number} {else} - Dial:{$row.phone_extension}# + {$row.phone_extension} {/if} - + {/if} {assign var=x value=$x+1} {/foreach} - - Exit - SoftKey:Exit - 4 - - + diff --git a/resources/templates/provision/cisco/7940/directory.xml b/resources/templates/provision/cisco/7940/directory.xml index 2aeda06113..24351b9b2d 100644 --- a/resources/templates/provision/cisco/7940/directory.xml +++ b/resources/templates/provision/cisco/7940/directory.xml @@ -1,28 +1,17 @@ Contacts Please choose... + - - Enterprise - http://{$domain_name}/app/provision?file=directory-enterprise.xml + --> Enterprise + http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac} Speed Dial - http://{$domain_name}/app/provision/?file=directory-speed_dial.xml + http://{$domain_name}/app/provision/file/directory-speed_dial.xml?mac={$mac} - - Select - SoftKey:Select - 1 - - - Exit - SoftKey:Exit - 4 - \ No newline at end of file From 6fa7dcfa30a02cc5d8f9135ed13565d0c4ffa0ca Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 28 Nov 2015 21:12:16 -0700 Subject: [PATCH 126/232] Synchronize the cisco 7940 with the 7940 template. --- .../cisco/7960/DISTINCTIVERINGLIST.XML | 30 +++ .../provision/cisco/7960/RINGLIST.XML | 30 +++ .../provision/cisco/7960/SIPDefault.cnf | 131 -------------- .../provision/cisco/7960/SIP{$mac}.cnf | 171 ++++++++++++++---- .../cisco/7960/directory-enterprise.xml | 25 +++ .../cisco/7960/directory-personal.xml | 24 +++ .../cisco/7960/directory-speed_dial.xml | 21 +++ .../provision/cisco/7960/directory.xml | 17 ++ 8 files changed, 286 insertions(+), 163 deletions(-) create mode 100644 resources/templates/provision/cisco/7960/DISTINCTIVERINGLIST.XML create mode 100644 resources/templates/provision/cisco/7960/RINGLIST.XML create mode 100644 resources/templates/provision/cisco/7960/directory-enterprise.xml create mode 100644 resources/templates/provision/cisco/7960/directory-personal.xml create mode 100644 resources/templates/provision/cisco/7960/directory-speed_dial.xml create mode 100644 resources/templates/provision/cisco/7960/directory.xml diff --git a/resources/templates/provision/cisco/7960/DISTINCTIVERINGLIST.XML b/resources/templates/provision/cisco/7960/DISTINCTIVERINGLIST.XML new file mode 100644 index 0000000000..8841ee8303 --- /dev/null +++ b/resources/templates/provision/cisco/7960/DISTINCTIVERINGLIST.XML @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/templates/provision/cisco/7960/RINGLIST.XML b/resources/templates/provision/cisco/7960/RINGLIST.XML new file mode 100644 index 0000000000..c30df63119 --- /dev/null +++ b/resources/templates/provision/cisco/7960/RINGLIST.XML @@ -0,0 +1,30 @@ + + + Chirp 3 + ringer3.pcm + + + Old Style + ringer1.pcm + + + Door Chime + doorchime.pcm + + + Red Alert + redalert.pcm + + + Terri + terri.pcm + + + Door Chime 2 + chime2.pcm + + + Silence + silence.pcm + + diff --git a/resources/templates/provision/cisco/7960/SIPDefault.cnf b/resources/templates/provision/cisco/7960/SIPDefault.cnf index aa90396792..e69de29bb2 100644 --- a/resources/templates/provision/cisco/7960/SIPDefault.cnf +++ b/resources/templates/provision/cisco/7960/SIPDefault.cnf @@ -1,131 +0,0 @@ -# Image Version -image_version: "P0S3-08-7-00" - -# Proxy Server -proxy1_address: "192.168.1.1" - -# Proxy Server Port (default - 5060) -proxy1_port:"5060" - -# Emergency Proxy info -proxy_emergency: "192.168.1.1" -proxy_emergency_port: "5060" - -# Backup Proxy info -proxy_backup: "192.168.1.1" -proxy_backup_port: "5060" - -# Outbound Proxy info -outbound_proxy: "" -outbound_proxy_port: "5060" - -# NAT/Firewall Traversal -nat_enable: "0" -nat_address: "" -voip_control_port: "5060" -start_media_port: "16384" -end_media_port: "32766" -nat_received_processing: "0" - -# Proxy Registration (0-disable (default), 1-enable) -proxy_register: "1" - -# Phone Registration Expiration [1-3932100 sec] (Default - 3600) -timer_register_expires: "3600" - -# Codec for media stream (g711ulaw (default), g711alaw, g729) -preferred_codec: "none" - -# TOS bits in media stream [0-5] (Default - 5) -tos_media: "5" - -# Enable VAD (0-disable (default), 1-enable) -enable_vad: "0" - -# Allow for the bridge on a 3way call to join remaining parties upon hangup -cnf_join_enable: "1" ; 0-Disabled, 1-Enabled (default) - -# Allow Transfer to be completed while target phone is still ringing -semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default) - -# Telnet Level (enable or disable the ability to telnet into this phone -telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged - -# Inband DTMF Settings (0-disable, 1-enable (default)) -dtmf_inband: "1" - -# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt ) -dtmf_outofband: "avt" - -# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up) -dtmf_db_level: "3" - -# SIP Timers -timer_t1: "500" ; Default 500 msec -timer_t2: "4000" ; Default 4 sec -sip_retx: "10" ; Default 11 -sip_invite_retx: "6" ; Default 7 -timer_invite_expires: "180" ; Default 180 sec - -# Setting for Message speeddial to UOne box -messages_uri: "*98" - -# TFTP Phone Specific Configuration File Directory -tftp_cfg_dir: "" - -# Time Server -sntp_mode: "unicast" -sntp_server: "192.168.1.1" -time_zone: "EST" -dst_offset: "1" -dst_start_month: "Mar" -dst_start_day: "" -dst_start_day_of_week: "Sun" -dst_start_week_of_month: "2" -dst_start_time: "02" -dst_stop_month: "Nov" -dst_stop_day: "" -dst_stop_day_of_week: "Sunday" -dst_stop_week_of_month: "1" -dst_stop_time: "2" -dst_auto_adjust: "1" - -# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control) -dnd_control: "0" ; Default 0 (Do Not Disturb feature is off) - -# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control) -callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous) - -# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control) -anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls) - -# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control) -call_waiting: "1" ; Default 1 (Call Waiting enabled) - -# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127) -dtmf_avt_payload: "101" ; Default 100 - -# XML file that specifies the dialplan desired -dial_template: "dialplan" - -# Network Media Type (auto, full100, full10, half100, half10) -network_media_type: "auto" - -#Autocompletion During Dial (0-off, 1-on [default]) -autocomplete: "1" - -#Time Format (0-12hr, 1-24hr [default]) -time_format_24hr: "0" - -# URL for external Phone Services -#services_url: "http://192.168.1.1/xmlservices/index.php" - -# URL for external Directory location -#directory_url: "http://192.168.1.1/xmlservices/PhoneDirectory.php" - -# URL for branding logo -#logo_url: "http://192.168.1.1/cisco/bmp/trixbox.bmp" - -# Remote Party ID -remote_party_id: 1 ; 0-Disabled (default), 1-Enabled - diff --git a/resources/templates/provision/cisco/7960/SIP{$mac}.cnf b/resources/templates/provision/cisco/7960/SIP{$mac}.cnf index f2dda35d42..2d9adbd63f 100644 --- a/resources/templates/provision/cisco/7960/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7960/SIP{$mac}.cnf @@ -1,43 +1,150 @@ -phone_label: "{$display_name_1}" -proxy1_address: "{$server_address_1}" +{if isset($cisco_time_zone)} +# Image version +image_version: "{$cisco_image_version}" +{/if} + +# Phone settings +phone_label: "{$label}" proxy_register: 1 timer_register_expires: 300 preferred_codec: g711ulaw enable_vad: 0 dial_template: "dialplan" -line1_name: "{$user_id_1}" -line1_displayname: "{$user_id_1}" -line1_shortname: "{$short_name_1}" -line1_authname: "{$auth_id_1}" -line1_password: "{$user_password_1}" +{foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.display_name}" +#registration information +proxy{$row.line_number}_address: "{$row.server_address}" +proxy{$row.line_number}_port:"{$row.sip_port}" +line{$row.line_number}_name: "{$row.user_id}" +line{$row.line_number}_displayname: "{$row.user_id}" +line{$row.line_number}_shortname: "{$row.display_name}" +line{$row.line_number}_authname: "{$row.auth_id}" +line{$row.line_number}_password: "{$row.password}" -line2_name: "{$user_id_2}" -line2_displayname: "{$user_id_2}" -line2_shortname: "{$short_name_2}" -line2_authname: "{$auth_id_2}" -line2_password: "{$user_password_2}" +{/foreach} +# Emergency Proxy info +proxy_emergency: "{$proxy_emergency}" +proxy_emergency_port: "{$proxy_emergency_port}" -line3_name: "{$user_id_3}" -line3_displayname: "{$user_id_3}" -line3_shortname: "{$short_name_3}" -line3_authname: "{$auth_id_3}" -line3_password: "{$user_password_3}" +# Backup Proxy info +proxy_backup: "{$proxy_backup}" +proxy_backup_port: "{$proxy_backup_port}" + +# Outbound Proxy info +outbound_proxy: "{$outbound_proxy}" +outbound_proxy_port: "{$outbound_proxy_port}" + +# NAT/Firewall Traversal +voip_control_port: "5060" +start_media_port: "16384" +end_media_port: "32768" +nat_received_processing: "0" +nat_enable: "{if isset($nat_enable)}{$nat_enable}{else}1{/if}" +nat_address: "{$nat_nat_address}" -line4_name: "{$user_id_4}" -line4_displayname: "{$user_id_4}" -line4_shortname: "{$short_name_4}" -line4_authname: "{$auth_id_4}" -line4_password: "{$user_password_4}" +# Sync value of the phone used for remote reset +sync: 1 ; Default 1 -line5_name: "{$user_id_5}" -line5_displayname: "{$user_id_5}" -line5_shortname: "{$short_name_5}" -line5_authname: "{$auth_id_5}" -line5_password: "{$user_password_5}" +# Proxy Registration (0-disable (default), 1-enable) +proxy_register: "1" + +# Phone Registration Expiration [1-3932100 sec] (Default - 3600) +timer_register_expires: "80" + +# Codec for media stream (g711ulaw (default), g711alaw, g729) +preferred_codec: "none" + +# TOS bits in media stream [0-5] (Default - 5) +tos_media: "5" -line6_name: "{$user_id_6}" -line6_displayname: "{$user_id_6}" -line6_shortname: "{$short_name_6}" -line6_authname: "{$auth_id_6}" -line6_password: "{$user_password_6}" \ No newline at end of file +# Enable VAD (0-disable (default), 1-enable) +enable_vad: "0" + +# Allow for the bridge on a 3way call to join remaining parties upon hangup +cnf_join_enable: "1" ; 0-Disabled, 1-Enabled (default) + +# Allow Transfer to be completed while target phone is still ringing +semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default) + +# Telnet Level (enable or disable the ability to telnet into this phone +telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged + +# Inband DTMF Settings (0-disable, 1-enable (default)) +dtmf_inband: "1" + +# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt ) +dtmf_outofband: "avt" + +# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up) +dtmf_db_level: "3" + +# SIP Timers +timer_t1: "500" ; Default 500 msec +timer_t2: "4000" ; Default 4 sec +sip_retx: "10" ; Default 11 +sip_invite_retx: "6" ; Default 7 +timer_invite_expires: "180" ; Default 180 sec + +# Setting for Message speeddial to UOne box +messages_uri: "*97" + +# TFTP Phone Specific Configuration File Directory +tftp_cfg_dir: "" + +# Time Server +sntp_mode: "unicast" +sntp_server: "{$sntp_server}" +{if isset($cisco_time_zone)} +time_zone: "{$cisco_time_zone}" +{/if} +dst_offset: "1" +dst_start_month: "Mar" +dst_start_day: "" +dst_start_day_of_week: "Sun" +dst_start_week_of_month: "2" +dst_start_time: "02" +dst_stop_month: "Nov" +dst_stop_day: "" +dst_stop_day_of_week: "Sunday" +dst_stop_week_of_month: "1" +dst_stop_time: "2" +dst_auto_adjust: "1" + +# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control) +dnd_control: "2" ; Default 0 (Do Not Disturb feature is off) + +# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control) +callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous) + +# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control) +anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls) + +# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control) +call_waiting: "1" ; Default 1 (Call Waiting enabled) + +# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127) +dtmf_avt_payload: "101" ; Default 100 + +# XML file that specifies the dialplan desired +dial_template: "dialplan" + +# Network Media Type (auto, full100, full10, half100, half10) +network_media_type: "auto" + +#Autocompletion During Dial (0-off, 1-on [default]) +autocomplete: "1" + +#Time Format (0-12hr, 1-24hr [default]) +time_format_24hr: "0" + +# URL for external Phone Services +#services_url: "http://{$domain_name}/app/provision/file/services.xml" + +# URL for external Directory location +directory_url: "http://{$domain_name}/app/provision/file/directory.xml" + +# URL for branding logo +#logo_url: "http://{$domain_name}/app/provision/logo.bmp" + +# Remote Party ID +remote_party_id: 1 ; 0-Disabled (default), 1-Enabled diff --git a/resources/templates/provision/cisco/7960/directory-enterprise.xml b/resources/templates/provision/cisco/7960/directory-enterprise.xml new file mode 100644 index 0000000000..5c977112b0 --- /dev/null +++ b/resources/templates/provision/cisco/7960/directory-enterprise.xml @@ -0,0 +1,25 @@ + + Enterprise + Please choose... +{assign var=x value=1} +{foreach $contacts as $row}{if $row.contact_category == "enterprise"} + +{if $row.contact_name_given != ""} + {$row.contact_name_given} {$row.contact_name_family} +{else} + {$row.contact_organization} +{/if} +{if $row.phone_number != ""} + {$row.phone_number} +{else} + {$row.phone_extension} +{/if} + +{/if} +{assign var=x value=$x+1} +{/foreach} + + + + + diff --git a/resources/templates/provision/cisco/7960/directory-personal.xml b/resources/templates/provision/cisco/7960/directory-personal.xml new file mode 100644 index 0000000000..2e6750eb98 --- /dev/null +++ b/resources/templates/provision/cisco/7960/directory-personal.xml @@ -0,0 +1,24 @@ + + Personal + Please choose... +{assign var=x value=1} +{foreach $contacts as $row}{if $row.contact_category == "personal"} + +{if $row.contact_name_given != ""} + {$row.contact_name_given} {$row.contact_name_family} +{else} + {$row.contact_organization} +{/if} +{if $row.phone_number != ""} + {$row.phone_number} +{else} + {$row.phone_extension} +{/if} + +{/if} +{assign var=x value=$x+1} +{/foreach} + + + + diff --git a/resources/templates/provision/cisco/7960/directory-speed_dial.xml b/resources/templates/provision/cisco/7960/directory-speed_dial.xml new file mode 100644 index 0000000000..16138ed111 --- /dev/null +++ b/resources/templates/provision/cisco/7960/directory-speed_dial.xml @@ -0,0 +1,21 @@ + + Speed Dial + Please choose... +{assign var=x value=1} +{foreach $contacts as $row}{if $row.contact_category == "speed dial"} + +{if $row.contact_name_given != ""} + {$row.contact_name_given} {$row.contact_name_family} +{else} + {$row.contact_organization} +{/if} +{if $row.phone_number != ""} + {$row.phone_number} +{else} + {$row.phone_extension} +{/if} + +{/if} +{assign var=x value=$x+1} +{/foreach} + diff --git a/resources/templates/provision/cisco/7960/directory.xml b/resources/templates/provision/cisco/7960/directory.xml new file mode 100644 index 0000000000..24351b9b2d --- /dev/null +++ b/resources/templates/provision/cisco/7960/directory.xml @@ -0,0 +1,17 @@ + + Contacts + Please choose... + + Enterprise + http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac} + + + Speed Dial + http://{$domain_name}/app/provision/file/directory-speed_dial.xml?mac={$mac} + + \ No newline at end of file From fedd5ba9fc4e8a76b2b4e4226b0febde810810ee Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 30 Nov 2015 10:22:55 +0300 Subject: [PATCH 127/232] Add. Text class to manage translate texts. --- .../scripts/app/voicemail/app_languages.lua | 3 +- .../resources/functions/send_email.lua | 13 ++-- .../scripts/resources/functions/text.lua | 71 +++++++++++++++++++ 3 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 resources/install/scripts/resources/functions/text.lua diff --git a/resources/install/scripts/app/voicemail/app_languages.lua b/resources/install/scripts/app/voicemail/app_languages.lua index 0c2daed73b..57dc356a16 100644 --- a/resources/install/scripts/app/voicemail/app_languages.lua +++ b/resources/install/scripts/app/voicemail/app_languages.lua @@ -1,4 +1,4 @@ -text = {}; +text = text or {}; text['label-download'] = {}; text['label-download']['en-us'] = "Download"; @@ -24,3 +24,4 @@ text['label-attached']['fr-fr'] = "Attaché"; text['label-attached']['de-de'] = "im Anhang"; text['label-attached']['de-at'] = "im Anhang"; +return text \ No newline at end of file diff --git a/resources/install/scripts/app/voicemail/resources/functions/send_email.lua b/resources/install/scripts/app/voicemail/resources/functions/send_email.lua index 0cb437c19e..0480f8c9dd 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/send_email.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/send_email.lua @@ -25,10 +25,6 @@ local send_mail = require 'resources.functions.send_mail' - local function T(str) - return text[str][default_language..'-'..default_dialect] or text[str]['en-us'] - end - --define a function to send email function send_email(id, uuid) --get voicemail message details @@ -58,7 +54,8 @@ --require the email address to send the email if (string.len(voicemail_mail_to) > 2) then --include languages file - require "app.voicemail.app_languages"; + local Text = require "resources.functions.text" + local text = Text.new("app.voicemail.app_languages") --get voicemail message details sql = [[SELECT * FROM v_voicemail_messages @@ -142,11 +139,11 @@ body = body:gsub("${sip_to_user}", id); body = body:gsub("${dialed_user}", id); if (voicemail_file == "attach") then - body = body:gsub("${message}", T'label-attached'); + body = body:gsub("${message}", text['label-attached']); elseif (voicemail_file == "link") then - body = body:gsub("${message}", ""..T'label-download'..""); + body = body:gsub("${message}", ""..text['label-download']..""); else - body = body:gsub("${message}", ""..T'label-listen'..""); + body = body:gsub("${message}", ""..text['label-listen']..""); end body = body:gsub(" ", " "); body = body:gsub("%s+", ""); diff --git a/resources/install/scripts/resources/functions/text.lua b/resources/install/scripts/resources/functions/text.lua new file mode 100644 index 0000000000..11bf0933a2 --- /dev/null +++ b/resources/install/scripts/resources/functions/text.lua @@ -0,0 +1,71 @@ +--- +-- @tparam table dict Dictionary +-- @tparam[opt='en'] string language default language +-- @tparam[opt='us'] string dialect default language +-- @return[1] nil if key is unknown +-- @return[2] empty string if language/dialect unknown or there no appropriate value for default language/dialect +-- @return[3] translated value accordint dictionary/language/dialect +-- +-- @usage +-- local dict = { +-- ['label-text'] = { +-- ['en-us'] = 'text'; +-- ['ru-ru'] = 'текст'; +-- } +-- } +-- local text = Text.new(dict) +-- -- use global `default_language` and `default_dialect` to resolve language +-- var = text['label-attached'] +-- -- use prefix form +-- var = text'label-attached' +-- -- Implicit specify language +-- var = text('label-attached', 'ru', 'ru') +-- -- set global variables(you can set them even after ctor call) +-- default_language, default_dialect = 'ru', 'ru' +-- var = text['label-attached'] +local function make_text(dict, language, dialect) + if not (language and dialect) then + language, dialect = 'en', 'us' + end + + if type(dict) == 'string' then + dict = require(dict) + end + + local default = (language .. '-' .. dialect):lower() + + local function index(_, k) + local t = dict[k] + if not t then return end + + local lang + if default_language and default_dialect then + lang = (default_language .. '-' .. default_dialect):lower() + end + if not lang then lang = default end + return t[lang] or t[default] or '' + end + + local function call(self, k, language, dialect) + if language and dialect then + local t = dict[k] + if not t then return end + local lang = (language .. '-' .. dialect):lower() + local v = t[lang] + if v then return v end + end + return self[k] + end + + return setmetatable({},{ + __newindex = function() + error('Can not add field to proxy') + end; + __index = index; + __call = call; + }) +end + +return { + new = make_text; +} \ No newline at end of file From 5339e39db839c496f425d14d2233f7d3da969336 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 30 Nov 2015 11:57:09 +0300 Subject: [PATCH 128/232] Add. Send reply message after fax task done. --- app/fax/app_config.php | 4 ++ app/fax/fax_send.php | 13 +++--- .../app/fax/resources/scripts/queue/retry.lua | 45 ++++++++++++++----- .../app/fax/resources/scripts/queue/tasks.lua | 1 + secure/fax_to_email.php | 13 +++--- 5 files changed, 53 insertions(+), 23 deletions(-) diff --git a/app/fax/app_config.php b/app/fax/app_config.php index fe63326d1d..83fe88019d 100644 --- a/app/fax/app_config.php +++ b/app/fax/app_config.php @@ -554,6 +554,10 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_reply_address'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'task_interrupted'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 362dbaf46c..b5491287a0 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -131,7 +131,7 @@ if(!function_exists('gs_cmd')) { } if(!function_exists('fax_enqueue')) { - function fax_enqueue($fax_uuid, $fax_file, $wav_file, $fax_uri, $fax_dtmf, $dial_string){ + function fax_enqueue($fax_uuid, $fax_file, $wav_file, $reply_address, $fax_uri, $fax_dtmf, $dial_string){ global $db, $db_type; $fax_task_uuid = uuid(); @@ -151,12 +151,12 @@ INSERT INTO v_fax_tasks( fax_task_uuid, fax_uuid, task_next_time, task_lock_time, task_fax_file, task_wav_file, task_uri, task_dial_string, task_dtmf, task_interrupted, task_status, task_no_answer_counter, task_no_answer_retry_counter, task_retry_counter, - task_description) + task_reply_address, task_description) VALUES (?, ?, $date_utc_now_sql, NULL, ?, ?, ?, ?, ?, 'false', 0, 0, 0, 0, - ?); + ?, ?); HERE; $stmt = $db->prepare($sql); $i = 0; @@ -167,6 +167,7 @@ HERE; $stmt->bindValue(++$i, $fax_uri); $stmt->bindValue(++$i, $dial_string); $stmt->bindValue(++$i, $fax_dtmf); + $stmt->bindValue(++$i, $reply_address); $stmt->bindValue(++$i, $description); if ($stmt->execute()) { $response = 'Enqueued'; @@ -694,8 +695,6 @@ function fax_split_dtmf(&$fax_number, &$fax_dtmf){ $common_dial_string .= "sip_h_X-accountcode='" . $fax_accountcode . "',"; $common_dial_string .= "domain_uuid=" . $_SESSION["domain_uuid"] . ","; $common_dial_string .= "domain_name=" . $_SESSION["domain_name"] . ","; - $common_dial_string .= "mailto_address='" . $mailto_address . "',"; - $common_dial_string .= "mailfrom_address='" . $mailfrom_address . "',"; $common_dial_string .= "origination_caller_id_name='" . $fax_caller_id_name . "',"; $common_dial_string .= "origination_caller_id_number='" . $fax_caller_id_number . "',"; $common_dial_string .= "fax_ident='" . $fax_caller_id_number . "',"; @@ -722,6 +721,8 @@ function fax_split_dtmf(&$fax_number, &$fax_dtmf){ if ($fax_send_mode != 'queue') { $dial_string .= $t38; + $dial_string .= "mailto_address='" . $mailto_address . "',"; + $dial_string .= "mailfrom_address='" . $mailfrom_address . "',"; $dial_string .= "fax_uri=" . $fax_uri . ","; $dial_string .= "fax_retry_attempts=1" . ","; $dial_string .= "fax_retry_limit=20" . ","; @@ -744,7 +745,7 @@ function fax_split_dtmf(&$fax_number, &$fax_dtmf){ } else{ // enqueue $wav_file = ''; //! @todo add custom message - $response = fax_enqueue($fax_uuid, $fax_file, $wav_file, $fax_uri, $fax_dtmf, $dial_string); + $response = fax_enqueue($fax_uuid, $fax_file, $wav_file, $mailto_address, $fax_uri, $fax_dtmf, $dial_string); } } diff --git a/resources/install/scripts/app/fax/resources/scripts/queue/retry.lua b/resources/install/scripts/app/fax/resources/scripts/queue/retry.lua index feb8f6ef4f..32ef3fac07 100644 --- a/resources/install/scripts/app/fax/resources/scripts/queue/retry.lua +++ b/resources/install/scripts/app/fax/resources/scripts/queue/retry.lua @@ -4,10 +4,11 @@ require "resources.functions.split"; require "resources.functions.count"; - local log = require "resources.functions.log".fax_retry - local Database = require "resources.functions.database" - local Settings = require "resources.functions.lazy_settings" - local Tasks = require "app.fax.resources.scripts.queue.tasks" + local log = require "resources.functions.log".fax_retry + local Database = require "resources.functions.database" + local Settings = require "resources.functions.lazy_settings" + local Tasks = require "app.fax.resources.scripts.queue.tasks" + local send_mail = require "resources.functions.send_mail" local fax_task_uuid = env:getHeader('fax_task_uuid') local task = Tasks.select_task(fax_task_uuid) @@ -69,11 +70,7 @@ local fax_uuid = task.fax_uuid -- Email variables - local email_address = env:getHeader("mailto_address") - local from_address = env:getHeader("mailfrom_address") or email_address local number_dialed = fax_uri:match("/([^/]-)%s*$") - local email_message_fail = "We are sorry the fax failed to go through. It has been attached. Please check the number "..number_dialed..", and if it was correct you might consider emailing it instead." - local email_message_success = "We are happy to report the fax was sent successfully. It has been attached for your records." log.noticef([[<<< CALL RESULT >>> uuid: = '%s' @@ -86,7 +83,6 @@ accountcode: = '%s' origination_caller_id_name: = '%s' origination_caller_id_number: = '%s' - mailfrom_address: = '%s' mailto_address: = '%s' hangup_cause_q850: = '%s' fax_options = '%s' @@ -101,8 +97,7 @@ tostring(accountcode) , tostring(origination_caller_id_name) , tostring(origination_caller_id_number) , - tostring(from_address) , - tostring(email_address) , + tostring(task.reply_address) , tostring(hangup_cause_q850) , fax_options ) @@ -249,6 +244,14 @@ dbh:query(sql); end +--prepare the headers + local mail_x_headers = { + ["X-FusionPBX-Domain-UUID"] = domain_uuid; + ["X-FusionPBX-Domain-Name"] = domain_name; + ["X-FusionPBX-Call-UUID"] = uuid; + ["X-FusionPBX-Email-Type"] = 'email2fax'; + } + -- add the fax files if fax_success == "1" then @@ -328,6 +331,16 @@ end Tasks.remove_task(task) + + if task.reply_address and #task.reply_address > 0 then + send_mail(mail_x_headers, task.reply_address, { + "Fax to: " .. number_dialed .. " SENT", + table.concat{ + "We are happy to report the fax was sent successfully.", + "It has been attached for your records.", + } + }) + end end if fax_success ~= "1" then @@ -349,6 +362,16 @@ Tasks.wait_task(task, answered, hangup_cause_q850) if task.status ~= 0 then Tasks.remove_task(task) + if task.reply_address and #task.reply_address > 0 then + send_mail(mail_x_headers, task.reply_address, { + "Fax to: " .. number_dialed .. " FAILED", + table.concat{ + "We are sorry the fax failed to go through. ", + "It has been attached. Please check the number "..number_dialed..", ", + "and if it was correct you might consider emailing it instead.", + } + }) + end end end end diff --git a/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua b/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua index 96f6d612bf..dd049fd8ef 100644 --- a/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua +++ b/resources/install/scripts/app/fax/resources/scripts/queue/tasks.lua @@ -43,6 +43,7 @@ select t1.task_dtmf as dtmf, t1.task_fax_file as fax_file, t1.task_wav_file as wav_file, + t1.task_reply_address as reply_address, t1.task_no_answer_counter as no_answer_counter, t1.task_no_answer_retry_counter as no_answer_retry_counter, t1.task_retry_counter as retry_counter, diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index a0576756c0..3005595d6b 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -236,7 +236,7 @@ if(!function_exists('tiff2pdf')) { } if(!function_exists('fax_enqueue')) { - function fax_enqueue($fax_uuid, $fax_file, $wav_file, $fax_uri, $fax_dtmf, $dial_string){ + function fax_enqueue($fax_uuid, $fax_file, $wav_file, $reply_address, $fax_uri, $fax_dtmf, $dial_string){ global $db, $db_type; $fax_task_uuid = uuid(); @@ -256,12 +256,12 @@ INSERT INTO v_fax_tasks( fax_task_uuid, fax_uuid, task_next_time, task_lock_time, task_fax_file, task_wav_file, task_uri, task_dial_string, task_dtmf, task_interrupted, task_status, task_no_answer_counter, task_no_answer_retry_counter, task_retry_counter, - task_description) + task_reply_address, task_description) VALUES (?, ?, $date_utc_now_sql, NULL, ?, ?, ?, ?, ?, 'false', 0, 0, 0, 0, - ?); + ?, ?); HERE; $stmt = $db->prepare($sql); $i = 0; @@ -272,6 +272,7 @@ HERE; $stmt->bindValue(++$i, $fax_uri); $stmt->bindValue(++$i, $dial_string); $stmt->bindValue(++$i, $fax_dtmf); + $stmt->bindValue(++$i, $reply_address); $stmt->bindValue(++$i, $description); if ($stmt->execute()) { $response = 'Enqueued'; @@ -479,8 +480,6 @@ if(!function_exists('fax_split_dtmf')) { $common_dial_string .= "sip_h_X-accountcode='" . $fax_accountcode . "',"; $common_dial_string .= "domain_uuid=" . $_SESSION["domain_uuid"] . ","; $common_dial_string .= "domain_name=" . $_SESSION["domain_name"] . ","; - $common_dial_string .= "mailto_address='" . $mailto_address . "',"; - $common_dial_string .= "mailfrom_address='" . $mailfrom_address . "',"; $common_dial_string .= "origination_caller_id_name='" . $fax_caller_id_name . "',"; $common_dial_string .= "origination_caller_id_number='" . $fax_caller_id_number . "',"; $common_dial_string .= "fax_ident='" . $fax_caller_id_number . "',"; @@ -489,6 +488,8 @@ if(!function_exists('fax_split_dtmf')) { if ($fax_send_mode != 'queue') { $dial_string .= $t38; + $dial_string .= "mailto_address='" . $mailto_address . "',"; + $dial_string .= "mailfrom_address='" . $mailfrom_address . "',"; $dial_string .= "fax_uri=" . $fax_uri . ","; $dial_string .= "fax_retry_attempts=1" . ","; $dial_string .= "fax_retry_limit=20" . ","; @@ -533,7 +534,7 @@ if(!function_exists('fax_split_dtmf')) { } else{ $wav_file = ''; - $response = fax_enqueue($fax_uuid, $fax_file, $wav_file, $fax_uri, $fax_dtmf, $dial_string); + $response = fax_enqueue($fax_uuid, $fax_file, $wav_file, $mailto_address, $fax_uri, $fax_dtmf, $dial_string); } } } From 6cfc24f8eb60a9326ea717d9e1b55c6e57a30d34 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 30 Nov 2015 12:08:26 +0300 Subject: [PATCH 129/232] Fix. Send mail when fail create outbound channel. --- .../app/fax/resources/scripts/queue/next.lua | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/resources/install/scripts/app/fax/resources/scripts/queue/next.lua b/resources/install/scripts/app/fax/resources/scripts/queue/next.lua index bb5607f5ca..fb0df5c1cd 100644 --- a/resources/install/scripts/app/fax/resources/scripts/queue/next.lua +++ b/resources/install/scripts/app/fax/resources/scripts/queue/next.lua @@ -4,6 +4,7 @@ require "resources.functions.sleep" local log = require "resources.functions.log".next_fax_task local Tasks = require "app.fax.resources.scripts.queue.tasks" local Esl = require "resources.functions.esl" +local send_mail = require "resources.functions.send_mail" local FAX_OPTIONS = { "fax_use_ecm=false,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=default"; @@ -13,6 +14,25 @@ local FAX_OPTIONS = { "fax_use_ecm=false,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false"; } +local function task_send_mail(task) + local mail_x_headers = { + ["X-FusionPBX-Domain-UUID"] = task.domain_uuid; + ["X-FusionPBX-Domain-Name"] = task.domain_name; + ["X-FusionPBX-Email-Type"] = 'email2fax'; + } + local number_dialed = task.uri:match("/([^/]-)%s*$") + if task.reply_address and #task.reply_address > 0 then + send_mail(mail_x_headers, task.reply_address, { + "Fax to: " .. number_dialed .. " FAILED", + table.concat{ + "We are sorry the fax failed to go through. ", + "It has been attached. Please check the number "..number_dialed..", ", + "and if it was correct you might consider emailing it instead.", + } + }) + end +end + local function next_task() local task, err = Tasks.next_task() @@ -43,6 +63,7 @@ local function next_task() Tasks.wait_task(task, false, info) if task.status ~= 0 then Tasks.remove_task(task) + task_send_mail(task) end log.noticef('Can not originate to `%s` cause: %s: %s ', task.uri, tostring(status), tostring(info)) else From 0c828deba60c9b1bb35a9db8b832b525902a12e0 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 30 Nov 2015 13:55:02 +0300 Subject: [PATCH 130/232] Fix. Create DB during web install. --- core/install/resources/classes/install_fusionpbx.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index f0e4ca1597..c891f96daa 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -275,9 +275,9 @@ include "root.php"; try { if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } if (strlen($this->db_host) > 0) { - $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} user={".$this->db_create_username."} password={".$this->db_create_password."} dbname=template1"); + $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1"); } else { - $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={".$this->db_create_username."} password={".$this->db_create_password."} dbname=template1"); + $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1"); } } catch (PDOException $error) { throw new Exception("error connecting to database: " . $error->getMessage()); From a4b126785ad6a324aba7c8ac50b7d781b8a981db Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 30 Nov 2015 14:54:39 +0300 Subject: [PATCH 131/232] Add. Translate to email2fax type message. --- app/emails/app_languages.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/emails/app_languages.php b/app/emails/app_languages.php index 5c08ca3825..c373cd8ce5 100644 --- a/app/emails/app_languages.php +++ b/app/emails/app_languages.php @@ -72,6 +72,15 @@ $text['label-type_voicemail']['pl'] = "Poczta głosowa"; $text['label-type_voicemail']['sv-se'] = "Röstbrevlåda"; $text['label-type_voicemail']['de-at'] = "Mailbox"; +$text['label-type_email2fax']['en-us'] = "Email to fax report"; +$text['label-type_email2fax']['es-cl'] = ""; +$text['label-type_email2fax']['pt-pt'] = ""; +$text['label-type_email2fax']['fr-fr'] = ""; +$text['label-type_email2fax']['pt-br'] = ""; +$text['label-type_email2fax']['pl'] = ""; +$text['label-type_email2fax']['sv-se'] = ""; +$text['label-type_email2fax']['de-at'] = ""; + $text['label-type']['en-us'] = "Type"; $text['label-type']['es-cl'] = "Tipo"; $text['label-type']['pt-pt'] = "Tipo"; From 29c4421592df6599221a02000bfcbb32bd884d2e Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 30 Nov 2015 15:36:11 +0300 Subject: [PATCH 132/232] Fix. Make channel uuid optional in email. This needs for example if fax server could not create outgoing channel. --- secure/v_mailto.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/secure/v_mailto.php b/secure/v_mailto.php index e81de0c6b1..5a7566a081 100644 --- a/secure/v_mailto.php +++ b/secure/v_mailto.php @@ -292,11 +292,14 @@ $mailer_error = $mail->ErrorInfo; echo "Mailer Error: ".$mailer_error."\n\n"; + $call_uuid = $headers["X-FusionPBX-Call-UUID"]; // log/store message in database for review $email_uuid = uuid(); $sql = "insert into v_emails ( "; $sql .= "email_uuid, "; - $sql .= "call_uuid, "; + if ($call_uuid) { + $sql .= "call_uuid, "; + } $sql .= "domain_uuid, "; $sql .= "sent_date, "; $sql .= "type, "; @@ -304,7 +307,9 @@ $sql .= "email "; $sql .= ") values ( "; $sql .= "'".$email_uuid."', "; - $sql .= "'".$headers["X-FusionPBX-Call-UUID"]."', "; + if ($call_uuid) { + $sql .= "'".$call_uuid."', "; + } $sql .= "'".$headers["X-FusionPBX-Domain-UUID"]."', "; $sql .= "now(),"; $sql .= "'".$headers["X-FusionPBX-Email-Type"]."', "; From b944a4dca73d5f831dbdae38866a6c8132c86e61 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 30 Nov 2015 16:04:13 +0300 Subject: [PATCH 133/232] Fix. Use incorrect option name. --- themes/enhanced/template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/enhanced/template.php b/themes/enhanced/template.php index fd0c9da8ad..23aadd820a 100644 --- a/themes/enhanced/template.php +++ b/themes/enhanced/template.php @@ -1434,7 +1434,7 @@ if (strlen($_SESSION['message']) > 0) { Date: Mon, 30 Nov 2015 15:23:42 +0000 Subject: [PATCH 134/232] moved assumed path management to detect_switch as *_vdir --- core/install/app_languages.php | 11 +++++ .../resources/classes/detect_switch.php | 41 +++++++++++++++---- .../resources/classes/install_fusionpbx.php | 16 +++++--- .../page_parts/install_event_socket.php | 23 +++++++++-- 4 files changed, 73 insertions(+), 18 deletions(-) diff --git a/core/install/app_languages.php b/core/install/app_languages.php index 7dcfb2145f..22ead46f1e 100644 --- a/core/install/app_languages.php +++ b/core/install/app_languages.php @@ -22,6 +22,17 @@ $text['title-detected_configuration']['uk'] = ""; $text['title-detected_configuration']['de-at'] = ""; $text['title-detected_configuration']['ar-eg'] = ""; +$text['title-assumed_configuration']['en-us'] = "Assumed Configuration"; +$text['title-assumed_configuration']['es-cl'] = ""; +$text['title-assumed_configuration']['pt-pt'] = ""; +$text['title-assumed_configuration']['fr-fr'] = ""; +$text['title-assumed_configuration']['pt-br'] = ""; +$text['title-assumed_configuration']['pl'] = ""; +$text['title-assumed_configuration']['sv-se'] = ""; +$text['title-assumed_configuration']['uk'] = ""; +$text['title-assumed_configuration']['de-at'] = ""; +$text['title-assumed_configuration']['ar-eg'] = ""; + $text['message-update']['en-us'] = "Update Completed"; $text['message-update']['es-cl'] = "Actualización Completada"; $text['message-update']['pt-pt'] = "Actualização Efectuada"; diff --git a/core/install/resources/classes/detect_switch.php b/core/install/resources/classes/detect_switch.php index 77a552aab9..a0c26c4d3c 100644 --- a/core/install/resources/classes/detect_switch.php +++ b/core/install/resources/classes/detect_switch.php @@ -36,7 +36,7 @@ require_once "resources/classes/EventSocket.php"; protected $_major; protected $_minor; - // folders + // dirs - detected by from the switch protected $_base_dir = ''; protected $_cache_dir = ''; protected $_certs_dir = ''; @@ -54,7 +54,7 @@ require_once "resources/classes/EventSocket.php"; protected $_sounds_dir = ''; protected $_storage_dir = ''; protected $_temp_dir = ''; - + public function major() { return $this->_major; } public function minor() { return $this->_minor; } public function version() { return $this->_major.".".$this->_minor; } @@ -75,7 +75,23 @@ require_once "resources/classes/EventSocket.php"; public function sounds_dir() { return $this->_sounds_dir; } public function storage_dir() { return $this->_storage_dir; } public function temp_dir() { return $this->_temp_dir; } - public function get_folders() { return $this->_folders; } + public function get_dirs() { return $this->_dirs; } + public function get_vdirs() { return $this->_vdirs; } + + // virtual dirs - assumed based on the detected dirs + protected $_voicemail_vdir = ''; + protected $_phrases_vdir = ''; + protected $_extensions_vdir = ''; + protected $_sip_profiles_vdir = ''; + protected $_dialplan_vdir = ''; + protected $_backup_vdir = ''; + + public function voicemail_vdir() { return $this->_voicemail_vdir; } + public function phrases_vdir() { return $this->_phrases_vdir; } + public function extensions_vdir() { return $this->_extensions_vdir; } + public function sip_profiles_vdir() { return $this->_sip_profiles_vdir; } + public function dialplan_vdir() { return $this->_dialplan_vdir; } + public function backup_vdir() { return $this->_backup_vdir; } // event socket public $event_host = 'localhost'; @@ -91,14 +107,16 @@ require_once "resources/classes/EventSocket.php"; if(!$this->event_socket){ $this->detect_event_socket(); } - $this->_folders = preg_grep ('/.*_dir$/', get_class_methods('detect_switch') ); - sort( $this->_folders ); + $this->_dirs = preg_grep ('/.*_dir$/', get_class_methods('detect_switch') ); + sort( $this->_dirs ); + $this->_vdirs = preg_grep ('/.*_vdir$/', get_class_methods('detect_switch') ); + sort( $this->_vdirs ); } - + protected function detect_event_socket() { //perform searches for user's config here } - + public function detect() { $this->connect_event_socket(); if(!$this->event_socket){ @@ -116,8 +134,13 @@ require_once "resources/classes/EventSocket.php"; $this->$field = $matches[2]; } } - } - + $this->_voicemail_vdir = join( DIRECTORY_SEPARATOR, array($this->_storage_dir, "voicemail")); + $this->_phrases_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "lang")); + $this->_extensions_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "directory")); + $this->_sip_profiles_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "sip_profiles")); + $this->_dialplan_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "dialplan")); + $this->_backup_vdir = sys_get_temp_dir(); + } protected function connect_event_socket(){ $esl = new EventSocket; diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 6d62060939..b7482fe592 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -637,7 +637,7 @@ include "root.php"; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->storage_dir(), 'voicemail'); + $tmp[$x]['value'] = $this->detect_switch->voicemail_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'voicemail'; $tmp[$x]['enabled'] = 'true'; @@ -655,25 +655,31 @@ include "root.php"; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->phrases_vdir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'phrases'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; $tmp[$x]['value'] = ''; $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'provision'; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->conf_dir(), "/directory"); + $tmp[$x]['value'] = $this->detect_switch->extensions_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'extensions'; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->conf_dir(), "/sip_profiles"); + $tmp[$x]['value'] = $this->detect_switch->sip_profiles_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'sip_profiles'; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->conf_dir(), "/dialplan"); + $tmp[$x]['value'] = $this->detect_switch->dialplan_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'dialplan'; $tmp[$x]['enabled'] = 'false'; @@ -694,7 +700,7 @@ include "root.php"; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = sys_get_temp_dir(); + $tmp[$x]['value'] = $this->detect_switch->backup_vdir(); $tmp[$x]['category'] = 'server'; $tmp[$x]['subcategory'] = 'backup'; $tmp[$x]['enabled'] = 'true'; diff --git a/core/install/resources/page_parts/install_event_socket.php b/core/install/resources/page_parts/install_event_socket.php index 7122925b4d..928c6e5424 100644 --- a/core/install/resources/page_parts/install_event_socket.php +++ b/core/install/resources/page_parts/install_event_socket.php @@ -91,10 +91,10 @@ echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; - $id = 0; + $id = 1; echo "\n"; echo "\n"; - echo "\n"; - foreach ($switch_detect->get_folders() as $folder) + foreach ($switch_detect->get_dirs() as $folder) { if($id % 2 == 0){ echo "\n"; } echo "\n"; } + echo "\n"; + echo "\n"; + echo "\n"; + $id=0; + foreach ($switch_detect->get_vdirs() as $folder) + { + if($id % 2 == 0){ echo "\n"; } + echo "\n"; + echo "\n"; + if($id % 2 == 1){ echo "\n"; } + $id++; + } echo "
    ".$text['title-detected_configuration']."

    ".$text['title-detected_configuration']."
    \n"; echo "Switch version\n"; @@ -102,9 +102,8 @@ echo "\n"; echo " ".$switch_detect->version()."\n"; echo "
    \n"; @@ -117,6 +116,22 @@ $id++; } if($id % 2 == 1){ echo "

    ".$text['title-assumed_configuration']."
    \n"; + echo $folder."\n"; + echo "\n"; + echo " ".$switch_detect->$folder()."\n"; + echo "
    "; } From e340747009480505a33f7af40864d2925b2bef4f Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Mon, 30 Nov 2015 16:25:36 +0000 Subject: [PATCH 135/232] Added the better create database support --- core/install/install_first_time.php | 1 + .../resources/classes/install_fusionpbx.php | 60 +++++++++---------- .../page_parts/install_config_database.php | 38 ++++++++++++ 3 files changed, 69 insertions(+), 30 deletions(-) diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php index ad08a3faeb..e47bb700bd 100644 --- a/core/install/install_first_time.php +++ b/core/install/install_first_time.php @@ -45,6 +45,7 @@ require_once "resources/classes/text.php"; $db_name = ''; $db_username = ''; $db_password = ''; + $db_create_option = 'none'; $db_create_username = ''; $db_create_password = ''; diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index b38860fb10..2a680efd2d 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -54,6 +54,9 @@ include "root.php"; public $db_name; public $db_username; public $db_password; + public $db_create_option = 'none'; + public $db_create_username; + public $db_create_password; function __construct($domain_name, $domain_uuid, $detect_switch) { if(!is_a($detect_switch, 'detect_switch')){ @@ -200,6 +203,12 @@ include "root.php"; protected function create_database() { require $this->config_php; $this->write_progress("Creating database as " . $this->db_type); + if($this->create_db_option == 'same') + { + $this->create_db_option = 'user'; + $this->create_db_username = $this->db_username; + $this->create_db_password = $this->db_username_password; + } $function = "create_database_" . $this->db_type; $this->$function(); global $db; @@ -270,17 +279,17 @@ include "root.php"; protected function create_database_pgsql() { - //if $this->db_create_username provided, attempt to create new PG role and database - if (strlen($this->db_create_username) > 0) { + if ($this->db_create_option == 'user') { + //Attempt to create new PG role and database try { if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } if (strlen($this->db_host) > 0) { - $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} user={".$this->db_create_username."} password={".$this->db_create_password."} dbname=template1"); + $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1"); } else { - $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={".$this->db_create_username."} password={".$this->db_create_password."} dbname=template1"); + $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1"); } } catch (PDOException $error) { - throw new Exception("error connecting to database: " . $error->getMessage()); + throw new Exception("error connecting to database in order to create: " . $error->getMessage()); } //create the database, user, grant perms @@ -344,50 +353,41 @@ include "root.php"; protected function create_database_mysql() { //database connection + $connect_string = ''; + $connect_username = $this->db_username; + $connect_password = $this->db_password; + if ($this->db_create_option == 'user') { + $connect_username = $this->db_create_username; + $connect_password = $this->db_create_password; + } try { if (strlen($this->db_host) == 0 && strlen($this->db_port) == 0) { //if both host and port are empty use the unix socket - if (strlen($this->db_create_username) == 0) { - $this->dbh = new PDO("mysql:host=$this->db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $this->db_username, $this->db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - else { - $this->dbh = new PDO("mysql:host=$this->db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $this->db_create_username, $this->db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } + $this->dbh = new PDO("mysql:host=$this->db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $connect_username, $connect_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + } + elseif (strlen($this->db_port) == 0) { + //leave out port if it is empty + $this->dbh = new PDO("mysql:host=$this->db_host;", $connect_username, $connect_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } } else { - if (strlen($this->db_port) == 0) { - //leave out port if it is empty - if (strlen($this->db_create_username) == 0) { - $this->dbh = new PDO("mysql:host=$this->db_host;", $this->db_username, $this->db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - else { - $this->dbh = new PDO("mysql:host=$this->db_host;", $this->db_create_username, $this->db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } - } - else { - if (strlen($this->db_create_username) == 0) { - $this->dbh = new PDO("mysql:host=$this->db_host;port=$this->db_port;", $this->db_username, $this->db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - else { - $this->dbh = new PDO("mysql:host=$this->db_host;port=$this->db_port;", $this->db_create_username, $this->db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - } + $this->dbh = new PDO("mysql:host=$this->db_host;port=$this->db_port;", $connect_username, $connect_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); } catch (PDOException $error) { - throw new Exception("error creating database: " . $error->getMessage() . "\n" . $sql ); + throw new Exception("error connecting to database: " . $error->getMessage() . "\n" . $sql ); } //create the table, user and set the permissions only if the db_create_username was provided - if (strlen($this->db_create_username) > 0) { + if ($this->db_create_option == 'user') { //select the mysql database try { $this->dbh->query("USE mysql;"); } catch (PDOException $error) { if ($this->debug) { - throw new Exception("error conencting to database: " . $error->getMessage()); + throw new Exception("error connecting to database in order to create: " . $error->getMessage()); } } diff --git a/core/install/resources/page_parts/install_config_database.php b/core/install/resources/page_parts/install_config_database.php index 371a726b98..f5198fc5a3 100644 --- a/core/install/resources/page_parts/install_config_database.php +++ b/core/install/resources/page_parts/install_config_database.php @@ -134,6 +134,25 @@ echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo " Create Database Options\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
    \n"; + echo "Choose whether to create the database\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo " Create Database Username\n"; @@ -218,6 +237,25 @@ echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo " Create Database Options\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
    \n"; + echo "Choose whether to create the database\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo " Create Database Username\n"; From ba0a00bc840f5a075a844306627f911b25130cb7 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 30 Nov 2015 12:33:27 -0700 Subject: [PATCH 136/232] Add expansion aka side car support to the Grandstream gxp21xx template. --- .../provision/grandstream/gxp21xx/{$mac}.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml index 2b0445ef10..78611d3c37 100644 --- a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml @@ -3591,6 +3591,17 @@ Outgoing calls. 0 - No, 1 - Yes. Default is 0 --> {$memory_key_value_18} +{$start_label_id = 23002} +{$start_value_id = 23003} +{foreach $keys as $row} +{if $row.device_key_category == "expansion"} + {$key_id = $row.device_key_id - 1} + {$label_id = $start_label_id + ($key_id * 5)} + {$value_id = $start_value_id + ($key_id * 5)} + {$row.device_key_label} + {$row.device_key_value} +{/if} +{/foreach} \ No newline at end of file From 675544a655ea6239eedd4d3dc3dbbb8179335b4a Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 30 Nov 2015 12:50:41 -0700 Subject: [PATCH 137/232] Add a few more keys parameters to the Grandstream gxp21xx template. --- .../templates/provision/grandstream/gxp21xx/{$mac}.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml index 78611d3c37..63be439319 100644 --- a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml @@ -3591,13 +3591,19 @@ Outgoing calls. 0 - No, 1 - Yes. Default is 0 --> {$memory_key_value_18} +{$start_type_id = 23000} +{$start_line_id = 23001} {$start_label_id = 23002} {$start_value_id = 23003} {foreach $keys as $row} {if $row.device_key_category == "expansion"} {$key_id = $row.device_key_id - 1} + {$line_id = $start_line_id + ($key_id * 5)} + {$type_id = $start_type_id + ($key_id * 5)} {$label_id = $start_label_id + ($key_id * 5)} {$value_id = $start_value_id + ($key_id * 5)} + {$row.device_key_type} + {$row.device_key_line} {$row.device_key_label} {$row.device_key_value} {/if} From 8b3e6e7a967f3bd3cdcd4b51412e87f192cabee8 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 30 Nov 2015 13:09:02 -0700 Subject: [PATCH 138/232] Fix the mode definition for the Grandstream expansion keys. --- app/provision/resources/classes/provision.php | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 62a8118182..60a7cdb141 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -664,21 +664,21 @@ include "root.php"; case "ldap search": $device_key_type = "21"; break; } } - if ($device_key_category == "memory") { - switch ($device_key_type) { - case "speed dial": $device_key_type = "0"; break; - case "blf": $device_key_type = "1"; break; - case "presence watcher": $device_key_type = "2"; break; - case "eventlist blf": $device_key_type = "3"; break; - case "speed dial active": $device_key_type = "4"; break; - case "dial dtmf": $device_key_type = "5"; break; - case "voicemail": $device_key_type = "6"; break; - case "call return": $device_key_type = "7"; break; - case "transfer": $device_key_type = "8"; break; - case "call park": $device_key_type = "9"; break; - case "intercom": $device_key_type = "10"; break; - case "ldap search": $device_key_type = "11"; break; - } + if ($device_key_category == "memory" || $device_key_category == "expansion") { + switch ($device_key_type) { + case "speed dial": $device_key_type = "0"; break; + case "blf": $device_key_type = "1"; break; + case "presence watcher": $device_key_type = "2"; break; + case "eventlist blf": $device_key_type = "3"; break; + case "speed dial active": $device_key_type = "4"; break; + case "dial dtmf": $device_key_type = "5"; break; + case "voicemail": $device_key_type = "6"; break; + case "call return": $device_key_type = "7"; break; + case "transfer": $device_key_type = "8"; break; + case "call park": $device_key_type = "9"; break; + case "intercom": $device_key_type = "10"; break; + case "ldap search": $device_key_type = "11"; break; + } } } From 1f7923908fb8274b3bbd27832e3ca65ee7245f87 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 30 Nov 2015 13:33:46 -0700 Subject: [PATCH 139/232] Adjust the type / mode in the Grandstream gxp21xx template. --- .../provision/grandstream/gxp21xx/{$mac}.xml | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml index 63be439319..a76deb0480 100644 --- a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml @@ -3590,18 +3590,27 @@ Outgoing calls. 0 - No, 1 - Yes. Default is 0 --> {$memory_key_value_18} - -{$start_type_id = 23000} -{$start_line_id = 23001} -{$start_label_id = 23002} -{$start_value_id = 23003} + +{$start_id = 23000} {foreach $keys as $row} {if $row.device_key_category == "expansion"} - {$key_id = $row.device_key_id - 1} - {$line_id = $start_line_id + ($key_id * 5)} - {$type_id = $start_type_id + ($key_id * 5)} - {$label_id = $start_label_id + ($key_id * 5)} - {$value_id = $start_value_id + ($key_id * 5)} +{$key_id = $row.device_key_id - 1} +{$type_id = $start_id + ($key_id * 5)} +{$line_id = ($start_id + 1) + ($key_id * 5)} +{$label_id = ($start_id + 2) ($key_id * 5)} +{$value_id = ($start_id + 3) + ($key_id * 5)} +{if $row.device_key_type == "speed dial"}0{/if} +{if $row.device_key_type == "blf"}1{/if} +{if $row.device_key_type == "presence watcher"}2{/if} +{if $row.device_key_type == "eventlist blf"}3{/if} +{if $row.device_key_type == "speed dial active"}4{/if} +{if $row.device_key_type == "dial dtmf"}5{/if} +{if $row.device_key_type == "voicemail"}6{/if} +{if $row.device_key_type == "call return"}7{/if} +{if $row.device_key_type == "transfer"}8{/if} +{if $row.device_key_type == "call park"}9{/if} +{if $row.device_key_type == "intercom"}10{/if} +{if $row.device_key_type == "ldap search"}11{/if} {$row.device_key_type} {$row.device_key_line} {$row.device_key_label} From ea16b7ea8cbd36fd3a05527b12e3499767e4c91d Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 30 Nov 2015 13:35:31 -0700 Subject: [PATCH 140/232] Add a missing plus in the template. --- resources/templates/provision/grandstream/gxp21xx/{$mac}.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml index a76deb0480..0255c67ee7 100644 --- a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml @@ -3597,7 +3597,7 @@ Outgoing calls. 0 - No, 1 - Yes. Default is 0 --> {$key_id = $row.device_key_id - 1} {$type_id = $start_id + ($key_id * 5)} {$line_id = ($start_id + 1) + ($key_id * 5)} -{$label_id = ($start_id + 2) ($key_id * 5)} +{$label_id = ($start_id + 2) + ($key_id * 5)} {$value_id = ($start_id + 3) + ($key_id * 5)} {if $row.device_key_type == "speed dial"}0{/if} {if $row.device_key_type == "blf"}1{/if} From d4303df93ab7643e53ee6d2c75fa8cbc5de704e0 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 30 Nov 2015 13:39:17 -0700 Subject: [PATCH 141/232] Adjust the spaces and remove the extra device key type. --- .../provision/grandstream/gxp21xx/{$mac}.xml | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml index 0255c67ee7..c8913f3c4e 100644 --- a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml @@ -3599,19 +3599,18 @@ Outgoing calls. 0 - No, 1 - Yes. Default is 0 --> {$line_id = ($start_id + 1) + ($key_id * 5)} {$label_id = ($start_id + 2) + ($key_id * 5)} {$value_id = ($start_id + 3) + ($key_id * 5)} -{if $row.device_key_type == "speed dial"}0{/if} -{if $row.device_key_type == "blf"}1{/if} -{if $row.device_key_type == "presence watcher"}2{/if} -{if $row.device_key_type == "eventlist blf"}3{/if} -{if $row.device_key_type == "speed dial active"}4{/if} -{if $row.device_key_type == "dial dtmf"}5{/if} -{if $row.device_key_type == "voicemail"}6{/if} -{if $row.device_key_type == "call return"}7{/if} -{if $row.device_key_type == "transfer"}8{/if} -{if $row.device_key_type == "call park"}9{/if} -{if $row.device_key_type == "intercom"}10{/if} -{if $row.device_key_type == "ldap search"}11{/if} - {$row.device_key_type} +{if $row.device_key_type == "speed dial"} 0{/if} +{if $row.device_key_type == "blf"} 1{/if} +{if $row.device_key_type == "presence watcher"} 2{/if} +{if $row.device_key_type == "eventlist blf"} 3{/if} +{if $row.device_key_type == "speed dial active"} 4{/if} +{if $row.device_key_type == "dial dtmf"} 5{/if} +{if $row.device_key_type == "voicemail"} 6{/if} +{if $row.device_key_type == "call return"} 7{/if} +{if $row.device_key_type == "transfer"} 8{/if} +{if $row.device_key_type == "call park"} 9{/if} +{if $row.device_key_type == "intercom"} 10{/if} +{if $row.device_key_type == "ldap search"} 11{/if} {$row.device_key_line} {$row.device_key_label} {$row.device_key_value} From e7ee8fb0f83c4021d2ef5334abb05f7fe630f3b5 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 30 Nov 2015 13:42:06 -0700 Subject: [PATCH 142/232] Add an additional line feed to the grandstream/gxp21xx template. --- resources/templates/provision/grandstream/gxp21xx/{$mac}.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml index c8913f3c4e..d534b1bd28 100644 --- a/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml +++ b/resources/templates/provision/grandstream/gxp21xx/{$mac}.xml @@ -3611,6 +3611,7 @@ Outgoing calls. 0 - No, 1 - Yes. Default is 0 --> {if $row.device_key_type == "call park"} 9{/if} {if $row.device_key_type == "intercom"} 10{/if} {if $row.device_key_type == "ldap search"} 11{/if} + {$row.device_key_line} {$row.device_key_label} {$row.device_key_value} From 45b8f00ae43469bb0c7cf4b68a2118af16e5cf5a Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 1 Dec 2015 09:53:18 +0000 Subject: [PATCH 143/232] pipe paths though realpath to normalize fixed extra } --- .../resources/classes/detect_switch.php | 21 +++++++++++-------- .../resources/classes/install_fusionpbx.php | 18 +++++++++++++++- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/core/install/resources/classes/detect_switch.php b/core/install/resources/classes/detect_switch.php index a0c26c4d3c..d07603f431 100644 --- a/core/install/resources/classes/detect_switch.php +++ b/core/install/resources/classes/detect_switch.php @@ -35,6 +35,7 @@ require_once "resources/classes/EventSocket.php"; // version information protected $_major; protected $_minor; + protected $_build; // dirs - detected by from the switch protected $_base_dir = ''; @@ -57,7 +58,8 @@ require_once "resources/classes/EventSocket.php"; public function major() { return $this->_major; } public function minor() { return $this->_minor; } - public function version() { return $this->_major.".".$this->_minor; } + public function build() { return $this->_build; } + public function version() { return $this->_major.".".$this->_minor.".".$this->_build; } public function base_dir() { return $this->_base_dir; } public function cache_dir() { return $this->_cache_dir; } public function certs_dir() { return $this->_certs_dir; } @@ -123,23 +125,24 @@ require_once "resources/classes/EventSocket.php"; throw new Exception('Failed to use event socket'); } $FS_Version = $this->event_socket_request('api version'); - preg_match("/FreeSWITCH Version (\d+)\.(\d(?:\.\d+)?)/", $FS_Version, $matches); + preg_match("/FreeSWITCH Version (\d+)\.(\d+)\.(\d(?:\.\d+)?)/", $FS_Version, $matches); $this->_major = $matches[1]; $this->_minor = $matches[2]; + $this->_build = $matches[3]; $FS_Vars = $this->event_socket_request('api global_getvar'); foreach (explode("\n",$FS_Vars) as $FS_Var){ preg_match("/(\w+_dir)=(.*)/", $FS_Var, $matches); if(count($matches) > 0 and property_exists($this, "_" . $matches[1])){ $field = "_" . $matches[1]; - $this->$field = $matches[2]; + $this->$field = realpath($matches[2]); } } - $this->_voicemail_vdir = join( DIRECTORY_SEPARATOR, array($this->_storage_dir, "voicemail")); - $this->_phrases_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "lang")); - $this->_extensions_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "directory")); - $this->_sip_profiles_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "sip_profiles")); - $this->_dialplan_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "dialplan")); - $this->_backup_vdir = sys_get_temp_dir(); + $this->_voicemail_vdir = realpath(join( DIRECTORY_SEPARATOR, array($this->_storage_dir, "voicemail"))); + $this->_phrases_vdir = realpath(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "lang"))); + $this->_extensions_vdir = realpath(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "directory"))); + $this->_sip_profiles_vdir = realpath(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "sip_profiles"))); + $this->_dialplan_vdir = realpath(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "dialplan"))); + $this->_backup_vdir = realpath(sys_get_temp_dir()); } protected function connect_event_socket(){ diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 2a680efd2d..4e59d5f2a9 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -213,6 +213,22 @@ include "root.php"; $this->$function(); global $db; $db = $this->dbh; + + //sqlite is natively supported under all known OS'es + if($this->db_type != 'sqlite'){ + if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){ + //non sqlite database support only uses ODBC under windows + $this->create_odbc_database_connection(); + }elseif($this->db_type != 'pgsql'){ + //switch supports postgresql natively + $this->create_odbc_database_connection(); + } + } + } + + protected function create_odbc_database_connection { + //needed for non native database support + } protected function create_database_sqlite() { @@ -367,7 +383,7 @@ include "root.php"; } elseif (strlen($this->db_port) == 0) { //leave out port if it is empty - $this->dbh = new PDO("mysql:host=$this->db_host;", $connect_username, $connect_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } + $this->dbh = new PDO("mysql:host=$this->db_host;", $connect_username, $connect_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); } else { $this->dbh = new PDO("mysql:host=$this->db_host;port=$this->db_port;", $connect_username, $connect_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); From aef4662f91c99b78956a9a8349017e9c7f53e101 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 1 Dec 2015 10:10:58 +0000 Subject: [PATCH 144/232] bug fixes for path normalization --- core/install/resources/classes/detect_switch.php | 16 ++++++++-------- .../resources/classes/install_fusionpbx.php | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/install/resources/classes/detect_switch.php b/core/install/resources/classes/detect_switch.php index d07603f431..974e2844dc 100644 --- a/core/install/resources/classes/detect_switch.php +++ b/core/install/resources/classes/detect_switch.php @@ -125,7 +125,7 @@ require_once "resources/classes/EventSocket.php"; throw new Exception('Failed to use event socket'); } $FS_Version = $this->event_socket_request('api version'); - preg_match("/FreeSWITCH Version (\d+)\.(\d+)\.(\d(?:\.\d+)?)/", $FS_Version, $matches); + preg_match("/FreeSWITCH Version (\d+)\.(\d+)\.(\d(?:\.\d+)?)$/", $FS_Version, $matches); $this->_major = $matches[1]; $this->_minor = $matches[2]; $this->_build = $matches[3]; @@ -134,15 +134,15 @@ require_once "resources/classes/EventSocket.php"; preg_match("/(\w+_dir)=(.*)/", $FS_Var, $matches); if(count($matches) > 0 and property_exists($this, "_" . $matches[1])){ $field = "_" . $matches[1]; - $this->$field = realpath($matches[2]); + $this->$field = normalize_path($matches[2]); } } - $this->_voicemail_vdir = realpath(join( DIRECTORY_SEPARATOR, array($this->_storage_dir, "voicemail"))); - $this->_phrases_vdir = realpath(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "lang"))); - $this->_extensions_vdir = realpath(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "directory"))); - $this->_sip_profiles_vdir = realpath(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "sip_profiles"))); - $this->_dialplan_vdir = realpath(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "dialplan"))); - $this->_backup_vdir = realpath(sys_get_temp_dir()); + $this->_voicemail_vdir = normalize_path(join( DIRECTORY_SEPARATOR, array($this->_storage_dir, "voicemail"))); + $this->_phrases_vdir = normalize_path(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "lang"))); + $this->_extensions_vdir = normalize_path(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "directory"))); + $this->_sip_profiles_vdir = normalize_path(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "sip_profiles"))); + $this->_dialplan_vdir = normalize_path(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "dialplan"))); + $this->_backup_vdir = normalize_path(sys_get_temp_dir()); } protected function connect_event_socket(){ diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 4e59d5f2a9..e27e66ac9f 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -226,7 +226,7 @@ include "root.php"; } } - protected function create_odbc_database_connection { + protected function create_odbc_database_connection() { //needed for non native database support } From d305dd2f793a4eb5b4fa54d910a1a7101d98e1d0 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 1 Dec 2015 10:11:39 +0000 Subject: [PATCH 145/232] added normalize_path --- resources/functions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/functions.php b/resources/functions.php index c1bd498810..dda3d3a2d6 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -600,6 +600,12 @@ } //echo realpath(sys_get_temp_dir()); + if ( !function_exists('normalize_path')) { + function normalize_path($path) { + return str_replace(DIRECTORY_SEPERATOR, '\\', $path); + } + } + if (!function_exists('username_exists')) { function username_exists($username) { global $db, $domain_uuid; From db1e53296ec90c1c23e798e55683ea60b9092aad Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 1 Dec 2015 10:23:24 +0000 Subject: [PATCH 146/232] db_create not create_db corrected version detection corrected constant --- .../resources/classes/detect_switch.php | 2 +- .../resources/classes/install_fusionpbx.php | 229 +++++++++--------- .../page_parts/install_config_database.php | 6 +- resources/functions.php | 2 +- 4 files changed, 119 insertions(+), 120 deletions(-) diff --git a/core/install/resources/classes/detect_switch.php b/core/install/resources/classes/detect_switch.php index 974e2844dc..b85ef4600b 100644 --- a/core/install/resources/classes/detect_switch.php +++ b/core/install/resources/classes/detect_switch.php @@ -125,7 +125,7 @@ require_once "resources/classes/EventSocket.php"; throw new Exception('Failed to use event socket'); } $FS_Version = $this->event_socket_request('api version'); - preg_match("/FreeSWITCH Version (\d+)\.(\d+)\.(\d(?:\.\d+)?)$/", $FS_Version, $matches); + preg_match("/FreeSWITCH Version (\d+)\.(\d+)\.(\d+(?:\.\d+)?)/", $FS_Version, $matches); $this->_major = $matches[1]; $this->_minor = $matches[2]; $this->_build = $matches[3]; diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index e27e66ac9f..64881301b5 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -232,140 +232,139 @@ include "root.php"; } protected function create_database_sqlite() { - //sqlite database will be created when the config.php is loaded and only if the database file does not exist + //sqlite database will be created when the config.php is loaded and only if the database file does not exist + try { + $this->dbh = new PDO('sqlite:'.$this->db_path.'/'.$this->db_name); //sqlite 3 + //$this->dbh = new PDO('sqlite::memory:'); //sqlite 3 + } + catch (PDOException $error) { + throw Exception("Failed to create database: " . $error->getMessage()); + } + + //add additional functions to SQLite - bool PDO::sqliteCreateFunction ( string function_name, callback callback [, int num_args] ) + if (!function_exists('php_now')) { + function php_now() { + if(function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) { + @date_default_timezone_set(@date_default_timezone_get()); + } + return date("Y-m-d H:i:s"); + } + } + $this->dbh->sqliteCreateFunction('now', 'php_now', 0); + + //add the database structure + require_once "resources/classes/schema.php"; + $schema = new schema; + $schema->db = $this->dbh; + $schema->db_type = $this->db_type; + $schema->sql(); + $schema->exec(); + + //get the contents of the sql file + if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/sqlite.sql')){ + $filename = "/usr/share/examples/fusionpbx/resources/install/sql/sqlite.sql"; + } + else { + $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/sqlite.sql'; + } + $file_contents = file_get_contents($filename); + unset($filename); + + //replace \r\n with \n then explode on \n + $file_contents = str_replace("\r\n", "\n", $file_contents); + + //loop line by line through all the lines of sql code + $this->dbh->beginTransaction(); + $string_array = explode("\n", $file_contents); + $x = 0; + foreach($string_array as $sql) { try { - $this->dbh = new PDO('sqlite:'.$this->db_path.'/'.$this->db_name); //sqlite 3 - //$this->dbh = new PDO('sqlite::memory:'); //sqlite 3 + $this->dbh->query($sql); } catch (PDOException $error) { - throw Exception("Failed to create database: " . $error->getMessage()); + throw new Exception("error creating database: " . $error->getMessage() . "\n" . $sql ); } + $x++; + } + unset ($file_contents, $sql); + $this->dbh->commit(); - //add additional functions to SQLite - bool PDO::sqliteCreateFunction ( string function_name, callback callback [, int num_args] ) - if (!function_exists('php_now')) { - function php_now() { - if(function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) { - @date_default_timezone_set(@date_default_timezone_get()); - } - return date("Y-m-d H:i:s"); + //set the file permissions + chmod($this->db_path.'/'.$this->db_name, 0777); + } + + protected function create_database_pgsql() { + if ($this->db_create_option == 'user') { + //Attempt to create new PG role and database + try { + if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } + if (strlen($this->db_host) > 0) { + $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1"); + } else { + $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1"); } + } catch (PDOException $error) { + throw new Exception("error connecting to database in order to create: " . $error->getMessage()); } - $this->dbh->sqliteCreateFunction('now', 'php_now', 0); - //add the database structure - require_once "resources/classes/schema.php"; - $schema = new schema; - $schema->db = $this->dbh; - $schema->db_type = $this->db_type; - $schema->sql(); - $schema->exec(); + //create the database, user, grant perms + $this->dbh->exec("CREATE DATABASE {$this->db_name}"); + $this->dbh->exec("CREATE USER {$this->db_username} WITH PASSWORD '{$this->db_password}'"); + $this->dbh->exec("GRANT ALL ON {$this->db_name} TO {$this->db_username}"); - //get the contents of the sql file - if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/sqlite.sql')){ - $filename = "/usr/share/examples/fusionpbx/resources/install/sql/sqlite.sql"; + //close database connection_aborted + $this->dbh = null; + } + + //open database connection with $this->db_name + try { + if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } + if (strlen($this->db_host) > 0) { + $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} dbname={$this->db_name} user={$this->db_username} password={$this->db_password}"); + } else { + $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_username} password={$this->db_password} dbname={$this->db_name}"); } - else { - $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/sqlite.sql'; - } - $file_contents = file_get_contents($filename); - unset($filename); + } + catch (PDOException $error) { + throw new Exception("error connecting to database: " . $error->getMessage()); + } - //replace \r\n with \n then explode on \n - $file_contents = str_replace("\r\n", "\n", $file_contents); + //add the database structure + require_once "resources/classes/schema.php"; + $schema = new schema; + $schema->db = $this->dbh; + $schema->db_type = $this->db_type; + $schema->sql(); + $schema->exec(); - //loop line by line through all the lines of sql code - $this->dbh->beginTransaction(); - $string_array = explode("\n", $file_contents); - $x = 0; - foreach($string_array as $sql) { + //get the contents of the sql file + if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql')){ + $filename = "/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql"; + } + else { + $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql'; + } + $file_contents = file_get_contents($filename); + + //replace \r\n with \n then explode on \n + $file_contents = str_replace("\r\n", "\n", $file_contents); + + //loop line by line through all the lines of sql code + $string_array = explode("\n", $file_contents); + $x = 0; + foreach($string_array as $sql) { + if (strlen($sql) > 3) { try { $this->dbh->query($sql); } catch (PDOException $error) { - throw new Exception("error creating database: " . $error->getMessage() . "\n" . $sql ); + throw new Exception("error creating database: " . $error->getMessage() . "\n" . $sql ); } - $x++; } - unset ($file_contents, $sql); - $this->dbh->commit(); - - //set the file permissions - chmod($this->db_path.'/'.$this->db_name, 0777); - } - - protected function create_database_pgsql() { - - if ($this->db_create_option == 'user') { - //Attempt to create new PG role and database - try { - if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } - if (strlen($this->db_host) > 0) { - $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1"); - } else { - $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1"); - } - } catch (PDOException $error) { - throw new Exception("error connecting to database in order to create: " . $error->getMessage()); - } - - //create the database, user, grant perms - $this->dbh->exec("CREATE DATABASE {$this->db_name}"); - $this->dbh->exec("CREATE USER {$this->db_username} WITH PASSWORD '{$this->db_password}'"); - $this->dbh->exec("GRANT ALL ON {$this->db_name} TO {$this->db_username}"); - - //close database connection_aborted - $this->dbh = null; - } - - //open database connection with $this->db_name - try { - if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } - if (strlen($this->db_host) > 0) { - $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} dbname={$this->db_name} user={$this->db_username} password={$this->db_password}"); - } else { - $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_username} password={$this->db_password} dbname={$this->db_name}"); - } - } - catch (PDOException $error) { - throw new Exception("error connecting to database: " . $error->getMessage()); - } - - //add the database structure - require_once "resources/classes/schema.php"; - $schema = new schema; - $schema->db = $this->dbh; - $schema->db_type = $this->db_type; - $schema->sql(); - $schema->exec(); - - //get the contents of the sql file - if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql')){ - $filename = "/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql"; - } - else { - $filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql'; - } - $file_contents = file_get_contents($filename); - - //replace \r\n with \n then explode on \n - $file_contents = str_replace("\r\n", "\n", $file_contents); - - //loop line by line through all the lines of sql code - $string_array = explode("\n", $file_contents); - $x = 0; - foreach($string_array as $sql) { - if (strlen($sql) > 3) { - try { - $this->dbh->query($sql); - } - catch (PDOException $error) { - throw new Exception("error creating database: " . $error->getMessage() . "\n" . $sql ); - } - } - $x++; - } - unset ($file_contents, $sql); + $x++; } + unset ($file_contents, $sql); + } protected function create_database_mysql() { //database connection diff --git a/core/install/resources/page_parts/install_config_database.php b/core/install/resources/page_parts/install_config_database.php index f5198fc5a3..0d41078d9d 100644 --- a/core/install/resources/page_parts/install_config_database.php +++ b/core/install/resources/page_parts/install_config_database.php @@ -242,13 +242,13 @@ echo " Create Database Options\n"; echo "\n"; echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; echo "
    \n"; diff --git a/resources/functions.php b/resources/functions.php index dda3d3a2d6..ac3b793f2b 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -602,7 +602,7 @@ if ( !function_exists('normalize_path')) { function normalize_path($path) { - return str_replace(DIRECTORY_SEPERATOR, '\\', $path); + return str_replace(DIRECTORY_SEPARATOR, '\\', $path); } } From 4ea9c8abc3963d7e2cce1c8254dfc520ccd95c6c Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 1 Dec 2015 10:33:51 +0000 Subject: [PATCH 147/232] simplified the create database options --- .../resources/classes/install_fusionpbx.php | 16 ++++++++-------- .../page_parts/install_config_database.php | 17 ++++++----------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 64881301b5..fc1fb850f4 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -54,7 +54,8 @@ include "root.php"; public $db_name; public $db_username; public $db_password; - public $db_create_option = 'none'; + public $db_create; + public $db_create_reuse_auth; public $db_create_username; public $db_create_password; @@ -203,11 +204,10 @@ include "root.php"; protected function create_database() { require $this->config_php; $this->write_progress("Creating database as " . $this->db_type); - if($this->create_db_option == 'same') + if($this->db_create_reuse_auth) { - $this->create_db_option = 'user'; - $this->create_db_username = $this->db_username; - $this->create_db_password = $this->db_username_password; + $this->db_create_username = $this->db_username; + $this->db_create_password = $this->db_username_password; } $function = "create_database_" . $this->db_type; $this->$function(); @@ -294,7 +294,7 @@ include "root.php"; } protected function create_database_pgsql() { - if ($this->db_create_option == 'user') { + if ($this->db_create) { //Attempt to create new PG role and database try { if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } @@ -371,7 +371,7 @@ include "root.php"; $connect_string = ''; $connect_username = $this->db_username; $connect_password = $this->db_password; - if ($this->db_create_option == 'user') { + if ($this->db_create) { $connect_username = $this->db_create_username; $connect_password = $this->db_create_password; } @@ -395,7 +395,7 @@ include "root.php"; } //create the table, user and set the permissions only if the db_create_username was provided - if ($this->db_create_option == 'user') { + if ($this->db_create) { //select the mysql database try { $this->dbh->query("USE mysql;"); diff --git a/core/install/resources/page_parts/install_config_database.php b/core/install/resources/page_parts/install_config_database.php index 0d41078d9d..e091d4cfbe 100644 --- a/core/install/resources/page_parts/install_config_database.php +++ b/core/install/resources/page_parts/install_config_database.php @@ -242,17 +242,12 @@ echo " Create Database Options\n"; echo "\n"; echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
    \n"; - echo "Choose whether to create the database\n"; + echo " \n"; + echo " \n"; echo "\n"; echo "\n"; From 2998a7cf7e2aa29f71aa2585585eeb1a4462c72c Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 1 Dec 2015 10:56:18 +0000 Subject: [PATCH 148/232] removed reuse stuff, it was confusing fixed mysql databse create to make more logical sense inside code removed many if($debug) and replaced with throws --- .../resources/classes/install_fusionpbx.php | 82 ++++++++----------- .../page_parts/install_config_database.php | 4 +- 2 files changed, 36 insertions(+), 50 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index fc1fb850f4..1253f3da60 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -55,7 +55,6 @@ include "root.php"; public $db_username; public $db_password; public $db_create; - public $db_create_reuse_auth; public $db_create_username; public $db_create_password; @@ -204,10 +203,10 @@ include "root.php"; protected function create_database() { require $this->config_php; $this->write_progress("Creating database as " . $this->db_type); - if($this->db_create_reuse_auth) + if($this->db_create and strlen($this->db_create_username) > 0) { $this->db_create_username = $this->db_username; - $this->db_create_password = $this->db_username_password; + $this->db_create_password = $this->db_password; } $function = "create_database_" . $this->db_type; $this->$function(); @@ -368,42 +367,35 @@ include "root.php"; protected function create_database_mysql() { //database connection - $connect_string = ''; - $connect_username = $this->db_username; - $connect_password = $this->db_password; - if ($this->db_create) { - $connect_username = $this->db_create_username; - $connect_password = $this->db_create_password; + $connect_string; + if (strlen($this->db_host) == 0 && strlen($this->db_port) == 0) { + //if both host and port are empty use the unix socket + $connect_string = "mysql:host=$this->db_host;unix_socket=/var/run/mysqld/mysqld.sock;"; } - try { - if (strlen($this->db_host) == 0 && strlen($this->db_port) == 0) { - //if both host and port are empty use the unix socket - $this->dbh = new PDO("mysql:host=$this->db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $connect_username, $connect_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - elseif (strlen($this->db_port) == 0) { - //leave out port if it is empty - $this->dbh = new PDO("mysql:host=$this->db_host;", $connect_username, $connect_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - else { - $this->dbh = new PDO("mysql:host=$this->db_host;port=$this->db_port;", $connect_username, $connect_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); - } - $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); + elseif (strlen($this->db_port) == 0) { + //leave out port if it is empty + $connect_string = "mysql:host=$this->db_host;"; } - catch (PDOException $error) { - throw new Exception("error connecting to database: " . $error->getMessage() . "\n" . $sql ); + else { + $connect_string = "mysql:host=$this->db_host;port=$this->db_port;"; } //create the table, user and set the permissions only if the db_create_username was provided if ($this->db_create) { + try { + $this->dbh = new PDO($connect_string, $this->db_create_username, db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); + } + catch (PDOException $error) { + throw new Exception("error connecting to database for ccreate: " . $error->getMessage() . "\n" . $sql ); + } //select the mysql database try { $this->dbh->query("USE mysql;"); } catch (PDOException $error) { - if ($this->debug) { - throw new Exception("error connecting to database in order to create: " . $error->getMessage()); - } + throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql ); } //create user and set the permissions @@ -412,9 +404,7 @@ include "root.php"; $this->dbh->query($tmp_sql); } catch (PDOException $error) { - if ($this->debug) { - print "error: " . $error->getMessage() . "
    "; - } + throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql ); } //set account to unlimited use @@ -438,9 +428,7 @@ include "root.php"; } } catch (PDOException $error) { - if ($this->debug) { - print "error: " . $error->getMessage() . "
    "; - } + throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql ); } //create the database and set the create user with permissions @@ -449,9 +437,7 @@ include "root.php"; $this->dbh->query($tmp_sql); } catch (PDOException $error) { - if ($this->debug) { - print "error: " . $error->getMessage() . "
    "; - } + throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql ); } //set user permissions @@ -459,9 +445,7 @@ include "root.php"; $this->dbh->query("GRANT ALL PRIVILEGES ON ".$this->db_name.".* TO '".$this->db_username."'@'%'; "); } catch (PDOException $error) { - if ($this->debug) { - print "error: " . $error->getMessage() . "
    "; - } + throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql ); } //make the changes active @@ -470,21 +454,25 @@ include "root.php"; $this->dbh->query($tmp_sql); } catch (PDOException $error) { - if ($this->debug) { - print "error: " . $error->getMessage() . "
    "; - } + throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql ); } - + $this->dbh = null; } //if (strlen($this->db_create_username) > 0) //select the database + try { + $this->dbh = new PDO($connect_string, $this->db_username, db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); + } + catch (PDOException $error) { + throw new Exception("error connecting to database: " . $error->getMessage() . "\n" . $sql ); + } try { $this->dbh->query("USE ".$this->db_name.";"); } catch (PDOException $error) { - if ($this->debug) { - print "error: " . $error->getMessage() . "
    "; - } + throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql ); } //add the database structure diff --git a/core/install/resources/page_parts/install_config_database.php b/core/install/resources/page_parts/install_config_database.php index e091d4cfbe..cf782d498b 100644 --- a/core/install/resources/page_parts/install_config_database.php +++ b/core/install/resources/page_parts/install_config_database.php @@ -246,8 +246,6 @@ if($db_create=='1') { echo " checked='checked'"; } echo "/>Create the database\n"; echo " \n"; echo "\n"; echo "\n"; @@ -259,7 +257,7 @@ echo "
    \n"; echo " Optional, this username is used to create the database, a database user and set the permissions. \n"; echo " By default this username is 'pgsql' however it can be any account with permission to add a database, user, and grant permissions. \n"; - echo " Leave blank if the user and empty database already exist and you do not want them created. \n"; + echo " Leave blank to use the details above. \n"; echo "\n"; echo "\n"; From 8df22f0030c53b669b03edab8265228024353b28 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 1 Dec 2015 11:02:32 +0000 Subject: [PATCH 149/232] removed redundant radio override when length is 0, not visa versa --- core/install/resources/classes/install_fusionpbx.php | 2 +- core/install/resources/page_parts/install_config_database.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 1253f3da60..cc15ecdf8a 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -203,7 +203,7 @@ include "root.php"; protected function create_database() { require $this->config_php; $this->write_progress("Creating database as " . $this->db_type); - if($this->db_create and strlen($this->db_create_username) > 0) + if($this->db_create and strlen($this->db_create_username) == 0) { $this->db_create_username = $this->db_username; $this->db_create_password = $this->db_password; diff --git a/core/install/resources/page_parts/install_config_database.php b/core/install/resources/page_parts/install_config_database.php index cf782d498b..054059e742 100644 --- a/core/install/resources/page_parts/install_config_database.php +++ b/core/install/resources/page_parts/install_config_database.php @@ -245,7 +245,6 @@ echo " \n"; - echo "
    \n"; echo "

    Failed to install
    " . $e->getMessage() . "

    \n"; try { require_once "resources/classes/install_fusionpbx.php"; - $system = new install_fusionpbx($domain_name, $domain_uuid, $switch_detect); + $system = new install_fusionpbx($domain_name, $domain_uuid, $detect_switch); $system->remove_config(); }catch(Exception $e){ echo "

    Failed to remove config: " . $e->getMessage() . "

    \n"; diff --git a/core/install/resources/classes/detect_switch.php b/core/install/resources/classes/detect_switch.php index b85ef4600b..dc46069d7b 100644 --- a/core/install/resources/classes/detect_switch.php +++ b/core/install/resources/classes/detect_switch.php @@ -31,11 +31,19 @@ require_once "resources/classes/EventSocket.php"; class detect_switch { // cached data - protected $_folders; + protected $_dirs; + protected $_vdirs; + public function get_dirs() { return $this->_dirs; } + public function get_vdirs() { return $this->_vdirs; } + // version information protected $_major; protected $_minor; protected $_build; + public function major() { return $this->_major; } + public function minor() { return $this->_minor; } + public function build() { return $this->_build; } + public function version() { return $this->_major.".".$this->_minor.".".$this->_build; } // dirs - detected by from the switch protected $_base_dir = ''; @@ -55,30 +63,23 @@ require_once "resources/classes/EventSocket.php"; protected $_sounds_dir = ''; protected $_storage_dir = ''; protected $_temp_dir = ''; - - public function major() { return $this->_major; } - public function minor() { return $this->_minor; } - public function build() { return $this->_build; } - public function version() { return $this->_major.".".$this->_minor.".".$this->_build; } - public function base_dir() { return $this->_base_dir; } - public function cache_dir() { return $this->_cache_dir; } - public function certs_dir() { return $this->_certs_dir; } - public function conf_dir() { return $this->_conf_dir; } - public function db_dir() { return $this->_db_dir; } - public function external_ssl_dir() { return $this->_external_ssl_dir; } - public function grammar_dir() { return $this->_grammar_dir; } - public function htdocs_dir() { return $this->_htdocs_dir; } - public function internal_ssl_dir() { return $this->_internal_ssl_dir; } - public function log_dir() { return $this->_log_dir; } - public function mod_dir() { return $this->_mod_dir; } - public function recordings_dir() { return $this->_recordings_dir; } - public function run_dir() { return $this->_run_dir; } - public function script_dir() { return $this->_script_dir; } - public function sounds_dir() { return $this->_sounds_dir; } - public function storage_dir() { return $this->_storage_dir; } - public function temp_dir() { return $this->_temp_dir; } - public function get_dirs() { return $this->_dirs; } - public function get_vdirs() { return $this->_vdirs; } + public function base_dir() { return $this->_base_dir; } + public function cache_dir() { return $this->_cache_dir; } + public function certs_dir() { return $this->_certs_dir; } + public function conf_dir() { return $this->_conf_dir; } + public function db_dir() { return $this->_db_dir; } + public function external_ssl_dir() { return $this->_external_ssl_dir; } + public function grammar_dir() { return $this->_grammar_dir; } + public function htdocs_dir() { return $this->_htdocs_dir; } + public function internal_ssl_dir() { return $this->_internal_ssl_dir; } + public function log_dir() { return $this->_log_dir; } + public function mod_dir() { return $this->_mod_dir; } + public function recordings_dir() { return $this->_recordings_dir; } + public function run_dir() { return $this->_run_dir; } + public function script_dir() { return $this->_script_dir; } + public function sounds_dir() { return $this->_sounds_dir; } + public function storage_dir() { return $this->_storage_dir; } + public function temp_dir() { return $this->_temp_dir; } // virtual dirs - assumed based on the detected dirs protected $_voicemail_vdir = ''; @@ -87,13 +88,12 @@ require_once "resources/classes/EventSocket.php"; protected $_sip_profiles_vdir = ''; protected $_dialplan_vdir = ''; protected $_backup_vdir = ''; - - public function voicemail_vdir() { return $this->_voicemail_vdir; } - public function phrases_vdir() { return $this->_phrases_vdir; } - public function extensions_vdir() { return $this->_extensions_vdir; } - public function sip_profiles_vdir() { return $this->_sip_profiles_vdir; } - public function dialplan_vdir() { return $this->_dialplan_vdir; } - public function backup_vdir() { return $this->_backup_vdir; } + public function voicemail_vdir() { return $this->_voicemail_vdir; } + public function phrases_vdir() { return $this->_phrases_vdir; } + public function extensions_vdir() { return $this->_extensions_vdir; } + public function sip_profiles_vdir() { return $this->_sip_profiles_vdir; } + public function dialplan_vdir() { return $this->_dialplan_vdir; } + public function backup_vdir() { return $this->_backup_vdir; } // event socket public $event_host = 'localhost'; @@ -102,6 +102,7 @@ require_once "resources/classes/EventSocket.php"; protected $event_socket; public function __construct($event_host, $event_port, $event_password) { + //do not take these settings from session as they be detecting a new switch if($event_host){ $this->event_host = $event_host; } if($event_port){ $this->event_port = $event_port; } if($event_password){ $this->event_password = $event_password; } @@ -137,12 +138,12 @@ require_once "resources/classes/EventSocket.php"; $this->$field = normalize_path($matches[2]); } } - $this->_voicemail_vdir = normalize_path(join( DIRECTORY_SEPARATOR, array($this->_storage_dir, "voicemail"))); - $this->_phrases_vdir = normalize_path(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "lang"))); - $this->_extensions_vdir = normalize_path(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "directory"))); - $this->_sip_profiles_vdir = normalize_path(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "sip_profiles"))); - $this->_dialplan_vdir = normalize_path(join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "dialplan"))); - $this->_backup_vdir = normalize_path(sys_get_temp_dir()); + $this->_voicemail_vdir = normalize_path($this->_storage_dir . DIRECTORY_SEPARATOR . "voicemail"); + $this->_phrases_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "lang"); + $this->_extensions_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "directory"); + $this->_sip_profiles_vdir = normalize_path(($this->_conf_dir . DIRECTORY_SEPARATOR . "sip_profiles"); + $this->_dialplan_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "dialplan"); + $this->_backup_vdir = normalize_path(sys_get_temp_dir()); } protected function connect_event_socket(){ diff --git a/core/install/resources/classes/global_settings.php b/core/install/resources/classes/global_settings.php new file mode 100644 index 0000000000..24f4e89ecc --- /dev/null +++ b/core/install/resources/classes/global_settings.php @@ -0,0 +1,192 @@ + + Copyright (C) 2010-2015 + All Rights Reserved. + + Contributor(s): + Matthew Vale + +*/ +require_once "root.php"; + +//define the install class + class global_settings { + + // cached data + protected $_dirs; + protected $_vdirs; + public function get_switch_dirs() { return $this->_switch_dirs; } + public function get_switch_vdirs() { return $this->_switch_vdirs; } + + // dirs - detected by from the switch + protected $_switch_base_dir = ''; + protected $_switch_cache_dir = ''; + protected $_switch_certs_dir = ''; + protected $_switch_conf_dir = ''; + protected $_switch_db_dir = ''; + protected $_switch_external_ssl_dir = ''; + protected $_switch_grammar_dir = ''; + protected $_switch_htdocs_dir = ''; + protected $_switch_internal_ssl_dir = ''; + protected $_switch_log_dir = ''; + protected $_switch_mod_dir = ''; + protected $_switch_recordings_dir = ''; + protected $_switch_run_dir = ''; + protected $_switch_script_dir = ''; + protected $_switch_sounds_dir = ''; + protected $_switch_storage_dir = ''; + protected $_switch_temp_dir = ''; + public function switch_base_dir() { return $this->_switch_base_dir; } + public function switch_cache_dir() { return $this->_switch_cache_dir; } + public function switch_certs_dir() { return $this->_switch_certs_dir; } + public function switch_conf_dir() { return $this->_switch_conf_dir; } + public function switch_db_dir() { return $this->_switch_db_dir; } + public function switch_external_ssl_dir() { return $this->_switch_external_ssl_dir; } + public function switch_grammar_dir() { return $this->_switch_grammar_dir; } + public function switch_htdocs_dir() { return $this->_switch_htdocs_dir; } + public function switch_internal_ssl_dir() { return $this->_switch_internal_ssl_dir; } + public function switch_log_dir() { return $this->_switch_log_dir; } + public function switch_mod_dir() { return $this->_switch_mod_dir; } + public function switch_recordings_dir() { return $this->_switch_recordings_dir; } + public function switch_run_dir() { return $this->_switch_run_dir; } + public function switch_script_dir() { return $this->_switch_script_dir; } + public function switch_sounds_dir() { return $this->_switch_sounds_dir; } + public function switch_storage_dir() { return $this->_switch_storage_dir; } + public function switch_temp_dir() { return $this->_switch_temp_dir; } + + // virtual dirs - assumed based on the detected dirs + protected $_switch_voicemail_vdir = ''; + protected $_switch_phrases_vdir = ''; + protected $_switch_extensions_vdir = ''; + protected $_switch_sip_profiles_vdir = ''; + protected $_switch_dialplan_vdir = ''; + protected $_switch_backup_vdir = ''; + public function switch_voicemail_vdir() { return $this->_switch_voicemail_vdir; } + public function switch_phrases_vdir() { return $this->_switch_phrases_vdir; } + public function switch_extensions_vdir() { return $this->_switch_extensions_vdir; } + public function switch_sip_profiles_vdir() { return $this->_switch_sip_profiles_vdir; } + public function switch_dialplan_vdir() { return $this->_switch_dialplan_vdir; } + public function switch_backup_vdir() { return $this->_switch_backup_vdir; } + + // event socket + protected $_switch_event_host; + protected $_switch_event_port; + protected $_switch_event_password; + public function switch_event_host() { return $this->_switch_event_host; } + public function switch_event_port() { return $this->_switch_event_port; } + public function switch_event_password() { return $this->_switch_event_password; } + + // database information + protected $_db_type; + protected $_db_path; + protected $_db_host; + protected $_db_port; + protected $_db_name; + protected $_db_username; + protected $_db_password; + protected $_db_create; + protected $_db_create_username; + protected $_db_create_password; + public function db_type() {return $this->_db_type; } + public function db_path() {return $this->_db_path; } + public function db_host() {return $this->_db_host; } + public function db_port() {return $this->_db_port; } + public function db_name() {return $this->_db_name; } + public function db_username() {return $this->_db_username; } + public function db_password() {return $this->_db_password; } + public function db_create() {return $this->_db_create; } + public function db_create_username() {return $this->_db_create_username; } + public function db_create_password() {return $this->_db_create_password; } + + //misc information + protected $_domain_count; + public function domain_count() {return $this->_domain_count; } + + public function __construct($detect_switch, $domain_name, $domain_uuid) { + $this->_switch_dirs = preg_grep ('/^switch_.*_dir$/', get_class_methods('global_settings') ); + sort( $this->_switch_dirs ); + $this->_switch_vdirs = preg_grep ('/^switch_.*_vdir$/', get_class_methods('global_settings') ); + sort( $this->_switch_vdirs ); + + if($detect_switch == null){ + //take settings from session + foreach ($this->_switch_dirs as $dir){ + $session_var; + preg_match( '^switch_.*_dir$', $dir, $session_var); + $this->$dir = $_SESSION['switch'][$session_var[0]]['dir']; + } + foreach ($this->_switch_vdirs as $vdir){ + $session_var; + preg_match( '^switch_.*_vdir$', $vdir, $session_var); + $this->$vdir = $_SESSION['switch'][$session_var[0]]['dir']; + } + $this->switch_event_host = $_SESSION['event_socket_ip_address']; + $this->switch_event_port = $_SESSION['event_socket_port']; + $this->switch_event_password = $_SESSION['event_socket_password']; + + // domain info + $this->domain_name = $_SESSION['domain_name']; + $this->domain_uuid = $_SESSION['domain_uuid']; + + // collect misc info + $this->domain_count = count($_SESSION["domains"]); + + // collect db_info + global $db_type, $db_path, $db_host, $db_port, $db_name, $db_username, $db_password; + $this->_db_type = $db_type; + $this->_db_path = $db_path; + $this->_db_host = $db_host; + $this->_db_port = $db_port; + $this->_db_name = $db_name; + $this->_db_username = $db_username; + $this->_db_password = $db_password; + + }elseif(!is_a($detect_switch, 'detect_switch')){ + throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)'); + + }else{ + //copy from detect_switch + foreach($detect_switch->switch_dirs() as $dir){ + $t_dir = "_$dir"; + $this->$t_dir = $detect_switch->$dir(); + } + foreach($detect_switch->switch_vdirs() as $vdir){ + $t_vdir = "_$vdir"; + $this->$t_vdir = $detect_switch->$vdir(); + } + + //copy from _POST + foreach($_POST as $key=>$value){ + if(substr($key,0,3) == "db_"){ + $this->$key = $value; + } + } + + // domain info + if($domain_uuid == null){ $domain_uuid = uuid(); } + $this->domain_name = $domain_name; + $this->domain_uuid = $domain_uuid; + + //collect misc info + $this->_domain_count = 1; //assumed to be one + } + } + } +?> \ No newline at end of file diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index f6047725de..17bfa24f0c 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -29,9 +29,7 @@ include "root.php"; //define the install class class install_fusionpbx { - protected $_domain_uuid; - protected $domain_name; - protected $detect_switch; + protected $global_settings; protected $config_php; protected $menu_uuid = 'b4750c3f-2a86-b00d-b7d0-345c14eca286'; protected $dbh; @@ -47,25 +45,11 @@ include "root.php"; public $default_country = 'US'; public $template_name = 'enhanced'; - public $db_type; - public $db_path; - public $db_host; - public $db_port; - public $db_name; - public $db_username; - public $db_password; - public $db_create; - public $db_create_username; - public $db_create_password; - - function __construct($domain_name, $domain_uuid, $detect_switch) { - if(!is_a($detect_switch, 'detect_switch')){ - throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)'); + function __construct($global_settings) { + if(!is_a($global_settings, 'global_settings')){ + throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)'); } - if($domain_uuid == null){ $domain_uuid = uuid(); } - $this->_domain_uuid = $domain_uuid; - $this->domain_name = $domain_name; - $this->detect_switch = $detect_switch; + $this->global_settings = $global_settings; if (is_dir("/etc/fusionpbx")){ $this->config_php = "/etc/fusionpbx/config.php"; } elseif (is_dir("/usr/local/etc/fusionpbx")){ @@ -138,26 +122,26 @@ include "root.php"; $tmp_config .= "//-----------------------------------------------------\n"; $tmp_config .= "\n"; $tmp_config .= " //set the database type\n"; - $tmp_config .= " \$db_type = '".$this->db_type."'; //sqlite, mysql, pgsql, others with a manually created PDO connection\n"; + $tmp_config .= " \$db_type = '".$this->global_settings->db_type()."'; //sqlite, mysql, pgsql, others with a manually created PDO connection\n"; $tmp_config .= "\n"; - if ($this->db_type == "sqlite") { + if ($this->global_settings->db_type() == "sqlite") { $tmp_config .= " //sqlite: the db_name and db_path are automatically assigned however the values can be overidden by setting the values here.\n"; - $tmp_config .= " \$db_name = '".$this->db_name."'; //host name/ip address + '.db' is the default database filename\n"; - $tmp_config .= " \$db_path = '".$this->db_path."'; //the path is determined by a php variable\n"; + $tmp_config .= " \$db_name = '".$this->global_settings->db_name()."'; //host name/ip address + '.db' is the default database filename\n"; + $tmp_config .= " \$db_path = '".$this->global_settings->db_path()."'; //the path is determined by a php variable\n"; } $tmp_config .= "\n"; $tmp_config .= " //mysql: database connection information\n"; - if ($this->db_type == "mysql") { - if ($this->db_host == "localhost") { + if ($this->global_settings->db_type() == "mysql") { + if ($this->global_settings->db_host() == "localhost") { //if localhost is used it defaults to a Unix Socket which doesn't seem to work. //replace localhost with 127.0.0.1 so that it will connect using TCP - $this->db_host = "127.0.0.1"; + $this->global_settings->db_host() = "127.0.0.1"; } - $tmp_config .= " \$db_host = '".$this->db_host."';\n"; - $tmp_config .= " \$db_port = '".$this->db_port."';\n"; - $tmp_config .= " \$db_name = '".$this->db_name."';\n"; - $tmp_config .= " \$db_username = '".$this->db_username."';\n"; - $tmp_config .= " \$db_password = '".$this->db_password."';\n"; + $tmp_config .= " \$db_host = '".$this->global_settings->db_host()."';\n"; + $tmp_config .= " \$db_port = '".$this->global_settings->db_port()."';\n"; + $tmp_config .= " \$db_name = '".$this->global_settings->db_name()."';\n"; + $tmp_config .= " \$db_username = '".$this->global_settings->db_username()."';\n"; + $tmp_config .= " \$db_password = '".$this->global_settings->db_password()."';\n"; } else { $tmp_config .= " //\$db_host = '';\n"; @@ -168,19 +152,19 @@ include "root.php"; } $tmp_config .= "\n"; $tmp_config .= " //pgsql: database connection information\n"; - if ($this->db_type == "pgsql") { - $tmp_config .= " \$db_host = '".$this->db_host."'; //set the host only if the database is not local\n"; - $tmp_config .= " \$db_port = '".$this->db_port."';\n"; - $tmp_config .= " \$db_name = '".$this->db_name."';\n"; - $tmp_config .= " \$db_username = '".$this->db_username."';\n"; - $tmp_config .= " \$db_password = '".$this->db_password."';\n"; + if ($this->global_settings->db_type() == "pgsql") { + $tmp_config .= " \$db_host = '".$this->global_settings->db_host()."'; //set the host only if the database is not local\n"; + $tmp_config .= " \$db_port = '".$this->global_settings->db_port()."';\n"; + $tmp_config .= " \$db_name = '".$this->global_settings->db_name()."';\n"; + $tmp_config .= " \$db_username = '".$this->global_settings->db_username()."';\n"; + $tmp_config .= " \$db_password = '".$this->global_settings->db_password()."';\n"; } else { - $tmp_config .= " //\$db_host = '".$this->db_host."'; //set the host only if the database is not local\n"; - $tmp_config .= " //\$db_port = '".$this->db_port."';\n"; - $tmp_config .= " //\$db_name = '".$this->db_name."';\n"; - $tmp_config .= " //\$db_username = '".$this->db_username."';\n"; - $tmp_config .= " //\$db_password = '".$this->db_password."';\n"; + $tmp_config .= " //\$db_host = '".$this->global_settings->db_host()."'; //set the host only if the database is not local\n"; + $tmp_config .= " //\$db_port = '".$this->global_settings->db_port()."';\n"; + $tmp_config .= " //\$db_name = '".$this->global_settings->db_name()."';\n"; + $tmp_config .= " //\$db_username = '".$this->global_settings->db_username()."';\n"; + $tmp_config .= " //\$db_password = '".$this->global_settings->db_password()."';\n"; } $tmp_config .= "\n"; $tmp_config .= " //show errors\n"; @@ -205,23 +189,24 @@ include "root.php"; protected function create_database() { require $this->config_php; - $this->write_progress("\tUsing database as type " . $this->db_type); - if($this->db_create and strlen($this->db_create_username) == 0) - { - $this->db_create_username = $this->db_username; - $this->db_create_password = $this->db_password; - } - $function = "create_database_" . $this->db_type; - $this->$function(); global $db; $db = $this->dbh; + $this->write_progress("\tUsing database as type " . $this->global_settings->db_type()); + if($this->global_settings->db_create() and strlen($this->global_settings->db_create_username()) == 0) + { + $this->global_settings->db_create_username() = $this->global_settings->db_username(); + $this->global_settings->db_create_password() = $this->global_settings->db_password(); + } + $function = "create_database_" . $this->global_settings->db_type(); + $this->$function(); + //sqlite is natively supported under all known OS'es - if($this->db_type != 'sqlite'){ + if($this->global_settings->db_type() != 'sqlite'){ if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){ //non sqlite database support only uses ODBC under windows $this->create_odbc_database_connection(); - }elseif($this->db_type != 'pgsql'){ + }elseif($this->global_settings->db_type() != 'pgsql'){ //switch supports postgresql natively $this->create_odbc_database_connection(); } @@ -236,7 +221,7 @@ include "root.php"; protected function create_database_sqlite() { //sqlite database will be created when the config.php is loaded and only if the database file does not exist try { - $this->dbh = new PDO('sqlite:'.$this->db_path.'/'.$this->db_name); //sqlite 3 + $this->dbh = new PDO('sqlite:'.$this->global_settings->db_path().'/'.$this->global_settings->db_name()); //sqlite 3 //$this->dbh = new PDO('sqlite::memory:'); //sqlite 3 } catch (PDOException $error) { @@ -258,7 +243,7 @@ include "root.php"; require_once "resources/classes/schema.php"; $schema = new schema; $schema->db = $this->dbh; - $schema->db_type = $this->db_type; + $schema->db_type = $this->global_settings->db_type(); $schema->sql(); $schema->exec(); @@ -292,34 +277,34 @@ include "root.php"; $this->dbh->commit(); //set the file permissions - chmod($this->db_path.'/'.$this->db_name, 0777); + chmod($this->global_settings->db_path().'/'.$this->global_settings->db_name(), 0777); } protected function create_database_pgsql() { - if ($this->db_create) { + if ($this->global_settings->db_create()) { //Attempt to create new PG role and database $this->write_progress("\tCreating database"); try { - if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } - if (strlen($this->db_host) > 0) { - $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1"); + if (strlen($this->global_settings->db_port()) == 0) { $this->global_settings->db_port() = "5432"; } + if (strlen($this->global_settings->db_host()) > 0) { + $this->dbh = new PDO("pgsql:host={$this->global_settings->db_host()} port={$this->global_settings->db_port()} user={$this->global_settings->db_create_username()} password={$this->global_settings->db_create_password()} dbname=template1"); } else { - $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_create_username} password={$this->db_create_password} dbname=template1"); + $this->dbh = new PDO("pgsql:host=localhost port={$this->global_settings->db_port()} user={$this->global_settings->db_create_username()} password={$this->global_settings->db_create_password()} dbname=template1"); } } catch (PDOException $error) { throw new Exception("error connecting to database in order to create: " . $error->getMessage()); } //create the database, user, grant perms - if($this->dbh->exec("CREATE DATABASE {$this->db_name}") === false) { - throw new Exception("Failed to create database {$this->db_name}: " . join(":", $this->dbh->errorInfo())); + if($this->dbh->exec("CREATE DATABASE {$this->global_settings->db_name()}") === false) { + throw new Exception("Failed to create database {$this->global_settings->db_name()}: " . join(":", $this->dbh->errorInfo())); } - if($this->db_username != $this->db_create_username){ - if($this->dbh->exec("CREATE USER {$this->db_username} WITH PASSWORD '{$this->db_password}'") === false){ - throw new Exception("Failed to create user {$this->db_name}: " . join(":", $this->dbh->errorInfo())); + if($this->global_settings->db_username() != $this->global_settings->db_create_username()){ + if($this->dbh->exec("CREATE USER {$this->global_settings->db_username()} WITH PASSWORD '{$this->global_settings->db_password()}'") === false){ + throw new Exception("Failed to create user {$this->global_settings->db_name()}: " . join(":", $this->dbh->errorInfo())); } - if($this->dbh->exec("GRANT ALL ON {$this->db_name} TO {$this->db_username}") === false){ - throw new Exception("Failed to create user {$this->db_name}: " . join(":", $this->dbh->errorInfo())); + if($this->dbh->exec("GRANT ALL ON {$this->global_settings->db_name()} TO {$this->global_settings->db_username()}") === false){ + throw new Exception("Failed to create user {$this->global_settings->db_name()}: " . join(":", $this->dbh->errorInfo())); } } @@ -328,13 +313,13 @@ include "root.php"; } $this->write_progress("\tInstalling data to database"); - //open database connection with $this->db_name + //open database connection with $this->global_settings->db_name() try { - if (strlen($this->db_port) == 0) { $this->db_port = "5432"; } - if (strlen($this->db_host) > 0) { - $this->dbh = new PDO("pgsql:host={$this->db_host} port={$this->db_port} dbname={$this->db_name} user={$this->db_username} password={$this->db_password}"); + if (strlen($this->global_settings->db_port()) == 0) { $this->global_settings->db_port() = "5432"; } + if (strlen($this->global_settings->db_host()) > 0) { + $this->dbh = new PDO("pgsql:host={$this->global_settings->db_host()} port={$this->global_settings->db_port()} dbname={$this->global_settings->db_name()} user={$this->global_settings->db_username()} password={$this->global_settings->db_password()}"); } else { - $this->dbh = new PDO("pgsql:host=localhost port={$this->db_port} user={$this->db_username} password={$this->db_password} dbname={$this->db_name}"); + $this->dbh = new PDO("pgsql:host=localhost port={$this->global_settings->db_port()} user={$this->global_settings->db_username()} password={$this->global_settings->db_password()} dbname={$this->global_settings->db_name()}"); } } catch (PDOException $error) { @@ -346,7 +331,7 @@ include "root.php"; require_once "resources/classes/schema.php"; $schema = new schema; $schema->db = $this->dbh; - $schema->db_type = $this->db_type; + $schema->db_type = $this->global_settings->db_type(); $schema->sql(); $schema->exec(); @@ -382,23 +367,23 @@ include "root.php"; protected function create_database_mysql() { //database connection $connect_string; - if (strlen($this->db_host) == 0 && strlen($this->db_port) == 0) { + if (strlen($this->global_settings->db_host()) == 0 && strlen($this->global_settings->db_port()) == 0) { //if both host and port are empty use the unix socket - $connect_string = "mysql:host=$this->db_host;unix_socket=/var/run/mysqld/mysqld.sock;"; + $connect_string = "mysql:host=$this->global_settings->db_host();unix_socket=/var/run/mysqld/mysqld.sock;"; } - elseif (strlen($this->db_port) == 0) { + elseif (strlen($this->global_settings->db_port()) == 0) { //leave out port if it is empty - $connect_string = "mysql:host=$this->db_host;"; + $connect_string = "mysql:host=$this->global_settings->db_host();"; } else { - $connect_string = "mysql:host=$this->db_host;port=$this->db_port;"; + $connect_string = "mysql:host=$this->global_settings->db_host();port=$this->global_settings->db_port();"; } //create the table, user and set the permissions only if the db_create_username was provided - if ($this->db_create) { + if ($this->global_settings->db_create()) { $this->write_progress("\tCreating database"); try { - $this->dbh = new PDO($connect_string, $this->db_create_username, db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + $this->dbh = new PDO($connect_string, $this->global_settings->db_create_username(), db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); } @@ -415,7 +400,7 @@ include "root.php"; //create user and set the permissions try { - $tmp_sql = "CREATE USER '".$this->db_username."'@'%' IDENTIFIED BY '".$this->db_password."'; "; + $tmp_sql = "CREATE USER '".$this->global_settings->db_username()."'@'%' IDENTIFIED BY '".$this->global_settings->db_password()."'; "; $this->dbh->query($tmp_sql); } catch (PDOException $error) { @@ -424,20 +409,20 @@ include "root.php"; //set account to unlimited use try { - if ($this->db_host == "localhost" || $this->db_host == "127.0.0.1") { - $tmp_sql = "GRANT USAGE ON * . * TO '".$this->db_username."'@'localhost' "; - $tmp_sql .= "IDENTIFIED BY '".$this->db_password."' "; + if ($this->global_settings->db_host() == "localhost" || $this->global_settings->db_host() == "127.0.0.1") { + $tmp_sql = "GRANT USAGE ON * . * TO '".$this->global_settings->db_username()."'@'localhost' "; + $tmp_sql .= "IDENTIFIED BY '".$this->global_settings->db_password()."' "; $tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; "; $this->dbh->query($tmp_sql); - $tmp_sql = "GRANT USAGE ON * . * TO '".$this->db_username."'@'127.0.0.1' "; - $tmp_sql .= "IDENTIFIED BY '".$this->db_password."' "; + $tmp_sql = "GRANT USAGE ON * . * TO '".$this->global_settings->db_username()."'@'127.0.0.1' "; + $tmp_sql .= "IDENTIFIED BY '".$this->global_settings->db_password()."' "; $tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; "; $this->dbh->query($tmp_sql); } else { - $tmp_sql = "GRANT USAGE ON * . * TO '".$this->db_username."'@'".$this->db_host."' "; - $tmp_sql .= "IDENTIFIED BY '".$this->db_password."' "; + $tmp_sql = "GRANT USAGE ON * . * TO '".$this->global_settings->db_username()."'@'".$this->global_settings->db_host()."' "; + $tmp_sql .= "IDENTIFIED BY '".$this->global_settings->db_password()."' "; $tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; "; $this->dbh->query($tmp_sql); } @@ -448,7 +433,7 @@ include "root.php"; //create the database and set the create user with permissions try { - $tmp_sql = "CREATE DATABASE IF NOT EXISTS ".$this->db_name."; "; + $tmp_sql = "CREATE DATABASE IF NOT EXISTS ".$this->global_settings->db_name()."; "; $this->dbh->query($tmp_sql); } catch (PDOException $error) { @@ -457,7 +442,7 @@ include "root.php"; //set user permissions try { - $this->dbh->query("GRANT ALL PRIVILEGES ON ".$this->db_name.".* TO '".$this->db_username."'@'%'; "); + $this->dbh->query("GRANT ALL PRIVILEGES ON ".$this->global_settings->db_name().".* TO '".$this->global_settings->db_username()."'@'%'; "); } catch (PDOException $error) { throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql ); @@ -472,12 +457,12 @@ include "root.php"; throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql ); } $this->dbh = null; - } //if (strlen($this->db_create_username) > 0) + } //if (strlen($this->global_settings->db_create_username()) > 0) $this->write_progress("\tInstalling data to database"); //select the database try { - $this->dbh = new PDO($connect_string, $this->db_username, db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); + $this->dbh = new PDO($connect_string, $this->global_settings->db_username(), db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); } @@ -485,7 +470,7 @@ include "root.php"; throw new Exception("error connecting to database: " . $error->getMessage() . "\n" . $sql ); } try { - $this->dbh->query("USE ".$this->db_name.";"); + $this->dbh->query("USE ".$this->global_settings->db_name().";"); } catch (PDOException $error) { throw new Exception("error in database: " . $error->getMessage() . "\n" . $sql ); @@ -495,7 +480,7 @@ include "root.php"; require_once "resources/classes/schema.php"; $schema = new schema; $schema->db = $this->dbh; - $schema->db_type = $this->db_type; + $schema->db_type = $this->global_settings->db_type(); $schema->sql(); $schema->exec(); @@ -534,9 +519,9 @@ include "root.php"; } protected function create_domain() { - $this->write_progress("\tChecking if domain exists '" . $this->domain_name . "'"); + $this->write_progress("\tChecking if domain exists '" . $this->global_settings->domain_name . "'"); $sql = "select * from v_domains "; - $sql .= "where domain_name = '".$this->domain_name."' "; + $sql .= "where domain_name = '".$this->global_settings->domain_name."' "; $sql .= "limit 1"; $this->write_debug($sql); $prep_statement = $this->dbh->prepare(check_sql($sql)); @@ -560,7 +545,7 @@ include "root.php"; $sql .= "values "; $sql .= "("; $sql .= "'".$this->_domain_uuid."', "; - $sql .= "'".$this->domain_name."', "; + $sql .= "'".$this->global_settings->domain_name."', "; $sql .= "'' "; $sql .= ");"; @@ -608,73 +593,73 @@ include "root.php"; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->base_dir(); + $tmp[$x]['value'] = $this->global_settings->base_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'base'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->conf_dir(); + $tmp[$x]['value'] = $this->global_settings->conf_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'conf'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->db_dir(); + $tmp[$x]['value'] = $this->global_settings->db_dir()(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'db'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->log_dir(); + $tmp[$x]['value'] = $this->global_settings->log_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'log'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->mod_dir(); + $tmp[$x]['value'] = $this->global_settings->mod_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'mod'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->script_dir(); + $tmp[$x]['value'] = $this->global_settings->script_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'scripts'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->grammar_dir(); + $tmp[$x]['value'] = $this->global_settings->grammar_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'grammar'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->storage_dir(); + $tmp[$x]['value'] = $this->global_settings->storage_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'storage'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->voicemail_vdir(); + $tmp[$x]['value'] = $this->global_settings->voicemail_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'voicemail'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->recordings_dir(); + $tmp[$x]['value'] = $this->global_settings->recordings_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'recordings'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->sounds_dir(); + $tmp[$x]['value'] = $this->global_settings->sounds_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'sounds'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->phrases_vdir(); + $tmp[$x]['value'] = $this->global_settings->phrases_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'phrases'; $tmp[$x]['enabled'] = 'true'; @@ -686,19 +671,19 @@ include "root.php"; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->extensions_vdir(); + $tmp[$x]['value'] = $this->global_settings->extensions_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'extensions'; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->sip_profiles_vdir(); + $tmp[$x]['value'] = $this->global_settings->sip_profiles_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'sip_profiles'; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->dialplan_vdir(); + $tmp[$x]['value'] = $this->global_settings->dialplan_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'dialplan'; $tmp[$x]['enabled'] = 'false'; @@ -706,7 +691,7 @@ include "root.php"; //server settings $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->temp_dir(); + $tmp[$x]['value'] = $this->global_settings->temp_dir(); $tmp[$x]['category'] = 'server'; $tmp[$x]['subcategory'] = 'temp'; $tmp[$x]['enabled'] = 'true'; @@ -719,7 +704,7 @@ include "root.php"; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->detect_switch->backup_vdir(); + $tmp[$x]['value'] = $this->global_settings->backup_vdir(); $tmp[$x]['category'] = 'server'; $tmp[$x]['subcategory'] = 'backup'; $tmp[$x]['enabled'] = 'true'; @@ -835,7 +820,7 @@ include "root.php"; } protected function create_superuser() { - $this->write_progress("\tChecking if superuser exists '" . $this->domain_name . "'"); + $this->write_progress("\tChecking if superuser exists '" . $this->global_settings->domain_name . "'"); $sql = "select * from v_users "; $sql .= "where domain_uuid = '".$this->_domain_uuid."' "; $sql .= "and username = '".$this->admin_username."' "; @@ -1009,16 +994,16 @@ include "root.php"; $_SESSION["domain_uuid"] = $this->_domain_uuid; require $this->config_php; require "resources/require.php"; - $_SESSION['event_socket_ip_address'] = $this->detect_switch->event_host; - $_SESSION['event_socket_port'] = $this->detect_switch->event_port; - $_SESSION['event_socket_password'] = $this->detect_switch->event_password; + $_SESSION['event_socket_ip_address'] = $this->global_settings->event_host; + $_SESSION['event_socket_port'] = $this->global_settings->event_port; + $_SESSION['event_socket_password'] = $this->global_settings->event_password; //get the groups assigned to the user and then set the groups in $_SESSION["groups"] $sql = "SELECT * FROM v_group_users "; $sql .= "where domain_uuid=:domain_uuid "; $sql .= "and user_uuid=:user_uuid "; $prep_statement = $this->dbh->prepare(check_sql($sql)); - $prep_statement->bindParam(':domain_uuid', $this->domain_uuid); + $prep_statement->bindParam(':domain_uuid', $this->global_settings->domain_uuid); $prep_statement->bindParam(':user_uuid', $this->admin_uuid); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); @@ -1031,10 +1016,10 @@ include "root.php"; foreach($_SESSION["groups"] as $field) { if (strlen($field['group_name']) > 0) { if ($x == 0) { - $sql .= "where (domain_uuid = '".$this->domain_uuid."' and group_name = '".$field['group_name']."') "; + $sql .= "where (domain_uuid = '".$this->global_settings->domain_uuid."' and group_name = '".$field['group_name']."') "; } else { - $sql .= "or (domain_uuid = '".$this->domain_uuid."' and group_name = '".$field['group_name']."') "; + $sql .= "or (domain_uuid = '".$this->global_settings->domain_uuid."' and group_name = '".$field['group_name']."') "; } $x++; } @@ -1045,13 +1030,13 @@ include "root.php"; unset($sql, $prep_statement_sub); //include the config.php - $db_type = $this->db_type; - $db_path = $this->db_path; - $db_host = $this->db_host; - $db_port = $this->db_port; - $db_name = $this->db_name; - $db_username = $this->db_username; - $db_password = $this->db_password; + $db_type = $this->global_settings->db_type(); + $db_path = $this->global_settings->db_path(); + $db_host = $this->global_settings->db_host(); + $db_port = $this->global_settings->db_port(); + $db_name = $this->global_settings->db_name(); + $db_username = $this->global_settings->db_username(); + $db_password = $this->global_settings->db_password(); //add the database structure require_once "resources/classes/schema.php"; diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 6e9155eb96..67b45e3bb1 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -28,34 +28,25 @@ include "root.php"; //define the install class class install_switch { - protected $domain_uuid; - protected $domain_name; - protected $detect_switch; + protected $global_settings; protected $config_lua; + protected $dbh; public $debug = false; - function __construct($domain_name, $domain_uuid, $detect_switch) { - if($detect_switch == null){ - if(strlen($_SESSION['event_socket_ip_address']) == 0 or strlen($_SESSION['event_socket_port']) == 0 or strlen($_SESSION['event_socket_password']) == 0 ){ - throw new Exception('The parameter $detect_switch was empty and i could not find the event socket details from the session'); - } - $detect_switch = new detect_switch($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - $domain_name = $_SESSION['domain_name']; - $domain_uuid = $_SESSION['domain_uuid']; - }elseif(!is_a($detect_switch, 'detect_switch')){ - throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)'); + function __construct($global_settings) { + if(!is_a($global_settings, 'global_settings')){ + throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)'); } - $this->domain_uuid = $domain_uuid; - $this->domain = $domain_name; - $this->detect_switch = $detect_switch; + $this->global_settings = $global_settings; if (is_dir("/etc/fusionpbx")){ $this->config_lua = "/etc/fusionpbx/config.lua"; - } elseif (is_dir("/usr/local/etc/fusionpbx")){ + }elseif (is_dir("/usr/local/etc/fusionpbx")){ $this->config_lua = "/usr/local/etc/fusionpbx/config.lua"; - } - else { - $this->config_lua = $this->detect_switch->script_dir."/resources/config.lua"; + }elseif(strlen($this->global_settings->script_dir) > 0) { + $this->config_lua = $this->global_settings->script_dir."/resources/config.lua"; + }else{ + throw new Exception("Could not work out where to put the config.lua"); } $this->config_lua = normalize_path_to_os($this->config_lua); } @@ -91,6 +82,7 @@ include "root.php"; exec("xcopy /E /Y \"$src\" \"$dst\""); } else { + throw new Exception('Could not perform copy operation on this platform, implementation missing'); $dir = opendir($src); if (!$dir) { if (!mkdir($src, 0755, true)) { @@ -202,14 +194,14 @@ include "root.php"; function copy_conf() { $this->write_progress("\tCopying Config"); //make a backup of the config - if (file_exists($this->detect_switch->conf_dir())) { - $this->backup_dir($this->detect_switch->conf_dir(), 'fusionpbx_switch_config'); - $this->recursive_delete($this->detect_switch->conf_dir()); + if (file_exists($this->global_settings->conf_dir())) { + $this->backup_dir($this->global_settings->conf_dir(), 'fusionpbx_switch_config'); + $this->recursive_delete($this->global_settings->conf_dir()); } //make sure the conf directory exists - if (!is_dir($this->detect_switch->conf_dir())) { - if (!mkdir($this->detect_switch->conf_dir(), 0774, true)) { - throw new Exception("Failed to create the switch conf directory '".$this->detect_switch->conf_dir()."'. "); + if (!is_dir($this->global_settings->conf_dir())) { + if (!mkdir($this->global_settings->conf_dir(), 0774, true)) { + throw new Exception("Failed to create the switch conf directory '".$this->global_settings->conf_dir()."'. "); } } //copy resources/templates/conf to the freeswitch conf dir @@ -219,14 +211,14 @@ include "root.php"; else { $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf"; } - $dst_dir = $this->detect_switch->conf_dir(); + $dst_dir = $this->global_settings->conf_dir(); if (is_readable($dst_dir)) { $this->recursive_copy($src_dir, $dst_dir); unset($src_dir, $dst_dir); } - $fax_dir = join( DIRECTORY_SEPARATOR, array($this->detect_switch->storage_dir(), 'fax')); + $fax_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->storage_dir(), 'fax')); if (!is_readable($fax_dir)) { mkdir($fax_dir,0777,true); } - $voicemail_dir = join( DIRECTORY_SEPARATOR, array($this->detect_switch->storage_dir(), 'voicemail')); + $voicemail_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->storage_dir(), 'voicemail')); if (!is_readable($voicemail_dir)) { mkdir($voicemail_dir,0777,true); } //create the dialplan/default.xml for single tenant or dialplan/domain.xml @@ -234,7 +226,7 @@ include "root.php"; $dialplan = new dialplan; $dialplan->domain_uuid = $this->domain_uuid; $dialplan->domain = $this->domain_name; - $dialplan->switch_dialplan_dir = join( DIRECTORY_SEPARATOR, array($this->detect_switch->conf_dir(), "/dialplan")); + $dialplan->switch_dialplan_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->conf_dir(), "/dialplan")); $dialplan->restore_advanced_xml(); if($this->_debug){ print_r($dialplan->result, $message); @@ -248,7 +240,7 @@ include "root.php"; } //write the switch.conf.xml file - if (file_exists($this->detect_switch->conf_dir())) { + if (file_exists($this->global_settings->conf_dir())) { switch_conf_xml(); } @@ -256,7 +248,10 @@ include "root.php"; function copy_scripts() { $this->write_progress("\tCopying Scripts"); - $script_dir = $this->detect_switch->script_dir(); + $script_dir = $this->global_settings->script_dir(); + if(strlen($script_dir) == 0) { + throw new Exception("Cannot copy scripts the 'script_dir' is empty"); + } if (file_exists($script_dir)) { if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){ $src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts'; @@ -312,30 +307,30 @@ include "root.php"; //config.lua $fout = fopen($this->config_lua,"w"); if(!$fout){ - throw new Exception("Failed to open '{$this->config_lua}' for writing"); + throw new Exception("Failed to open '".$this->config_lua."' for writing"); } $tmp = "\n"; $tmp .= "--set the variables\n"; - if (strlen($_SESSION['switch']['sounds']['dir']) > 0) { - $tmp .= normalize_path_to_os(" sounds_dir = [[".$_SESSION['switch']['sounds']['dir']."]];\n"); + if (strlen($this->global_settings->switch_sounds_dir()) > 0) { + $tmp .= normalize_path_to_os(" sounds_dir = [[".$this->global_settings->switch_sounds_dir()."]];\n"); } - if (strlen($_SESSION['switch']['phrases']['dir']) > 0) { - $tmp .= normalize_path_to_os(" phrases_dir = [[".$_SESSION['switch']['phrases']['dir']."]];\n"); + if (strlen($this->global_settings->switch_phrases_vdir()) > 0) { + $tmp .= normalize_path_to_os(" phrases_dir = [[".$this->global_settings->switch_phrases_vdir()."]];\n"); } - if (strlen($_SESSION['switch']['db']['dir']) > 0) { - $tmp .= normalize_path_to_os(" database_dir = [[".$_SESSION['switch']['db']['dir']."]];\n"); + if (strlen($this->global_settings->switch_db_dir()) > 0) { + $tmp .= normalize_path_to_os(" database_dir = [[".$this->global_settings->switch_db_dir()."]];\n"); } - if (strlen($_SESSION['switch']['recordings']['dir']) > 0) { - $tmp .= normalize_path_to_os(" recordings_dir = [[".$_SESSION['switch']['recordings']['dir']."]];\n"); + if (strlen($this->global_settings->switch_recordings_dir()) > 0) { + $tmp .= normalize_path_to_os(" recordings_dir = [[".$this->global_settings->switch_recordings_dir()."]];\n"); } - if (strlen($_SESSION['switch']['storage']['dir']) > 0) { - $tmp .= normalize_path_to_os(" storage_dir = [[".$_SESSION['switch']['storage']['dir']."]];\n"); + if (strlen($this->global_settings->switch_storage_dir()) > 0) { + $tmp .= normalize_path_to_os(" storage_dir = [[".$this->global_settings->switch_storage_dir()."]];\n"); } - if (strlen($_SESSION['switch']['voicemail']['dir']) > 0) { - $tmp .= normalize_path_to_os(" voicemail_dir = [[".$_SESSION['switch']['voicemail']['dir']."]];\n"); + if (strlen($this->global_settings->switch_voicemail_vdir()) > 0) { + $tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n"); } - if (strlen($_SESSION['switch']['scripts']['dir']) > 0) { - $tmp .= normalize_path_to_os(" scripts_dir = [[".$_SESSION['switch']['scripts']['dir']."]];\n"); + if (strlen($this->global_settings->switch_scripts_dir()) > 0) { + $tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_scripts_dir()."]];\n"); } $tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n"); if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { @@ -347,27 +342,27 @@ include "root.php"; $tmp .= normalize_path_to_os(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n"); $tmp .= "\n"; - if ((strlen($db_type) > 0) || (strlen($dsn_name) > 0)) { + if ((strlen($this->global_settings->db_type()) > 0) || (strlen($dsn_name) > 0)) { $tmp .= "--database information\n"; $tmp .= " database = {}\n"; - $tmp .= " database[\"type\"] = \"".$db_type."\";\n"; - $tmp .= " database[\"name\"] = \"".$db_name."\";\n"; - $tmp .= normalize_path_to_os(" database[\"path\"] = [[".$db_path."]];\n"); + $tmp .= " database[\"type\"] = \"".$this->global_settings->db_type()."\";\n"; + $tmp .= " database[\"name\"] = \"".$this->global_settings->db_name()."\";\n"; + $tmp .= normalize_path_to_os(" database[\"path\"] = [[".$this->global_settings->db_path()."]];\n"); if (strlen($dsn_name) > 0) { $tmp .= " database[\"system\"] = \"odbc://".$dsn_name.":".$dsn_username.":".$dsn_password."\";\n"; $tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n"; } - elseif ($db_type == "pgsql") { - if ($db_host == "localhost") { $db_host = "127.0.0.1"; } - $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$db_host." port=".$db_port." dbname=".$db_name." user=".$db_username." password=".$db_password." options='' application_name='".$db_name."'\";\n"; - $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$db_host." port=".$db_port." dbname=freeswitch user=".$db_username." password=".$db_password." options='' application_name='freeswitch'\";\n"; + elseif ($this->global_settings->db_type() == "pgsql") { + if ($this->global_settings->db_host() == "localhost") { $this->global_settings->db_host() = "127.0.0.1"; } + $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; + $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; } - elseif ($db_type == "sqlite") { - $tmp .= " database[\"system\"] = \"sqlite://".$db_path."/".$db_name."\";\n"; + elseif ($this->global_settings->db_type() == "sqlite") { + $tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n"; $tmp .= " database[\"switch\"] = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n"; } - elseif ($db_type == "mysql") { + elseif ($this->global_settings->db_type() == "mysql") { $tmp .= " database[\"system\"] = \"\";\n"; $tmp .= " database[\"switch\"] = \"\";\n"; } @@ -393,8 +388,8 @@ include "root.php"; $tmp .= " debug[\"cache\"] = false;\n"; $tmp .= "\n"; $tmp .= "--additional info\n"; - $tmp .= " domain_count = ".count($_SESSION["domains"]).";\n"; - $tmp .= normalize_path_to_os(" temp_dir = [[".$_SESSION['server']['temp']['dir']."]];\n"); + $tmp .= " domain_count = ".$this->global_settings->domain_count().";\n"; + $tmp .= normalize_path_to_os(" temp_dir = [[".$this->global_settings->switch_temp_dir()."]];\n"); if (isset($_SESSION['domain']['dial_string']['text'])) { $tmp .= " dial_string = \"".$_SESSION['domain']['dial_string']['text']."\";\n"; } From bcfd71577cafa6147a9d0ac5fce07cd6a1b174ca Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 2 Dec 2015 11:21:09 +0000 Subject: [PATCH 177/232] added auto usage of global_settings where not provided --- core/install/install_first_time.php | 4 +++- core/install/resources/classes/install_fusionpbx.php | 5 ++++- core/install/resources/classes/install_switch.php | 5 ++++- core/install/upgrade_switch.php | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php index 82abc3e2e0..ba6a567c36 100644 --- a/core/install/install_first_time.php +++ b/core/install/install_first_time.php @@ -296,7 +296,9 @@ if(!$install_step) { $install_step = 'select_language'; } try { require_once "resources/classes/global_settings.php"; $settings = new global_settings($detect_switch, $domain_name); - + if($settings = null){ + throw new Exception("Error global_settings came back with null"); + } require_once "resources/classes/install_fusionpbx.php"; $system = new install_fusionpbx($settings); $system->admin_username = $admin_username; diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 17bfa24f0c..ab096ca715 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -46,7 +46,10 @@ include "root.php"; public $template_name = 'enhanced'; function __construct($global_settings) { - if(!is_a($global_settings, 'global_settings')){ + if($global_settings == null){ + require_once "resources/classes/global_settings.php"; + $global_settings = new global_settings(); + elseif(!is_a($global_settings, 'global_settings')){ throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)'); } $this->global_settings = $global_settings; diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 67b45e3bb1..f9fa1b9ec2 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -35,7 +35,10 @@ include "root.php"; public $debug = false; function __construct($global_settings) { - if(!is_a($global_settings, 'global_settings')){ + if($global_settings == null){ + require_once "resources/classes/global_settings.php"; + $global_settings = new global_settings(); + elseif(!is_a($global_settings, 'global_settings')){ throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)'); } $this->global_settings = $global_settings; diff --git a/core/install/upgrade_switch.php b/core/install/upgrade_switch.php index dc579b4a86..fd34d3c806 100644 --- a/core/install/upgrade_switch.php +++ b/core/install/upgrade_switch.php @@ -53,7 +53,7 @@ //run switch upgrade require_once "resources/classes/install_switch.php"; - $switch = new install_switch; + $switch = new install_switch(); $switch->upgrade(); ?> \ No newline at end of file From de2cb971130641c3564f00fc1776a73c1af5f6cb Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 2 Dec 2015 14:05:21 +0000 Subject: [PATCH 178/232] Bugfix batch --- core/install/install_first_time.php | 14 ++- .../resources/classes/detect_switch.php | 2 +- .../resources/classes/global_settings.php | 55 +++++++---- .../resources/classes/install_fusionpbx.php | 99 ++++++++++--------- .../resources/classes/install_switch.php | 41 ++++---- 5 files changed, 115 insertions(+), 96 deletions(-) diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php index ba6a567c36..5a772e023e 100644 --- a/core/install/install_first_time.php +++ b/core/install/install_first_time.php @@ -295,12 +295,10 @@ if(!$install_step) { $install_step = 'select_language'; } #set_error_handler("error_handler"); try { require_once "resources/classes/global_settings.php"; - $settings = new global_settings($detect_switch, $domain_name); - if($settings = null){ - throw new Exception("Error global_settings came back with null"); - } + $global_settings = new global_settings($detect_switch, $domain_name); + if(is_null($global_settings)){ throw new Exception("Error global_settings came back with null"); } require_once "resources/classes/install_fusionpbx.php"; - $system = new install_fusionpbx($settings); + $system = new install_fusionpbx($global_settings); $system->admin_username = $admin_username; $system->admin_password = $admin_password; $system->default_country = $install_default_country; @@ -308,7 +306,7 @@ if(!$install_step) { $install_step = 'select_language'; } $system->template_name = $install_template_name; require_once "resources/classes/install_switch.php"; - $switch = new install_switch($settings); + $switch = new install_switch($global_settings); //$switch->debug = true; //$system->debug = true; $system->install(); @@ -320,7 +318,7 @@ if(!$install_step) { $install_step = 'select_language'; } echo "

    Failed to install
    " . $e->getMessage() . "

    \n"; try { require_once "resources/classes/install_fusionpbx.php"; - $system = new install_fusionpbx($domain_name, $domain_uuid, $detect_switch); + $system = new install_fusionpbx($global_settings); $system->remove_config(); }catch(Exception $e){ echo "

    Failed to remove config: " . $e->getMessage() . "

    \n"; @@ -330,7 +328,7 @@ if(!$install_step) { $install_step = 'select_language'; } restore_error_handler(); if($install_ok){ echo "\n"; - header("Location: ".PROJECT_PATH."/logout.php"); + #header("Location: ".PROJECT_PATH."/logout.php"); $_SESSION['message'] = 'Install complete'; }else{ echo "
    \n"; diff --git a/core/install/resources/classes/detect_switch.php b/core/install/resources/classes/detect_switch.php index dc46069d7b..4245d5bc61 100644 --- a/core/install/resources/classes/detect_switch.php +++ b/core/install/resources/classes/detect_switch.php @@ -141,7 +141,7 @@ require_once "resources/classes/EventSocket.php"; $this->_voicemail_vdir = normalize_path($this->_storage_dir . DIRECTORY_SEPARATOR . "voicemail"); $this->_phrases_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "lang"); $this->_extensions_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "directory"); - $this->_sip_profiles_vdir = normalize_path(($this->_conf_dir . DIRECTORY_SEPARATOR . "sip_profiles"); + $this->_sip_profiles_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "sip_profiles"); $this->_dialplan_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "dialplan"); $this->_backup_vdir = normalize_path(sys_get_temp_dir()); } diff --git a/core/install/resources/classes/global_settings.php b/core/install/resources/classes/global_settings.php index 24f4e89ecc..76612ed539 100644 --- a/core/install/resources/classes/global_settings.php +++ b/core/install/resources/classes/global_settings.php @@ -30,8 +30,8 @@ require_once "root.php"; class global_settings { // cached data - protected $_dirs; - protected $_vdirs; + protected $_switch_dirs; + protected $_switch_vdirs; public function get_switch_dirs() { return $this->_switch_dirs; } public function get_switch_vdirs() { return $this->_switch_vdirs; } @@ -116,25 +116,39 @@ require_once "root.php"; public function db_create_password() {return $this->_db_create_password; } //misc information + protected $_domain_uuid; + protected $_domain_name; protected $_domain_count; + public function domain_uuid() {return $this->_domain_uuid; } + public function domain_name() {return $this->_domain_name; } public function domain_count() {return $this->_domain_count; } + public function set_domain_uuid($domain_uuid) { + $e = new Exception(); + $trace = $e->getTrace(); + if($trace[1]['function'] != 'create_domain'){ + throw new Exception('Only create_domain is allowed to update the domain_uuid'); + } + $this->_domain_uuid = $domain_uuid; + } - public function __construct($detect_switch, $domain_name, $domain_uuid) { + public function __construct($detect_switch = null, $domain_name = null, $domain_uuid = null) { $this->_switch_dirs = preg_grep ('/^switch_.*_dir$/', get_class_methods('global_settings') ); sort( $this->_switch_dirs ); $this->_switch_vdirs = preg_grep ('/^switch_.*_vdir$/', get_class_methods('global_settings') ); sort( $this->_switch_vdirs ); - - if($detect_switch == null){ + if(is_null($detect_switch)){ //take settings from session + if(!isset($_SESSION['switch'])){ + throw new Exception("No detect_switch was passed to me but \$_SESSION['switch'] is empty!"); + } foreach ($this->_switch_dirs as $dir){ $session_var; - preg_match( '^switch_.*_dir$', $dir, $session_var); + preg_match( '/^switch_.*_dir$/', $dir, $session_var); $this->$dir = $_SESSION['switch'][$session_var[0]]['dir']; } foreach ($this->_switch_vdirs as $vdir){ $session_var; - preg_match( '^switch_.*_vdir$', $vdir, $session_var); + preg_match( '/^switch_.*_vdir$/', $vdir, $session_var); $this->$vdir = $_SESSION['switch'][$session_var[0]]['dir']; } $this->switch_event_host = $_SESSION['event_socket_ip_address']; @@ -142,8 +156,8 @@ require_once "root.php"; $this->switch_event_password = $_SESSION['event_socket_password']; // domain info - $this->domain_name = $_SESSION['domain_name']; - $this->domain_uuid = $_SESSION['domain_uuid']; + $this->_domain_name = $_SESSION['domain_name']; + $this->_domain_uuid = $_SESSION['domain_uuid']; // collect misc info $this->domain_count = count($_SESSION["domains"]); @@ -163,26 +177,33 @@ require_once "root.php"; }else{ //copy from detect_switch - foreach($detect_switch->switch_dirs() as $dir){ - $t_dir = "_$dir"; + foreach($detect_switch->get_dirs() as $dir){ + $t_dir = "_switch_$dir"; $this->$t_dir = $detect_switch->$dir(); } - foreach($detect_switch->switch_vdirs() as $vdir){ - $t_vdir = "_$vdir"; + foreach($detect_switch->get_vdirs() as $vdir){ + $t_vdir = "_switch_$vdir"; $this->$t_vdir = $detect_switch->$vdir(); } //copy from _POST foreach($_POST as $key=>$value){ if(substr($key,0,3) == "db_"){ - $this->$key = $value; + $o_key = "_$key"; + $this->$o_key = $value; } } + if($this->_db_create and strlen($this->_db_create_username) == 0) + { + $this->_db_create_username = $this->_db_username; + $this->_db_create_password = $this->_db_password; + } + if (strlen($this->_db_port) == 0) { $this->_db_port = "5432"; } // domain info - if($domain_uuid == null){ $domain_uuid = uuid(); } - $this->domain_name = $domain_name; - $this->domain_uuid = $domain_uuid; + if(strlen($domain_uuid) == 0){ $domain_uuid = uuid(); } + $this->_domain_name = $domain_name; + $this->_domain_uuid = $domain_uuid; //collect misc info $this->_domain_count = 1; //assumed to be one diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index ab096ca715..b6c2dbb6bd 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -34,7 +34,7 @@ include "root.php"; protected $menu_uuid = 'b4750c3f-2a86-b00d-b7d0-345c14eca286'; protected $dbh; - public function domain_uuid() { return $this->_domain_uuid; } + public function domain_uuid() { return $this->global_settings->domain_uuid(); } public $debug = false; @@ -46,10 +46,10 @@ include "root.php"; public $template_name = 'enhanced'; function __construct($global_settings) { - if($global_settings == null){ + if(is_null($global_settings)){ require_once "resources/classes/global_settings.php"; $global_settings = new global_settings(); - elseif(!is_a($global_settings, 'global_settings')){ + }elseif(!is_a($global_settings, 'global_settings')){ throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)'); } $this->global_settings = $global_settings; @@ -81,9 +81,14 @@ include "root.php"; ini_set('max_execution_time',3600); $this->write_progress("Install started for FusionPBX"); $this->create_config_php(); + $this->write_progress("\tExecuting config.php"); + require $this->config_php; + global $db; + $db = $this->dbh; $this->create_database(); $this->create_domain(); $this->create_superuser(); + $this->write_progress("\tRunning requires"); require "resources/require.php"; $this->create_menus(); $this->write_progress("Install complete for FusionPBX"); @@ -135,12 +140,13 @@ include "root.php"; $tmp_config .= "\n"; $tmp_config .= " //mysql: database connection information\n"; if ($this->global_settings->db_type() == "mysql") { - if ($this->global_settings->db_host() == "localhost") { + $db_host = $this->global_settings->db_host(); + if ( $db_host == "localhost") { //if localhost is used it defaults to a Unix Socket which doesn't seem to work. //replace localhost with 127.0.0.1 so that it will connect using TCP - $this->global_settings->db_host() = "127.0.0.1"; + $db_host = "127.0.0.1"; } - $tmp_config .= " \$db_host = '".$this->global_settings->db_host()."';\n"; + $tmp_config .= " \$db_host = '".$db_host."';\n"; $tmp_config .= " \$db_port = '".$this->global_settings->db_port()."';\n"; $tmp_config .= " \$db_name = '".$this->global_settings->db_name()."';\n"; $tmp_config .= " \$db_username = '".$this->global_settings->db_username()."';\n"; @@ -156,7 +162,9 @@ include "root.php"; $tmp_config .= "\n"; $tmp_config .= " //pgsql: database connection information\n"; if ($this->global_settings->db_type() == "pgsql") { - $tmp_config .= " \$db_host = '".$this->global_settings->db_host()."'; //set the host only if the database is not local\n"; + $cmt_out = ''; + if($this->global_settings->db_host() != 'localhost') { $cmt_out = "//"; } + $tmp_config .= " $cmt_out\$db_host = '".$this->global_settings->db_host()."'; //set the host only if the database is not local\n"; $tmp_config .= " \$db_port = '".$this->global_settings->db_port()."';\n"; $tmp_config .= " \$db_name = '".$this->global_settings->db_name()."';\n"; $tmp_config .= " \$db_username = '".$this->global_settings->db_username()."';\n"; @@ -191,16 +199,7 @@ include "root.php"; } protected function create_database() { - require $this->config_php; - global $db; - $db = $this->dbh; - $this->write_progress("\tUsing database as type " . $this->global_settings->db_type()); - if($this->global_settings->db_create() and strlen($this->global_settings->db_create_username()) == 0) - { - $this->global_settings->db_create_username() = $this->global_settings->db_username(); - $this->global_settings->db_create_password() = $this->global_settings->db_password(); - } $function = "create_database_" . $this->global_settings->db_type(); $this->$function(); @@ -288,7 +287,6 @@ include "root.php"; //Attempt to create new PG role and database $this->write_progress("\tCreating database"); try { - if (strlen($this->global_settings->db_port()) == 0) { $this->global_settings->db_port() = "5432"; } if (strlen($this->global_settings->db_host()) > 0) { $this->dbh = new PDO("pgsql:host={$this->global_settings->db_host()} port={$this->global_settings->db_port()} user={$this->global_settings->db_create_username()} password={$this->global_settings->db_create_password()} dbname=template1"); } else { @@ -318,7 +316,6 @@ include "root.php"; $this->write_progress("\tInstalling data to database"); //open database connection with $this->global_settings->db_name() try { - if (strlen($this->global_settings->db_port()) == 0) { $this->global_settings->db_port() = "5432"; } if (strlen($this->global_settings->db_host()) > 0) { $this->dbh = new PDO("pgsql:host={$this->global_settings->db_host()} port={$this->global_settings->db_port()} dbname={$this->global_settings->db_name()} user={$this->global_settings->db_username()} password={$this->global_settings->db_password()}"); } else { @@ -528,12 +525,14 @@ include "root.php"; $sql .= "limit 1"; $this->write_debug($sql); $prep_statement = $this->dbh->prepare(check_sql($sql)); - $prep_statement->execute(); + if($prep_statement->execute() === false){ + throw new Exception("Failed to search for domain: " . join(":", $this->dbh->errorInfo())); + } $result = $prep_statement->fetch(PDO::FETCH_NAMED); unset($sql, $prep_statement); if ($result) { - $this->_domain_uuid = $result['domain_uuid']; - $this->write_progress("... domain exists as '" . $this->_domain_uuid . "'"); + $this->global_settings->set_domain_uuid($result['domain_uuid']); + $this->write_progress("... domain exists as '" . $this->global_settings->domain_uuid() . "'"); if($result['domain_enabled'] != 'true'){ throw new Exception("Domain already exists but is disabled, this is unexpected"); } @@ -547,13 +546,15 @@ include "root.php"; $sql .= ") "; $sql .= "values "; $sql .= "("; - $sql .= "'".$this->_domain_uuid."', "; - $sql .= "'".$this->global_settings->domain_name."', "; - $sql .= "'' "; + $sql .= "'".$this->global_settings->domain_uuid()."', "; + $sql .= "'".$this->global_settings->domain_name()."', "; + $sql .= "'Default Domain' "; $sql .= ");"; $this->write_debug($sql); - $this->dbh->exec(check_sql($sql)); + if($this->dbh->exec(check_sql($sql)) === false){ + throw new Exception("Failed to execute sql statement: " . join(":", $this->dbh->errorInfo())); + } unset($sql); //domain settings @@ -596,73 +597,73 @@ include "root.php"; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->base_dir(); + $tmp[$x]['value'] = $this->global_settings->switch_base_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'base'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->conf_dir(); + $tmp[$x]['value'] = $this->global_settings->switch_conf_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'conf'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->db_dir()(); + $tmp[$x]['value'] = $this->global_settings->switch_db_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'db'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->log_dir(); + $tmp[$x]['value'] = $this->global_settings->switch_log_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'log'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->mod_dir(); + $tmp[$x]['value'] = $this->global_settings->switch_mod_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'mod'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->script_dir(); + $tmp[$x]['value'] = $this->global_settings->switch_script_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'scripts'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->grammar_dir(); + $tmp[$x]['value'] = $this->global_settings->switch_grammar_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'grammar'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->storage_dir(); + $tmp[$x]['value'] = $this->global_settings->switch_storage_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'storage'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->voicemail_vdir(); + $tmp[$x]['value'] = $this->global_settings->switch_voicemail_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'voicemail'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->recordings_dir(); + $tmp[$x]['value'] = $this->global_settings->switch_recordings_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'recordings'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->sounds_dir(); + $tmp[$x]['value'] = $this->global_settings->switch_sounds_dir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'sounds'; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->phrases_vdir(); + $tmp[$x]['value'] = $this->global_settings->switch_phrases_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'phrases'; $tmp[$x]['enabled'] = 'true'; @@ -674,19 +675,19 @@ include "root.php"; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->extensions_vdir(); + $tmp[$x]['value'] = $this->global_settings->switch_extensions_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'extensions'; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->sip_profiles_vdir(); + $tmp[$x]['value'] = $this->global_settings->switch_sip_profiles_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'sip_profiles'; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->dialplan_vdir(); + $tmp[$x]['value'] = $this->global_settings->switch_dialplan_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'dialplan'; $tmp[$x]['enabled'] = 'false'; @@ -694,7 +695,7 @@ include "root.php"; //server settings $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->temp_dir(); + $tmp[$x]['value'] = $this->global_settings->switch_temp_dir(); $tmp[$x]['category'] = 'server'; $tmp[$x]['subcategory'] = 'temp'; $tmp[$x]['enabled'] = 'true'; @@ -707,7 +708,7 @@ include "root.php"; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = $this->global_settings->backup_vdir(); + $tmp[$x]['value'] = $this->global_settings->switch_backup_vdir(); $tmp[$x]['category'] = 'server'; $tmp[$x]['subcategory'] = 'backup'; $tmp[$x]['enabled'] = 'true'; @@ -825,7 +826,7 @@ include "root.php"; protected function create_superuser() { $this->write_progress("\tChecking if superuser exists '" . $this->global_settings->domain_name . "'"); $sql = "select * from v_users "; - $sql .= "where domain_uuid = '".$this->_domain_uuid."' "; + $sql .= "where domain_uuid = '".$this->global_settings->domain_uuid()."' "; $sql .= "and username = '".$this->admin_username."' "; $sql .= "limit 1 "; $this->write_debug($sql); @@ -866,7 +867,7 @@ include "root.php"; $sql .= ") "; $sql .= "values "; $sql .= "("; - $sql .= "'".$this->_domain_uuid."', "; + $sql .= "'".$this->global_settings->domain_uuid()."', "; $sql .= "'".$this->admin_uuid."', "; $sql .= "'$contact_uuid', "; $sql .= "'".$this->admin_username."', "; @@ -881,7 +882,7 @@ include "root.php"; } $this->write_progress("\tChecking if superuser contact exists"); $sql = "select count(*) from v_contacts "; - $sql .= "where domain_uuid = '".$this->_domain_uuid."' "; + $sql .= "where domain_uuid = '".$this->global_settings->domain_uuid()."' "; $sql .= "and contact_name_given = '".$this->admin_username."' "; $sql .= "and contact_nickname = '".$this->admin_username."' "; $sql .= "limit 1 "; @@ -900,7 +901,7 @@ include "root.php"; $sql .= ") "; $sql .= "values "; $sql .= "("; - $sql .= "'".$this->_domain_uuid."', "; + $sql .= "'".$this->global_settings->domain_uuid()."', "; $sql .= "'$contact_uuid', "; $sql .= "'user', "; $sql .= "'".$this->admin_username."', "; @@ -911,7 +912,7 @@ include "root.php"; } $this->write_progress("\tChecking if superuser is in the correct group"); $sql = "select count(*) from v_group_users "; - $sql .= "where domain_uuid = '".$this->_domain_uuid."' "; + $sql .= "where domain_uuid = '".$this->global_settings->domain_uuid()."' "; $sql .= "and user_uuid = '".$this->admin_uuid."' "; $sql .= "and group_name = 'superadmin' "; $sql .= "limit 1 "; @@ -931,7 +932,7 @@ include "root.php"; $sql .= "values "; $sql .= "("; $sql .= "'".uuid()."', "; - $sql .= "'".$this->_domain_uuid."', "; + $sql .= "'".$this->global_settings->domain_uuid()."', "; $sql .= "'".$this->admin_uuid."', "; $sql .= "'superadmin' "; $sql .= ");"; @@ -994,7 +995,7 @@ include "root.php"; //set needed session settings $_SESSION["username"] = $this->admin_username; - $_SESSION["domain_uuid"] = $this->_domain_uuid; + $_SESSION["domain_uuid"] = $this->global_settings->domain_uuid(); require $this->config_php; require "resources/require.php"; $_SESSION['event_socket_ip_address'] = $this->global_settings->event_host; diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index f9fa1b9ec2..e2cd95dd00 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -35,10 +35,10 @@ include "root.php"; public $debug = false; function __construct($global_settings) { - if($global_settings == null){ + if(is_null($global_settings)){ require_once "resources/classes/global_settings.php"; $global_settings = new global_settings(); - elseif(!is_a($global_settings, 'global_settings')){ + }elseif(!is_a($global_settings, 'global_settings')){ throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)'); } $this->global_settings = $global_settings; @@ -98,8 +98,8 @@ include "root.php"; } } //This looks wrong, essentially if we can't use /bin/cp it manually fils dirs, not correct - $scripts_dir_target = $_SESSION['switch']['scripts']['dir']; - $scripts_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'); + $script_dir_target = $_SESSION['switch']['scripts']['dir']; + $script_dir_source = realpath($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src)) as $file_path_source) { if ( substr_count($file_path_source, '/..') == 0 && @@ -197,14 +197,14 @@ include "root.php"; function copy_conf() { $this->write_progress("\tCopying Config"); //make a backup of the config - if (file_exists($this->global_settings->conf_dir())) { - $this->backup_dir($this->global_settings->conf_dir(), 'fusionpbx_switch_config'); - $this->recursive_delete($this->global_settings->conf_dir()); + if (file_exists($this->global_settings->switch_conf_dir())) { + $this->backup_dir($this->global_settings->switch_conf_dir(), 'fusionpbx_switch_config'); + $this->recursive_delete($this->global_settings->switch_conf_dir()); } //make sure the conf directory exists - if (!is_dir($this->global_settings->conf_dir())) { - if (!mkdir($this->global_settings->conf_dir(), 0774, true)) { - throw new Exception("Failed to create the switch conf directory '".$this->global_settings->conf_dir()."'. "); + if (!is_dir($this->global_settings->switch_conf_dir())) { + if (!mkdir($this->global_settings->switch_conf_dir(), 0774, true)) { + throw new Exception("Failed to create the switch conf directory '".$this->global_settings->switch_conf_dir()."'. "); } } //copy resources/templates/conf to the freeswitch conf dir @@ -214,14 +214,14 @@ include "root.php"; else { $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf"; } - $dst_dir = $this->global_settings->conf_dir(); + $dst_dir = $this->global_settings->switch_conf_dir(); if (is_readable($dst_dir)) { $this->recursive_copy($src_dir, $dst_dir); unset($src_dir, $dst_dir); } - $fax_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->storage_dir(), 'fax')); + $fax_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'fax')); if (!is_readable($fax_dir)) { mkdir($fax_dir,0777,true); } - $voicemail_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->storage_dir(), 'voicemail')); + $voicemail_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'voicemail')); if (!is_readable($voicemail_dir)) { mkdir($voicemail_dir,0777,true); } //create the dialplan/default.xml for single tenant or dialplan/domain.xml @@ -229,7 +229,7 @@ include "root.php"; $dialplan = new dialplan; $dialplan->domain_uuid = $this->domain_uuid; $dialplan->domain = $this->domain_name; - $dialplan->switch_dialplan_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->conf_dir(), "/dialplan")); + $dialplan->switch_dialplan_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->switch_conf_dir(), "/dialplan")); $dialplan->restore_advanced_xml(); if($this->_debug){ print_r($dialplan->result, $message); @@ -243,7 +243,7 @@ include "root.php"; } //write the switch.conf.xml file - if (file_exists($this->global_settings->conf_dir())) { + if (file_exists($this->global_settings->switch_conf_dir())) { switch_conf_xml(); } @@ -251,7 +251,7 @@ include "root.php"; function copy_scripts() { $this->write_progress("\tCopying Scripts"); - $script_dir = $this->global_settings->script_dir(); + $script_dir = $this->global_settings->switch_script_dir(); if(strlen($script_dir) == 0) { throw new Exception("Cannot copy scripts the 'script_dir' is empty"); } @@ -271,7 +271,7 @@ include "root.php"; } chmod($dst_dir, 0774); }else{ - $this->write_progress("\tSkipping scripts, scripts_dir is unset"); + $this->write_progress("\tSkipping scripts, script_dir is unset"); } } @@ -332,8 +332,8 @@ include "root.php"; if (strlen($this->global_settings->switch_voicemail_vdir()) > 0) { $tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n"); } - if (strlen($this->global_settings->switch_scripts_dir()) > 0) { - $tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_scripts_dir()."]];\n"); + if (strlen($this->global_settings->switch_script_dir()) > 0) { + $tmp .= normalize_path_to_os(" script_dir = [[".$this->global_settings->switch_script_dir()."]];\n"); } $tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n"); if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { @@ -357,7 +357,6 @@ include "root.php"; $tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n"; } elseif ($this->global_settings->db_type() == "pgsql") { - if ($this->global_settings->db_host() == "localhost") { $this->global_settings->db_host() = "127.0.0.1"; } $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; } @@ -403,7 +402,7 @@ include "root.php"; $tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n"; $tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n"; $tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n"; - $tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n"; + $tmp .= " elseif (file_exists(script_dir..\"/resources/local.lua\")) then\n"; $tmp .= " require(\"resources.local\");\n"; $tmp .= " end\n"; fwrite($fout, $tmp); From 3f6fdc1df4784a957154a706a351b54be801b590 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 2 Dec 2015 14:17:53 +0000 Subject: [PATCH 179/232] added automatic odbc_database definition --- .../resources/classes/install_fusionpbx.php | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index b6c2dbb6bd..6571f15adf 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -217,7 +217,38 @@ include "root.php"; protected function create_odbc_database_connection() { //needed for non native database support - + $database_uuid = uuid(); + $sql = "insert into v_databases "; + $sql .= "("; + //$sql .= "domain_uuid, "; + $sql .= "database_uuid, "; + $sql .= "database_driver, "; + $sql .= "database_type, "; + $sql .= "database_host, "; + $sql .= "database_port, "; + $sql .= "database_name, "; + $sql .= "database_username, "; + $sql .= "database_password, "; + $sql .= "database_path, "; + $sql .= "database_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'$database_uuid', "; + $sql .= "'odbc', "; + $sql .= "'".$this->global_settings->db_type()."', "; + $sql .= "'".$this->global_settings->db_host()."', "; + $sql .= "'".$this->global_settings->db_port()."', "; + $sql .= "'".$this->global_settings->db_name()."', "; + $sql .= "'".$this->global_settings->db_username()."', "; + $sql .= "'".$this->global_settings->db_password()."', "; + $sql .= "'".$this->global_settings->db_path()."', "; + $sql .= "'Created by installer' "; + $sql .= ")"; + if($this->dbh->exec(check_sql($sql)) === false){ + throw new Exception("Failed to create odbc_database entery: " . join(":", $this->dbh->errorInfo())); + } + unset($sql); } protected function create_database_sqlite() { From b9b05f757c73e405ea917a3d34a8267c106f2bc6 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 2 Dec 2015 14:32:49 +0000 Subject: [PATCH 180/232] reorganised upgrade routine to make more sense --- core/install/install_first_time.php | 2 -- .../resources/classes/install_fusionpbx.php | 7 ++++++- .../resources/classes/install_switch.php | 20 ++++++++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php index 5a772e023e..896ec839fe 100644 --- a/core/install/install_first_time.php +++ b/core/install/install_first_time.php @@ -311,8 +311,6 @@ if(!$install_step) { $install_step = 'select_language'; } //$system->debug = true; $system->install(); $switch->install(); - $system->app_defaults(); - $detect_switch->restart_switch(); }catch(Exception $e){ echo "\n"; echo "

    Failed to install
    " . $e->getMessage() . "

    \n"; diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 6571f15adf..b35b21f917 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -91,8 +91,13 @@ include "root.php"; $this->write_progress("\tRunning requires"); require "resources/require.php"; $this->create_menus(); + $this->app_defaults(); $this->write_progress("Install complete for FusionPBX"); } + + function upgrade() { + $this->app_defaults(); + } protected function create_config_php() { $this->write_progress("\tCreating " . $this->config_php); @@ -1021,7 +1026,7 @@ include "root.php"; } } - public function app_defaults() { + protected function app_defaults() { $this->write_progress("\tRunning app_defaults"); //set needed session settings diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index e2cd95dd00..c0c8215059 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -186,15 +186,17 @@ include "root.php"; $this->copy_conf(); $this->copy_scripts(); $this->create_config_lua(); + $this->restart_switch(); $this->write_progress("Install completed for switch"); } function upgrade() { $this->copy_scripts(); $this->create_config_lua(); + $this->restart_switch(); } - function copy_conf() { + protected function copy_conf() { $this->write_progress("\tCopying Config"); //make a backup of the config if (file_exists($this->global_settings->switch_conf_dir())) { @@ -249,7 +251,7 @@ include "root.php"; } - function copy_scripts() { + protected function copy_scripts() { $this->write_progress("\tCopying Scripts"); $script_dir = $this->global_settings->switch_script_dir(); if(strlen($script_dir) == 0) { @@ -275,7 +277,7 @@ include "root.php"; } } - function create_config_lua() { + public function create_config_lua() { $this->write_progress("\tCreating " . $this->config_lua); global $db; //get the odbc information @@ -410,4 +412,16 @@ include "root.php"; fclose($fout); } } + + protected function restart_switch() { + global $errstr; + $esl = new EventSocket; + if (!$esl->connect($this->event_host, $this->event_port, $this->event_password)) { + throw new Exception("Failed to connect to switch: $errstr"); + } + if (!$esl->request('api fsctl shutdown restart elegant')){ + throw new Exception("Failed to send switch restart: $errstr"); + } + $esl->reset_fp(); + } ?> \ No newline at end of file From 86b945a997f637036606e504f1915d014d39f79d Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 2 Dec 2015 14:39:53 +0000 Subject: [PATCH 181/232] accidentally cancelled redirect during testing --- core/install/install_first_time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php index 896ec839fe..fd9472bfc4 100644 --- a/core/install/install_first_time.php +++ b/core/install/install_first_time.php @@ -326,7 +326,7 @@ if(!$install_step) { $install_step = 'select_language'; } restore_error_handler(); if($install_ok){ echo "\n"; - #header("Location: ".PROJECT_PATH."/logout.php"); + header("Location: ".PROJECT_PATH."/logout.php"); $_SESSION['message'] = 'Install complete'; }else{ echo "\n"; From 120ea2cc408bd67482ae64889563c25dc3070f4b Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 2 Dec 2015 14:46:03 +0000 Subject: [PATCH 182/232] Removed redundant code --- core/install/resources/classes/install_fusionpbx.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index b35b21f917..a2dd714b1a 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -34,11 +34,8 @@ include "root.php"; protected $menu_uuid = 'b4750c3f-2a86-b00d-b7d0-345c14eca286'; protected $dbh; - public function domain_uuid() { return $this->global_settings->domain_uuid(); } - public $debug = false; - public $install_msg; public $install_language = 'en-us'; public $admin_username; public $admin_password; @@ -225,7 +222,6 @@ include "root.php"; $database_uuid = uuid(); $sql = "insert into v_databases "; $sql .= "("; - //$sql .= "domain_uuid, "; $sql .= "database_uuid, "; $sql .= "database_driver, "; $sql .= "database_type, "; From 31619d8747103da7c2fca738823d14f168e590d2 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 2 Dec 2015 15:55:21 +0000 Subject: [PATCH 183/232] fixes during upgrade --- .../resources/classes/global_settings.php | 48 +++++++++++-------- .../resources/classes/install_switch.php | 23 +++++---- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/core/install/resources/classes/global_settings.php b/core/install/resources/classes/global_settings.php index 76612ed539..eb1cbfd2ef 100644 --- a/core/install/resources/classes/global_settings.php +++ b/core/install/resources/classes/global_settings.php @@ -78,7 +78,7 @@ require_once "root.php"; protected $_switch_sip_profiles_vdir = ''; protected $_switch_dialplan_vdir = ''; protected $_switch_backup_vdir = ''; - public function switch_voicemail_vdir() { return $this->_switch_voicemail_vdir; } + public function switch_voicemail_vdir() { return $this->_switch_voicemail_vdir; } public function switch_phrases_vdir() { return $this->_switch_phrases_vdir; } public function switch_extensions_vdir() { return $this->_switch_extensions_vdir; } public function switch_sip_profiles_vdir() { return $this->_switch_sip_profiles_vdir; } @@ -104,24 +104,24 @@ require_once "root.php"; protected $_db_create; protected $_db_create_username; protected $_db_create_password; - public function db_type() {return $this->_db_type; } - public function db_path() {return $this->_db_path; } - public function db_host() {return $this->_db_host; } - public function db_port() {return $this->_db_port; } - public function db_name() {return $this->_db_name; } - public function db_username() {return $this->_db_username; } - public function db_password() {return $this->_db_password; } - public function db_create() {return $this->_db_create; } - public function db_create_username() {return $this->_db_create_username; } - public function db_create_password() {return $this->_db_create_password; } + public function db_type() { return $this->_db_type; } + public function db_path() { return $this->_db_path; } + public function db_host() { return $this->_db_host; } + public function db_port() { return $this->_db_port; } + public function db_name() { return $this->_db_name; } + public function db_username() { return $this->_db_username; } + public function db_password() { return $this->_db_password; } + public function db_create() { return $this->_db_create; } + public function db_create_username() { return $this->_db_create_username; } + public function db_create_password() { return $this->_db_create_password; } //misc information protected $_domain_uuid; protected $_domain_name; protected $_domain_count; - public function domain_uuid() {return $this->_domain_uuid; } - public function domain_name() {return $this->_domain_name; } - public function domain_count() {return $this->_domain_count; } + public function domain_uuid() { return $this->_domain_uuid; } + public function domain_name() { return $this->_domain_name; } + public function domain_count() { return $this->_domain_count; } public function set_domain_uuid($domain_uuid) { $e = new Exception(); $trace = $e->getTrace(); @@ -143,17 +143,20 @@ require_once "root.php"; } foreach ($this->_switch_dirs as $dir){ $session_var; - preg_match( '/^switch_.*_dir$/', $dir, $session_var); - $this->$dir = $_SESSION['switch'][$session_var[0]]['dir']; + preg_match( '/^switch_(.*)_dir$/', $dir, $session_var); + $dir = "_$dir"; + if($session_var[1] == 'script'){ $session_var[1] = 'scripts'; } + $this->$dir = $_SESSION['switch'][$session_var[1]]['dir']; } foreach ($this->_switch_vdirs as $vdir){ $session_var; - preg_match( '/^switch_.*_vdir$/', $vdir, $session_var); - $this->$vdir = $_SESSION['switch'][$session_var[0]]['dir']; + preg_match( '/^switch_(.*)_vdir$/', $vdir, $session_var); + $vdir = "_$vdir"; + $this->$vdir = $_SESSION['switch'][$session_var[1]]['dir']; } - $this->switch_event_host = $_SESSION['event_socket_ip_address']; - $this->switch_event_port = $_SESSION['event_socket_port']; - $this->switch_event_password = $_SESSION['event_socket_password']; + $this->_switch_event_host = $_SESSION['event_socket_ip_address']; + $this->_switch_event_port = $_SESSION['event_socket_port']; + $this->_switch_event_password = $_SESSION['event_socket_password']; // domain info $this->_domain_name = $_SESSION['domain_name']; @@ -185,6 +188,9 @@ require_once "root.php"; $t_vdir = "_switch_$vdir"; $this->$t_vdir = $detect_switch->$vdir(); } + $this->_switch_event_host = $detect_switch->event_host; + $this->_switch_event_port = $detect_switch->event_port; + $this->_switch_event_password = $detect_switch->event_password; //copy from _POST foreach($_POST as $key=>$value){ diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index c0c8215059..bc4036fdc2 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -36,7 +36,7 @@ include "root.php"; function __construct($global_settings) { if(is_null($global_settings)){ - require_once "resources/classes/global_settings.php"; + require_once "core/install/resources/classes/global_settings.php"; $global_settings = new global_settings(); }elseif(!is_a($global_settings, 'global_settings')){ throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)'); @@ -411,17 +411,16 @@ include "root.php"; unset($tmp); fclose($fout); } - } - - protected function restart_switch() { - global $errstr; - $esl = new EventSocket; - if (!$esl->connect($this->event_host, $this->event_port, $this->event_password)) { - throw new Exception("Failed to connect to switch: $errstr"); + + protected function restart_switch() { + $esl = new EventSocket; + if(!$esl->connect($this->global_settings->switch_event_host(), $this->global_settings->switch_event_port(), $this->global_settings->switch_event_password())) { + throw new Exception("Failed to connect to switch"); + } + if (!$esl->request('api fsctl shutdown restart elegant')){ + throw new Exception("Failed to send switch restart"); + } + $esl->reset_fp(); } - if (!$esl->request('api fsctl shutdown restart elegant')){ - throw new Exception("Failed to send switch restart: $errstr"); - } - $esl->reset_fp(); } ?> \ No newline at end of file From 96a22b5321fd6fbc6a99ec98c39c0d6be415c7d0 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 2 Dec 2015 16:07:23 +0000 Subject: [PATCH 184/232] made reference to install resource literal --- resources/classes/domains.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/classes/domains.php b/resources/classes/domains.php index 5ea36058bf..2c2bbadee1 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -369,6 +369,10 @@ if (function_exists('save_dialplan_xml')) { save_dialplan_xml(); } + //update config.lua + require_once "core/install/resources/classes/install_switch.php"; + $switch = new install_switch; + $switch->create_config_lua(); //clear the session variables unset($_SESSION['domain']); From 7f0f8ff1cd0a83c853ab72ebc844ba9723afa79d Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 2 Dec 2015 20:36:47 -0700 Subject: [PATCH 185/232] Change ntp server variable for Cisco 7940 and 7960 ntp_server_primary. --- resources/templates/provision/cisco/7940/SIP{$mac}.cnf | 2 +- resources/templates/provision/cisco/7960/SIP{$mac}.cnf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf index 2d9adbd63f..4a4bb88bdb 100644 --- a/resources/templates/provision/cisco/7940/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7940/SIP{$mac}.cnf @@ -93,7 +93,7 @@ tftp_cfg_dir: "" # Time Server sntp_mode: "unicast" -sntp_server: "{$sntp_server}" +sntp_server: "{$ntp_server_primary}" {if isset($cisco_time_zone)} time_zone: "{$cisco_time_zone}" {/if} diff --git a/resources/templates/provision/cisco/7960/SIP{$mac}.cnf b/resources/templates/provision/cisco/7960/SIP{$mac}.cnf index 2d9adbd63f..4a4bb88bdb 100644 --- a/resources/templates/provision/cisco/7960/SIP{$mac}.cnf +++ b/resources/templates/provision/cisco/7960/SIP{$mac}.cnf @@ -93,7 +93,7 @@ tftp_cfg_dir: "" # Time Server sntp_mode: "unicast" -sntp_server: "{$sntp_server}" +sntp_server: "{$ntp_server_primary}" {if isset($cisco_time_zone)} time_zone: "{$cisco_time_zone}" {/if} From 9bc96195c1702e831899496b8da17a87f222f0e3 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 09:52:53 +0000 Subject: [PATCH 186/232] corrected references to scripts --- core/install/resources/classes/install_switch.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index bc4036fdc2..3e34071dae 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -46,8 +46,8 @@ include "root.php"; $this->config_lua = "/etc/fusionpbx/config.lua"; }elseif (is_dir("/usr/local/etc/fusionpbx")){ $this->config_lua = "/usr/local/etc/fusionpbx/config.lua"; - }elseif(strlen($this->global_settings->script_dir) > 0) { - $this->config_lua = $this->global_settings->script_dir."/resources/config.lua"; + }elseif(strlen($this->global_settings->switch_script_dir()) > 0) { + $this->config_lua = $this->global_settings->switch_script_dir()."/resources/config.lua"; }else{ throw new Exception("Could not work out where to put the config.lua"); } @@ -193,7 +193,6 @@ include "root.php"; function upgrade() { $this->copy_scripts(); $this->create_config_lua(); - $this->restart_switch(); } protected function copy_conf() { @@ -335,7 +334,7 @@ include "root.php"; $tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n"); } if (strlen($this->global_settings->switch_script_dir()) > 0) { - $tmp .= normalize_path_to_os(" script_dir = [[".$this->global_settings->switch_script_dir()."]];\n"); + $tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_script_dir()."]];\n"); } $tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n"); if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { From f3f24c40858f1c931ebe44caacbd4154fcdc266d Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 10:40:54 +0000 Subject: [PATCH 187/232] add caveat when the config.lua is inside scripts\resources due to app_defaults running before install_switch create_config_lua cannot create it's config if the detected folder is scripts\resources\ this solves this by adding a caveat to create it's parent folder when it is called resources --- core/install/resources/classes/install_switch.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 3e34071dae..2df6ac189f 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -278,6 +278,14 @@ include "root.php"; public function create_config_lua() { $this->write_progress("\tCreating " . $this->config_lua); + $dirs = array_pop(explode("/", normalize_path($config_path))); + $path = normalize_path_to_os(join("/", $dirs)); + if($dirs[(sizeof($dirs)-1)] == 'resources' and !file_exists($path)){ + if (!mkdir($path, 0755, true)) { + throw new Exception("Failed to create the missing resources directory '$path'"); + } + } + global $db; //get the odbc information $sql = "select count(*) as num_rows from v_databases "; From 5149307d1120e4a9190a2555f59c7b2cb19812ba Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 10:49:38 +0000 Subject: [PATCH 188/232] corrected path retrieval for test added missing () when reporting domain name --- core/install/resources/classes/install_fusionpbx.php | 4 ++-- core/install/resources/classes/install_switch.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index a2dd714b1a..513581c628 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -551,9 +551,9 @@ include "root.php"; } protected function create_domain() { - $this->write_progress("\tChecking if domain exists '" . $this->global_settings->domain_name . "'"); + $this->write_progress("\tChecking if domain exists '" . $this->global_settings->domain_name() . "'"); $sql = "select * from v_domains "; - $sql .= "where domain_name = '".$this->global_settings->domain_name."' "; + $sql .= "where domain_name = '".$this->global_settings->domain_name()."' "; $sql .= "limit 1"; $this->write_debug($sql); $prep_statement = $this->dbh->prepare(check_sql($sql)); diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 2df6ac189f..da76e40dd8 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -278,9 +278,10 @@ include "root.php"; public function create_config_lua() { $this->write_progress("\tCreating " . $this->config_lua); - $dirs = array_pop(explode("/", normalize_path($config_path))); + $dirs = array_pop(explode("/", normalize_path($this->config_lua))); $path = normalize_path_to_os(join("/", $dirs)); if($dirs[(sizeof($dirs)-1)] == 'resources' and !file_exists($path)){ + $this->write_progress("\t... creating missing '$path'"); if (!mkdir($path, 0755, true)) { throw new Exception("Failed to create the missing resources directory '$path'"); } From cc3f8e9945c0a244698b0990b98429c8a392c832 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 11:19:09 +0000 Subject: [PATCH 189/232] changed path handling for create_config_lua thanks moteus for the hint --- core/install/resources/classes/install_fusionpbx.php | 4 ++-- core/install/resources/classes/install_switch.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 513581c628..cf1cee1076 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -856,7 +856,7 @@ include "root.php"; } protected function create_superuser() { - $this->write_progress("\tChecking if superuser exists '" . $this->global_settings->domain_name . "'"); + $this->write_progress("\tChecking if superuser exists '" . $this->admin_username . "'"); $sql = "select * from v_users "; $sql .= "where domain_uuid = '".$this->global_settings->domain_uuid()."' "; $sql .= "and username = '".$this->admin_username."' "; @@ -877,7 +877,7 @@ include "root.php"; $this->write_debug($sql); $this->dbh->exec(check_sql($sql)); }else{ - $this->write_progress("\t... creating super user '" . $this->admin_username . "'"); + $this->write_progress("\t... creating super user"); //add a user and then add the user to the superadmin group //prepare the values $this->admin_uuid = uuid(); diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index da76e40dd8..36db511cf4 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -278,9 +278,9 @@ include "root.php"; public function create_config_lua() { $this->write_progress("\tCreating " . $this->config_lua); - $dirs = array_pop(explode("/", normalize_path($this->config_lua))); - $path = normalize_path_to_os(join("/", $dirs)); - if($dirs[(sizeof($dirs)-1)] == 'resources' and !file_exists($path)){ + $path = dirname($this->config_lua); + $parent_dir = basename($path); + if($parent_dir == 'resources' and !file_exists($path)){ $this->write_progress("\t... creating missing '$path'"); if (!mkdir($path, 0755, true)) { throw new Exception("Failed to create the missing resources directory '$path'"); @@ -412,7 +412,7 @@ include "root.php"; $tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n"; $tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n"; $tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n"; - $tmp .= " elseif (file_exists(script_dir..\"/resources/local.lua\")) then\n"; + $tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n"; $tmp .= " require(\"resources.local\");\n"; $tmp .= " end\n"; fwrite($fout, $tmp); From 68cd03d598e1d31887455a288f3e22267b36ba00 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 11:36:29 +0000 Subject: [PATCH 190/232] added workaround for lua not resolving localhost --- core/install/resources/classes/install_switch.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 36db511cf4..dd64ee1d60 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -367,8 +367,10 @@ include "root.php"; $tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n"; } elseif ($this->global_settings->db_type() == "pgsql") { - $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; - $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; + $lua_db_host = $this->global_settings->db_host(); + if($lua_db_host == 'localhost') { $lua_db_host = '127.0.0.1'; } // lua cannot resolve localhost + $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; + $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; } elseif ($this->global_settings->db_type() == "sqlite") { $tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n"; From e036c88c99184236f895a3e8c076f9a29b31a7b7 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 11:55:40 +0000 Subject: [PATCH 191/232] fixed storage of domain_count --- core/install/resources/classes/global_settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/install/resources/classes/global_settings.php b/core/install/resources/classes/global_settings.php index eb1cbfd2ef..b93bc371fb 100644 --- a/core/install/resources/classes/global_settings.php +++ b/core/install/resources/classes/global_settings.php @@ -163,7 +163,7 @@ require_once "root.php"; $this->_domain_uuid = $_SESSION['domain_uuid']; // collect misc info - $this->domain_count = count($_SESSION["domains"]); + $this->_domain_count = count($_SESSION["domains"]); // collect db_info global $db_type, $db_path, $db_host, $db_port, $db_name, $db_username, $db_password; From 875f0a62622a76e6310037cfde796439302508c6 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 13:36:43 +0000 Subject: [PATCH 192/232] added save_switch_xml during install --- core/install/index.php | 4 ---- core/install/resources/classes/install_switch.php | 1 + themes/enhanced/app_defaults.php | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/install/index.php b/core/install/index.php index 1eb6efc8c9..36d012f0f7 100644 --- a/core/install/index.php +++ b/core/install/index.php @@ -78,10 +78,6 @@ if (!if_group("superadmin")) { echo "\n"; echo "\n"; - echo "

    "; - - echo "

    WiP

    "; - //include the footer require_once "resources/footer.php"; ?> \ No newline at end of file diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index dd64ee1d60..3af53476c8 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -186,6 +186,7 @@ include "root.php"; $this->copy_conf(); $this->copy_scripts(); $this->create_config_lua(); + save_switch_xml(); $this->restart_switch(); $this->write_progress("Install completed for switch"); } diff --git a/themes/enhanced/app_defaults.php b/themes/enhanced/app_defaults.php index 333fb6efca..5080029782 100644 --- a/themes/enhanced/app_defaults.php +++ b/themes/enhanced/app_defaults.php @@ -287,7 +287,7 @@ if ($domains_processed == 1) { $array[$x]['default_setting_category'] = 'theme'; $array[$x]['default_setting_subcategory'] = 'background_color'; $array[$x]['default_setting_name'] = 'array'; - $array[$x]['default_setting_value'] = '#ffffff'; + $array[$x]['default_setting_value'] = '#6c89b5'; $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_order'] = '0'; $array[$x]['default_setting_description'] = 'Set a background (HTML compatible) color.'; @@ -295,7 +295,7 @@ if ($domains_processed == 1) { $array[$x]['default_setting_category'] = 'theme'; $array[$x]['default_setting_subcategory'] = 'background_color'; $array[$x]['default_setting_name'] = 'array'; - $array[$x]['default_setting_value'] = '#e7ebf1'; + $array[$x]['default_setting_value'] = '#144794'; $array[$x]['default_setting_order'] = '1'; $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_description'] = 'Set a secondary background (HTML compatible) color, for a gradient effect.'; From 7ce32f11d4da1cf6c661296969f2bbd16bcf8bd4 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 14:25:33 +0000 Subject: [PATCH 193/232] corrected function name --- core/install/resources/classes/install_switch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 27efa25e3c..bdf9a2c48b 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -188,7 +188,7 @@ include "root.php"; $this->write_progress("Install phase 1 completed for switch"); } - function install_phase_1() { + function install_phase_2() { $this->write_progress("Install phase 2 started for switch"); $this->create_config_lua(); $this->restart_switch(); From fb4edcdd7474491dbc5b3548b8998d0d1164b32d Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 14:59:46 +0000 Subject: [PATCH 194/232] added suppression of progress by default --- core/install/install_first_time.php | 2 ++ core/install/resources/classes/install_fusionpbx.php | 5 ++++- core/install/resources/classes/install_switch.php | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php index dcc7e04ade..1b629de24b 100644 --- a/core/install/install_first_time.php +++ b/core/install/install_first_time.php @@ -309,6 +309,8 @@ if(!$install_step) { $install_step = 'select_language'; } $switch = new install_switch($global_settings); //$switch->debug = true; //$system->debug = true; + $switch->echo_progress = true; + $system->echo_progress = true; $system->install_phase_1(); $switch->install_phase_1(); $system->install_phase_2(); diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 28bed4cd17..41d28ca92c 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -35,6 +35,7 @@ include "root.php"; protected $dbh; public $debug = false; + public $echo_progress = false; public $install_language = 'en-us'; public $admin_username; @@ -71,7 +72,9 @@ include "root.php"; } function write_progress($message) { - echo "$message\n"; + if($this->echo_progress){ + echo "$message\n"; + } } function install_phase_1() { diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index bdf9a2c48b..3fb3950cb6 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -33,6 +33,7 @@ include "root.php"; protected $dbh; public $debug = false; + public $echo_progress = false; function __construct($global_settings) { if(is_null($global_settings)){ @@ -63,7 +64,9 @@ include "root.php"; } function write_progress($message) { - echo "$message\n"; + if($this->echo_progress){ + echo "$message\n"; + } } //$options '-n' --no-clobber From 47ff30bce07efc10b074aae3d526e673218186d8 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 15:42:52 +0000 Subject: [PATCH 195/232] fix to the external IPv6 --- .../templates/conf/sip_profiles/external-ipv6.xml.noload | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/templates/conf/sip_profiles/external-ipv6.xml.noload b/resources/templates/conf/sip_profiles/external-ipv6.xml.noload index 4a4b4028ee..b980a94d1b 100644 --- a/resources/templates/conf/sip_profiles/external-ipv6.xml.noload +++ b/resources/templates/conf/sip_profiles/external-ipv6.xml.noload @@ -58,8 +58,8 @@ - - + + From a62cafb40292a49f5fb0c4944791f74730742027 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 3 Dec 2015 10:29:33 -0700 Subject: [PATCH 196/232] Update the provision file download to work with domain filter set to false. --- app/devices/device_edit.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 6039ea02bb..e7064dfeb6 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -547,7 +547,13 @@ require_once "resources/require.php"; echo " function download(d) {\n"; echo " if (d == '".$text['label-download']."') return;\n"; - echo " window.location = 'https://".$_SESSION['domain_name']."/app/provision?mac=$device_mac_address&file=' + d + '&content_type=application/octet-stream';\n"; + if ($_SESSION['provision']['http_domain_filter']['text'] == "false") { + $domain_name = $_SERVER["HTTP_HOST"]; + } + else { + $domain_name = $_SESSION['domain_name']; + } + echo " window.location = 'https://".$domain_name."/app/provision?mac=$device_mac_address&file=' + d + '&content_type=application/octet-stream';\n"; echo " }\n"; echo "\n"; From c543c42ffaa4325d34235d0646b8ea1a29d23873 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 4 Dec 2015 12:57:30 +0300 Subject: [PATCH 197/232] Change. Use path with domain name for faxes for single tenant installation. --- app/fax/fax_edit.php | 7 +------ app/fax/fax_files.php | 2 +- app/fax/fax_files_remote.php | 2 +- app/fax/fax_send.php | 2 +- app/fax/resources/classes/fax.php | 7 +------ 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index e690d06739..77a473567a 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -53,12 +53,7 @@ else { } //set the fax directory - if (count($_SESSION["domains"]) > 1) { - $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name']; - } - else { - $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'; - } + $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name']; //get the fax extension if (strlen($fax_extension) > 0) { diff --git a/app/fax/fax_files.php b/app/fax/fax_files.php index 8f83b675dd..bb08fa837d 100644 --- a/app/fax/fax_files.php +++ b/app/fax/fax_files.php @@ -86,7 +86,7 @@ else { } //set the fax directory - $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.((count($_SESSION["domains"]) > 1) ? '/'.$_SESSION['domain_name'] : null); + $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name']; //download the fax if ($_GET['a'] == "download") { diff --git a/app/fax/fax_files_remote.php b/app/fax/fax_files_remote.php index ddc87a7dca..28c5d76b83 100644 --- a/app/fax/fax_files_remote.php +++ b/app/fax/fax_files_remote.php @@ -135,7 +135,7 @@ else { if (imap_delete($connection, $email_id, FT_UID)) { if (imap_expunge($connection)) { //clean up local inbox copy - $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.((count($_SESSION["domains"]) > 1) ? '/'.$_SESSION['domain_name'] : null); + $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name']; @unlink($fax_dir.'/'.$fax_extension.'/inbox/'.$attachment[0]['filename']); //redirect user $_SESSION["message"] = $text['message-delete']; diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index b5491287a0..aabf063277 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -101,7 +101,7 @@ if (!$included) { } //set the fax directory - $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.((count($_SESSION["domains"]) > 1) ? '/'.$_SESSION['domain_name'] : null); + $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name']; // set fax cover font to generate pdf $fax_cover_font = $_SESSION['fax']['cover_font']['text']; diff --git a/app/fax/resources/classes/fax.php b/app/fax/resources/classes/fax.php index b86627c44c..0100aeaeaa 100644 --- a/app/fax/resources/classes/fax.php +++ b/app/fax/resources/classes/fax.php @@ -174,12 +174,7 @@ $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "rxfax"; - if (count($_SESSION["domains"]) > 1) { - $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'].'/'.$this->fax_extension.'/inbox/'.$this->forward_prefix.'${last_fax}.tif'; - } - else { - $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'].'/fax/'.$this->fax_extension.'/inbox/'.$this->forward_prefix.'${last_fax}.tif'; - } + $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'].'/'.$this->fax_extension.'/inbox/'.$this->forward_prefix.'${last_fax}.tif'; $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1"; $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10; $y++; From 0be63dff0e7d01a40e2e7b6af44af5d431ca1533 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Fri, 4 Dec 2015 12:18:11 +0000 Subject: [PATCH 198/232] Add git information to system info --- app/system/app_languages.php | 10 ++++++++++ app/system/system.php | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/system/app_languages.php b/app/system/app_languages.php index 0906685a9b..e367817dea 100644 --- a/app/system/app_languages.php +++ b/app/system/app_languages.php @@ -80,6 +80,16 @@ $text['label-os']['sv-se'] = "Operativsystem"; $text['label-os']['uk'] = "Операційна система "; $text['label-os']['de-at'] = "Betriebssystem"; +$text['label-git-info']['en-us'] = "Git Information"; +$text['label-git-info']['es-cl'] = ""; +$text['label-git-info']['pt-pt'] = ""; +$text['label-git-info']['fr-fr'] = ""; +$text['label-git-info']['pt-br'] = ""; +$text['label-git-info']['pl'] = ""; +$text['label-git-info']['sv-se'] = ""; +$text['label-git-info']['uk'] = ""; +$text['label-git-info']['de-at'] = ""; + $text['label-memcache_status']['en-us'] = "Memcache Status"; $text['label-memcache_status']['es-cl'] = "Estado de Memcache"; $text['label-memcache_status']['pt-pt'] = "Estado da Memcache"; diff --git a/app/system/system.php b/app/system/system.php index eb77d27d99..4c72da3862 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -85,6 +85,24 @@ $document['title'] = $text['title-sys-status']; echo " \n"; echo "\n"; + $git_path = normalize_path_to_os($_SERVER["DOCUMENT_ROOT"]."/.git"); + $git_branch = shell_exec('git --git-dir='.$git_path.' name-rev --name-only HEAD'); + rtrim($git_branch); + $git_commit = shell_exec('git --git-dir='.$git_path.' rev-parse HEAD'); + rtrim($git_commit); + $git_origin = shell_exec('git --git-dir='.$git_path.' config --get remote.origin.url'); + rtrim($git_commit); + echo "\n"; + echo " \n"; + echo " ".$text['label-git-info']."\n"; + echo " \n"; + echo " \n"; + echo " Branch: '$git_branch'
    \n"; + echo " Commit: '$git_commit'
    \n"; + echo " Origin: '$git_origin'
    \n"; + echo " \n"; + echo "\n"; + echo "\n"; From 36652ff231ea8c91750fe0548e1dc9f7df11876e Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Fri, 4 Dec 2015 12:24:22 +0000 Subject: [PATCH 199/232] use DOCUMENT_ROOT rather than assume path --- core/upgrade/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/upgrade/index.php b/core/upgrade/index.php index d51b012718..376c7b54d8 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -53,7 +53,7 @@ if (sizeof($_POST) > 0) { // run source update if ($do["source"] && permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx")) { - chdir("/var/www/fusionpbx/"); + chdir($_SERVER["DOCUMENT_ROOT"]); exec("git pull", $response_source_update); $update_failed = true; if (sizeof($response_source_update) > 0) { From 5c8aa45d449cd954021f4d1ee107f1ecd1d06952 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 4 Dec 2015 16:18:53 +0300 Subject: [PATCH 200/232] Fix. send_mail without file. --- resources/install/scripts/resources/functions/send_mail.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/install/scripts/resources/functions/send_mail.lua b/resources/install/scripts/resources/functions/send_mail.lua index 52f8e647e4..430983ed2e 100644 --- a/resources/install/scripts/resources/functions/send_mail.lua +++ b/resources/install/scripts/resources/functions/send_mail.lua @@ -90,7 +90,7 @@ if freeswitch then if file then freeswitch.email(address, address, mail_headers, body, file) else - freeswitch.email(address, address, mail_headers, body, file) + freeswitch.email(address, address, mail_headers, body) end end end From f01439a2bb9f90f411943137f2889111f14221ee Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 4 Dec 2015 21:14:33 +0300 Subject: [PATCH 201/232] Fix. send fax by user listed in fax server list --- app/fax/fax_send.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index b5491287a0..917b925758 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -58,13 +58,17 @@ if (!$included) { $fax_uuid = check_str($_REQUEST["id"]); if (if_group("superadmin") || if_group("admin")) { //show all fax extensions - $sql = "select * from v_fax "; + $sql = "select fax_uuid, fax_extension, fax_caller_id_name, fax_caller_id_number, "; + $sql .= "accountcode, fax_send_greeting "; + $sql .= "from v_fax "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and fax_uuid = '$fax_uuid' "; } else { //show only assigned fax extensions - $sql = "select * from v_fax as f, v_fax_users as u "; + $sql = "select f.fax_uuid, f.fax_extension, f.fax_caller_id_name, f.fax_caller_id_number, "; + $sql .= "f.accountcode, f.fax_send_greeting "; + $sql .= "from v_fax as f, v_fax_users as u "; $sql .= "where f.fax_uuid = u.fax_uuid "; $sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and f.fax_uuid = '$fax_uuid' "; From 5291abfe174868b00e354660a83500dfb9fa6d74 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 4 Dec 2015 17:35:02 -0700 Subject: [PATCH 202/232] Update the wakeup phrases. --- .../templates/conf/lang/en/ivr/wakeup.xml | 151 ++++++++++-------- 1 file changed, 85 insertions(+), 66 deletions(-) diff --git a/resources/templates/conf/lang/en/ivr/wakeup.xml b/resources/templates/conf/lang/en/ivr/wakeup.xml index 8c41736405..7ce070c06f 100644 --- a/resources/templates/conf/lang/en/ivr/wakeup.xml +++ b/resources/templates/conf/lang/en/ivr/wakeup.xml @@ -5,49 +5,51 @@ - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,13 +59,7 @@ - - - - - - - + @@ -73,13 +69,10 @@ - - - + - - - + + @@ -90,13 +83,20 @@ - - - - - - - + + + + + + + + + + + + + + @@ -104,26 +104,45 @@ - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - + + - + \ No newline at end of file From 85f84e0ef62d1e56bbec0379b256c6222f926026 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 10:02:24 -0700 Subject: [PATCH 203/232] Create a new app_uuid when creating a dialplan however when copying a time condition, inbound and outbound route keep the original app_uuid. --- app/dialplan/dialplan_copy.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/dialplan/dialplan_copy.php b/app/dialplan/dialplan_copy.php index c99d664145..1160fc769f 100644 --- a/app/dialplan/dialplan_copy.php +++ b/app/dialplan/dialplan_copy.php @@ -77,6 +77,15 @@ else { } unset ($prep_statement); +//copy the app_uuid only for specific dialplans + switch ($app_uuid) { + case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": //inbound routes + case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes + case "4b821450-926b-175a-af93-a03c441818b1": //time conditions + default: + $app_uuid = null; + } + //copy the dialplan $dialplan_uuid = uuid(); $sql = "insert into v_dialplans "; @@ -95,7 +104,12 @@ else { $sql .= "("; $sql .= "'".$domain_uuid."', "; $sql .= "'$dialplan_uuid', "; - $sql .= "'$app_uuid', "; + if ($app_uuid == null) { + $sql .= "null, "; + } + else { + $sql .= "'$app_uuid', "; + } $sql .= "'".$dialplan_name."-copy', "; $sql .= "'$dialplan_order', "; $sql .= "'$dialplan_continue', "; From c02713a3bd9afff1807012b3cc003d1b4a6f3e7e Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 10:13:22 -0700 Subject: [PATCH 204/232] Use set and unset instead. --- app/dialplan/dialplan_copy.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/dialplan/dialplan_copy.php b/app/dialplan/dialplan_copy.php index 1160fc769f..8d295a4b7f 100644 --- a/app/dialplan/dialplan_copy.php +++ b/app/dialplan/dialplan_copy.php @@ -83,7 +83,7 @@ else { case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes case "4b821450-926b-175a-af93-a03c441818b1": //time conditions default: - $app_uuid = null; + unset($app_uuid); } //copy the dialplan @@ -104,11 +104,11 @@ else { $sql .= "("; $sql .= "'".$domain_uuid."', "; $sql .= "'$dialplan_uuid', "; - if ($app_uuid == null) { - $sql .= "null, "; + if (isset($app_uuid)) { + $sql .= "'$app_uuid', "; } else { - $sql .= "'$app_uuid', "; + $sql .= "null, "; } $sql .= "'".$dialplan_name."-copy', "; $sql .= "'$dialplan_order', "; From c7ce4dade0f2d2149b6d651595a56414b26e999a Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 10:26:10 -0700 Subject: [PATCH 205/232] Change how the app_uuid is handled on device copy. --- app/dialplan/dialplan_copy.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/dialplan/dialplan_copy.php b/app/dialplan/dialplan_copy.php index 8d295a4b7f..de81736106 100644 --- a/app/dialplan/dialplan_copy.php +++ b/app/dialplan/dialplan_copy.php @@ -77,13 +77,13 @@ else { } unset ($prep_statement); -//copy the app_uuid only for specific dialplans +//create a new app_uuid when copying a dialplan except for these exceptions switch ($app_uuid) { case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": //inbound routes case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes case "4b821450-926b-175a-af93-a03c441818b1": //time conditions default: - unset($app_uuid); + $app_uuid = uuid(); } //copy the dialplan @@ -104,12 +104,7 @@ else { $sql .= "("; $sql .= "'".$domain_uuid."', "; $sql .= "'$dialplan_uuid', "; - if (isset($app_uuid)) { - $sql .= "'$app_uuid', "; - } - else { - $sql .= "null, "; - } + $sql .= "'$app_uuid', "; $sql .= "'".$dialplan_name."-copy', "; $sql .= "'$dialplan_order', "; $sql .= "'$dialplan_continue', "; From b4e3ee5b0ddb160a16cca95c28519520f8b5c055 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 12:25:34 -0700 Subject: [PATCH 206/232] Detect the host type for PostgreSQL so it works with host or ip address. Also improve the code consistency by correcting the indentation and adding a few more comments. --- .../resources/classes/global_settings.php | 4 +- .../resources/classes/install_switch.php | 279 +++++++++--------- 2 files changed, 147 insertions(+), 136 deletions(-) diff --git a/core/install/resources/classes/global_settings.php b/core/install/resources/classes/global_settings.php index b93bc371fb..251153e5d2 100644 --- a/core/install/resources/classes/global_settings.php +++ b/core/install/resources/classes/global_settings.php @@ -35,7 +35,7 @@ require_once "root.php"; public function get_switch_dirs() { return $this->_switch_dirs; } public function get_switch_vdirs() { return $this->_switch_vdirs; } - // dirs - detected by from the switch + // dirs - detected from the switch protected $_switch_base_dir = ''; protected $_switch_cache_dir = ''; protected $_switch_certs_dir = ''; @@ -157,7 +157,7 @@ require_once "root.php"; $this->_switch_event_host = $_SESSION['event_socket_ip_address']; $this->_switch_event_port = $_SESSION['event_socket_port']; $this->_switch_event_password = $_SESSION['event_socket_password']; - + // domain info $this->_domain_name = $_SESSION['domain_name']; $this->_domain_uuid = $_SESSION['domain_uuid']; diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 3fb3950cb6..5b5e953c80 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -285,149 +285,160 @@ include "root.php"; } public function create_config_lua() { - $this->write_progress("\tCreating " . $this->config_lua); - $path = dirname($this->config_lua); - $parent_dir = basename($path); - if($parent_dir == 'resources' and !file_exists($path)){ - $this->write_progress("\t... creating missing '$path'"); - if (!mkdir($path, 0755, true)) { - throw new Exception("Failed to create the missing resources directory '$path'"); - } - } - - global $db; - //get the odbc information - $sql = "select count(*) as num_rows from v_databases "; - $sql .= "where database_driver = 'odbc' "; - if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - unset($prep_statement); - if ($row['num_rows'] > 0) { - $odbc_num_rows = $row['num_rows']; - $sql = "select * from v_databases "; - $sql .= "where database_driver = 'odbc' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - $dsn_name = $row["database_name"]; - $dsn_username = $row["database_username"]; - $dsn_password = $row["database_password"]; - break; //limit to 1 row + //define the database connection as global + global $db; + + //send progress + $this->write_progress("\tCreating " . $this->config_lua); + + //set the directories + $path = dirname($this->config_lua); + $parent_dir = basename($path); + if ($parent_dir == 'resources' and !file_exists($path)){ + $this->write_progress("\t... creating missing '$path'"); + if (!mkdir($path, 0755, true)) { + throw new Exception("Failed to create the missing resources directory '$path'"); } - unset ($prep_statement); + } + + //get the odbc information + $sql = "select count(*) as num_rows from v_databases "; + $sql .= "where database_driver = 'odbc' "; + if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] > 0) { + $odbc_num_rows = $row['num_rows']; + $sql = "select * from v_databases "; + $sql .= "where database_driver = 'odbc' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $dsn_name = $row["database_name"]; + $dsn_username = $row["database_username"]; + $dsn_password = $row["database_password"]; + break; //limit to 1 row + } + unset ($prep_statement); + } + else { + $odbc_num_rows = '0'; + } + } + + //config.lua + $fout = fopen($this->config_lua,"w"); + if(!$fout){ + throw new Exception("Failed to open '".$this->config_lua."' for writing"); + } + $tmp = "\n"; + $tmp .= "--set the variables\n"; + if (strlen($this->global_settings->switch_sounds_dir()) > 0) { + $tmp .= normalize_path_to_os(" sounds_dir = [[".$this->global_settings->switch_sounds_dir()."]];\n"); + } + if (strlen($this->global_settings->switch_phrases_vdir()) > 0) { + $tmp .= normalize_path_to_os(" phrases_dir = [[".$this->global_settings->switch_phrases_vdir()."]];\n"); + } + if (strlen($this->global_settings->switch_db_dir()) > 0) { + $tmp .= normalize_path_to_os(" database_dir = [[".$this->global_settings->switch_db_dir()."]];\n"); + } + if (strlen($this->global_settings->switch_recordings_dir()) > 0) { + $tmp .= normalize_path_to_os(" recordings_dir = [[".$this->global_settings->switch_recordings_dir()."]];\n"); + } + if (strlen($this->global_settings->switch_storage_dir()) > 0) { + $tmp .= normalize_path_to_os(" storage_dir = [[".$this->global_settings->switch_storage_dir()."]];\n"); + } + if (strlen($this->global_settings->switch_voicemail_vdir()) > 0) { + $tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n"); + } + if (strlen($this->global_settings->switch_script_dir()) > 0) { + $tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_script_dir()."]];\n"); + } + $tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n"); + if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { + $tmp .= " php_bin = \"php.exe\";\n"; } else { - $odbc_num_rows = '0'; + $tmp .= " php_bin = \"php\";\n"; } - } + $tmp .= normalize_path_to_os(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n"); + $tmp .= "\n"; - //config.lua - $fout = fopen($this->config_lua,"w"); - if(!$fout){ - throw new Exception("Failed to open '".$this->config_lua."' for writing"); - } - $tmp = "\n"; - $tmp .= "--set the variables\n"; - if (strlen($this->global_settings->switch_sounds_dir()) > 0) { - $tmp .= normalize_path_to_os(" sounds_dir = [[".$this->global_settings->switch_sounds_dir()."]];\n"); - } - if (strlen($this->global_settings->switch_phrases_vdir()) > 0) { - $tmp .= normalize_path_to_os(" phrases_dir = [[".$this->global_settings->switch_phrases_vdir()."]];\n"); - } - if (strlen($this->global_settings->switch_db_dir()) > 0) { - $tmp .= normalize_path_to_os(" database_dir = [[".$this->global_settings->switch_db_dir()."]];\n"); - } - if (strlen($this->global_settings->switch_recordings_dir()) > 0) { - $tmp .= normalize_path_to_os(" recordings_dir = [[".$this->global_settings->switch_recordings_dir()."]];\n"); - } - if (strlen($this->global_settings->switch_storage_dir()) > 0) { - $tmp .= normalize_path_to_os(" storage_dir = [[".$this->global_settings->switch_storage_dir()."]];\n"); - } - if (strlen($this->global_settings->switch_voicemail_vdir()) > 0) { - $tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n"); - } - if (strlen($this->global_settings->switch_script_dir()) > 0) { - $tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_script_dir()."]];\n"); - } - $tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n"); - if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { - $tmp .= " php_bin = \"php.exe\";\n"; - } - else { - $tmp .= " php_bin = \"php\";\n"; - } - $tmp .= normalize_path_to_os(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n"); - $tmp .= "\n"; + if ((strlen($this->global_settings->db_type()) > 0) || (strlen($dsn_name) > 0)) { + $tmp .= "--database information\n"; + $tmp .= " database = {}\n"; + $tmp .= " database[\"type\"] = \"".$this->global_settings->db_type()."\";\n"; + $tmp .= " database[\"name\"] = \"".$this->global_settings->db_name()."\";\n"; + $tmp .= normalize_path_to_os(" database[\"path\"] = [[".$this->global_settings->db_path()."]];\n"); - if ((strlen($this->global_settings->db_type()) > 0) || (strlen($dsn_name) > 0)) { - $tmp .= "--database information\n"; - $tmp .= " database = {}\n"; - $tmp .= " database[\"type\"] = \"".$this->global_settings->db_type()."\";\n"; - $tmp .= " database[\"name\"] = \"".$this->global_settings->db_name()."\";\n"; - $tmp .= normalize_path_to_os(" database[\"path\"] = [[".$this->global_settings->db_path()."]];\n"); - - if (strlen($dsn_name) > 0) { - $tmp .= " database[\"system\"] = \"odbc://".$dsn_name.":".$dsn_username.":".$dsn_password."\";\n"; - $tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n"; + if (strlen($dsn_name) > 0) { + $tmp .= " database[\"system\"] = \"odbc://".$dsn_name.":".$dsn_username.":".$dsn_password."\";\n"; + $tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n"; + } + elseif ($this->global_settings->db_type() == "pgsql") { + $db_host = $this->global_settings->db_host(); + if (filter_var($db_host, FILTER_VALIDATE_IP)) { + $host_type = "hostaddr"; + } + else { + $host_type = "host"; + } + if($db_host == 'localhost') { $db_host = '127.0.0.1'; } // lua cannot resolve localhost + $tmp .= " database[\"system\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; + $tmp .= " database[\"switch\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; + } + elseif ($this->global_settings->db_type() == "sqlite") { + $tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n"; + $tmp .= " database[\"switch\"] = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n"; + } + elseif ($this->global_settings->db_type() == "mysql") { + $tmp .= " database[\"system\"] = \"\";\n"; + $tmp .= " database[\"switch\"] = \"\";\n"; + } + $tmp .= "\n"; } - elseif ($this->global_settings->db_type() == "pgsql") { - $lua_db_host = $this->global_settings->db_host(); - if($lua_db_host == 'localhost') { $lua_db_host = '127.0.0.1'; } // lua cannot resolve localhost - $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; - $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; - } - elseif ($this->global_settings->db_type() == "sqlite") { - $tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n"; - $tmp .= " database[\"switch\"] = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n"; - } - elseif ($this->global_settings->db_type() == "mysql") { - $tmp .= " database[\"system\"] = \"\";\n"; - $tmp .= " database[\"switch\"] = \"\";\n"; + $tmp .= "--set defaults\n"; + $tmp .= " expire = {}\n"; + $tmp .= " expire[\"directory\"] = \"3600\";\n"; + $tmp .= " expire[\"dialplan\"] = \"3600\";\n"; + $tmp .= " expire[\"languages\"] = \"3600\";\n"; + $tmp .= " expire[\"sofia.conf\"] = \"3600\";\n"; + $tmp .= " expire[\"acl.conf\"] = \"3600\";\n"; + $tmp .= "\n"; + $tmp .= "--set xml_handler\n"; + $tmp .= " xml_handler = {}\n"; + $tmp .= " xml_handler[\"fs_path\"] = false;\n"; + $tmp .= "\n"; + $tmp .= "--set the debug options\n"; + $tmp .= " debug[\"params\"] = false;\n"; + $tmp .= " debug[\"sql\"] = false;\n"; + $tmp .= " debug[\"xml_request\"] = false;\n"; + $tmp .= " debug[\"xml_string\"] = false;\n"; + $tmp .= " debug[\"cache\"] = false;\n"; + $tmp .= "\n"; + $tmp .= "--additional info\n"; + $tmp .= " domain_count = ".$this->global_settings->domain_count().";\n"; + $tmp .= normalize_path_to_os(" temp_dir = [[".$this->global_settings->switch_temp_dir()."]];\n"); + if (isset($_SESSION['domain']['dial_string']['text'])) { + $tmp .= " dial_string = \"".$_SESSION['domain']['dial_string']['text']."\";\n"; } $tmp .= "\n"; - } - $tmp .= "--set defaults\n"; - $tmp .= " expire = {}\n"; - $tmp .= " expire[\"directory\"] = \"3600\";\n"; - $tmp .= " expire[\"dialplan\"] = \"3600\";\n"; - $tmp .= " expire[\"languages\"] = \"3600\";\n"; - $tmp .= " expire[\"sofia.conf\"] = \"3600\";\n"; - $tmp .= " expire[\"acl.conf\"] = \"3600\";\n"; - $tmp .= "\n"; - $tmp .= "--set xml_handler\n"; - $tmp .= " xml_handler = {}\n"; - $tmp .= " xml_handler[\"fs_path\"] = false;\n"; - $tmp .= "\n"; - $tmp .= "--set the debug options\n"; - $tmp .= " debug[\"params\"] = false;\n"; - $tmp .= " debug[\"sql\"] = false;\n"; - $tmp .= " debug[\"xml_request\"] = false;\n"; - $tmp .= " debug[\"xml_string\"] = false;\n"; - $tmp .= " debug[\"cache\"] = false;\n"; - $tmp .= "\n"; - $tmp .= "--additional info\n"; - $tmp .= " domain_count = ".$this->global_settings->domain_count().";\n"; - $tmp .= normalize_path_to_os(" temp_dir = [[".$this->global_settings->switch_temp_dir()."]];\n"); - if (isset($_SESSION['domain']['dial_string']['text'])) { - $tmp .= " dial_string = \"".$_SESSION['domain']['dial_string']['text']."\";\n"; - } - $tmp .= "\n"; - $tmp .= "--include local.lua\n"; - $tmp .= " require(\"resources.functions.file_exists\");\n"; - $tmp .= " if (file_exists(\"/etc/fusionpbx/local.lua\")) then\n"; - $tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n"; - $tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n"; - $tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n"; - $tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n"; - $tmp .= " require(\"resources.local\");\n"; - $tmp .= " end\n"; - fwrite($fout, $tmp); - unset($tmp); - fclose($fout); + $tmp .= "--include local.lua\n"; + $tmp .= " require(\"resources.functions.file_exists\");\n"; + $tmp .= " if (file_exists(\"/etc/fusionpbx/local.lua\")) then\n"; + $tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n"; + $tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n"; + $tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n"; + $tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n"; + $tmp .= " require(\"resources.local\");\n"; + $tmp .= " end\n"; + fwrite($fout, $tmp); + unset($tmp); + fclose($fout); } protected function restart_switch() { From 16abb2849f29d3f1fbb1af793ece6f125d8a3419 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 12:36:08 -0700 Subject: [PATCH 207/232] Remove the domain name from the switch recordings SESSION variable. The path for single and multi-tenant are handled the same and all will used their domain name. --- resources/classes/domains.php | 39 ----------------------------------- 1 file changed, 39 deletions(-) diff --git a/resources/classes/domains.php b/resources/classes/domains.php index 2c2bbadee1..c0cc1e751f 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -186,30 +186,6 @@ //set the context $_SESSION["context"] = $_SESSION["domain_name"]; - //recordings add the domain to the path if there is more than one domains - if (count($_SESSION["domains"]) > 1) { - if (strlen($_SESSION['switch']['recordings']['dir']) > 0) { - if (substr($_SESSION['switch']['recordings']['dir'], -strlen($_SESSION["domain_name"])) != $_SESSION["domain_name"]) { - //get the default recordings directory - $sql = "select * from v_default_settings "; - $sql .= "where default_setting_enabled = 'true' "; - $sql .= "and default_setting_category = 'switch' "; - $sql .= "and default_setting_subcategory = 'recordings' "; - $sql .= "and default_setting_name = 'dir' "; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - $result_default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result_default_settings as $row) { - $name = $row['default_setting_name']; - $category = $row['default_setting_category']; - $subcategory = $row['default_setting_subcategory']; - $switch_recordings_dir = $row['default_setting_value']; - } - //add the domain - $_SESSION['switch']['recordings']['dir'] = $switch_recordings_dir . '/' . $_SESSION["domain_name"]; - } - } - } } public function upgrade() { @@ -272,16 +248,6 @@ $prep_statement->execute(); $result_default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); - //get the default recordings directory - foreach($result_default_settings as $row) { - $name = $row['default_setting_name']; - $category = $row['default_setting_category']; - $subcategory = $row['default_setting_subcategory']; - if ($category == 'switch' && $subcategory == 'recordings' && $name == 'dir') { - $switch_recordings_dir = $row['default_setting_value']; - } - } - //loop through all domains $sql = "select * from v_domains "; $v_prep_statement = $db->prepare(check_sql($sql)); @@ -349,11 +315,6 @@ } } - //set the recordings directory - if (strlen($switch_recordings_dir) > 1 && count($_SESSION["domains"]) > 1) { - $_SESSION['switch']['recordings']['dir'] = $switch_recordings_dir."/".$domain_name; - } - //get the list of installed apps from the core and mod directories and execute the php code in app_defaults.php $default_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_defaults.php"); foreach ($default_list as &$default_path) { From 622efef416c5ca8277f4a63d9377a4c3f9d765d9 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 12:43:18 -0700 Subject: [PATCH 208/232] Convert localhost to 127.0.0.1 before determining the host_type. --- core/install/resources/classes/install_switch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 5b5e953c80..0e7fbf5803 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -381,13 +381,13 @@ include "root.php"; } elseif ($this->global_settings->db_type() == "pgsql") { $db_host = $this->global_settings->db_host(); + if($db_host == 'localhost') { $db_host = '127.0.0.1'; } // lua cannot resolve localhost if (filter_var($db_host, FILTER_VALIDATE_IP)) { $host_type = "hostaddr"; } else { $host_type = "host"; } - if($db_host == 'localhost') { $db_host = '127.0.0.1'; } // lua cannot resolve localhost $tmp .= " database[\"system\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; $tmp .= " database[\"switch\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; } From cde9debb2934b9c2d4c147c85a86c14bcfc040c7 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 13:37:35 -0700 Subject: [PATCH 209/232] After removing domain name from the default recordings dir path need to add the domain name every where the recordings directory is currently used. --- app/call_broadcast/call_broadcast_send.php | 12 +++---- app/call_centers/call_center_queue_edit.php | 2 +- app/calls_active/calls_active.php | 2 +- app/calls_active/calls_active_inc.php | 2 +- app/calls_active/calls_exec.php | 6 ++-- app/click_to_call/click_to_call.php | 2 +- .../conference_center_edit.php | 12 +++---- .../conference_session_details.php | 2 +- .../conference_sessions.php | 2 +- app/conferences_active/conference_exec.php | 4 +-- .../conference_interactive_inc.php | 2 +- app/ivr_menus/ivr_menu_edit.php | 32 +++++++++---------- .../classes/switch_music_on_hold.php | 2 +- app/operator_panel/index.php | 2 +- app/phrases/app_defaults.php | 6 ++-- app/phrases/phrase_edit.php | 4 +-- app/recordings/app_defaults.php | 8 ++--- app/recordings/recording_delete.php | 4 +-- app/recordings/recording_edit.php | 2 +- app/recordings/recordings.php | 24 +++++++------- app/xml_cdr/v_xml_cdr_import.php | 2 +- app/xml_cdr/xml_cdr.php | 2 +- app/xml_cdr/xml_cdr_delete.php | 4 +-- app/xml_cdr/xml_cdr_details.php | 10 +++--- core/domain_settings/domain_delete.php | 2 +- core/domain_settings/domain_edit.php | 4 +-- .../scripts/app/conference_center/index.lua | 11 ++++--- .../resources/scripts/start_recording.lua | 6 ++-- .../install/scripts/app/dialplan/index.lua | 1 - resources/install/scripts/fifo_member.lua | 1 - resources/install/scripts/ivr_menu.lua | 6 ++-- resources/install/scripts/recordings.lua | 16 ++-------- 32 files changed, 92 insertions(+), 105 deletions(-) diff --git a/app/call_broadcast/call_broadcast_send.php b/app/call_broadcast/call_broadcast_send.php index 1ccf411c42..3041391e16 100644 --- a/app/call_broadcast/call_broadcast_send.php +++ b/app/call_broadcast/call_broadcast_send.php @@ -260,10 +260,10 @@ require_once "resources/header.php"; $phone_1 = preg_replace('{\D}', '', $tmp_value_array[0]); if ($gateway == "loopback") { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } else { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } echo $cmd."
    \n"; cmd_async($cmd); @@ -335,20 +335,20 @@ require_once "resources/header.php"; //make the call if (strlen($phone_1)> 0) { if ($gateway == "loopback") { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } else { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } //echo $cmd."
    \n"; cmd_async($cmd); } if (strlen($phone_2)> 0) { if ($gateway == "loopback") { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_2."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_2."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } else { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_2." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_2." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } //echo $cmd."
    \n"; cmd_async($cmd); diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index 6f9a00809d..81ce4acbfb 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -739,7 +739,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; $record_ext=($_SESSION['record_ext']=='mp3'?'mp3':'wav'); - $record_template = $_SESSION['switch']['recordings']['dir']."/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.".$record_ext; + $record_template = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.".$record_ext; echo " \n"; echo " \n"; //recordings - if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) { + if($dh = opendir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/")) { $tmp_selected = false; $files = Array(); echo "\n"; while ($file = readdir($dh)) { if ($file != "." && $file != ".." && $file[0] != '.') { - if (!is_dir($_SESSION['switch']['recordings']['dir']."/".$file)) { - $selected = ($conference_center_greeting == $_SESSION['switch']['recordings']['dir']."/".$file && strlen($conference_center_greeting) > 0) ? true : false; - echo " \n"; + if (!is_dir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file)) { + $selected = ($conference_center_greeting == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file && strlen($conference_center_greeting) > 0) ? true : false; + echo " \n"; if ($selected) { $tmp_selected = true; } } } @@ -393,8 +393,8 @@ else { if (permission_exists('conference_center_add') || permission_exists('conference_center_edit')) { if (!$tmp_selected) { echo "\n"; - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$conference_center_greeting)) { - echo " \n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$conference_center_greeting)) { + echo " \n"; } else if (substr($conference_center_greeting, -3) == "wav" || substr($conference_center_greeting, -3) == "mp3") { echo " \n"; diff --git a/app/conference_centers/conference_session_details.php b/app/conference_centers/conference_session_details.php index eeea9296c1..1ed402ab62 100644 --- a/app/conference_centers/conference_session_details.php +++ b/app/conference_centers/conference_session_details.php @@ -77,7 +77,7 @@ else { echo " \n"; echo " ".$text['title-conference_session_details']."\n"; echo " \n"; - $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; $tmp_name = ''; if (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.mp3')) { $tmp_name = $row['conference_session_uuid'].".mp3"; diff --git a/app/conference_centers/conference_sessions.php b/app/conference_centers/conference_sessions.php index eecd71e4fb..4c669ac46a 100644 --- a/app/conference_centers/conference_sessions.php +++ b/app/conference_centers/conference_sessions.php @@ -146,7 +146,7 @@ else { echo " ".$start_date." \n"; echo " ".$end_date." \n"; echo " ".$row['profile']." \n"; - $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; $tmp_name = ''; if (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.mp3')) { $tmp_name = $row['conference_session_uuid'].".mp3"; diff --git a/app/conferences_active/conference_exec.php b/app/conferences_active/conference_exec.php index f21af3adbb..2b5419aa3d 100644 --- a/app/conferences_active/conference_exec.php +++ b/app/conferences_active/conference_exec.php @@ -141,7 +141,7 @@ else { $switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value); } elseif ($data == "record") { - $recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); + $recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); $switch_cmd .= $recording_dir."/".$uuid.".wav"; if (!file_exists($recording_dir."/".$uuid.".wav")) { $switch_result = event_socket_request($fp, "api ".$switch_cmd); @@ -149,7 +149,7 @@ else { } elseif ($data == "norecord") { //stop recording and rename the file - $recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); + $recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); $switch_cmd .= $recording_dir."/".$uuid.".wav"; $switch_result = event_socket_request($fp, 'api '.$switch_cmd); } diff --git a/app/conferences_active/conference_interactive_inc.php b/app/conferences_active/conference_interactive_inc.php index 2c3a989593..0b9fbcf0ad 100644 --- a/app/conferences_active/conference_interactive_inc.php +++ b/app/conferences_active/conference_interactive_inc.php @@ -104,7 +104,7 @@ else { echo " \n"; echo "\n"; - $recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); + $recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); $recording_name = ''; if (file_exists($recording_dir.'/'.$row['uuid'].'.wav')) { $recording_name = $session_uuid.".wav"; diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index eb85e04752..40a40e3d24 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -440,9 +440,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($recordings as &$row) { $recording_name = $row["recording_name"]; $recording_filename = $row["recording_filename"]; - if ($ivr_menu_greet_long == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_greet_long) > 0) { + if ($ivr_menu_greet_long == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_greet_long) > 0) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else if ($ivr_menu_greet_long == $recording_filename && strlen($ivr_menu_greet_long) > 0) { $tmp_selected = true; @@ -500,8 +500,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (if_group("superadmin")) { if (!$tmp_selected) { echo "\n"; - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_long)) { - echo " \n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_long)) { + echo " \n"; } else if (substr($ivr_menu_greet_long, -3) == "wav" || substr($ivr_menu_greet_long, -3) == "mp3") { echo " \n"; @@ -538,9 +538,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($recordings as &$row) { $recording_name = $row["recording_name"]; $recording_filename = $row["recording_filename"]; - if ($ivr_menu_greet_short == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_greet_short) > 0) { + if ($ivr_menu_greet_short == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_greet_short) > 0) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else if ($ivr_menu_greet_short == $recording_filename && strlen($ivr_menu_greet_short) > 0) { $tmp_selected = true; @@ -599,8 +599,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (if_group("superadmin")) { if (!$tmp_selected && strlen($ivr_menu_greet_short) > 0) { echo "\n"; - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_short)) { - echo " \n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_short)) { + echo " \n"; } else if (substr($ivr_menu_greet_short, -3) == "wav" || substr($ivr_menu_greet_short, -3) == "mp3") { echo " \n"; @@ -877,9 +877,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($recordings as &$row) { $recording_name = $row["recording_name"]; $recording_filename = $row["recording_filename"]; - if ($ivr_menu_invalid_sound == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_invalid_sound) > 0) { + if ($ivr_menu_invalid_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_invalid_sound) > 0) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else if ($ivr_menu_invalid_sound == $recording_filename && strlen($ivr_menu_invalid_sound) > 0) { $tmp_selected = true; @@ -935,8 +935,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (if_group("superadmin")) { if (!$tmp_selected) { echo "\n"; - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_invalid_sound)) { - echo " \n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_invalid_sound)) { + echo " \n"; } else if (substr($ivr_menu_invalid_sound, -3) == "wav" || substr($ivr_menu_invalid_sound, -3) == "mp3") { echo " \n"; @@ -973,9 +973,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($recordings as &$row) { $recording_name = $row["recording_name"]; $recording_filename = $row["recording_filename"]; - if ($ivr_menu_exit_sound == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_exit_sound) > 0) { + if ($ivr_menu_exit_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_exit_sound) > 0) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else if ($ivr_menu_exit_sound == $recording_filename && strlen($ivr_menu_exit_sound) > 0) { $tmp_selected = true; @@ -1031,8 +1031,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (if_group("superadmin")) { if (!$tmp_selected) { echo "\n"; - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_exit_sound)) { - echo " \n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_exit_sound)) { + echo " \n"; } else if (substr($ivr_menu_exit_sound, -3) == "wav" || substr($ivr_menu_exit_sound, -3) == "mp3") { echo " \n"; diff --git a/app/music_on_hold/resources/classes/switch_music_on_hold.php b/app/music_on_hold/resources/classes/switch_music_on_hold.php index 3e3aaf1e01..40bc2ba8e4 100644 --- a/app/music_on_hold/resources/classes/switch_music_on_hold.php +++ b/app/music_on_hold/resources/classes/switch_music_on_hold.php @@ -90,7 +90,7 @@ include "root.php"; } } //recordings - if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) { + if($dh = opendir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/")) { $tmp_selected = false; $files = Array(); //$select .= "\n"; diff --git a/app/operator_panel/index.php b/app/operator_panel/index.php index daa77ee8bd..481696d0ba 100644 --- a/app/operator_panel/index.php +++ b/app/operator_panel/index.php @@ -357,7 +357,7 @@ require_once "resources/header.php"; } function get_record_cmd(uuid) { - cmd = "uuid_record " + uuid + " start /archive////" + uuid + ".wav"; + cmd = "uuid_record " + uuid + " start /archive////" + uuid + ".wav"; return cmd; } diff --git a/app/phrases/app_defaults.php b/app/phrases/app_defaults.php index 43f23c3b08..1d707c96b6 100644 --- a/app/phrases/app_defaults.php +++ b/app/phrases/app_defaults.php @@ -109,8 +109,8 @@ if ($domains_processed == 1) { foreach ($result as &$row) { $phrase_detail_uuid = $row['phrase_detail_uuid']; $phrase_detail_data = $row['phrase_detail_data']; - if (substr_count($phrase_detail_data, $_SESSION['switch']['recordings']['dir']) > 0) { - $phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/', '', $phrase_detail_data); + if (substr_count($phrase_detail_data, $_SESSION['switch']['recordings']['dir'].'/'.$domain_name) > 0) { + $phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/', '', $phrase_detail_data); } //update function and data to be base64 compatible $phrase_detail_data = "lua(streamfile.lua ".$phrase_detail_data.")"; @@ -141,7 +141,7 @@ if ($domains_processed == 1) { $phrase_detail_data = str_replace('lua(streamfile.lua ', '', $phrase_detail_data); $phrase_detail_data = str_replace(')', '', $phrase_detail_data); if (substr_count($phrase_detail_data, '/') === 0) { - $phrase_detail_data = $_SESSION['switch']['recordings']['dir'].'/'.$phrase_detail_data; + $phrase_detail_data = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/'.$phrase_detail_data; } $sql = "update v_phrase_details set "; $sql .= "phrase_detail_function = 'play-file', "; diff --git a/app/phrases/phrase_edit.php b/app/phrases/phrase_edit.php index 387255a9bb..512bdef71a 100644 --- a/app/phrases/phrase_edit.php +++ b/app/phrases/phrase_edit.php @@ -305,7 +305,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"lua(streamfile.lua ".$row["recording_filename"].")\"));\n"; } else { - echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"".$_SESSION['switch']['recordings']['dir'].'/'.$row["recording_filename"]."\"));\n"; + echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"".$_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row["recording_filename"]."\"));\n"; } } echo "obj_action.appendChild(opt_group);\n"; @@ -470,7 +470,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } if ($field['phrase_detail_function'] == 'play-file') { $phrase_detail_function = $text['label-play']; - $phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/', '', $field['phrase_detail_data']); + $phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/', '', $field['phrase_detail_data']); } echo "\n"; echo " ".$phrase_detail_function." \n"; diff --git a/app/recordings/app_defaults.php b/app/recordings/app_defaults.php index 1d2552b251..7e22c12191 100644 --- a/app/recordings/app_defaults.php +++ b/app/recordings/app_defaults.php @@ -25,8 +25,8 @@ */ //if the recordings directory doesn't exist then create it - if (strlen($_SESSION['switch']['recordings']['dir']) > 0) { - if (!is_readable($_SESSION['switch']['recordings']['dir'])) { mkdir($_SESSION['switch']['recordings']['dir'],0777,true); } + if (strlen($_SESSION['switch']['recordings']['dir']."/".$domain_name) > 0) { + if (!is_readable($_SESSION['switch']['recordings']['dir']."/".$domain_name)) { mkdir($_SESSION['switch']['recordings']['dir']."/".$domain_name,0777,true); } } if ($domains_processed == 1) { @@ -45,7 +45,7 @@ if ($domains_processed == 1) { $recording_domain_uuid = $row['domain_uuid']; $recording_filename = $row['recording_filename']; //set recording directory - $recording_directory = $_SESSION['switch']['recordings']['dir']; + $recording_directory = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name; //encode recording file (if exists) if (file_exists($recording_directory.'/'.$recording_filename)) { $recording_base64 = base64_encode(file_get_contents($recording_directory.'/'.$recording_filename)); @@ -78,7 +78,7 @@ if ($domains_processed == 1) { $recording_filename = $row['recording_filename']; $recording_base64 = $row['recording_base64']; //set recording directory - $recording_directory = $_SESSION['switch']['recordings']['dir']; + $recording_directory = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name; //remove local file, if any if (file_exists($recording_directory.'/'.$recording_filename)) { @unlink($recording_directory.'/'.$recording_filename); diff --git a/app/recordings/recording_delete.php b/app/recordings/recording_delete.php index b460300109..9738b8756a 100644 --- a/app/recordings/recording_delete.php +++ b/app/recordings/recording_delete.php @@ -66,8 +66,8 @@ if (strlen($id)>0) { unset($sql); //delete the recording - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$filename)) { - @unlink($_SESSION['switch']['recordings']['dir']."/".$filename); + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$filename)) { + @unlink($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$filename); } } diff --git a/app/recordings/recording_edit.php b/app/recordings/recording_edit.php index e5d29ce62b..e4b6bc6187 100644 --- a/app/recordings/recording_edit.php +++ b/app/recordings/recording_edit.php @@ -83,7 +83,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (permission_exists('recording_edit')) { //if file name is not the same then rename the file if ($recording_filename != $recording_filename_original) { - rename($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename_original, $_SESSION['switch']['recordings']['dir'].'/'.$recording_filename); + rename($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename_original, $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename); } //update the database with the new data diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php index 97843d156d..c12e09d01e 100644 --- a/app/recordings/recordings.php +++ b/app/recordings/recordings.php @@ -49,7 +49,7 @@ require_once "resources/check_auth.php"; if ($_GET['a'] == "download" && (permission_exists('recording_play') || permission_exists('recording_download'))) { session_cache_limiter('public'); if ($_GET['type'] = "rec") { - $path = $_SESSION['switch']['recordings']['dir']; + $path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']; //if from recordings, get recording details from db $recording_uuid = check_str($_GET['id']); //recordings @@ -115,7 +115,7 @@ require_once "resources/check_auth.php"; if ($_POST['submit'] == $text['button-upload'] && $_POST['type'] == 'rec' && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { $recording_filename = str_replace(" ", "_", $_FILES['ulfile']['name']); $recording_filename = str_replace("'", "", $recording_filename); - move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['switch']['recordings']['dir'].'/'.$recording_filename); + move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename); $_SESSION['message'] = $text['message-uploaded'].": ".htmlentities($recording_filename); @@ -146,9 +146,9 @@ require_once "resources/check_auth.php"; $array_base64_exists[$row['recording_uuid']] = ($row['recording_base64'] != '') ? true : false; //if not base64, convert back to local files and remove base64 from db if ($_SESSION['recordings']['storage_type']['text'] != 'base64' && $row['recording_base64'] != '') { - if (!file_exists($_SESSION['switch']['recordings']['dir'].'/'.$row['recording_filename'])) { + if (!file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename'])) { $recording_decoded = base64_decode($row['recording_base64']); - file_put_contents($_SESSION['switch']['recordings']['dir'].'/'.$row['recording_filename'], $recording_decoded); + file_put_contents($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename'], $recording_decoded); $sql = "update v_recordings set recording_base64 = null where domain_uuid = '".$domain_uuid."' and recording_uuid = '".$row['recording_uuid']."' "; $db->exec(check_sql($sql)); unset($sql); @@ -158,10 +158,10 @@ require_once "resources/check_auth.php"; unset ($prep_statement); //add recordings to the database - if (is_dir($_SESSION['switch']['recordings']['dir'].'/')) { - if ($dh = opendir($_SESSION['switch']['recordings']['dir'].'/')) { + if (is_dir($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/')) { + if ($dh = opendir($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/')) { while (($recording_filename = readdir($dh)) !== false) { - if (filetype($_SESSION['switch']['recordings']['dir']."/".$recording_filename) == "file") { + if (filetype($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename) == "file") { if (!in_array($recording_filename, $array_recordings)) { //file not found in db, add it @@ -187,7 +187,7 @@ require_once "resources/check_auth.php"; $sql .= "'".$recording_name."', "; $sql .= "'".$recording_description."' "; if ($_SESSION['recordings']['storage_type']['text'] == 'base64') { - $recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename)); + $recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename)); $sql .= ", '".$recording_base64."' "; } $sql .= ")"; @@ -199,7 +199,7 @@ require_once "resources/check_auth.php"; if ($_SESSION['recordings']['storage_type']['text'] == 'base64') { $found_recording_uuid = array_search($recording_filename, $array_recordings); if (!$array_base64_exists[$found_recording_uuid]) { - $recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename)); + $recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename)); $sql = "update v_recordings set "; $sql .= "recording_base64 = '".$recording_base64."' "; $sql .= "where domain_uuid = '".$domain_uuid."' "; @@ -211,8 +211,8 @@ require_once "resources/check_auth.php"; } //if base64, remove local file - if ($_SESSION['recordings']['storage_type']['text'] == 'base64' && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename)) { - @unlink($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename); + if ($_SESSION['recordings']['storage_type']['text'] == 'base64' && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename)) { + @unlink($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename); } } @@ -307,7 +307,7 @@ require_once "resources/check_auth.php"; echo " ".$row['recording_name']."\n"; if ($_SESSION['recordings']['storage_type']['text'] != 'base64') { echo " ".$row['recording_filename']."\n"; - $tmp_filesize = filesize($_SESSION['switch']['recordings']['dir'].'/'.$row['recording_filename']); + $tmp_filesize = filesize($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename']); $tmp_filesize = byte_convert($tmp_filesize); echo " ".$tmp_filesize."\n"; } diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index 4dfce90452..291389ff27 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -219,7 +219,7 @@ $database->fields['domain_name'] = $domain_name; //check whether a recording exists - $recording_relative_path = '/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $recording_relative_path = '/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; if (file_exists($_SESSION['switch']['recordings']['dir'].$recording_relative_path.'/'.$uuid.'.wav')) { $recording_file = $recording_relative_path.'/'.$uuid.'.wav'; } diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index a667148085..e3e076edf9 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -396,7 +396,7 @@ else { //handle recordings if (permission_exists('recording_play') || permission_exists('recording_download')) { - $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$path_mod.'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$path_mod.'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; $tmp_name = ''; if(!empty($row['recording_file']) && file_exists($row['recording_file'])){ $tmp_name=$row['recording_file']; diff --git a/app/xml_cdr/xml_cdr_delete.php b/app/xml_cdr/xml_cdr_delete.php index 16f8614357..be3de7ac6e 100644 --- a/app/xml_cdr/xml_cdr_delete.php +++ b/app/xml_cdr/xml_cdr_delete.php @@ -54,8 +54,8 @@ if (sizeof($_REQUEST) > 0) { $prep_statement->execute(); unset($sql, $prep_statement); //delete recording, if any - if ($recording_file_path[$index] != '' && file_exists($_SESSION['switch']['recordings']['dir'].base64_decode($recording_file_path[$index]))) { - @unlink($_SESSION['switch']['recordings']['dir'].base64_decode($recording_file_path[$index])); + if ($recording_file_path[$index] != '' && file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].base64_decode($recording_file_path[$index]))) { + @unlink($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].base64_decode($recording_file_path[$index])); } } } diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php index aca8978688..af95603150 100644 --- a/app/xml_cdr/xml_cdr_details.php +++ b/app/xml_cdr/xml_cdr_details.php @@ -194,7 +194,7 @@ else { //echo " ".$language."\n"; //echo " ".$context."\n"; echo " "; - if (file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) { + if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) { //echo " \n"; //echo " "; @@ -208,7 +208,7 @@ else { } echo " \n"; echo " "; - if (file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) { + if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) { echo " \n"; echo $caller_id_number.' '; echo " "; @@ -276,7 +276,7 @@ else { if ($key == "bridge_uuid" || $key == "signal_bond") { echo " \n"; echo " ".$value." \n"; - $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; $tmp_name = ''; if (file_exists($tmp_dir.'/'.$value.'.wav')) { $tmp_name = $value.".wav"; @@ -290,12 +290,12 @@ else { elseif (file_exists($tmp_dir.'/'.$value.'_1.mp3')) { $tmp_name = $value."_1.mp3"; } - if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) { + if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) { echo " \n"; echo " play"; echo "  "; } - if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) { + if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) { echo " \n"; echo " download"; echo " "; diff --git a/core/domain_settings/domain_delete.php b/core/domain_settings/domain_delete.php index e65af3bb40..7e544a963a 100644 --- a/core/domain_settings/domain_delete.php +++ b/core/domain_settings/domain_delete.php @@ -176,7 +176,7 @@ if (strlen($id) > 0) { //delete the recordings if (strlen($_SESSION['switch'][recordings]['dir']) > 0) { - system('rm -rf '.$_SESSION['switch']['recordings']['dir'].'/'.$domain_name); + system('rm -rf '.$_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$domain_name); } //delete voicemail diff --git a/core/domain_settings/domain_edit.php b/core/domain_settings/domain_edit.php index a31abb390b..099c563458 100644 --- a/core/domain_settings/domain_edit.php +++ b/core/domain_settings/domain_edit.php @@ -234,8 +234,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } // rename switch/recordings/[domain] (folder) - if ( isset($_SESSION['switch']['recordings']['dir']) ) { - $switch_recordings_dir = str_replace("/".$_SESSION["domain_name"], "", $_SESSION['switch']['recordings']['dir']); + if ( isset($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']) ) { + $switch_recordings_dir = str_replace("/".$_SESSION["domain_name"], "", $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']); if ( file_exists($switch_recordings_dir."/".$original_domain_name) ) { @rename($switch_recordings_dir."/".$original_domain_name, $switch_recordings_dir."/".$domain_name); // folder } diff --git a/resources/install/scripts/app/conference_center/index.lua b/resources/install/scripts/app/conference_center/index.lua index 395db64a75..e9adc15b7e 100644 --- a/resources/install/scripts/app/conference_center/index.lua +++ b/resources/install/scripts/app/conference_center/index.lua @@ -148,6 +148,10 @@ default_language = session:getVariable("default_language"); default_dialect = session:getVariable("default_dialect"); --recording = session:getVariable("recording"); + domain_name = session:getVariable("domain_name"); + + --add the domain name to the recordings directory + recordings_dir = recordings_dir .. "/"..domain_name; --set the end epoch end_epoch = os.time(); @@ -339,6 +343,9 @@ --freeswitch.consoleLog("notice", "[conference center] destination_number: " .. destination_number .. "\n"); --freeswitch.consoleLog("notice", "[conference center] caller_id_number: " .. caller_id_number .. "\n"); + --add the domain name to the recordings directory + recordings_dir = recordings_dir .. "/"..domain_name; + --set the sounds path for the language, dialect and voice default_language = session:getVariable("default_language"); default_dialect = session:getVariable("default_dialect"); @@ -411,10 +418,6 @@ --add the domain to the recording directory freeswitch.consoleLog("notice", "[conference center] domain_count: " .. domain_count .. "\n"); - if (domain_count > 1) then - recordings_dir = recordings_dir.."/"..domain_name; - freeswitch.consoleLog("notice", "[conference center] recordings_dir: " .. recordings_dir .. "\n"); - end --sounds enter_sound = "tone_stream://v=-20;%(100,1000,100);v=-20;%(90,60,440);%(90,60,620)"; diff --git a/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua b/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua index b30412451d..047619cadb 100644 --- a/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua +++ b/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua @@ -36,10 +36,8 @@ --get the current time start_epoch = os.time(); - --set the recording variable - if (domain_count > 1) then - recordings_dir = recordings_dir.."/"..domain_name; - end + --add the domain name to the recordings directory + recordings_dir = recordings_dir .. "/"..domain_name; recordings_dir = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch); mkdir(recordings_dir); recording = recordings_dir.."/"..conference_session_uuid; diff --git a/resources/install/scripts/app/dialplan/index.lua b/resources/install/scripts/app/dialplan/index.lua index fbd3892031..b173b2ca57 100644 --- a/resources/install/scripts/app/dialplan/index.lua +++ b/resources/install/scripts/app/dialplan/index.lua @@ -36,7 +36,6 @@ destination_number = session:getVariable("destination_number"); call_direction = session:getVariable("call_direction"); domain_name = session:getVariable("domain_name"); - recordings_dir = session:getVariable("recordings_dir"); --determine the call direction if (call_direction == nil) then diff --git a/resources/install/scripts/fifo_member.lua b/resources/install/scripts/fifo_member.lua index 54b364db10..c7874b4d2e 100644 --- a/resources/install/scripts/fifo_member.lua +++ b/resources/install/scripts/fifo_member.lua @@ -23,7 +23,6 @@ -- Mark J Crane sounds_dir = ""; -recordings_dir = ""; pin_number = ""; max_tries = "3"; digit_timeout = "3000"; diff --git a/resources/install/scripts/ivr_menu.lua b/resources/install/scripts/ivr_menu.lua index 47b35679ed..24418d531e 100644 --- a/resources/install/scripts/ivr_menu.lua +++ b/resources/install/scripts/ivr_menu.lua @@ -76,10 +76,8 @@ end end ---set the recordings directory - if (domain_count > 1) then - recordings_dir = recordings_dir .. "/"..domain_name; - end +--add the domain name to the recordings directory + recordings_dir = recordings_dir .. "/"..domain_name; --set default variable(s) tries = 0; diff --git a/resources/install/scripts/recordings.lua b/resources/install/scripts/recordings.lua index f03fd0a0d4..540258adfd 100644 --- a/resources/install/scripts/recordings.lua +++ b/resources/install/scripts/recordings.lua @@ -100,6 +100,7 @@ recording_slots = session:getVariable("recording_slots"); recording_prefix = session:getVariable("recording_prefix"); recording_name = session:getVariable("recording_name"); + domain_name = session:getVariable("domain_name"); --select the recording number if (recording_slots) then @@ -256,20 +257,9 @@ if ( session:ready() ) then domain_name = session:getVariable("domain_name"); domain_uuid = session:getVariable("domain_uuid"); - --set the base recordings dir - base_recordings_dir = recordings_dir; + --add the domain name to the recordings directory + recordings_dir = recordings_dir .. "/"..domain_name; - --use the recording_dir when the variable is set - if (session:getVariable("recordings_dir")) then - if (base_recordings_dir ~= session:getVariable("recordings_dir")) then - recordings_dir = session:getVariable("recordings_dir"); - end - end - - --get the recordings from the config.lua and append the domain_name if the system is multi-tenant - if (domain_count > 1) then - recordings_dir = recordings_dir .. "/" .. domain_name; - end --set the sounds path for the language, dialect and voice default_language = session:getVariable("default_language"); default_dialect = session:getVariable("default_dialect"); From 9b9c98995a9b3ea54a1b3b0c2e8c55fda5ddbc0c Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 13:51:19 -0700 Subject: [PATCH 210/232] Get rid of the abbreviation its recommended to use the full name in the variable unless it makes it really long in order to make the code easier to read and more intuitive. --- app/system/system.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/system/system.php b/app/system/system.php index 4c72da3862..78d4facc36 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -338,37 +338,37 @@ $document['title'] = $text['title-sys-status']; echo " ".$text['title-memcache']."\n"; echo " \n"; - $mc_fail = false; + $memcache_fail = false; $mod = new modules; if ($mod -> active("mod_memcache")) { $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($fp) { $switch_cmd = "memcache status verbose"; $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - $mc_lines = preg_split('/\n/', $switch_result); - foreach($mc_lines as $mc_line) { - if (strlen(trim($mc_line)) > 0 && substr_count($mc_line, ': ') > 0) { - $mc_temp = explode(': ', $mc_line); - $mc_status[$mc_temp[0]] = $mc_temp[1]; + $memcache_lines = preg_split('/\n/', $switch_result); + foreach($memcache_lines as $memcache_line) { + if (strlen(trim($memcache_line)) > 0 && substr_count($memcache_line, ': ') > 0) { + $memcache_temp = explode(': ', $memcache_line); + $memcache_status[$memcache_temp[0]] = $memcache_temp[1]; } } - if (is_array($mc_status) && sizeof($mc_status) > 0) { - foreach($mc_status as $mc_field => $mc_value) { + if (is_array($memcache_status) && sizeof($memcache_status) > 0) { + foreach($memcache_status as $memcache_field => $memcache_value) { echo "\n"; - echo " ".$mc_field."\n"; - echo " ".$mc_value."\n"; + echo " ".$memcache_field."\n"; + echo " ".$memcache_value."\n"; echo "\n"; } } - else { $mc_fail = true; } + else { $memcache_fail = true; } } - else { $mc_fail = true; } + else { $memcache_fail = true; } } - else { $mc_fail = true; } + else { $memcache_fail = true; } - if ($mc_fail) { + if ($memcache_fail) { echo "\n"; echo " ".$text['label-memcache_status']."\n"; echo " ".$text['message-unavailable']."\n"; From e484d9758b79ef8f581ce477d75697b076afa4f5 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 13:57:56 -0700 Subject: [PATCH 211/232] Add missing translation labels and remove the quotes arounds the GIT values. --- app/system/app_languages.php | 48 +++++++++++++++++++++++++++++------- app/system/system.php | 8 +++--- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/app/system/app_languages.php b/app/system/app_languages.php index e367817dea..495304b133 100644 --- a/app/system/app_languages.php +++ b/app/system/app_languages.php @@ -80,15 +80,45 @@ $text['label-os']['sv-se'] = "Operativsystem"; $text['label-os']['uk'] = "Операційна система "; $text['label-os']['de-at'] = "Betriebssystem"; -$text['label-git-info']['en-us'] = "Git Information"; -$text['label-git-info']['es-cl'] = ""; -$text['label-git-info']['pt-pt'] = ""; -$text['label-git-info']['fr-fr'] = ""; -$text['label-git-info']['pt-br'] = ""; -$text['label-git-info']['pl'] = ""; -$text['label-git-info']['sv-se'] = ""; -$text['label-git-info']['uk'] = ""; -$text['label-git-info']['de-at'] = ""; +$text['label-git_info']['en-us'] = "Git Information"; +$text['label-git_info']['es-cl'] = ""; +$text['label-git_info']['pt-pt'] = ""; +$text['label-git_info']['fr-fr'] = ""; +$text['label-git_info']['pt-br'] = ""; +$text['label-git_info']['pl'] = ""; +$text['label-git_info']['sv-se'] = ""; +$text['label-git_info']['uk'] = ""; +$text['label-git_info']['de-at'] = ""; + +$text['label-git_branch']['en-us'] = "Branch"; +$text['label-git_branch']['es-cl'] = ""; +$text['label-git_branch']['pt-pt'] = ""; +$text['label-git_branch']['fr-fr'] = ""; +$text['label-git_branch']['pt-br'] = ""; +$text['label-git_branch']['pl'] = ""; +$text['label-git_branch']['sv-se'] = ""; +$text['label-git_branch']['uk'] = ""; +$text['label-git_branch']['de-at'] = ""; + +$text['label-git_commit']['en-us'] = "Commit"; +$text['label-git_commit']['es-cl'] = ""; +$text['label-git_commit']['pt-pt'] = ""; +$text['label-git_commit']['fr-fr'] = ""; +$text['label-git_commit']['pt-br'] = ""; +$text['label-git_commit']['pl'] = ""; +$text['label-git_commit']['sv-se'] = ""; +$text['label-git_commit']['uk'] = ""; +$text['label-git_commit']['de-at'] = ""; + +$text['label-git_origin']['en-us'] = "Origin"; +$text['label-git_origin']['es-cl'] = ""; +$text['label-git_origin']['pt-pt'] = ""; +$text['label-git_origin']['fr-fr'] = ""; +$text['label-git_origin']['pt-br'] = ""; +$text['label-git_origin']['pl'] = ""; +$text['label-git_origin']['sv-se'] = ""; +$text['label-git_origin']['uk'] = ""; +$text['label-git_origin']['de-at'] = ""; $text['label-memcache_status']['en-us'] = "Memcache Status"; $text['label-memcache_status']['es-cl'] = "Estado de Memcache"; diff --git a/app/system/system.php b/app/system/system.php index 78d4facc36..59a42528b7 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -94,12 +94,12 @@ $document['title'] = $text['title-sys-status']; rtrim($git_commit); echo "\n"; echo " \n"; - echo " ".$text['label-git-info']."\n"; + echo " ".$text['label-git_info']."\n"; echo " \n"; echo " \n"; - echo " Branch: '$git_branch'
    \n"; - echo " Commit: '$git_commit'
    \n"; - echo " Origin: '$git_origin'
    \n"; + echo " ".$text['label-git_branch']." ".$git_branch."
    \n"; + echo " ".$text['label-git_commit']." ".$git_commit."
    \n"; + echo " ".$text['label-git_origin']." ".$git_origin."
    \n"; echo " \n"; echo "\n"; From 1077234745c1f902477ab191e869ec33f7098f3c Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 14:01:05 -0700 Subject: [PATCH 212/232] Add the semi colon to the GIT labels. --- app/system/app_languages.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/system/app_languages.php b/app/system/app_languages.php index 495304b133..f7a67d4e6c 100644 --- a/app/system/app_languages.php +++ b/app/system/app_languages.php @@ -90,7 +90,7 @@ $text['label-git_info']['sv-se'] = ""; $text['label-git_info']['uk'] = ""; $text['label-git_info']['de-at'] = ""; -$text['label-git_branch']['en-us'] = "Branch"; +$text['label-git_branch']['en-us'] = "Branch:"; $text['label-git_branch']['es-cl'] = ""; $text['label-git_branch']['pt-pt'] = ""; $text['label-git_branch']['fr-fr'] = ""; @@ -100,7 +100,7 @@ $text['label-git_branch']['sv-se'] = ""; $text['label-git_branch']['uk'] = ""; $text['label-git_branch']['de-at'] = ""; -$text['label-git_commit']['en-us'] = "Commit"; +$text['label-git_commit']['en-us'] = "Commit:"; $text['label-git_commit']['es-cl'] = ""; $text['label-git_commit']['pt-pt'] = ""; $text['label-git_commit']['fr-fr'] = ""; @@ -110,7 +110,7 @@ $text['label-git_commit']['sv-se'] = ""; $text['label-git_commit']['uk'] = ""; $text['label-git_commit']['de-at'] = ""; -$text['label-git_origin']['en-us'] = "Origin"; +$text['label-git_origin']['en-us'] = "Origin:"; $text['label-git_origin']['es-cl'] = ""; $text['label-git_origin']['pt-pt'] = ""; $text['label-git_origin']['fr-fr'] = ""; From 52f87223b0e35d9e9433840a131e427bb6349bf9 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 14:19:18 -0700 Subject: [PATCH 213/232] Commenting Advanced -> Install menu until its reason developer that added the menu explains its purpose. --- core/install/app_config.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/install/app_config.php b/core/install/app_config.php index a65a67c8bc..aa400f46cb 100644 --- a/core/install/app_config.php +++ b/core/install/app_config.php @@ -19,10 +19,10 @@ $apps[$x]['description']['pt-br'] = ""; //permission details - $y = 0; - $apps[$x]['permissions'][$y]['name'] = "install"; - $apps[$x]['permissions'][$y]['menu']['uuid'] = "75507e6e-891e-11e5-af63-feff819cdc9f"; - $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; - $y++; + //$y = 0; + //$apps[$x]['permissions'][$y]['name'] = "install"; + //$apps[$x]['permissions'][$y]['menu']['uuid'] = "75507e6e-891e-11e5-af63-feff819cdc9f"; + //$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + //$y++; ?> \ No newline at end of file From 84ff743e845b91c2b2ed6c54ef3f789453583624 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 14:21:36 -0700 Subject: [PATCH 214/232] Last commit commented out the permission this comments out the menu. --- core/install/app_menu.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/install/app_menu.php b/core/install/app_menu.php index e76450bd70..78831564c0 100644 --- a/core/install/app_menu.php +++ b/core/install/app_menu.php @@ -1,10 +1,10 @@ \ No newline at end of file From 310b7f2b922430e02c5c4b5d6de7a4b3f6e6381c Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 14:53:20 -0700 Subject: [PATCH 215/232] Correct the provision time zone variables used in the t48g template. --- resources/templates/provision/yealink/t48g/{$mac}.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/templates/provision/yealink/t48g/{$mac}.cfg b/resources/templates/provision/yealink/t48g/{$mac}.cfg index c9387f2da9..101b2090f6 100644 --- a/resources/templates/provision/yealink/t48g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t48g/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### From 950788b92ede0834c1f7dd7001ccb3f6425dcb79 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Mon, 7 Dec 2015 17:32:20 +0000 Subject: [PATCH 216/232] changed label to text[*] --- app/system/app_languages.php | 10 ++++++++++ app/system/system.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/system/app_languages.php b/app/system/app_languages.php index f7a67d4e6c..f0c4985ccb 100644 --- a/app/system/app_languages.php +++ b/app/system/app_languages.php @@ -80,6 +80,16 @@ $text['label-os']['sv-se'] = "Operativsystem"; $text['label-os']['uk'] = "Операційна система "; $text['label-os']['de-at'] = "Betriebssystem"; +$text['label-version']['en-us'] = "Version"; +$text['label-version']['es-cl'] = ""; +$text['label-version']['pt-pt'] = ""; +$text['label-version']['fr-fr'] = ""; +$text['label-version']['pt-br'] = ""; +$text['label-version']['pl'] = ""; +$text['label-version']['sv-se'] = ""; +$text['label-version']['uk'] = ""; +$text['label-version']['de-at'] = ""; + $text['label-git_info']['en-us'] = "Git Information"; $text['label-git_info']['es-cl'] = ""; $text['label-git_info']['pt-pt'] = ""; diff --git a/app/system/system.php b/app/system/system.php index 59a42528b7..510f1aa4eb 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -78,7 +78,7 @@ $document['title'] = $text['title-sys-status']; if (permission_exists('system_view_info')) { echo "\n"; echo " \n"; - echo " Version\n"; + echo " ".$text['label-version']."\n"; echo " \n"; echo " \n"; echo " ".software_version()."\n"; From 8d62c96ef73386b76fbc10a80a39b46129890980 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Mon, 7 Dec 2015 17:37:41 +0000 Subject: [PATCH 217/232] use $git_path to determine if it is a git install --- app/system/system.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/system/system.php b/app/system/system.php index 510f1aa4eb..84fa5e9ac6 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -86,22 +86,24 @@ $document['title'] = $text['title-sys-status']; echo "\n"; $git_path = normalize_path_to_os($_SERVER["DOCUMENT_ROOT"]."/.git"); - $git_branch = shell_exec('git --git-dir='.$git_path.' name-rev --name-only HEAD'); - rtrim($git_branch); - $git_commit = shell_exec('git --git-dir='.$git_path.' rev-parse HEAD'); - rtrim($git_commit); - $git_origin = shell_exec('git --git-dir='.$git_path.' config --get remote.origin.url'); - rtrim($git_commit); - echo "\n"; - echo " \n"; - echo " ".$text['label-git_info']."\n"; - echo " \n"; - echo " \n"; - echo " ".$text['label-git_branch']." ".$git_branch."
    \n"; - echo " ".$text['label-git_commit']." ".$git_commit."
    \n"; - echo " ".$text['label-git_origin']." ".$git_origin."
    \n"; - echo " \n"; - echo "\n"; + if(file_exists($git_path)){ + $git_branch = shell_exec('git --git-dir='.$git_path.' name-rev --name-only HEAD'); + rtrim($git_branch); + $git_commit = shell_exec('git --git-dir='.$git_path.' rev-parse HEAD'); + rtrim($git_commit); + $git_origin = shell_exec('git --git-dir='.$git_path.' config --get remote.origin.url'); + rtrim($git_commit); + echo "\n"; + echo " \n"; + echo " ".$text['label-git_info']."\n"; + echo " \n"; + echo " \n"; + echo " ".$text['label-git_branch']." ".$git_branch."
    \n"; + echo " ".$text['label-git_commit']." ".$git_commit."
    \n"; + echo " ".$text['label-git_origin']." ".$git_origin."
    \n"; + echo " \n"; + echo "\n"; + } echo "\n"; From 93a83ccb61a4c49ff5132f96c0465b48a8922a08 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Mon, 7 Dec 2015 21:19:59 +0000 Subject: [PATCH 219/232] Fixed temp_dir not getting set correctly this would have also affected backup_dir --- core/install/resources/classes/global_settings.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/install/resources/classes/global_settings.php b/core/install/resources/classes/global_settings.php index 251153e5d2..8d10cfd716 100644 --- a/core/install/resources/classes/global_settings.php +++ b/core/install/resources/classes/global_settings.php @@ -142,17 +142,21 @@ require_once "root.php"; throw new Exception("No detect_switch was passed to me but \$_SESSION['switch'] is empty!"); } foreach ($this->_switch_dirs as $dir){ + $category = 'switch'; $session_var; preg_match( '/^switch_(.*)_dir$/', $dir, $session_var); $dir = "_$dir"; if($session_var[1] == 'script'){ $session_var[1] = 'scripts'; } - $this->$dir = $_SESSION['switch'][$session_var[1]]['dir']; + if($session_var[1] == 'temp'){ $category = 'server'; } + $this->$dir = $_SESSION[$category][$session_var[1]]['dir']; } foreach ($this->_switch_vdirs as $vdir){ + $category = 'switch'; $session_var; preg_match( '/^switch_(.*)_vdir$/', $vdir, $session_var); $vdir = "_$vdir"; - $this->$vdir = $_SESSION['switch'][$session_var[1]]['dir']; + if($session_var[1] == 'backup'){ $category = 'server'; } + $this->$vdir = $_SESSION[$category][$session_var[1]]['dir']; } $this->_switch_event_host = $_SESSION['event_socket_ip_address']; $this->_switch_event_port = $_SESSION['event_socket_port']; From 6387f3700958cb06904d49fdb866aa905c7be4ff Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 7 Dec 2015 16:30:03 -0700 Subject: [PATCH 220/232] Prevent the conference alone sound from playing twice. --- resources/install/scripts/app/conference_center/index.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/resources/install/scripts/app/conference_center/index.lua b/resources/install/scripts/app/conference_center/index.lua index e9adc15b7e..08d43c42a6 100644 --- a/resources/install/scripts/app/conference_center/index.lua +++ b/resources/install/scripts/app/conference_center/index.lua @@ -150,9 +150,6 @@ --recording = session:getVariable("recording"); domain_name = session:getVariable("domain_name"); - --add the domain name to the recordings directory - recordings_dir = recordings_dir .. "/"..domain_name; - --set the end epoch end_epoch = os.time(); @@ -710,7 +707,7 @@ --there is one other member in this conference session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-one_other_member_conference.wav"); elseif (member_count == "0") then - session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-alone.wav"); + --conference profile defines the alone sound file else --say the count session:execute("say", default_language.." number pronounced "..member_count); From 29f844bf12e8078d0d45074a13535260cf7fbc9c Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 7 Dec 2015 18:02:56 -0700 Subject: [PATCH 221/232] Fix the call center agent contact string include the domain by adding the sip_invite_domain with the domain name. --- app/call_centers/call_center_agent_edit.php | 35 ++++++++++----------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/app/call_centers/call_center_agent_edit.php b/app/call_centers/call_center_agent_edit.php index e72dc42c19..34002e36ac 100644 --- a/app/call_centers/call_center_agent_edit.php +++ b/app/call_centers/call_center_agent_edit.php @@ -129,48 +129,47 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //get and then set the complete agent_contact with the call_timeout and when necessary confirm //if you change this variable, also change resources/switch.php - $tmp_confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout=".$agent_call_timeout; + $confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout=".$agent_call_timeout; if(strstr($agent_contact, '}') === FALSE) { //not found if(stristr($agent_contact, 'sofia/gateway') === FALSE) { //add the call_timeout - $tmp_agent_contact = "{call_timeout=".$agent_call_timeout."}".$agent_contact; + $agent_contact = "{call_timeout=".$agent_call_timeout.",sip_invite_domain=".$_SESSION['domain_name']."}".$agent_contact; } else { //add the call_timeout and confirm - $tmp_agent_contact = $tmp_first.',call_timeout='.$agent_call_timeout.$tmp_last; - $tmp_agent_contact = "{".$tmp_confirm.",call_timeout=".$agent_call_timeout."}".$agent_contact; - echo "\n\n".$tmp_agent_contact."\n\n"; + $agent_contact = $first.',call_timeout='.$agent_call_timeout.$last; + $agent_contact = "{".$confirm.",call_timeout=".$agent_call_timeout.",sip_invite_domain=".$_SESSION['domain_name']."}".$agent_contact; + echo "\n\n".$agent_contact."\n\n"; } } else { //found if(stristr($agent_contact, 'sofia/gateway') === FALSE) { //not found + $position = strrpos($agent_contact, "}"); + $first = substr($agent_contact, 0, $position); + $last = substr($agent_contact, $position); if(stristr($agent_contact, 'call_timeout') === FALSE) { - //add the call_timeout - $tmp_pos = strrpos($agent_contact, "}"); - $tmp_first = substr($agent_contact, 0, $tmp_pos); - $tmp_last = substr($agent_contact, $tmp_pos); - $tmp_agent_contact = $tmp_first.',call_timeout='.$agent_call_timeout.$tmp_last; + $call_timeout = ',call_timeout='.$agent_call_timeout; } else { - //the string has the call timeout - $tmp_agent_contact = $agent_contact; + $call_timeout = ''; } + $agent_contact = $first.',sip_invite_domain='.$_SESSION['domain_name'].$call_timeout.$last; } else { //found - $tmp_pos = strrpos($agent_contact, "}"); - $tmp_first = substr($agent_contact, 0, $tmp_pos); - $tmp_last = substr($agent_contact, $tmp_pos); + $position = strrpos($agent_contact, "}"); + $first = substr($agent_contact, 0, $position); + $last = substr($agent_contact, $position); if(stristr($agent_contact, 'call_timeout') === FALSE) { //add the call_timeout and confirm - $tmp_agent_contact = $tmp_first.','.$tmp_confirm.',call_timeout='.$agent_call_timeout.$tmp_last; + $agent_contact = $first.','.$confirm.',sip_invite_domain='.$_SESSION['domain_name'].'call_timeout='.$agent_call_timeout.$last; } else { //add confirm - $tmp_agent_contact = $tmp_first.','.$tmp_confirm.$tmp_last; + $agent_contact = $first.',sip_invite_domain='.$_SESSION['domain_name'].','.$confirm.$last; } } } @@ -193,7 +192,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $response = event_socket_request($fp, $cmd); usleep(200); //agent set contact - $cmd = "api callcenter_config agent set contact ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$tmp_agent_contact; + $cmd = "api callcenter_config agent set contact ".$agent_name."@".$_SESSION['domains'][$domain_uuid]['domain_name']." ".$agent_contact; $response = event_socket_request($fp, $cmd); usleep(200); //agent set status From ebc9b41c4a94e2fba7e066421dfc59cc1e002ace Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 7 Dec 2015 21:45:24 -0700 Subject: [PATCH 222/232] Add ^.*$| to local_extension to support dialing non numeric usernames. --- .../resources/switch/conf/dialplan/999_local_extension.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml index a53fda713e..f0ba159730 100644 --- a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml +++ b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml @@ -1,6 +1,6 @@ - + From 925feb06a1f0412637fdee756c70f864241e2841 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 7 Dec 2015 22:09:27 -0700 Subject: [PATCH 223/232] Add user_exists condition to local_extension to compensate for the fact we allow dialing an extension based on a non numeric username. --- .../resources/switch/conf/dialplan/999_local_extension.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml index f0ba159730..10c28b8df0 100644 --- a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml +++ b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml @@ -1,5 +1,6 @@ + From 36e546adcb64b4457c9427e30367eb34d157e1cd Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 8 Dec 2015 09:13:56 -0700 Subject: [PATCH 224/232] Remove the destination number condition and exchange the $1 for the destination_number variable. --- .../resources/switch/conf/dialplan/999_local_extension.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml index 10c28b8df0..905bdc0aa0 100644 --- a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml +++ b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml @@ -1,10 +1,9 @@ - - - + + From e7162402b13e7514a42f6c48f1d9d676e2c0dd3b Mon Sep 17 00:00:00 2001 From: reliberate Date: Tue, 8 Dec 2015 11:24:47 -0700 Subject: [PATCH 225/232] Domain Edit/Create: Use file_exists instead of isset on recordings directory path check. --- core/domain_settings/domain_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/domain_settings/domain_edit.php b/core/domain_settings/domain_edit.php index 099c563458..870a2c9ad9 100644 --- a/core/domain_settings/domain_edit.php +++ b/core/domain_settings/domain_edit.php @@ -234,7 +234,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } // rename switch/recordings/[domain] (folder) - if ( isset($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']) ) { + if ( file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']) ) { $switch_recordings_dir = str_replace("/".$_SESSION["domain_name"], "", $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']); if ( file_exists($switch_recordings_dir."/".$original_domain_name) ) { @rename($switch_recordings_dir."/".$original_domain_name, $switch_recordings_dir."/".$domain_name); // folder From fb1e3e29f161ef587ba7508b11c6f2811b1b2264 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 8 Dec 2015 21:57:18 -0700 Subject: [PATCH 226/232] Add tabbing to parse_attachments.php. --- .../resources/functions/parse_attachments.php | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/app/fax/resources/functions/parse_attachments.php b/app/fax/resources/functions/parse_attachments.php index 9999660636..f5a5f1f508 100644 --- a/app/fax/resources/functions/parse_attachments.php +++ b/app/fax/resources/functions/parse_attachments.php @@ -1,48 +1,48 @@ parts) && count($structure->parts)) { + if(isset($structure->parts) && count($structure->parts)) { - for($i = 0; $i < count($structure->parts); $i++) { + for($i = 0; $i < count($structure->parts); $i++) { - if($structure->parts[$i]->ifdparameters) { - foreach($structure->parts[$i]->dparameters as $object) { - if(strtolower($object->attribute) == 'filename') { - $attachments[$i]['is_attachment'] = true; - $attachments[$i]['filename'] = $object->value; - } - } - } + if($structure->parts[$i]->ifdparameters) { + foreach($structure->parts[$i]->dparameters as $object) { + if(strtolower($object->attribute) == 'filename') { + $attachments[$i]['is_attachment'] = true; + $attachments[$i]['filename'] = $object->value; + } + } + } - if($structure->parts[$i]->ifparameters) { - foreach($structure->parts[$i]->parameters as $object) { - if(strtolower($object->attribute) == 'name') { - $attachments[$i]['is_attachment'] = true; - $attachments[$i]['name'] = $object->value; - } - } - } + if($structure->parts[$i]->ifparameters) { + foreach($structure->parts[$i]->parameters as $object) { + if(strtolower($object->attribute) == 'name') { + $attachments[$i]['is_attachment'] = true; + $attachments[$i]['name'] = $object->value; + } + } + } - if($attachments[$i]['is_attachment']) { - $attachments[$i]['attachment'] = imap_fetchbody($connection, $message_number, $i+1, $option); - if($structure->parts[$i]->encoding == 3) { // 3 = BASE64 - $attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']); - $attachments[$i]['size'] = strlen($attachments[$i]['attachment']); - } - elseif($structure->parts[$i]->encoding == 4) { // 4 = QUOTED-PRINTABLE - $attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']); - $attachments[$i]['size'] = strlen($attachments[$i]['attachment']); - } - } + if($attachments[$i]['is_attachment']) { + $attachments[$i]['attachment'] = imap_fetchbody($connection, $message_number, $i+1, $option); + if($structure->parts[$i]->encoding == 3) { // 3 = BASE64 + $attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']); + $attachments[$i]['size'] = strlen($attachments[$i]['attachment']); + } + elseif($structure->parts[$i]->encoding == 4) { // 4 = QUOTED-PRINTABLE + $attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']); + $attachments[$i]['size'] = strlen($attachments[$i]['attachment']); + } + } unset($attachments[$i]['is_attachment']); - } + } - } - return array_values($attachments); //reindex + } + return array_values($attachments); //reindex } ?> \ No newline at end of file From 532e01b5c05e6bdcedcd808b19a768d9affde2ed Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 8 Dec 2015 21:59:09 -0700 Subject: [PATCH 227/232] Remove count($_SESSION["domains"]) > 1 from the as the domain name should always be part of the fax directory path. --- app/fax/fax_edit.php | 1 - app/fax/fax_send.php | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index 77a473567a..8a23a3cf4c 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -931,7 +931,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo ""; echo "
    "; echo "
    \n"; - } echo ""; diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 12104e4e81..b016ba0bfd 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -213,7 +213,7 @@ function fax_split_dtmf(&$fax_number, &$fax_dtmf){ mkdir($_SESSION['switch']['storage']['dir'].'/fax'); chmod($_SESSION['switch']['storage']['dir'].'/fax',0774); } - if (count($_SESSION["domains"]) > 1 && !is_dir($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'])) { + if (!is_dir($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'])) { mkdir($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name']); chmod($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'],0774); } @@ -238,7 +238,6 @@ function fax_split_dtmf(&$fax_number, &$fax_dtmf){ //clear file status cache clearstatcache(); - //send the fax $continue = false; From 98777ef728591ca13e0b80bf124dba5aa5791a37 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 8 Dec 2015 22:15:21 -0700 Subject: [PATCH 228/232] Remove code that was commented out a while ago. --- app/ivr_menus/resources/classes/ivr_menu.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/app/ivr_menus/resources/classes/ivr_menu.php b/app/ivr_menus/resources/classes/ivr_menu.php index 2f4d03959c..beaba4f804 100644 --- a/app/ivr_menus/resources/classes/ivr_menu.php +++ b/app/ivr_menus/resources/classes/ivr_menu.php @@ -575,23 +575,6 @@ include "root.php"; $database->fields['dialplan_detail_order'] = '030'; $database->add(); - /* - $database->table = "v_dialplan_details"; - $database->fields['domain_uuid'] = $this->domain_uuid; - $database->fields['dialplan_uuid'] = $this->dialplan_uuid; - $database->fields['dialplan_detail_uuid'] = uuid(); - $database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction - $database->fields['dialplan_detail_type'] = 'ivr'; - if (count($_SESSION["domains"]) > 1) { - $database->fields['dialplan_detail_data'] = $_SESSION['domain_name'].'-'.$this->ivr_menu_name; - } - else { - $database->fields['dialplan_detail_data'] = $this->ivr_menu_name; - } - $database->fields['dialplan_detail_order'] = '035'; - $database->add(); - */ - $database->table = "v_dialplan_details"; $database->fields['domain_uuid'] = $this->domain_uuid; $database->fields['dialplan_uuid'] = $this->dialplan_uuid; From 4bf86da6415bba501b90c1b7b6c549ad9fa1825d Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 8 Dec 2015 22:32:11 -0700 Subject: [PATCH 229/232] Remove the default context from one more location. --- app/dialplan_inbound/dialplan_inbound_add.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/dialplan_inbound/dialplan_inbound_add.php b/app/dialplan_inbound/dialplan_inbound_add.php index 25dbfb37fd..bf4205d8fe 100644 --- a/app/dialplan_inbound/dialplan_inbound_add.php +++ b/app/dialplan_inbound/dialplan_inbound_add.php @@ -145,12 +145,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $dialplan_name = str_replace("/", "", $dialplan_name); //set the context - if (count($_SESSION["domains"]) > 1) { - $context = 'default'; - } - else { - $context = '$${domain_name}'; - } + $context = '$${domain_name}'; //start the atomic transaction $count = $db->exec("BEGIN;"); //returns affected rows From bc1fcebad30854177692466ebe95949a3959091e Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 8 Dec 2015 22:34:23 -0700 Subject: [PATCH 230/232] Fix the domain name in the path for the inbound fax dialplan. --- resources/classes/fax.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/resources/classes/fax.php b/resources/classes/fax.php index bd936bdb01..195a0e8370 100644 --- a/resources/classes/fax.php +++ b/resources/classes/fax.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2010 + Copyright (C) 2010-2015 All Rights Reserved. Contributor(s): @@ -89,6 +89,7 @@ include "root.php"; //add the fax if (strlen($this->fax_extension) > 0) { + //add the dialplan $database = new database; $database->table = "v_dialplans"; @@ -190,12 +191,7 @@ include "root.php"; $database->fields['dialplan_detail_uuid'] = uuid(); $database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction $database->fields['dialplan_detail_type'] = 'rxfax'; - if (count($_SESSION["domains"]) > 1) { - $dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif'; - } - else { - $dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$this->fax_extension.'/inbox/${last_fax}.tif'; - } + $dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$this->domain_uuid]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif'; $database->fields['dialplan_detail_data'] = $dialplan_detail_data; $database->fields['dialplan_detail_order'] = '040'; $database->add(); @@ -322,7 +318,6 @@ include "root.php"; $database->update(); } else { -// $this->dialplan_uuid = uuid(); $database->fields['domain_uuid'] = $this->domain_uuid; $database->fields['dialplan_uuid'] = $this->dialplan_uuid; $database->add(); @@ -427,12 +422,7 @@ include "root.php"; $database->fields['dialplan_detail_uuid'] = uuid(); $database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction $database->fields['dialplan_detail_type'] = 'rxfax'; - if (count($_SESSION["domains"]) > 1) { - $dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif'; - } - else { - $dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$this->fax_extension.'/inbox/${last_fax}.tif'; - } + $dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$this->domain_uuid]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif'; $database->fields['dialplan_detail_data'] = $dialplan_detail_data; $database->fields['dialplan_detail_order'] = '040'; $database->add(); From 8f3f2040a766e819ee7cb393d44a02eb4099abf3 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 9 Dec 2015 12:05:20 -0700 Subject: [PATCH 231/232] Remove the self closing tag on the local_extension condition. --- .../resources/switch/conf/dialplan/999_local_extension.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml index 905bdc0aa0..4bb7d61431 100644 --- a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml +++ b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml @@ -1,6 +1,6 @@ - + From c9fee6c080b79d009b4a3c4e5a1cdf61a3b5a880 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 9 Dec 2015 12:10:31 -0700 Subject: [PATCH 232/232] Add the ${ and } to user_exists so that it works with the condition. --- .../resources/switch/conf/dialplan/999_local_extension.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml index 4bb7d61431..559821b785 100644 --- a/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml +++ b/app/dialplan/resources/switch/conf/dialplan/999_local_extension.xml @@ -1,6 +1,6 @@ - +