diff options
author | Mark Crane <mcrane@pfsense.org> | 2008-12-06 20:37:47 +0000 |
---|---|---|
committer | Mark Crane <mcrane@pfsense.org> | 2008-12-06 20:37:47 +0000 |
commit | 93ffc598a13083537270b701c6d1b94e8434ce4d (patch) | |
tree | 774154ced423b46a0411f9b2e9c7e599b383b350 /packages/freeswitch/freeswitch_public_includes_edit.tmp | |
parent | bee461d20120b86962980f0e441e9c42e6682d90 (diff) | |
download | pfsense-packages-93ffc598a13083537270b701c6d1b94e8434ce4d.tar.gz pfsense-packages-93ffc598a13083537270b701c6d1b94e8434ce4d.tar.bz2 pfsense-packages-93ffc598a13083537270b701c6d1b94e8434ce4d.zip |
FreeSWITCH package check array size and tab adjustments
Diffstat (limited to 'packages/freeswitch/freeswitch_public_includes_edit.tmp')
-rw-r--r-- | packages/freeswitch/freeswitch_public_includes_edit.tmp | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/packages/freeswitch/freeswitch_public_includes_edit.tmp b/packages/freeswitch/freeswitch_public_includes_edit.tmp index c7301db6..7c5b2158 100644 --- a/packages/freeswitch/freeswitch_public_includes_edit.tmp +++ b/packages/freeswitch/freeswitch_public_includes_edit.tmp @@ -62,13 +62,13 @@ $parentid = $id; if (isset($id) && $a_public_includes[$id]) { $pconfig['publicincludeid'] = $a_public_includes[$id]['publicincludeid']; $publicincludeid = $a_public_includes[$id]['publicincludeid']; - $pconfig['extensionname'] = $a_public_includes[$id]['extensionname']; - $pconfig['order'] = $a_public_includes[$id]['order']; + $pconfig['extensionname'] = $a_public_includes[$id]['extensionname']; + $pconfig['order'] = $a_public_includes[$id]['order']; $pconfig['context'] = $a_public_includes[$id]['context']; $pconfig['enabled'] = $a_public_includes[$id]['enabled']; $pconfig['descr'] = $a_public_includes[$id]['descr']; - $pconfig['opt1name'] = $a_public_includes[$id]['opt1name']; - $pconfig['opt1value'] = $a_public_includes[$id]['opt1value']; + $pconfig['opt1name'] = $a_public_includes[$id]['opt1name']; + $pconfig['opt1value'] = $a_public_includes[$id]['opt1value']; } if ($_POST) { @@ -94,64 +94,66 @@ if ($_POST) { $ent = array(); if (strlen($_POST['publicincludeid']) > 0) { //update - $ent['publicincludeid'] = $_POST['publicincludeid']; + $ent['publicincludeid'] = $_POST['publicincludeid']; } else { - //add - $ent['publicincludeid'] = guid(); - } + //add + $ent['publicincludeid'] = guid(); + } $ent['extensionname'] = $_POST['extensionname']; $ent['order'] = $_POST['order']; //$ent['context'] = $_POST['context']; $ent['context'] = 'default'; $ent['enabled'] = $_POST['enabled']; $ent['descr'] = $_POST['descr']; - $ent['opt1name'] = $_POST['opt1name']; + $ent['opt1name'] = $_POST['opt1name']; $ent['opt1value'] = $_POST['opt1value']; if (isset($id) && $a_public_includes[$id]) { - - foreach($config['installedpackages']['freeswitchpublicincludes']['config'] as $rowhelper) { - - //$rowhelper['publicincludeid']; - //$rowhelper['extensionname']; - //$rowhelper['context']; - //$rowhelper['enabled']; - - $filenamechanged = false; - if ($rowhelper['publicincludeid'] == $_POST['publicincludeid']) { - - if ($rowhelper['extensionname'] != $_POST['extensionname']) { - //if the extension name has changed then remove the current public xml file - //to prepare for the new file - $filenamechanged = true; - } - if ($rowhelper['order'] != $_POST['order']) { - //if the order has changed then remove the current public xml file - //to prepare for the new file - $filenamechanged = true; - } - if ($_POST['enabled'] == "false") { - //if the extension name is disabled then remove the public xml file - $filenamechanged = true; - } - if ($filenamechanged){ - $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; - if (file_exists("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename)) { - unlink("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename); - } - unset($publicincludefilename); - } - - } - unset($filenamechanged); - - } //end foreach - - //update the config - $a_public_includes[$id] = $ent; + $a_public_includes = $config['installedpackages']['freeswitchpublicincludes']['config']; + if (count($a_public_includes) > 0) { + foreach($a_public_includes as $rowhelper) { + + //$rowhelper['publicincludeid']; + //$rowhelper['extensionname']; + //$rowhelper['context']; + //$rowhelper['enabled']; + + $filenamechanged = false; + if ($rowhelper['publicincludeid'] == $_POST['publicincludeid']) { + + if ($rowhelper['extensionname'] != $_POST['extensionname']) { + //if the extension name has changed then remove the current public xml file + //to prepare for the new file + $filenamechanged = true; + } + if ($rowhelper['order'] != $_POST['order']) { + //if the order has changed then remove the current public xml file + //to prepare for the new file + $filenamechanged = true; + } + if ($_POST['enabled'] == "false") { + //if the extension name is disabled then remove the public xml file + $filenamechanged = true; + } + if ($filenamechanged){ + $publicincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml"; + if (file_exists("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename)) { + unlink("/usr/local/freeswitch/conf/dialplan/public/".$publicincludefilename); + } + unset($publicincludefilename); + } + + } + unset($filenamechanged); + + } //end foreach + } //end if count + + //update the config + $a_public_includes[$id] = $ent; } else { //add to the config |