From 8b2c8fe99d568bab93700fe85d34e49b309f8a11 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 24 Jun 2010 06:00:44 +0000 Subject: [PATCH 001/623] Added Endpoint Manager into the Repo --- .htaccess | 19 + Install/phonesettings.module | 202 + etc/sip_notify.conf | 43 + functions.inc.php | 7 + i18n/endpointman.pot | 334 + i18n/fr_FR/LC_MESSAGES/endpointman.mo | Bin 0 -> 8565 bytes i18n/fr_FR/LC_MESSAGES/endpointman.po | 389 ++ includes/JSON/JSON.php | 806 +++ includes/JSON/LICENSE | 21 + includes/JSON/Test-JSON.php | 521 ++ includes/advanced.inc | 453 ++ includes/ajax.inc | 36 + includes/ajax_select.php | 69 + includes/brand_model_manager.inc | 174 + includes/databases/freepbxv2.inc | 14 + includes/databases/freepbxv3.inc | 0 includes/databases/mysql.inc | 9 + includes/default.inc | 7 + includes/devices_manager.inc | 389 ++ includes/export.php | 52 + includes/functions.inc | 1572 +++++ includes/installer.php | 64 + includes/jsonwrapper.php | 6 + includes/jsonwrapper_inner.php | 23 + includes/oui_list.inc | 84 + includes/rain.tpl.class.php | 199 + includes/rain.tpl.compile.class.php | 484 ++ includes/template_manager.inc | 96 + includes/update_check.php | 100 + index.php | 23 + install.php | 792 +++ module.xml | 21 + page.endpointman.php | 120 + templates/advanced_settings_iedl.html | 17 + templates/advanced_settings_oui.html | 32 + templates/advanced_settings_poce.html | 54 + templates/advanced_settings_settings.html | 79 + templates/advanced_settings_sh_manager.html | 56 + templates/advanced_subheader.html | 10 + templates/brand_model_manager.html | 71 + templates/credits.html | 0 templates/devices_manager.html | 232 + templates/global_footer.html | 8 + templates/global_header.html | 78 + templates/global_links.html | 9 + templates/images/delete.gif | Bin 0 -> 610 bytes templates/images/edit.gif | Bin 0 -> 202 bytes templates/images/trash.gif | Bin 0 -> 2815 bytes templates/javascript/ajax_req.js | 46 + templates/javascript/jquery-1.3.2.min.js | 19 + .../javascript/jquery.coda-slider-2.0.js | 234 + templates/javascript/jquery.cookie.js | 97 + templates/javascript/jquery.easing.1.3.js | 205 + templates/javascript/jquery.js | 5999 +++++++++++++++++ templates/stylesheets/coda-slider-2.0a.css | 49 + templates/stylesheets/reset.css | 33 + templates/template_editor.html | 94 + templates/template_manager.html | 43 + uninstall.php | 77 + 59 files changed, 14671 insertions(+) create mode 100644 .htaccess create mode 100644 Install/phonesettings.module create mode 100644 etc/sip_notify.conf create mode 100644 functions.inc.php create mode 100644 i18n/endpointman.pot create mode 100644 i18n/fr_FR/LC_MESSAGES/endpointman.mo create mode 100644 i18n/fr_FR/LC_MESSAGES/endpointman.po create mode 100644 includes/JSON/JSON.php create mode 100644 includes/JSON/LICENSE create mode 100644 includes/JSON/Test-JSON.php create mode 100644 includes/advanced.inc create mode 100644 includes/ajax.inc create mode 100644 includes/ajax_select.php create mode 100644 includes/brand_model_manager.inc create mode 100644 includes/databases/freepbxv2.inc create mode 100644 includes/databases/freepbxv3.inc create mode 100644 includes/databases/mysql.inc create mode 100644 includes/default.inc create mode 100644 includes/devices_manager.inc create mode 100644 includes/export.php create mode 100644 includes/functions.inc create mode 100644 includes/installer.php create mode 100644 includes/jsonwrapper.php create mode 100644 includes/jsonwrapper_inner.php create mode 100644 includes/oui_list.inc create mode 100644 includes/rain.tpl.class.php create mode 100644 includes/rain.tpl.compile.class.php create mode 100644 includes/template_manager.inc create mode 100644 includes/update_check.php create mode 100644 index.php create mode 100644 install.php create mode 100644 module.xml create mode 100644 page.endpointman.php create mode 100644 templates/advanced_settings_iedl.html create mode 100644 templates/advanced_settings_oui.html create mode 100644 templates/advanced_settings_poce.html create mode 100644 templates/advanced_settings_settings.html create mode 100755 templates/advanced_settings_sh_manager.html create mode 100644 templates/advanced_subheader.html create mode 100755 templates/brand_model_manager.html create mode 100644 templates/credits.html create mode 100755 templates/devices_manager.html create mode 100755 templates/global_footer.html create mode 100755 templates/global_header.html create mode 100755 templates/global_links.html create mode 100644 templates/images/delete.gif create mode 100644 templates/images/edit.gif create mode 100644 templates/images/trash.gif create mode 100644 templates/javascript/ajax_req.js create mode 100644 templates/javascript/jquery-1.3.2.min.js create mode 100755 templates/javascript/jquery.coda-slider-2.0.js create mode 100644 templates/javascript/jquery.cookie.js create mode 100755 templates/javascript/jquery.easing.1.3.js create mode 100644 templates/javascript/jquery.js create mode 100755 templates/stylesheets/coda-slider-2.0a.css create mode 100755 templates/stylesheets/reset.css create mode 100644 templates/template_editor.html create mode 100644 templates/template_manager.html create mode 100644 uninstall.php diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000..50de8a4a --- /dev/null +++ b/.htaccess @@ -0,0 +1,19 @@ +allow from all +AuthName FreePBX-Admin-only +Require valid-user +AuthType Basic +AuthMySQLEnable On +AuthMySQLHost localhost +AuthMySQLDB asterisk +AuthMySQLUserTable ampusers +AuthMySQLUser asteriskuser +AuthMySQLPassword amp109 +AuthMySQLNameField username +AuthMySQLPasswordField password +AuthMySQLAuthoritative On +AuthMySQLPwEncryption none +AuthMySQLUserCondition "username = 'admin'" + + + deny from all + diff --git a/Install/phonesettings.module b/Install/phonesettings.module new file mode 100644 index 00000000..7e46d8ff --- /dev/null +++ b/Install/phonesettings.module @@ -0,0 +1,202 @@ +getAll($sql, DB_FETCHMODE_ASSOC); + + // and we are not logged in as admin + if (($exten!=$ARI_ADMIN_USERNAME) AND ($results[0]['value'])) { + $ret .= "

" . _("Phone Settings") . "


"; + } + + return $ret; + } + + /* + * Acts on the user settings + * + * @param $args + * Common arguments + * @param $a + * action + */ + function action($args) { + global $endpoint, $global_cfg; + + $doc_root = $_SERVER["DOCUMENT_ROOT"] ."/admin/modules/endpointman/"; + require($doc_root . "includes/functions.inc"); + + $endpoint = new endpointmanager(); + + $sql = "SELECT id FROM endpointman_mac_list WHERE ext = '".$_SESSION['ari_user']['extension']."' "; + $results = mysql_query($sql); + $row = mysql_fetch_assoc($results); + + + $id = $row['id']; + + $row = $endpoint->get_phone_info($id); + + $cfg_data = unserialize($row['cfg_data']); + + + if($row['custom_cfg_template'] > 0) { + $row['custom_cfg_data'] = $row['template_data']['custom_cfg_data']; + } + $custom_cfg_data2 = unserialize($row['custom_cfg_data']); + + $count = count($cfg_data); + for($i=0;$i<=$count;$i++) { + $temping = str_replace('$','',$cfg_data[$i]['variable']); + if((isset($_REQUEST[$temping])) AND (isset($custom_cfg_data2[$temping]['ari'])) AND ($custom_cfg_data2[$temping]['ari'] == 1)) { + $custom_cfg_data[$temping]['value'] = $_REQUEST[$temping]; + } + } + + $custom_cfg_data = serialize($custom_cfg_data); + + $sql = "UPDATE endpointman_mac_list SET user_cfg_data = '".$custom_cfg_data."' WHERE id = ". $id; + mysql_query($sql); + + require(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + + $phone_config = new $row['cfg_dir'](); + $phone_config->generate_config($id); + + $m = "phonesettings"; + + $ret .= " + + + "; + + return $ret; + } + + function reloadSettings($exten) { + + } + + /* + * Displays stats page + * + * @param $args + * Common arguments + */ + function display($args) { + if (!isset($_SESSION['dbh_asterisk'])) { + die('No Database?'); + } + + $doc_root = $_SERVER["DOCUMENT_ROOT"] ."/admin/modules/endpointman/"; + require($doc_root . "includes/functions.inc"); + + $endpoint = new endpointmanager(); + + $sql = "SELECT id FROM endpointman_mac_list WHERE ext = '".$_SESSION['ari_user']['extension']."' "; + $results = mysql_query($sql); + $row = mysql_fetch_assoc($results); + + global $global_cfg; + + $row = $endpoint->get_phone_info($row['id']); + + + + + if(!$endpoint->sync_product($row['product_id'])) { + die("unable to sync local template files". $custom); + } + + //Get default template config data from the database for this product + $sql = "SELECT cfg_data FROM endpointman_product_list WHERE id=". $row['product_id']; + $result=mysql_query($sql); + $product_row=mysql_fetch_array($result); + + //inset it into our usable row + $row['cfg_data'] = $product_row['cfg_data']; + + $brand_name = $row['directory']; + $model_name = $row['cfg_dir']; + + + //Start the display of the html file in the product folder + + $template .= '

Hello '. $row['description'] . ', You are currently editing phone settings for extension '.$row['ext'].'


'; + + if($row['custom_cfg_template'] > 0) { + $row['custom_cfg_data'] = $row['template_data']['custom_cfg_data']; + } + + $out = $endpoint->generate_gui_html($row['cfg_data'],$row['custom_cfg_data'],FALSE,$row['user_cfg_data']); + + $out[0]['data'] = array_values($out[0]['data']); + + $out[0]['title'] = "Your Phone Settings"; + + $tpl = new RainTPL( LOCAL_PATH.'templates' ); + + $tpl->assign("in_ari", 1); + $tpl->assign("template_editor", $out); + $tpl->assign("hidden_id", $row['id']); + $tpl->assign("web_vars", WEB_VARS); + $tpl->assign("hidden_custom", $custom); + $template .= $tpl->draw( 'template_editor', TRUE ); + + + $m = "phonesettings"; + $ret .= "
+ + + +
+ " . $template . " +
+ +
"; + return($ret); + } +} // class + +?> diff --git a/etc/sip_notify.conf b/etc/sip_notify.conf new file mode 100644 index 00000000..dde4ccdd --- /dev/null +++ b/etc/sip_notify.conf @@ -0,0 +1,43 @@ +[polycom-check-cfg] +Event=>check-sync +Content-Length=>0 + +[polycom-reboot] +Event=>check-sync +Content-Length=>0 + +; Untested +[sipura-check-cfg] +Event=>resync +Content-Length=>0 + +; Untested +[grandstream-check-cfg] +Event=>sys-control + +; Untested +[cisco-check-cfg] +Event=>check-sync +Content-Length=>0 + +; Untested - from Snom docs +[reboot-snom] +Event=>reboot +Content-Length=>0 + +[aastra-check-cfg] +Event=>check-sync +Content-Length=>0 + +[linksys-cold-restart] +Event=>reboot_now +Content-Length=>0 + +[linksys-warm-restart] +Event=>restart_now +Content-Length=>0 + +[spa-reboot] +Event=>reboot +Content-Length=>0 + diff --git a/functions.inc.php b/functions.inc.php new file mode 100644 index 00000000..3ea78b3e --- /dev/null +++ b/functions.inc.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/i18n/endpointman.pot b/i18n/endpointman.pot new file mode 100644 index 00000000..8384b789 --- /dev/null +++ b/i18n/endpointman.pot @@ -0,0 +1,334 @@ +# This file is part of FreePBX. +# +# FreePBX is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# FreePBX is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with FreePBX. If not, see . +# +# FreePBX language template for announcement +# Copyright (C) 2008, 2009, 2010 Bandwith.com +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-27 17:34+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "My Devices List" +msgstr "" + +msgid "Template Manager" +msgstr "" + +msgid "Brand Configurations/Setup" +msgstr "" + +msgid "Advanced Settings" +msgstr "" + +msgid "IP address of phone server" +msgstr "" + +msgid "Determine for me" +msgstr "" + +msgid "Time Zone" +msgstr "" + +msgid "Default Final Configuration Directory" +msgstr "" + +msgid "Enable FreePBX ARI Module" +msgstr "" + +msgid "Enable Debug Mode" +msgstr "" + +msgid "Brand" +msgstr "" + +msgid "Select Product" +msgstr "" + +msgid "File Configuration Editor" +msgstr "" + +msgid "Local File Configs" +msgstr "" + +msgid "User File Configs" +msgstr "" + +msgid "Settings" +msgstr "" + +msgid "OUI Manager" +msgstr "" + +msgid "Product Options/Configuration Editor" +msgstr "" + +msgid "Show/Hide Brands/Models" +msgstr "" + +msgid "Please wait for the progress bar to show below (this might take a minute or two)" +msgstr "" + +msgid "Version" +msgstr "" + +msgid "Use NMAP" +msgstr "" + +msgid "Mac Address" +msgstr "" + +msgid "Model of Phone" +msgstr "" + +msgid "Extension Number" +msgstr "" + +msgid "Template" +msgstr "" + +msgid "Unmanaged Extensions" +msgstr "" + +msgid "Current Managed Extensions" +msgstr "" + +msgid "End Point Configuration Manager" +msgstr "" + +msgid "You are currently editing" +msgstr "" + +msgid "a custom config template for extension" +msgstr "" + +msgid "the template named" +msgstr "" + +msgid "Select Alternative File Configurations" +msgstr "" + +msgid "You can also user certain variables in your configs" +msgstr "" + +msgid "Server IP" +msgstr "" + +msgid "Device's Mac Address" +msgstr "" + +msgid "Device's Default Extension (Line 1 or Master)" +msgstr "" + +msgid "Device's Description in FreePBX (Usually the Full Name)" +msgstr "" + +msgid "for Model" +msgstr "" + +msgid "Model" +msgstr "" + +msgid "Add New Template" +msgstr "" + +msgid "Template Name" +msgstr "" + +msgid "Product Select" +msgstr "" + +msgid "Model Classification" +msgstr "" + +msgid "Edit" +msgstr "" + +msgid "Delete" +msgstr "" + +#new below + +msgid "Welcome to Endpoint Manager" +msgstr "" + +msgid "You have no products (Modules) installed, click" +msgstr + +msgid "here" +msgstr "" + +msgid "to install some" +msgstr "" + +msgid "Saved" +msgstr "" + +msgid "Invalid MAC Address" +msgstr "" + +msgid "One or more selected phones had the same extension as a phone already added, these devices were not added" +msgstr "" + +msgid "Please select a Brand and/or Model" +msgstr "" + +msgid "No Phones Selected" +msgstr "" + +msgid "No Devices Found" +msgstr "" + +msgid "Please select a product" +msgstr "" + +msgid "Please select a template" +msgstr "" + +msgid "No Brand Selected for Reboot" +msgstr "" + +msgid "Unknown" +msgstr "" + +msgid "You have disabled/removed all models that correspond to this brand. Please enable them in 'Brand Configurations/Setup' before trying to edit this phone" +msgstr "" + +msgid "Go" +msgstr "" + +msgid "Save" +msgstr "" + +msgid "Add" +msgstr "" + +msgid "Reset" +msgstr "" + +msgid "Add Selected Phones" +msgstr "" + +msgid "Selected Phone(s) Options" +msgstr "" + +msgid "Change Selected Phones to" +msgstr "" + +msgid "Global Phone Options" +msgstr "" + +msgid "Update Phones" +msgstr "" + +msgid "Delete Selected Phones" +msgstr "" + +msgid "Rebuild Configs for Selected Phones" +msgstr "" + +msgid "Rebuild Configs for All Phones" +msgstr "" + +msgid "Rebuild & Reboot" +msgstr "" + +msgid "Reconfigure all" +msgstr "" + +msgid "with" +msgstr "" + +msgid "Deleted" +msgstr "" + +msgid "Save Template" +msgstr "" + +msgid "Check for Updates" +msgstr "" + +msgid "Disable" +msgstr "" + +msgid "Enable" +msgstr "" + +msgid "Install" +msgstr "" + +msgid "Uninstall" +msgstr "" + +msgid "Update" +msgstr "" + +msgid "Install Firmware" +msgstr "" + +msgid "Remove Firmware" +msgstr "" + +msgid "Update Firmware" +msgstr "" + +msgid "Import/Export Devices My Devices List" +msgstr "" + +msgid "Update Globals" +msgstr "" + +msgid "like" +msgstr "" + +msgid "Add Custom" +msgstr "" + +msgid "Select" +msgstr "" + +msgid "Save As" +msgstr "" + +msgid "Export CSV file of devices" +msgstr "" + +msgid "Export CSV" +msgstr "" + +msgid "Import CSV file of devices" +msgstr "" + +msgid "Note: CSV file should look like this" +msgstr "" + +msgid "Extension" +msgstr "" + +msgid "Extension can be blank" +msgstr "" + +msgid "Show" +msgstr "" + +msgid "Hide" +msgstr "" \ No newline at end of file diff --git a/i18n/fr_FR/LC_MESSAGES/endpointman.mo b/i18n/fr_FR/LC_MESSAGES/endpointman.mo new file mode 100644 index 0000000000000000000000000000000000000000..18caa271d1fd95ef4ac4171439719760949c081f GIT binary patch literal 8565 zcma)=du(J^ea8<;fOH%B2#)}5!`aZpHpzJG&4vvQA@O>>o25HmX#Ze@+CQjDQ4yl8`cl<4{83d1fe@9# z=XcJzGk0uAxbm6rz327&o!|TTUv9nW6N)FL{VMIFH!39^|NjbpcvgQ-DZ13Vz$4%$ z_)Fju;H$wW!CwYH1il=68hj)8N$?He7sL2BLjQk)chdg?C?xJ=)7OFb1Y81N$@e8t z=xl*4umDehp8;P3ejAi|{|nv(ejk+megq0XH~hS({~BMAIFegK3O z^(j#3JqrpyUjl{yuY*GGJKzoA3!u=u;TFICm7vhQBYe+*a=ufb@OK%MeRELc^#Sl! z@M(~()N`Q7?ax7>^JVZCz`qB75&Sn$^zwh8?DMKu`SrJhzs~nO_yl+Xl>Pn!jKLvz z2iRh>+rU-u^XnC`fq^zsUPqoa(e|th0g22+rb&|&EO*-e<}(1+o16MQBdUZ zaZt|tGze++=`j8$;8DK60E(Qx3El<%GbnU#gqX&>-Ru8$1?%1gZ!z_@gwuT82bMP{NT%! z`dd)wufhBjcnK6ceSi4=B*>roDnD|re*}f@zk~OHH^0`~`F)_~dlP&MxC;tDp8@X% z{}`MGzZLq$=*2#dfNukD2baN%pwRymDE9RwQ0RUY6h6NO!m|1YP=o&sz7@O~rOkj3 zfpn=DJO=&_D13Y&;9r88@4p7c&i)4!ySxQs75kb8h29D9PVgO|@X-ZjzXA9F_=lkE z`>!B>>Un-dPB)-5p?@1F>t;dWdjS;vo($uUgNQ;^pz!~Z(Ek-s;>NeZ7WhN34^ANz z(cdS)4}+frg`YV#m3^at?*%)2KLd)~p9e)=uf?f_&uLK3y$CLV7F-0cgP4~34^Z^- zJy7iS=3n#YxDCWq)tf=#`*`SoCn)@10L8vP1|A2W0cGCTL9vtn3gfTF$we+lL6J)f z6n^dt-;aSJM*|A|-GCngW&hs?W!+~%RHvQ;303MVAR+HcmK0ndP^Xkt?$zsG3xv%-sd@+^%S(&)5bf=uQ*2u7 z^PS=Q3GhzZ12nNCdFE-SX_6Pu(NfxdGT?_O8zp5CziL1IelI@WDsqtbTuYA;J|LEo-PBfi&dS;py3p-$!| z?fPH6l%?D8PL-Q7&eEdIoNAz!dM4emEST6yml-2Ax}vwUTyGA#P%P9^mFG4sb;qP; z2P(@~OPdz5nL1^+O_h}Tbex)Gl9E0Z=Wv>Sc*Do|)^>&bS-q8*^olwyJ4}+4!)CcUlVn@y*zdxZQNKxmq2woe9DO6LBqNYT-U%ix=qKLQS$oWU;L3>@nRdQ4wqo&=HM^B% zrDCvV`E*v{fONQRiqUksO1m%?L($8sq^pxGyP}i$ip31$B23!gRqw@^B(wI!sC&rT z(=XbqIW`rQMcW;t(3rKDu;*?O3yP-u*1M=q$to zr@}(_OxNvN;1k-8OvV)21TC8+x2Ahd)Ni}@$mGJ-_NVtOd!||GN7ZU#4Wph2J9u7+ zRBdrsr;~$I2L6uq3=8&5T)F@uGGNh;_^aMBIU&u9Z_6eKaa!c7`{IDQG|1cV zkyfP>LAjUBs32DzOuRiIN*$b`p5)`F^7_|KVLtTIQ^hFuuG%*04!>RDcwI!b-acdp zH@`W2AUHE83ZWdf@q{(o&vpq~wIi${`ckc%UF&}IV&QR=J7lP<)~(5-o?{>-vxHb7 zF)_7e-xODvAyyDTFD3-i6z_1f4u%J4xY;_0Bz)G%X}XxHCCP{c1buduw~(jSF>ED2 zZ3!c_X?u%SBfjgGk;#raBvz}97~{M|CRCeg9HPW#dL_;FQhNG_vzAY6%EMTG;oAqg zq8<(k+Qe{II*Y4{mwYm^T(G%hL-nXlq6}8BIKub9Meo|lCdMX)j;hD9N*f#{@_ClT zUJru3GK3R3!xwDh5*bH7y z4Ip|<>8>nBWqUDS*ug* z#NF1(YNu#zWDEMp>iLb<5|L2Ki`FU1rUiX$Zho#ccdT{ngq}aKaPRTE`JQ89YmKxf z1~W15cx!H6ADdq|KIiA1qkd^^ppJsFFUuG7Wim=^s;m0#(QN(xaA~7nDgKxBXSefr z963i-R}to08`ks}C~{0X{3Aoed$C2Gvz_Jff#+xEju3^Y4xoQ+z(Go+-KP4C(+70a zGdWS_!Oe}+t^3FGgwJi8x0cf=>tX;4`u?rBJaVzMnu#5>YQBUen?}9y$P&lGXc$;q zTv=K^q82$E0mq~6PF19*I_^2~>H+?iQE$e@aG!!$=DT@hnrhdYO79o~KNVWoN{gG6 z!~JBqAJQ5NCBmVDbhuxrRg;_k@Yxb?&_+sW>Fk*N$;v83F|MB5&6&ijgzOQfxq3Q( zDN=fXtEvmb{d`n$5P&5i75ombiP1Dl3~LwvS%a8YdwTWK`I0`GkB5 z93j`;;Xb7~LA)9aasp)T-^hxb+AVr9iPWoJ>OA%K!+q`z8CIRkA^H>tiHWFpM-@YZ zCEcx>+K{4s$5-tYD~ErI8l?OlSL+Ancd@l``EFB@5o*jS_y_{2ix^y%Y&pZlNXh`~ zO2f%r)G2g~OygZxm!yt>7Q?4QVy(nVBt>2Chvl3y(Gl9!);-p2B9#|Yw@kWt4_e{*GY)N9Grmkn4A z*N=vz!}X(SW3j)A9Echk8%^XwGCD6;6}e~(pXE+CdH-+%!(e2H8023jC1MFpKZ)1H zDw0^~1CpKyap+S@1gwr=5~maw5IH-n}WpDyz01#ybn z?&Nyc%}D&t@A_nA7ZAdQCbChCHxTb_ZZuU-}0rq znOJ8e{S5bK_0ohnp$N=bHXF!g$xkX~)dfqLj|ViRiHsVGvt=7*Ar`D)yd(+{mN8dA z5kE%THOA`f*ReU`?oOE!eAWBoO9Yms~2*(@U0q=k5biv&<7_I9b;cI{f9R zm>CCv1KGHp`F{n-wl!CEDrhjeW|0>bgXXDW;iyiW?ov~fIagUpOcv8QWTFS=NKBas zl@ewsIjh1M(l~bDK|jmV7c~gAA>~CrzIx^CS(12NGT0v7y&6mtEtb>V?hsCx)_kYd ztmINgnX+SYm_}%|x<*TIKDZ`4(&S*Fs<~SGC|YqTP;!wes8K{>1$B>FAA2Zty%tD+ zPqE8kiAfg4I4XGLHtO>R|Lb!$<`%Jkt4-<;`a{`ovy2J6*p9nOP6RVu zxiPK|QXz&b<;mElyEa9~PUVNLl`k=VR9z6SAdjOnvXJ;a0bpvl?<*cRic)v65mQkb z1}1{Zj4zpv`fhg6irD^|l*}@JTu*V~#6gDpW0$P8irdy#PD5x!%*|LZt4HBX5`wGF z5S61nH6g3Xz|TLPT*!9$Xv$Uaav=zZghbO^y+qO}$Fz}@SzGzx%jj_5T}E-Srxf#o z`H4?Xgr9IB2{#g-YR4B;1X0)O%K1+n*W)Nw+}pT(;%W8XW-zeaQ~b=45o=gTXoZ69 GNc|Z6m9EYJ literal 0 HcmV?d00001 diff --git a/i18n/fr_FR/LC_MESSAGES/endpointman.po b/i18n/fr_FR/LC_MESSAGES/endpointman.po new file mode 100644 index 00000000..7ec9f135 --- /dev/null +++ b/i18n/fr_FR/LC_MESSAGES/endpointman.po @@ -0,0 +1,389 @@ +# This file is part of FreePBX. +# +# FreePBX is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# FreePBX is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with FreePBX. If not, see . +# +# FreePBX language template for endpointmanager +# Copyright (C) 2008, 2009, 2010 Bandwith.com +# +msgid "" +msgstr "" +"Project-Id-Version: EndPointManager\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-27 17:34+0100\n" +"PO-Revision-Date: 2010-04-01 21:40+0100\n" +"Last-Translator: jouniaux \n" +"Language-Team: Français \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: French\n" +"X-Poedit-Country: FRANCE\n" + +msgid "My Devices List" +msgstr "Ma liste de terminaux" + +msgid "Template Manager" +msgstr "Gestion des gabarits" + +msgid "Brand Configurations/Setup" +msgstr "Configuration/Paramètres de la marque" + +msgid "Advanced Settings" +msgstr "Paramètres avancés" + +msgid "IP address of phone server" +msgstr "Adresse IP du serveur de téléphonie" + +msgid "Determine for me" +msgstr "Choisir à ma place" + +msgid "Time Zone" +msgstr "Fuseau horaire" + +msgid "Default Final Configuration Directory" +msgstr "Répertoire des configurations par défaut" + +msgid "Enable FreePBX ARI Module" +msgstr "Activer le module ARI de FreePBX" + +msgid "Enable Debug Mode" +msgstr "Activer mode debug" + +msgid "Brand" +msgstr "Marque" + +msgid "Select Product" +msgstr "Choisissez le produit" + +msgid "File Configuration Editor" +msgstr "Editeur du fichier de configuration" + +msgid "Local File Configs" +msgstr "Configuration en local" + +msgid "User File Configs" +msgstr "Configuration utilisateur" + +msgid "Settings" +msgstr "Paramètres" + +msgid "OUI Manager" +msgstr "Gestion des OUI" + +msgid "Product Options/Configuration Editor" +msgstr "Editeur de configuration/options du produit" + +msgid "Show/Hide Brands/Models" +msgstr "Montrer/Cacher les marques/modèles" + +msgid "Please wait for the progress bar to show below (this might take a minute or two)" +msgstr "Merci d'attendre la fin du traitement (Cela peut prendre une à deux minutes)" + +msgid "Version" +msgstr "Version" + +msgid "Use NMAP" +msgstr "Utiliser NMAP" + +msgid "Mac Address" +msgstr "Adresse MAC" + +msgid "Model of Phone" +msgstr "Modèle de téléphone" + +msgid "Extension Number" +msgstr "Extension" + +msgid "Template" +msgstr "Gabarit" + +msgid "Unmanaged Extensions" +msgstr "Extensions non gérées" + +msgid "Current Managed Extensions" +msgstr "Extensions gérées actuellement" + +msgid "End Point Configuration Manager" +msgstr "Gestion de la configuration des terminaux" + +msgid "You are currently editing" +msgstr "Vous êtes en train d'éditer" + +msgid "a custom config template for extension" +msgstr "un gabarit de configuration personnalisé pour extension" + +msgid "the template named" +msgstr "le gabarit appelé" + +msgid "Select Alternative File Configurations" +msgstr "Choisissez des configurations dans d'autres fichiers" + +msgid "You can also user certain variables in your configs" +msgstr "Vous pouvez aussi utilisez des variables dans vos configurations" + +msgid "Server IP" +msgstr "IP du serveur" + +msgid "Device's Mac Address" +msgstr "Adresse MAC du téléphone" + +msgid "Device's Default Extension (Line 1 or Master)" +msgstr "Extension par défaut du téléphone (Ligne 1 ou maître)" + +msgid "Device's Description in FreePBX (Usually the Full Name)" +msgstr "Description du téléphone dans FreePBX (en général le nom complet)" + +msgid "for Model" +msgstr "pour modèle" + +msgid "Model" +msgstr "Modèle" + +msgid "Add New Template" +msgstr "Ajout d'un nouveau gabarit" + +msgid "Template Name" +msgstr "Nom du gabarit" + +msgid "Product Select" +msgstr "Choisir un produit" + +msgid "Model Classification" +msgstr "Classification des modèles" + +msgid "Edit" +msgstr "Editer" + +msgid "Delete" +msgstr "Supprimer" + +msgid "Welcome to Endpoint Manager" +msgstr "Bienvenue dans Endpoint Manager" + +msgid "here" +msgstr "ici" + +msgid "to install some" +msgstr "pour installer quelques" + +msgid "Saved" +msgstr "Enregistré" + +msgid "Invalid MAC Address" +msgstr "Adresse MAC invalide" + +msgid "One or more selected phones had the same extension as a phone already added, these devices were not added" +msgstr "Un ou plusieurs téléphones sélectionnés ont la même extension qu'un téléphone déjà ajouté. Ces terminaux ne seront pas ajoutés." + +msgid "Please select a Brand and/or Model" +msgstr "Veuillez sélectionner une marque et/ou un modèle" + +msgid "No Phones Selected" +msgstr "Aucun téléphone sélectionné" + +msgid "No Devices Found" +msgstr "Aucun terminal trouvé" + +msgid "Please select a product" +msgstr "Veuillez choisir un produit" + +msgid "Please select a template" +msgstr "Veuillez choisir un gabarit" + +msgid "No Brand Selected for Reboot" +msgstr "Aucune marque sélectionnée pour la réinitialisation" + +msgid "Unknown" +msgstr "Inconnu" + +msgid "You have disabled/removed all models that correspond to this brand. Please enable them in 'Brand Configurations/Setup' before trying to edit this phone" +msgstr "Voys avez désactivé/retiré tous les modèles correspondant à cette marque. Veuillez les activer dans 'Configurations/Paramètres ded la marque' avant d'éditer ce téléphone" + +msgid "Go" +msgstr "Allez" + +msgid "Save" +msgstr "Enregistrer" + +msgid "Add" +msgstr "Ajouter" + +msgid "Reset" +msgstr "Réinitialiser" + +msgid "Add Selected Phones" +msgstr "Ajouter les téléphones sélectionnés" + +msgid "Selected Phone(s) Options" +msgstr "Options pour les téléphones sélectionnés" + +msgid "Change Selected Phones to" +msgstr "Changer les téléphones sélectionnés pour" + +msgid "Global Phone Options" +msgstr "Options générales des téléphones" + +msgid "Update Phones" +msgstr "Mis à jour des téléphones" + +msgid "Delete Selected Phones" +msgstr "Suppression des téléphones sélectionnés" + +msgid "Rebuild Configs for Selected Phones" +msgstr "Reconstruction des configurations des téléphones sélectionnés" + +msgid "Rebuild Configs for All Phones" +msgstr "Reconstruction des configurations de tous les téléphones" + +msgid "Rebuild & Reboot" +msgstr "Reconstruction et réinitialisation" + +msgid "Reconfigure all" +msgstr "Tout reconfigurer" + +msgid "with" +msgstr "avec" + +msgid "Deleted" +msgstr "Supprimé" + +msgid "Save Template" +msgstr "Sauvegarde du gabarit" + +msgid "Check for Updates" +msgstr "Vérification des mises à jour" + +msgid "Disable" +msgstr "Désactivé" + +msgid "Enable" +msgstr "Activé" + +msgid "Install" +msgstr "Installer" + +msgid "Uninstall" +msgstr "Désinstaller" + +msgid "Update" +msgstr "Mise à jour" + +msgid "Install Firmware" +msgstr "Installation du firmware" + +msgid "Remove Firmware" +msgstr "Retirer le firmware" + +msgid "Update Firmware" +msgstr "Mettre à jour le firmware" + +msgid "Import/Export Devices My Devices List" +msgstr "Importation/Exportation des terminaux Ma liste de terminaux" + +msgid "Update Globals" +msgstr "Mise à jour des paramètres généraux" + +msgid "like" +msgstr "comme" + +msgid "Add Custom" +msgstr "Ajout d'une configuration personalisée" + +msgid "Select" +msgstr "Sélectionner" + +msgid "Save As" +msgstr "Enregistrer sous" + +msgid "Export CSV file of devices" +msgstr "Exportation du fichier des terminaux au format CSV" + +msgid "Export CSV" +msgstr "Exportation format CSV" + +msgid "Import CSV file of devices" +msgstr "Importation du fichier des terminaux au format CSV" + +msgid "Note: CSV file should look like this" +msgstr "Remarque : le fichier CSV doit ressembler à " + +msgid "Extension" +msgstr "Extension" + +msgid "Extension can be blank" +msgstr "Une extension ne peut être vide" + +msgid "Show" +msgstr "Montrer" + +msgid "Hide" +msgstr "Cacher" + +#more new + +msgid "executable path" +msgstr "répertoire" + +msgid "Search for new devices in netmask" +msgstr "Recherche de nouveaux terminaux dans le masque réseau" + +msgid "Delete Selected phones" +msgstr "Supprime les téléphones sélectionnés" + +msgid "Reboot This Brand" +msgstr "Redémarrer cette marque" + +msgid "Import" +msgstr "Importation" + +msgid "Enable Nightly Phone Module Updates Check" +msgstr "Activer la vérification du module téléphone la nuit" + +msgid "Note: This will show or hide Brands/Products/Models on the Brand Configurations/Setup page ONLY!" +msgstr "Note: ceci montrera ou cachera les Marques/Produits/Modèles sur la page Configurations/Paramètres SEULEMENT" + +msgid "Welcome to Enpoint Manager!" +msgstr "Bienvenue dans Endpoint Manager!" + +msgid "You have no products (Modules) installed, click" +msgstr "Vous n'avez aucun produit (Modules) installé, cliquez" + +#more new new new! + +msgid "Turn Off Safe Mode" +msgstr "" + +msgid "/tftpboot is not writable" +msgstr "" + +msgid "Please create /tftpboot, even if you won't use it" +msgstr "" + +msgid "Sorry, Only Asterisk is supported currently" +msgstr "" + +msgid "End User Editable (Through ARI Module)" +msgstr "" + +msgid "Disable .htaccess (Might fix 'Internal Server Errors')" +msgstr "" + +msgid "The Endpoint Configuration Manager was written by" +msgstr "" + +msgid "The project is maintained at" +msgstr "" + +msgid "Debug Log" +msgstr "" \ No newline at end of file diff --git a/includes/JSON/JSON.php b/includes/JSON/JSON.php new file mode 100644 index 00000000..0cddbddb --- /dev/null +++ b/includes/JSON/JSON.php @@ -0,0 +1,806 @@ + + * @author Matt Knapp + * @author Brett Stimmerman + * @copyright 2005 Michal Migurski + * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_SLICE', 1); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_STR', 2); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_ARR', 3); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_OBJ', 4); + +/** + * Marker constant for Services_JSON::decode(), used to flag stack state + */ +define('SERVICES_JSON_IN_CMT', 5); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_LOOSE_TYPE', 16); + +/** + * Behavior switch for Services_JSON::decode() + */ +define('SERVICES_JSON_SUPPRESS_ERRORS', 32); + +/** + * Converts to and from JSON format. + * + * Brief example of use: + * + * + * // create a new instance of Services_JSON + * $json = new Services_JSON(); + * + * // convert a complexe value to JSON notation, and send it to the browser + * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); + * $output = $json->encode($value); + * + * print($output); + * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] + * + * // accept incoming POST data, assumed to be in JSON notation + * $input = file_get_contents('php://input', 1000000); + * $value = $json->decode($input); + * + */ +class Services_JSON +{ + /** + * constructs a new JSON instance + * + * @param int $use object behavior flags; combine with boolean-OR + * + * possible values: + * - SERVICES_JSON_LOOSE_TYPE: loose typing. + * "{...}" syntax creates associative arrays + * instead of objects in decode(). + * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. + * Values which can't be encoded (e.g. resources) + * appear as NULL instead of throwing errors. + * By default, a deeply-nested resource will + * bubble up with an error, so all return values + * from encode() should be checked with isError() + */ + function Services_JSON($use = 0) + { + $this->use = $use; + } + + /** + * convert a string from one UTF-16 char to one UTF-8 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf16 UTF-16 character + * @return string UTF-8 character + * @access private + */ + function utf162utf8($utf16) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); + } + + $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + + switch(true) { + case ((0x7F & $bytes) == $bytes): + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x7F & $bytes); + + case (0x07FF & $bytes) == $bytes: + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xC0 | (($bytes >> 6) & 0x1F)) + . chr(0x80 | ($bytes & 0x3F)); + + case (0xFFFF & $bytes) == $bytes: + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xE0 | (($bytes >> 12) & 0x0F)) + . chr(0x80 | (($bytes >> 6) & 0x3F)) + . chr(0x80 | ($bytes & 0x3F)); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encode($var) + { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + $properties = array_map(array($this, 'name_value'), + array_keys($var), + array_values($var)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + // treat it like a regular array + $elements = array_map(array($this, 'encode'), $var); + + foreach($elements as $element) { + if(Services_JSON::isError($element)) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = get_object_vars($var); + + $properties = array_map(array($this, 'name_value'), + array_keys($vars), + array_values($vars)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) + ? 'null' + : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function name_value($name, $value) + { + $encoded_value = $this->encode($value); + + if(Services_JSON::isError($encoded_value)) { + return $encoded_value; + } + + return $this->encode(strval($name)) . ':' . $encoded_value; + } + + /** + * reduce a string by removing leading and trailing comments and whitespace + * + * @param $str string string value to strip of comments and whitespace + * + * @return string string value stripped of comments and whitespace + * @access private + */ + function reduce_string($str) + { + $str = preg_replace(array( + + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + + ), '', $str); + + // eliminate extraneous space + return trim($str); + } + + /** + * decodes a JSON string into appropriate variable + * + * @param string $str JSON-formatted string + * + * @return mixed number, boolean, string, array, or object + * corresponding to given JSON input string. + * See argument 1 to Services_JSON() above for object-output behavior. + * Note that decode() always returns strings + * in ASCII or UTF-8 format! + * @access public + */ + function decode($str) + { + $str = $this->reduce_string($str); + + switch (strtolower($str)) { + case 'true': + return true; + + case 'false': + return false; + + case 'null': + return null; + + default: + $m = array(); + + if (is_numeric($str)) { + // Lookie-loo, it's a number + + // This would work on its own, but I'm trying to be + // good about returning integers where appropriate: + // return (float)$str; + + // Return float or int, as appropriate + return ((float)$str == (integer)$str) + ? (integer)$str + : (float)$str; + + } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { + // STRINGS RETURNED IN UTF-8 FORMAT + $delim = substr($str, 0, 1); + $chrs = substr($str, 1, -1); + $utf8 = ''; + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c < $strlen_chrs; ++$c) { + + $substr_chrs_c_2 = substr($chrs, $c, 2); + $ord_chrs_c = ord($chrs{$c}); + + switch (true) { + case $substr_chrs_c_2 == '\b': + $utf8 .= chr(0x08); + ++$c; + break; + case $substr_chrs_c_2 == '\t': + $utf8 .= chr(0x09); + ++$c; + break; + case $substr_chrs_c_2 == '\n': + $utf8 .= chr(0x0A); + ++$c; + break; + case $substr_chrs_c_2 == '\f': + $utf8 .= chr(0x0C); + ++$c; + break; + case $substr_chrs_c_2 == '\r': + $utf8 .= chr(0x0D); + ++$c; + break; + + case $substr_chrs_c_2 == '\\"': + case $substr_chrs_c_2 == '\\\'': + case $substr_chrs_c_2 == '\\\\': + case $substr_chrs_c_2 == '\\/': + if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || + ($delim == "'" && $substr_chrs_c_2 != '\\"')) { + $utf8 .= $chrs{++$c}; + } + break; + + case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): + // single, escaped unicode character + $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) + . chr(hexdec(substr($chrs, ($c + 4), 2))); + $utf8 .= $this->utf162utf8($utf16); + $c += 5; + break; + + case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): + $utf8 .= $chrs{$c}; + break; + + case ($ord_chrs_c & 0xE0) == 0xC0: + // characters U-00000080 - U-000007FF, mask 110XXXXX + //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 2); + ++$c; + break; + + case ($ord_chrs_c & 0xF0) == 0xE0: + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 3); + $c += 2; + break; + + case ($ord_chrs_c & 0xF8) == 0xF0: + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 4); + $c += 3; + break; + + case ($ord_chrs_c & 0xFC) == 0xF8: + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 5); + $c += 4; + break; + + case ($ord_chrs_c & 0xFE) == 0xFC: + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 6); + $c += 5; + break; + + } + + } + + return $utf8; + + } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { + // array, or object notation + + if ($str{0} == '[') { + $stk = array(SERVICES_JSON_IN_ARR); + $arr = array(); + } else { + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = array(); + } else { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = new stdClass(); + } + } + + array_push($stk, array('what' => SERVICES_JSON_SLICE, + 'where' => 0, + 'delim' => false)); + + $chrs = substr($str, 1, -1); + $chrs = $this->reduce_string($chrs); + + if ($chrs == '') { + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } else { + return $obj; + + } + } + + //print("\nparsing {$chrs}\n"); + + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c <= $strlen_chrs; ++$c) { + + $top = end($stk); + $substr_chrs_c_2 = substr($chrs, $c, 2); + + if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + // found a comma that is not inside a string, array, etc., + // OR we've reached the end of the character list + $slice = substr($chrs, $top['where'], ($c - $top['where'])); + array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + // we are in an array, so just push an element onto the stack + array_push($arr, $this->decode($slice)); + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + // we are in an object, so figure + // out the property name and set an + // element in an associative array, + // for now + $parts = array(); + + if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // "name":value pair + $key = $this->decode($parts[1]); + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // name:value pair, where name is unquoted + $key = $parts[1]; + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } + + } + + } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + // found a quote, and we are not inside a string + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + //print("Found start of string at {$c}\n"); + + } elseif (($chrs{$c} == $top['delim']) && + ($top['what'] == SERVICES_JSON_IN_STR) && + ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { + // found a quote, we're in a string, and it's not escaped + // we know that it's not escaped becase there is _not_ an + // odd number of backslashes at the end of the string so far + array_pop($stk); + //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '[') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-bracket, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); + //print("Found start of array at {$c}\n"); + + } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + // found a right-bracket, and we're in an array + array_pop($stk); + //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '{') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-brace, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + //print("Found start of object at {$c}\n"); + + } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + // found a right-brace, and we're in an object + array_pop($stk); + //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($substr_chrs_c_2 == '/*') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a comment start, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $c++; + //print("Found start of comment at {$c}\n"); + + } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { + // found a comment end, and we're in one now + array_pop($stk); + $c++; + + for ($i = $top['where']; $i <= $c; ++$i) + $chrs = substr_replace($chrs, ' ', $i, 1); + + //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } + + } + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + return $obj; + + } + + } + } + } + + /** + * @todo Ultimately, this should just call PEAR::isError() + */ + function isError($data, $code = null) + { + if (class_exists('pear')) { + return PEAR::isError($data, $code); + } elseif (is_object($data) && (get_class($data) == 'services_json_error' || + is_subclass_of($data, 'services_json_error'))) { + return true; + } + + return false; + } +} + +if (class_exists('PEAR_Error')) { + + class Services_JSON_Error extends PEAR_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + parent::PEAR_Error($message, $code, $mode, $options, $userinfo); + } + } + +} else { + + /** + * @todo Ultimately, this class shall be descended from PEAR_Error + */ + class Services_JSON_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + + } + } + +} + +?> diff --git a/includes/JSON/LICENSE b/includes/JSON/LICENSE new file mode 100644 index 00000000..4ae6bef5 --- /dev/null +++ b/includes/JSON/LICENSE @@ -0,0 +1,21 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/includes/JSON/Test-JSON.php b/includes/JSON/Test-JSON.php new file mode 100644 index 00000000..4a437f74 --- /dev/null +++ b/includes/JSON/Test-JSON.php @@ -0,0 +1,521 @@ + + * @author Matt Knapp + * @author Brett Stimmerman + * @copyright 2005 Michal Migurski + * @version CVS: $Id: Test-JSON.php,v 1.28 2006/06/28 05:54:17 migurski Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php + * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 + */ + + error_reporting(E_ALL); + + require_once 'PHPUnit.php'; + require_once 'JSON.php'; + + class Services_JSON_EncDec_TestCase extends PHPUnit_TestCase { + + function Services_JSON_EncDec_TestCase($name) { + $this->PHPUnit_TestCase($name); + } + + function setUp() { + $this->json = new Services_JSON(); + + $obj = new stdClass(); + $obj->a_string = '"he":llo}:{world'; + $obj->an_array = array(1, 2, 3); + $obj->obj = new stdClass(); + $obj->obj->a_number = 123; + + $this->obj = $obj; + $this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}'; + $this->obj_d = 'object with properties, nested object and arrays'; + + $this->arr = array(null, true, array(1, 2, 3), "hello\"],[world!"); + $this->arr_j = '[null,true,[1,2,3],"hello\"],[world!"]'; + $this->arr_d = 'array with elements and nested arrays'; + + $this->str1 = 'hello world'; + $this->str1_j = '"hello world"'; + $this->str1_j_ = "'hello world'"; + $this->str1_d = 'hello world'; + $this->str1_d_ = 'hello world, double quotes'; + + $this->str2 = "hello\t\"world\""; + $this->str2_j = '"hello\\t\\"world\\""'; + $this->str2_d = 'hello world, with tab, double-quotes'; + + $this->str3 = "\\\r\n\t\"/"; + $this->str3_j = '"\\\\\\r\\n\\t\\"\\/"'; + $this->str3_d = 'backslash, return, newline, tab, double-quote'; + + $this->str4 = 'héllö wørłd'; + $this->str4_j = '"h\u00e9ll\u00f6 w\u00f8r\u0142d"'; + $this->str4_j_ = '"héllö wørłd"'; + $this->str4_d = 'hello world, with unicode'; + } + + function test_to_JSON() + { + $this->assertEquals('null', $this->json->encode(null), 'type case: null'); + $this->assertEquals('true', $this->json->encode(true), 'type case: boolean true'); + $this->assertEquals('false', $this->json->encode(false), 'type case: boolean false'); + + $this->assertEquals('1', $this->json->encode(1), 'numeric case: 1'); + $this->assertEquals('-1', $this->json->encode(-1), 'numeric case: -1'); + $this->assertEquals('1.000000', $this->json->encode(1.0), 'numeric case: 1.0'); + $this->assertEquals('1.100000', $this->json->encode(1.1), 'numeric case: 1.1'); + + $this->assertEquals($this->str1_j, $this->json->encode($this->str1), "string case: {$this->str1_d}"); + $this->assertEquals($this->str2_j, $this->json->encode($this->str2), "string case: {$this->str2_d}"); + $this->assertEquals($this->str3_j, $this->json->encode($this->str3), "string case: {$this->str3_d}"); + $this->assertEquals($this->str4_j, $this->json->encode($this->str4), "string case: {$this->str4_d}"); + + $this->assertEquals($this->arr_j, $this->json->encode($this->arr), "array case: {$this->arr_d}"); + $this->assertEquals($this->obj_j, $this->json->encode($this->obj), "object case: {$this->obj_d}"); + } + + function test_from_JSON() + { + $this->assertEquals(null, $this->json->decode('null'), 'type case: null'); + $this->assertEquals(true, $this->json->decode('true'), 'type case: boolean true'); + $this->assertEquals(false, $this->json->decode('false'), 'type case: boolean false'); + + $this->assertEquals(1, $this->json->decode('1'), 'numeric case: 1'); + $this->assertEquals(-1, $this->json->decode('-1'), 'numeric case: -1'); + $this->assertEquals(1.0, $this->json->decode('1.0'), 'numeric case: 1.0'); + $this->assertEquals(1.1, $this->json->decode('1.1'), 'numeric case: 1.1'); + + $this->assertEquals(11.0, $this->json->decode('1.1e1'), 'numeric case: 1.1e1'); + $this->assertEquals(11.0, $this->json->decode('1.10e+1'), 'numeric case: 1.10e+1'); + $this->assertEquals(0.11, $this->json->decode('1.1e-1'), 'numeric case: 1.1e-1'); + $this->assertEquals(-0.11, $this->json->decode('-1.1e-1'), 'numeric case: -1.1e-1'); + + $this->assertEquals($this->str1, $this->json->decode($this->str1_j), "string case: {$this->str1_d}"); + $this->assertEquals($this->str1, $this->json->decode($this->str1_j_), "string case: {$this->str1_d_}"); + $this->assertEquals($this->str2, $this->json->decode($this->str2_j), "string case: {$this->str2_d}"); + $this->assertEquals($this->str3, $this->json->decode($this->str3_j), "string case: {$this->str3_d}"); + $this->assertEquals($this->str4, $this->json->decode($this->str4_j), "string case: {$this->str4_d}"); + $this->assertEquals($this->str4, $this->json->decode($this->str4_j_), "string case: {$this->str4_d}"); + + $this->assertEquals($this->arr, $this->json->decode($this->arr_j), "array case: {$this->arr_d}"); + $this->assertEquals($this->obj, $this->json->decode($this->obj_j), "object case: {$this->obj_d}"); + } + + function test_to_then_from_JSON() + { + $this->assertEquals(null, $this->json->decode($this->json->encode(null)), 'type case: null'); + $this->assertEquals(true, $this->json->decode($this->json->encode(true)), 'type case: boolean true'); + $this->assertEquals(false, $this->json->decode($this->json->encode(false)), 'type case: boolean false'); + + $this->assertEquals(1, $this->json->decode($this->json->encode(1)), 'numeric case: 1'); + $this->assertEquals(-1, $this->json->decode($this->json->encode(-1)), 'numeric case: -1'); + $this->assertEquals(1.0, $this->json->decode($this->json->encode(1.0)), 'numeric case: 1.0'); + $this->assertEquals(1.1, $this->json->decode($this->json->encode(1.1)), 'numeric case: 1.1'); + + $this->assertEquals($this->str1, $this->json->decode($this->json->encode($this->str1)), "string case: {$this->str1_d}"); + $this->assertEquals($this->str2, $this->json->decode($this->json->encode($this->str2)), "string case: {$this->str2_d}"); + $this->assertEquals($this->str3, $this->json->decode($this->json->encode($this->str3)), "string case: {$this->str3_d}"); + $this->assertEquals($this->str4, $this->json->decode($this->json->encode($this->str4)), "string case: {$this->str4_d}"); + + $this->assertEquals($this->arr, $this->json->decode($this->json->encode($this->arr)), "array case: {$this->arr_d}"); + $this->assertEquals($this->obj, $this->json->decode($this->json->encode($this->obj)), "object case: {$this->obj_d}"); + } + + function test_from_then_to_JSON() + { + $this->assertEquals('null', $this->json->encode($this->json->decode('null')), 'type case: null'); + $this->assertEquals('true', $this->json->encode($this->json->decode('true')), 'type case: boolean true'); + $this->assertEquals('false', $this->json->encode($this->json->decode('false')), 'type case: boolean false'); + + $this->assertEquals('1', $this->json->encode($this->json->decode('1')), 'numeric case: 1'); + $this->assertEquals('-1', $this->json->encode($this->json->decode('-1')), 'numeric case: -1'); + $this->assertEquals('1.0', $this->json->encode($this->json->decode('1.0')), 'numeric case: 1.0'); + $this->assertEquals('1.1', $this->json->encode($this->json->decode('1.1')), 'numeric case: 1.1'); + + $this->assertEquals($this->str1_j, $this->json->encode($this->json->decode($this->str1_j)), "string case: {$this->str1_d}"); + $this->assertEquals($this->str2_j, $this->json->encode($this->json->decode($this->str2_j)), "string case: {$this->str2_d}"); + $this->assertEquals($this->str3_j, $this->json->encode($this->json->decode($this->str3_j)), "string case: {$this->str3_d}"); + $this->assertEquals($this->str4_j, $this->json->encode($this->json->decode($this->str4_j)), "string case: {$this->str4_d}"); + $this->assertEquals($this->str4_j, $this->json->encode($this->json->decode($this->str4_j_)), "string case: {$this->str4_d}"); + + $this->assertEquals($this->arr_j, $this->json->encode($this->json->decode($this->arr_j)), "array case: {$this->arr_d}"); + $this->assertEquals($this->obj_j, $this->json->encode($this->json->decode($this->obj_j)), "object case: {$this->obj_d}"); + } + } + + class Services_JSON_AssocArray_TestCase extends PHPUnit_TestCase { + + function Services_JSON_AssocArray_TestCase($name) { + $this->PHPUnit_TestCase($name); + } + + function setUp() { + $this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + $this->json_s = new Services_JSON(); + + $this->arr = array('car1'=> array('color'=> 'tan', 'model' => 'sedan'), + 'car2' => array('color' => 'red', 'model' => 'sports')); + $this->arr_jo = '{"car1":{"color":"tan","model":"sedan"},"car2":{"color":"red","model":"sports"}}'; + $this->arr_d = 'associative array with nested associative arrays'; + + $this->arn = array(0=> array(0=> 'tan\\', 'model\\' => 'sedan'), 1 => array(0 => 'red', 'model' => 'sports')); + $this->arn_ja = '[{"0":"tan\\\\","model\\\\":"sedan"},{"0":"red","model":"sports"}]'; + $this->arn_d = 'associative array with nested associative arrays, and some numeric keys thrown in'; + + $this->arrs = array (1 => 'one', 2 => 'two', 5 => 'five'); + $this->arrs_jo = '{"1":"one","2":"two","5":"five"}'; + $this->arrs_d = 'associative array numeric keys which are not fully populated in a range of 0 to length-1'; + } + + function test_type() + { + $this->assertEquals('array', gettype($this->json_l->decode($this->arn_ja)), "loose type should be array"); + $this->assertEquals('array', gettype($this->json_s->decode($this->arn_ja)), "strict type should be array"); + } + + function test_to_JSON() + { + // both strict and loose JSON should result in an object + $this->assertEquals($this->arr_jo, $this->json_l->encode($this->arr), "array case - loose: {$this->arr_d}"); + $this->assertEquals($this->arr_jo, $this->json_s->encode($this->arr), "array case - strict: {$this->arr_d}"); + + // ...unless the input array has some numeric indeces, in which case the behavior is to degrade to a regular array + $this->assertEquals($this->arn_ja, $this->json_s->encode($this->arn), "array case - strict: {$this->arn_d}"); + + // Test a sparsely populated numerically indexed associative array + $this->assertEquals($this->arrs_jo, $this->json_l->encode($this->arrs), "sparse numeric assoc array: {$this->arrs_d}"); + } + + function test_to_then_from_JSON() + { + // these tests motivated by a bug in which strings that end + // with backslashes followed by quotes were incorrectly decoded. + + foreach(array('\\"', '\\\\"', '\\"\\"', '\\""\\""', '\\\\"\\\\"') as $v) { + $this->assertEquals(array($v), $this->json_l->decode($this->json_l->encode(array($v)))); + $this->assertEquals(array('a' => $v), $this->json_l->decode($this->json_l->encode(array('a' => $v)))); + } + } + } + + class Services_JSON_NestedArray_TestCase extends PHPUnit_TestCase { + + function Services_JSON_NestedArray_TestCase($name) { + $this->PHPUnit_TestCase($name); + } + + function setUp() { + $this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + + $this->str1 = '[{"this":"that"}]'; + $this->arr1 = array(array('this' => 'that')); + + $this->str2 = '{"this":["that"]}'; + $this->arr2 = array('this' => array('that')); + + $this->str3 = '{"params":[{"foo":["1"],"bar":"1"}]}'; + $this->arr3 = array('params' => array(array('foo' => array('1'), 'bar' => '1'))); + + $this->str4 = '{"0": {"foo": "bar", "baz": "winkle"}}'; + $this->arr4 = array('0' => array('foo' => 'bar', 'baz' => 'winkle')); + + $this->str5 = '{"params":[{"options": {"old": [ ], "new": {"0": {"elements": {"old": [], "new": {"0": {"elementName": "aa", "isDefault": false, "elementRank": "0", "priceAdjust": "0", "partNumber": ""}}}, "optionName": "aa", "isRequired": false, "optionDesc": null}}}}]}'; + $this->arr5 = array ( + 'params' => array ( + 0 => array ( + 'options' => + array ( + 'old' => array(), + 'new' => array ( + 0 => array ( + 'elements' => array ( + 'old' => array(), + 'new' => array ( + 0 => array ( + 'elementName' => 'aa', + 'isDefault' => false, + 'elementRank' => '0', + 'priceAdjust' => '0', + 'partNumber' => '', + ), + ), + ), + 'optionName' => 'aa', + 'isRequired' => false, + 'optionDesc' => NULL, + ), + ), + ), + ), + ), + ); + } + + function test_type() + { + $this->assertEquals('array', gettype($this->json->decode($this->str1)), "loose type should be array"); + $this->assertEquals('array', gettype($this->json->decode($this->str2)), "loose type should be array"); + $this->assertEquals('array', gettype($this->json->decode($this->str3)), "loose type should be array"); + } + + function test_from_JSON() + { + $this->assertEquals($this->arr1, $this->json->decode($this->str1), "simple compactly-nested array"); + $this->assertEquals($this->arr2, $this->json->decode($this->str2), "simple compactly-nested array"); + $this->assertEquals($this->arr3, $this->json->decode($this->str3), "complex compactly nested array"); + $this->assertEquals($this->arr4, $this->json->decode($this->str4), "complex compactly nested array"); + $this->assertEquals($this->arr5, $this->json->decode($this->str5), "super complex compactly nested array"); + } + + function _test_from_JSON() + { + $super = '{"params":[{"options": {"old": {}, "new": {"0": {"elements": {"old": {}, "new": {"0": {"elementName": "aa", "isDefault": false, "elementRank": "0", "priceAdjust": "0", "partNumber": ""}}}, "optionName": "aa", "isRequired": false, "optionDesc": ""}}}}]}'; + print("trying {$super}...\n"); + print var_export($this->json->decode($super)); + } + } + + class Services_JSON_Object_TestCase extends PHPUnit_TestCase { + + function Services_JSON_Object_TestCase($name) { + $this->PHPUnit_TestCase($name); + } + + function setUp() { + $this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + $this->json_s = new Services_JSON(); + + $this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}'; + + $this->obj1->car1->color = 'tan'; + $this->obj1->car1->model = 'sedan'; + $this->obj1->car2->color = 'red'; + $this->obj1->car2->model = 'sports'; + $this->obj1_j = '{"car1":{"color":"tan","model":"sedan"},"car2":{"color":"red","model":"sports"}}'; + $this->obj1_d = 'Object with nested objects'; + } + + function test_type() + { + $this->assertEquals('object', gettype($this->json_s->decode($this->obj_j)), "checking whether decoded type is object"); + $this->assertEquals('array', gettype($this->json_l->decode($this->obj_j)), "checking whether decoded type is array"); + } + + function test_to_JSON() + { + $this->assertEquals($this->obj1_j, $this->json_s->encode($this->obj1), "object - strict: {$this->obj1_d}"); + $this->assertEquals($this->obj1_j, $this->json_l->encode($this->obj1), "object - loose: {$this->obj1_d}"); + } + + function test_from_then_to_JSON() + { + $this->assertEquals($this->obj_j, $this->json_s->encode($this->json_s->decode($this->obj_j)), "object case"); + $this->assertEquals($this->obj_j, $this->json_l->encode($this->json_l->decode($this->obj_j)), "array case"); + } + } + + class Services_JSON_Spaces_Comments_TestCase extends PHPUnit_TestCase { + + function Services_JSON_Spaces_Comments_TestCase($name) { + $this->PHPUnit_TestCase($name); + } + + function setUp() { + $this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + + $this->obj_j = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"obj":{"a_number":123}}'; + + $this->obj_js = '{"a_string": "\"he\":llo}:{world", + "an_array":[1, 2, 3], + "obj": {"a_number":123}}'; + + $this->obj_jc1 = '{"a_string": "\"he\":llo}:{world", + // here is a comment, hoorah + "an_array":[1, 2, 3], + "obj": {"a_number":123}}'; + + $this->obj_jc2 = '/* this here is the sneetch */ "the sneetch" + // this has been the sneetch.'; + + $this->obj_jc3 = '{"a_string": "\"he\":llo}:{world", + /* here is a comment, hoorah */ + "an_array":[1, 2, 3 /* and here is another */], + "obj": {"a_number":123}}'; + + $this->obj_jc4 = '{\'a_string\': "\"he\":llo}:{world", + /* here is a comment, hoorah */ + \'an_array\':[1, 2, 3 /* and here is another */], + "obj": {"a_number":123}}'; + } + + function test_spaces() + { + $this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_js), "checking whether notation with spaces works"); + } + + function test_comments() + { + $this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc1), "checking whether notation with single line comments works"); + $this->assertEquals('the sneetch', $this->json->decode($this->obj_jc2), "checking whether notation with multiline comments works"); + $this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc3), "checking whether notation with multiline comments works"); + $this->assertEquals($this->json->decode($this->obj_j), $this->json->decode($this->obj_jc4), "checking whether notation with single-quotes and multiline comments works"); + } + } + + class Services_JSON_Empties_TestCase extends PHPUnit_TestCase { + + function Services_JSON_Empties_TestCase($name) { + $this->PHPUnit_TestCase($name); + } + + function setUp() { + $this->json_l = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + $this->json_s = new Services_JSON(); + + $this->obj0_j = '{}'; + $this->arr0_j = '[]'; + + $this->obj1_j = '{ }'; + $this->arr1_j = '[ ]'; + + $this->obj2_j = '{ /* comment inside */ }'; + $this->arr2_j = '[ /* comment inside */ ]'; + } + + function test_type() + { + $this->assertEquals('array', gettype($this->json_l->decode($this->arr0_j)), "should be array"); + $this->assertEquals('object', gettype($this->json_s->decode($this->obj0_j)), "should be object"); + + $this->assertEquals(0, count($this->json_l->decode($this->arr0_j)), "should be empty array"); + $this->assertEquals(0, count(get_object_vars($this->json_s->decode($this->obj0_j))), "should be empty object"); + + $this->assertEquals('array', gettype($this->json_l->decode($this->arr1_j)), "should be array, even with space"); + $this->assertEquals('object', gettype($this->json_s->decode($this->obj1_j)), "should be object, even with space"); + + $this->assertEquals(0, count($this->json_l->decode($this->arr1_j)), "should be empty array, even with space"); + $this->assertEquals(0, count(get_object_vars($this->json_s->decode($this->obj1_j))), "should be empty object, even with space"); + + $this->assertEquals('array', gettype($this->json_l->decode($this->arr2_j)), "should be array, despite comment"); + $this->assertEquals('object', gettype($this->json_s->decode($this->obj2_j)), "should be object, despite comment"); + + $this->assertEquals(0, count($this->json_l->decode($this->arr2_j)), "should be empty array, despite comment"); + $this->assertEquals(0, count(get_object_vars($this->json_s->decode($this->obj2_j))), "should be empty object, despite commentt"); + } + } + + class Services_JSON_UnquotedKeys_TestCase extends PHPUnit_TestCase { + + function Services_JSON_UnquotedKeys_TestCase($name) { + $this->PHPUnit_TestCase($name); + } + + function setUp() { + $this->json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + + $this->arn = array(0=> array(0=> 'tan', 'model' => 'sedan'), 1 => array(0 => 'red', 'model' => 'sports')); + $this->arn_ja = '[{0:"tan","model":"sedan"},{"0":"red",model:"sports"}]'; + $this->arn_d = 'associative array with unquoted keys, nested associative arrays, and some numeric keys thrown in'; + + $this->arrs = array (1 => 'one', 2 => 'two', 5 => 'fi"ve'); + $this->arrs_jo = '{"1":"one",2:"two","5":\'fi"ve\'}'; + $this->arrs_d = 'associative array with unquoted keys, single-quoted values, numeric keys which are not fully populated in a range of 0 to length-1'; + } + + function test_from_JSON() + { + // ...unless the input array has some numeric indeces, in which case the behavior is to degrade to a regular array + $this->assertEquals($this->arn, $this->json->decode($this->arn_ja), "array case - strict: {$this->arn_d}"); + + // Test a sparsely populated numerically indexed associative array + $this->assertEquals($this->arrs, $this->json->decode($this->arrs_jo), "sparse numeric assoc array: {$this->arrs_d}"); + } + } + + class Services_JSON_ErrorSuppression_TestCase extends PHPUnit_TestCase { + + function Services_JSON_ErrorSuppression_TestCase($name) { + $this->PHPUnit_TestCase($name); + } + + function setUp() { + $this->json = new Services_JSON(); + $this->json_ = new Services_JSON(SERVICES_JSON_SUPPRESS_ERRORS); + + $this->res = tmpfile(); + $this->res_j_ = 'null'; + $this->res_d = 'naked resource'; + + $this->arr = array('a', 1, tmpfile()); + $this->arr_j_ = '["a",1,null]'; + $this->arr_d = 'array with string, number and resource'; + + $obj = new stdClass(); + $obj->a_string = '"he":llo}:{world'; + $obj->an_array = array(1, 2, 3); + $obj->resource = tmpfile(); + + $this->obj = $obj; + $this->obj_j_ = '{"a_string":"\"he\":llo}:{world","an_array":[1,2,3],"resource":null}'; + $this->obj_d = 'object with properties, array, and nested resource'; + } + + function test_to_JSON() + { + $this->assertTrue(Services_JSON::isError($this->json->encode($this->res)), "resource case: {$this->res_d}"); + $this->assertTrue(Services_JSON::isError($this->json->encode($this->arr)), "array case: {$this->arr_d}"); + $this->assertTrue(Services_JSON::isError($this->json->encode($this->obj)), "object case: {$this->obj_d}"); + } + + function test_to_JSON_suppressed() + { + $this->assertEquals($this->res_j_, $this->json_->encode($this->res), "resource case: {$this->res_d}"); + $this->assertEquals($this->arr_j_, $this->json_->encode($this->arr), "array case: {$this->arr_d}"); + $this->assertEquals($this->obj_j_, $this->json_->encode($this->obj), "object case: {$this->obj_d}"); + } + } + + $suite = new PHPUnit_TestSuite('Services_JSON_EncDec_TestCase'); + $result = PHPUnit::run($suite); + echo $result->toString(); + + $suite = new PHPUnit_TestSuite('Services_JSON_AssocArray_TestCase'); + $result = PHPUnit::run($suite); + echo $result->toString(); + + $suite = new PHPUnit_TestSuite('Services_JSON_NestedArray_TestCase'); + $result = PHPUnit::run($suite); + echo $result->toString(); + + $suite = new PHPUnit_TestSuite('Services_JSON_Object_TestCase'); + $result = PHPUnit::run($suite); + echo $result->toString(); + + $suite = new PHPUnit_TestSuite('Services_JSON_Spaces_Comments_TestCase'); + $result = PHPUnit::run($suite); + echo $result->toString(); + + $suite = new PHPUnit_TestSuite('Services_JSON_Empties_TestCase'); + $result = PHPUnit::run($suite); + echo $result->toString(); + + $suite = new PHPUnit_TestSuite('Services_JSON_UnquotedKeys_TestCase'); + $result = PHPUnit::run($suite); + echo $result->toString(); + + $suite = new PHPUnit_TestSuite('Services_JSON_ErrorSuppression_TestCase'); + $result = PHPUnit::run($suite); + echo $result->toString(); + +?> diff --git a/includes/advanced.inc b/includes/advanced.inc new file mode 100644 index 00000000..7ee940e8 --- /dev/null +++ b/includes/advanced.inc @@ -0,0 +1,453 @@ +assign("message", $message); +$tpl->assign("web_vars", WEB_VARS); + +echo $tpl->draw( 'global_header' ); +echo $tpl->draw( 'global_links' ); +echo $tpl->draw( 'advanced_subheader' ); + +if(!isset($_REQUEST['subpage'])) { + $_REQUEST['subpage'] = ""; +} + +switch($_REQUEST['subpage']) { + case "iedl": + $amp_serial = base64_encode(serialize($amp_conf)); + $amp_serial = base64_encode(serialize($amp_conf)); + $temp_amp['amp_serial'] = $amp_serial; + $temp_amp = base64_encode(serialize($temp_amp)); + + $outfile=LOCAL_PATH."/includes/amp.ini"; + $wfh=fopen($outfile,'w'); + fwrite($wfh, $temp_amp); + fclose($wfh); + $tpl->assign("exporter_address", $_SERVER["HTTP_HOST"]."/admin/modules/endpointman/includes/export.php"); + //Dave B's Q&D file upload security code (http://us2.php.net/manual/en/features.file-upload.php) + if((isset($_REQUEST['action'])) AND (isset($_REQUEST['button_import'])) AND ($_REQUEST['action'] == "import")) { + $allowedExtensions = array("csv","txt"); + foreach ($_FILES as $file) { + if ($file['tmp_name'] > '') { + if (!in_array(end(explode(".", strtolower($file['name']))), $allowedExtensions)) { + $tpl->assign("message", "We support only CVS and TXT files"); + } else { + $uploaddir = LOCAL_PATH; + $uploadfile = $uploaddir . basename($_FILES['import_csv']['name']); + if (move_uploaded_file($_FILES['import_csv']['tmp_name'], $uploadfile)) { + //Parse the uploaded file + $handle = fopen(LOCAL_PATH.$_FILES['import_csv']['name'], "r"); + $i = 1; + while (($device = fgetcsv($handle, filesize(LOCAL_PATH.$_FILES['import_csv']['name']))) !== FALSE) { + if($device[0] != "") { + if($mac = $endpoint->mac_check_clean($device[0])) { + $sql = "SELECT id FROM endpointman_brand_list WHERE name LIKE '%".$device[1]."%' LIMIT 1"; + $res_brand = mysql_query($sql); + if(mysql_num_rows($res_brand)) { + $brand_id = mysql_fetch_row($res_brand); + $brand_id = $brand_id[0]; + } else { + $brand_id = 0; + } + $sql = "SELECT id FROM endpointman_model_list WHERE brand = ".$brand_id." AND model LIKE '%".$device[2]."%' LIMIT 1"; + $res_model = mysql_query($sql); + $sql = "SELECT extension, name FROM users WHERE extension LIKE '%".$device[3]."%' LIMIT 1"; + $res_ext = mysql_query($sql); + if(mysql_num_rows($res_model)) { + $model_id = mysql_fetch_row($res_model); + $model_id = $model_id[0]; + } else { + $model_id = 0; + } + if(mysql_num_rows($res_ext)) { + $ext = mysql_fetch_row($res_ext); + $description = $ext[1]; + $ext = $ext[0]; + } else { + $ext = ''; + $description = ''; + } + $sql = "INSERT INTO endpointman_mac_list (mac, model, ext, description) VALUES ('".$mac."','".$model_id."','".$ext."','".$description."')"; + mysql_query($sql); + $message .= "Inserted Mac Address ".$mac."
"; + } else { + $message .= "Invalid Mac on line ". $i. "
"; + } + } + $i++; + } + fclose($handle); + unlink(LOCAL_PATH.$_FILES['import_csv']['name']); + $message .= "Please reboot & rebuild all imported phones
"; + $tpl->assign("message", $message); + } else { + $tpl->assign("message", "Possible file upload attack!"); + + } + } + } + } + } + echo $tpl->draw( 'advanced_settings_iedl' ); + break; + case "sh_manager": + if(isset($_REQUEST['button_hide'])) { + if(isset($_REQUEST['model'])) { + $sql = "UPDATE endpointman_model_list SET hidden = 1 WHERE id = ".$_REQUEST['model']; + } elseif(isset($_REQUEST['brand'])) { + $sql = "UPDATE endpointman_brand_list SET hidden = 1 WHERE id = ".$_REQUEST['brand']; + } elseif(isset($_REQUEST['product'])) { + $sql = "UPDATE endpointman_product_list SET hidden = 1 WHERE id = ".$_REQUEST['product']; + } + mysql_query($sql); + }elseif(isset($_REQUEST['button_show'])) { + if(isset($_REQUEST['model'])) { + $sql = "UPDATE endpointman_model_list SET hidden = 0 WHERE id = ".$_REQUEST['model']; + } elseif(isset($_REQUEST['brand'])) { + $sql = "UPDATE endpointman_brand_list SET hidden = 0 WHERE id = ".$_REQUEST['brand']; + } elseif(isset($_REQUEST['product'])) { + $sql = "UPDATE endpointman_product_list SET hidden = 0 WHERE id = ".$_REQUEST['product']; + } + mysql_query($sql); + } + $sql="SELECT * from endpointman_brand_list WHERE id > 0 ORDER BY id ASC "; + $result=mysql_query($sql); + $i = 0; + while($row = mysql_fetch_assoc($result)) { + $row_out[$i] = $row; + $row_out[$i]['count'] = $i; + if($row['installed']){ + $j = 0; + $sql = 'SELECT * FROM endpointman_product_list WHERE brand = '.$row['id'].' ORDER BY long_name ASC'; + $result2=mysql_query($sql); + $xml_data = ""; + while($row2 = mysql_fetch_assoc($result2)) { + $row_out[$i]['products'][$j] = $row2; + if($row2['installed']) { + $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = '.$row2['id']; + $result3=mysql_query($sql); + $k = 0; + while($row3 = mysql_fetch_assoc($result3)) { + $row_out[$i]['products'][$j]['models'][$k] = $row3; + $k++; + } + } + $j++; + } + } + $i++; + } + $tpl->assign("brand2_list", $row_out); + echo $tpl->draw( 'advanced_settings_sh_manager' ); + break; + case "oui_manager": + if((isset($_REQUEST['oui_sub'])) AND ($_REQUEST['rb_brand'] > 0) AND ($_REQUEST['oui'] != "")) { + $sql = "INSERT INTO endpointman_oui_list (oui, brand, custom) VALUES ('".$_REQUEST['oui']."', '".$_REQUEST['rb_brand']."', '1')"; + mysql_query($sql); + } + if((isset($_REQUEST['delete'])) AND ($_REQUEST['id'] > 0)) { + $sql = "DELETE FROM endpointman_oui_list WHERE id = ". $_REQUEST['id']; + mysql_query($sql); + } + $result = mysql_query('SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id AND endpointman_oui_list.custom = 0'); + $i = 0; + while($row = mysql_fetch_array($result)) { + $row_out[$i] = $row; + $i++; + } + $tpl->assign("oui_list", $row_out); + $result = mysql_query('SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id AND endpointman_oui_list.custom = 1'); + if(mysql_num_rows($result) > 0) { + $i = 0; + while($row = mysql_fetch_array($result)) { + $row_out_custom[$i] = $row; + $i++; + } + $tpl->assign("oui_list_custom", $row_out_custom); + } + $tpl->assign("brand_ava", $endpoint->brandAvailable()); + echo $tpl->draw( 'advanced_settings_oui' ); + break; + case "poce": + $sql = 'SELECT * FROM `endpointman_product_list` WHERE `installed` = 1 AND `id` > 0'; + $result = mysql_query($sql); + $i = 0; + while($row = mysql_fetch_assoc($result)) { + $product_list[$i]['value'] = $row['id']; + $product_list[$i]['text'] = $row['long_name']; + if((isset($_REQUEST['product_select'])) AND ($_REQUEST['product_select'] == $row['id'])) { + $product_list[$i]['selected'] = 1; + } + $i++; + } + if(isset($_REQUEST['delete'])) { + $sql = "DELETE FROM endpointman_custom_configs WHERE id =". $_REQUEST['sql']; + mysql_query($sql); + } + if(isset($_REQUEST['file'])) { + $sql = 'SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id =' . $_REQUEST['product_select']; + $result = mysql_query($sql); + $row = mysql_fetch_assoc($result); + $config_files = explode(",",$row['config_files']); + $file=PHONE_MODULES_PATH.$row['directory']."/".$row['cfg_dir']."/".$config_files[$_REQUEST['file']]; + if(isset($_REQUEST['config_text'])) { + if(isset($_REQUEST['button_save'])) { + $wfh=fopen($file,'w'); + fwrite($wfh,$_REQUEST['config_text']); + fclose($wfh); + }elseif(isset($_REQUEST['button_save_as'])) { + $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("'.addslashes($_REQUEST['save_as_name']).'","'.addslashes($config_files[$_REQUEST['file']]).'",'.$_REQUEST['product_select'].',"'.addslashes($_REQUEST['config_text']).'")'; + mysql_query($sql); + } + } + $handle = fopen($file, "rb"); + $contents = fread($handle, filesize($file)); + fclose($handle); + $tpl->assign("save_as_name_value", $config_files[$_REQUEST['file']]); + $tpl->assign("config_data", $contents); + } elseif(isset($_REQUEST['sql'])) { + if(isset($_REQUEST['config_text'])) { + if(isset($_REQUEST['button_save'])) { + $sql = "UPDATE endpointman_custom_configs SET data = '".addslashes($_REQUEST['config_text'])."' WHERE id = ".$_REQUEST['sql']; + mysql_query($sql); + }elseif(isset($_REQUEST['button_save_as'])) { + $sql = 'SELECT original_name FROM endpointman_custom_configs WHERE id = 11'; + $res = mysql_query($sql); + $file_name = mysql_fetch_array($res); + + $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("'.addslashes($_REQUEST['save_as_name']).'","'.addslashes($file_name['original_name']).'",'.$_REQUEST['product_select'].',"'.addslashes($_REQUEST['config_text']).'")'; + mysql_query($sql); + } + } + $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $_REQUEST['sql']; + $result = mysql_query($sql); + $row = mysql_fetch_assoc($result); + $tpl->assign("save_as_name_value", $row['name']); + $tpl->assign("config_data", $row['data']); + } + if(isset($_REQUEST['product_select'])) { + $endpoint->sync_product($_REQUEST['product_select']); + $sql = 'SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id =' . $_REQUEST['product_select']; + $result = mysql_query($sql); + $row = mysql_fetch_assoc($result); + $config_files = explode(",",$row['config_files']); + $i = 0; + while($i < count($config_files)) { + $file_list[$i]['value'] = $i; + $file_list[$i]['text'] = $config_files[$i]; + $i++; + } + $sql = 'SELECT * FROM `endpointman_custom_configs` WHERE `product_id` = '. $_REQUEST['product_select']; + $result = mysql_query($sql); + $i = 0; + if(mysql_num_rows($result)) { + while($row2 = mysql_fetch_assoc($result)) { + $sql_file_list[$i]['value'] = $row2['id']; + $sql_file_list[$i]['text'] = $row2['name']; + $sql_file_list[$i]['ref'] = $row2['original_name']; + $i++; + } + } else { + $sql_file_list = NULL; + } + require(PHONE_MODULES_PATH .$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + + $phone_config = new $row['cfg_dir'](); + if((method_exists($phone_config,'display_options')) AND (method_exists($phone_config,'process_options'))) { + if(isset($_REQUEST['phone_options'])) { + $tpl->assign("options", $phone_config->process_options()); + } else { + $tpl->assign("options", $phone_config->display_options()); + } + } + + $tpl->assign("file_list", $file_list); + $tpl->assign("sql_file_list", $sql_file_list); + $tpl->assign("product_selected", $_REQUEST['product_select']); + } + $tpl->assign("product_list", $product_list); + echo $tpl->draw( 'advanced_settings_poce' ); + break; + case "settings": + default: + global $global_cfg; + if(isset($_REQUEST['button_update_globals'])) { + $_POST['srvip'] = trim($_POST['srvip']); #trim whitespace from IP address + + $_POST['config_loc'] = trim($_POST['config_loc']); #trim whitespace from Config Location + + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['srvip'] . "' WHERE var_name='srvip'"; + mysql_query($sql); + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['tz'] . "' WHERE var_name='tz'"; + mysql_query($sql); + + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['config_loc'] . "' WHERE var_name='config_location'"; + mysql_query($sql); + + if((isset($_POST['enable_ari'])) AND ($_POST['enable_ari'] == "on")) { + $_POST['enable_ari'] = 1; + } else { + $_POST['enable_ari'] = 0; + } + if((isset($_POST['enable_debug'])) AND ($_POST['enable_debug'] == "on")) { + $_POST['enable_debug'] = 1; + } else { + $_POST['enable_debug'] = 0; + } + + if((isset($_POST['disable_htaccess'])) AND ($_POST['disable_htaccess'] == "on")) { + $htaccess = "allow from all"; + + $outfile = $amp_conf['AMPWEBROOT']."/admin/modules/endpointman/.htaccess"; + $wfh=fopen($outfile,'w'); + fwrite($wfh,$htaccess); + fclose($wfh); + $_POST['disable_htaccess'] = 1; + } else { + $htaccess = "allow from all +AuthName FreePBX-Admin-only +Require valid-user +AuthType Basic +AuthMySQLEnable\tOn +AuthMySQLHost\tlocalhost +AuthMySQLDB\tasterisk +AuthMySQLUserTable\tampusers +AuthMySQLUser\t".$amp_conf['AMPDBUSER']." +AuthMySQLPassword\t".$amp_conf['AMPDBPASS']." +AuthMySQLNameField\tusername +AuthMySQLPasswordField\tpassword +AuthMySQLAuthoritative\tOn +AuthMySQLPwEncryption\tnone +AuthMySQLUserCondition\t\"username = 'admin'\" + + + deny from all + +"; + + $outfile = $amp_conf['AMPWEBROOT']."/admin/modules/endpointman/.htaccess"; + $wfh=fopen($outfile,'w'); + fwrite($wfh,$htaccess); + fclose($wfh); + $_POST['disable_htaccess'] = 0; + } + if((isset($_POST['enable_updates'])) AND ($_POST['enable_updates'] == "on")) { + $_POST['enable_updates'] = 1; + $sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php ".$amp_conf['AMPWEBROOT']."/admin/modules/endpointman/includes/update_check.php')"; + mysql_query($sql); + } else { + $_POST['enable_updates'] = 0; + $sql = "DELETE FROM `cronmanager` WHERE CONVERT(`cronmanager`.`module` USING utf8) = 'endpointman' AND CONVERT(`cronmanager`.`id` USING utf8) = 'UPDATES' LIMIT 1"; + mysql_query($sql); + } + + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['enable_ari'] . "' WHERE var_name='enable_ari'"; + mysql_query($sql); + + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['enable_debug'] . "' WHERE var_name='debug'"; + mysql_query($sql); + + $sql="SELECT gmtoff,gmthr FROM endpointman_time_zones WHERE tz='" . $_POST['tz'] . "'"; + $result=mysql_query($sql); + $row=mysql_fetch_array($result); + + $sql="UPDATE endpointman_global_vars SET value='" . $row['gmtoff'] . "' where var_name='gmtoff'"; + mysql_query($sql); + $sql="UPDATE endpointman_global_vars SET value='" . $row['gmthr'] . "' where var_name='gmthr'"; + mysql_query($sql); + + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['asterisk_loc'] . "' WHERE var_name='asterisk_location'"; + mysql_query($sql); + + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['enable_updates'] . "' WHERE var_name='check_updates'"; + mysql_query($sql); + + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['nmap_loc'] . "' WHERE var_name='nmap_location'"; + mysql_query($sql); + + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['arp_loc'] . "' WHERE var_name='arp_location'"; + mysql_query($sql); + + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['disable_htaccess'] . "' WHERE var_name='disable_htaccess'"; + mysql_query($sql); + + $message = "

Updated!

"; + } + //Because we are working with global variables we probably updated them, so lets refresh those variables + $sql = "SELECT * FROM endpointman_global_vars"; + $result = mysql_query($sql); + while($row = mysql_fetch_assoc($result)) { + $global_cfg[$row['var_name']] = $row['value']; + } + + if($global_cfg['enable_ari']) { + $ari_selected = "checked"; + } else { + $ari_selected = ""; + } + + if($global_cfg['disable_htaccess']) { + $htaccess_selected = "checked"; + } else { + $htaccess_selected = ""; + } + + if($global_cfg['check_updates']) { + $updates_selected = "checked"; + } else { + $updates_selected = ""; + } + if($global_cfg['debug']) { + $debug_selected = "checked"; + global $debug; + $debug = $debug . print_r($_REQUEST,true); + $tpl->assign("debug", $debug); + } else { + $debug_selected = ""; + } + $tpl->assign("htaccess_selected", $htaccess_selected); + $tpl->assign("ari_selected", $ari_selected); + $tpl->assign("updates_selected", $updates_selected); + $tpl->assign("debug_selected", $debug_selected); + $tpl->assign("message", $message); + $tpl->assign("ip", $_SERVER["SERVER_ADDR"]); + $tpl->assign("srvip", $global_cfg['srvip']); + $tpl->assign("arp_location", $global_cfg['arp_location']); + $tpl->assign("nmap_location", $global_cfg['nmap_location']); + $tpl->assign("asterisk_location", $global_cfg['asterisk_location']); + + $tpl->assign("config_location", $global_cfg['config_location']); + $tpl->assign("list_tz", $endpoint->listTZ($global_cfg['tz'])); + $tpl->assign("brand_list", $endpoint->brandAvailable()); + echo $tpl->draw( 'advanced_settings_settings' ); + break; + + +} +if($global_cfg['debug']) { + global $debug; + $tpl->assign("debug", $debug); +} +echo $tpl->draw( 'global_footer' ); +?> \ No newline at end of file diff --git a/includes/ajax.inc b/includes/ajax.inc new file mode 100644 index 00000000..c1bcecea --- /dev/null +++ b/includes/ajax.inc @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/includes/ajax_select.php b/includes/ajax_select.php new file mode 100644 index 00000000..d64b562c --- /dev/null +++ b/includes/ajax_select.php @@ -0,0 +1,69 @@ + \ No newline at end of file diff --git a/includes/brand_model_manager.inc b/includes/brand_model_manager.inc new file mode 100644 index 00000000..0c27fa8b --- /dev/null +++ b/includes/brand_model_manager.inc @@ -0,0 +1,174 @@ + 'product', "id" => $_REQUEST['product']); + } elseif(isset($_REQUEST['brand'])) { + $installer = array("type" => 'brand', "id" => $_REQUEST['brand']); + } +} elseif((isset($_REQUEST['button_install_firmware'])) OR (isset($_REQUEST['button_update_firmware'])) AND (isset($_REQUEST['product']))) { + $installer = array("type" => 'firmware', "id" => $_REQUEST['product']); +} elseif((isset($_REQUEST['button_remove_firmware'])) AND (isset($_REQUEST['product']))) { + $endpoint->remove_firmware($_REQUEST['product']); +} elseif(isset($_REQUEST['button_disable'])) { + if(isset($_REQUEST['model'])) { + $sql = "UPDATE endpointman_model_list SET enabled = 0 WHERE id = ".$_REQUEST['model']; + } elseif(isset($_REQUEST['brand'])) { + $sql = "UPDATE endpointman_brand_list SET enabled = 0 WHERE id = ".$_REQUEST['model']; + } + mysql_query($sql); +} elseif(isset($_REQUEST['button_enable'])) { + if(isset($_REQUEST['model'])) { + $sql = "UPDATE endpointman_model_list SET enabled = 1 WHERE id = ".$_REQUEST['model']; + } elseif(isset($_REQUEST['brand'])) { + $sql = "UPDATE endpointman_brand_list SET enabled = 1 WHERE id = ".$_REQUEST['model']; + } + mysql_query($sql); +} elseif(isset($_REQUEST['button_uninstall'])) { + if(isset($_REQUEST['product'])) { + $endpoint->remove_product($_REQUEST['product']); + } elseif(isset($_REQUEST['brand'])) { + $endpoint->remove_brand($_REQUEST['brand']); + } +} elseif(isset($_REQUEST['button_check_for_updates'])) { + $brand_up = $endpoint->brand_update_check(); + $check_for_updates = TRUE; +} + +$sql="SELECT * from endpointman_brand_list WHERE id > 0 AND hidden = 0 ORDER BY id ASC "; +$result=mysql_query($sql); +$i = 0; +$note = ""; +while($row = mysql_fetch_assoc($result)) { + $row_out[$i] = $row; + $row_out[$i]['count'] = $i; + if($check_for_updates) { + $id = $endpoint->arraysearchrecursive($row['name'], $brand_up,'brand_name'); + $id = $id[0]; + if((isset($brand_up[$id]['update'])) AND ($row['installed'] == 1)) { + $row_out[$i]['update'] = $brand_up[$id]['update']; + $endpoint->add_freepbx_notification("PU_".$brand_up[$id]['brand_name'], '', "Brand \'".$brand_up[$id]['brand_name']."\' has updates available", "Old Version: ".$row['cfg_ver']." New Version: ".$brand_up[$id]['version']."
"."Changes: ". $brand_up[$id]['changes'].$note, ""); + } else { + $row_out[$i]['update'] = NULL; + } + if(isset($brand_up[$id]['update_vers'])) { + $row_out[$i]['update_vers'] = $brand_up[$id]['update_vers']; + } else { + $row_out[$i]['update_vers'] = NULL; + } + } + if($row['installed']){ + $j = 0; + $sql = 'SELECT * FROM endpointman_product_list WHERE hidden = 0 AND brand = '.$row['id'].' ORDER BY long_name ASC'; + $result2=mysql_query($sql); + while($row2 = mysql_fetch_assoc($result2)) { + $row_out[$i]['products'][$j] = $row2; + if($row_out[$i]['products'][$j]['installed']){ + $row_out[$i]['products'][$j]['installed_checked'] = 'checked'; + } + if($check_for_updates) { + if(($temp = $endpoint->product_update_check($row2['id'])) AND ($row2['installed'] == 1)) { + $row_out[$i]['products'][$j]['update'] = 1; + $row_out[$i]['products'][$j]['update_vers'] = $temp['data']['version']; + $row_out[$i]['products'][$j]['update_desc'] = $temp['data']['description']; + $endpoint->add_freepbx_notification("PU_".$row2['long_name'], '', "There is a Product update for ".$row2['long_name'], "Old Version: ".$row2['cfg_ver']." New Version: ".$temp['data']['version']."
"."Changes: ". $temp['data']['description'].$note, ""); + } else { + $row_out[$i]['products'][$j]['update'] = 0; + } + if(($temp = $endpoint->firmware_update_check($row2['id'])) AND (array_key_exists('firmware_vers', $row)) AND ($row['firmware_vers'] > 0)) { + $row_out[$i]['products'][$j]['update_fw'] = 1; + $row_out[$i]['products'][$j]['update_vers_fw'] = $temp['data']['version']; + $endpoint->add_freepbx_notification("PU_".$row2['long_name'], '', "There is a firmware update for phone module ".$row2['long_name'], "Old Version: ".$row2['firmware_vers']." New Version: ".$temp['data']['version'].$note, ""); + } else { + $row_out[$i]['products'][$j]['update_fw'] = 0; + } + $xml_data = $row2['xml_data']; + } + + $row_out[$i]['products'][$j]['fw_type'] = $endpoint->firmware_local_check($row2['id']); + + + if($row2['installed']) { + $sql = 'SELECT * FROM endpointman_model_list WHERE hidden = 0 AND product_id = '.$row2['id']; + $result3=mysql_query($sql); + $k = 0; + while($row3 = mysql_fetch_assoc($result3)) { + $row_out[$i]['products'][$j]['models'][$k] = $row3; + if($row_out[$i]['products'][$j]['models'][$k]['enabled']){ + $row_out[$i]['products'][$j]['models'][$k]['enabled_checked'] = 'checked'; + } + $k++; + } + } + $j++; + } + } + $i++; +} + +//initialize a Rain TPL object +$tpl = new RainTPL( LOCAL_PATH.'templates' ); + +if (!isset($error)) { + $error = ""; +} +if (!isset($_POST['brand'])) { + $brand = NULL; +} else { + $brand = $_POST['brand']; +} +if (isset($installer)) { + $data = base64_encode(serialize($installer)); + $amp_serial = base64_encode(serialize($amp_conf)); + $temp_amp['data'] = $data; + $temp_amp['amp_serial'] = $amp_serial; + $temp_amp = base64_encode(serialize($temp_amp)); + + $outfile=LOCAL_PATH."/includes/amp.ini"; + $wfh=fopen($outfile,'w'); + fwrite($wfh, $temp_amp); + fclose($wfh); + $tpl->assign("installer_address", $_SERVER["HTTP_HOST"]."/admin/modules/endpointman/includes/installer.php"); +} + +global $debug, $global_cfg; +if($global_cfg['debug']) { + if(file_exists(LOCAL_PATH."debug_installer.log")) { + $outfile=LOCAL_PATH."debug_installer.log"; + $wfh=fopen($outfile,'r'); + $contents = fread($wfh, filesize($outfile)); + fclose($wfh); + unlink(LOCAL_PATH."debug_installer.log"); + } else { + $contents = ""; + } + $debug .= $contents; + $tpl->assign("debug", $debug); +} +$tpl->assign("error", $error); +$tpl->assign("web_vars", WEB_VARS); +$tpl->assign("brand2_list", $row_out); +//draw the template +echo $tpl->draw( 'brand_model_manager' ); +?> \ No newline at end of file diff --git a/includes/databases/freepbxv2.inc b/includes/databases/freepbxv2.inc new file mode 100644 index 00000000..ae36db2f --- /dev/null +++ b/includes/databases/freepbxv2.inc @@ -0,0 +1,14 @@ +getAll($query, DB_FETCHMODE_ASSOC); + return($out); + } + function query_row($query) { + global $db; + $out = $db->getAll($query, DB_FETCHMODE_ASSOC); + return($out[0]); + } +} +?> \ No newline at end of file diff --git a/includes/databases/freepbxv3.inc b/includes/databases/freepbxv3.inc new file mode 100644 index 00000000..e69de29b diff --git a/includes/databases/mysql.inc b/includes/databases/mysql.inc new file mode 100644 index 00000000..41cb7102 --- /dev/null +++ b/includes/databases/mysql.inc @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/includes/default.inc b/includes/default.inc new file mode 100644 index 00000000..9a7235ab --- /dev/null +++ b/includes/default.inc @@ -0,0 +1,7 @@ +draw( 'main' ); +?> \ No newline at end of file diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc new file mode 100644 index 00000000..19779546 --- /dev/null +++ b/includes/devices_manager.inc @@ -0,0 +1,389 @@ + 0"; +$result = mysql_query($sql); +$sql2 = "SELECT * FROM endpointman_mac_list"; +$result2 = mysql_query($sql2); +if((!mysql_num_rows($result)) && (!mysql_num_rows($result2))) { + $message = "Welcome to Enpoint Manager!
You have no products (Modules) installed, click here to install some"; + $no_add = TRUE; +} elseif(!mysql_num_rows($result)) { + $message = "Thanks for upgrading to version 2.0! Please head on over to \"Brand Configurations/Setup\" to setup and install phone configurations"; + $no_add = TRUE; +} elseif($global_cfg['srvip'] == "") { + $message = "Your Global Variables are not set! Please head on over to \"Advanced Settings\" to setup your configuration"; + $no_add = TRUE; +} +if(isset($_REQUEST['button_add'])) { + if($mac = $endpoint->mac_check_clean($_REQUEST['mac'])) { + $sql = 'SELECT `name` FROM `users` WHERE `extension` = '.$_REQUEST['ext_list']; + $result=mysql_query($sql); + $name=mysql_fetch_array($result); + + $sql = 'SELECT endpointman_product_list. * , endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id = \''.$_REQUEST['model_list'].'\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id'; + $result=mysql_query($sql); + $row=mysql_fetch_array($result); + + $cfg_data = unserialize($row['cfg_data']); + $count = count($cfg_data); + $i = 0; + while($i < $count) { + if(array_key_exists('variable',$cfg_data[$i])) { + $temping = str_replace('$','',$cfg_data[$i]['variable']); + if(is_array($cfg_data[$i]['default_value'])) { + $custom_cfg_data[$temping]['value'] = ''; + } else { + $custom_cfg_data[$temping]['value'] = $cfg_data[$i]['default_value']; + } + } + $i++; + } + $custom_cfg_data = serialize($custom_cfg_data); + + $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `ext`, `description`, `custom_cfg_data`, `custom_cfg_template`) VALUES ('".$mac."', '".$_REQUEST['model_list']."', '".$_REQUEST['ext_list']."', '".$name['name']."', '".$custom_cfg_data."', '".$_REQUEST['template_list']."')"; + mysql_query($sql); + + $sql = 'SELECT id FROM endpointman_mac_list WHERE ext ='. $_REQUEST['ext_list']; + $result=mysql_query($sql); + $ext_id=mysql_fetch_array($result); + + require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + + $phone_config = new $row['cfg_dir'](); + $phone_config->generate_config($ext_id['id']); + $message = _("Saved")."!"; + } else { + $message = _("Invalid MAC Address")."!"; + } +} elseif(isset($_REQUEST['editready'])) { + $edit_row=$endpoint->get_phone_info($_REQUEST['id']); + $edit_row['id'] = $_REQUEST['id']; + $mode = "EDIT"; +} elseif(isset($_REQUEST['button_edit'])) { + $template_editor = TRUE; + if ($_REQUEST['template_list'] == 0) { + $endpoint->edit_template_display($_REQUEST['edit_id'],1); + } else { + $endpoint->edit_template_display($_REQUEST['template_list'],0); + } +} elseif(isset($_REQUEST['button_save'])) { + $sql = "SELECT name FROM users WHERE extension = ".$_REQUEST['ext_list']; + $result=mysql_query($sql); + $name=mysql_fetch_array($result); + + $sql = "UPDATE endpointman_mac_list SET custom_cfg_template = '".$_REQUEST['template_list']."', model = ".$_REQUEST['model_list'].", ext = ".$_REQUEST['ext_list'].", description = '".$name['name']."' WHERE id = ". $_REQUEST['edit_id']; + $result=mysql_query($sql); + + $row = $endpoint->get_phone_info($_REQUEST['edit_id']); + + require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + $phone_config = new $row['cfg_dir'](); + + $phone_config->generate_config($_REQUEST['edit_id']); + $message = _("Saved")."!"; +} elseif(isset($_REQUEST['deleteready'])) { + $row = $endpoint->get_phone_info($_REQUEST['id']); + + if(file_exists(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc')) { + require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + + $phone_config = new $row['cfg_dir'](); + $phone_config->delete_config($_REQUEST['id']); + unset($phone_config); + } + + $sql = "DELETE FROM endpointman_mac_list WHERE id=".$_REQUEST['id']; + $result=mysql_query($sql); +} elseif((isset($_REQUEST['button_add_selected_phones'])) AND (isset($_REQUEST['add']))) { + $list_num = count($_REQUEST['add']); + for($i=0;$i<$list_num;$i++) { + $num = $_REQUEST['add'][$i]; + if($mac = $endpoint->mac_check_clean($_REQUEST['mac_'.$num])) { + $sql = "SELECT * FROM endpointman_mac_list WHERE ext = ".$_REQUEST['ext_list_'.$num]; + $result=mysql_query($sql); + if(!mysql_num_rows($result)) { + $sql = 'SELECT `name` FROM `users` WHERE `extension` = '.$_REQUEST['ext_list_'.$num]; + $result=mysql_query($sql); + $name=mysql_fetch_array($result); + + $sql = 'SELECT endpointman_product_list. * , endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id = \''.$_REQUEST['model_list_'.$num].'\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id'; + $result=mysql_query($sql); + $row=mysql_fetch_array($result); + + $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `ext`, `description`) VALUES ('".$mac."', '".$_REQUEST['model_list_'.$num]."', '".$_REQUEST['ext_list_'.$num]."', '".$name['name']."')"; + mysql_query($sql); + + $sql = 'SELECT id FROM endpointman_mac_list WHERE ext ='. $_REQUEST['ext_list_'.$num]; + $result=mysql_query($sql); + $ext_id=mysql_fetch_array($result); + + if(file_exists(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc')) { + require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + $phone_config = new $row['cfg_dir'](); + $phone_config->generate_config($ext_id['id']); + unset($phone_config); + } + $message = _("Saved")."!"; + } else { + $message = _("One or more selected phones had the same extension as a phone already added, these devices were not added"); + } + + } else { + $message = _("Invalid MAC Address"); + } + } +} elseif((isset($_REQUEST['button_update_phones'])) AND (isset($_REQUEST['selected']))) { + $list_num = count($_REQUEST['selected']); + for($i=0;$i<$list_num;$i++) { + if(($_REQUEST['brand_list_selected'] > 0) AND ($_REQUEST['model_list_selected'] > 0)) { + $sql = "UPDATE endpointman_mac_list SET custom_cfg_data = '', custom_cfg_template = '', user_cfg_data = '', config_files_override = '', model = ".$_REQUEST['model_list_selected']." WHERE id = ". $_REQUEST['selected'][$i]; + $result=mysql_query($sql); + + $row = $endpoint->get_phone_info($_REQUEST['selected'][$i]); + + require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + $phone_config = new $row['cfg_dir'](); + + $phone_config->generate_config($_REQUEST['selected'][$i]); + $message = _("Saved")."!"; + } else { + $message = _("Please select a Brand and/or Model"); + } + } +} elseif(isset($_REQUEST['button_delete_selected_phones'])) { + if(isset($_REQUEST['selected'])) { + $list_num = count($_REQUEST['selected']); + for($i=0;$i<$list_num;$i++) { + $row = $endpoint->get_phone_info($_REQUEST['selected'][$i]); + + if(file_exists(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc')) { + require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + + $phone_config = new $row['cfg_dir'](); + $phone_config->delete_config($_REQUEST['selected'][$i]); + unset($phone_config); + } + + $sql = "DELETE FROM endpointman_mac_list WHERE id=".$_REQUEST['selected'][$i]; + $result=mysql_query($sql); + } + } else { + $message = _("No Phones Selected")."!"; + } +} elseif(isset($_REQUEST['button_go'])) { + if ($_REQUEST['nmap'] == 1) { + $temp = $endpoint->discover_new($_REQUEST['netmask']); + } else { + $temp = $endpoint->discover_new($_REQUEST['netmask'], FALSE); + } + $count = count($temp); + $i = 0; + while($i < $count) { + if (!$temp[$i]['endpoint_managed']) { + if ($temp[$i]['brand']) { + $final[$i] = $temp[$i]; + $final[$i]['id'] = $i; + $sqln = "SELECT * FROM endpointman_model_list WHERE enabled = 1 AND brand =".$temp[$i]['brand_id']; + $model_list=mysql_query($sqln); + $j = 0; + while($row = mysql_fetch_assoc($model_list)) { + $final[$i]['list'][$j] = $row; + $j++; + } + } + } + $i++; + } + if($final) { + $final = array_values($final); + } else { + $final = NULL; + $message = _("No Devices Found"); + } + $searched = 1; +} elseif(isset($_REQUEST['button_rebuild_configs_for_all_phones'])) { + $sql = "SELECT endpointman_brand_list.directory, endpointman_mac_list.id, endpointman_product_list.cfg_dir FROM endpointman_mac_list, endpointman_brand_list, endpointman_product_list, endpointman_model_list WHERE endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.model = endpointman_model_list.id ORDER BY endpointman_product_list.cfg_dir ASC"; + $result = mysql_query($sql); + while($row = mysql_fetch_assoc($result)) { + if(file_exists(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc')) { + require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + $phone_config = new $row['cfg_dir'](); + $phone_config->generate_config($row['id']); + unset($phone_config); + } + } +} elseif(isset($_REQUEST['button_rebuild_reboot'])) { + if($_REQUEST['product_select'] == "") { + $message = _("Please select a product"); + } elseif($_REQUEST['template_selector'] == "") { + $message = _("Please select a template"); + } else { + $sql = "SELECT endpointman_brand_list.directory, endpointman_mac_list.id, endpointman_product_list.cfg_dir FROM endpointman_mac_list, endpointman_brand_list, endpointman_product_list, endpointman_model_list WHERE endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_product_list.id = ".$_REQUEST['product_select']; + $result = mysql_query($sql); + while($row = mysql_fetch_assoc($result)) { + $sql = "UPDATE endpointman_mac_list SET custom_cfg_template = '".$_REQUEST['template_selector']."' WHERE id = ". $row['id']; + mysql_query($sql); + if(file_exists(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc')) { + require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + $phone_config = new $row['cfg_dir'](); + $phone_config->generate_config($row['id']); + unset($phone_config); + } + } + } +} elseif(isset($_REQUEST['button_rebuild_selected'])) { + if(isset($_REQUEST['selected'])) { + $list_num = count($_REQUEST['selected']); + for($i=0;$i<$list_num;$i++) { + $row = $endpoint->get_phone_info($_REQUEST['selected'][$i]); + if(file_exists(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc')) { + require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + $phone_config = new $row['cfg_dir'](); + $phone_config->generate_config($_REQUEST['selected'][$i]); + unset($phone_config); + } + } + } else { + $message = _("No Phones Selected")."!"; + } +} elseif(isset($_REQUEST['button_reboot_this_brand'])) { + if($_REQUEST['rb_brand'] != "") { + $sql = 'SELECT endpointman_mac_list.id , endpointman_brand_list.directory , endpointman_product_list.cfg_dir FROM endpointman_mac_list , endpointman_model_list , endpointman_brand_list , endpointman_product_list WHERE endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_brand_list.id = '.$_REQUEST['rb_brand'].' ORDER BY endpointman_product_list.cfg_dir ASC'; + $result = mysql_query($sql); + while($row = mysql_fetch_assoc($result)) { + if(file_exists(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc')) { + require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + $phone_config = new $row['cfg_dir'](); + $phone_config->reboot($row['id']); + unset($phone_config); + } + } + } else { + $message = _("No Brand Selected for Reboot"); + } +} + +$sql = 'SELECT endpointman_mac_list.id , endpointman_mac_list.mac , endpointman_model_list.model , endpointman_mac_list.ext , endpointman_mac_list.description , endpointman_brand_list.name, endpointman_mac_list.custom_cfg_data, endpointman_mac_list.custom_cfg_template FROM endpointman_mac_list , endpointman_model_list , endpointman_brand_list WHERE ( endpointman_model_list.id = endpointman_mac_list.model ) AND ( endpointman_model_list.brand = endpointman_brand_list.id )'; +$result=mysql_query($sql); + + +$i = 0; +while ($row = mysql_fetch_assoc($result)) { #Displays the phones in the database with edit and delete buttons + $list[$i] = $row; + if (($row['custom_cfg_template'] == 0) && (isset($row['custom_cfg_data'])) ) { + $list[$i]['template_name'] = "Custom-".$row['mac']; + } elseif((!isset($row['custom_cfg_data'])) && ($row['custom_cfg_template'] == 0)) { + $list[$i]['template_name'] = "N/A"; + } else { + $sql = "SELECT name FROM endpointman_template_list WHERE id =".$row['custom_cfg_template']; + $result1=mysql_query($sql); + $row2 = mysql_fetch_assoc($result1); + $list[$i]['template_name'] = $row2['name']; + } + $i++; +} # End while + +$sql = 'SELECT * FROM endpointman_mac_list WHERE model =0'; +$result=mysql_query($sql); + +while ($row = mysql_fetch_assoc($result)) { #Displays unknown phones in the database with edit and delete buttons + $list[$i] = $row; + $list[$i]['name'] = _("Unknown"); + $list[$i]['template_name'] = "N/A"; + $list[$i]['model'] = _("Unknown"); + $i++; +} + +$amp_send['AMPDBUSER'] = $amp_conf['AMPDBUSER']; +$amp_send['AMPDBPASS'] = $amp_conf['AMPDBPASS']; +$amp_send['AMPDBNAME'] = $amp_conf['AMPDBNAME']; + +$sql = "SELECT DISTINCT endpointman_product_list.id, endpointman_product_list.long_name FROM endpointman_product_list, endpointman_template_list WHERE endpointman_product_list.installed = 1 AND endpointman_template_list.product_id = endpointman_product_list.id"; +$result = mysql_query($sql); +$product_list[0]['value'] = ""; +$product_list[0]['text'] = ""; +$i = 1; +while($row = mysql_fetch_assoc($result)) { + $product_list[$i]['value'] = $row['id']; + $product_list[$i]['text'] = $row['long_name']; + $i++; +} +//initialize a Rain TPL object +if (isset($template_editor)) { + +} else { + $tpl = new RainTPL( LOCAL_PATH.'templates' ); + $tpl->assign("list", $list); + $tpl->assign("error", ""); + $tpl->assign("srvip", $_SERVER["SERVER_ADDR"]); + $tpl->assign("web_vars", WEB_VARS); + if($ma = $endpoint->modelsAvailable()) { + $tpl->assign("models_ava", $ma); + } + $tpl->assign("product_list", $product_list); + $tpl->assign("display_ext", $endpoint->displayExtension()); + $tpl->assign("brand_ava", $endpoint->brandAvailable()); + $tpl->assign("unmanaged", $final); + $tpl->assign("button", $button); + $tpl->assign("searched", $searched); + $tpl->assign("edit", $edit); + $tpl->assign("amp_conf_serial", base64_encode(serialize($amp_send))); + $tpl->assign("no_add", $no_add); + $tpl->assign("mode", $mode); + + if(isset($final)) { + $tpl->assign("cached_devices", base64_encode(serialize($final))); + } + + if (isset($mode) && ($mode == "EDIT")) { + if($ma = $endpoint->modelsAvailable($edit_row['model_id'],NULL,$edit_row['brand_id'])) { + $tpl->assign("mac", $edit_row['mac']); + $tpl->assign("name", $edit_row['name']); + $tpl->assign("models_ava", $ma); + $tpl->assign("display_ext", $endpoint->displayExtension($edit_row['ext'])); + $tpl->assign("display_templates", $endpoint->display_templates($edit_row['product_id'],$edit_row['custom_cfg_template'])); + $tpl->assign("edit_id", $edit_row['id']); + } else { + $message = _("You have disabled/removed all models that correspond to this brand. Please enable them in 'Brand Configurations/Setup' before trying to edit this phone"); + $tpl->assign("mode", NULL); + } + } + + + $tpl->assign("message", $message); + $tpl->assign("debug", $debug); + + //draw the template + echo $tpl->draw( 'devices_manager' ); +} +?> \ No newline at end of file diff --git a/includes/export.php b/includes/export.php new file mode 100644 index 00000000..a136e1c2 --- /dev/null +++ b/includes/export.php @@ -0,0 +1,52 @@ + \ No newline at end of file diff --git a/includes/functions.inc b/includes/functions.inc new file mode 100644 index 00000000..783f0972 --- /dev/null +++ b/includes/functions.inc @@ -0,0 +1,1572 @@ +dblogin(); + + //Set Global Variables + if($this->table_exists("endpointman_global_vars")) { + $result = mysql_query("SELECT var_name, value FROM endpointman_global_vars"); + while ($row=mysql_fetch_array($result)) { + $global_cfg[$row['var_name']] = $row['value']; + } + + define("UPDATE_PATH", $global_cfg['update_server']); + define("VER", $global_cfg['version']); + } + + //Define error reporting + if($global_cfg['debug']) { + error_reporting(E_ALL); + ini_set('display_errors', 1); + } else { + ini_set('display_errors', 0); + } + //include the local template class + include LOCAL_PATH."includes/rain.tpl.class.php"; + } + + function add_freepbx_notification($id, $type, $display_text, $text, $link) { + $sql = "INSERT INTO notifications (module, id, level, display_text, link, candelete, timestamp, extended_text) VALUES ('endpointman', '".$id."', '500', '".$display_text."', '".$link."', '1', '".time()."', '".$text."')"; + mysql_query($sql); + } + + //Send this function an ID from the mac devices list table and you'll get all the information we have on that particular phone + function get_phone_info($mac_id=NULL) { + //You could screw up a phone if the mac_id is blank + if (!isset($mac_id)) { + die('Can\'t get phone info!'); + } + $sql = "SELECT id,mac,model FROM endpointman_mac_list WHERE model > 0 AND id =".$mac_id; + $result=mysql_query($sql); + if(mysql_num_rows($result)) { + //Returns Brand Name, Brand Directory, Model Name, Mac Address, Extension (FreePBX), Custom Configuration Template, Custom Configuration Data, Product Name, Product ID, Product Configuration Directory, Product Configuration Version, Product XML name, + $result=mysql_query("SELECT endpointman_mac_list.config_files_override, endpointman_mac_list.user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_mac_list.ext, endpointman_mac_list.custom_cfg_template, endpointman_mac_list.custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_product_list.xml_data, endpointman_product_list.cfg_data, endpointman_product_list.installed, endpointman_model_list.enabled, users.name as description, sip.data as secret FROM endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list, sip, users WHERE endpointman_mac_list.id = ".$mac_id." AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.ext = sip.id AND sip.keyword = 'secret' AND endpointman_mac_list.ext = users.extension"); + $phone_info=mysql_fetch_array($result); + + //If there is a template associated with this phone then pull that information and put it into the array + if ($phone_info['custom_cfg_template'] > 0) { + $result=mysql_query("SELECT name, custom_cfg_data, config_files_override FROM endpointman_template_list WHERE id = ".$phone_info['custom_cfg_template']); + $phone_info['template_data'] = mysql_fetch_array($result); + + } + } else { + //Phone is unknown, we need to display this to the end user so that they can make corrections + $row=mysql_fetch_array($result); + $phone_info['id'] = $mac_id; + $phone_info['model_id'] = 0; + $phone_info['brand_id'] = 0; + $phone_info['ext'] = $row['ext']; + $phone_info['mac'] = $row['mac']; + $phone_info['name'] = 'Unknown'; + } + return $phone_info; + } + + //Open configuration files and return the data from the file + function open_config_file($infile,$phone_info,$config_files_override){ + //Sometimes periods turn to underscores when periods are submitted through a form as a variable, we need to account for this + $key=str_replace('.', "_",$infile); + //from phone info open the required file for reading + $infile=PHONE_MODULES_PATH.$phone_info['directory']."/".$phone_info['cfg_dir']."/".$infile; + //if there is no configuration file over ridding the default then load up $contents with the file's information, where $key is the name of the default configuration file + if(!isset($config_files_override[$key])) { + //always use 'rb' says php.net + $handle = fopen($infile, "rb"); + $contents = fread($handle, filesize($infile)); + fclose($handle); + } else { + //$config_files_override has data in it so that means we have a configuration file over ride, lets pull the text out of the database + $sql = 'SELECT data FROM endpointman_custom_configs WHERE id = ' . $config_files_override[$key]; + $result = mysql_query($sql); + //$config_files_override said we had a file in the database but mySQL couldn't find anything so we default back to the local file + //This usually happens when the user deletes a custome configuration file but doesn't update their templates + if(mysql_num_rows($result) == 0) { + $handle = fopen($infile, "rb"); + $contents = fread($handle, filesize($infile)); + fclose($handle); + } else { + $data = mysql_fetch_assoc($result); + $contents = $data['data']; + } + } + return($contents); + } + + //Write configuration files + function write_config_file($outfile,$phone_info,$contents,$custom_cfg_data){ + global $global_cfg; + //Get End User (through ARI) set variables + $user_cfg_data = unserialize($phone_info['user_cfg_data']); + + //Determine if ARI is enabled, if not ignore any values present in $user_cfg_data, keep unknown variables, this is what 'TRUE' means + if(($global_cfg['enable_ari']) AND is_array($user_cfg_data)){ + $contents = $this->parse_config_values($user_cfg_data,$contents,TRUE,$phone_info); + } + + //Parse normal config values and set all unknown variables in the file to nothing (Blanking them out), this is what 'FALSE' means + $contents = $this->parse_config_values($custom_cfg_data,$contents,FALSE,$phone_info); + + $outfile=$global_cfg['config_location'].$outfile; + $wfh=fopen($outfile,'w'); + fwrite($wfh,$contents); + fclose($wfh); + } + + /* + -Send this function the contents of a text file to $file_contents and then send an array to $custom_cfg_data + The key of the array is the name of the variable in the text file between "{$" and "}" + Then return the contents of the file with the values merged into it + -The $keep_unknown variable tells this function to ignore(TRUE) or blank out(FALSE) variables that it finds in $file_contents but can not find in $variables_array + */ + function parse_config_values($variables_array,$file_contents,$keep_unknown=FALSE, $phone_info=NULL) { + global $global_cfg; + //Find all matched variables in the text file between "{$" and "}" + preg_match_all('/[{\$](.*?)[}]/i',$file_contents,$match); + //Result without brackets (but with the $ variable identifier) + $no_brackets = array_values(array_unique($match[1])); + //Result with brackets + $brackets = array_values(array_unique($match[0])); + //Count how many variables were found in the file + $count = count($brackets); + $cfg_data = unserialize($phone_info['cfg_data']); + + //loop though each variable found in the text file + for($i=0;$i<$count;$i++) { + $key = str_replace('$','',$no_brackets[$i]); + //If the variable we found in the text file exists in the variables array then replace the variable in the text file with the value under our key + if (isset($variables_array[$key])) { + $variables_array[$key]['value'] = htmlspecialchars($variables_array[$key]['value']); + //Variables the user defined in their custom configs + if(isset($phone_info)) { + $variables_array[$key]['value']=str_replace('{$srvip}', $global_cfg['srvip'], $variables_array[$key]['value']); + $variables_array[$key]['value']=str_replace('{$mac}', $phone_info['mac'], $variables_array[$key]['value']); + $variables_array[$key]['value']=str_replace('{$ext}', $phone_info['ext'], $variables_array[$key]['value']); + $variables_array[$key]['value']=str_replace('{$displayname}', $phone_info['description'], $variables_array[$key]['value']); + } + $file_contents=str_replace($brackets[$i], $variables_array[$key]['value'],$file_contents); + } else { + if(!$keep_unknown) { + //read default template values here, blank unknowns or arrays (which are blanks anyways) + $key1 = $this->arraysearchrecursive($no_brackets[$i], $cfg_data, 'variable'); + if(isset($phone_info)) { + $file_contents=str_replace('{$srvip}', $global_cfg['srvip'], $file_contents); + $file_contents=str_replace('{$mac}', $phone_info['mac'], $file_contents); + $file_contents=str_replace('{$ext}', $phone_info['ext'], $file_contents); + $file_contents=str_replace('{$displayname}', $phone_info['description'], $file_contents); + } + if((isset($cfg_data[$key1[0]]['default_value'])) AND (!is_array($cfg_data[$key1[0]]['default_value']))) { + $file_contents=str_replace($brackets[$i], $cfg_data[$key1[0]]['default_value'],$file_contents); + } else { + $file_contents=str_replace($brackets[$i], "",$file_contents); + } + } + } + } + + if($global_cfg['debug']) { + global $debug; + $list = print_r($brackets, TRUE); + $debug .= "\nVariables found in file:\n".$list; + } + + return $file_contents; + } + + //Custom Means specific to that MAC + //id is either the mac ID (not address) or the template ID + function edit_template_display($id, $custom) { + global $global_cfg,$debug; + $alt_configs = NULL; + //Determine if we are dealing with a general template or a specific [for that phone only] template (custom =0 means general) + if($custom == 0) { + $sql = "SELECT endpointman_product_list.config_files, endpointman_template_list.*, endpointman_product_list.id as product_id, endpointman_product_list.long_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_template_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_template_list.id = ".$id." AND endpointman_template_list.product_id = endpointman_product_list.id AND endpointman_product_list.brand = endpointman_brand_list.id"; + } else { + $sql = "SELECT endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_product_list.id as product_id, endpointman_product_list.long_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_mac_list.id=".$id." AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; + } + $result=mysql_query($sql); + $row=mysql_fetch_array($result); + + //Make sure the model data from the local confg files are stored in the database and vice-versa. Serious errors will occur if the database is not in sync with the local file + if(!$this->sync_product($row['product_id'])) { + die("unable to sync local template files". $custom); + } + + //Get default template config data from the database for this product + $sql = "SELECT cfg_data FROM endpointman_product_list WHERE id=". $row['product_id']; + $result=mysql_query($sql); + $product_row=mysql_fetch_array($result); + + //inset it into our usable row + $row['cfg_data'] = $product_row['cfg_data']; + + $brand_name = $row['directory']; + $model_name = $row['cfg_dir']; + $tpl = new RainTPL( LOCAL_PATH.'templates' ); + $tpl->assign("template_editor_display", 1); + + echo $tpl->draw( 'global_header' ); + echo $tpl->draw( 'global_links' ); + //Let the template system know if we are working with a general template or a specific [for that phone only] template + $tpl->assign("custom", $custom); + if($custom) + { + $tpl->assign("ext", $row['ext']); + } else { + $tpl->assign("template_name", $row['name']); + } + $tpl->assign("model", $row['long_name']); + + //Start the display of the html file in the product folder + if($row['config_files_override'] == "") { + $config_files_saved = ""; + } else { + $config_files_saved = unserialize($row['config_files_override']); + } + $config_files = explode(",",$row['config_files']); + $i = 0; + $alt = 0; + while($i < count($config_files)) { + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = ".$row['product_id']." AND original_name = '".$config_files[$i]."'"; + $result = mysql_query($sql); + if(mysql_num_rows($result) > 0) { + $alt_configs .= $config_files[$i]; + $alt_configs .= '"; + $alt = 1; + } + $i++; + } + $tpl->assign("alt_configs", $alt_configs); + $tpl->assign("alt", $alt); + + if($row['cfg_data'] != "") { + $out = $this->generate_gui_html($row['cfg_data'],$row['custom_cfg_data'],TRUE); + } else { + echo "No Template Data has been defined for this Product
"; + } + + $tpl->assign("template_editor", $out); + $tpl->assign("hidden_id", $row['id']); + $tpl->assign("web_vars", WEB_VARS); + $tpl->assign("hidden_custom", $custom); + echo $tpl->draw( 'template_editor' ); + + $tpl->assign("debug", $debug); + + echo $tpl->draw( 'global_footer' ); + } + + function generate_gui_html($cfg_data,$custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL) { + global $global_cfg; + //take the data out of the database and turn it back into an array for use + $cfg_data = unserialize($cfg_data); + $count = count($cfg_data); + + //Check to see if there is a custom template for this phone already listed in the endpointman_mac_list database + if (isset($custom_cfg_data)) { + $custom_cfg_data = unserialize($custom_cfg_data); + } else { + //No custom template so let's pull the default values for this model into the custom_cfg_data array and populate it from there so that we won't have to make two completely different functions below + for($i=0;$i<$count;$i++) { + $key_default = str_replace('$','',$cfg_data[$i]['variable']); + if(!is_array($cfg_data[$i]['default_value'])) { + $custom_cfg_data[$key_default]['value'] = $cfg_data[$i]['default_value']; + + } + } + } + if(isset($user_cfg_data)) { + $user_cfg_data = unserialize($user_cfg_data); + } + + $template_variables_array = array(); + + $group_count = 0; + //Fill the html form data with values from either the database or the default values to display to the end user + for($i=0;$i<$count;$i++) { + if(array_key_exists('variable',$cfg_data[$i])) { + $key = str_replace('$','',$cfg_data[$i]['variable']); + } else { + $key = ""; + } + if(($admin) OR (isset($custom_cfg_data[$key]['ari']))) { + //Checks to see if values are defined in the database, if not then we assume this is a new option and we need a default value here! + if(!isset($custom_cfg_data[$key]['value'])) { + //xml2array will take values that have no data and turn them into arrays, we want to avoid the word 'array' as a default value, so we blank it out here if we are an array + if((array_key_exists('default_value',$cfg_data[$i])) AND (is_array($cfg_data[$i]['default_value']))) { + $custom_cfg_data[$key]['value'] = ""; + } elseif((array_key_exists('default_value',$cfg_data[$i])) AND (!is_array($cfg_data[$i]['default_value']))) { + $custom_cfg_data[$key]['value'] = $cfg_data[$i]['default_value']; + } + } + if ($cfg_data[$i]['type'] == "group") { + $group_count++; + $template_variables_array[$group_count]['title'] = $cfg_data[$i]['description']; + $variables_count = 0; + } elseif ($cfg_data[$i]['type'] == "input") { + if((!$admin) && (isset($user_cfg_data[$key]['value']))) { + $custom_cfg_data[$key]['value'] = $user_cfg_data[$key]['value']; + } + $template_variables_array[$group_count]['data'][$variables_count]['type'] = "input"; + $template_variables_array[$group_count]['data'][$variables_count]['key'] = $key; + $template_variables_array[$group_count]['data'][$variables_count]['value'] = $custom_cfg_data[$key]['value']; + $template_variables_array[$group_count]['data'][$variables_count]['description'] = $cfg_data[$i]['description']; + } elseif ($cfg_data[$i]['type'] == "radio") { + if((!$admin) && (isset($user_cfg_data[$key]['value']))) { + $custom_cfg_data[$key]['value'] = $user_cfg_data[$key]['value']; + } + $num = $custom_cfg_data[$key]['value']; + $template_variables_array[$group_count]['data'][$variables_count]['type'] = "radio"; + $template_variables_array[$group_count]['data'][$variables_count]['key'] = $key; + $template_variables_array[$group_count]['data'][$variables_count]['description'] = $cfg_data[$i]['description']; + $z = 0; + while($z < count($cfg_data[$i]['data'])) { + $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['key'] = $key; + $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['value'] = $cfg_data[$i]['data'][$z]['value']; + $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['description'] = $cfg_data[$i]['data'][$z]['text']; + if ($cfg_data[$i]['data'][$z]['value'] == $num) { + $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['checked'] = 'checked'; + } + $z++; + } + } elseif ($cfg_data[$i]['type'] == "list") { + if((!$admin) && (isset($user_cfg_data[$key]['value']))) { + $custom_cfg_data[$key]['value'] = $user_cfg_data[$key]['value']; + } + $num = $custom_cfg_data[$key]['value']; + $template_variables_array[$group_count]['data'][$variables_count]['type'] = "list"; + $template_variables_array[$group_count]['data'][$variables_count]['key'] = $key; + $template_variables_array[$group_count]['data'][$variables_count]['description'] = $cfg_data[$i]['description']; + $z = 0; + while($z < count($cfg_data[$i]['data'])) { + $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['value'] = $cfg_data[$i]['data'][$z]['value']; + $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['description'] = $cfg_data[$i]['data'][$z]['text']; + if ($cfg_data[$i]['data'][$z]['value'] == $num) { + $template_variables_array[$group_count]['data'][$variables_count]['data'][$z]['selected'] = 'selected'; + } + $z++; + } + } elseif ($cfg_data[$i]['type'] == "break") { + $template_variables_array[$group_count]['data'][$variables_count]['type'] = "break"; + } + if(($global_cfg['enable_ari']) AND ($admin) AND ($cfg_data[$i]['type'] != "break") AND ($cfg_data[$i]['type'] != "group")) { + $template_variables_array[$group_count]['data'][$variables_count]['aried'] = 1; + $template_variables_array[$group_count]['data'][$variables_count]['ari']['key'] = $key; + if(isset($custom_cfg_data[$key]['ari'])) { + $template_variables_array[$group_count]['data'][$variables_count]['ari']['checked'] = "checked"; + } + } + $variables_count++; + } + } + return($template_variables_array); + } + + function save_template($id, $custom, $variables) { + //Custom Means specific to that MAC + if($custom == "0") { + $sql = "SELECT endpointman_product_list.config_files, endpointman_template_list.*, endpointman_product_list.long_name, endpointman_product_list.cfg_data, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_template_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_template_list.id = ".$id." AND endpointman_template_list.product_id = endpointman_product_list.id AND endpointman_product_list.brand = endpointman_brand_list.id"; + } else { + $sql = "SELECT endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_product_list.id as product_id, endpointman_product_list.long_name, endpointman_product_list.cfg_data, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_mac_list.id=".$id." AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; + } + //Load template data + $result=mysql_query($sql); + $row=mysql_fetch_array($result); + $cfg_data = unserialize($row['cfg_data']); + $count = count($cfg_data); + for($i=0;$i<$count;$i++) { + if(array_key_exists('variable',$cfg_data[$i])) { + $temping = str_replace('$','',$cfg_data[$i]['variable']); + $temping_ari = "ari_" . $temping; + if(array_key_exists($temping, $_REQUEST)) { + $custom_cfg_data[$temping]['value'] = $_REQUEST[$temping]; + if(array_key_exists($temping_ari, $_REQUEST)) { + if($_REQUEST[$temping_ari] == "on") { + $custom_cfg_data[$temping]['ari'] = 1; + } + } + } + } + } + + $config_files = explode(",",$row['config_files']); + $i = 0; + while($i < count($config_files)) { + $config_files[$i] = str_replace(".","_",$config_files[$i]); + if(isset($_REQUEST[$config_files[$i]])) { + if($_REQUEST[$config_files[$i]] > 0) { + $config_files_selected[$config_files[$i]] = $_REQUEST[$config_files[$i]]; + } + } + $i++; + } + if(!isset($config_files_selected)) { + $config_files_selected = ""; + } else { + $config_files_selected = serialize($config_files_selected); + } + $save = serialize($custom_cfg_data); + + if($custom == "0") { + $sql = 'UPDATE endpointman_template_list SET config_files_override = \''.addslashes($config_files_selected).'\', custom_cfg_data = \''.addslashes($save).'\' WHERE id ='.$id; + $location = "template_manager"; + } else { + $sql = 'UPDATE endpointman_mac_list SET config_files_override = \''.addslashes($config_files_selected).'\', custom_cfg_template = 0, custom_cfg_data = \''.addslashes($save).'\' WHERE id ='.$id; + $location = "devices_manager"; + } + $result=mysql_query($sql); + + + require(PHONE_MODULES_PATH .$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + + $phone_config = new $row['cfg_dir'](); + if($custom != 0) { + $phone_config->generate_config($id); + } else { + $sql = 'SELECT id FROM endpointman_mac_list WHERE custom_cfg_template = '.$id; + $result=mysql_query($sql); + while($row=mysql_fetch_array($result)) { + $phone_config->generate_config($row['id']); + } + } + return($location); + + } + + function firmware_update_check($id=NULL) { + $sql = "SELECT * FROM endpointman_product_list WHERE id =". $id; + $result = mysql_query($sql); + $row = mysql_fetch_array($result); + + $sql = "SELECT directory FROM endpointman_brand_list WHERE id =". $row['brand']; + $result = mysql_query($sql); + if(mysql_num_rows($result)) { + $brand_row = mysql_fetch_array($result); + + //config drive unknown! + if ($row['cfg_dir'] == "") { + return FALSE; + } else { + $temp = $this->xml2array(PHONE_MODULES_PATH.$brand_row['directory']."/".$row['cfg_dir']."/template_data.xml"); + if((array_key_exists('data',$temp)) AND (!is_array($temp['data']['firmware_ver']))) { + if($row['firmware_vers'] < $temp['data']['firmware_ver']) { + return $temp; + } else { + return FALSE; + } + } else { + return FALSE; + } + } + } else { + return FALSE; + } + } + + function firmware_local_check($id=NULL) { + $sql = "SELECT * FROM endpointman_product_list WHERE installed = 1 AND id =". $id; + $result = mysql_query($sql); + if(mysql_num_rows($result)) { + $row = mysql_fetch_array($result); + + $sql = "SELECT directory FROM endpointman_brand_list WHERE installed = 1 AND id =". $row['brand']; + $result = mysql_query($sql); + $brand_row = mysql_fetch_array($result); + + //config drive unknown! + if ($row['cfg_dir'] == "") { + return("nothing"); + } else { + $temp = $this->xml2array(PHONE_MODULES_PATH.$brand_row['directory']."/".$row['cfg_dir']."/template_data.xml"); + if(!is_array($temp['data']['firmware_ver'])) { + if($row['firmware_vers'] == "") { + return("install"); + } else { + return("remove"); + } + } else { + return("nothing"); + } + } + } else { + return("nothing"); + } + } + + function remove_firmware($id=NULL) { + global $global_cfg; + $sql = "SELECT * FROM endpointman_product_list WHERE id =". $id; + $result = mysql_query($sql); + $row = mysql_fetch_array($result); + + $file_list = explode(",",$row['firmware_files']); + $i = 0; + while($i < count($file_list)){ + unlink($global_cfg['config_location'].$file_list[$i]); + $i++; + } + $sql = 'UPDATE endpointman_product_list SET firmware_files = "", firmware_vers = "" WHERE id = '.$id; + mysql_query($sql); + } + + function install_firmware($product_id) { + global $global_cfg, $debug; + $sql = 'SELECT endpointman_product_list.*, endpointman_brand_list.directory FROM endpointman_product_list, endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '.$product_id; + $result = mysql_query($sql); + $row = mysql_fetch_array($result); + $temp = $this->xml2array(PHONE_MODULES_PATH.$row['directory']."/".$row['cfg_dir']."/template_data.xml"); + if($temp['data']['firmware_ver'] > $row['firmware_vers']) { + echo ""; + $this->download_file_with_progress_bar(UPDATE_PATH . $temp['data']['firmware_pkg'], PHONE_MODULES_PATH."temp/".$temp['data']['firmware_pkg']); + global $global_cfg, $endpoint; + if(!file_exists(PHONE_MODULES_PATH.$row['directory']."/".$row['cfg_dir']."/firmware")) {mkdir(PHONE_MODULES_PATH.$row['directory']."/".$row['cfg_dir']."/firmware");} + exec("unzip ".PHONE_MODULES_PATH."temp/" . $temp['data']['firmware_pkg'] ." -d ".PHONE_MODULES_PATH.$row['directory']."/".$row['cfg_dir']."/firmware/", $debug_a = array()); + if ($handle = opendir(PHONE_MODULES_PATH.$row['directory']."/".$row['cfg_dir']."/firmware/")) { + while (false !== ($file = readdir($handle))) { + if ($file != "." && $file != "..") { + $list .= $file.","; + } + } + closedir($handle); + } + $list = substr_replace($list ,"",-1); + exec("cp -r " . PHONE_MODULES_PATH.$row['directory']."/".$row['cfg_dir']."/firmware/*.* ". $global_cfg['config_location'], $debug_a2 = array()); + $sql = "UPDATE endpointman_product_list SET firmware_vers = '".$temp['data']['firmware_ver']."', firmware_files = '".$list."' WHERE id = ". $row['id']; + mysql_query($sql); + echo ""; + } else { + echo ""; + + } + if($global_cfg['debug']) { + $debug = array_merge($debug_a, $debug_a2); + $outfile=LOCAL_PATH."debug_installer.log"; + $wfh=fopen($outfile,'a'); + fwrite($wfh,print_r($debug, TRUE)); + fclose($wfh); + } + } + + + //Check for new packges for brands. These packages will include phone models and such which the user can remove if they want + function brand_update_check() { + $location = UPDATE_PATH . "brands.xml"; + $temp = $this->xml2array($location); + + if(!isset($temp['data']['brands'][0])) { + $temp2['data']['brands'][0] = $temp['data']['brands']; + $temp = $temp2; + } + + $out = $temp['data']['brands']; + $count = count($out); + + $sql = "SELECT * FROM endpointman_brand_list WHERE id > 0"; + $result = mysql_query($sql); + while($row = mysql_fetch_assoc($result)){ + $key = $this->arraysearchrecursive($row['directory'], $out, 'directory'); + if($key === FALSE) { + $this->remove_brand($row['id']); + } + + $key = $key[0]; + + if($row['cfg_ver'] < $out[$key]['version']) { + $out[$key]['update'] = 1; + $out[$key]['update_vers'] = $out[$key]['version']; + } else { + $out[$key]['update'] = NULL; + } + + } + + for($i=0;$i<$count;$i++){ + if(!isset($out[$i]['update'])) { + //insert row + $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('".$out[$i]['brand_id']."', '".$out[$i]['brand_name']."', '".$out[$i]['directory']."', '".$out[$i]['version']."')"; + mysql_query($sql); + } + } + + return $out; + } + + //This will update AND install brands! + //id is brand id + function update_brand($id = NULL) { + //Get the brands run down from the update server + $temp = $this->xml2array(UPDATE_PATH . "brands.xml"); + + $key = $this->arraysearchrecursive($id, $temp['data']['brands'],'brand_id'); + + + $key = $key[0]; + + if(!isset($temp['data']['brands'][$key]['product_list'][0])) { + $temp2 = $temp['data']['brands'][$key]['product_list']; + unset($temp['data']['brands'][$key]['product_list']); + $temp['data']['brands'][$key]['product_list'][0] = $temp2; + } + + //Count how many products are avalible for this brand + $count2 = count($temp['data']['brands'][$key]['product_list']); + + //Get the name of the brand (Grandstream, Polycom, etc) + $brand_name = $temp['data']['brands'][$key]['brand_name']; + + //Though we already have the brand ID lets just pull it again to be sure + $brand_id = $temp['data']['brands'][$key]['brand_id']; + + //Brand directory listing. We'll use this to put the generic files into place + $brand_directory = $temp['data']['brands'][$key]['directory']; + + //Get the brand's config version + $cfg_ver = $temp['data']['brands'][$key]['version']; + + //Update config version to the newest number + $sql = "UPDATE endpointman_brand_list SET name = '".$brand_name."', cfg_ver = '".$cfg_ver."', installed = 1 WHERE id = ". $brand_id; + mysql_query($sql); + + //Run through the list of products supported under this brand by us. Then spit these values back out into an array where the array's key is equal to the phone's ID number + $sql = "SELECT * FROM endpointman_product_list WHERE brand = ". $brand_id; + $result = mysql_query($sql); + while($row = mysql_fetch_assoc($result)) { + $rid = $row['id']; + $row_out[$rid] = $row; + } + + for($i=0;$i<$count2;$i++) { + $id = $temp['data']['brands'][$key]['product_list'][$i]['product_id']; + $long_name = $temp['data']['brands'][$key]['product_list'][$i]['product_name']; + $cfg_dir = $temp['data']['brands'][$key]['product_list'][$i]['directory']; + $xml_data = $temp['data']['brands'][$key]['product_list'][$i]['xml_name']; + + if(!isset($row_out[$id])) { + $sql = "INSERT INTO endpointman_product_list (id, brand, long_name, cfg_dir, xml_data) VALUES ('".$id."','".$brand_id."','".$long_name."','".$cfg_dir."','".$xml_data."')"; + mysql_query($sql); + } else { + $sql = "UPDATE endpointman_product_list SET long_name = '".$long_name."', cfg_dir= '".$cfg_dir."', xml_data='".$xml_data."' WHERE id =". $id; + mysql_query($sql); + } + } + //Now run through the OUI list and add it in! + $result = mysql_query("SELECT * FROM endpointman_oui_list"); + $i = 0; + $oui_out = array(); + while($row = mysql_fetch_assoc($result)) { + $oui_out[$i] = $row; + $i++; + } + + if(!is_array($temp['data']['brands'][$key]['oui_list']['oui'])) { + $temp2 = $temp['data']['brands'][$key]['oui_list']['oui']; + unset($temp['data']['brands'][$key]['oui_list']); + $temp['data']['brands'][$key]['oui_list']['oui'][0] = $temp2; + } + + $count = count($temp['data']['brands'][$key]['oui_list']['oui']); + for($i=0;$i < $count;$i++) { + if(!$this->arraysearchrecursive($temp['data']['brands'][$key]['oui_list']['oui'][$i],$oui_out)) { + $sql = "INSERT INTO endpointman_oui_list (oui, brand) VALUES ('".$temp['data']['brands'][$key]['oui_list']['oui'][$i]."', '".$brand_id."')"; + mysql_query($sql); + } + } + //Download the corresponding package and install it in the directory listed above + echo ""; + if(!file_exists(PHONE_MODULES_PATH."temp")) {mkdir(PHONE_MODULES_PATH."temp");} + if(!file_exists(PHONE_MODULES_PATH.$brand_directory)) {mkdir(PHONE_MODULES_PATH.$brand_directory);} + echo ""; + $this->download_file_with_progress_bar(UPDATE_PATH . $temp['data']['brands'][$key]['package'], PHONE_MODULES_PATH."temp/".$temp['data']['brands'][$key]['package']); + echo ""; + exec("unzip ".PHONE_MODULES_PATH.'temp/'. $temp['data']['brands'][$key]['package'] ." -d ".PHONE_MODULES_PATH."temp/"); + exec("rm -R ".PHONE_MODULES_PATH."temp/__MACOSX"); + unlink(PHONE_MODULES_PATH.'temp/'. $temp['data']['brands'][$key]['package']); + exec("cp -R ".PHONE_MODULES_PATH."temp/" .$brand_directory . " " . PHONE_MODULES_PATH); + chmod(PHONE_MODULES_PATH.$brand_directory, 0777); + $this->deltree(PHONE_MODULES_PATH."temp/" .$brand_directory); + exec("chmod 777 -R ". PHONE_MODULES_PATH.$brand_directory); + echo ""; + } + + function remove_brand($id=NULL) { + mysql_query("DELETE FROM endpointman_brand_list WHERE id = ". $id); + } + + function product_update_check($id=NULL) { + $sql = "SELECT * FROM endpointman_product_list WHERE id =".$id; + $result = mysql_query($sql); + $row = mysql_fetch_array($result); + //config drive unknown! + if ($row['cfg_dir'] == "") { + return FALSE; + } else { + $temp = $this->xml2array(UPDATE_PATH . $row['xml_data']); + if($row['cfg_ver'] < $temp['data']['version']) { + return $temp; + } else { + return FALSE; + } + } + } + + function sync_product($product=NULL) { + global $global_cfg, $debug; + $sql = "SELECT * FROM endpointman_product_list WHERE id =". $product; + $result = mysql_query($sql); + $row = mysql_fetch_array($result); + + $sql = "SELECT directory FROM endpointman_brand_list WHERE id =". $row['brand']; + $result = mysql_query($sql); + $brand_row = mysql_fetch_array($result); + //config drive unknown! + if ($row['cfg_dir'] == "") { + if($global_cfg['debug']) { + $debug .= "\nFunction sync_product XML Data:\n".$xml; + } + return FALSE; + } else { + //check for updates in template folder + $temp = $this->xml2array(PHONE_MODULES_PATH.$brand_row['directory']."/".$row['cfg_dir']."/template_data.xml"); + if (($temp['data']['version'] >= $row['cfg_ver']) OR ($row['cfg_data'] == "")) { + if(isset($temp['data']['item'])) { + $cfg_data = serialize($temp['data']['item']); + } else { + $cfg_data = NULL; + } + $sql = "UPDATE endpointman_product_list SET config_files=\"".addslashes($temp['data']['configuration_files'])."\",cfg_data = \"".addslashes($cfg_data)."\", cfg_ver ='".$temp['data']['version']."' WHERE id = ". $product; + mysql_query($sql); + if($global_cfg['debug']) { + $xml = print_r($temp, TRUE); + $debug .= "\nFunction sync_product XML Data:\n".$xml; + } + return TRUE; + } else { + if($global_cfg['debug']) { + $debug .= "\nFunction sync_product XML Data:Didn't run xml2array, local version less than sql version\n"; + } + return TRUE; + } + } + } + + //id is model id + function install_product($id = NULL) { + //Update SQL below to include the brand and then use the brand_xml with the data returned to get new models are remove old ones....etc. + $sql = "SELECT endpointman_product_list.*, endpointman_brand_list.directory FROM endpointman_product_list, endpointman_brand_list WHERE endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_product_list.id =". $id; + $result = mysql_query($sql); + $row = mysql_fetch_assoc($result); + $cfg_dir = $row['cfg_dir']; + $xml_data = $row['xml_data']; + + echo ""; + + $product_xml = $this->xml2array(UPDATE_PATH . $xml_data); + $brand_xml = $this->xml2array(UPDATE_PATH . "brands.xml"); + + $brand_id = $this->arraysearchrecursive($row['directory'], $brand_xml['data']['brands'], 'directory'); + $brand_id = $brand_id[0]; + + + if(!isset($brand_xml['data']['brands'][$brand_id]['product_list'][0])) { + $temp2 = $brand_xml['data']['brands'][$brand_id]['product_list']; + unset($brand_xml['data']['brands'][$brand_id]['product_list']); + $brand_xml['data']['brands'][$brand_id]['product_list'][0] = $temp2; + } + + $product_id = $this->arraysearchrecursive($row['cfg_dir'], $brand_xml['data']['brands'][$brand_id]['product_list'],'directory'); + $product_id = $product_id[0]; + $cfg_ver = $product_xml['data']['version']; + $product_dir = $brand_xml['data']['brands'][$brand_id]['product_list'][$product_id]['directory']; + + if ($cfg_ver > $row['cfg_ver']) { + $cfg_pkg = $temp['data']['package']; + if(!file_exists(PHONE_MODULES_PATH."temp")) {mkdir(PHONE_MODULES_PATH."temp");} + $this->download_file_with_progress_bar(UPDATE_PATH . $xml_data, PHONE_MODULES_PATH.'temp/'. $xml_data); + echo ""; + $this->download_file_with_progress_bar(UPDATE_PATH . $product_xml['data']['package'], PHONE_MODULES_PATH.'temp/'. $product_xml['data']['package']); + echo ""; + exec("rm -R ".PHONE_MODULES_PATH.$row['directory']."/" .$product_dir, $debug_a = array()); + exec("unzip ".PHONE_MODULES_PATH.'temp/'. $product_xml['data']['package']." -d ".PHONE_MODULES_PATH."temp/", $debug_a2 = array()); + exec("rm -R ".PHONE_MODULES_PATH."temp/__MACOSX" , $debug_a3 = array()); + unlink(PHONE_MODULES_PATH.'temp/'. $product_xml['data']['package']); + exec("cp -R ".PHONE_MODULES_PATH."temp/" .$product_dir . " " . PHONE_MODULES_PATH.$row['directory'], $debug_a4 = array()); + chmod(PHONE_MODULES_PATH.$row['directory']."/".$product_dir, 0777); + rename(PHONE_MODULES_PATH."temp/" .$xml_data, PHONE_MODULES_PATH.$row['directory']."/".$product_dir."/template_data.xml"); + exec("rm -R ".PHONE_MODULES_PATH."temp/" .$product_dir, $debug_a5 = array()); + unlink(PHONE_MODULES_PATH."temp/" .$xml_data); + exec("chmod 777 -R ". PHONE_MODULES_PATH.$row['directory']."/". $cfg_dir, $debug_a6 = array()); + } + + echo ""; + + + $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = '. $id; + $result = mysql_query($sql); + $i = 0; + while($row = mysql_fetch_assoc($result)) { + $row_o[$i] = $row; + $i++; + } + + $count = count($brand_xml['data']['brands'][$brand_id]['product_list'][$product_id]['model_list']); + + echo ""; + + //Look Through remote values and compare them to local values, adding phones if needed and updating other phones if these exist already in our database + for($i=0;$i<$count;$i++) { + $model_name = $brand_xml['data']['brands'][$brand_id]['product_list'][$product_id]['model_list'][$i]['model']; + $model_id = $brand_xml['data']['brands'][$brand_id]['product_list'][$product_id]['model_list'][$i]['id']; + $brand_id2 = $brand_xml['data']['brands'][$brand_id]['brand_id']; + $temping = $this->arraysearchrecursive($model_name, $row_o); + if($temping === FALSE) { + $sql = "INSERT INTO endpointman_model_list (id, brand, model, product_id) VALUES ('".$model_id."','".$brand_id2."','".$model_name."','".$id."')"; + } else { + $sql = "UPDATE endpointman_model_list SET brand = '".$brand_id2."', model= '".$model_name."', product_id='".$id."' WHERE id =". $model_id; + } + mysql_query($sql); + } + + //Look through the database and compare local values with remote values, removing those phones that are no longer supported. + $count = count($row_o); + for($i=0;$i<$count;$i++) { + $temping = $this->arraysearchrecursive($row_o['id'], $brand_xml); + if($temping === FALSE) { + $sql = "DELETE FROM endpointman_model_list WHERE id = " . $row_o['id']; + mysql_query("UPDATE endpointman_model_list SET model = 0 WHERE model = " . $row_o['id']); + } + mysql_query($sql); + } + $sql = "UPDATE endpointman_product_list SET installed = '1', cfg_ver= '".$cfg_ver."' WHERE id = " . $id; + mysql_query($sql); + + echo ""; + + $this->sync_product($id); + + echo ""; + + if($global_cfg['debug']) { + unlink(LOCAL_PATH."debug_installer.log"); + $debug = array_merge($debug_a, $debug_a2, $debug_a3, $debug_a4, $debug_a5, $debug_a6); + $outfile=LOCAL_PATH."debug_installer.log"; + $wfh=fopen($outfile,'a'); + fwrite($wfh,print_r($debug, TRUE)); + fclose($wfh); + } + } + + function remove_product($id=NULL) { + $sql = 'SELECT endpointman_model_list.*, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_model_list, endpointman_product_list, endpointman_brand_list WHERE endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_product_list.id = '.$id; + + $result = mysql_query($sql); + while($row = mysql_fetch_assoc($result)) { + $sql = "UPDATE endpointman_mac_list SET model = 0 WHERE model = ".$row['id']; + mysql_query($sql); + $row_out = $row; + } + + $this->deltree(PHONE_MODULES_PATH.$row_out['directory']."/". $row_out['cfg_dir']); + $sql = "UPDATE endpointman_product_list SET installed = 0, cfg_ver = '' WHERE id = ".$id; + mysql_query($sql); + $sql = "DELETE FROM endpointman_model_list WHERE product_id = ".$id; + mysql_query($sql); + } + + function arraysearchrecursive($Needle,$Haystack,$NeedleKey="",$Strict=false,$Path=array()) { + if(!is_array($Haystack)) + return false; + foreach($Haystack as $Key => $Val) { + if(is_array($Val)&& + $SubPath=$this->arraysearchrecursive($Needle,$Val,$NeedleKey,$Strict,$Path)) { + $Path=array_merge($Path,Array($Key),$SubPath); + return $Path; + } + elseif((!$Strict&&$Val==$Needle&& + $Key==(strlen($NeedleKey)>0?$NeedleKey:$Key))|| + ($Strict&&$Val===$Needle&& + $Key==(strlen($NeedleKey)>0?$NeedleKey:$Key))) { + $Path[]=$Key; + return $Path; + } + } + return false; + } + //Below is pfSense code + function download_file_with_progress_bar($url_file, $destination_file) { + global $ch, $fout, $file_size, $downloaded, $pkg_interface; + set_time_limit(0); + $file_size = 1; + $downloaded = 1; + /* open destination file */ + $fout = fopen($destination_file, "wb"); + + /* + * Originally by Author: Keyvan Minoukadeh + * Modified by Scott Ullrich to return Content-Length size + */ + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url_file); + curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'endpointmanager_read_header'); + curl_setopt($ch, CURLOPT_WRITEFUNCTION, 'endpointmanager_read_body'); + curl_setopt($ch, CURLOPT_NOPROGRESS, '1'); + curl_setopt($ch, CURLOPT_TIMEOUT, 0); + + curl_exec($ch); + $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); + if($fout) + fclose($fout); + curl_close($ch); + return ($http_code == 200) ? true : $http_code; + } + //end pfSense code + + //This function looks in common linux directories for system executable files. Like ARP & NMAP + function find_exec($exec) { + $usr_bin = glob("/usr/bin/".$exec); + $usr_sbin = glob("/usr/sbin/".$exec); + $sbin = glob("/sbin/".$exec); + $bin = glob("/bin/".$exec); + $etc = glob("/etc/".$exec); + if(isset($usr_bin[0])) { + return("/usr/bin/".$exec); + } elseif(isset($usr_sbin[0])) { + return("/usr/sbin/".$exec); + } elseif(isset($sbin[0])) { + return("/sbin/".$exec); + } elseif(isset($bin[0])) { + return("/bin/".$exec); + } elseif(isset($etc[0])) { + return("/etc/".$exec); + } else { + return($exec); + } + } + + //Delete Directory Tree, Doesn't work. though + function deltree($dir) { + $this->rmrf($dir); + } + + function rmrf($dir) { + foreach (glob($dir) as $file) { + if (is_dir($file)) { + $this->rmrf("$file/*"); + rmdir($file); + } else { + unlink($file); + } + } + } + + + function table_exists ($table) { + $sql = "SHOW TABLES FROM asterisk"; + $result = mysql_query($sql); + + while ($row = mysql_fetch_row($result)) { + if ($row[0] == $table) { + return TRUE; + } + } + return FALSE; + } + + /** + Parse XML file into an array + Taken from Sister Project SuperFecta + */ + function xml2array($url, $get_attributes = 1, $priority = 'tag') + { + $contents = ""; + if (!function_exists('xml_parser_create')) + { + return array (); + } + $parser = xml_parser_create(''); + if(!($fp = @ fopen($url, 'rb'))) + { + return array (); + } + while(!feof($fp)) + { + $contents .= fread($fp, 8192); + } + fclose($fp); + xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); + xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); + xml_parse_into_struct($parser, trim($contents), $xml_values); + xml_parser_free($parser); + if(!$xml_values) + { + return; //Hmm... + } + $xml_array = array (); + $parents = array (); + $opened_tags = array (); + $arr = array (); + $current = & $xml_array; + $repeated_tag_index = array (); + foreach ($xml_values as $data) + { + unset ($attributes, $value); + extract($data); + $result = array (); + $attributes_data = array (); + if (isset ($value)) + { + if($priority == 'tag') + { + $result = $value; + } + else + { + $result['value'] = $value; + } + } + if(isset($attributes) and $get_attributes) + { + foreach($attributes as $attr => $val) + { + if($priority == 'tag') + { + $attributes_data[$attr] = $val; + } + else + { + $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr' + } + } + } + if ($type == "open") + { + $parent[$level -1] = & $current; + if(!is_array($current) or (!in_array($tag, array_keys($current)))) + { + $current[$tag] = $result; + if($attributes_data) + { + $current[$tag . '_attr'] = $attributes_data; + } + $repeated_tag_index[$tag . '_' . $level] = 1; + $current = & $current[$tag]; + } + else + { + if (isset ($current[$tag][0])) + { + $current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result; + $repeated_tag_index[$tag . '_' . $level]++; + } + else + { + $current[$tag] = array($current[$tag],$result); + $repeated_tag_index[$tag . '_' . $level] = 2; + if(isset($current[$tag . '_attr'])) + { + $current[$tag]['0_attr'] = $current[$tag . '_attr']; + unset ($current[$tag . '_attr']); + } + } + $last_item_index = $repeated_tag_index[$tag . '_' . $level] - 1; + $current = & $current[$tag][$last_item_index]; + } + } + else if($type == "complete") + { + if(!isset ($current[$tag])) + { + $current[$tag] = $result; + $repeated_tag_index[$tag . '_' . $level] = 1; + if($priority == 'tag' and $attributes_data) + { + $current[$tag . '_attr'] = $attributes_data; + } + } + else + { + if (isset ($current[$tag][0]) and is_array($current[$tag])) + { + $current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result; + if ($priority == 'tag' and $get_attributes and $attributes_data) + { + $current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data; + } + $repeated_tag_index[$tag . '_' . $level]++; + } + else + { + $current[$tag] = array($current[$tag],$result); + $repeated_tag_index[$tag . '_' . $level] = 1; + if ($priority == 'tag' and $get_attributes) + { + if (isset ($current[$tag . '_attr'])) + { + $current[$tag]['0_attr'] = $current[$tag . '_attr']; + unset ($current[$tag . '_attr']); + } + if ($attributes_data) + { + $current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data; + } + } + $repeated_tag_index[$tag . '_' . $level]++; //0 and 1 index is already taken + } + } + } + else if($type == 'close') + { + $current = & $parent[$level -1]; + } + } + return ($xml_array); + } + + //This function takes a string and tries to determine if it's a valid mac addess, return FALSE if invalid + function mac_check_clean($mac) { + if ((strlen($mac) == "17") OR (strlen($mac) == "12")) { + //It might be better to use switch here instead of these IF statements... + + //Is the mac separated by colons(:)? + if (preg_match("/[0-9a-f][0-9a-f][:-]". + "[0-9a-f][0-9a-f][:-]". + "[0-9a-f][0-9a-f][:-]". + "[0-9a-f][0-9a-f][:-]". + "[0-9a-f][0-9a-f][:-]". + "[0-9a-f][0-9a-f]/i", $mac)) { + return(strtoupper(str_replace(":", "", $mac))); + //Is the string exactly 12 characters? + } elseif(strlen($mac) == "12") { + //Now is the string a valid HEX mac address? + if (preg_match("/[0-9a-f][0-9a-f]". + "[0-9a-f][0-9a-f]". + "[0-9a-f][0-9a-f]". + "[0-9a-f][0-9a-f]". + "[0-9a-f][0-9a-f]". + "[0-9a-f][0-9a-f]/i", $mac)) { + return(strtoupper($mac)); + } else { + return(FALSE); + } + //Is the mac separated by whitespaces? + } elseif(preg_match("/[0-9a-f][0-9a-f][\s]". + "[0-9a-f][0-9a-f][\s]". + "[0-9a-f][0-9a-f][\s]". + "[0-9a-f][0-9a-f][\s]". + "[0-9a-f][0-9a-f][\s]". + "[0-9a-f][0-9a-f]/i", $mac)) { + return(strtoupper(str_replace(" ", "", $mac))); + } else { + return(FALSE); + } + } else { + return(FALSE); + } + } + + //Discover New Device/Hardware + function discover_new($netmask, $use_nmap=TRUE) { + global $global_cfg, $debug; + //Written by tm1000 + //Version 1.0 + + //nmap will actually discover 'unseen' devices that the VoIP server hasn't heard from + //If the user just wishes to use the local arp cache they can tell the function to not use nmap + //This results in a speed increase from 60 seconds to less than one second. + if ($use_nmap) { + shell_exec($global_cfg['nmap_location'].' -v -sP '. $netmask); + } + //Get arp list + $arp_list = shell_exec($global_cfg['arp_location'] . " -an"); + //$arp_list = shell_exec("arp -an"); + if($global_cfg['debug']) { + $debug .= "ARP LIST:\n".$arp_list; + } + //Throw arp list into an array, break by new lines + $arp_array = explode("\n", $arp_list); + + //Find all references to active computers by searching out mac addresses. + $temp = array_values(array_unique(preg_grep("/[0-9a-f][0-9a-f][:-]". + "[0-9a-f][0-9a-f][:-]". + "[0-9a-f][0-9a-f][:-]". + "[0-9a-f][0-9a-f][:-]". + "[0-9a-f][0-9a-f][:-]". + "[0-9a-f][0-9a-f]/i", $arp_array))); + + if($global_cfg['debug']) { + $arp_arry = print_r($temp, true); + $debug .= "ARP Array:\n".$arp_arry; + } + //Go through each row of valid arp entries and pull out the information and add it into a nice array! + foreach ($temp as $key => &$value) { + + //Pull out the IP address from row. It's always the first entry in the row and it can only be a max of 15 characters with the delimiters + $ip = trim(substr($value, 0, 15)); + + //Pull out the mac address by looking for the delimiter + $mac = substr($value, (strpos($value, ":") -2), 17); + + //Get rid of the delimiter + $mac_strip = strtoupper(str_replace(":", "", $mac)); + + //arp -n will return a MAC address of 000000000000 if no hardware was found, so we need to ignore it + if($mac_strip != "000000000000") { + //only use the first 6 characters for the oui: http://en.wikipedia.org/wiki/Organizationally_Unique_Identifier + $oui = substr($mac_strip,0,6); + + //Find the matching brand model to the oui + $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%". $oui ."%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; + + + $brand_result = mysql_query($oui_sql); + $brand = mysql_fetch_row($brand_result); + if ($brand == FALSE) { + //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. + $brand[0] = FALSE; + $brand[1] = NULL; + } + + //Find out if endpoint has already been configured for this mac address + $epm_sql = "SELECT * FROM endpointman_mac_list WHERE mac LIKE '%". $mac_strip ."%'"; + $epm_result = mysql_query($epm_sql); + $epm_row = mysql_fetch_row($epm_result); + if ($epm_row == TRUE) { + $epm = TRUE; + } else { + $epm = FALSE; + } + + //Add into a final array + $final[$key] = array("ip" => $ip, "mac" => $mac, "mac_strip" => $mac_strip, "oui" => $oui, "brand" => $brand[0], "brand_id" => $brand[1], "endpoint_managed" => $epm); + } + } + $final = array_values($final); + if($global_cfg['debug']) { + $arp_arry = print_r($final, true); + $debug .= "Final output from 'discover_new' function:\n".$arp_arry; + } + if(!is_array($final)) { + return(FALSE); + } else { + return ($final); + } + } + + //Function Works + function dblogin() { //Database login + global $amp_conf, $db, $endpoint_db, $ep_link; + + /* FUTURE + if (is_object($db)) { + //I 'think' we are freepbxv2 + include('databases/freepbxv2.inc'); + } else { + //Standalone + include('databases/mysql.inc'); + } + */ + + //Re-written to get rid of duplicate references to one database + + //connect to the mysql system + $ep_link=mysql_connect('localhost', $amp_conf['AMPDBUSER'], $amp_conf['AMPDBPASS']); + if ($ep_link == FALSE) { + die("Sorry, We can't connect to your database :-(\nTry checking /etc/amportal.conf for the correct settings"); + } + //connect to the only useable asterisk database, need to look this up in the amportal.conf really because someone could change it + $success = mysql_select_db($amp_conf['AMPDBNAME'],$ep_link); + if ($success== FALSE) { + die("Sorry, We can't FIND your database, but we COULD connect to MySQL :-/\nDoes Asterisk & FreePBX exist on this server?"); + } + } + + function modelsAvailable($model=NULL, $macAdd=NULL, $brand=NULL) { + if (isset($macAdd)) { + $oui=substr($macAdd,0,6); + } + if ((!isset($oui)) && (!isset($brand)) && (!isset($model))) { + $sql="SELECT endpointman_model_list.* FROM endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_model_list.enabled = 1 AND endpointman_product_list.installed = 1"; + }elseif(isset($brand)){ + $sql="SELECT endpointman_model_list.* FROM endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_model_list.enabled = 1 AND endpointman_product_list.installed = 1 AND endpointman_model_list.brand = " . $brand; + } + $result1=mysql_query($sql); + if(mysql_num_rows($result1)) { + $i = 1; + while ($row=mysql_fetch_array($result1)) { + if ($row['id'] == $model) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 'selected'; + }else{ + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 0; + } + $i++; + } + } + if(!isset($temp)) { + global $error, $global_cfg, $debug, $ep_link; + if($global_cfg['debug']) { + $debug .= "Error in function 'modelsAvailable'\nSQL:". $sql; + $debug .= mysql_error($ep_link); + } + return(FALSE); + } else { + return($temp); + } + } + + function displayExtension($ext = NULL) { + if(!isset($ext)) { + $not_added="SELECT devices.id, devices.description FROM devices WHERE devices.id not in (SELECT devices.id FROM devices, endpointman_mac_list WHERE tech='sip' AND devices.id = endpointman_mac_list.ext )"; + } else { + $not_added="SELECT devices.id, devices.description FROM devices WHERE devices.id not in (SELECT devices.id FROM devices, endpointman_mac_list WHERE tech='sip' AND devices.id = endpointman_mac_list.ext AND endpointman_mac_list.ext !=".$ext." )"; + } + + $result=mysql_query($not_added); + + //$temp[0]['value'] = ""; + //$temp[0]['text'] = " --- "; + //$temp[0]['selected'] = 1; + $i = 1; + while ($row=mysql_fetch_array($result)) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['id'] . " --- " . $row['description']; + if ($row['id'] == $ext) { + $temp[$i]['selected'] = "selected"; + } + $i++; + } + return($temp); + + } + + function brandAvailable ($selected = NULL) { + $i = 1; + $sql="SELECT name, id FROM endpointman_brand_list WHERE installed = 1"; + $result=mysql_query($sql); + $temp[0]['value'] = ""; + $temp[0]['text'] = ""; + while ($row=mysql_fetch_array($result)) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['name']; + if ($row['id'] == $selected) { + $temp[$i]['selected'] = TRUE; + } else { + $temp[$i]['selected'] = NULL; + } + $i++; + } + return($temp); + } + + function display_templates($product_id,$temp_select = NULL) { + $i = 0; + $sql="SELECT * FROM endpointman_product_list WHERE endpointman_product_list.id =".$product_id; + $result=mysql_query($sql); + $row=mysql_fetch_array($result); + $sql="SELECT * FROM endpointman_template_list WHERE product_id = '".$row['id']."'"; + $result=mysql_query($sql); + while ($row=mysql_fetch_array($result)) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['name']; + if ($row['id'] == $temp_select) { + $temp[$i]['selected'] = "selected"; + } + $i++; + } + $temp[$i]['value'] = 0; + if ($temp_select == 0) { + $temp[$i]['text'] = "Custom..."; + $temp[$i]['selected'] = "selected"; + } else { + $temp[$i]['text'] = "Custom..."; + } + return($temp); + } + + function listTZ($selected) { + $sql="SELECT tz from endpointman_time_zones"; + $result=mysql_query($sql); + $i = 0; + while ($row=mysql_fetch_array($result)) { + if ($row['tz'] == $selected) { + $temp[$i]['value'] = $row['tz']; + $temp[$i]['text'] = $row['tz']; + $temp[$i]['selected'] = 1; + }else{ + $temp[$i]['value'] = $row['tz']; + $temp[$i]['text'] = $row['tz']; + $temp[$i]['selected'] = 0; + } + $i++; + } + return($temp); + } + + function rebootPhone($ext,$datav) { + if (is_numeric($ext)) { + } elseif ($ext == 'all') { + $sql = "SELECT endpointman_mac_list.id , endpointman_brand_list.directory , endpointman_product_list.cfg_dir FROM endpointman_mac_list , endpointman_model_list , endpointman_brand_list, endpointman_product_list WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.brand =endpointman_brand_list.id"; + $result = mysql_query($sql); + while($row = mysql_fetch_assoc($result)) { + if(($cfg_dir == $row['cfg_dir']) AND ($directory == $row['directory'])) { + $phone_config->reboot($row['id']); + } else { + if(isset($phone_config)) { + unset($phone_config); + } + $directory = $row['directory']; + $cfg_dir = $row['cfg_dir']; + require(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + $phone_config = new $row['cfg_dir'](); + $phone_config->reboot($row['id']); + } + } + } else { + $sql = "SELECT endpointman_brand_list.directory, endpointman_product_list.cfg_dir, endpointman_mac_list.id FROM endpointman_brand_list, endpointman_model_list, endpointman_mac_list, endpointman_product_list WHERE endpointman_brand_list.id = ".$datav['rb_brand']." AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_model_list.product_id = endpointman_product_list.id"; + $result = mysql_query($sql); + while($row = mysql_fetch_assoc($result)) { + if(($cfg_dir == $row['cfg_dir']) AND ($directory == $row['directory'])) { + $phone_config->reboot($row['id']); + } else { + if(isset($phone_config)) { + unset($phone_config); + } + $directory = $row['directory']; + $cfg_dir = $row['cfg_dir']; + require(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); + $phone_config = new $row['cfg_dir'](); + $phone_config->reboot($row['id']); + } + } + } + } +} + +function endpointman_update_progress_bar($out) { + echo "\n"; +} + +function endpointmanager_read_header($ch, $string) { + global $file_size, $fout; + $length = strlen($string); + $regs = ""; + ereg("(Content-Length:) (.*)", $string, $regs); + if($regs[2] <> "") { + $file_size = intval($regs[2]); + } + ob_flush(); + return $length; +} + +function endpointmanager_read_body($ch, $string) { + //Andrew Nagy added the below echo, otherwise the progress bar never updated until the download was complete + echo " "; + //end Andrew code + global $fout, $file_size, $downloaded, $lastseen; + $length = strlen($string); + $downloaded += intval($length); + $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); + $downloadProgress = 100 - $downloadProgress; + if($lastseen <> $downloadProgress and $downloadProgress < 101) { + endpointman_update_progress_bar($downloadProgress); + $lastseen = $downloadProgress; + } + if($fout) + fwrite($fout, $string); + ob_flush(); + return $length; +} +?> \ No newline at end of file diff --git a/includes/installer.php b/includes/installer.php new file mode 100644 index 00000000..26b6c9ec --- /dev/null +++ b/includes/installer.php @@ -0,0 +1,64 @@ + + + PBX Endpoint Configuration Manager + + + + + + + + +
 
+
+install_product($data['id']); +} elseif($data['type'] == "brand") { + $endpoint->update_brand($data['id']); +} elseif($data['type'] == "firmware") { + $endpoint->install_firmware($data['id']); +} + +?> + + \ No newline at end of file diff --git a/includes/jsonwrapper.php b/includes/jsonwrapper.php new file mode 100644 index 00000000..29509deb --- /dev/null +++ b/includes/jsonwrapper.php @@ -0,0 +1,6 @@ + diff --git a/includes/jsonwrapper_inner.php b/includes/jsonwrapper_inner.php new file mode 100644 index 00000000..36a3f286 --- /dev/null +++ b/includes/jsonwrapper_inner.php @@ -0,0 +1,23 @@ +encode($arg); +} + +function json_decode($arg) +{ + global $services_json; + if (!isset($services_json)) { + $services_json = new Services_JSON(); + } + return $services_json->decode($arg); +} + +?> diff --git a/includes/oui_list.inc b/includes/oui_list.inc new file mode 100644 index 00000000..3b192445 --- /dev/null +++ b/includes/oui_list.inc @@ -0,0 +1,84 @@ +You are about to permanently delete a manufacturer.
"; + $error.="Click delete to continue or Reset to abort the deletion."; + $button="Delete"; + + +} + # We are deleting a record here +If ($_REQUEST['Submit'] == "Delete") { + $sql = "Delete from endpointman_oui_list where id='" . $_REQUEST['id'] . "'"; + mysql_query($sql,$conn) or Die("The Delete failed: " . mysql_error()); + $oui=""; + $error=""; + +} + # We are adding an OUI here, since the Add button was pressed. +if ($_POST['Submit'] == "Add") { + if (strlen($_POST['oui']) != "6" ) { + $error="The OUI must be 6 Hexadecimal characters.
"; + $stoprun="1"; + } + if ($_POST['brand'] == "") { + $error.="The Brand cannot be blank.
"; + $stoprun="1"; + } + + $sql="Select * from endpointman_oui_list where model like '%" . $_POST['model'] . "' AND oui= '" . $_POST['oui'] . "'"; + $result=mysql_query($sql,$conn); + $numrow=mysql_num_rows($result); + if ($numrow < 1 AND $stoprun == "0") { + # Create the query + $sql="Insert into endpointman_oui_list set oui='" . $_POST['oui'] . "', "; + $sql.= "brand='" . $_POST['brand'] . "', model='" . $_POST['model'] . "'"; + + # Run the query + $result=mysql_query($sql,$conn) or DIE("The Insert failed: " . mysql_error()); + $oui=""; + } else { + $error.="There is already a record in the database with this OUI and model number."; + } + + +} + + # Display the blank fields at the top to enter a new OUI in + +displayoui($error,$oui,$button); + + # Run a query that displays all of the OUI's in the database +$sql = "Select * from endpointman_oui_list order by brand"; +$result=mysql_query($sql,$conn) or Die("The Query failed: " . mysql_error()); + + +echo ""; +echo ""; +while ($row = mysql_fetch_assoc($result)) { + echo ""; + echo "\n"; + +} +echo "
" . $row['oui'] . "" . $row['brand'] . "
"; +include 'includes/footer.inc'; +mysql_close($conn); #Close the database connection +?> \ No newline at end of file diff --git a/includes/rain.tpl.class.php b/includes/rain.tpl.class.php new file mode 100644 index 00000000..1cb73c7b --- /dev/null +++ b/includes/rain.tpl.class.php @@ -0,0 +1,199 @@ + + * @version 1.7.5 + * @copyright 2006 - 2009 Federico Ulfo | www.RainElemental.net + * @package RainTPL + */ + + + +/** + * + *Cache enabled: + * TRUE improve speed + * FALSE recompile template each executions + * + */ + +define( "TPL_CACHE_ENABLED", true ); + + +/** + * Extension of template + * + */ + +define( "TPL_EXT", "html" ); + + + +/** + * Questa costante serve per la sicurezza dei template, in modo che un template non pu essere eseguito senza questa classe. + * + */ + +define( "IN_RAINTPL", true ); + + + +/** + * RainTPL Template class. + * Questa classe permette di caricare e visualizzare i template + * + * @access public + * + */ + +class RainTPL{ + + /** + * Contiene tutte le variabili assegnate al template + * @access private + * @var array + */ + var $variables = array( ); + + + /** + * Directory dove sono i templates + * @access private + * @var string + */ + var $tpl_dir = "themes/"; + + + + /** + * Inizializza la classe. + * + * @param string $tpl_dir Setta la directory da cui prendere i template. E' sufficente settarla al primo utilizzo del template engine + * @return RainTPL + */ + + function RainTPL( $tpl_dir = null ){ + + if( $tpl_dir ) + $this->tpl_dir = $GLOBALS[ 'RainTPL_tpl_dir' ] = $tpl_dir . ( substr($tpl_dir,-1,1) != "/" ? "/" : "" ); + elseif( isset( $GLOBALS[ 'RainTPL_tpl_dir' ] ) ) + $this->tpl_dir = $GLOBALS[ 'RainTPL_tpl_dir' ]; + + } + + /** + * Assign variable and name, or you can assign associative arrays variable to the template. + * + * @param mixed $variable_name Name of template variable + * @param mixed $value value assigned to this variable + */ + + function assign( $variable, $value = null ){ + + if( is_array( $variable ) ) + foreach( $variable as $name => $value ) + $this->variables[ $name ] = $value; + elseif( is_object( $variable ) ){ + $variable = get_object_vars( $variable ); + foreach( $variable as $name => $value ) + $this->variables[ $name ] = $value; + } + else + $this->variables[ $variable ] = $value; + } + + + + /** + * If return_string == false, echo the template with all assigned variables as a string, else return the template as a string. + * + * An appropriate use of this function is to store the result into a variable to bufferize or store the template. + * + * Example: + * $tpl->draw( $tpl_name ); + * + * or + * + * echo $tpl->draw( $tpl_name, TRUE ); + * + * @param string $tpl_name Nome del template da caricare + * @return string + */ + + function draw( $tpl_name, $return_string = false ){ + + if( count( $a = explode('/', $tpl_name) ) > 1 ){ + $temp = $tpl_name; + $tpl_name = end( $a ); + $tpl_dir = substr( $temp, 0, strlen($temp) - strlen( $tpl_name ) ); + } + else + $tpl_dir = null; + + //var is the variabile che si trova in ogni template + $var = $this->variables; + + if( !file_exists( $template_file = $this->tpl_dir . $tpl_dir . $tpl_name . '.' . TPL_EXT ) ){ + trigger_error( "Template not found: $tpl_name" ); + if( $return_string ) + return "
Template $tpl_name not found
"; + else{ + echo "
Template $tpl_name not found
"; + return null; + } + } + elseif( !is_writable( $this->tpl_dir ) ) + $compiled_filename = $this->tpl_dir . $tpl_dir . "/compiled/" . $tpl_name . "_def.php"; + elseif( TPL_CACHE_ENABLED && file_exists( $this->tpl_dir . $tpl_dir . "/compiled/" . $tpl_name . "_" . ( $filetime = filemtime( $template_file ) ) . ".php" ) ) + $compiled_filename = $this->tpl_dir . $tpl_dir . "/compiled/" . $tpl_name . "_" . $filetime . ".php"; + else{ + include_once "rain.tpl.compile.class.php"; + $RainTPLCompile_obj = new RainTPLCompile( ); + $RainTPLCompile_obj->compileFile( $tpl_name, $this->tpl_dir . $tpl_dir ); + // template last update date + $filetime = filemtime( $this->tpl_dir . $tpl_dir . '/' . $tpl_name . '.' . TPL_EXT ); + $compiled_filename = $this->tpl_dir . $tpl_dir . "/compiled/" . $tpl_name . "_" . $filetime . ".php"; + } + + + + + //if return_string is true, the function return the output as a string + if( $return_string ){ + ob_start(); + include( $compiled_filename ); + $contents = ob_get_contents(); + ob_end_clean(); + return $contents; + } + else + include( $compiled_filename ); + + } + + +} + + + +?> \ No newline at end of file diff --git a/includes/rain.tpl.compile.class.php b/includes/rain.tpl.compile.class.php new file mode 100644 index 00000000..f0809a20 --- /dev/null +++ b/includes/rain.tpl.compile.class.php @@ -0,0 +1,484 @@ + + * @version 1.7.5 + * @copyright 2006 - 2008 Federico Ulfo | www.RainElemental.net + * @package RainTPL + */ + + + + +/** + * + * FALSE more security (DEFAULT) + * TRUE enable tag in templates. + * + */ + +define( "RAINTPL_PHP_ENABLED", true ); + + + + +/** + * + *Cache enabled: + * TRUE improve speed + * FALSE recompile template each executions + * + */ + +define( "RAINTPL_VERSION", '1.7.5' ); + + + +/** + * Template engine, compile HTML template to PHP, cache templates, wysiwyg: change image src to the right path. + * + * @access private + * + */ + +class RainTPLCompile{ + + /** + * Template directory, default: themes + * @access private + * @var string + */ + var $tpl_dir = "themes"; + + + /** + * Regular expression pattern + * @access private + * @var string + */ + var $split_pattern = '/(\{(?:loop(?:\s+)name="(?:.*?)")\})|(\{(?:\/loop)\})|(\{(?:if(?:\s+)condition="(?:.*?)")\})|(\{(?:elseif(?:\s+)condition="(?:.*?)")\})|(\{(?:else)\})|(\{(?:\/if)\})|(\{noparse\})|(\{\/noparse\})|(\{ignore\})|(\{\/ignore\})|(\{include="(?:.*?)"\})/'; + + + /** + * Regular expression pattern + * @access private + * @var string + */ + var $show_copyright = true; + + + + /** + * Compile and write the compiled template file + * + * @access private + * @param string $template_name + * @param string $template_directory + */ + + function compileFile( $template_name, $template_directory ){ + + //set the temlate directory + $this->tpl_dir = $template_directory; + + //if directory $this->tpl_dir/compiled doesn't exist, create its and compile all file into $this->tpl_dir + if( !file_exists( $this->tpl_dir . '/compiled/' ) ) + mkdir( $this->tpl_dir . '/compiled/', 0755 ); + + if( $compiled_file = glob( $this->tpl_dir . '/compiled/' . $template_name . '*.php' ) ) + foreach( $compiled_file as $file_name ) + unlink( $file_name ); + + //leggo il template + $template_code = file_get_contents( $this->tpl_dir . '/' . $template_name . '.' . TPL_EXT ); + + + //sostituzione per xml + $template_code = preg_replace( "/\<\?xml(.*?)\?\>/", "##XML\\1XML##", $template_code ); + + //se i tag php sono disabilitati nei template + if( !RAINTPL_PHP_ENABLED ){ + $template_code = str_replace( "", "?>", $template_code ); + } + + //sostituzione per xml + $template_code = preg_replace( "/\#\#XML(.*?)XML\#\#/", "'; ?>", $template_code ); + + + //compilo il template + + $template_compiled = $this->compileTemplate( $template_code, $template_name ); + $template_compiled = "" . $template_compiled; + + //scrivo il file compilato + fwrite( $fp = fopen( $this->tpl_dir . "/compiled/" . $template_name . "_" . filemtime( $this->tpl_dir . '/' . $template_name . '.' . TPL_EXT ) . ".php", 'w' ), $template_compiled ); + + //chiudo l'handler del file + fclose( $fp ); + + } + + + /** + * Compile the template + * + * @param string $template_code + * @param string template_name + * @param string + */ + function compileTemplate( $template_code, $template_name ){ + + //divido il codice del template nei vari tag + $template_code = preg_split ( $this->split_pattern, $template_code, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); + + //compilo il codice parsato in codice php + $compiled_code = $this->compileCode( $template_code ); + + if( !$this->show_copyright ) + return $compiled_code; + else + //creo il codice da inserire nel template + return "" . "\n" . + $compiled_code . "\n" . + "" . "\n"; + + + + } + + /** + * Compilo il codice parsato in php + * + * @access private + * @param string $parsed_code Array che contiene codice html e tag + * @return string codice compilato + */ + function compileCode( $parsed_code ){ + + //inizializzo tutte le variabili + $parent_loop[ $level = 0 ] = $loop_name = $compiled_code = $compiled_return_code = null; + $open_if = $comment_is_open = $ignore_is_open = 0; + + //leggo tutti gli elementi dell'array del codice parsato + while( $html = array_shift( $parsed_code ) ){ + + //calcolo lo spazio per l'indentazione del codice compilato + for( $space_counter = 0, $space = ""; $space_counter < $level + $open_if; $space_counter++, $space .= " " ); + + //Chiudo il tag ignore + if( !$comment_is_open && preg_match( '/\{\/ignore\}/', $html ) ) + $ignore_is_open = false; + + //tutto il codice tra il tag ignore ed /ignore viene cancellato + elseif( $ignore_is_open ){ + //non faccio niente + } + + //Chiudo il tag noparse + elseif( preg_match( '/\{\/noparse\}/', $html ) ) + $comment_is_open = false; + + //tutto il codice tra il tag noparse e /noparse non viene compilato + elseif( $comment_is_open ){ + $compiled_code .= $html; + } + + //Apro il tag ignore + elseif( preg_match( '/\{ignore\}/', $html ) ) + $ignore_is_open = true; + + //apro il tag noparse + elseif( preg_match( '/\{noparse\}/', $html ) ) + $comment_is_open = true; + + //inserisco il comando include + elseif( preg_match( '/(?:\{include="(.*?)"\})/', $html, $code ) ){ + + //sostituisco le variabili che si trovano nel tag include + $include_var = $this->var_replace( $code[ 1 ], $left_delimiter = null, $right_delimiter = null, $php_left_delimiter = '".' , $php_right_delimiter = '."', $this_loop_name = $parent_loop[ $level ] ); + + //inserisco il codice php per includere il file dinamicamente con il RainTPL + $compiled_code .= "assign( \$var );\n" . + "\$RainTPL_directory_template_temp = \$RainTPL_include_obj->tpl_dir;" . "\n" . + ( ( $this_loop_name ) ? "\$RainTPL_include_obj->assign( \"key\", \$key" . $this_loop_name . " );\n" . "\$RainTPL_include_obj->assign( \"value\", \$value" . $this_loop_name . " );\n" : null ) . + "\$this->tpl_dir = \$GLOBALS[ 'RainTPL_tpl_dir' ] = \$RainTPL_include_obj->tpl_dir . \"/\" . dirname( \"$include_var\" );" . "\n" . + "\$RainTPL_include_obj->draw( \"$include_var\" );" . "\n" . + "\$this->tpl_dir = \$GLOBALS[ 'RainTPL_tpl_dir' ] = \$RainTPL_directory_template_temp;" . "\n" . + "?>"; + + + } + + //apro il tag loop + elseif( preg_match( '/(?:\{loop(?:\s+)name="(.*?)"\})/', $html, $code ) ){ + + //incremento la variabile level, che tiene conto del numero di tag loop aperti + $level++; + + //inserisco nell'array parent_loop il nome di questo loop + $parent_loop[ $level ] = $level; + + $var = $this->var_replace( '$' . $code[ 1 ], "","", "","", $level-1 ); + + //creo le variabili php per il loop + $counter = "\$counter$level"; + $key = "\$key$level"; + $value = "\$value$level"; + + //scrivo il codice per aprire il tag loop + $compiled_code .= " $value ){ " . "\n" . + "?>"; + + } + + //chiudo il tag loop + elseif( preg_match( '/\{\/loop\}/', $html ) ){ + //carico la variabile counter + $counter = "\$counter$level"; + + //diminuisco il livello del loop + $level--; + + //scrivo il codice per chiudere il tag loop + $compiled_code .= ""; + } + + //apro il tag if + elseif( preg_match( '/(?:\{if(?:\s+)condition="(.*?)"\})/', $html, $code ) ){ + + //incremento open_if (serve per l'indentazione del codice) + $open_if++; + + //recupero l'attributo condition del tag if + $condition = $code[ 1 ]; + + //sostituisco le variabili all'interno della condizione del tag if, le variabili nell'if vengono inserite senza i delimitatori + $parsed_condition = $this->var_replace( $condition, $tag_left_delimiter = '', $tag_right_delimiter = '', $php_left_delimiter = null, $php_right_delimiter = null, $parent_loop[ $level ] ); + + //scrivo il codice php del tag if + $compiled_code .= ""; + } + + //apro il tag elseif + elseif( preg_match( '/(?:\{elseif(?:\s+)condition="(.*?)"\})/', $html, $code ) ){ + + //incremento open_if + $open_if++; + + //recupero l'attributo condition del tag elseif + $condition = $code[ 1 ]; + + //sostituisco le variabili all'interno della condizione del tag elseif, le variabili nell'elseif vengono inserite senza i delimitatori + $parsed_condition = $this->var_replace( $condition, $tag_left_delimiter = '', $tag_right_delimiter = '', $php_left_delimiter = null, $php_right_delimiter = null, $parent_loop[ $level ] ); + + //scrivo il codice php del tag elseif + $compiled_code .= ""; + } + + //apro il tag else + elseif( preg_match( '/\{else\}/', $html ) ){ + + //scrivo il codice php del tag else + $compiled_code .= ""; + + } + + //chido il tag if + elseif( preg_match( '/\{\/if}/', $html ) ){ + + //decremento $open_if + $open_if--; + + //scrivo il codice php del tag /if + $compiled_code .= ""; + + } + + //scrivo il codice html, cio?tutto il codice che non e incluso tra tag + else{ + + //sostituisco i percorsi di immagini e collegamenti a fogli di stile + //$html = $this->path_replace( $html ); + + //eseguo la sostituzione delle variabili nel codice + $compiled_code .= $this->var_replace( $html, $left_delimiter = '\{', $right_delimiter = '\}', $php_left_delimiter = '', $parent_loop[ $level ] ); + + } + } + + //restituisco il codice compilato + return $compiled_code; + } + + + + /** + * Sostituisce il percorso dei fogli di stile, dell'src delle immagini e del tag background + * + * @param string $html + * @return string html sostituito + */ + function path_replace( $html ){ + + // sostituisco i percorsi di img, link e background: + // url => template_dir/url + // url# => url# + // http://url => http://url + + $exp = array( '/src=(?:")http\:\/\/([^"]+)(?:")/i', '/src=(?:")([^"]+)#(?:")/i', '/src="(.*?)"/', '/src=(?:\@)([^"]+)(?:\@)/i', '/background=(?:")http\:\/\/([^"]+)(?:")/i', '/background=(?:")([^"]+)#(?:")/i', '/background="(.*?)"/', '/background=(?:\@)([^"]+)(?:\@)/i', '/ + * @param string $loop_name Nome del loop + * @return string Codice sostituito + */ + function var_replace( $html, $tag_left_delimiter, $tag_right_delimiter, $php_left_delimiter = null, $php_right_delimiter = null, $loop_name = null ){ + + $html = preg_replace( '/\{\#(\w+)\#\}/', $php_left_delimiter . '\\1' . $php_right_delimiter, $html ); + preg_match_all( '/' . $tag_left_delimiter . '\$(\w+(?:\.\${0,1}(?:\w+))*(?:\[\${0,1}(?:\w+)\])*(?:\-\>\${0,1}(?:\w+))*)(.*?)' . $tag_right_delimiter . '/', $html, $matches ); + + for( $i = 0; $i < count( $matches[ 0 ] ); $i++ ){ + + //inserisco nella variabile $tag il tag completo, es: {$news.title|substr:0,100} + $tag = $matches[ 0 ][ $i ]; + + //inserisco in $var la variabile es: news.title + $var = $matches[ 1 ][ $i ]; + + //inserisco in $extra_var le eventuali funzioni associate alla variabile, es: substr:0,100 + $extra_var = $matches[ 2 ][ $i ]; + + $function_var = ( $extra_var and $extra_var[0] == '|') ? substr( $extra_var, 1 ) : null; + + //divido la variabile se ? un array (es. $news.title o $news[title]) o un oggetto (es. $news->title) + $temp = preg_split( "/\.|\[|\-\>/", $var ); + + //prendo il nome della variabile + $var_name = $temp[ 0 ]; + + //prendo gli elementi dell'array successivi al nome + $variable_path = substr( $var, strlen( $var_name ) ); + + //trasformo le parentesi [ e ] in [" e in "] + $variable_path = str_replace( '[', '["', $variable_path ); + $variable_path = str_replace( ']', '"]', $variable_path ); + + //trasformo .$variabile in ["$variabile"] + $variable_path = preg_replace('/\.\$(\w+)/', '["$\\1"]', $variable_path ); + //trasformo [variabile] in ["variabile] + $variable_path = preg_replace('/\.(\w+)/', '["\\1"]', $variable_path ); + + //se alla funzione ? associata una funzione + if( $function_var ){ + + //divido la funzione dai parametri (es: substr:0,100) + $function_split = explode( ':', $function_var, 2 ); + + //prendo la funzione + $function = $function_split[ 0 ]; + + //prendo i parametri + $params = ( isset( $function_split[ 1 ] ) ) ? $function_split[ 1 ] : null; + + } + else + $function = $params = null; + + + //if it is inside a loop + if( $loop_name ){ + + //verify the variable name + if( $var_name == 'key' ) + $php_var = '$key' . $loop_name; + elseif( $var_name == 'value' ) + $php_var = '$value' . $loop_name . $variable_path; + elseif( $var_name == 'counter' ) + $php_var = '$counter' . $loop_name; + else + $php_var = '$var["' . $var_name . '"]' . $variable_path; + } + elseif( $var_name == 'GLOBALS' ) + $php_var = '$GLOBALS' . $variable_path; + elseif( $var_name == '_SESSION' ) + $php_var = '$_SESSION' . $variable_path; + elseif( $var_name == '_COOKIE' ) + $php_var = '$_COOKIE' . $variable_path; + elseif( $var_name == '_SERVER' ) + $php_var = '$_SERVER' . $variable_path; + elseif( $var_name == '_GET' ) + $php_var = '$_GET' . $variable_path; + elseif( $var_name == '_POST' ) + $php_var = '$_POST' . $variable_path; + else + $php_var = '$var["' . $var_name . '"]' . $variable_path; + + + if( isset( $function ) ) + $php_var = $php_left_delimiter . ( $params ? "( $function( $php_var, $params ) )" : "$function( $php_var )" ) . $php_right_delimiter; + else + $php_var = $php_left_delimiter . $php_var . $extra_var . $php_right_delimiter; + + $html = str_replace( $tag, $php_var, $html ); + + } + + + + return $html; + } + +} + +?> \ No newline at end of file diff --git a/includes/template_manager.inc b/includes/template_manager.inc new file mode 100644 index 00000000..3f550879 --- /dev/null +++ b/includes/template_manager.inc @@ -0,0 +1,96 @@ + 0"; +$result = mysql_query($sql); +$sql2 = "SELECT * FROM endpointman_mac_list"; +$result2 = mysql_query($sql2); +if((!mysql_num_rows($result)) && (!mysql_num_rows($result2))) { + $message = _("Welcome to Endpoint Manager")."!
"._("You have no products (Modules) installed, click")." "._("here")." "._("to install some"); + $no_add = TRUE; +} elseif(!mysql_num_rows($result)) { + $message = "Thanks for upgrading to version 2.0! Please head on over to \"Brand Configurations/Setup\" to setup and install phone configurations"; + $no_add = TRUE; +} + +if(isset($_REQUEST['edit_template'])) { + $endpoint->edit_template_display($_REQUEST['id'],$_REQUEST['custom']); +} elseif(isset($_REQUEST['button_save'])) { + $sql = "INSERT INTO endpointman_template_list (product_id, name) VALUES ('".$_REQUEST['model_class']."','".$_REQUEST['template_name']."')"; + mysql_query($sql); + $sql = "SELECT id FROM endpointman_template_list WHERE product_id = '".$_REQUEST['model_class']."' AND name = '".$_REQUEST['template_name']."'"; + $result = mysql_query($sql); + $row = mysql_fetch_assoc($result); + $endpoint->edit_template_display($row['id'],0); +} elseif(isset($_REQUEST['delete_template'])) { + $sql = "DELETE FROM endpointman_template_list WHERE id = ". $_REQUEST['id']; + mysql_query($sql); + $default_display = TRUE; + $message = _('Deleted'); +} elseif((isset($_REQUEST['button_save_template'])) AND (isset($_REQUEST['custom']))) { + $endpoint->save_template($_REQUEST['id'],$_REQUEST['custom'],$_REQUEST); + $default_display = TRUE; + $message = _('Saved'); +} else { + $default_display = TRUE; +} + +if($default_display) { + $sql = 'SELECT endpointman_template_list.*, endpointman_product_list.long_name as model_class FROM endpointman_template_list, endpointman_product_list WHERE endpointman_template_list.product_id = endpointman_product_list.id'; + $result = mysql_query($sql); + $i = 0; + while($row = mysql_fetch_assoc($result)) { + $row_out[$i] = $row; + $row_out[$i]['custom'] = 0; + $i++; + } + + $sql = 'SELECT endpointman_mac_list.id,endpointman_mac_list.mac,endpointman_mac_list.model,endpointman_mac_list.description,endpointman_product_list.long_name as model_class FROM endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.custom_cfg_data IS NOT NULL AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_mac_list.custom_cfg_template = 0'; + $result = mysql_query($sql); + while($row = mysql_fetch_assoc($result)) { + $row_out[$i] = $row; + $row_out[$i]['custom'] = 1; + $row_out[$i]['name'] = $row['mac'] . "-(" .$row['description'].")"; + $i++; + } + + $sql = "SELECT * FROM endpointman_product_list WHERE installed = 1 AND cfg_dir != ''"; + $result = mysql_query($sql); + $i = 0; + while($row = mysql_fetch_assoc($result)) { + $class_row[$i]['value'] = $row['id']; + $class_row[$i]['text'] = $row['long_name']; + $i++; + } + $tpl = new RainTPL( LOCAL_PATH.'templates' ); + $tpl->assign("templates_list", $row_out); + $tpl->assign("class_list", $class_row); + $tpl->assign("no_add", $no_add); + $tpl->assign("debug", $debug); + $tpl->assign("message", $message); + $tpl->assign("web_vars", WEB_VARS); + echo $tpl->draw( 'template_manager' ); +} +?> \ No newline at end of file diff --git a/includes/update_check.php b/includes/update_check.php new file mode 100644 index 00000000..d0da899c --- /dev/null +++ b/includes/update_check.php @@ -0,0 +1,100 @@ +brand_update_check(); + +$note = "

NOTE: This was generated by the Endpoint Manager Module, not by FreePBX
You can turn off these updates on the settings page within the Endpoint Manager Settings Page"; + +$sql="SELECT * from endpointman_brand_list WHERE id > 0 AND hidden = 0 AND installed = 1 ORDER BY id ASC "; +$result=mysql_query($sql); +$i = 0; +while($row = mysql_fetch_assoc($result)) { + $row_out[$i] = $row; + $row_out[$i]['count'] = $i; + $id = $endpoint->arraysearchrecursive($row['name'], $brand_up,'brand_name'); + $id = $id[0]; + if(isset($brand_up[$id]['update'])) { + echo "Brand '".$brand_up[$id]['brand_name']."' has updates available\n"; + echo "Old Version: ".$row['cfg_ver']." New Version: ".$brand_up[$id]['version']."\n"; + echo "Changes: ". $brand_up[$id]['changes']."\n"; + $endpoint->add_freepbx_notification("PU_".$brand_up[$id]['brand_name'], '', "Brand \'".$brand_up[$id]['brand_name']."\' has updates available", "Old Version: ".$row['cfg_ver']." New Version: ".$brand_up[$id]['version']."
"."Changes: ". $brand_up[$id]['changes'].$note, ""); + $email_message .= "Brand \'".$brand_up[$id]['brand_name']."\' has updates available \n Old Version: ".$row['cfg_ver']." New Version: ".$brand_up[$id]['version']."\n"."Changes: ". $brand_up[$id]['changes']."\n\n"; + } + if($row['installed']){ + $j = 0; + $sql = 'SELECT * FROM endpointman_product_list WHERE hidden = 0 AND brand = '.$row['id'].' ORDER BY long_name ASC'; + $result2=mysql_query($sql); + while($row2 = mysql_fetch_assoc($result2)) { + $row_out[$i]['products'][$j] = $row2; + if(($temp = $endpoint->product_update_check($row2['id'])) AND ($row2['installed'] == 1)) { + echo "Product '".$row2['long_name']."' has updates available\n"; + echo "Old Version: ".$row2['cfg_ver']." New Version: ".$temp['data']['version']."\n"; + echo "Changes: ". $temp['data']['description']."\n"; + $endpoint->add_freepbx_notification("PU_".$row2['long_name'], '', "There is a Product update for ".$row2['long_name'], "Old Version: ".$row2['cfg_ver']." New Version: ".$temp['data']['version']."
"."Changes: ". $temp['data']['description'].$note, ""); + $email_message .= "There is a Product update for ".$row2['long_name']."\n"."Old Version: ".$row2['cfg_ver']." New Version: ".$temp['data']['version']."\n"."Changes: ". $temp['data']['description']."\n\n"; + } + if(($temp = $endpoint->firmware_update_check($row2['id'])) AND ($row['firmware_vers'] > 0)) { + echo "Product '".$row2['long_name']."' has new firmware available\n"; + echo "Old Version: ".$row2['cfg_ver']." New Version: ".$temp['data']['version']."\n"; + $endpoint->add_freepbx_notification("PU_".$row2['long_name'], '', "There is a firmware update for phone module ".$row2['long_name'], "Old Version: ".$row2['firmware_vers']." New Version: ".$temp['data']['version'].$note, ""); + $email_message .= "There is a firmware update for phone module ".$row2['long_name']."\n Old Version: ".$row2['firmware_vers']." New Version: ".$temp['data']['version']."\n\n"; + } + $j++; + } + } + $i++; +} + +$email_message .= "\n\n\nNOTE: This was generated by the Endpoint Manager Module, not by FreePBX\n You can turn off these updates on the settings page within the Endpoint Manager Settings Page"; + +$sql = 'SELECT * FROM `admin` WHERE `variable` = CONVERT(_utf8 \'email\' USING latin1) COLLATE latin1_swedish_ci'; +$result=mysql_query($sql); +$row = mysql_fetch_assoc($result); + +$email = $row['value']; + +$time = time() - 25200; + +$sql = 'SELECT * FROM `notifications` WHERE `module` = CONVERT(_utf8 \'endpointman\' USING latin1) COLLATE latin1_swedish_ci'; +$result=mysql_query($sql); +while($row = mysql_fetch_assoc($result)) { + if(($row['timestamp'] > $time) AND ($row['reset'] != 1)) { + + // In case any of our lines are larger than 70 characters, we should use wordwrap() + $message = wordwrap($email_message, 70); + + // Send + mail($email, 'Phone Updates Available', $message); + } +} + +?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 00000000..073a2b9f --- /dev/null +++ b/index.php @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/install.php b/install.php new file mode 100644 index 00000000..ded10dc3 --- /dev/null +++ b/install.php @@ -0,0 +1,792 @@ +"; + } +} + +if (! function_exists("outn")) { + function outn($text) { + echo $text; + } +} + +global $db; + +out("Endpoint Manager Installer"); +out("Creating New phone modules directory"); + +mkdir(PHONE_MODULES_PATH, 0777); +//Detect Version + +if($endpoint->table_exists("endpointman_global_vars")) { + $sql = "SELECT var_name, value FROM endpointman_global_vars"; + + $result = $db->query($sql); + + //$result = mysql_query("SELECT var_name, value FROM endpointman_global_vars"); + while ($row =& $result->fetchRow(DB_FETCHMODE_ASSOC)) { + $global_cfg[$row['var_name']] = $row['value']; + } +} else { + $global_cfg['version'] = '?'; +} + +if(!isset($global_cfg['version'])){ + $ver = "1.0.3"; +} elseif($global_cfg['version'] == '2.0') { + $ver = "1.9.0"; +} elseif($global_cfg['version'] == '1.9.1') { + $ver = "1.9.1"; +} elseif($global_cfg['version'] == '1.9.2') { + $ver = "1.9.2"; +} elseif($global_cfg['version'] == '1.9.3') { + $ver = "1.9.3"; +} elseif($global_cfg['version'] == '1.9.4') { + $ver = "1.9.4"; +} elseif($global_cfg['version'] == '1.9.5') { + $ver = "1.9.5"; +} elseif($global_cfg['version'] == '1.9.6') { + $ver = "1.9.6"; +} elseif($global_cfg['version'] == '1.9.7') { + $ver = "1.9.7"; +} elseif($global_cfg['version'] == '1.9.8') { + $ver = "1.9.8"; +} elseif($global_cfg['version'] == '1.9.9') { + $ver = "1.9.9"; +} elseif($global_cfg['version'] == '2.0.0') { + $ver = "2.0.0"; +} else { + $ver = "?"; +} + +out('Version Identified as '. $ver); + +//Done, Run Update Scripts +If ($ver < "1.9.0") { + //Run updates from 1.x releases to 2.x releases + out("Please Wait While we upgrade your old setup"); + //Expand the value option + $sql = 'ALTER TABLE `endpointman_global_vars` CHANGE `value` `value` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT \'Data\''; + $db->query($sql); + + out("Locating NMAP + ARP + ASTERISK Executables"); + + $nmap = $endpoint->find_exec("nmap"); + $arp = $endpoint->find_exec("arp"); + $asterisk = $endpoint->find_exec("asterisk"); + + out("Updating Global Variables table"); + //Add new Vars into database + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES + (5, 'config_location', '/tftpboot/'), + (6, 'update_server', 'http://www.the159.com/endpoint/'), + (7, 'version', '1.9.9'), + (8, 'enable_ari', '0'), + (9, 'debug', '0'), + (10, 'arp_location', '".$arp."'), + (11, 'nmap_location', '".$nmap."'), + (12, 'asterisk_location', '".$asterisk."')"; + $db->query($sql_update_vars); + + define("UPDATE_PATH", 'http://www.the159.com/endpoint/'); + define("VER", '1.9.9'); + + out("Updating Mac List table"); + $sql = 'ALTER TABLE `endpointman_mac_list` DROP `map`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `custom_cfg_template` INT(11) NOT NULL AFTER `description`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `custom_cfg_data` TEXT NOT NULL AFTER `custom_cfg_template`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `user_cfg_data` TEXT NOT NULL AFTER `custom_cfg_data`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `config_files_override` TEXT NOT NULL AFTER `user_cfg_data`'; + $db->query($sql); + + out("Updating Brands table"); + $sql = 'DROP TABLE endpointman_brand_list'; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_brand_list` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(255) NOT NULL, + `directory` varchar(255) NOT NULL, + `cfg_ver` varchar(255) NOT NULL, + `installed` int(1) NOT NULL default '0', + `hidden` int(1) NOT NULL default '0', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=22"; + $db->query($sql); + + out("Updating Models table"); + $sql = 'DROP TABLE endpointman_model_list'; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_model_list` ( + `id` int(11) NOT NULL auto_increment COMMENT 'Key ', + `brand` int(11) NOT NULL COMMENT 'Brand', + `model` varchar(25) NOT NULL COMMENT 'Model', + `product_id` int(11) NOT NULL, + `enabled` int(1) NOT NULL default '0', + `hidden` int(1) NOT NULL default '0', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=48"; + $db->query($sql); + + out("Updating OUI table"); + + $sql = 'DROP TABLE endpointman_oui_list'; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_oui_list` ( + `id` int(30) NOT NULL auto_increment, + `oui` varchar(30) default NULL, + `brand` int(11) default NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=57"; + $db->query($sql); + + out("Updating Products table"); + + $sql = 'DROP TABLE IF EXISTS endpointman_product_list'; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_product_list` ( + `id` int(11) NOT NULL auto_increment, + `brand` int(11) NOT NULL, + `long_name` varchar(255) NOT NULL, + `cfg_dir` varchar(255) NOT NULL, + `cfg_ver` varchar(255) NOT NULL, + `xml_data` varchar(255) NOT NULL, + `cfg_data` text NOT NULL, + `installed` int(1) NOT NULL default '0', + `hidden` int(1) NOT NULL default '0', + `firmware_vers` varchar(255) NOT NULL, + `firmware_files` text NOT NULL, + `config_files` text, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8"; + $db->query($sql); + + out("Updating templates table"); + + $sql = 'DROP TABLE IF EXISTS endpointman_template_list'; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_template_list` ( + `id` int(11) NOT NULL auto_increment, + `product_id` int(11) NOT NULL, + `name` varchar(255) NOT NULL, + `custom_cfg_data` text, + `config_files_override` text, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8"; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(255) NOT NULL, + `original_name` varchar(255) NOT NULL, + `product_id` int(11) NOT NULL, + `data` longtext NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11"; + $db->query($sql); + + $old_models = array( + "57iCT" => array("brand" => 1, "model" => 2, "product" => 7), + "57i" => array("brand" => 1, "model" => 3, "product" => 7), + "330" => array("brand" => 4, "model" => 6, "product" => 4), + "560" => array("brand" => 4, "model" => 7, "product" => 4), + "300" => array("brand" => 6, "model" => 8, "product" => 8), + "320" => array("brand" => 6, "model" => 9, "product" => 8), + "360" => array("brand" => 6, "model" => 10, "product" => 8), + "370" => array("brand" => 6, "model" => 11, "product" => 8), + "820" => array("brand" => 6, "model" => 12, "product" => 8), + "M3" => array("brand" => 6, "model" => 13, "product" => 8), + "GXP-2000" => array("brand" => 2, "model" => 15, "product" => 1), + "BT200_201" => array("brand" => 2, "model" => 27, "product" => 2), + "spa941" => array("brand" => 0, "model" => 0, "product" => 0), + "spa942" => array("brand" => 0, "model" => 0, "product" => 0), + "spa962" => array("brand" => 0, "model" => 0, "product" => 0), + "55i" => array("brand" => 1, "model" => 4, "product" => 7) + ); + + out("Migrating Old Devices"); + $sql = "SELECT * FROM endpointman_mac_list"; + $result = $db->query($sql); + while($row =& $result->fetchRow(DB_FETCHMODE_ASSOC)) { + $id = $row['model']; + $new_model = $old_models[$id]['model']; + $sql = "UPDATE endpointman_mac_list SET model = ".$new_model." WHERE id =" . $row['id']; + $db->query($sql); + } + out("Old Devices Migrated, You must install the phone modules from within endpointmanager to see your old devices!"); + + $sql = 'ALTER TABLE endpointman_mac_list CHANGE model model INT NOT NULL'; + $db->query($sql); + + $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; + $db->query($sql); + + out("DONE! You can now use endpoint manager!"); + + +} elseif ($ver == "1.9.0") { + + + out("Locating NMAP + ARP + ASTERISK Executables"); + + $nmap = $endpoint->find_exec("nmap"); + $arp = $endpoint->find_exec("arp"); + $asterisk = $endpoint->find_exec("asterisk"); + + out("Updating Global Variables table"); + //Add new Vars into database + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (8, 'enable_ari', '0')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (9, 'debug', '0')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '".$arp."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; + $db->query($sql_update_vars); + + out("Updating Mac List Table"); + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `user_cfg_data` TEXT NOT NULL AFTER `custom_cfg_data`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `config_files_override` TEXT NOT NULL AFTER `user_cfg_data`'; + $db->query($sql); + + out("Updating OUI Table"); + $sql = 'ALTER TABLE `endpointman_oui_list` DROP model'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_oui_list` CHANGE `brand` `brand` INT( 11 ) NULL DEFAULT NULL'; + $db->query($sql); + + out("Updating Product List"); + $sql = 'ALTER TABLE `endpointman_product_list` ADD `firmware_vers` TEXT NULL AFTER `hidden`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_product_list` ADD `firmware_files` VARCHAR( 255 ) NOT NULL AFTER `firmware_vers`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_product_list` ADD `config_files_override` TEXT NULL AFTER `firmware_files`'; + $db->query($sql); + + out("Updating Template List"); + $sql = 'ALTER TABLE `endpointman_template_list` ADD `config_files_override` TEXT NULL AFTER `custom_cfg_data`'; + + out("Updating Version Number"); + $sql = "UPDATE endpointman_global_vars SET value = '1.9.9' WHERE var_name = 'version'"; + + out("Creating Custom Configs Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(255) NOT NULL, + `original_name` varchar(255) NOT NULL, + `product_id` int(11) NOT NULL, + `data` longtext NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11"; + $db->query($sql); + + out('Alter custom_cfg_data'); + $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; + $db->query($sql); + +} elseif($ver == "1.9.1") { + out("Create Custom Configs Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(255) NOT NULL, + `original_name` varchar(255) NOT NULL, + `product_id` int(11) NOT NULL, + `data` longtext NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11"; + $db->query($sql); + + out("Locating NMAP + ARP + ASTERISK Executables"); + + $nmap = $endpoint->find_exec("nmap"); + $arp = $endpoint->find_exec("arp"); + $asterisk = $endpoint->find_exec("asterisk"); + + out('Updating Global Variables'); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (8, 'enable_ari', '0')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (9, 'debug', '0')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '".$arp."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; + $db->query($sql_update_vars); + + out("Update Mac List Table"); + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `config_files_override` TEXT NOT NULL AFTER `user_cfg_data`'; + $db->query($sql); + + out("Update Product List Table"); + $sql = 'ALTER TABLE `endpointman_product_list` ADD `config_files` TEXT NOT NULL AFTER `firmware_files`'; + $db->query($sql); + + out("Update Template List Table"); + $sql = 'ALTER TABLE `endpointman_template_list` ADD `config_files_override` TEXT NOT NULL AFTER `custom_cfg_data`'; + $db->query($sql); + + out("Update Version Number"); + $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $db->query($sql); + + out('Alter custom_cfg_data'); + $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; + $db->query($sql); + +} elseif($ver == "1.9.2") { + + out("Locating NMAP + ARP + ASTERISK Executables"); + + $nmap = $endpoint->find_exec("nmap"); + $arp = $endpoint->find_exec("arp"); + $asterisk = $endpoint->find_exec("asterisk"); + + out('Updating Global Variables'); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '".$arp."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; + $db->query($sql_update_vars); + + out('Alter custom_cfg_data'); + $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; + $db->query($sql); + + out("Update Version Number"); + $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $db->query($sql); + +} elseif($ver == "1.9.3") { + out("Update Version Number"); + $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $db->query($sql); +} elseif($ver == "1.9.4") { + out("Your Database is already up to date!"); + out("Update Version Number"); + $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $db->query($sql); +} elseif($ver == "1.9.5") { + out("Your Database is already up to date!"); + out("Update Version Number"); + $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $db->query($sql); +} elseif($ver == "1.9.6") { + out("Your Database is already up to date!"); + out("Update Version Number"); + $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $db->query($sql); +} elseif($ver == "1.9.7") { + out("Your Database is already up to date!"); + out("Update Version Number"); + $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $db->query($sql); +} elseif($ver == "1.9.8") { + out("Your Database is already up to date!"); + out("Update Version Number"); + $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $db->query($sql); +} elseif($ver == "1.9.9") { + out("Your Database is already up to date!"); +} else { + out("Creating Brand List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_brand_list` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(255) NOT NULL, + `directory` varchar(255) NOT NULL, + `cfg_ver` varchar(255) NOT NULL, + `installed` int(1) NOT NULL default '0', + `hidden` int(1) NOT NULL default '0', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=22"; + $db->query($sql); + + out("Creating Global Variables Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_global_vars` ( + `idnum` int(11) NOT NULL auto_increment COMMENT 'Index', + `var_name` varchar(25) NOT NULL COMMENT 'Variable Name', + `value` varchar(100) NOT NULL COMMENT 'Data', + PRIMARY KEY (`idnum`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10"; + $db->query($sql); + + out("Locating NMAP + ARP + ASTERISK Executables"); + $nmap = $endpoint->find_exec("nmap"); + $arp = $endpoint->find_exec("arp"); + $asterisk = $endpoint->find_exec("asterisk"); + + out("Inserting data into the global vars Table"); + $sql = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES + (1, 'srvip', ''), + (2, 'tz', ''), + (3, 'gmtoff', ''), + (4, 'gmthr', ''), + (5, 'config_location', '/tftpboot/'), + (6, 'update_server', 'http://www.the159.com/endpoint/'), + (7, 'version', '1.9.9'), + (8, 'enable_ari', '0'), + (9, 'debug', '0'), + (10, 'arp_location', '".$arp."'), + (11, 'nmap_location', '".$nmap."'), + (12, 'asterisk_location', '".$asterisk."')"; + $db->query($sql); + + out("Creating mac list Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_mac_list` ( + `id` int(10) NOT NULL auto_increment, + `mac` varchar(12) default NULL, + `model` int(11) NOT NULL, + `ext` varchar(15) default 'Not Assigned', + `description` varchar(20) default NULL, + `custom_cfg_template` int(11) NOT NULL, + `custom_cfg_data` text NOT NULL, + `user_cfg_data` text NOT NULL, + `config_files_override` text NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `mac` (`mac`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=324"; + $db->query($sql); + + out("Creating model List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_model_list` ( + `id` int(11) NOT NULL auto_increment COMMENT 'Key ', + `brand` int(11) NOT NULL COMMENT 'Brand', + `model` varchar(25) NOT NULL COMMENT 'Model', + `product_id` int(11) NOT NULL, + `enabled` int(1) NOT NULL default '0', + `hidden` int(1) NOT NULL default '0', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=60"; + $db->query($sql); + + out("Creating oui List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_oui_list` ( + `id` int(30) NOT NULL auto_increment, + `oui` varchar(30) default NULL, + `brand` int(11) NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=82"; + $db->query($sql); + + out("Creating product List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_product_list` ( + `id` int(11) NOT NULL auto_increment, + `brand` int(11) NOT NULL, + `long_name` varchar(255) NOT NULL, + `cfg_dir` varchar(255) NOT NULL, + `cfg_ver` varchar(255) NOT NULL, + `xml_data` varchar(255) NOT NULL, + `cfg_data` text NOT NULL, + `installed` int(1) NOT NULL default '0', + `hidden` int(1) NOT NULL default '0', + `firmware_vers` varchar(255) NOT NULL, + `firmware_files` text NOT NULL, + `config_files` text, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10"; + $db->query($sql); + + out("Creating Template List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_template_list` ( + `id` int(11) NOT NULL auto_increment, + `product_id` int(11) NOT NULL, + `name` varchar(255) NOT NULL, + `custom_cfg_data` text, + `config_files_override` text, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=23"; + $db->query($sql); + + out("Creating Time Zone List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_time_zones` ( + `idnum` int(11) NOT NULL auto_increment COMMENT 'Record Number', + `tz` varchar(10) NOT NULL COMMENT 'Time Zone', + `gmtoff` varchar(10) NOT NULL COMMENT 'Offset in Seconds', + `gmthr` varchar(10) NOT NULL, + PRIMARY KEY (`idnum`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=116"; + $db->query($sql); + + out("Inserting Data into table Table"); + $sql = "INSERT INTO `endpointman_time_zones` (`idnum`, `tz`, `gmtoff`, `gmthr`) VALUES + (1, 'USA-10', '-36000', 'GMT-10:00'), + (2, 'USA-9', '-32400', 'GMT-09:00'), + (3, 'CAN-8', '-28800', 'GMT-08:00'), + (4, 'MEX-8', '-28800', 'GMT-08:00'), + (5, 'USA-8', '-28800', 'GMT-08:00'), + (6, 'CAN-7', '-25200', 'GMT-07:00'), + (7, 'MEX-7', '-25200', 'GMT-07:00'), + (8, 'USA2-7', '-25200', 'GMT-07:00'), + (9, 'USA-7', '-25200', 'GMT-07:00'), + (10, 'CAN-6', '-21600', 'GMT-06:00'), + (11, 'CHL-6', '-21600', 'GMT-06:00'), + (12, 'MEX-6', '-21600', 'GMT-06:00'), + (13, 'USA-6', '-21600', 'GMT-06:00'), + (14, 'BHS-5', '-18000', 'GMT-05:00'), + (15, 'CAN-5', '-18000', 'GMT-05:00'), + (16, 'CUB-5', '-18000', 'GMT-05:00'), + (17, 'USA-5', '-18000', 'GMT-05:00'), + (18, 'VEN-4.5', '-16200', 'GMT-04:00'), + (19, 'CAN-4', '-14400', 'GMT-04:00'), + (20, 'CHL-4', '-14400', 'GMT-04:00'), + (21, 'PRY-4', '-14400', 'GMT-04:00'), + (22, 'BMU-4', '-14400', 'GMT-04:00'), + (23, 'FLK-4', '-14400', 'GMT-04:00'), + (24, 'TTB-4', '-14400', 'GMT-04:00'), + (25, 'CAN-3.5', '-12600', 'GMT-03:30'), + (26, 'GRL-3', '-10800', 'GMT-03:00'), + (27, 'ARG-3', '-10800', 'GMT-03:00'), + (28, 'BRA2-3', '-10800', 'GMT-03:00'), + (29, 'BRA1-3', '-10800', 'GMT-03:00'), + (30, 'BRA-2', '-7200', 'GMT-02:00'), + (31, 'PRT-1', '-3600', 'GMT-01:00'), + (32, 'FRO-0', '0', 'GMT'), + (33, 'IRL-0', '0', 'GMT'), + (34, 'PRT-0', '0', 'GMT'), + (35, 'ESP-0', '0', 'GMT'), + (36, 'GBR-0', '0', 'GMT'), + (37, 'ALB+1', '3600', 'GMT+01:00'), + (38, 'AUT+1', '3600', 'GMT+01:00'), + (39, 'BEL+1', '3600', 'GMT+01:00'), + (40, 'CAI+1', '3600', 'GMT+01:00'), + (41, 'CHA+1', '3600', 'GMT+01:00'), + (42, 'HRV+1', '3600', 'GMT+01:00'), + (43, 'CZE+1', '3600', 'GMT+01:00'), + (44, 'DNK+1', '3600', 'GMT+01:00'), + (45, 'FRA+1', '3600', 'GMT+01:00'), + (46, 'GER+1', '3600', 'GMT+01:00'), + (47, 'HUN+1', '3600', 'GMT+01:00'), + (48, 'ITA+1', '3600', 'GMT+01:00'), + (49, 'LUX+1', '3600', 'GMT+01:00'), + (50, 'MAK+1', '3600', 'GMT+01:00'), + (51, 'NLD+1', '3600', 'GMT+01:00'), + (52, 'NAM+1', '3600', 'GMT+01:00'), + (53, 'NOR+1', '3600', 'GMT+01:00'), + (54, 'POL+1', '3600', 'GMT+01:00'), + (55, 'SVK+1', '3600', 'GMT+01:00'), + (56, 'ESP+1', '3600', 'GMT+01:00'), + (57, 'SWE+1', '3600', 'GMT+01:00'), + (58, 'CHE+1', '3600', 'GMT+01:00'), + (59, 'GIB+1', '3600', 'GMT+01:00'), + (60, 'YUG+1', '3600', 'GMT+01:00'), + (61, 'WAT+1', '3600', 'GMT+01:00'), + (62, 'BLR+2', '7200', 'GMT+02:00'), + (63, 'BGR+2', '7200', 'GMT+02:00'), + (64, 'CYP+2', '7200', 'GMT+02:00'), + (65, 'CAT+2', '7200', 'GMT+02:00'), + (66, 'EGY+2', '7200', 'GMT+02:00'), + (67, 'EST+2', '7200', 'GMT+02:00'), + (68, 'FIN+2', '7200', 'GMT+02:00'), + (69, 'GAZ+2', '7200', 'GMT+02:00'), + (70, 'GRC+2', '7200', 'GMT+02:00'), + (71, 'ISR+2', '7200', 'GMT+02:00'), + (72, 'JOR+2', '7200', 'GMT+02:00'), + (73, 'LVA+2', '7200', 'GMT+02:00'), + (74, 'LBN+2', '7200', 'GMT+02:00'), + (75, 'MDA+2', '7200', 'GMT+02:00'), + (76, 'RUS+2', '7200', 'GMT+02:00'), + (77, 'ROU+2', '7200', 'GMT+02:00'), + (78, 'SYR+2', '7200', 'GMT+02:00'), + (79, 'TUR+2', '7200', 'GMT+02:00'), + (80, 'UKR+2', '7200', 'GMT+02:00'), + (81, 'EAT+3', '10800', 'GMT+03:00'), + (82, 'IRQ+3', '10800', 'GMT+03:00'), + (83, 'RUS+3', '10800', 'GMT+03:00'), + (84, 'IRN+3.5', '12600', 'GMT+03:30'), + (85, 'ARM+4', '14400', 'GMT+04:00'), + (86, 'AZE+4', '14400', 'GMT+04:00'), + (87, 'GEO+4', '14400', 'GMT+04:00'), + (88, 'KAZ+4', '14400', 'GMT+04:00'), + (89, 'RUS+4', '14400', 'GMT+04:00'), + (90, 'KAZ+5', '18000', 'GMT+05:00'), + (91, 'KGZ+5', '18000', 'GMT+05:00'), + (92, 'PAK+5', '18000', 'GMT+05:00'), + (93, 'RUS+5', '18000', 'GMT+05:00'), + (94, 'IND+5.5', '19800', 'GMT+05:30'), + (95, 'KAZ+6', '21600', 'GMT+06:00'), + (96, 'RUS+6', '21600', 'GMT+06:00'), + (97, 'RUS+7', '25200', 'GMT+07:00'), + (98, 'THA+7', '25200', 'GMT+07:00'), + (99, 'CHN+7', '25200', 'GMT+07:00'), + (100, 'SGP+8', '28800', 'GMT+08:00'), + (101, 'KOR+8', '28800', 'GMT+08:00'), + (102, 'AUS+8', '28800', 'GMT+08:00'), + (103, 'JPN+9', '32400', 'GMT+09:00'), + (104, 'AUS+9.5', '34200', 'GMT+09:30'), + (105, 'AUS2+9.5', '34200', 'GMT+09:30'), + (106, 'AUS+10', '36000', 'GMT+10:00'), + (107, 'AUS2+10', '36000', 'GMT+10:00'), + (108, 'AUS3+10', '36000', 'GMT+10:00'), + (109, 'RUS+10', '36000', 'GMT+10:00'), + (110, 'AUS+10.5', '37800', 'GMT+10:30'), + (111, 'NCL+11', '39600', 'GMT+11:00'), + (112, 'NZL+12', '43200', 'GMT+12:00'), + (113, 'RUS+12', '43200', 'GMT+12:00'), + (114, 'NZL+12.75', '45900', 'GMT+12:00'), + (115, 'TON+13', '46800', 'GMT+13:00')"; + $db->query($sql); + + out("Create Custom Configs Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(255) NOT NULL, + `original_name` varchar(255) NOT NULL, + `product_id` int(11) NOT NULL, + `data` longtext NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11"; + $db->query($sql); + + out('Alter custom_cfg_data'); + $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; + $db->query($sql); +} + +out("Fixing .htaccess issues (#288)"); +$htaccess = "allow from all +AuthName FreePBX-Admin-only +Require valid-user +AuthType Basic +AuthMySQLEnable\tOn +AuthMySQLHost\tlocalhost +AuthMySQLDB\tasterisk +AuthMySQLUserTable\tampusers +AuthMySQLUser\t".$amp_conf['AMPDBUSER']." +AuthMySQLPassword\t".$amp_conf['AMPDBPASS']." +AuthMySQLNameField\tusername +AuthMySQLPasswordField\tpassword +AuthMySQLAuthoritative\tOn +AuthMySQLPwEncryption\tnone +AuthMySQLUserCondition\t\"username = 'admin'\" + + + deny from all + +"; + +$outfile =LOCAL_PATH. ".htaccess"; +$wfh=fopen($outfile,'w'); +fwrite($wfh,$htaccess); +fclose($wfh); + +out("Installing ARI Module"); +rename(LOCAL_PATH. "Install/phonesettings.module", $amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); + +out("Fixing permissions on ARI module"); +chmod($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module", 0664); + +out("Adding Custom Field to OUI List"); +$sql = 'ALTER TABLE `endpointman_oui_list` ADD `custom` INT(1) NOT NULL DEFAULT \'0\''; +$db->query($sql); + +out("Increase value Size in global Variables Table"); +$sql = 'ALTER TABLE `endpointman_global_vars` CHANGE `value` `value` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT \'Data\''; +$db->query($sql); + +out("Update global variables to include future language support"); +$sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (\'13\', \'temp_amp\', \'\');'; +$db->query($sql); + +$sql = "UPDATE endpointman_global_vars SET var_name = 'language' WHERE var_name = 'temp_amp'"; +$db->query($sql); + +out("Changing all 'LONG TEXT' or 'TEXT' to 'BLOB'"); +$sql = 'ALTER TABLE `endpointman_product_list` CHANGE `cfg_data` `cfg_data` BLOB NOT NULL'; +$db->query($sql); + +$sql = 'ALTER TABLE `endpointman_template_list` CHANGE `custom_cfg_data` `custom_cfg_data` BLOB NULL DEFAULT NULL'; +$db->query($sql); + +$sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `custom_cfg_data` `custom_cfg_data` BLOB NOT NULL, CHANGE `user_cfg_data` `user_cfg_data` BLOB NOT NULL'; +$db->query($sql); + +$sql = 'ALTER TABLE `endpointman_custom_configs` CHANGE `data` `data` BLOB NOT NULL'; +$db->query($sql); + +$sql = 'ALTER TABLE `endpointman_product_list` ADD `special_cfgs` BLOB NOT NULL;'; +$db->query($sql); + +out("Inserting Check for Updates Command"); +$sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (\'14\', \'check_updates\', \'1\');'; +$db->query($sql); + +out("Inserting Disable .htaccess command"); +$sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (\'15\', \'disable_htaccess\', \'0\');'; +$db->query($sql); + +out("Add Automatic Update Check [Can be Disabled]"); +$sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php ".LOCAL_PATH "includes/update_check.php')"; +$db->query($sql); + +$arp = $endpoint->find_exec("arp"); + +out("Finding ARP again"); +$sql = "UPDATE endpointman_global_vars SET value = '".$arp."' WHERE var_name = 'arp_location'"; +$db->query($sql); + +out("Update Version Number [Yes again, just in case]"); +$sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; +$db->query($sql); + +?> \ No newline at end of file diff --git a/module.xml b/module.xml new file mode 100644 index 00000000..20394fbf --- /dev/null +++ b/module.xml @@ -0,0 +1,21 @@ + + endpointman + PBX End Point Manager + 1.9.9 + tool + System Administration + + PBX End Point Manager + + PBX End Point Manager supports automated deployment of multiple manufacturers IP telephones. + + *2.0.0* #264, #115, #107, #110, #111, #112, #119, #127, #128, #174, #261, #270, #280, #124, #126, #272, #281 (http://projects.colsolgrp.net/projects/endpointman/issues) + *1.0.3* Bug Fix Aastra.cfg #142, #143 (http://projects.colsolgrp.net/projects/endpointman/issues)(6/16/09) + *1.0.2* Bug Fix Polycom No sip_custom.cfg #125 (http://projects.colsolgrp.net/projects/endpointman/issues) + *1.0.1* Bug Fix Polycom Ticket: #125 (http://projects.colsolgrp.net/projects/endpointman/issues) + *1.0.0* Initial release (5.26.2009). + + http://projects.colsolgrp.net/projects/show/endpointman + projects.colsolgrp.net/projects/list_files/endpointman + + diff --git a/page.endpointman.php b/page.endpointman.php new file mode 100644 index 00000000..0bf88430 --- /dev/null +++ b/page.endpointman.php @@ -0,0 +1,120 @@ + + deny from all + +"; + + $outfile = LOCAL_PATH.".htaccess"; + $wfh=fopen($outfile,'w'); + fwrite($wfh,$htaccess); + fclose($wfh); +} + +if($amp_conf['AMPENGINE'] != 'asterisk') { + die(_("Sorry, Only Asterisk is supported currently")); +} + +if (isset($_REQUEST['page'])) { + $page = $_REQUEST['page']; +} else { + $page = ""; +} + +if($global_cfg['debug']) { + $debug .= "Request Variables: \n".print_r($_REQUEST, TRUE); +} + +switch ($page) { + case 'advanced': + include LOCAL_PATH.'includes/advanced.inc'; + break; + + case 'template_manager': + include LOCAL_PATH.'includes/template_manager.inc'; + break; + + case 'devices_manager'; + include LOCAL_PATH.'includes/devices_manager.inc'; + break; + + case 'brand_model_manager': + include LOCAL_PATH.'includes/brand_model_manager.inc'; + break; + + case 'installer': + include LOCAL_PATH.'install.php'; + break; + + default: + include LOCAL_PATH.'includes/devices_manager.inc'; +} +?> \ No newline at end of file diff --git a/templates/advanced_settings_iedl.html b/templates/advanced_settings_iedl.html new file mode 100644 index 00000000..95ec721a --- /dev/null +++ b/templates/advanced_settings_iedl.html @@ -0,0 +1,17 @@ +

{$message}

+

: +
+

+

:

+ +
+ +
+

:

+

<Mac>, <>, <>, <>

+

, &

diff --git a/templates/advanced_settings_oui.html b/templates/advanced_settings_oui.html new file mode 100644 index 00000000..d936fba2 --- /dev/null +++ b/templates/advanced_settings_oui.html @@ -0,0 +1,32 @@ + + + + + +{loop name="oui_list"} + + + +{/loop} +{if condition="isset($oui_list_custom)"} + {loop name="oui_list_custom"} + + + + {/loop} +{/if} + + + + + + + + + + +

OUI

{$value.oui}{$value.name}
{$value.oui}{$value.name}Delete

OUI

\ No newline at end of file diff --git a/templates/advanced_settings_poce.html b/templates/advanced_settings_poce.html new file mode 100644 index 00000000..4542edeb --- /dev/null +++ b/templates/advanced_settings_poce.html @@ -0,0 +1,54 @@ +
+ + + +
+
+
+
+{if condition="isset($options)"} +{$options} +{/if} +
+
+

+ + + + + +
+
+ {loop name="file_list"} + {$value.text}
+ {/loop} +
+
+ {if condition="isset($sql_file_list)"} + {loop name="sql_file_list"} + {$value.text} [{$value.ref}] Delete +
+ {/loop} + {/if} +
+ +
+ or + + +
+
\ No newline at end of file diff --git a/templates/advanced_settings_settings.html b/templates/advanced_settings_settings.html new file mode 100644 index 00000000..a1831296 --- /dev/null +++ b/templates/advanced_settings_settings.html @@ -0,0 +1,79 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
:
( USA-5) + +
NMAP :
ARP :
Asterisk :
:
'>
+
\ No newline at end of file diff --git a/templates/advanced_settings_sh_manager.html b/templates/advanced_settings_sh_manager.html new file mode 100755 index 00000000..02351d92 --- /dev/null +++ b/templates/advanced_settings_sh_manager.html @@ -0,0 +1,56 @@ + + +
+
+{loop name="brand2_list"} + + + + + + + + +
{$value.name} ( [{$value.cfg_ver}])
{else}{/if}">
 {loop name="value.products"} + + + + + + + + +
{$value.long_name} {if condition="$value.cfg_ver != ''"}( [{$value.cfg_ver}]){/if}
{else}{/if}">
 {loop name="value.models"} + + + + +
{$value.model}
{else}{/if}">
{/loop}
{/loop}
+
+
+{/loop} + + + + + + + diff --git a/templates/advanced_subheader.html b/templates/advanced_subheader.html new file mode 100644 index 00000000..4a79ab80 --- /dev/null +++ b/templates/advanced_subheader.html @@ -0,0 +1,10 @@ + + + + + + + + +

+
diff --git a/templates/brand_model_manager.html b/templates/brand_model_manager.html new file mode 100755 index 00000000..2b342f1d --- /dev/null +++ b/templates/brand_model_manager.html @@ -0,0 +1,71 @@ +{include="global_header"} +{include="global_links"} + +

{$error}

+
+
+ +
+
+ +

+ +{if condition="isset($installer_address)"} + + +{/if} + + +{loop name="brand2_list"} + + + + + + + + +
{$value.name} ( [{$value.cfg_ver}])
{else}{/if}">{if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}{/if}{/if}
 {loop name="value.products"} + + + + + + + + +
{$value.long_name} {if condition="$value.cfg_ver != ''"}( [{$value.cfg_ver}]){/if}
{else}{/if}">{if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}{/if}{/if}{if condition="$value.fw_type == 'install'"}{elseif condition="$value.fw_type == 'remove'"}{/if}{if condition="array_key_exists('update_fw',$value)"}{if condition="$value.update_fw == 1"}{/if}{/if}
{if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}New Version: {$value.update_vers}
Changes: {$value.update_desc}{/if}{/if}
 {loop name="value.models"} + + + + +
{$value.model}
{else}{/if}">
{/loop}
{/loop}
+
+
+{/loop} + +{include="global_footer"} + + + + + + diff --git a/templates/credits.html b/templates/credits.html new file mode 100644 index 00000000..e69de29b diff --git a/templates/devices_manager.html b/templates/devices_manager.html new file mode 100755 index 00000000..87dfe9df --- /dev/null +++ b/templates/devices_manager.html @@ -0,0 +1,232 @@ +{include="global_header"} +{include="global_links"} +

{$error}

+{if condition="isset($id)"} + +{/if} +
+
+ {if condition="isset($message)"} +

{$message}

+ {/if} + {if condition="$no_add == FALSE"} +
+ + +
+ {/if} +
+ + + + + + + + + + + + {if condition="$no_add == FALSE"} + + + + + + + + + +{$edit} + + +

+ {if condition="$mode == 'EDIT'"} + {$mac} + {else} + + {/if} + + + + '> + + {if condition="$mode == 'EDIT'"} + '> + {else} + '> + {/if} +'>
+ +{/if} +{if condition="$searched == 1"} + + + + + + + + + + + {if condition="is_array($unmanaged)"} + + + {loop name="unmanaged"} + + + + + + + + + + + + {/loop} + +
   

   
{$value.mac_strip}{$value.brand} + + +   
+ + + +
+ + + {/if} + +{/if} + + + + + + + + + + + + + {loop name="list"} + + + + + + + + + + + {/loop} +
   

 

Edit

Delete

{$value.mac}{$value.name}{$value.model}{$value.ext} - {$value.description}{$value.template_name}<?=_(' border='0'><?=_(' border='0'>
+
+
+

+ +

+
+ + + + + + +
:
: :
+ +
+
+

+
+ + + + + + +
'>
+ '>
+
+ +{include="global_footer"} \ No newline at end of file diff --git a/templates/global_footer.html b/templates/global_footer.html new file mode 100755 index 00000000..730c2113 --- /dev/null +++ b/templates/global_footer.html @@ -0,0 +1,8 @@ +
+
Ed Macri, John Mullinix. and Andrew Nagy +
+ CSG Software Projects.
+Copyright © 2009, 2010 by Ed Macri and John Mullinix
+{if condition="isset($debug)"}:
{/if} + + diff --git a/templates/global_header.html b/templates/global_header.html new file mode 100755 index 00000000..ad572b2d --- /dev/null +++ b/templates/global_header.html @@ -0,0 +1,78 @@ + + + PBX Endpoint Configuration Manager + {if condition="isset($template_editor_display)"} + + + + + + + + + {/if} + {if condition="isset($amp_conf_serial)"} + + {/if} + + +
+

+
\ No newline at end of file diff --git a/templates/global_links.html b/templates/global_links.html new file mode 100755 index 00000000..d53bd957 --- /dev/null +++ b/templates/global_links.html @@ -0,0 +1,9 @@ + + + + + + + +

+
diff --git a/templates/images/delete.gif b/templates/images/delete.gif new file mode 100644 index 0000000000000000000000000000000000000000..2d733ac67fdcaa1ad2ac6ab5809575aa65bf7ea3 GIT binary patch literal 610 zcmZ?wbhEHblw^=(C}3bv{K>+|z>vzI!vF*zu{I!GS$W;q__Uthse*zFsj06R82)o` z{7*f(Z z&%p3h-jIReU%be=|Ex?egyobtA0#F1^7DK4Qptdk;ZKCX=Ksu0FGS>(IqvcD{{P7* z@IgcOKO6i@85n;37v!(!E#qSN#>DXRzX)fkKs_hJw+O*a zZ`AeUMb|Mf{7sWs^`D91iJako8NM=sx?jRP_43mh8UGg*oz>#F^V7`H|AKCaM+^qQNWd1 iZNr4aTT~Y*NiDJ}4JlDjb@$~Ap48~M`PmW&25SHl%+g^1 literal 0 HcmV?d00001 diff --git a/templates/images/edit.gif b/templates/images/edit.gif new file mode 100644 index 0000000000000000000000000000000000000000..9b86002a587cb93ed4262ef4c7292e532a4742f4 GIT binary patch literal 202 zcmZ?wbhEHblwgoxC}3bv{K>+|z`)0#!vF*zv1TAWbLN?}v@;A0{}~w07#sgjGoA^e zfE)&6W1ysQnlVTmr~m|5$}gPsT)kB>{owBRR}BQFWXwyq^f)TowX|hdpXBuySvM!= zNwrV$QjhNB=}2h`S9z4ul~Qyt#jY@j#W_QCqD$uz#c&xX@!NCG_XKmd+kM~dIpzHO rGKsma)8A+7=GHa2HkR?)R#|7M6sUJJ#hI9>_fFQEG<}wcAcHjk_FK_cNPEyYU3y}n zsH90xdbrGtosfr#4tb7~`V#f+LEhi*{RgjKUV*`Uj^_?9#1r{1f*{M+Agclpm+*_7 zpYJyHw2i*k^-dt{Ey${MDCZ!A%EYk3aSm(DUHnMy!5aOmzW;ndocxWvw_@!%#_SNY zK#_^F56;fT%$~K_jZ0Y*Sl#pHkI_#}Qw#dHUl95_6K0_K+6{PyFL~XDvZh{Bx`&_W z=jw*mt~YZAu3QphEi3WZ@-@8Sxv#x%W+px@%zj)gV8Qu+Cg4{t8KZegZwd-CR`bv)PQlwd=}uZQ$yGTn9kyP?4^ zQ$_mwGxHzwNAH$S{&DY36KR{%Gx$sUp|gFV|Kcv=rlFTeIpz~q_vi<*VT zHt2i_ePb}b4-V+y*+Dpx4jGwnG7BUM$h!cS%HetiRH_#=+HZ}74+OI@GgGyxiOR&d z$QUQZnRS`rpW#hwOpTI^tiWm|taJh=H*oU;FMse4f}l_cjev+Kh}sOBV<09LVziC20$jKRmx`dM7>cjJl`<$Rhw|(Hm@6uwvhrJH6;$1UJ2g=A2p&Cw zCr{z28q^xlXhGWujXKaZK~pm{w?bO{L4^O2^A`+ybt$u(AW(x z3gLV+G_^u=KlBbj|67=xhtKoh=H@=U1pw-23<^O2ar%D+ zPN%x8IZ34ba51Q=SSuwn6Z>>kC5@*k{%e|Nd`kn+Hk_UUYVz{RnA?Jy+w5nfT(mhy zIV#rhZMIj2T-w-meUtO1$4Pz+U*$EFfh{L>LWMG-Z@la)_v>ovstCUs6#BJb6!T}9 z1Eo!=R%@aP_wsY;2k47$Y`*^UDZ8!&S}Vyu4!7Lt0fJfNyeq9>2W_uoq$1)&G7lAPdJfbqfl`Zhf|U>?JEZJWUN;qBm(>X z=s3}(fyWHv3?x;XdGx1^w6LEMX<39d^V1pTF2r_}F-M`)n6eYq4KB@b`|UX0`7|@f z9AA-?J(%ntD(Q}kJni0}yx)w~&hrnnN}Zq-Sgz<%rIWWRn5`atNwZ}hFXLv-IGqAF zW8U2~gVv&f>?XNn(_u~MwO5#?mK%LUpkFC}rDV2p`ehjek5@=y%SyX-QR}aK$TrAv zAHY0pxjKBpfWR4+#pigAWS4|`4=OTR?~EyFt)Amb|1j?Z`bYvx#zQB1@BKAC)ZH=B zf6QZ8K?{4*dEQ_rt7CLc&b{%}>YJ>NxUWVYBb-QkUUl5pMAn#yIp)4E&p*ub^~HFC z=POlgi~HbFQfq1d>+}Ze!71iRNw>q_;ZE%d@h$m7X|xHtt{0D5N6_mSksCO}$`ZNuiNbC@LpN1txM#t0cjE^u|+Q$a!ORAS7FZbQLT z-LiVsiHCN#O=FRG>%nQmKijDC2!W7vX^>~X(L(Bh;iB2P2F`VEj!S_6?N6>V+SrB_ z&DAY?R2x78GSy-aLR+Gq;NNMo@ZMeTN4lV^w-?W4c|;*b$7%z;KXS9|9h4}~5H;?x zFMj)A9r0#(Aulz;R5X9;yCtNPo|Tu4*QW_dMGvqxo5Ky57~!sg+T&O&BFd0OK{;ll z?b6f)KSbkBstIrsbLHJTWwx)0fpkW$@rE>^l`xuX`9O{LNzJg1Qu-|}6l0yzP=tfT zESDatbaV4_>V0v5vn0Y?dYKkC&&YCMSxCal>y~bc=6!e7)yPLiC8RwtV1MzICwax= zH;V&Tdr}`}lWAvSXR+v!nD6@6G?saEhiP=raW9P`Yj0n=d1Seox}6F* zK}6~DnsBXyxc&Qu7$=*yG@-q|UFsg4ZbAz}kqRhSx`0cNFdDpVyE6|W!o|NU&+`&e zOu|b20$yzRKm7|LTw+rZM5Ubioi@n$TqITSLEtEF*zq1Byat+On}@WUnqLluaz3?+&r zLYW^+<`))P#7dLvEX&D!wo*N?wFzUz8`3V_n~Zgd9>N7G(ibHonQpctHUnb5_nL?S zsj|*;*0+IKtd?yrM=w@6n9##6o3f)&3Ej0>FWz51xrb+9`@G!9ExNr$np|u>TM)=B zpyIcb)-8H(p>@m~>J^n9Cuel=*JV@Xhj^Mko97dl73^YTk1e#N_0fimgcQ?F3cGb$ zvLQP}eJajjWa-1`23GzKdBU{Na{r5Ly2`b5_o5PVOKqkL8ZQYgud}*B3~-X=?i4xs zTX*UPX|@+~6XWb`TR&;Nu3E@;&KLVUWd!W@a+L_0OUP}teAdB~Q^9>3X}={*DrG3y zp`a4-U)!?WPNYcV$nj*|G)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/templates/javascript/jquery.coda-slider-2.0.js b/templates/javascript/jquery.coda-slider-2.0.js new file mode 100755 index 00000000..6057ed17 --- /dev/null +++ b/templates/javascript/jquery.coda-slider-2.0.js @@ -0,0 +1,234 @@ +/* + jQuery Coda-Slider v2.0 - http://www.ndoherty.biz/coda-slider + Copyright (c) 2009 Niall Doherty + This plugin available for use in all personal or commercial projects under both MIT and GPL licenses. +*/ + +$(function(){ + // Remove the coda-slider-no-js class from the body + $("body").removeClass("coda-slider-no-js"); + // Preloader + $(".coda-slider").children('.panel').hide().end().prepend('

Loading...
loading...

'); +}); + +var sliderCount = 1; + +$.fn.codaSlider = function(settings) { + + settings = $.extend({ + autoHeight: true, + autoHeightEaseDuration: 1000, + autoHeightEaseFunction: "easeInOutExpo", + autoSlide: false, + autoSlideInterval: 7000, + autoSlideStopWhenClicked: true, + crossLinking: true, + dynamicArrows: true, + dynamicArrowLeftText: "« left", + dynamicArrowRightText: "right »", + dynamicTabs: true, + dynamicTabsAlign: "center", + dynamicTabsPosition: "top", + externalTriggerSelector: "a.xtrig", + firstPanelToLoad: 1, + panelTitleSelector: "h2.title", + slideEaseDuration: 1000, + slideEaseFunction: "easeInOutExpo" + }, settings); + + return this.each(function(){ + + // Uncomment the line below to test your preloader + // alert("Testing preloader"); + + var slider = $(this); + + // If we need arrows + if (settings.dynamicArrows) { + slider.parent().addClass("arrows"); + slider.before(''); + slider.after(''); + }; + + var panelWidth = slider.find(".panel").width(); + var panelCount = slider.find(".panel").size(); + var panelContainerWidth = panelWidth*panelCount; + var navClicks = 0; // Used if autoSlideStopWhenClicked = true + + // Surround the collection of panel divs with a container div (wide enough for all panels to be lined up end-to-end) + $('.panel', slider).wrapAll('
'); + // Specify the width of the container div (wide enough for all panels to be lined up end-to-end) + $(".panel-container", slider).css({ width: panelContainerWidth }); + + // Specify the current panel. + // If the loaded URL has a hash (cross-linking), we're going to use that hash to give the slider a specific starting position... + if (settings.crossLinking && location.hash && parseInt(location.hash.slice(1)) <= panelCount) { + var currentPanel = parseInt(location.hash.slice(1)); + var offset = - (panelWidth*(currentPanel - 1)); + $('.panel-container', slider).css({ marginLeft: offset }); + // If that's not the case, check to see if we're supposed to load a panel other than Panel 1 initially... + } else if (settings.firstPanelToLoad != 1 && settings.firstPanelToLoad <= panelCount) { + var currentPanel = settings.firstPanelToLoad; + var offset = - (panelWidth*(currentPanel - 1)); + $('.panel-container', slider).css({ marginLeft: offset }); + // Otherwise, we'll just set the current panel to 1... + } else { + var currentPanel = 1; + }; + + // Left arrow click + $("#coda-nav-left-" + sliderCount + " a").click(function(){ + navClicks++; + if (currentPanel == 1) { + offset = - (panelWidth*(panelCount - 1)); + alterPanelHeight(panelCount - 1); + currentPanel = panelCount; + slider.siblings('.coda-nav').find('a.current').removeClass('current').parents('ul').find('li:last a').addClass('current'); + } else { + currentPanel -= 1; + alterPanelHeight(currentPanel - 1); + offset = - (panelWidth*(currentPanel - 1)); + slider.siblings('.coda-nav').find('a.current').removeClass('current').parent().prev().find('a').addClass('current'); + }; + $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); + if (settings.crossLinking) { location.hash = currentPanel }; // Change the URL hash (cross-linking) + return false; + }); + + // Right arrow click + $('#coda-nav-right-' + sliderCount + ' a').click(function(){ + navClicks++; + if (currentPanel == panelCount) { + offset = 0; + currentPanel = 1; + alterPanelHeight(0); + slider.siblings('.coda-nav').find('a.current').removeClass('current').parents('ul').find('a:eq(0)').addClass('current'); + } else { + offset = - (panelWidth*currentPanel); + alterPanelHeight(currentPanel); + currentPanel += 1; + slider.siblings('.coda-nav').find('a.current').removeClass('current').parent().next().find('a').addClass('current'); + }; + $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); + if (settings.crossLinking) { location.hash = currentPanel }; // Change the URL hash (cross-linking) + return false; + }); + + // If we need a dynamic menu + if (settings.dynamicTabs) { + var dynamicTabs = '
    '; + switch (settings.dynamicTabsPosition) { + case "bottom": + slider.parent().append(dynamicTabs); + break; + default: + slider.parent().prepend(dynamicTabs); + break; + }; + ul = $('#coda-nav-' + sliderCount + ' ul'); + // Create the nav items + $('.panel', slider).each(function(n) { + ul.append('
  • ' + $(this).find(settings.panelTitleSelector).text() + '
  • '); + }); + navContainerWidth = slider.width() + slider.siblings('.coda-nav-left').width() + slider.siblings('.coda-nav-right').width(); + ul.parent().css({ width: navContainerWidth }); + switch (settings.dynamicTabsAlign) { + case "center": + ul.css({ width: ($("li", ul).width() + 2) * panelCount }); + break; + case "right": + ul.css({ float: 'right' }); + break; + }; + }; + + // If we need a tabbed nav + $('#coda-nav-' + sliderCount + ' a').each(function(z) { + // What happens when a nav link is clicked + $(this).bind("click", function() { + navClicks++; + $(this).addClass('current').parents('ul').find('a').not($(this)).removeClass('current'); + offset = - (panelWidth*z); + alterPanelHeight(z); + currentPanel = z + 1; + $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); + if (!settings.crossLinking) { return false }; // Don't change the URL hash unless cross-linking is specified + }); + }); + + // External triggers (anywhere on the page) + $(settings.externalTriggerSelector).each(function() { + // Make sure this only affects the targeted slider + if (sliderCount == parseInt($(this).attr("rel").slice(12))) { + $(this).bind("click", function() { + navClicks++; + targetPanel = parseInt($(this).attr("href").slice(1)); + offset = - (panelWidth*(targetPanel - 1)); + alterPanelHeight(targetPanel - 1); + currentPanel = targetPanel; + // Switch the current tab: + slider.siblings('.coda-nav').find('a').removeClass('current').parents('ul').find('li:eq(' + (targetPanel - 1) + ') a').addClass('current'); + // Slide + $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); + if (!settings.crossLinking) { return false }; // Don't change the URL hash unless cross-linking is specified + }); + }; + }); + + // Specify which tab is initially set to "current". Depends on if the loaded URL had a hash or not (cross-linking). + if (settings.crossLinking && location.hash && parseInt(location.hash.slice(1)) <= panelCount) { + $("#coda-nav-" + sliderCount + " a:eq(" + (location.hash.slice(1) - 1) + ")").addClass("current"); + // If there's no cross-linking, check to see if we're supposed to load a panel other than Panel 1 initially... + } else if (settings.firstPanelToLoad != 1 && settings.firstPanelToLoad <= panelCount) { + $("#coda-nav-" + sliderCount + " a:eq(" + (settings.firstPanelToLoad - 1) + ")").addClass("current"); + // Otherwise we must be loading Panel 1, so make the first tab the current one. + } else { + $("#coda-nav-" + sliderCount + " a:eq(0)").addClass("current"); + }; + + // Set the height of the first panel + if (settings.autoHeight) { + panelHeight = $('.panel:eq(' + (currentPanel - 1) + ')', slider).height(); + slider.css({ height: panelHeight }); + }; + + // Trigger autoSlide + if (settings.autoSlide) { + slider.ready(function() { + setTimeout(autoSlide,settings.autoSlideInterval); + }); + }; + + function alterPanelHeight(x) { + if (settings.autoHeight) { + panelHeight = $('.panel:eq(' + x + ')', slider).height() + slider.animate({ height: panelHeight }, settings.autoHeightEaseDuration, settings.autoHeightEaseFunction); + }; + }; + + function autoSlide() { + if (navClicks == 0 || !settings.autoSlideStopWhenClicked) { + if (currentPanel == panelCount) { + var offset = 0; + currentPanel = 1; + } else { + var offset = - (panelWidth*currentPanel); + currentPanel += 1; + }; + alterPanelHeight(currentPanel - 1); + // Switch the current tab: + slider.siblings('.coda-nav').find('a').removeClass('current').parents('ul').find('li:eq(' + (currentPanel - 1) + ') a').addClass('current'); + // Slide: + $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); + setTimeout(autoSlide,settings.autoSlideInterval); + }; + }; + + // Kill the preloader + $('.panel', slider).show().end().find("p.loading").remove(); + slider.removeClass("preload"); + + sliderCount++; + + }); +}; \ No newline at end of file diff --git a/templates/javascript/jquery.cookie.js b/templates/javascript/jquery.cookie.js new file mode 100644 index 00000000..a80bfa29 --- /dev/null +++ b/templates/javascript/jquery.cookie.js @@ -0,0 +1,97 @@ +/** + * Cookie plugin + * + * Copyright (c) 2006 Klaus Hartl (stilbuero.de) + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + */ + +/** + * Create a cookie with the given name and value and other optional parameters. + * + * @example $.cookie('the_cookie', 'the_value'); + * @desc Set the value of a cookie. + * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); + * @desc Create a cookie with all available options. + * @example $.cookie('the_cookie', 'the_value'); + * @desc Create a session cookie. + * @example $.cookie('the_cookie', null); + * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain + * used when the cookie was set. + * + * @param String name The name of the cookie. + * @param String value The value of the cookie. + * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. + * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. + * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. + * If set to null or omitted, the cookie will be a session cookie and will not be retained + * when the the browser exits. + * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). + * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). + * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will + * require a secure protocol (like HTTPS). + * @type undefined + * + * @name $.cookie + * @cat Plugins/Cookie + * @author Klaus Hartl/klaus.hartl@stilbuero.de + */ + +/** + * Get the value of a cookie with the given name. + * + * @example $.cookie('the_cookie'); + * @desc Get the value of a cookie. + * + * @param String name The name of the cookie. + * @return The value of the cookie. + * @type String + * + * @name $.cookie + * @cat Plugins/Cookie + * @author Klaus Hartl/klaus.hartl@stilbuero.de + */ +jQuery.cookie = function(name, value, options) { + if (typeof value != 'undefined') { // name and value given, set cookie + options = options || {}; + if (value === null) { + value = ''; + options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed + options.expires = -1; + } + var expires = ''; + if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { + var date; + if (typeof options.expires == 'number') { + date = new Date(); + date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); + } else { + date = options.expires; + } + expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE + } + // NOTE Needed to parenthesize options.path and options.domain + // in the following expressions, otherwise they evaluate to undefined + // in the packed version for some reason... + var path = options.path ? '; path=' + (options.path) : ''; + var domain = options.domain ? '; domain=' + (options.domain) : ''; + var secure = options.secure ? '; secure' : ''; + document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); + } else { // only name given, get cookie + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } +}; \ No newline at end of file diff --git a/templates/javascript/jquery.easing.1.3.js b/templates/javascript/jquery.easing.1.3.js new file mode 100755 index 00000000..ef743210 --- /dev/null +++ b/templates/javascript/jquery.easing.1.3.js @@ -0,0 +1,205 @@ +/* + * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ + * + * Uses the built in easing capabilities added In jQuery 1.1 + * to offer multiple easing options + * + * TERMS OF USE - jQuery Easing + * + * Open source under the BSD License. + * + * Copyright © 2008 George McGinley Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * +*/ + +// t: current time, b: begInnIng value, c: change In value, d: duration +jQuery.easing['jswing'] = jQuery.easing['swing']; + +jQuery.extend( jQuery.easing, +{ + def: 'easeOutQuad', + swing: function (x, t, b, c, d) { + //alert(jQuery.easing.default); + return jQuery.easing[jQuery.easing.def](x, t, b, c, d); + }, + easeInQuad: function (x, t, b, c, d) { + return c*(t/=d)*t + b; + }, + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + easeInOutQuad: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + easeInCubic: function (x, t, b, c, d) { + return c*(t/=d)*t*t + b; + }, + easeOutCubic: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; + }, + easeInOutCubic: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + }, + easeInQuart: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + easeOutQuart: function (x, t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + easeInOutQuart: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + easeInQuint: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t*t + b; + }, + easeOutQuint: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + }, + easeInOutQuint: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + }, + easeInSine: function (x, t, b, c, d) { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + }, + easeOutSine: function (x, t, b, c, d) { + return c * Math.sin(t/d * (Math.PI/2)) + b; + }, + easeInOutSine: function (x, t, b, c, d) { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + }, + easeInExpo: function (x, t, b, c, d) { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; + }, + easeOutExpo: function (x, t, b, c, d) { + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; + }, + easeInOutExpo: function (x, t, b, c, d) { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function (x, t, b, c, d) { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + }, + easeOutCirc: function (x, t, b, c, d) { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + }, + easeInOutCirc: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + }, + easeInElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + easeOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + easeInOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + easeInBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + easeOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + easeInOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + easeInBounce: function (x, t, b, c, d) { + return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; + }, + easeOutBounce: function (x, t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + }, + easeInOutBounce: function (x, t, b, c, d) { + if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; + return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; + } +}); + +/* + * + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright © 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ \ No newline at end of file diff --git a/templates/javascript/jquery.js b/templates/javascript/jquery.js new file mode 100644 index 00000000..1112b4ef --- /dev/null +++ b/templates/javascript/jquery.js @@ -0,0 +1,5999 @@ +/*! + * jQuery JavaScript Library v1.4 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://docs.jquery.com/License + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Wed Jan 13 15:23:05 2010 -0500 + */ +(function( window, undefined ) { + +// Define a local copy of jQuery +var jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context ); + }, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + + // A central reference to the root jQuery(document) + rootjQuery, + + // A simple way to check for HTML strings or ID strings + // (both of which we optimize for) + quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, + + // Is it a simple selector + isSimple = /^.[^:#\[\.,]*$/, + + // Check if a string has a non-whitespace character in it + rnotwhite = /\S/, + + // Used for trimming whitespace + rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, + + // Keep a UserAgent string for use with jQuery.browser + userAgent = navigator.userAgent, + + // For matching the engine and version of the browser + browserMatch, + + // Has the ready events already been bound? + readyBound = false, + + // The functions to execute on DOM ready + readyList = [], + + // The ready event handler + DOMContentLoaded, + + // Save a reference to some core methods + toString = Object.prototype.toString, + hasOwnProperty = Object.prototype.hasOwnProperty, + push = Array.prototype.push, + slice = Array.prototype.slice, + indexOf = Array.prototype.indexOf; + +jQuery.fn = jQuery.prototype = { + init: function( selector, context ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), or $(undefined) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + // Are we dealing with HTML string or an ID? + match = quickExpr.exec( selector ); + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + doc = (context ? context.ownerDocument || context : document); + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + ret = rsingleTag.exec( selector ); + + if ( ret ) { + if ( jQuery.isPlainObject( context ) ) { + selector = [ document.createElement( ret[1] ) ]; + jQuery.fn.attr.call( selector, context, true ); + + } else { + selector = [ doc.createElement( ret[1] ) ]; + } + + } else { + ret = buildFragment( [ match[1] ], [ doc ] ); + selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; + } + + // HANDLE: $("#id") + } else { + elem = document.getElementById( match[2] ); + + if ( elem ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $("TAG") + } else if ( !context && /^\w+$/.test( selector ) ) { + this.selector = selector; + this.context = document; + selector = document.getElementsByTagName( selector ); + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return (context || rootjQuery).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return jQuery( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if (selector.selector !== undefined) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.isArray( selector ) ? + this.setArray( selector ) : + jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.4", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return slice.call( this, 0 ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + // Build a new jQuery matched element set + var ret = jQuery( elems || null ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + (this.selector ? " " : "") + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Force the current matched set of elements to become + // the specified array of elements (destroying the stack in the process) + // You should use pushStack() in order to do this, but maintain the stack + setArray: function( elems ) { + // Resetting the length to 0, then using the native Array push + // is a super-fast way to populate an object with array-like properties + this.length = 0; + push.apply( this, elems ); + + return this; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Attach the listeners + jQuery.bindReady(); + + // If the DOM is already ready + if ( jQuery.isReady ) { + // Execute the function immediately + fn.call( document, jQuery ); + + // Otherwise, remember the function for later + } else if ( readyList ) { + // Add the function to the wait list + readyList.push( fn ); + } + + return this; + }, + + eq: function( i ) { + return i === -1 ? + this.slice( i ) : + this.slice( i, +i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ), + "slice", slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || jQuery(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + // copy reference to target object + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging object literal values or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) { + var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src + : jQuery.isArray(copy) ? [] : {}; + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + window.$ = _$; + + if ( deep ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // Handle when the DOM is ready + ready: function() { + // Make sure that the DOM is not already loaded + if ( !jQuery.isReady ) { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 13 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If there are functions bound, to execute + if ( readyList ) { + // Execute all of them + var fn, i = 0; + while ( (fn = readyList[ i++ ]) ) { + fn.call( document, jQuery ); + } + + // Reset the list of functions + readyList = null; + } + + // Trigger any bound ready events + if ( jQuery.fn.triggerHandler ) { + jQuery( document ).triggerHandler( "ready" ); + } + } + }, + + bindReady: function() { + if ( readyBound ) { + return; + } + + readyBound = true; + + // Catch cases where $(document).ready() is called after the + // browser event has already occurred. + if ( document.readyState === "complete" ) { + return jQuery.ready(); + } + + // Mozilla, Opera and webkit nightlies currently support this event + if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else if ( document.attachEvent ) { + // ensure firing before onload, + // maybe late but safe also for iframes + document.attachEvent("onreadystatechange", DOMContentLoaded); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var toplevel = false; + + try { + toplevel = window.frameElement == null; + } catch(e) {} + + if ( document.documentElement.doScroll && toplevel ) { + doScrollCheck(); + } + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return toString.call(obj) === "[object Function]"; + }, + + isArray: function( obj ) { + return toString.call(obj) === "[object Array]"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) { + return false; + } + + // Not own constructor property must be Object + if ( obj.constructor + && !hasOwnProperty.call(obj, "constructor") + && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || hasOwnProperty.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + for ( var name in obj ) { + return false; + } + return true; + }, + + noop: function() {}, + + // Evalulates a script in a global context + globalEval: function( data ) { + if ( data && rnotwhite.test(data) ) { + // Inspired by code by Andrea Giammarchi + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html + var head = document.getElementsByTagName("head")[0] || document.documentElement, + script = document.createElement("script"); + + script.type = "text/javascript"; + + if ( jQuery.support.scriptEval ) { + script.appendChild( document.createTextNode( data ) ); + } else { + script.text = data; + } + + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709). + head.insertBefore( script, head.firstChild ); + head.removeChild( script ); + } + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); + }, + + // args is for internal usage only + each: function( object, callback, args ) { + var name, i = 0, + length = object.length, + isObj = length === undefined || jQuery.isFunction(object); + + if ( args ) { + if ( isObj ) { + for ( name in object ) { + if ( callback.apply( object[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( object[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in object ) { + if ( callback.call( object[ name ], name, object[ name ] ) === false ) { + break; + } + } + } else { + for ( var value = object[0]; + i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} + } + } + + return object; + }, + + trim: function( text ) { + return (text || "").replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( array, results ) { + var ret = results || []; + + if ( array != null ) { + // The window, strings (and functions) also have 'length' + // The extra typeof function check is to prevent crashes + // in Safari 2 (See: #3039) + if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) { + push.call( ret, array ); + } else { + jQuery.merge( ret, array ); + } + } + + return ret; + }, + + inArray: function( elem, array ) { + if ( array.indexOf ) { + return array.indexOf( elem ); + } + + for ( var i = 0, length = array.length; i < length; i++ ) { + if ( array[ i ] === elem ) { + return i; + } + } + + return -1; + }, + + merge: function( first, second ) { + var i = first.length, j = 0; + + if ( typeof second.length === "number" ) { + for ( var l = second.length; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var ret = []; + + // Go through the array, only saving the items + // that pass the validator function + for ( var i = 0, length = elems.length; i < length; i++ ) { + if ( !inv !== !callback( elems[ i ], i ) ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var ret = [], value; + + // Go through the array, translating each of the items to their + // new value (or values). + for ( var i = 0, length = elems.length; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + proxy: function( fn, proxy, thisObject ) { + if ( arguments.length === 2 ) { + if ( typeof proxy === "string" ) { + thisObject = fn; + fn = thisObject[ proxy ]; + proxy = undefined; + + } else if ( proxy && !jQuery.isFunction( proxy ) ) { + thisObject = proxy; + proxy = undefined; + } + } + + if ( !proxy && fn ) { + proxy = function() { + return fn.apply( thisObject || this, arguments ); + }; + } + + // Set the guid of unique handler to the same of original handler, so it can be removed + if ( fn ) { + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; + } + + // So proxy can be declared as an argument + return proxy; + }, + + // Use of jQuery.browser is frowned upon. + // More details: http://docs.jquery.com/Utilities/jQuery.browser + uaMatch: function( ua ) { + var ret = { browser: "" }; + + ua = ua.toLowerCase(); + + if ( /webkit/.test( ua ) ) { + ret = { browser: "webkit", version: /webkit[\/ ]([\w.]+)/ }; + + } else if ( /opera/.test( ua ) ) { + ret = { browser: "opera", version: /version/.test( ua ) ? /version[\/ ]([\w.]+)/ : /opera[\/ ]([\w.]+)/ }; + + } else if ( /msie/.test( ua ) ) { + ret = { browser: "msie", version: /msie ([\w.]+)/ }; + + } else if ( /mozilla/.test( ua ) && !/compatible/.test( ua ) ) { + ret = { browser: "mozilla", version: /rv:([\w.]+)/ }; + } + + ret.version = (ret.version && ret.version.exec( ua ) || [0, "0"])[1]; + + return ret; + }, + + browser: {} +}); + +browserMatch = jQuery.uaMatch( userAgent ); +if ( browserMatch.browser ) { + jQuery.browser[ browserMatch.browser ] = true; + jQuery.browser.version = browserMatch.version; +} + +// Deprecated, use jQuery.browser.webkit instead +if ( jQuery.browser.webkit ) { + jQuery.browser.safari = true; +} + +if ( indexOf ) { + jQuery.inArray = function( elem, array ) { + return indexOf.call( array, elem ); + }; +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); + +// Cleanup functions for the document ready method +if ( document.addEventListener ) { + DOMContentLoaded = function() { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + }; + +} else if ( document.attachEvent ) { + DOMContentLoaded = function() { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( document.readyState === "complete" ) { + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }; +} + +// The DOM ready check for Internet Explorer +function doScrollCheck() { + if ( jQuery.isReady ) { + return; + } + + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + document.documentElement.doScroll("left"); + } catch( error ) { + setTimeout( doScrollCheck, 1 ); + return; + } + + // and execute any waiting functions + jQuery.ready(); +} + +if ( indexOf ) { + jQuery.inArray = function( elem, array ) { + return indexOf.call( array, elem ); + }; +} + +function evalScript( i, elem ) { + if ( elem.src ) { + jQuery.ajax({ + url: elem.src, + async: false, + dataType: "script" + }); + } else { + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } +} + +// Mutifunctional method to get and set values to a collection +// The value/s can be optionally by executed if its a function +function access( elems, key, value, exec, fn, pass ) { + var length = elems.length; + + // Setting many attributes + if ( typeof key === "object" ) { + for ( var k in key ) { + access( elems, k, key[k], exec, fn, value ); + } + return elems; + } + + // Setting one attribute + if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = !pass && exec && jQuery.isFunction(value); + + for ( var i = 0; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + + return elems; + } + + // Getting an attribute + return length ? fn( elems[0], key ) : null; +} + +function now() { + return (new Date).getTime(); +} +(function() { + + jQuery.support = {}; + + var root = document.documentElement, + script = document.createElement("script"), + div = document.createElement("div"), + id = "script" + now(); + + div.style.display = "none"; + div.innerHTML = "
    a"; + + var all = div.getElementsByTagName("*"), + a = div.getElementsByTagName("a")[0]; + + // Can't get basic test support + if ( !all || !all.length || !a ) { + return; + } + + jQuery.support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: div.firstChild.nodeType === 3, + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText insted) + style: /red/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: a.getAttribute("href") === "/a", + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.55$/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: div.getElementsByTagName("input")[0].value === "on", + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, + + // Will be defined later + scriptEval: false, + noCloneEvent: true, + boxModel: null + }; + + script.type = "text/javascript"; + try { + script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); + } catch(e) {} + + root.insertBefore( script, root.firstChild ); + + // Make sure that the execution of code works by injecting a script + // tag with appendChild/createTextNode + // (IE doesn't support this, fails, and uses .text instead) + if ( window[ id ] ) { + jQuery.support.scriptEval = true; + delete window[ id ]; + } + + root.removeChild( script ); + + if ( div.attachEvent && div.fireEvent ) { + div.attachEvent("onclick", function click() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + jQuery.support.noCloneEvent = false; + div.detachEvent("onclick", click); + }); + div.cloneNode(true).fireEvent("onclick"); + } + + // Figure out if the W3C box model works as expected + // document.body must exist before we can do this + // TODO: This timeout is temporary until I move ready into core.js. + jQuery(function() { + var div = document.createElement("div"); + div.style.width = div.style.paddingLeft = "1px"; + + document.body.appendChild( div ); + jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; + document.body.removeChild( div ).style.display = 'none'; + div = null; + }); + + // Technique from Juriy Zaytsev + // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ + var eventSupported = function( eventName ) { + var el = document.createElement("div"); + eventName = "on" + eventName; + + var isSupported = (eventName in el); + if ( !isSupported ) { + el.setAttribute(eventName, "return;"); + isSupported = typeof el[eventName] === "function"; + } + el = null; + + return isSupported; + }; + + jQuery.support.submitBubbles = eventSupported("submit"); + jQuery.support.changeBubbles = eventSupported("change"); + + // release memory in IE + root = script = div = all = a = null; +})(); + +jQuery.props = { + "for": "htmlFor", + "class": "className", + readonly: "readOnly", + maxlength: "maxLength", + cellspacing: "cellSpacing", + rowspan: "rowSpan", + colspan: "colSpan", + tabindex: "tabIndex", + usemap: "useMap", + frameborder: "frameBorder" +}; +var expando = "jQuery" + now(), uuid = 0, windowData = {}; +var emptyObject = {}; + +jQuery.extend({ + cache: {}, + + expando:expando, + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + "object": true, + "applet": true + }, + + data: function( elem, name, data ) { + if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { + return; + } + + elem = elem == window ? + windowData : + elem; + + var id = elem[ expando ], cache = jQuery.cache, thisCache; + + // Handle the case where there's no name immediately + if ( !name && !id ) { + return null; + } + + // Compute a unique ID for the element + if ( !id ) { + id = ++uuid; + } + + // Avoid generating a new cache unless none exists and we + // want to manipulate it. + if ( typeof name === "object" ) { + elem[ expando ] = id; + thisCache = cache[ id ] = jQuery.extend(true, {}, name); + } else if ( cache[ id ] ) { + thisCache = cache[ id ]; + } else if ( typeof data === "undefined" ) { + thisCache = emptyObject; + } else { + thisCache = cache[ id ] = {}; + } + + // Prevent overriding the named cache with undefined values + if ( data !== undefined ) { + elem[ expando ] = id; + thisCache[ name ] = data; + } + + return typeof name === "string" ? thisCache[ name ] : thisCache; + }, + + removeData: function( elem, name ) { + if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { + return; + } + + elem = elem == window ? + windowData : + elem; + + var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; + + // If we want to remove a specific section of the element's data + if ( name ) { + if ( thisCache ) { + // Remove the section of cache data + delete thisCache[ name ]; + + // If we've removed all the data, remove the element's cache + if ( jQuery.isEmptyObject(thisCache) ) { + jQuery.removeData( elem ); + } + } + + // Otherwise, we want to remove all of the element's data + } else { + // Clean up the element expando + try { + delete elem[ expando ]; + } catch( e ) { + // IE has trouble directly removing the expando + // but it's ok with using removeAttribute + if ( elem.removeAttribute ) { + elem.removeAttribute( expando ); + } + } + + // Completely remove the data cache + delete cache[ id ]; + } + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + if ( typeof key === "undefined" && this.length ) { + return jQuery.data( this[0] ); + + } else if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + var parts = key.split("."); + parts[1] = parts[1] ? "." + parts[1] : ""; + + if ( value === undefined ) { + var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); + + if ( data === undefined && this.length ) { + data = jQuery.data( this[0], key ); + } + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + } else { + return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() { + jQuery.data( this, key, value ); + }); + } + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); +jQuery.extend({ + queue: function( elem, type, data ) { + if ( !elem ) { + return; + } + + type = (type || "fx") + "queue"; + var q = jQuery.data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( !data ) { + return q || []; + } + + if ( !q || jQuery.isArray(data) ) { + q = jQuery.data( elem, type, jQuery.makeArray(data) ); + + } else { + q.push( data ); + } + + return q; + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), fn = queue.shift(); + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + } + + if ( fn ) { + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift("inprogress"); + } + + fn.call(elem, function() { + jQuery.dequeue(elem, type); + }); + } + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + } + + if ( data === undefined ) { + return jQuery.queue( this[0], type ); + } + return this.each(function( i, elem ) { + var queue = jQuery.queue( this, type, data ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; + type = type || "fx"; + + return this.queue( type, function() { + var elem = this; + setTimeout(function() { + jQuery.dequeue( elem, type ); + }, time ); + }); + }, + + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + } +}); +var rclass = /[\n\t]/g, + rspace = /\s+/, + rreturn = /\r/g, + rspecialurl = /href|src|style/, + rtype = /(button|input)/i, + rfocusable = /(button|input|object|select|textarea)/i, + rclickable = /^(a|area)$/i, + rradiocheck = /radio|checkbox/; + +jQuery.fn.extend({ + attr: function( name, value ) { + return access( this, name, value, true, jQuery.attr ); + }, + + removeAttr: function( name, fn ) { + return this.each(function(){ + jQuery.attr( this, name, "" ); + if ( this.nodeType === 1 ) { + this.removeAttribute( name ); + } + }); + }, + + addClass: function( value ) { + if ( jQuery.isFunction(value) ) { + return this.each(function(i) { + var self = jQuery(this); + self.addClass( value.call(this, i, self.attr("class")) ); + }); + } + + if ( value && typeof value === "string" ) { + var classNames = (value || "").split( rspace ); + + for ( var i = 0, l = this.length; i < l; i++ ) { + var elem = this[i]; + + if ( elem.nodeType === 1 ) { + if ( !elem.className ) { + elem.className = value; + + } else { + var className = " " + elem.className + " "; + for ( var c = 0, cl = classNames.length; c < cl; c++ ) { + if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { + elem.className += " " + classNames[c]; + } + } + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + if ( jQuery.isFunction(value) ) { + return this.each(function(i) { + var self = jQuery(this); + self.removeClass( value.call(this, i, self.attr("class")) ); + }); + } + + if ( (value && typeof value === "string") || value === undefined ) { + var classNames = (value || "").split(rspace); + + for ( var i = 0, l = this.length; i < l; i++ ) { + var elem = this[i]; + + if ( elem.nodeType === 1 && elem.className ) { + if ( value ) { + var className = (" " + elem.className + " ").replace(rclass, " "); + for ( var c = 0, cl = classNames.length; c < cl; c++ ) { + className = className.replace(" " + classNames[c] + " ", " "); + } + elem.className = className.substring(1, className.length - 1); + + } else { + elem.className = ""; + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function(i) { + var self = jQuery(this); + self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, i = 0, self = jQuery(this), + state = stateVal, + classNames = value.split( rspace ); + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space seperated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery.data( this, "__className__", this.className ); + } + + // toggle whole className + this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " "; + for ( var i = 0, l = this.length; i < l; i++ ) { + if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + if ( value === undefined ) { + var elem = this[0]; + + if ( elem ) { + if ( jQuery.nodeName( elem, "option" ) ) { + return (elem.attributes.value || {}).specified ? elem.value : elem.text; + } + + // We need to handle select boxes special + if ( jQuery.nodeName( elem, "select" ) ) { + var index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type === "select-one"; + + // Nothing was selected + if ( index < 0 ) { + return null; + } + + // Loop through all the selected options + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { + var option = options[ i ]; + + if ( option.selected ) { + // Get the specifc value for the option + value = jQuery(option).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + } + + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { + return elem.getAttribute("value") === null ? "on" : elem.value; + } + + + // Everything else, we just grab the value + return (elem.value || "").replace(rreturn, ""); + + } + + return undefined; + } + + var isFunction = jQuery.isFunction(value); + + return this.each(function(i) { + var self = jQuery(this), val = value; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call(this, i, self.val()); + } + + // Typecast each time if the value is a Function and the appended + // value is therefore different each time. + if ( typeof val === "number" ) { + val += ""; + } + + if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { + this.checked = jQuery.inArray( self.val(), val ) >= 0; + + } else if ( jQuery.nodeName( this, "select" ) ) { + var values = jQuery.makeArray(val); + + jQuery( "option", this ).each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + this.selectedIndex = -1; + } + + } else { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + attrFn: { + val: true, + css: true, + html: true, + text: true, + data: true, + width: true, + height: true, + offset: true + }, + + attr: function( elem, name, value, pass ) { + // don't set attributes on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { + return undefined; + } + + if ( pass && name in jQuery.attrFn ) { + return jQuery(elem)[name](value); + } + + var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), + // Whether we are setting (or getting) + set = value !== undefined; + + // Try to normalize/fix the name + name = notxml && jQuery.props[ name ] || name; + + // Only do all the following if this is a node (faster for style) + if ( elem.nodeType === 1 ) { + // These attributes require special treatment + var special = rspecialurl.test( name ); + + // Safari mis-reports the default selected property of an option + // Accessing the parent's selectedIndex property fixes it + if ( name === "selected" && !jQuery.support.optSelected ) { + var parent = elem.parentNode; + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + } + + // If applicable, access the attribute via the DOM 0 way + if ( name in elem && notxml && !special ) { + if ( set ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { + throw "type property can't be changed"; + } + + elem[ name ] = value; + } + + // browsers index elements by id/name on forms, give priority to attributes. + if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { + return elem.getAttributeNode( name ).nodeValue; + } + + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + if ( name === "tabIndex" ) { + var attributeNode = elem.getAttributeNode( "tabIndex" ); + + return attributeNode && attributeNode.specified ? + attributeNode.value : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + + return elem[ name ]; + } + + if ( !jQuery.support.style && notxml && name === "style" ) { + if ( set ) { + elem.style.cssText = "" + value; + } + + return elem.style.cssText; + } + + if ( set ) { + // convert the value to a string (all browsers do this but IE) see #1070 + elem.setAttribute( name, "" + value ); + } + + var attr = !jQuery.support.hrefNormalized && notxml && special ? + // Some attributes require a special call on IE + elem.getAttribute( name, 2 ) : + elem.getAttribute( name ); + + // Non-existent attributes return null, we normalize to undefined + return attr === null ? undefined : attr; + } + + // elem is actually elem.style ... set the style + // Using attr for specific style information is now deprecated. Use style insead. + return jQuery.style( elem, name, value ); + } +}); +var fcleanup = function( nm ) { + return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { + return "\\" + ch; + }); +}; + +/* + * A number of helper functions used for managing events. + * Many of the ideas behind this code originated from + * Dean Edwards' addEvent library. + */ +jQuery.event = { + + // Bind an event to an element + // Original by Dean Edwards + add: function( elem, types, handler, data ) { + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // For whatever reason, IE has trouble passing the window object + // around, causing it to be cloned in the process + if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { + elem = window; + } + + // Make sure that the function being executed has a unique ID + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // if data is passed, bind to handler + if ( data !== undefined ) { + // Create temporary function pointer to original handler + var fn = handler; + + // Create unique handler function, wrapped around original handler + handler = jQuery.proxy( fn ); + + // Store data in unique handler + handler.data = data; + } + + // Init the element's event structure + var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ), + handle = jQuery.data( elem, "handle" ), eventHandle; + + if ( !handle ) { + eventHandle = function() { + // Handle the second event of a trigger and when + // an event is called after a page has unloaded + return typeof jQuery !== "undefined" && !jQuery.event.triggered ? + jQuery.event.handle.apply( eventHandle.elem, arguments ) : + undefined; + }; + + handle = jQuery.data( elem, "handle", eventHandle ); + } + + // If no handle is found then we must be trying to bind to one of the + // banned noData elements + if ( !handle ) { + return; + } + + // Add elem as a property of the handle function + // This is to prevent a memory leak with non-native + // event in IE. + handle.elem = elem; + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = types.split( /\s+/ ); + var type, i=0; + while ( (type = types[ i++ ]) ) { + // Namespaced event handlers + var namespaces = type.split("."); + type = namespaces.shift(); + handler.type = namespaces.slice(0).sort().join("."); + + // Get the current list of functions bound to this event + var handlers = events[ type ], + special = this.special[ type ] || {}; + + + + // Init the event handler queue + if ( !handlers ) { + handlers = events[ type ] = {}; + + // Check for a special event handler + // Only use addEventListener/attachEvent if the special + // events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, handler) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, handle, false ); + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, handle ); + } + } + } + + if ( special.add ) { + var modifiedHandler = special.add.call( elem, handler, data, namespaces, handlers ); + if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) { + modifiedHandler.guid = modifiedHandler.guid || handler.guid; + handler = modifiedHandler; + } + } + + // Add the function to the element's handler list + handlers[ handler.guid ] = handler; + + // Keep track of which events have been used, for global triggering + this.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler ) { + // don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + var events = jQuery.data( elem, "events" ), ret, type, fn; + + if ( events ) { + // Unbind all events for the element + if ( types === undefined || (typeof types === "string" && types.charAt(0) === ".") ) { + for ( type in events ) { + this.remove( elem, type + (types || "") ); + } + } else { + // types is actually an event object here + if ( types.type ) { + handler = types.handler; + types = types.type; + } + + // Handle multiple events separated by a space + // jQuery(...).unbind("mouseover mouseout", fn); + types = types.split(/\s+/); + var i = 0; + while ( (type = types[ i++ ]) ) { + // Namespaced event handlers + var namespaces = type.split("."); + type = namespaces.shift(); + var all = !namespaces.length, + cleaned = jQuery.map( namespaces.slice(0).sort(), fcleanup ), + namespace = new RegExp("(^|\\.)" + cleaned.join("\\.(?:.*\\.)?") + "(\\.|$)"), + special = this.special[ type ] || {}; + + if ( events[ type ] ) { + // remove the given handler for the given type + if ( handler ) { + fn = events[ type ][ handler.guid ]; + delete events[ type ][ handler.guid ]; + + // remove all handlers for the given type + } else { + for ( var handle in events[ type ] ) { + // Handle the removal of namespaced events + if ( all || namespace.test( events[ type ][ handle ].type ) ) { + delete events[ type ][ handle ]; + } + } + } + + if ( special.remove ) { + special.remove.call( elem, namespaces, fn); + } + + // remove generic event handler if no more handlers exist + for ( ret in events[ type ] ) { + break; + } + if ( !ret ) { + if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, jQuery.data( elem, "handle" ), false ); + } else if ( elem.detachEvent ) { + elem.detachEvent( "on" + type, jQuery.data( elem, "handle" ) ); + } + } + ret = null; + delete events[ type ]; + } + } + } + } + + // Remove the expando if it's no longer used + for ( ret in events ) { + break; + } + if ( !ret ) { + var handle = jQuery.data( elem, "handle" ); + if ( handle ) { + handle.elem = null; + } + jQuery.removeData( elem, "events" ); + jQuery.removeData( elem, "handle" ); + } + } + }, + + // bubbling is internal + trigger: function( event, data, elem /*, bubbling */ ) { + // Event object or event type + var type = event.type || event, + bubbling = arguments[3]; + + if ( !bubbling ) { + event = typeof event === "object" ? + // jQuery.Event object + event[expando] ? event : + // Object literal + jQuery.extend( jQuery.Event(type), event ) : + // Just the event type (string) + jQuery.Event(type); + + if ( type.indexOf("!") >= 0 ) { + event.type = type = type.slice(0, -1); + event.exclusive = true; + } + + // Handle a global trigger + if ( !elem ) { + // Don't bubble custom events when global (to avoid too much overhead) + event.stopPropagation(); + + // Only trigger if we've ever bound an event for it + if ( this.global[ type ] ) { + jQuery.each( jQuery.cache, function() { + if ( this.events && this.events[type] ) { + jQuery.event.trigger( event, data, this.handle.elem ); + } + }); + } + } + + // Handle triggering a single element + + // don't do events on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { + return undefined; + } + + // Clean up in case it is reused + event.result = undefined; + event.target = elem; + + // Clone the incoming data, if any + data = jQuery.makeArray( data ); + data.unshift( event ); + } + + event.currentTarget = elem; + + // Trigger the event, it is assumed that "handle" is a function + var handle = jQuery.data( elem, "handle" ); + if ( handle ) { + handle.apply( elem, data ); + } + + var nativeFn, nativeHandler; + try { + if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { + nativeFn = elem[ type ]; + nativeHandler = elem[ "on" + type ]; + } + // prevent IE from throwing an error for some elements with some event types, see #3533 + } catch (e) {} + + var isClick = jQuery.nodeName(elem, "a") && type === "click"; + + // Trigger the native events (except for clicks on links) + if ( !bubbling && nativeFn && !event.isDefaultPrevented() && !isClick ) { + this.triggered = true; + try { + elem[ type ](); + // prevent IE from throwing an error for some hidden elements + } catch (e) {} + + // Handle triggering native .onfoo handlers + } else if ( nativeHandler && elem[ "on" + type ].apply( elem, data ) === false ) { + event.result = false; + } + + this.triggered = false; + + if ( !event.isPropagationStopped() ) { + var parent = elem.parentNode || elem.ownerDocument; + if ( parent ) { + jQuery.event.trigger( event, data, parent, true ); + } + } + }, + + handle: function( event ) { + // returned undefined or false + var all, handlers; + + event = arguments[0] = jQuery.event.fix( event || window.event ); + event.currentTarget = this; + + // Namespaced event handlers + var namespaces = event.type.split("."); + event.type = namespaces.shift(); + + // Cache this now, all = true means, any handler + all = !namespaces.length && !event.exclusive; + + var namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"); + + handlers = ( jQuery.data(this, "events") || {} )[ event.type ]; + + for ( var j in handlers ) { + var handler = handlers[ j ]; + + // Filter the functions by class + if ( all || namespace.test(handler.type) ) { + // Pass in a reference to the handler function itself + // So that we can later remove it + event.handler = handler; + event.data = handler.data; + + var ret = handler.apply( this, arguments ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + + if ( event.isImmediatePropagationStopped() ) { + break; + } + + } + } + + return event.result; + }, + + props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), + + fix: function( event ) { + if ( event[ expando ] ) { + return event; + } + + // store a copy of the original event object + // and "clone" to set read-only properties + var originalEvent = event; + event = jQuery.Event( originalEvent ); + + for ( var i = this.props.length, prop; i; ) { + prop = this.props[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary + if ( !event.target ) { + event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either + } + + // check if target is a textnode (safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && event.fromElement ) { + event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; + } + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && event.clientX != null ) { + var doc = document.documentElement, body = document.body; + event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); + event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); + } + + // Add which for key events + if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) { + event.which = event.charCode || event.keyCode; + } + + // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) + if ( !event.metaKey && event.ctrlKey ) { + event.metaKey = event.ctrlKey; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && event.button !== undefined ) { + event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); + } + + return event; + }, + + // Deprecated, use jQuery.guid instead + guid: 1E8, + + // Deprecated, use jQuery.proxy instead + proxy: jQuery.proxy, + + special: { + ready: { + // Make sure the ready event is setup + setup: jQuery.bindReady, + teardown: jQuery.noop + }, + + live: { + add: function( proxy, data, namespaces, live ) { + jQuery.extend( proxy, data || {} ); + + proxy.guid += data.selector + data.live; + jQuery.event.add( this, data.live, liveHandler, data ); + + }, + + remove: function( namespaces ) { + if ( namespaces.length ) { + var remove = 0, name = new RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)"); + + jQuery.each( (jQuery.data(this, "events").live || {}), function() { + if ( name.test(this.type) ) { + remove++; + } + }); + + if ( remove < 1 ) { + jQuery.event.remove( this, namespaces[0], liveHandler ); + } + } + }, + special: {} + }, + beforeunload: { + setup: function( data, namespaces, fn ) { + // We only want to do this special case on windows + if ( this.setInterval ) { + this.onbeforeunload = fn; + } + + return false; + }, + teardown: function( namespaces, fn ) { + if ( this.onbeforeunload === fn ) { + this.onbeforeunload = null; + } + } + } + } +}; + +jQuery.Event = function( src ) { + // Allow instantiation without the 'new' keyword + if ( !this.preventDefault ) { + return new jQuery.Event( src ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + // Event type + } else { + this.type = src; + } + + // timeStamp is buggy for some events on Firefox(#3843) + // So we won't rely on the native value + this.timeStamp = now(); + + // Mark it as fixed + this[ expando ] = true; +}; + +function returnFalse() { + return false; +} +function returnTrue() { + return true; +} + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + preventDefault: function() { + this.isDefaultPrevented = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + } + // otherwise set the returnValue property of the original event to false (IE) + e.returnValue = false; + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +// Checks if an event happened on an element within another element +// Used in jQuery.event.special.mouseenter and mouseleave handlers +var withinElement = function( event ) { + // Check if mouse(over|out) are still within the same parent element + var parent = event.relatedTarget; + + // Traverse up the tree + while ( parent && parent !== this ) { + // Firefox sometimes assigns relatedTarget a XUL element + // which we cannot access the parentNode property of + try { + parent = parent.parentNode; + + // assuming we've left the element since we most likely mousedover a xul element + } catch(e) { + break; + } + } + + if ( parent !== this ) { + // set the correct event type + event.type = event.data; + + // handle event if we actually just moused on to a non sub-element + jQuery.event.handle.apply( this, arguments ); + } + +}, + +// In case of event delegation, we only need to rename the event.type, +// liveHandler will take care of the rest. +delegate = function( event ) { + event.type = event.data; + jQuery.event.handle.apply( this, arguments ); +}; + +// Create mouseenter and mouseleave events +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + setup: function( data ) { + jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); + }, + teardown: function( data ) { + jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); + } + }; +}); + +// submit delegation +if ( !jQuery.support.submitBubbles ) { + +jQuery.event.special.submit = { + setup: function( data, namespaces, fn ) { + if ( this.nodeName.toLowerCase() !== "form" ) { + jQuery.event.add(this, "click.specialSubmit." + fn.guid, function( e ) { + var elem = e.target, type = elem.type; + + if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { + return trigger( "submit", this, arguments ); + } + }); + + jQuery.event.add(this, "keypress.specialSubmit." + fn.guid, function( e ) { + var elem = e.target, type = elem.type; + + if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { + return trigger( "submit", this, arguments ); + } + }); + + } else { + return false; + } + }, + + remove: function( namespaces, fn ) { + jQuery.event.remove( this, "click.specialSubmit" + (fn ? "."+fn.guid : "") ); + jQuery.event.remove( this, "keypress.specialSubmit" + (fn ? "."+fn.guid : "") ); + } +}; + +} + +// change delegation, happens here so we have bind. +if ( !jQuery.support.changeBubbles ) { + +var formElems = /textarea|input|select/i; + +function getVal( elem ) { + var type = elem.type, val = elem.value; + + if ( type === "radio" || type === "checkbox" ) { + val = elem.checked; + + } else if ( type === "select-multiple" ) { + val = elem.selectedIndex > -1 ? + jQuery.map( elem.options, function( elem ) { + return elem.selected; + }).join("-") : + ""; + + } else if ( elem.nodeName.toLowerCase() === "select" ) { + val = elem.selectedIndex; + } + + return val; +} + +function testChange( e ) { + var elem = e.target, data, val; + + if ( !formElems.test( elem.nodeName ) || elem.readOnly ) { + return; + } + + data = jQuery.data( elem, "_change_data" ); + val = getVal(elem); + + if ( val === data ) { + return; + } + + // the current data will be also retrieved by beforeactivate + if ( e.type !== "focusout" || elem.type !== "radio" ) { + jQuery.data( elem, "_change_data", val ); + } + + if ( elem.type !== "select" && (data != null || val) ) { + e.type = "change"; + return jQuery.event.trigger( e, arguments[1], this ); + } +} + +jQuery.event.special.change = { + filters: { + focusout: testChange, + + click: function( e ) { + var elem = e.target, type = elem.type; + + if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { + return testChange.call( this, e ); + } + }, + + // Change has to be called before submit + // Keydown will be called before keypress, which is used in submit-event delegation + keydown: function( e ) { + var elem = e.target, type = elem.type; + + if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || + (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || + type === "select-multiple" ) { + return testChange.call( this, e ); + } + }, + + // Beforeactivate happens also before the previous element is blurred + // with this event you can't trigger a change event, but you can store + // information/focus[in] is not needed anymore + beforeactivate: function( e ) { + var elem = e.target; + + if ( elem.nodeName.toLowerCase() === "input" && elem.type === "radio" ) { + jQuery.data( elem, "_change_data", getVal(elem) ); + } + } + }, + setup: function( data, namespaces, fn ) { + for ( var type in changeFilters ) { + jQuery.event.add( this, type + ".specialChange." + fn.guid, changeFilters[type] ); + } + + return formElems.test( this.nodeName ); + }, + remove: function( namespaces, fn ) { + for ( var type in changeFilters ) { + jQuery.event.remove( this, type + ".specialChange" + (fn ? "."+fn.guid : ""), changeFilters[type] ); + } + + return formElems.test( this.nodeName ); + } +}; + +var changeFilters = jQuery.event.special.change.filters; + +} + +function trigger( type, elem, args ) { + args[0].type = type; + return jQuery.event.handle.apply( elem, args ); +} + +// Create "bubbling" focus and blur events +if ( document.addEventListener ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + jQuery.event.special[ fix ] = { + setup: function() { + this.addEventListener( orig, handler, true ); + }, + teardown: function() { + this.removeEventListener( orig, handler, true ); + } + }; + + function handler( e ) { + e = jQuery.event.fix( e ); + e.type = fix; + return jQuery.event.handle.call( this, e ); + } + }); +} + +jQuery.each(["bind", "one"], function( i, name ) { + jQuery.fn[ name ] = function( type, data, fn ) { + // Handle object literals + if ( typeof type === "object" ) { + for ( var key in type ) { + this[ name ](key, data, type[key], fn); + } + return this; + } + + if ( jQuery.isFunction( data ) ) { + thisObject = fn; + fn = data; + data = undefined; + } + + var handler = name === "one" ? jQuery.proxy( fn, function( event ) { + jQuery( this ).unbind( event, handler ); + return fn.apply( this, arguments ); + }) : fn; + + return type === "unload" && name !== "one" ? + this.one( type, data, fn, thisObject ) : + this.each(function() { + jQuery.event.add( this, type, handler, data ); + }); + }; +}); + +jQuery.fn.extend({ + unbind: function( type, fn ) { + // Handle object literals + if ( typeof type === "object" && !type.preventDefault ) { + for ( var key in type ) { + this.unbind(key, type[key]); + } + return this; + } + + return this.each(function() { + jQuery.event.remove( this, type, fn ); + }); + }, + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + + triggerHandler: function( type, data ) { + if ( this[0] ) { + var event = jQuery.Event( type ); + event.preventDefault(); + event.stopPropagation(); + jQuery.event.trigger( event, data, this[0] ); + return event.result; + } + }, + + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, i = 1; + + // link all the functions, so any of them can unbind this click handler + while ( i < args.length ) { + jQuery.proxy( fn, args[ i++ ] ); + } + + return this.click( jQuery.proxy( fn, function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + })); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + }, + + live: function( type, data, fn ) { + if ( jQuery.isFunction( data ) ) { + fn = data; + data = undefined; + } + + jQuery( this.context ).bind( liveConvert( type, this.selector ), { + data: data, selector: this.selector, live: type + }, fn ); + + return this; + }, + + die: function( type, fn ) { + jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null ); + return this; + } +}); + +function liveHandler( event ) { + var stop = true, elems = [], selectors = [], args = arguments, + related, match, fn, elem, j, i, data, + live = jQuery.extend({}, jQuery.data( this, "events" ).live); + + for ( j in live ) { + fn = live[j]; + if ( fn.live === event.type || + fn.altLive && jQuery.inArray(event.type, fn.altLive) > -1 ) { + + data = fn.data; + if ( !(data.beforeFilter && data.beforeFilter[event.type] && + !data.beforeFilter[event.type](event)) ) { + selectors.push( fn.selector ); + } + } else { + delete live[j]; + } + } + + match = jQuery( event.target ).closest( selectors, event.currentTarget ); + + for ( i = 0, l = match.length; i < l; i++ ) { + for ( j in live ) { + fn = live[j]; + elem = match[i].elem; + related = null; + + if ( match[i].selector === fn.selector ) { + // Those two events require additional checking + if ( fn.live === "mouseenter" || fn.live === "mouseleave" ) { + related = jQuery( event.relatedTarget ).closest( fn.selector )[0]; + } + + if ( !related || related !== elem ) { + elems.push({ elem: elem, fn: fn }); + } + } + } + } + + for ( i = 0, l = elems.length; i < l; i++ ) { + match = elems[i]; + event.currentTarget = match.elem; + event.data = match.fn.data; + if ( match.fn.apply( match.elem, args ) === false ) { + stop = false; + break; + } + } + + return stop; +} + +function liveConvert( type, selector ) { + return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "&")].join("."); +} + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( fn ) { + return fn ? this.bind( name, fn ) : this.trigger( name ); + }; + + if ( jQuery.attrFn ) { + jQuery.attrFn[ name ] = true; + } +}); + +// Prevent memory leaks in IE +// Window isn't included so as not to unbind existing unload events +// More info: +// - http://isaacschlueter.com/2006/10/msie-memory-leaks/ +if ( window.attachEvent && !window.addEventListener ) { + window.attachEvent("onunload", function() { + for ( var id in jQuery.cache ) { + if ( jQuery.cache[ id ].handle ) { + // Try/Catch is to handle iframes being unloaded, see #4280 + try { + jQuery.event.remove( jQuery.cache[ id ].handle.elem ); + } catch(e) {} + } + } + }); +} +/*! + * Sizzle CSS Selector Engine - v1.0 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false, + baseHasDuplicate = true; + +// Here we check if the JavaScript engine is using some sort of +// optimization where it does not always call our comparision +// function. If that is the case, discard the hasDuplicate value. +// Thus far that includes Google Chrome. +[0, 0].sort(function(){ + baseHasDuplicate = false; + return 0; +}); + +var Sizzle = function(selector, context, results, seed) { + results = results || []; + var origContext = context = context || document; + + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { + return []; + } + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context), + soFar = selector; + + // Reset the position of the chunker regexp (start from head) + while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { + soFar = m[3]; + + parts.push( m[1] ); + + if ( m[2] ) { + extra = m[3]; + break; + } + } + + if ( parts.length > 1 && origPOS.exec( selector ) ) { + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { + set = posProcess( parts[0] + parts[1], context ); + } else { + set = Expr.relative[ parts[0] ] ? + [ context ] : + Sizzle( parts.shift(), context ); + + while ( parts.length ) { + selector = parts.shift(); + + if ( Expr.relative[ selector ] ) { + selector += parts.shift(); + } + + set = posProcess( selector, set ); + } + } + } else { + // Take a shortcut and set the context if the root selector is an ID + // (but not if it'll be faster if the inner selector is an ID) + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { + var ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; + } + + if ( context ) { + var ret = seed ? + { expr: parts.pop(), set: makeArray(seed) } : + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); + set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; + + if ( parts.length > 0 ) { + checkSet = makeArray(set); + } else { + prune = false; + } + + while ( parts.length ) { + var cur = parts.pop(), pop = cur; + + if ( !Expr.relative[ cur ] ) { + cur = ""; + } else { + pop = parts.pop(); + } + + if ( pop == null ) { + pop = context; + } + + Expr.relative[ cur ]( checkSet, pop, contextXML ); + } + } else { + checkSet = parts = []; + } + } + + if ( !checkSet ) { + checkSet = set; + } + + if ( !checkSet ) { + throw "Syntax error, unrecognized expression: " + (cur || selector); + } + + if ( toString.call(checkSet) === "[object Array]" ) { + if ( !prune ) { + results.push.apply( results, checkSet ); + } else if ( context && context.nodeType === 1 ) { + for ( var i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { + results.push( set[i] ); + } + } + } else { + for ( var i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { + results.push( set[i] ); + } + } + } + } else { + makeArray( checkSet, results ); + } + + if ( extra ) { + Sizzle( extra, origContext, results, seed ); + Sizzle.uniqueSort( results ); + } + + return results; +}; + +Sizzle.uniqueSort = function(results){ + if ( sortOrder ) { + hasDuplicate = baseHasDuplicate; + results.sort(sortOrder); + + if ( hasDuplicate ) { + for ( var i = 1; i < results.length; i++ ) { + if ( results[i] === results[i-1] ) { + results.splice(i--, 1); + } + } + } + } + + return results; +}; + +Sizzle.matches = function(expr, set){ + return Sizzle(expr, null, null, set); +}; + +Sizzle.find = function(expr, context, isXML){ + var set, match; + + if ( !expr ) { + return []; + } + + for ( var i = 0, l = Expr.order.length; i < l; i++ ) { + var type = Expr.order[i], match; + + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { + var left = match[1]; + match.splice(1,1); + + if ( left.substr( left.length - 1 ) !== "\\" ) { + match[1] = (match[1] || "").replace(/\\/g, ""); + set = Expr.find[ type ]( match, context, isXML ); + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = context.getElementsByTagName("*"); + } + + return {set: set, expr: expr}; +}; + +Sizzle.filter = function(expr, set, inplace, not){ + var old = expr, result = [], curLoop = set, match, anyFound, + isXMLFilter = set && set[0] && isXML(set[0]); + + while ( expr && set.length ) { + for ( var type in Expr.filter ) { + if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { + var filter = Expr.filter[ type ], found, item, left = match[1]; + anyFound = false; + + match.splice(1,1); + + if ( left.substr( left.length - 1 ) === "\\" ) { + continue; + } + + if ( curLoop === result ) { + result = []; + } + + if ( Expr.preFilter[ type ] ) { + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); + + if ( !match ) { + anyFound = found = true; + } else if ( match === true ) { + continue; + } + } + + if ( match ) { + for ( var i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + var pass = not ^ !!found; + + if ( inplace && found != null ) { + if ( pass ) { + anyFound = true; + } else { + curLoop[i] = false; + } + } else if ( pass ) { + result.push( item ); + anyFound = true; + } + } + } + } + + if ( found !== undefined ) { + if ( !inplace ) { + curLoop = result; + } + + expr = expr.replace( Expr.match[ type ], "" ); + + if ( !anyFound ) { + return []; + } + + break; + } + } + } + + // Improper expression + if ( expr === old ) { + if ( anyFound == null ) { + throw "Syntax error, unrecognized expression: " + expr; + } else { + break; + } + } + + old = expr; + } + + return curLoop; +}; + +var Expr = Sizzle.selectors = { + order: [ "ID", "NAME", "TAG" ], + match: { + ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, + CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ + }, + leftMatch: {}, + attrMap: { + "class": "className", + "for": "htmlFor" + }, + attrHandle: { + href: function(elem){ + return elem.getAttribute("href"); + } + }, + relative: { + "+": function(checkSet, part){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !/\W/.test(part), + isPartStrNotTag = isPartStr && !isTag; + + if ( isTag ) { + part = part.toLowerCase(); + } + + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { + if ( (elem = checkSet[i]) ) { + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} + + checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? + elem || false : + elem === part; + } + } + + if ( isPartStrNotTag ) { + Sizzle.filter( part, checkSet, true ); + } + }, + ">": function(checkSet, part){ + var isPartStr = typeof part === "string"; + + if ( isPartStr && !/\W/.test(part) ) { + part = part.toLowerCase(); + + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + var parent = elem.parentNode; + checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; + } + } + } else { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + checkSet[i] = isPartStr ? + elem.parentNode : + elem.parentNode === part; + } + } + + if ( isPartStr ) { + Sizzle.filter( part, checkSet, true ); + } + } + }, + "": function(checkSet, part, isXML){ + var doneName = done++, checkFn = dirCheck; + + if ( typeof part === "string" && !/\W/.test(part) ) { + var nodeCheck = part = part.toLowerCase(); + checkFn = dirNodeCheck; + } + + checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); + }, + "~": function(checkSet, part, isXML){ + var doneName = done++, checkFn = dirCheck; + + if ( typeof part === "string" && !/\W/.test(part) ) { + var nodeCheck = part = part.toLowerCase(); + checkFn = dirNodeCheck; + } + + checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); + } + }, + find: { + ID: function(match, context, isXML){ + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + return m ? [m] : []; + } + }, + NAME: function(match, context){ + if ( typeof context.getElementsByName !== "undefined" ) { + var ret = [], results = context.getElementsByName(match[1]); + + for ( var i = 0, l = results.length; i < l; i++ ) { + if ( results[i].getAttribute("name") === match[1] ) { + ret.push( results[i] ); + } + } + + return ret.length === 0 ? null : ret; + } + }, + TAG: function(match, context){ + return context.getElementsByTagName(match[1]); + } + }, + preFilter: { + CLASS: function(match, curLoop, inplace, result, not, isXML){ + match = " " + match[1].replace(/\\/g, "") + " "; + + if ( isXML ) { + return match; + } + + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { + if ( elem ) { + if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) { + if ( !inplace ) { + result.push( elem ); + } + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + ID: function(match){ + return match[1].replace(/\\/g, ""); + }, + TAG: function(match, curLoop){ + return match[1].toLowerCase(); + }, + CHILD: function(match){ + if ( match[1] === "nth" ) { + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' + var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( + match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); + + // calculate the numbers (first)n+(last) including if they are negative + match[2] = (test[1] + (test[2] || 1)) - 0; + match[3] = test[3] - 0; + } + + // TODO: Move to normal caching system + match[0] = done++; + + return match; + }, + ATTR: function(match, curLoop, inplace, result, not, isXML){ + var name = match[1].replace(/\\/g, ""); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + if ( match[2] === "~=" ) { + match[4] = " " + match[4] + " "; + } + + return match; + }, + PSEUDO: function(match, curLoop, inplace, result, not){ + if ( match[1] === "not" ) { + // If we're dealing with a complex expression, or a simple one + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { + match[3] = Sizzle(match[3], null, null, curLoop); + } else { + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + if ( !inplace ) { + result.push.apply( result, ret ); + } + return false; + } + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { + return true; + } + + return match; + }, + POS: function(match){ + match.unshift( true ); + return match; + } + }, + filters: { + enabled: function(elem){ + return elem.disabled === false && elem.type !== "hidden"; + }, + disabled: function(elem){ + return elem.disabled === true; + }, + checked: function(elem){ + return elem.checked === true; + }, + selected: function(elem){ + // Accessing this property makes selected-by-default + // options in Safari work properly + elem.parentNode.selectedIndex; + return elem.selected === true; + }, + parent: function(elem){ + return !!elem.firstChild; + }, + empty: function(elem){ + return !elem.firstChild; + }, + has: function(elem, i, match){ + return !!Sizzle( match[3], elem ).length; + }, + header: function(elem){ + return /h\d/i.test( elem.nodeName ); + }, + text: function(elem){ + return "text" === elem.type; + }, + radio: function(elem){ + return "radio" === elem.type; + }, + checkbox: function(elem){ + return "checkbox" === elem.type; + }, + file: function(elem){ + return "file" === elem.type; + }, + password: function(elem){ + return "password" === elem.type; + }, + submit: function(elem){ + return "submit" === elem.type; + }, + image: function(elem){ + return "image" === elem.type; + }, + reset: function(elem){ + return "reset" === elem.type; + }, + button: function(elem){ + return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; + }, + input: function(elem){ + return /input|select|textarea|button/i.test(elem.nodeName); + } + }, + setFilters: { + first: function(elem, i){ + return i === 0; + }, + last: function(elem, i, match, array){ + return i === array.length - 1; + }, + even: function(elem, i){ + return i % 2 === 0; + }, + odd: function(elem, i){ + return i % 2 === 1; + }, + lt: function(elem, i, match){ + return i < match[3] - 0; + }, + gt: function(elem, i, match){ + return i > match[3] - 0; + }, + nth: function(elem, i, match){ + return match[3] - 0 === i; + }, + eq: function(elem, i, match){ + return match[3] - 0 === i; + } + }, + filter: { + PSEUDO: function(elem, match, i, array){ + var name = match[1], filter = Expr.filters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } else if ( name === "contains" ) { + return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; + } else if ( name === "not" ) { + var not = match[3]; + + for ( var i = 0, l = not.length; i < l; i++ ) { + if ( not[i] === elem ) { + return false; + } + } + + return true; + } else { + throw "Syntax error, unrecognized expression: " + name; + } + }, + CHILD: function(elem, match){ + var type = match[1], node = elem; + switch (type) { + case 'only': + case 'first': + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + if ( type === "first" ) { + return true; + } + node = elem; + case 'last': + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + return true; + case 'nth': + var first = match[2], last = match[3]; + + if ( first === 1 && last === 0 ) { + return true; + } + + var doneName = match[0], + parent = elem.parentNode; + + if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { + var count = 0; + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + parent.sizcache = doneName; + } + + var diff = elem.nodeIndex - last; + if ( first === 0 ) { + return diff === 0; + } else { + return ( diff % first === 0 && diff / first >= 0 ); + } + } + }, + ID: function(elem, match){ + return elem.nodeType === 1 && elem.getAttribute("id") === match; + }, + TAG: function(elem, match){ + return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; + }, + CLASS: function(elem, match){ + return (" " + (elem.className || elem.getAttribute("class")) + " ") + .indexOf( match ) > -1; + }, + ATTR: function(elem, match){ + var name = match[1], + result = Expr.attrHandle[ name ] ? + Expr.attrHandle[ name ]( elem ) : + elem[ name ] != null ? + elem[ name ] : + elem.getAttribute( name ), + value = result + "", + type = match[2], + check = match[4]; + + return result == null ? + type === "!=" : + type === "=" ? + value === check : + type === "*=" ? + value.indexOf(check) >= 0 : + type === "~=" ? + (" " + value + " ").indexOf(check) >= 0 : + !check ? + value && result !== false : + type === "!=" ? + value !== check : + type === "^=" ? + value.indexOf(check) === 0 : + type === "$=" ? + value.substr(value.length - check.length) === check : + type === "|=" ? + value === check || value.substr(0, check.length + 1) === check + "-" : + false; + }, + POS: function(elem, match, i, array){ + var name = match[2], filter = Expr.setFilters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } + } + } +}; + +var origPOS = Expr.match.POS; + +for ( var type in Expr.match ) { + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){ + return "\\" + (num - 0 + 1); + })); +} + +var makeArray = function(array, results) { + array = Array.prototype.slice.call( array, 0 ); + + if ( results ) { + results.push.apply( results, array ); + return results; + } + + return array; +}; + +// Perform a simple check to determine if the browser is capable of +// converting a NodeList to an array using builtin methods. +try { + Array.prototype.slice.call( document.documentElement.childNodes, 0 ); + +// Provide a fallback method if it does not work +} catch(e){ + makeArray = function(array, results) { + var ret = results || []; + + if ( toString.call(array) === "[object Array]" ) { + Array.prototype.push.apply( ret, array ); + } else { + if ( typeof array.length === "number" ) { + for ( var i = 0, l = array.length; i < l; i++ ) { + ret.push( array[i] ); + } + } else { + for ( var i = 0; array[i]; i++ ) { + ret.push( array[i] ); + } + } + } + + return ret; + }; +} + +var sortOrder; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + if ( a == b ) { + hasDuplicate = true; + } + return a.compareDocumentPosition ? -1 : 1; + } + + var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} else if ( "sourceIndex" in document.documentElement ) { + sortOrder = function( a, b ) { + if ( !a.sourceIndex || !b.sourceIndex ) { + if ( a == b ) { + hasDuplicate = true; + } + return a.sourceIndex ? -1 : 1; + } + + var ret = a.sourceIndex - b.sourceIndex; + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} else if ( document.createRange ) { + sortOrder = function( a, b ) { + if ( !a.ownerDocument || !b.ownerDocument ) { + if ( a == b ) { + hasDuplicate = true; + } + return a.ownerDocument ? -1 : 1; + } + + var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); + aRange.setStart(a, 0); + aRange.setEnd(a, 0); + bRange.setStart(b, 0); + bRange.setEnd(b, 0); + var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} + +// Utility function for retreiving the text value of an array of DOM nodes +function getText( elems ) { + var ret = "", elem; + + for ( var i = 0; elems[i]; i++ ) { + elem = elems[i]; + + // Get the text from text nodes and CDATA nodes + if ( elem.nodeType === 3 || elem.nodeType === 4 ) { + ret += elem.nodeValue; + + // Traverse everything else, except comment nodes + } else if ( elem.nodeType !== 8 ) { + ret += getText( elem.childNodes ); + } + } + + return ret; +} + +// Check to see if the browser returns elements by name when +// querying by getElementById (and provide a workaround) +(function(){ + // We're going to inject a fake input element with a specified name + var form = document.createElement("div"), + id = "script" + (new Date).getTime(); + form.innerHTML = ""; + + // Inject it into the root element, check its status, and remove it quickly + var root = document.documentElement; + root.insertBefore( form, root.firstChild ); + + // The workaround has to do additional checks after a getElementById + // Which slows things down for other browsers (hence the branching) + if ( document.getElementById( id ) ) { + Expr.find.ID = function(match, context, isXML){ + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; + } + }; + + Expr.filter.ID = function(elem, match){ + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + return elem.nodeType === 1 && node && node.nodeValue === match; + }; + } + + root.removeChild( form ); + root = form = null; // release memory in IE +})(); + +(function(){ + // Check to see if the browser returns only elements + // when doing getElementsByTagName("*") + + // Create a fake element + var div = document.createElement("div"); + div.appendChild( document.createComment("") ); + + // Make sure no comments are found + if ( div.getElementsByTagName("*").length > 0 ) { + Expr.find.TAG = function(match, context){ + var results = context.getElementsByTagName(match[1]); + + // Filter out possible comments + if ( match[1] === "*" ) { + var tmp = []; + + for ( var i = 0; results[i]; i++ ) { + if ( results[i].nodeType === 1 ) { + tmp.push( results[i] ); + } + } + + results = tmp; + } + + return results; + }; + } + + // Check to see if an attribute returns normalized href attributes + div.innerHTML = ""; + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && + div.firstChild.getAttribute("href") !== "#" ) { + Expr.attrHandle.href = function(elem){ + return elem.getAttribute("href", 2); + }; + } + + div = null; // release memory in IE +})(); + +if ( document.querySelectorAll ) { + (function(){ + var oldSizzle = Sizzle, div = document.createElement("div"); + div.innerHTML = "

    "; + + // Safari can't handle uppercase or unicode characters when + // in quirks mode. + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { + return; + } + + Sizzle = function(query, context, extra, seed){ + context = context || document; + + // Only use querySelectorAll on non-XML documents + // (ID selectors don't work in non-HTML documents) + if ( !seed && context.nodeType === 9 && !isXML(context) ) { + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(e){} + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } + + div = null; // release memory in IE + })(); +} + +(function(){ + var div = document.createElement("div"); + + div.innerHTML = "
    "; + + // Opera can't find a second classname (in 9.6) + // Also, make sure that getElementsByClassName actually exists + if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { + return; + } + + // Safari caches class attributes, doesn't catch changes (in 3.2) + div.lastChild.className = "e"; + + if ( div.getElementsByClassName("e").length === 1 ) { + return; + } + + Expr.order.splice(1, 0, "CLASS"); + Expr.find.CLASS = function(match, context, isXML) { + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { + return context.getElementsByClassName(match[1]); + } + }; + + div = null; // release memory in IE +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + elem = elem[dir]; + var match = false; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem.sizcache = doneName; + elem.sizset = i; + } + + if ( elem.nodeName.toLowerCase() === cur ) { + match = elem; + break; + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + elem = elem[dir]; + var match = false; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem.sizcache = doneName; + elem.sizset = i; + } + if ( typeof cur !== "string" ) { + if ( elem === cur ) { + match = true; + break; + } + + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { + match = elem; + break; + } + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +var contains = document.compareDocumentPosition ? function(a, b){ + return a.compareDocumentPosition(b) & 16; +} : function(a, b){ + return a !== b && (a.contains ? a.contains(b) : true); +}; + +var isXML = function(elem){ + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +var posProcess = function(selector, context){ + var tmpSet = [], later = "", match, + root = context.nodeType ? [context] : context; + + // Position selectors must be done after the filter + // And so must :not(positional) so we move all PSEUDOs to the end + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { + later += match[0]; + selector = selector.replace( Expr.match.PSEUDO, "" ); + } + + selector = Expr.relative[selector] ? selector + "*" : selector; + + for ( var i = 0, l = root.length; i < l; i++ ) { + Sizzle( selector, root[i], tmpSet ); + } + + return Sizzle.filter( later, tmpSet ); +}; + +// EXPOSE +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.filters; +jQuery.unique = Sizzle.uniqueSort; +jQuery.getText = getText; +jQuery.isXMLDoc = isXML; +jQuery.contains = contains; + +return; + +window.Sizzle = Sizzle; + +})(); +var runtil = /Until$/, + rparentsprev = /^(?:parents|prevUntil|prevAll)/, + // Note: This RegExp should be improved, or likely pulled from Sizzle + rmultiselector = /,/, + slice = Array.prototype.slice; + +// Implement the identical functionality for filter and not +var winnow = function( elements, qualifier, keep ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + return !!qualifier.call( elem, i, elem ) === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return (elem === qualifier) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, elements ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return (jQuery.inArray( elem, qualifier ) >= 0) === keep; + }); +}; + +jQuery.fn.extend({ + find: function( selector ) { + var ret = this.pushStack( "", "find", selector ), length = 0; + + for ( var i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); + + if ( i > 0 ) { + // Make sure that the results are unique + for ( var n = length; n < ret.length; n++ ) { + for ( var r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } + + return ret; + }, + + has: function( target ) { + var targets = jQuery( target ); + return this.filter(function() { + for ( var i = 0, l = targets.length; i < l; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, + + is: function( selector ) { + return !!selector && jQuery.filter( selector, this ).length > 0; + }, + + closest: function( selectors, context ) { + if ( jQuery.isArray( selectors ) ) { + var ret = [], cur = this[0], match, matches = {}, selector; + + if ( cur && selectors.length ) { + for ( var i = 0, l = selectors.length; i < l; i++ ) { + selector = selectors[i]; + + if ( !matches[selector] ) { + matches[selector] = jQuery.expr.match.POS.test( selector ) ? + jQuery( selector, context || this.context ) : + selector; + } + } + + while ( cur && cur.ownerDocument && cur !== context ) { + for ( selector in matches ) { + match = matches[selector]; + + if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { + ret.push({ selector: selector, elem: cur }); + delete matches[selector]; + } + } + cur = cur.parentNode; + } + } + + return ret; + } + + var pos = jQuery.expr.match.POS.test( selectors ) ? + jQuery( selectors, context || this.context ) : null; + + return this.map(function( i, cur ) { + while ( cur && cur.ownerDocument && cur !== context ) { + if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) { + return cur; + } + cur = cur.parentNode; + } + return null; + }); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + if ( !elem || typeof elem === "string" ) { + return jQuery.inArray( this[0], + // If it receives a string, the selector is used + // If it receives nothing, the siblings are used + elem ? jQuery( elem ) : this.parent().children() ); + } + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context || this.context ) : + jQuery.makeArray( selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, + + andSelf: function() { + return this.add( this.prevObject ); + } +}); + +// A painfully simple check to see if an element is disconnected +// from a document (should be improved, where feasible). +function isDisconnected( node ) { + return !node || !node.parentNode || node.parentNode.nodeType === 11; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return jQuery.nth( elem, 2, "nextSibling" ); + }, + prev: function( elem ) { + return jQuery.nth( elem, 2, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( elem.parentNode.firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.makeArray( elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 ? jQuery.unique( ret ) : ret; + + if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret, name, slice.call(arguments).join(",") ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], cur = elem[dir]; + while ( cur && cur.nodeType !== 9 && (until === undefined || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + nth: function( cur, result, dir, elem ) { + result = result || 1; + var num = 0; + + for ( ; cur; cur = cur[dir] ) { + if ( cur.nodeType === 1 && ++num === result ) { + break; + } + } + + return cur; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); +var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, + rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, + rtagName = /<([\w:]+)/, + rtbody = /"; + }, + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
    ", "
    " ], + thead: [ 1, "", "
    " ], + tr: [ 2, "", "
    " ], + td: [ 3, "", "
    " ], + col: [ 2, "", "
    " ], + area: [ 1, "", "" ], + _default: [ 0, "", "" ] + }; + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// IE can't serialize and + + + + + +{else} + + {if condition="$custom != 0"} + {$ext}, : {$model} + {/if} + {if condition="$custom == 0"} + "{$template_name}" : {$model} + {/if} +
    +
    + {if condition="$alt != 0"} +
    +
    + + {$alt_configs} +
    + {/if} +
    + :
    {noparse} + -"{$srvip}" =
    + -"{$mac}" =
    + -"{$ext}" =
    + -"{$diplayname}" =
    {/noparse} +
    +{/if} + +
    +
    + {loop name="template_editor"} +
    +
    +

    {$value.title}

    + + {loop name="value.data"} + + + + {if condition="$value.type == 'break'"} + + + + + {/if} + {/loop} +
    + {if condition="$value.type == 'input'"} + + {elseif condition="$value.type == 'radio'"} + {$value.description} + {loop name="value.data"} + + {/loop} + {elseif condition="$value.type == 'list'"} + {$value.description} + {/if} + + {if condition="isset($value.aried)"} + + {/if} +
      
    +
    +
    + {/loop} +
    +
    + + +{if condition="!isset($in_ari)"} + +
    +{/if} \ No newline at end of file diff --git a/templates/template_manager.html b/templates/template_manager.html new file mode 100644 index 00000000..756ad677 --- /dev/null +++ b/templates/template_manager.html @@ -0,0 +1,43 @@ +{include="global_header"} +{include="global_links"} +

    {$message}

    +{if condition="$no_add == FALSE"} +
    +

    :

    + : + + : + + +
    + + + + + + + +{loop name="templates_list"} + + + + + + +{/loop} +

    {$value.name}{$value.model_class}<?=_(' border='0'>{if condition="$value.custom == 0"} + <?=_(' border='0'>{/if}
    +
    +{/if} +{include="global_footer"} \ No newline at end of file diff --git a/uninstall.php b/uninstall.php new file mode 100644 index 00000000..679f6fec --- /dev/null +++ b/uninstall.php @@ -0,0 +1,77 @@ +"; + } +} + +if (! function_exists("outn")) { + function outn($text) { + echo $text; + } +} + +out("Removing Phone Modules Directory"); +$endpoint->deltree(PHONE_MODULES_PATH); +exec("rm -R ". PHONE_MODULES_PATH); + +out("Dropping all relevant tables"); +$sql = "DROP TABLE `endpointman_brand_list`"; +$result = $db->query($sql); + +$sql = "DROP TABLE `endpointman_global_vars`"; +$result = $db->query($sql); + +$sql = "DROP TABLE `endpointman_mac_list`"; +$result = $db->query($sql); + +$sql = "DROP TABLE `endpointman_model_list`"; +$result = $db->query($sql); + +$sql = "DROP TABLE `endpointman_oui_list`"; +$result = $db->query($sql); + +$sql = "DROP TABLE `endpointman_product_list`"; +$result = $db->query($sql); + +$sql = "DROP TABLE `endpointman_template_list`"; +$result = $db->query($sql); + +$sql = "DROP TABLE `endpointman_time_zones`"; +$result = $db->query($sql); + +$sql = "DROP TABLE `endpointman_custom_configs`"; +$result = $db->query($sql); + +out("Removing ARI Module"); +unlink($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); + +?> \ No newline at end of file From caea5fdb4d7ab0b77cbd63137da1ec50fb74529b Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 24 Jun 2010 08:03:22 +0000 Subject: [PATCH 002/623] Module Publish Script: endpointman 1.9.9 --- module.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module.xml b/module.xml index 20394fbf..cae9ebb4 100644 --- a/module.xml +++ b/module.xml @@ -16,6 +16,7 @@ *1.0.0* Initial release (5.26.2009). http://projects.colsolgrp.net/projects/show/endpointman - projects.colsolgrp.net/projects/list_files/endpointman + contributed_modules/release/endpointman-1.9.9.tgz + From 3262fb80ac0f837ab4db86f9f67b9a38c347dfcc Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 24 Jun 2010 08:08:11 +0000 Subject: [PATCH 003/623] Module Publish Script: endpointman 1.9.9 --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index cae9ebb4..87002e2b 100644 --- a/module.xml +++ b/module.xml @@ -18,5 +18,5 @@ http://projects.colsolgrp.net/projects/show/endpointman contributed_modules/release/endpointman-1.9.9.tgz - +8d8d7ff939a49ecc4d7ed7ca25ecae06 From 186f913af953375a433e81d70c304d3c67a1ff7f Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 24 Jun 2010 08:25:45 +0000 Subject: [PATCH 004/623] Auto Check-in of any outstanding patches --- install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.php b/install.php index ded10dc3..9f2546d6 100644 --- a/install.php +++ b/install.php @@ -776,7 +776,7 @@ function outn($text) { $db->query($sql); out("Add Automatic Update Check [Can be Disabled]"); -$sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php ".LOCAL_PATH "includes/update_check.php')"; +$sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php ".LOCAL_PATH. "includes/update_check.php')"; $db->query($sql); $arp = $endpoint->find_exec("arp"); From f3f9606498c27a4eceb8e21c08accb528f1d2503 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 24 Jun 2010 08:25:49 +0000 Subject: [PATCH 005/623] Module Publish Script: endpointman 1.9.9 --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index 87002e2b..3bbe84a0 100644 --- a/module.xml +++ b/module.xml @@ -18,5 +18,5 @@ http://projects.colsolgrp.net/projects/show/endpointman contributed_modules/release/endpointman-1.9.9.tgz -8d8d7ff939a49ecc4d7ed7ca25ecae06 +aa4111bfbb609e453287e9ba454ab069 From 2788ad9c7ea4df822ab89dca4bf2057bd9bd41f3 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 24 Jun 2010 08:28:03 +0000 Subject: [PATCH 006/623] Module Publish Script: endpointman 1.9.9 --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index 3bbe84a0..f4b750c9 100644 --- a/module.xml +++ b/module.xml @@ -18,5 +18,5 @@ http://projects.colsolgrp.net/projects/show/endpointman contributed_modules/release/endpointman-1.9.9.tgz -aa4111bfbb609e453287e9ba454ab069 +c202f25d0979f47204c97058b4a9cd56 From 4c5b1a35162f1141eca1880eb6f1d813a14a4c22 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 24 Jun 2010 08:31:04 +0000 Subject: [PATCH 007/623] Module Publish Script: endpointman 1.9.9 --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index f4b750c9..31d4d4ad 100644 --- a/module.xml +++ b/module.xml @@ -18,5 +18,5 @@ http://projects.colsolgrp.net/projects/show/endpointman contributed_modules/release/endpointman-1.9.9.tgz -c202f25d0979f47204c97058b4a9cd56 +b99f3ddc7e9e51692d7a0208401a2ad7 From 752af05256d3d14034100de1c0b1b04f7071c90d Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Sun, 27 Jun 2010 03:46:49 +0000 Subject: [PATCH 008/623] Language and Security Issue Fixed --- i18n/fr_FR/LC_MESSAGES/endpointman.mo | Bin 8565 -> 9550 bytes i18n/fr_FR/LC_MESSAGES/endpointman.po | 23 +++++++++++++---------- includes/functions.inc | 16 +++++++++++++--- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/i18n/fr_FR/LC_MESSAGES/endpointman.mo b/i18n/fr_FR/LC_MESSAGES/endpointman.mo index 18caa271d1fd95ef4ac4171439719760949c081f..ec6b19d0c662cd100f23b6e7141fcb4d5f9da107 100644 GIT binary patch delta 3391 zcmZA1e{9@!9mny{y3TH`?iX9>Hmsixx@)_3zuJ{erdzv~QCL}NyD>JWyI#L-zi@Zo z^ZTQ>V)TrT#32FnLI9P-0SoJliFo{BOjyE>_#-2TK@3?82BKyWH7X&Rpo`Df-IuZW z&AspO{eJIzpYQwq{(QdQ_xoSHz3|q`+Q$sr3E~FgcMFYq2ESLw7h7AsF>A0L`N`}> zK4u?Z%W)L1!xXN-JTAghxE3El{r_D2`^)k9-{KNu3g#c|v~s}*_%Up0Fs2dPVt3li14r%?s=(<4dT@ z-a)nWJzR-(OO2r@vli9b4X7J+A|KPo*D@SIP2q9WIA2En|6#ldPvdd?8EU))e=4}_ zbhEP+pThO{E4&{6iA`9~Xd`$dYM>Aq!#s&<7f@63DlW!1Q3Jn?D&SAJ5wFC* zchC+c+Ksy3z)JeRm7P&esC6e%1D-}c<_Gcdc~qjmK(+ogRAPTbRrVKDV*f!6+`#-P zp*6_8&3e@TdvG1@ialIlN0o%wjSu7FcmX%#5$>kSA4J{gc~pWgp(?!?`xU<+U@pt4}(?tJNVHYZa9_+-UsHfx`Xz?s6 zpT;%~4W8yI8ZjL5|PiPTbBjsKh)Z2lI67c^u~W5^5^i7_^`kjWirxwc7WgDmsLEtR_$e1gP_;P=!2(dMaMQ9=wFQZdnWSuSM0` zQoUdl^~d9=7Nt=Mg{X?2h|ga{wf1#XB9~E*@xPGSGwm#OogYA!gBe35kU@?6C1ib? zudgo{!)x7qmlOKqSxjIV>9Tnj^~c3zp@AAv18hN>Vs@a#!$|kd9PYu#@yGZkssrC- zL1{5wKo$4_>b`XaR@6dvR-qPK6RyN&REArz7Kd;FZX~o>;`77^q0J?n%3gI~C37p0 zCnn?b6R}zo2jhL}ueK^aHg~eKfgo{nFL67eO4Sur-cM*dL}(5*4K%4zm0nn%CAJVA zv6s+x2Qfovs`Z3u+f(^w{`F|-jdkrd79Sjr)fDU_?v9Ve7l~nF7m+6R69SzB0z&R6QMzPWU+G5$ewmL#<5wH+h0a_e=#)<=AX(4uT7K1c9WnY)Nt zLT|ioViDmJ8RGvp-hO)jRUfq$)O;T&x(LnrIH6U2?WRR|3!&#++Yw@WWv}|BMK&ED z55(s19%7V85jBLi+lWJhd}*am5l0DatTnTn7$R;a^kg&s_xvEyUVOj)WNUWP9t?DHvU)$; zHa_Ef(e#Y%8y&L4-ei<^+DrL{7i&6FzLN|cdo|Tg>&!Y?>rUA@FS2It?~c zK1cn5YiGTP#p7HZkSue_ptN~i$HHw&-Ak9}JIN_Ze>5LX5Pmoz<#|hSk&{k48D^z; zxVfwL!wI?DCT)2>z$+#$|z_0k8IX(M*f3N3x&N;v5_Wi*J z^}koUUwh+@8%iH>BXKC!7)Iht@k3(32r*IKoL4EIMjKe=rbN(AOAx~0d z0*lZ`y9l$f8TpFYhnb9TMyW6va}qV+OQ;E*L#<#MHQ+V$;4ErDPjY0X@u-1wZQF-h zVJ&Kcdr{9FMD5rpdT|Vs7~h5pt32s6z(_?)EHSt5J z9XX0x@fb3;dCq?R3g*xbp?2z1T!vqzu>Tr3meI7;Uer+(Vgjy4J-8CJf?C_Z3%N{y zn+6&|{qBJEFlr*tqIPrwHSnv**k%ef?xh9nzaH=<9U5>3wFAGR9uP<4228f*qb6F5 ztFRTv@F*5z0SBvvi*cg z&SX+nNmhy)umbb&R@6i~Q4buzb@&2mh2J2Tnc=3L@^EgNKsxGoMHsL5e=QZAakc$I zE3z487`1{YZT|(#rhNtd_!su#a<)ZBcpRU=Nz{Z&c&MJc$Liu{+T*CLpFywQ|5RRX z%`_ji@+w@50j$CaB)`m6)Y1Hg%HD*VA}dKp^3^OsO}xzZ*P|BDgi7+Kunfmh-h#KG+>UYm0r)N$hf3wU5WK+zCsARr| ztigD**?;}8n0;k8&3e=Wb|9B&z zb*LPwL@(B%CfJ(ChR7QAcbgw53X<`-yuAhfq;c=@_-u zD$T@w;To?i-c9t{_R5HE_!ZGvsOV3mN&~TrNF#KfMMMd42eFAzGHoWJrIU)Es3dN& zol0yaX}xW?V;-@NP%f#I>iyqHMgJ!6B>ISQLS;kv9=Ywc^<~x-xQD1F^r|YGR}n2l zG2tWrFIAnLhHz?zhaT$h4Oh1W9(J||dIx%fZHdQ%|0cEt2a}!&Rwj>zW|H6Vgg#5j z_XG>PzWDCmfYZ|77n<^(_r#U?OG-nJrp}28O{Oi434WaZbntM-TfrlXUkvqSPREA! fWjV3I_i_s7ZyX*9bPPLP{evCdgMm;_?p4o!*dytb diff --git a/i18n/fr_FR/LC_MESSAGES/endpointman.po b/i18n/fr_FR/LC_MESSAGES/endpointman.po index 7ec9f135..830807c4 100644 --- a/i18n/fr_FR/LC_MESSAGES/endpointman.po +++ b/i18n/fr_FR/LC_MESSAGES/endpointman.po @@ -21,7 +21,7 @@ msgstr "" "Project-Id-Version: EndPointManager\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-02-27 17:34+0100\n" -"PO-Revision-Date: 2010-04-01 21:40+0100\n" +"PO-Revision-Date: 2010-06-26 21:40+0100\n" "Last-Translator: jouniaux \n" "Language-Team: Français \n" "MIME-Version: 1.0\n" @@ -362,28 +362,31 @@ msgstr "Vous n'avez aucun produit (Modules) installé, cliquez" #more new new new! msgid "Turn Off Safe Mode" -msgstr "" +msgstr "Arrêt du mode sécurisé" msgid "/tftpboot is not writable" -msgstr "" +msgstr "Impossible d'écrire sur /tftpboot" msgid "Please create /tftpboot, even if you won't use it" -msgstr "" +msgstr "Veuillez créer /tftpboot même si vous ne l'utilisez pas" msgid "Sorry, Only Asterisk is supported currently" -msgstr "" +msgstr "Désolé, seul Asterisk est supporté actuellement" msgid "End User Editable (Through ARI Module)" -msgstr "" +msgstr "Modifiable par l'utilisateur(En utilisant le module ARI)" msgid "Disable .htaccess (Might fix 'Internal Server Errors')" -msgstr "" +msgstr "Désactivez .htaccess (Peut corriger 'Erreurs du serveur interne')" msgid "The Endpoint Configuration Manager was written by" -msgstr "" +msgstr "Endpoint Configuration Manager a été écrit par" msgid "The project is maintained at" -msgstr "" +msgstr "Le projet est maintenu par" msgid "Debug Log" -msgstr "" \ No newline at end of file +msgstr "Log Debug" + +msgid "Delete selected phone" +msgstr "Suppression des téléphones sélectionnés" diff --git a/includes/functions.inc b/includes/functions.inc index 783f0972..99547012 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1251,19 +1251,29 @@ class endpointmanager { return(FALSE); } } + + function validate_netmask($mask) { + if (preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/", $mask)) { + return(TRUE); + } else { + return(FALSE); + } + } //Discover New Device/Hardware function discover_new($netmask, $use_nmap=TRUE) { - global $global_cfg, $debug; + global $global_cfg, $debug, $error; //Written by tm1000 //Version 1.0 //nmap will actually discover 'unseen' devices that the VoIP server hasn't heard from //If the user just wishes to use the local arp cache they can tell the function to not use nmap //This results in a speed increase from 60 seconds to less than one second. - if ($use_nmap) { + if (($use_nmap) AND ($this->validate_netmask($netmask))) { shell_exec($global_cfg['nmap_location'].' -v -sP '. $netmask); - } + } elseif(!$this->validate_netmask($netmask)) { + return(FALSE); + } //Get arp list $arp_list = shell_exec($global_cfg['arp_location'] . " -an"); //$arp_list = shell_exec("arp -an"); From 85688ebd8edbcecd0663ab1467cc9dcba86f589f Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Mon, 5 Jul 2010 08:22:34 +0000 Subject: [PATCH 009/623] A bunch of fixes to bring endpoint manager up to 2.0. Now the move to FreePBX and new phone modules code can begin --- includes/advanced.inc | 6 +-- includes/brand_model_manager.inc | 2 +- includes/devices_manager.inc | 1 + includes/functions.inc | 17 +++++-- install.php | 77 +++++++++++++------------------- module.xml | 4 +- page.endpointman.php | 28 ------------ templates/devices_manager.html | 4 +- templates/global_header.html | 12 ++--- templates/template_editor.html | 6 +-- templates/template_manager.html | 4 +- 11 files changed, 66 insertions(+), 95 deletions(-) diff --git a/includes/advanced.inc b/includes/advanced.inc index 7ee940e8..b9af3875 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -44,7 +44,7 @@ switch($_REQUEST['subpage']) { $wfh=fopen($outfile,'w'); fwrite($wfh, $temp_amp); fclose($wfh); - $tpl->assign("exporter_address", $_SERVER["HTTP_HOST"]."/admin/modules/endpointman/includes/export.php"); + $tpl->assign("exporter_address", $_SERVER["HTTP_HOST"].WEB_PATH."includes/export.php"); //Dave B's Q&D file upload security code (http://us2.php.net/manual/en/features.file-upload.php) if((isset($_REQUEST['action'])) AND (isset($_REQUEST['button_import'])) AND ($_REQUEST['action'] == "import")) { $allowedExtensions = array("csv","txt"); @@ -319,7 +319,7 @@ switch($_REQUEST['subpage']) { if((isset($_POST['disable_htaccess'])) AND ($_POST['disable_htaccess'] == "on")) { $htaccess = "allow from all"; - $outfile = $amp_conf['AMPWEBROOT']."/admin/modules/endpointman/.htaccess"; + $outfile = $amp_conf['AMPWEBROOT'].WEB_PATH.".htaccess"; $wfh=fopen($outfile,'w'); fwrite($wfh,$htaccess); fclose($wfh); @@ -346,7 +346,7 @@ AuthMySQLUserCondition\t\"username = 'admin'\" "; - $outfile = $amp_conf['AMPWEBROOT']."/admin/modules/endpointman/.htaccess"; + $outfile = $amp_conf['AMPWEBROOT'].WEB_PATH.".htaccess"; $wfh=fopen($outfile,'w'); fwrite($wfh,$htaccess); fclose($wfh); diff --git a/includes/brand_model_manager.inc b/includes/brand_model_manager.inc index 0c27fa8b..43da0c98 100644 --- a/includes/brand_model_manager.inc +++ b/includes/brand_model_manager.inc @@ -149,7 +149,7 @@ if (isset($installer)) { $wfh=fopen($outfile,'w'); fwrite($wfh, $temp_amp); fclose($wfh); - $tpl->assign("installer_address", $_SERVER["HTTP_HOST"]."/admin/modules/endpointman/includes/installer.php"); + $tpl->assign("installer_address", $_SERVER["HTTP_HOST"].WEB_PATH."includes/installer.php"); } global $debug, $global_cfg; diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc index 19779546..b725ff5a 100644 --- a/includes/devices_manager.inc +++ b/includes/devices_manager.inc @@ -350,6 +350,7 @@ if (isset($template_editor)) { if($ma = $endpoint->modelsAvailable()) { $tpl->assign("models_ava", $ma); } + $tpl->assign("web_path", WEB_PATH); $tpl->assign("product_list", $product_list); $tpl->assign("display_ext", $endpoint->displayExtension()); $tpl->assign("brand_ava", $endpoint->brandAvailable()); diff --git a/includes/functions.inc b/includes/functions.inc index 99547012..26bfaa01 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -61,17 +61,28 @@ class endpointmanager { //attached to the end of every link so we can flow through FreePBX define("WEB_VARS", "?type=tool&display=endpointman"); //This is really hacky but I have to do it when people have different directories instead of admin - if(!array_key_exists('PHONE_MODULES_PATH',$amp_conf)) { + if((!array_key_exists('PHONE_MODULES_PATH',$amp_conf)) AND (dirname($_SERVER['SCRIPT_NAME']) != "/recordings")) { //Define the location of phone modules, keeping it outside of the module directory so that when the user updates endpointmanager they don't lose all of their phones define("PHONE_MODULES_PATH", dirname($_SERVER["SCRIPT_FILENAME"])."/modules/_ep_phone_modules/"); //Get local path information - define("LOCAL_PATH", dirname($_SERVER["SCRIPT_FILENAME"])."/modules/endpointman/"); - + define("WEB_PATH", dirname($_SERVER['SCRIPT_NAME'])."/modules/endpointman/"); + define("LOCAL_PATH", dirname($_SERVER["SCRIPT_FILENAME"])."/modules/endpointman/"); + //have to hack around freepbx.... $amp_conf['PHONE_MODULES_PATH'] = PHONE_MODULES_PATH; $amp_conf['LOCAL_ENDPOINT_PATH'] = LOCAL_PATH; + } elseif(dirname($_SERVER['SCRIPT_NAME']) == "/recordings") { + //Define the location of phone modules, keeping it outside of the module directory so that when the user updates endpointmanager they don't lose all of their phones + define("PHONE_MODULES_PATH", $amp_conf['AMPWEBROOT']."/admin/modules/_ep_phone_modules/"); + + //Get local path information + define("WEB_PATH", "/admin/modules/endpointman/"); + define("LOCAL_PATH", $amp_conf['AMPWEBROOT']."/admin/modules/endpointman/"); + //have to hack around freepbx.... + $amp_conf['PHONE_MODULES_PATH'] = PHONE_MODULES_PATH; + $amp_conf['LOCAL_ENDPOINT_PATH'] = LOCAL_PATH; } else { define("PHONE_MODULES_PATH", $amp_conf['PHONE_MODULES_PATH']); define("LOCAL_PATH", $amp_conf['LOCAL_ENDPOINT_PATH']); diff --git a/install.php b/install.php index 9f2546d6..b0b18330 100644 --- a/install.php +++ b/install.php @@ -108,7 +108,7 @@ function outn($text) { $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (5, 'config_location', '/tftpboot/'), (6, 'update_server', 'http://www.the159.com/endpoint/'), - (7, 'version', '1.9.9'), + (7, 'version', '2.0.0'), (8, 'enable_ari', '0'), (9, 'debug', '0'), (10, 'arp_location', '".$arp."'), @@ -117,7 +117,7 @@ function outn($text) { $db->query($sql_update_vars); define("UPDATE_PATH", 'http://www.the159.com/endpoint/'); - define("VER", '1.9.9'); + define("VER", '2.0.0'); out("Updating Mac List table"); $sql = 'ALTER TABLE `endpointman_mac_list` DROP `map`'; @@ -319,7 +319,7 @@ function outn($text) { $sql = 'ALTER TABLE `endpointman_template_list` ADD `config_files_override` TEXT NULL AFTER `custom_cfg_data`'; out("Updating Version Number"); - $sql = "UPDATE endpointman_global_vars SET value = '1.9.9' WHERE var_name = 'version'"; + $sql = "UPDATE endpointman_global_vars SET value = '2.0.0' WHERE var_name = 'version'"; out("Creating Custom Configs Table"); $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( @@ -384,7 +384,7 @@ function outn($text) { $db->query($sql); out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; $db->query($sql); out('Alter custom_cfg_data'); @@ -415,40 +415,45 @@ function outn($text) { $db->query($sql); out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; $db->query($sql); } elseif($ver == "1.9.3") { out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; $db->query($sql); } elseif($ver == "1.9.4") { out("Your Database is already up to date!"); out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; $db->query($sql); } elseif($ver == "1.9.5") { out("Your Database is already up to date!"); out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; $db->query($sql); } elseif($ver == "1.9.6") { out("Your Database is already up to date!"); out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; $db->query($sql); } elseif($ver == "1.9.7") { out("Your Database is already up to date!"); out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; $db->query($sql); } elseif($ver == "1.9.8") { out("Your Database is already up to date!"); out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; + $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; $db->query($sql); } elseif($ver == "1.9.9") { out("Your Database is already up to date!"); + out("Update Version Number"); + $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; + $db->query($sql); +} elseif($ver == "2.0.0") { + out("Your Database is already up to date!"); } else { out("Creating Brand List Table"); $sql = "CREATE TABLE IF NOT EXISTS `endpointman_brand_list` ( @@ -484,7 +489,7 @@ function outn($text) { (4, 'gmthr', ''), (5, 'config_location', '/tftpboot/'), (6, 'update_server', 'http://www.the159.com/endpoint/'), - (7, 'version', '1.9.9'), + (7, 'version', '2.0.0'), (8, 'enable_ari', '0'), (9, 'debug', '0'), (10, 'arp_location', '".$arp."'), @@ -703,38 +708,20 @@ function outn($text) { $db->query($sql); } -out("Fixing .htaccess issues (#288)"); -$htaccess = "allow from all -AuthName FreePBX-Admin-only -Require valid-user -AuthType Basic -AuthMySQLEnable\tOn -AuthMySQLHost\tlocalhost -AuthMySQLDB\tasterisk -AuthMySQLUserTable\tampusers -AuthMySQLUser\t".$amp_conf['AMPDBUSER']." -AuthMySQLPassword\t".$amp_conf['AMPDBPASS']." -AuthMySQLNameField\tusername -AuthMySQLPasswordField\tpassword -AuthMySQLAuthoritative\tOn -AuthMySQLPwEncryption\tnone -AuthMySQLUserCondition\t\"username = 'admin'\" - - - deny from all - -"; - -$outfile =LOCAL_PATH. ".htaccess"; -$wfh=fopen($outfile,'w'); -fwrite($wfh,$htaccess); -fclose($wfh); - -out("Installing ARI Module"); -rename(LOCAL_PATH. "Install/phonesettings.module", $amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); - -out("Fixing permissions on ARI module"); -chmod($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module", 0664); +if(file_exists($amp_conf['AMPWEBROOT']."/recordings")) { + out("Installing ARI Module"); + copy(LOCAL_PATH. "Install/phonesettings.module", $amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); + + copy(LOCAL_PATH. "templates/javascript/jquery.coda-slider-2.0.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js"); + + copy(LOCAL_PATH. "templates/javascript/jquery.easing.1.3.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js"); + + copy(LOCAL_PATH. "templates/stylesheets/coda-slider-2.0a.css", $amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css"); + + + out("Fixing permissions on ARI module"); + chmod($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module", 0664); +} out("Adding Custom Field to OUI List"); $sql = 'ALTER TABLE `endpointman_oui_list` ADD `custom` INT(1) NOT NULL DEFAULT \'0\''; @@ -786,7 +773,7 @@ function outn($text) { $db->query($sql); out("Update Version Number [Yes again, just in case]"); -$sql = 'UPDATE endpointman_global_vars SET value = \'1.9.9\' WHERE var_name = "version"'; +$sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; $db->query($sql); ?> \ No newline at end of file diff --git a/module.xml b/module.xml index 31d4d4ad..0cb32f51 100644 --- a/module.xml +++ b/module.xml @@ -1,7 +1,7 @@ endpointman PBX End Point Manager - 1.9.9 + 2.0.0 tool System Administration @@ -18,5 +18,5 @@ http://projects.colsolgrp.net/projects/show/endpointman contributed_modules/release/endpointman-1.9.9.tgz -b99f3ddc7e9e51692d7a0208401a2ad7 +c202f25d0979f47204c97058b4a9cd56 diff --git a/page.endpointman.php b/page.endpointman.php index 0bf88430..c8ed63ac 100644 --- a/page.endpointman.php +++ b/page.endpointman.php @@ -51,34 +51,6 @@ chmod(PHONE_MODULES_PATH, 0764); } -if(!file_exists(LOCAL_PATH.".htaccess")) { -$htaccess = "allow from all -AuthName FreePBX-Admin-only -Require valid-user -AuthType Basic -AuthMySQLEnable\tOn -AuthMySQLHost\tlocalhost -AuthMySQLDB\tasterisk -AuthMySQLUserTable\tampusers -AuthMySQLUser\t".$amp_conf['AMPDBUSER']." -AuthMySQLPassword\t".$amp_conf['AMPDBPASS']." -AuthMySQLNameField\tusername -AuthMySQLPasswordField\tpassword -AuthMySQLAuthoritative\tOn -AuthMySQLPwEncryption\tnone -AuthMySQLUserCondition\t\"username = 'admin'\" - - - deny from all - -"; - - $outfile = LOCAL_PATH.".htaccess"; - $wfh=fopen($outfile,'w'); - fwrite($wfh,$htaccess); - fclose($wfh); -} - if($amp_conf['AMPENGINE'] != 'asterisk') { die(_("Sorry, Only Asterisk is supported currently")); } diff --git a/templates/devices_manager.html b/templates/devices_manager.html index 87dfe9df..f1b925a9 100755 --- a/templates/devices_manager.html +++ b/templates/devices_manager.html @@ -179,8 +179,8 @@

    {$message}

    {$value.model} {$value.ext} - {$value.description} {$value.template_name} - <?=_(' border='0'> - <?=_(' border='0'> + <?=_(' border='0'> + <?=_(' border='0'> {/loop} diff --git a/templates/global_header.html b/templates/global_header.html index ad572b2d..7f2b3b5d 100755 --- a/templates/global_header.html +++ b/templates/global_header.html @@ -6,8 +6,8 @@ - - + + - + + + + +{/if} {loop name="brand2_list"} @@ -43,7 +62,7 @@

    {$error}

    {loop name="value.products"} - + diff --git a/templates/devices_manager.html b/templates/devices_manager.html index 4cff3006..8fb9bf4c 100755 --- a/templates/devices_manager.html +++ b/templates/devices_manager.html @@ -178,8 +178,8 @@

    {$message}

    - - + + {/loop}
    {$value.long_name} {if condition="$value.cfg_ver != ''"}( [{$value.cfg_ver}]){/if}
    {else}{/if}">{if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}{/if}{/if}{if condition="$value.fw_type == 'install'"}{elseif condition="$value.fw_type == 'remove'"}{/if}{if condition="array_key_exists('update_fw',$value)"}{if condition="$value.update_fw == 1"}{/if}{/if}
    {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}New Version: {$value.update_vers}
    Changes: {$value.update_desc}{/if}{/if}
    {$value.long_name} {if condition="$value.cfg_ver != ''"}( [{$value.cfg_ver}]){/if}
    {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}{/if}{/if}{if condition="$value.fw_type == 'install'"}{elseif condition="$value.fw_type == 'remove'"}{/if}{if condition="array_key_exists('update_fw',$value)"}{if condition="$value.update_fw == 1"}{/if}{/if}
    {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}New Version: {$value.update_vers}
    Changes: {$value.update_desc}{/if}{/if}
      {$value.model} {$value.ext} - {$value.description} {$value.template_name}<?=_(' border='0'><?=_(' border='0'><?=_(' border='0'><?=_(' border='0'>
    diff --git a/templates/global_footer.html b/templates/global_footer.html new file mode 100755 index 00000000..730c2113 --- /dev/null +++ b/templates/global_footer.html @@ -0,0 +1,8 @@ +
    +
    Ed Macri, John Mullinix. and Andrew Nagy +
    + CSG Software Projects.
    +Copyright © 2009, 2010 by Ed Macri and John Mullinix
    +{if condition="isset($debug)"}:
    {/if} + + diff --git a/templates/global_header.html b/templates/global_header.html index 7f2b3b5d..e0c92ac6 100755 --- a/templates/global_header.html +++ b/templates/global_header.html @@ -17,11 +17,15 @@ {/if} + + + + {if condition="isset($amp_conf_serial)"} {/if} diff --git a/templates/global_links.html b/templates/global_links.html new file mode 100755 index 00000000..d53bd957 --- /dev/null +++ b/templates/global_links.html @@ -0,0 +1,9 @@ + + + + + + + +

    +
    diff --git a/templates/template_editor.html b/templates/template_editor.html index 7384f4c7..e10ded22 100644 --- a/templates/template_editor.html +++ b/templates/template_editor.html @@ -1,94 +1,94 @@ {if condition="isset($in_ari)"} - - - + + + - - - - - - - -{else} - + + + + + + + + {else} + {if condition="$custom != 0"} - {$ext}, : {$model} + {$ext}, : {$model} {/if} {if condition="$custom == 0"} - "{$template_name}" : {$model} + "{$template_name}" : {$model} {/if} -
    -
    +
    + {if condition="$alt != 0"} -
    -
    - +
    +
    + {$alt_configs} -
    +
    {/if} -
    - :
    {noparse} +
    + :
    {noparse} -"{$srvip}" =
    -"{$mac}" =
    -"{$ext}" =
    -"{$diplayname}" =
    {/noparse} -
    -{/if} +
    + {/if} -
    -
    +
    +
    {loop name="template_editor"} -
    -
    -

    {$value.title}

    - +
    +
    +

    {$value.title}

    +
    {loop name="value.data"} - - + - + + {if condition="$value.type == 'break'"} - - - - + + + + {/if} {/loop} -
    +
    {if condition="$value.type == 'input'"} - + {elseif condition="$value.type == 'radio'"} {$value.description} {loop name="value.data"} - + {/loop} {elseif condition="$value.type == 'list'"} {$value.description} + {/if} - + {if condition="isset($value.aried)"} - + {/if} -
      
      
    -
    -
    +
    +
    + {/loop} - - - - -{if condition="!isset($in_ari)"} - - -{/if} + + + + + {if condition="!isset($in_ari)"} + + + {/if} diff --git a/templates/template_manager.html b/templates/template_manager.html index 9d7c9b4b..74e3e349 100644 --- a/templates/template_manager.html +++ b/templates/template_manager.html @@ -2,28 +2,34 @@

    {$message}

    {if condition="$no_add == FALSE"}
    -

    :

    +

    :

    : : + Clone Template From: +
    - +
    + @@ -31,9 +37,11 @@

    :

    <?=_(' border='0'> + <?=_(' border='0'>{/if} {/loop}

    {if condition="$value.custom == 0"} - <?=_(' border='0'>{/if}
    From a28729f36cdab4a637e7e3d9d7fa89d8ea264e61 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 30 Jul 2010 07:47:06 +0000 Subject: [PATCH 015/623] Fixes to Discover Devices. --- includes/devices_manager.inc | 33 ++++++++++++-------------- includes/functions.inc | 46 ++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc index 95f33820..919637dd 100644 --- a/includes/devices_manager.inc +++ b/includes/devices_manager.inc @@ -126,29 +126,26 @@ if(isset($_REQUEST['button_add'])) { $num = $_REQUEST['add'][$i]; if($mac = $endpoint->mac_check_clean($_REQUEST['mac_'.$num])) { $sql = "SELECT * FROM endpointman_mac_list WHERE ext = ".$_REQUEST['ext_list_'.$num]; - $result=mysql_query($sql); - if(!mysql_num_rows($result)) { + $res =& $endpoint->db->query($sql); + $count_macs = $res->numRows(); + if(!$count_macs) { $sql = 'SELECT `name` FROM `users` WHERE `extension` = '.$_REQUEST['ext_list_'.$num]; - $result=mysql_query($sql); - $name=mysql_fetch_array($result); + $name =& $endpoint->db->getOne($sql,array(),DB_FETCHMODE_ASSOC); + $sql = 'SELECT endpointman_product_list. * , endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id = \''.$_REQUEST['model_list_'.$num].'\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id'; - $result=mysql_query($sql); - $row=mysql_fetch_array($result); + $row =& $endpoint->db->getAll($sql,array(),DB_FETCHMODE_ASSOC); + $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `ext`, `description`) VALUES ('".$mac."', '".$_REQUEST['model_list_'.$num]."', '".$_REQUEST['ext_list_'.$num]."', '".$name['name']."')"; - mysql_query($sql); + $endpoint->db->query($sql); $sql = 'SELECT id FROM endpointman_mac_list WHERE ext ='. $_REQUEST['ext_list_'.$num]; - $result=mysql_query($sql); - $ext_id=mysql_fetch_array($result); - - if(file_exists(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc')) { - require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); - $phone_config = new $row['cfg_dir'](); - $phone_config->generate_config($ext_id['id']); - unset($phone_config); - } + $mac_new_id =& $endpoint->db->getOne($sql,array(),DB_FETCHMODE_ASSOC); + + $row_new = $endpoint->get_phone_info($mac_new_id); + $endpoint->prepare_configs($row_new); + $message = _("Saved")."!"; } else { $message = _("One or more selected phones had the same extension as a phone already added, these devices were not added"); @@ -197,9 +194,9 @@ if(isset($_REQUEST['button_add'])) { $final[$i] = $temp[$i]; $final[$i]['id'] = $i; $sqln = "SELECT * FROM endpointman_model_list WHERE enabled = 1 AND brand =".$temp[$i]['brand_id']; - $model_list=mysql_query($sqln); + $model_list =& $endpoint->db->getAll($sqln,array(),DB_FETCHMODE_ASSOC); $j = 0; - while($row = mysql_fetch_assoc($model_list)) { + foreach($model_list as $row) { $final[$i]['list'][$j] = $row; $j++; } diff --git a/includes/functions.inc b/includes/functions.inc index c0eced91..1ec240fd 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1213,7 +1213,6 @@ class endpointmanager { //Discover New Device/Hardware function discover_new($netmask, $use_nmap=TRUE) { - global $global_cfg, $debug, $error; //Written by tm1000 //Version 1.0 @@ -1221,19 +1220,17 @@ class endpointmanager { //If the user just wishes to use the local arp cache they can tell the function to not use nmap //This results in a speed increase from 60 seconds to less than one second. if (($use_nmap) AND ($this->validate_netmask($netmask))) { - shell_exec($global_cfg['nmap_location'].' -v -sP '. $netmask); + shell_exec($this->global_cfg['nmap_location'].' -v -sP '. $netmask); } elseif(!$this->validate_netmask($netmask)) { return(FALSE); } //Get arp list - $arp_list = shell_exec($global_cfg['arp_location'] . " -an"); - //$arp_list = shell_exec("arp -an"); - if($global_cfg['debug']) { - $debug .= "ARP LIST:\n".$arp_list; - } + $arp_list = shell_exec($this->global_cfg['arp_location'] . " -an"); + //Throw arp list into an array, break by new lines $arp_array = explode("\n", $arp_list); + //Find all references to active computers by searching out mac addresses. $temp = array_values(array_unique(preg_grep("/[0-9a-f][0-9a-f][:-]". "[0-9a-f][0-9a-f][:-]". @@ -1242,10 +1239,6 @@ class endpointmanager { "[0-9a-f][0-9a-f][:-]". "[0-9a-f][0-9a-f]/i", $arp_array))); - if($global_cfg['debug']) { - $arp_arry = print_r($temp, true); - $debug .= "ARP Array:\n".$arp_arry; - } //Go through each row of valid arp entries and pull out the information and add it into a nice array! foreach ($temp as $key => &$value) { @@ -1266,34 +1259,37 @@ class endpointmanager { //Find the matching brand model to the oui $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%". $oui ."%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; - - $brand_result = mysql_query($oui_sql); - $brand = mysql_fetch_row($brand_result); - if ($brand == FALSE) { + $brand =& $this->db->getRow($oui_sql, array(), DB_FETCHMODE_ASSOC); + + $res =& $this->db->query($oui_sql); + $brand_count = $res->numRows(); + + if (!$brand_count) { //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. - $brand[0] = FALSE; - $brand[1] = NULL; + $brand['name'] = FALSE; + $brand['id'] = NULL; } //Find out if endpoint has already been configured for this mac address $epm_sql = "SELECT * FROM endpointman_mac_list WHERE mac LIKE '%". $mac_strip ."%'"; - $epm_result = mysql_query($epm_sql); - $epm_row = mysql_fetch_row($epm_result); - if ($epm_row == TRUE) { + $epm_row =& $this->db->getRow($epm_sql, array(), DB_FETCHMODE_ASSOC); + + $res =& $this->db->query($epm_sql); + $epm_count = $res->numRows(); + + if ($epm_count) { $epm = TRUE; } else { $epm = FALSE; } //Add into a final array - $final[$key] = array("ip" => $ip, "mac" => $mac, "mac_strip" => $mac_strip, "oui" => $oui, "brand" => $brand[0], "brand_id" => $brand[1], "endpoint_managed" => $epm); + $final[$key] = array("ip" => $ip, "mac" => $mac, "mac_strip" => $mac_strip, "oui" => $oui, "brand" => $brand['name'], "brand_id" => $brand['id'], "endpoint_managed" => $epm); } } + $final = array_values($final); - if($global_cfg['debug']) { - $arp_arry = print_r($final, true); - $debug .= "Final output from 'discover_new' function:\n".$arp_arry; - } + if(!is_array($final)) { return(FALSE); } else { From e00b637c2df5909dde2d4e30e6dcd01198daea73 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Wed, 11 Aug 2010 08:16:25 +0000 Subject: [PATCH 016/623] This is version 2.2. It will work on a fresh install. Upgrading from 2.0 to 2.2 won't work right now. --- ajax_select.html.php | 3 +- config.php | 53 + etc/sip_notify.conf | 43 + includes/advanced.inc | 286 +- includes/ajax.inc | 30 +- includes/ajax_select.php | 32 +- includes/brand_model_manager.inc | 67 +- includes/devices_manager.inc | 54 +- includes/export.php | 31 +- includes/functions.inc | 251 +- includes/installer.php | 196 +- includes/template_manager.inc | 32 +- includes/update_check.php | 11 +- install.php | 1150 +++--- page.endpointman.php | 69 +- page.epm_advanced.php | 69 +- page.epm_config.php | 69 +- page.epm_devices.php | 68 +- page.epm_templates.php | 68 +- .../advanced_settings_manual_upload.html | 52 + templates/advanced_settings_poce.html | 9 +- templates/advanced_settings_settings.html | 6 - templates/advanced_subheader.html | 2 +- templates/brand_model_manager.html | 140 +- templates/devices_manager.html | 12 +- templates/global_header.html | 11 +- templates/javascript/jquery.jstree.js | 3510 +++++++++++++++++ templates/javascript/themes/apple/bg.jpg | Bin 0 -> 331 bytes templates/javascript/themes/apple/d.png | Bin 0 -> 7765 bytes .../javascript/themes/apple/dot_for_ie.gif | Bin 0 -> 43 bytes templates/javascript/themes/apple/style.css | 60 + .../javascript/themes/apple/throbber.gif | Bin 0 -> 1849 bytes templates/javascript/themes/classic/d.png | Bin 0 -> 7535 bytes .../javascript/themes/classic/dot_for_ie.gif | Bin 0 -> 43 bytes templates/javascript/themes/classic/style.css | 59 + .../javascript/themes/classic/throbber.gif | Bin 0 -> 1849 bytes templates/javascript/themes/default-rtl/d.gif | Bin 0 -> 2872 bytes templates/javascript/themes/default-rtl/d.png | Bin 0 -> 7459 bytes .../javascript/themes/default-rtl/dots.gif | Bin 0 -> 132 bytes .../javascript/themes/default-rtl/style.css | 83 + .../themes/default-rtl/throbber.gif | Bin 0 -> 1849 bytes templates/javascript/themes/default/d.gif | Bin 0 -> 2944 bytes templates/javascript/themes/default/d.png | Bin 0 -> 7635 bytes templates/javascript/themes/default/style.css | 73 + .../javascript/themes/default/throbber.gif | Bin 0 -> 1849 bytes 45 files changed, 5315 insertions(+), 1284 deletions(-) create mode 100755 config.php create mode 100644 etc/sip_notify.conf create mode 100755 templates/advanced_settings_manual_upload.html create mode 100755 templates/javascript/jquery.jstree.js create mode 100755 templates/javascript/themes/apple/bg.jpg create mode 100755 templates/javascript/themes/apple/d.png create mode 100755 templates/javascript/themes/apple/dot_for_ie.gif create mode 100755 templates/javascript/themes/apple/style.css create mode 100755 templates/javascript/themes/apple/throbber.gif create mode 100755 templates/javascript/themes/classic/d.png create mode 100755 templates/javascript/themes/classic/dot_for_ie.gif create mode 100755 templates/javascript/themes/classic/style.css create mode 100755 templates/javascript/themes/classic/throbber.gif create mode 100755 templates/javascript/themes/default-rtl/d.gif create mode 100755 templates/javascript/themes/default-rtl/d.png create mode 100755 templates/javascript/themes/default-rtl/dots.gif create mode 100755 templates/javascript/themes/default-rtl/style.css create mode 100755 templates/javascript/themes/default-rtl/throbber.gif create mode 100755 templates/javascript/themes/default/d.gif create mode 100755 templates/javascript/themes/default/d.png create mode 100755 templates/javascript/themes/default/style.css create mode 100755 templates/javascript/themes/default/throbber.gif diff --git a/ajax_select.html.php b/ajax_select.html.php index bad67346..faa089cb 100644 --- a/ajax_select.html.php +++ b/ajax_select.html.php @@ -1,3 +1,2 @@ \ No newline at end of file +include('includes/ajax_select.php'); \ No newline at end of file diff --git a/config.php b/config.php new file mode 100755 index 00000000..1276aeb1 --- /dev/null +++ b/config.php @@ -0,0 +1,53 @@ +check-sync +Content-Length=>0 + +[polycom-reboot] +Event=>check-sync +Content-Length=>0 + +; Untested +[sipura-check-cfg] +Event=>resync +Content-Length=>0 + +; Untested +[grandstream-check-cfg] +Event=>sys-control + +; Untested +[cisco-check-cfg] +Event=>check-sync +Content-Length=>0 + +; Untested - from Snom docs +[reboot-snom] +Event=>reboot +Content-Length=>0 + +[aastra-check-cfg] +Event=>check-sync +Content-Length=>0 + +[linksys-cold-restart] +Event=>reboot_now +Content-Length=>0 + +[linksys-warm-restart] +Event=>restart_now +Content-Length=>0 + +[spa-reboot] +Event=>reboot +Content-Length=>0 + diff --git a/includes/advanced.inc b/includes/advanced.inc index 357c85b6..d0fd856d 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -1,24 +1,11 @@ mac_check_clean($device[0])) { $sql = "SELECT id FROM endpointman_brand_list WHERE name LIKE '%".$device[1]."%' LIMIT 1"; - $res_brand = mysql_query($sql); - if(mysql_num_rows($res_brand)) { - $brand_id = mysql_fetch_row($res_brand); + $res =& $db->query($sql); + if($res->numRows()) { + $brand_id = $endpoint->db->getOne($sql); $brand_id = $brand_id[0]; } else { $brand_id = 0; } - $sql = "SELECT id FROM endpointman_model_list WHERE brand = ".$brand_id." AND model LIKE '%".$device[2]."%' LIMIT 1"; - $res_model = mysql_query($sql); - $sql = "SELECT extension, name FROM users WHERE extension LIKE '%".$device[3]."%' LIMIT 1"; - $res_ext = mysql_query($sql); - if(mysql_num_rows($res_model)) { - $model_id = mysql_fetch_row($res_model); - $model_id = $model_id[0]; + $sql_model = "SELECT id FROM endpointman_model_list WHERE brand = ".$brand_id." AND model LIKE '%".$device[2]."%' LIMIT 1"; + $sql_ext = "SELECT extension, name FROM users WHERE extension LIKE '%".$device[3]."%' LIMIT 1"; + + $res_model =& $db->query($sql_model); + if($res_model->numRows()) { + $model_id =& $db->getRow($sql_model,array(), DB_FETCHMODE_ASSOC); + $model_id = $model_id['id']; } else { $model_id = 0; } - if(mysql_num_rows($res_ext)) { - $ext = mysql_fetch_row($res_ext); - $description = $ext[1]; - $ext = $ext[0]; + $res_ext =& $db->query($sql_ext); + if($res_ext->numRows()) { + $ext =& $db->getRow($sql_ext,array(), DB_FETCHMODE_ASSOC); + $description = $ext['name']; + $ext = $ext['extension']; } else { $ext = ''; $description = ''; } $sql = "INSERT INTO endpointman_mac_list (mac, model, ext, description) VALUES ('".$mac."','".$model_id."','".$ext."','".$description."')"; - mysql_query($sql); + $endpoint->db->query($sql); $message .= "Inserted Mac Address ".$mac."
    "; } else { $message .= "Invalid Mac on line ". $i. "
    "; @@ -111,47 +99,129 @@ switch($_REQUEST['subpage']) { } echo $tpl->draw( 'advanced_settings_iedl' ); break; + case "manual_upload": + $sql = "SELECT value FROM endpointman_global_vars WHERE var_name LIKE 'endpoint_vers'"; + $provisioner_ver = $endpoint->db->getOne($sql); + $provisioner_ver = date("n-j-y",$provisioner_ver) . " at " . date("g:ia",$provisioner_ver); + $tpl->assign("provisioner_ver", $provisioner_ver); + + $provisioner_ver = filemtime(PHONE_MODULES_PATH."master.xml"); + $provisioner_ver = date("n-j-y",$provisioner_ver) . " at " . date("g:ia",$provisioner_ver); + $tpl->assign("master_ver", $provisioner_ver); + $uploads_dir = PHONE_MODULES_PATH."temp"; + + if(isset($_REQUEST['upload_provisioner'])) { + + $extension = pathinfo($_FILES["package"]["name"],PATHINFO_EXTENSION); + if($extension == "tgz") { + if ($_FILES['package']['error'] == UPLOAD_ERR_OK) { + $tmp_name = $_FILES["package"]["tmp_name"]; + $name = $_FILES["package"]["name"]; + move_uploaded_file($tmp_name, "$uploads_dir/$name"); + $tpl->assign("show_installer", 1); + $tpl->assign("package", $name); + $tpl->assign("type", "upload_provisioner"); + $tpl->assign("xml", 0); + } else { + $message = $endpoint->file_upload_error_message($_FILES['package']['error']); + } + } else { + $message = "Invalid Extension"; + } + + + } elseif(isset($_REQUEST['upload_master_xml'])) { + $extension = pathinfo($_FILES["xml"]["name"],PATHINFO_EXTENSION); + if($extension == "xml") { + if ($_FILES['xml']['error'] == UPLOAD_ERR_OK) { + $tmp_name = $_FILES['xml']["tmp_name"]; + $name = $_FILES['xml']["name"]; + move_uploaded_file($tmp_name, "$uploads_dir/$name"); + $tpl->assign("show_installer", 1); + $tpl->assign("package", 0); + $tpl->assign("type", "upload_master_xml"); + $tpl->assign("xml", $name); + } else { + $message = $endpoint->file_upload_error_message($_FILES['xml']['error']); + } + } else { + $message = "Invalid Extension"; + } + } elseif(isset($_REQUEST['upload_brand'])) { + $error = FALSE; + $files_list = array(); + $i = 0; + foreach($_FILES as $files) { + $extension = pathinfo($files["name"],PATHINFO_EXTENSION); + if(($extension == "xml") OR ($extension == "tgz")) { + if ($files['error'] == UPLOAD_ERR_OK) { + $tmp_name = $files["tmp_name"]; + $name = $files["name"]; + move_uploaded_file($tmp_name, "$uploads_dir/$name"); + $files_list[$i] = $name; + $i++; + } else { + $error_message = $endpoint->file_upload_error_message($files['error']); + $error = TRUE; + } + } else { + $error_message = "Invalid Extension"; + $error = TRUE; + } + } + if(!$error){ + $tpl->assign("show_installer", 1); + $tpl->assign("package", $files_list[1]); + $tpl->assign("type", "upload_brand"); + $tpl->assign("xml", $files_list[0]); + } else { + $message = $error_message; + } + + } + $tpl->assign("message", $message); + + echo $tpl->draw( 'advanced_settings_manual_upload' ); + break; case "sh_manager": if(isset($_REQUEST['button_hide'])) { if(isset($_REQUEST['model'])) { - $sql = "UPDATE endpointman_model_list SET hidden = 1 WHERE id = ".$_REQUEST['model']; + $sql = "UPDATE endpointman_model_list SET hidden = 1 WHERE id = '".$_REQUEST['model']."'"; } elseif(isset($_REQUEST['brand'])) { $sql = "UPDATE endpointman_brand_list SET hidden = 1 WHERE id = ".$_REQUEST['brand']; } elseif(isset($_REQUEST['product'])) { - $sql = "UPDATE endpointman_product_list SET hidden = 1 WHERE id = ".$_REQUEST['product']; + $sql = "UPDATE endpointman_product_list SET hidden = 1 WHERE id = '".$_REQUEST['product']."'"; } - mysql_query($sql); + $endpoint->db->query($sql); }elseif(isset($_REQUEST['button_show'])) { if(isset($_REQUEST['model'])) { - $sql = "UPDATE endpointman_model_list SET hidden = 0 WHERE id = ".$_REQUEST['model']; + $sql = "UPDATE endpointman_model_list SET hidden = 0 WHERE id = '".$_REQUEST['model']."'"; } elseif(isset($_REQUEST['brand'])) { $sql = "UPDATE endpointman_brand_list SET hidden = 0 WHERE id = ".$_REQUEST['brand']; } elseif(isset($_REQUEST['product'])) { - $sql = "UPDATE endpointman_product_list SET hidden = 0 WHERE id = ".$_REQUEST['product']; + $sql = "UPDATE endpointman_product_list SET hidden = 0 WHERE id = '".$_REQUEST['product']."'"; } - mysql_query($sql); + $endpoint->db->query($sql); } $sql="SELECT * from endpointman_brand_list WHERE id > 0 ORDER BY id ASC "; - $result=mysql_query($sql); + $result =& $endpoint->db->getAll($sql, array(), DB_FETCHMODE_ASSOC); $i = 0; - while($row = mysql_fetch_assoc($result)) { + foreach($result as $row) { $row_out[$i] = $row; $row_out[$i]['count'] = $i; if($row['installed']) { $j = 0; $sql = 'SELECT * FROM endpointman_product_list WHERE brand = '.$row['id'].' ORDER BY long_name ASC'; - $result2=mysql_query($sql); + $result2 =& $endpoint->db->getAll($sql, array(), DB_FETCHMODE_ASSOC); $xml_data = ""; - while($row2 = mysql_fetch_assoc($result2)) { + foreach($result2 as $row2) { $row_out[$i]['products'][$j] = $row2; - if($row2['installed']) { - $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = '.$row2['id']; - $result3=mysql_query($sql); - $k = 0; - while($row3 = mysql_fetch_assoc($result3)) { - $row_out[$i]['products'][$j]['models'][$k] = $row3; - $k++; - } + $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = '.$row2['id']; + $result3 =& $endpoint->db->getAll($sql, array(), DB_FETCHMODE_ASSOC); + $k = 0; + foreach($result3 as $row3) { + $row_out[$i]['products'][$j]['models'][$k] = $row3; + $k++; } $j++; } @@ -193,9 +263,9 @@ switch($_REQUEST['subpage']) { break; case "poce": $sql = 'SELECT * FROM `endpointman_product_list` WHERE `hidden` = 0 AND `id` > 0'; - $result = mysql_query($sql); + $data =& $endpoint->db->getAll($sql, array(), DB_FETCHMODE_ASSOC); $i = 0; - while($row = mysql_fetch_assoc($result)) { + foreach($data as $row) { $product_list[$i]['value'] = $row['id']; $product_list[$i]['text'] = $row['long_name']; if((isset($_REQUEST['product_select'])) AND ($_REQUEST['product_select'] == $row['id'])) { @@ -205,13 +275,51 @@ switch($_REQUEST['subpage']) { } if(isset($_REQUEST['delete'])) { $sql = "DELETE FROM endpointman_custom_configs WHERE id =". $_REQUEST['sql']; - mysql_query($sql); + $endpoint->db->query($sql); + } + if(isset($_REQUEST['temp_file'])) { + $file = $_REQUEST['temp_file']; + + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '". $_REQUEST['product_select'] ."'"; + $row =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); + + $file=PHONE_MODULES_PATH.'endpoint/'.$row['directory']."/".$row['cfg_dir']."/".$file; + + if(isset($_REQUEST['config_text'])) { + if(isset($_REQUEST['button_save'])) { + $wfh=fopen($file,'w'); + fwrite($wfh,$_REQUEST['config_text']); + fclose($wfh); + } + } + + if(!file_exists($file)) { + $fp = fopen($file, 'w'); + fwrite($fp, ' + + '); + fclose($fp); + } + $handle = fopen($file, "rb"); + $contents = fread($handle, filesize($file)); + fclose($handle); + $tpl->assign("config_data", $contents); } if(isset($_REQUEST['file'])) { - $sql = 'SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id =' . $_REQUEST['product_select']; + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '". $_REQUEST['product_select'] ."'"; + $row =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); - $result = mysql_query($sql); - $row = mysql_fetch_assoc($result); $config_files = explode(",",$row['config_files']); $file=PHONE_MODULES_PATH.'endpoint/'.$row['directory']."/".$row['cfg_dir']."/".$config_files[$_REQUEST['file']]; if(isset($_REQUEST['config_text'])) { @@ -220,8 +328,8 @@ switch($_REQUEST['subpage']) { fwrite($wfh,$_REQUEST['config_text']); fclose($wfh); }elseif(isset($_REQUEST['button_save_as'])) { - $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("'.addslashes($_REQUEST['save_as_name']).'","'.addslashes($config_files[$_REQUEST['file']]).'",'.$_REQUEST['product_select'].',"'.addslashes($_REQUEST['config_text']).'")'; - mysql_query($sql); + $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("'.addslashes($_REQUEST['save_as_name']).'","'.addslashes($config_files[$_REQUEST['file']]).'","'.$_REQUEST['product_select'].'","'.addslashes($_REQUEST['config_text']).'")'; + $endpoint->db->query($sql); } } $handle = fopen($file, "rb"); @@ -233,38 +341,37 @@ switch($_REQUEST['subpage']) { if(isset($_REQUEST['config_text'])) { if(isset($_REQUEST['button_save'])) { $sql = "UPDATE endpointman_custom_configs SET data = '".addslashes($_REQUEST['config_text'])."' WHERE id = ".$_REQUEST['sql']; - mysql_query($sql); + $endpoint->db->query($sql); }elseif(isset($_REQUEST['button_save_as'])) { - $sql = 'SELECT original_name FROM endpointman_custom_configs WHERE id = 11'; - $res = mysql_query($sql); - $file_name = mysql_fetch_array($res); + $sql = 'SELECT original_name FROM endpointman_custom_configs WHERE id = '.$_REQUEST['sql']; + $file_name = $endpoint->db->getOne($sql); - $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("'.addslashes($_REQUEST['save_as_name']).'","'.addslashes($file_name['original_name']).'",'.$_REQUEST['product_select'].',"'.addslashes($_REQUEST['config_text']).'")'; - mysql_query($sql); + $sql = "INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ('".addslashes($_REQUEST['save_as_name'])."','".addslashes($file_name)."','".$_REQUEST['product_select']."','".addslashes($_REQUEST['config_text'])."')"; + $endpoint->db->query($sql); } } $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $_REQUEST['sql']; - $result = mysql_query($sql); - $row = mysql_fetch_assoc($result); + $row =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); $tpl->assign("save_as_name_value", $row['name']); $tpl->assign("config_data", $row['data']); } if(isset($_REQUEST['product_select'])) { - $sql = 'SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id =' . $_REQUEST['product_select']; - $result = mysql_query($sql); - $row = mysql_fetch_assoc($result); + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id ='" . $_REQUEST['product_select'] . "'"; + + $row =& $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); $config_files = explode(",",$row['config_files']); $i = 0; - while($i < count($config_files)) { + foreach($config_files as $config_files_data) { $file_list[$i]['value'] = $i; - $file_list[$i]['text'] = $config_files[$i]; + $file_list[$i]['text'] = $config_files_data; $i++; } - $sql = 'SELECT * FROM `endpointman_custom_configs` WHERE `product_id` = '. $_REQUEST['product_select']; - $result = mysql_query($sql); + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '". $_REQUEST['product_select'] . "'"; + $res =& $endpoint->db->query($sql); $i = 0; - if(mysql_num_rows($result)) { - while($row2 = mysql_fetch_assoc($result)) { + if($res->numRows()) { + $data =& $endpoint->db->getAll($sql, array(), DB_FETCHMODE_ASSOC); + foreach($data as $row2) { $sql_file_list[$i]['value'] = $row2['id']; $sql_file_list[$i]['text'] = $row2['name']; $sql_file_list[$i]['ref'] = $row2['original_name']; @@ -288,6 +395,26 @@ switch($_REQUEST['subpage']) { } } + + + $template_file_list[0]['value'] = "template_data_custom.xml"; + $template_file_list[0]['text'] = "template_data_custom.xml"; + + $sql = 'SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE CONVERT(_utf8 \'1-2\' USING latin1) COLLATE latin1_swedish_ci AND `enabled` = 1 AND `hidden` = 0'; + $data =& $endpoint->db->getAll($sql, array(), DB_FETCHMODE_ASSOC); + $i = 1; + foreach($data as $list) { + $template_file_list[$i]['value'] = "template_data_" . $list['model'] . "_custom.xml"; + $template_file_list[$i]['text'] = "template_data_" . $list['model'] . "_custom.xml"; + } + + $tpl->assign("template_file_list",$template_file_list); + if(isset($_REQUEST['temp_file'])) { + $tpl->assign("temp_file",1); + } else { + $tpl->assign("temp_file",NULL); + } + $tpl->assign("file_list", $file_list); $tpl->assign("sql_file_list", $sql_file_list); $tpl->assign("product_selected", $_REQUEST['product_select']); @@ -406,5 +533,4 @@ switch($_REQUEST['subpage']) { $tpl->assign("brand_list", $endpoint->brandAvailable()); echo $tpl->draw( 'advanced_settings_settings' ); break; -} -?> +} \ No newline at end of file diff --git a/includes/ajax.inc b/includes/ajax.inc index c1bcecea..85cd50cf 100644 --- a/includes/ajax.inc +++ b/includes/ajax.inc @@ -1,24 +1,11 @@ \ No newline at end of file +echo json_encode($out); \ No newline at end of file diff --git a/includes/ajax_select.php b/includes/ajax_select.php index 655df417..bd70fe80 100644 --- a/includes/ajax_select.php +++ b/includes/ajax_select.php @@ -1,24 +1,11 @@ \ No newline at end of file +echo json_encode($out); \ No newline at end of file diff --git a/includes/brand_model_manager.inc b/includes/brand_model_manager.inc index 90aec47a..c9e02364 100644 --- a/includes/brand_model_manager.inc +++ b/includes/brand_model_manager.inc @@ -1,33 +1,20 @@ 'product', "id" => $_REQUEST['product']); - } elseif(isset($_REQUEST['brand'])) { + if(isset($_REQUEST['brand'])) { $installer = array("type" => 'brand', "id" => $_REQUEST['brand']); } } elseif((isset($_REQUEST['button_install_firmware'])) OR (isset($_REQUEST['button_update_firmware'])) AND (isset($_REQUEST['product']))) { @@ -49,14 +36,16 @@ if((isset($_REQUEST['button_install'])) OR (isset($_REQUEST['button_update']))) } $endpoint->db->query($sql); } elseif(isset($_REQUEST['button_uninstall'])) { - if(isset($_REQUEST['product'])) { - $endpoint->remove_product($_REQUEST['product']); - } elseif(isset($_REQUEST['brand'])) { + if(isset($_REQUEST['brand'])) { $endpoint->remove_brand($_REQUEST['brand']); } } elseif(isset($_REQUEST['button_check_for_updates'])) { $brand_up = $endpoint->brand_update_check(); + $tpl->assign("update_check", 1); + $check_for_updates = TRUE; +} elseif(isset($_REQUEST['install-jstree'])) { + $installer = array("type" => 'js-multiple', "id" => $_REQUEST['hidden']); } $sql="SELECT * from endpointman_brand_list WHERE id > 0 AND hidden = 0 ORDER BY id ASC "; @@ -65,18 +54,21 @@ $i = 0; $note = ""; foreach($brand_list as $row) { $row_out[$i] = $row; + $row_out[$i]['cfg_ver'] = date("n-j-y",$row['cfg_ver']) . " at " . date("g:ia",$row['cfg_ver']); + $row_out[$i]['count'] = $i; if($check_for_updates) { - $id = $endpoint->arraysearchrecursive($row['name'], $brand_up,'brand_name'); + $id = $endpoint->arraysearchrecursive($row['name'], $brand_up,'name'); + $id = $id[0]; if((isset($brand_up[$id]['update'])) AND ($row['installed'] == 1)) { $row_out[$i]['update'] = $brand_up[$id]['update']; - $endpoint->add_freepbx_notification("PU_".$brand_up[$id]['brand_name'], '', "Brand \'".$brand_up[$id]['brand_name']."\' has updates available", "Old Version: ".$row['cfg_ver']." New Version: ".$brand_up[$id]['version']."
    "."Changes: ". $brand_up[$id]['changes'].$note, ""); + //$endpoint->add_freepbx_notification("PU_".$brand_up[$id]['name'], '', "Brand \'".$brand_up[$id]['name']."\' has updates available", "Old Version: ".$row['cfg_ver']." New Version: ".$brand_up[$id]['version']."
    "."Changes: ". $brand_up[$id]['changes'].$note, ""); } else { $row_out[$i]['update'] = NULL; } if(isset($brand_up[$id]['update_vers'])) { - $row_out[$i]['update_vers'] = $brand_up[$id]['update_vers']; + $row_out[$i]['update_vers'] = date("n-j-y",$brand_up[$id]['update_vers']) . " at " . date("g:ia",$brand_up[$id]['update_vers']); } else { $row_out[$i]['update_vers'] = NULL; } @@ -91,11 +83,10 @@ foreach($brand_list as $row) { if(($temp = $endpoint->firmware_update_check($row2['id'])) AND (array_key_exists('firmware_vers', $row)) AND ($row['firmware_vers'] > 0)) { $row_out[$i]['products'][$j]['update_fw'] = 1; $row_out[$i]['products'][$j]['update_vers_fw'] = $temp['data']['version']; - $endpoint->add_freepbx_notification("PU_".$row2['long_name'], '', "There is a firmware update for phone module ".$row2['long_name'], "Old Version: ".$row2['firmware_vers']." New Version: ".$temp['data']['version'].$note, ""); + //$endpoint->add_freepbx_notification("PU_".$row2['long_name'], '', "There is a firmware update for phone module ".$row2['long_name'], "Old Version: ".$row2['firmware_vers']." New Version: ".$temp['data']['version'].$note, ""); } else { $row_out[$i]['products'][$j]['update_fw'] = 0; } - $xml_data = $row2['xml_data']; } $row_out[$i]['products'][$j]['fw_type'] = $endpoint->firmware_local_check($row2['id']); @@ -119,8 +110,7 @@ foreach($brand_list as $row) { $i++; } -//initialize a Rain TPL object -$tpl = new RainTPL( LOCAL_PATH.'templates' ); + if (!isset($error)) { $error = ""; @@ -132,18 +122,15 @@ if (!isset($_POST['brand'])) { } if (isset($installer)) { - $tpl->assign("installer_address", $_SERVER["HTTP_HOST"].WEB_PATH."includes/installer.php"); $tpl->assign("brand", $brand); - + $tpl->assign("installer", $installer); } -global $debug, $global_cfg; $tpl->assign("error", $error); $tpl->assign("web_var", "?type=$type"); $tpl->assign("brand2_list", $row_out); -$tpl->assign("error", $endpoint->error['brand_update_check']); +//$tpl->assign("error", $endpoint->error['brand_update_check']); //draw the template -echo $tpl->draw( 'brand_model_manager' ); -?> +echo $tpl->draw( 'brand_model_manager' ); \ No newline at end of file diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc index 919637dd..e730e4e5 100644 --- a/includes/devices_manager.inc +++ b/includes/devices_manager.inc @@ -1,24 +1,11 @@ db->getRow($sql,array(),DB_FETCHMODE_ASSOC); $cfg_data = unserialize($row['template_data']); + $count = count($cfg_data); $i = 0; while($i < $count) { @@ -67,6 +55,7 @@ if(isset($_REQUEST['button_add'])) { } $i++; } + $custom_cfg_data = serialize($custom_cfg_data); $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `ext`, `description`, `custom_cfg_data`, `custom_cfg_template`) VALUES ('".$mac."', '".$_REQUEST['model_list']."', '".$_REQUEST['ext_list']."', '".$name."', '".$custom_cfg_data."', '".$_REQUEST['template_list']."')"; @@ -75,6 +64,10 @@ if(isset($_REQUEST['button_add'])) { $sql = 'SELECT id FROM endpointman_mac_list WHERE ext ='. $_REQUEST['ext_list']; $ext_id =& $endpoint->db->getOne($sql); + $mac_id = $endpoint->get_phone_info($ext_id); + + $endpoint->prepare_configs($mac_id); + $message = _("Saved")."!"; } else { $message = _("Invalid MAC Address")."!"; @@ -89,6 +82,8 @@ if(isset($_REQUEST['button_add'])) { $message = _("No Device Selected to Edit!")."!"; } else { $template_editor = TRUE; + $sql = "UPDATE endpointman_mac_list SET model = '".$_REQUEST['model_list']."' WHERE id =".$_REQUEST['edit_id']; + $endpoint->db->query($sql); if ($_REQUEST['template_list'] == 0) { $endpoint->edit_template_display($_REQUEST['edit_id'],1); } else { @@ -110,16 +105,8 @@ if(isset($_REQUEST['button_add'])) { } elseif(isset($_REQUEST['deleteready'])) { $row = $endpoint->get_phone_info($_REQUEST['id']); - if(file_exists(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc')) { - require_once(PHONE_MODULES_PATH.$row['directory'].'/'.$row['cfg_dir'].'/functions.inc'); - - $phone_config = new $row['cfg_dir'](); - $phone_config->delete_config($_REQUEST['id']); - unset($phone_config); - } - $sql = "DELETE FROM endpointman_mac_list WHERE id=".$_REQUEST['id']; - $result=mysql_query($sql); + $endpoint->db->query($sql); } elseif((isset($_REQUEST['button_add_selected_phones'])) AND (isset($_REQUEST['add']))) { $list_num = count($_REQUEST['add']); for($i=0;$i<$list_num;$i++) { @@ -282,7 +269,10 @@ $unknown_list =& $endpoint->db->getAll($sql,array(),DB_FETCHMODE_ASSOC); foreach($unknown_list as $row) { #Displays unknown phones in the database with edit and delete buttons $list[$i] = $row; - $list[$i]['name'] = _("Unknown"); + + $brand_info = $endpoint->get_brand_from_mac($row['mac']); + + $list[$i]['name'] = $brand_info['name']; $list[$i]['template_name'] = "N/A"; $list[$i]['model'] = _("Unknown"); $i++; @@ -336,6 +326,7 @@ if (isset($template_editor)) { if($ma = $endpoint->modelsAvailable($edit_row['model_id'],NULL,$edit_row['brand_id'])) { $tpl->assign("mac", $edit_row['mac']); $tpl->assign("name", $edit_row['name']); + $tpl->assign("brand_id", $edit_row['brand_id']); $tpl->assign("models_ava", $ma); $tpl->assign("display_ext", $endpoint->displayExtension($edit_row['ext'])); $tpl->assign("display_templates", $endpoint->display_templates($edit_row['product_id'],$edit_row['custom_cfg_template'])); @@ -352,5 +343,4 @@ if (isset($template_editor)) { //draw the template echo $tpl->draw( 'devices_manager' ); -} -?> +} \ No newline at end of file diff --git a/includes/export.php b/includes/export.php index a136e1c2..5fd39e22 100644 --- a/includes/export.php +++ b/includes/export.php @@ -1,24 +1,11 @@ \ No newline at end of file +fclose($outstream); \ No newline at end of file diff --git a/includes/functions.inc b/includes/functions.inc index 1ec240fd..60f77cd8 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1,59 +1,11 @@ db = $db; $this->amp_conf = $amp_conf; $this->error = array(); - //attached to the end of every link so we can flow through FreePBX - //This is really hacky but I have to do it when people have different directories instead of admin //Define the location of phone modules, keeping it outside of the module directory so that when the user updates endpointmanager they don't lose all of their phones define("PHONE_MODULES_PATH", dirname($_SERVER["SCRIPT_FILENAME"])."/modules/_ep_phone_modules/"); @@ -80,7 +32,7 @@ class endpointmanager { define("LOCAL_PATH", dirname($_SERVER["SCRIPT_FILENAME"])."/modules/endpointman/"); - + //close open mysql stuff mysql_close(); @@ -105,6 +57,47 @@ class endpointmanager { mysql_query($sql); } + function file_upload_error_message($error_code) { + switch ($error_code) { + case UPLOAD_ERR_INI_SIZE: + return 'The uploaded file exceeds the upload_max_filesize directive in php.ini'; + case UPLOAD_ERR_FORM_SIZE: + return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'; + case UPLOAD_ERR_PARTIAL: + return 'The uploaded file was only partially uploaded'; + case UPLOAD_ERR_NO_FILE: + return 'No file was uploaded'; + case UPLOAD_ERR_NO_TMP_DIR: + return 'Missing a temporary folder'; + case UPLOAD_ERR_CANT_WRITE: + return 'Failed to write file to disk'; + case UPLOAD_ERR_EXTENSION: + return 'File upload stopped by extension'; + default: + return 'Unknown upload error'; + } + } + + function get_brand_from_mac($mac){ + $oui = substr($mac,0,6); + //Find the matching brand model to the oui + $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%". $oui ."%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; + $brand =& $this->db->getRow($oui_sql, array(), DB_FETCHMODE_ASSOC); + + $res =& $this->db->query($oui_sql); + $brand_count = $res->numRows(); + + if (!$brand_count) { + //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. + $phone_info['id'] = 0; + $phone_info['name'] = _("Unknown"); + } else { + $phone_info['id'] = $brand['id']; + $phone_info['name'] = $brand['name']; + } + + return($phone_info); + } /** * Send this function an ID from the mac devices list table and you'll get all the information we have on that particular phone * @param integer $mac_id ID number reference from the MySQL database referencing the table endpointman_mac_list @@ -116,6 +109,7 @@ class endpointmanager { die("Can't get phone info!"); } $sql = "SELECT id,mac,model FROM endpointman_mac_list WHERE model > 0 AND id =".$mac_id; + $res =& $this->db->query($sql); if($res->numRows()) { //Returns Brand Name, Brand Directory, Model Name, Mac Address, Extension (FreePBX), Custom Configuration Template, Custom Configuration Data, Product Name, Product ID, Product Configuration Directory, Product Configuration Version, Product XML name, @@ -135,14 +129,20 @@ class endpointmanager { } } else { + $sql = "SELECT id, mac, ext FROM endpointman_mac_list WHERE id =".$mac_id; //Phone is unknown, we need to display this to the end user so that they can make corrections - $row=mysql_fetch_array($result); + $row =& $this->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); + + $brand = $this->get_brand_from_mac($row['mac']); + $phone_info['brand_id'] = $brand['id']; + $phone_info['name'] = $brand['name']; + $phone_info['id'] = $mac_id; $phone_info['model_id'] = 0; - $phone_info['brand_id'] = 0; + $phone_info['product_id'] = 0; + $phone_info['custom_cfg_template'] = 0; $phone_info['ext'] = $row['ext']; $phone_info['mac'] = $row['mac']; - $phone_info['name'] = 'Unknown'; } return $phone_info; @@ -173,7 +173,7 @@ class endpointmanager { //Determine if we are dealing with a general template or a specific [for that phone only] template (custom =0 means general) if($custom == 0) { - $sql = "SELECT endpointman_product_list.config_files, endpointman_product_list.long_name, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = ".$id; + $sql = "SELECT endpointman_product_list.config_files, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = ".$id; } else { $sql = "SELECT endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_model_list.id as model_id, endpointman_model_list.template_data, endpointman_product_list.id as product_id, endpointman_product_list.long_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_mac_list.id=".$id." AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; } @@ -204,7 +204,7 @@ class endpointmanager { $alt = 0; //TODO: Perhaps fix this alternative files list foreach($config_files_list as $files) { - $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = ".$row['id']." AND original_name = '".$files."'"; + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '".$row['product_id']."' AND original_name = '".$files."'"; $alt_configs_list_count =& $this->db->query($sql); if($alt_configs_list_count->numRows() > 0) { $alt_configs_list =& $this->db->getAll($sql, array(), DB_FETCHMODE_ASSOC); @@ -225,6 +225,7 @@ class endpointmanager { } $i++; } + $tpl->assign("alt_configs", $alt_configs); $tpl->assign("alt", $alt); @@ -254,6 +255,10 @@ class endpointmanager { function generate_gui_html($cfg_data,$custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL) { //take the data out of the database and turn it back into an array for use $cfg_data = unserialize($cfg_data); + + + + $count = count($cfg_data); //Check to see if there is a custom template for this phone already listed in the endpointman_mac_list database @@ -430,7 +435,9 @@ class endpointmanager { } function prepare_configs($phone_info) { - require(PHONE_MODULES_PATH.'setup.php'); + if(!class_exists('ProvisionerConfig')) { + require(PHONE_MODULES_PATH.'setup.php'); + } $class = "endpoint_" . $phone_info['directory'] . "_" . $phone_info['cfg_dir'] . '_phone'; @@ -456,7 +463,18 @@ class endpointmanager { $provisioner_lib->server[1]['port'] = 5060; //Provide alternate Configuration file instead of the one from the hard drive - //$endpoint->config_files_override['$mac.cfg'] = "{\$srvip}\n{\$admin_pass|0}\n{\$test.line.1}"; + $temp = ""; + if(!empty($phone_info['config_files_override'])){ + $temp = unserialize($phone_info['config_files_override']); + foreach($temp as $list) { + $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = ".$list; + $res =& $this->db->query($sql); + if($res->numRows()) { + $data = $this->db->getRow($sql, array(),DB_FETCHMODE_ASSOC); + $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; + } + } + } //Pretend we have three lines, we could just have one line or 20...whatever the phone supports $provisioner_lib->lines[1] = array('ext' => $phone_info['ext'], 'secret' => $phone_info['secret'], 'displayname' => $phone_info['description']); @@ -470,8 +488,10 @@ class endpointmanager { } $new_template_data = array(); - foreach($template_data as $key => $data) { - $new_template_data = array_merge($new_template_data, array($key => $data['value'])); + if(is_array($template_data)) { + foreach($template_data as $key => $data) { + $new_template_data = array_merge($new_template_data, array($key => $data['value'])); + } } //Set Variables according to the template_data files included. We can include different template.xml files within family_data.xml also one can create @@ -485,59 +505,53 @@ class endpointmanager { $returned_data = $provisioner_lib->generate_config(); foreach($returned_data as $key => $data) { - $fp = fopen("/tftpboot/".$key, 'w'); + $fp = fopen($this->global_cfg['config_location'].$key, 'w'); fwrite($fp, $data); fclose($fp); } - unset($provisioner_lib); } function firmware_update_check($id=NULL) { - $sql = "SELECT * FROM endpointman_product_list WHERE id =". $id; - $result = mysql_query($sql); - $row = mysql_fetch_array($result); + $sql = "SELECT * FROM endpointman_product_list WHERE id ='". $id."'"; + $row =& $this->db->getRow($sql,array(),DB_FETCHMODE_ASSOC); $sql = "SELECT directory FROM endpointman_brand_list WHERE id =". $row['brand']; - $result = mysql_query($sql); - if(mysql_num_rows($result)) { - $brand_row = mysql_fetch_array($result); + $brand_directory =& $this->db->getOne($sql); - //config drive unknown! - if ($row['cfg_dir'] == "") { - return FALSE; - } else { - $temp = $this->xml2array(PHONE_MODULES_PATH.$brand_row['directory']."/".$row['cfg_dir']."/template_data.xml"); - if((array_key_exists('data',$temp)) AND (!is_array($temp['data']['firmware_ver']))) { - if($row['firmware_vers'] < $temp['data']['firmware_ver']) { - return $temp; - } else { - return FALSE; - } + //config drive unknown! + if ($row['cfg_dir'] == "") { + return FALSE; + } else { + $temp = $this->xml2array(PHONE_MODULES_PATH."endpoint/".$brand_directory."/".$row['cfg_dir']."/template_data.xml"); + if((array_key_exists('data',$temp)) AND (!is_array($temp['data']['firmware_ver']))) { + if($row['firmware_vers'] < $temp['data']['firmware_ver']) { + return $temp; } else { return FALSE; } + } else { + return FALSE; } - } else { - return FALSE; } + } function firmware_local_check($id=NULL) { - $sql = "SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id =". $id; - $result = mysql_query($sql); - if(mysql_num_rows($result)) { - $row = mysql_fetch_array($result); + $sql = "SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id ='". $id ."'"; + $res =& $this->db->query($sql); + + if($res->numRows()) { + $row =& $this->db->getRow($sql,array(),DB_FETCHMODE_ASSOC); $sql = "SELECT directory FROM endpointman_brand_list WHERE hidden = 0 AND id =". $row['brand']; - $result = mysql_query($sql); - $brand_row = mysql_fetch_array($result); + $brand_directory =& $this->db->getOne($sql); //config drive unknown! if ($row['cfg_dir'] == "") { return("nothing"); } else { - $temp = $this->xml2array(PHONE_MODULES_PATH.$brand_row['directory']."/".$row['cfg_dir']."/template_data.xml"); + $temp = $this->xml2array(PHONE_MODULES_PATH.$brand_directory."/".$row['cfg_dir']."/template_data.xml"); if((isset ($temp['data']['firmware_ver'])) AND (!is_array($temp['data']['firmware_ver']))) { if($row['firmware_vers'] == "") { return("install"); @@ -680,7 +694,6 @@ class endpointmanager { //rename(PHONE_MODULES_PATH."temp/setup.php", PHONE_MODULES_PATH."setup.php"); - rename(PHONE_MODULES_PATH."temp/endpoint/base.php", PHONE_MODULES_PATH."endpoint/base.php"); $sql = "UPDATE endpointman_global_vars SET value = '".$endpoint_last_mod."' WHERE var_name = 'endpoint_vers'"; @@ -713,11 +726,22 @@ class endpointmanager { } $brand_name = $data['directory']; - $version[$brand_name] = $temp['version']; + $version[$brand_name] = $temp['last_modified']; + + $last_mod = ""; + + $temp['family_list']['family'] = $this->fix_single_array_keys($temp['family_list']['family']); + + foreach($temp['family_list']['family'] as $list) { + $last_mod = max($last_mod, $list['last_modified']); + } + $last_mod = max($last_mod, $version[$brand_name]); + + $version[$brand_name] = $last_mod; if(!($this->arraysearchrecursive($brand_name, $row, 'directory'))) { //insert row - $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('".$temp['brand_id']."', '".$temp['name']."', '".$temp['directory']."', '".$temp['version']."')"; + $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('".$temp['brand_id']."', '".$temp['name']."', '".$temp['directory']."', '".$version[$brand_name]."')"; $this->db->query($sql); } else { //in database already! @@ -767,11 +791,6 @@ class endpointmanager { $brand_version = $temp['data']['brands']['version']; $package = $temp['data']['brands']['package']; - echo "Updating data.........."; - $sql = "UPDATE endpointman_brand_list SET name = '".$brand_name."', cfg_ver = '".$brand_version."', installed = 1, hidden = 0 WHERE id = ".$id; - $this->db->query($sql); - echo "Done!
    "; - echo "Downloading Tarball......."; $this->download_file_with_progress_bar(UPDATE_PATH.$row[0]['directory'].'/'.$package, PHONE_MODULES_PATH."temp/".$package); echo "Done!
    "; @@ -805,10 +824,12 @@ class endpointmanager { unlink(PHONE_MODULES_PATH.'temp/'. $package); echo "Done!
    "; - + $last_mod = ""; $temp['data']['brands']['family_list']['family'] = $this->fix_single_array_keys($temp['data']['brands']['family_list']['family']); foreach($temp['data']['brands']['family_list']['family'] as $family_list) { echo "Updating Family Lines.................
    "; + $last_mod = max($last_mod, $family_list['last_modified']); + $family_line_xml = $this->xml2array(PHONE_MODULES_PATH.'/endpoint/'.$row[0]['directory'].'/'.$family_list['directory'].'/family_data.xml'); $data =& $this->db->getOne("SELECT id FROM endpointman_product_list WHERE id='".$brand_id."-".$family_line_xml['data']['id']."'", array(), DB_FETCHMODE_ASSOC); $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); @@ -836,6 +857,13 @@ class endpointmanager { $this->db->query($sql); } } + + $brand_version = max($last_mod, $brand_version); + echo "Updating data.........."; + $sql = "UPDATE endpointman_brand_list SET name = '".$brand_name."', cfg_ver = '".$brand_version."', installed = 1, hidden = 0 WHERE id = ".$id; + $this->db->query($sql); + echo "Done!
    "; + } else { echo "
    Error Connecting to the Package Repository. Module not installed. Please Try again later."; } @@ -868,6 +896,10 @@ class endpointmanager { $model_id = explode("-",$model); + if((!$model_id[0]) OR (!$model_id[1])) { + return(FALSE); + } + $model_row =& $this->db->getRow($sql, array(),DB_FETCHMODE_ASSOC); $sql = "SELECT * FROM endpointman_product_list WHERE id='".$model_row['product_id']."'"; @@ -1031,9 +1063,9 @@ class endpointmanager { function table_exists ($table) { $sql = "SHOW TABLES FROM asterisk"; - $result = mysql_query($sql); + $result = $this->db->getAll($sql); - while ($row = mysql_fetch_row($result)) { + foreach($result as $row) { if ($row[0] == $table) { return TRUE; } @@ -1336,9 +1368,9 @@ class endpointmanager { function displayExtension($ext = NULL) { if(!isset($ext)) { - $not_added="SELECT devices.id, devices.description FROM devices WHERE devices.id not in (SELECT devices.id FROM devices, endpointman_mac_list WHERE tech='sip' AND devices.id = endpointman_mac_list.ext )"; + $not_added="SELECT devices.id, devices.description FROM devices WHERE tech='sip' AND devices.id not in (SELECT devices.id FROM devices, endpointman_mac_list WHERE tech='sip' AND devices.id = endpointman_mac_list.ext ) ORDER BY devices.id"; } else { - $not_added="SELECT devices.id, devices.description FROM devices WHERE devices.id not in (SELECT devices.id FROM devices, endpointman_mac_list WHERE tech='sip' AND devices.id = endpointman_mac_list.ext AND endpointman_mac_list.ext !=".$ext." )"; + $not_added="SELECT devices.id, devices.description FROM devices WHERE tech='sip' AND devices.id not in (SELECT devices.id FROM devices, endpointman_mac_list WHERE tech='sip' AND devices.id = endpointman_mac_list.ext AND endpointman_mac_list.ext !=".$ext." ) ORDER BY devices.id"; } $result=mysql_query($not_added); @@ -1365,7 +1397,8 @@ class endpointmanager { * @return array Number array used to generate a select box */ function brandAvailable ($selected = NULL) { - $sql="SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_brand_list,endpointman_model_list WHERE endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND endpointman_brand_list.installed = 1 AND endpointman_brand_list.hidden = 0"; + $sql="SELECT DISTINCT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_brand_list,endpointman_model_list WHERE endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND endpointman_brand_list.installed = 1 AND endpointman_brand_list.hidden = 0"; + $data =& $this->db->getAll($sql,array(), DB_FETCHMODE_ASSOC); $temp[0]['value'] = ""; $temp[0]['text'] = ""; diff --git a/includes/installer.php b/includes/installer.php index d010bd8b..992eae7a 100644 --- a/includes/installer.php +++ b/includes/installer.php @@ -1,35 +1,181 @@ "; +} -if($_REQUEST['type'] == "install") { - $endpoint->update_brand($_REQUEST['brand']); +if($_REQUEST['type'] == "brand") { + $endpoint->update_brand($_REQUEST['id']); +} elseif($_REQUEST['type'] == "js-multiple") { + $list = explode(",",$_REQUEST['id']); + sort($list,SORT_STRING); + echo "
    ";
    +    print_r($list);
    +    foreach($list as $data) {
    +        $parameters = explode("_",$data);
    +        $type = $parameters[0];
    +        $id = $parameters[1];
    +        //Check to see if it's already installed
    +        if($type == "models") {
    +            $parameters2 = explode("-",$id);
    +            $brand = $parameters2[0];
    +            $product_id = $parameters2[0]."-".$parameters2[1];
    +            $sql = "UPDATE endpointman_model_list SET enabled = 1 WHERE id = '".$id."'";
    +            $endpoint->db->query($sql);
    +            $sql = 'SELECT `model` FROM `endpointman_model_list` WHERE `id` LIKE CONVERT(_utf8 \''.$id.'\' USING latin1) COLLATE latin1_swedish_ci';
    +            $name = $endpoint->db->getOne($sql);
    +            out("Enabling Model ".$name);
    +        } elseif($type == "products") {
    +            $sql = "UPDATE endpointman_model_list SET enabled = 1 WHERE product_id = '".$id."'";
    +            $endpoint->db->query($sql);
    +            $sql = 'SELECT `short_name` FROM `endpointman_product_list` WHERE `id` LIKE CONVERT(_utf8 \''.$id.'\' USING latin1) COLLATE latin1_swedish_ci';
    +            $name = $endpoint->db->getOne($sql);
    +            out("Enabling all models in ".$name);
    +        } elseif($type == "brand") {
    +            $endpoint->update_brand($id);
    +        }
    +    }
     } elseif($_REQUEST['type'] == "firmware") {
    -	$endpoint->install_firmware($data['id']);
    -}
    +    $endpoint->install_firmware($data['id']);
    +} elseif($_REQUEST['type'] == "manual_install") {
    +    switch($_REQUEST['install_type']) {
    +        case "upload_master_xml":
    +            if (file_exists(PHONE_MODULES_PATH."temp/master.xml")) {
    +                $handle = fopen(PHONE_MODULES_PATH."temp/master.xml", "rb");
    +                $contents = stream_get_contents($handle);
    +                fclose($handle);
    +                @$a = simplexml_load_string($contents);
    +                if($a===FALSE) {
    +                    echo "Not a valid xml file";
    +                    break;
    +                } else {
    +                    rename(PHONE_MODULES_PATH."temp/master.xml", PHONE_MODULES_PATH."master.xml");
    +                    echo "Move Successful
    "; + $endpoint->brand_update_check(); + echo "Updating Brands
    "; + + } + } else { + } + break; + case "upload_provisioner": + if (file_exists(PHONE_MODULES_PATH."temp/".$_REQUEST['package'])) { + echo "Extracting Provisioner Package
    "; + exec("tar -xvf ".PHONE_MODULES_PATH.'temp/'. $_REQUEST['package'] ." -C ".PHONE_MODULES_PATH."temp/"); + + if(!file_exists(PHONE_MODULES_PATH."endpoint")) { + echo "Creating Provisioner Directory
    "; + mkdir(PHONE_MODULES_PATH."endpoint"); + } + + $endpoint_last_mod = filemtime(PHONE_MODULES_PATH."temp/endpoint/base.php"); + + //rename(PHONE_MODULES_PATH."temp/setup.php", PHONE_MODULES_PATH."setup.php"); + + rename(PHONE_MODULES_PATH."temp/endpoint/base.php", PHONE_MODULES_PATH."endpoint/base.php"); + + echo "Updating Last Modified
    "; + $sql = "UPDATE endpointman_global_vars SET value = '".$endpoint_last_mod."' WHERE var_name = 'endpoint_vers'"; + $endpoint->db->query($sql); + } + break; + case "upload_brand": + if ((file_exists(PHONE_MODULES_PATH."temp/".$_REQUEST['package'])) AND (file_exists(PHONE_MODULES_PATH."temp/".$_REQUEST['xml']))) { + $temp = $endpoint->xml2array(PHONE_MODULES_PATH."temp/".$_REQUEST['xml']); + + $brand_name = $temp['data']['brands']['name']; + $brand_id = $temp['data']['brands']['brand_id']; + $brand_version = $temp['data']['brands']['version']; + $package = $temp['data']['brands']['package']; + $brand_directory = $temp['data']['brands']['directory']; + + if(!file_exists(PHONE_MODULES_PATH."endpoint/".$brand_directory)) { + echo "Creating ".$brand_name." Directory
    "; + mkdir(PHONE_MODULES_PATH."endpoint/".$brand_directory); + } + + rename(PHONE_MODULES_PATH."temp/".$_REQUEST['xml'], PHONE_MODULES_PATH."endpoint/".$brand_directory."brand_data.xml"); + + echo "Extracting Tarball........"; + exec("tar -xvf ".PHONE_MODULES_PATH.'temp/'. $package ." -C ".PHONE_MODULES_PATH."temp/"); + echo "Done!
    "; + + echo "Creating Directory Structure/Moving Files..............."; + $dir_iterator = new RecursiveDirectoryIterator(PHONE_MODULES_PATH."temp/".$brand_directory."/"); + $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST); + // could use CHILD_FIRST if you so wish + + foreach ($iterator as $file) { + if(is_dir($file)) { + $dir = str_replace(PHONE_MODULES_PATH."temp/".$brand_directory."/", "", $file); + if(!file_exists(PHONE_MODULES_PATH."endpoint/".$brand_directory."/".$dir)) { + mkdir(PHONE_MODULES_PATH."endpoint/".$brand_directory."/".$dir); + } + } else { + if(basename($file) != "brand_data.xml") { + $dir = str_replace(PHONE_MODULES_PATH."temp/".$brand_directory."/", "", $file); + rename($file, PHONE_MODULES_PATH."endpoint/".$brand_directory."/".$dir); + } + } + } + echo "Done!
    "; + echo "Removing Temporary Files.............."; + $endpoint->deltree(PHONE_MODULES_PATH."temp/" .$brand_directory); + unlink(PHONE_MODULES_PATH.'temp/'. $_REQUEST['package']); + echo "Done!
    "; + + $last_mod = ""; + $temp['data']['brands']['family_list']['family'] = $endpoint->fix_single_array_keys($temp['data']['brands']['family_list']['family']); + foreach($temp['data']['brands']['family_list']['family'] as $family_list) { + echo "Updating Family Lines.................
    "; + $last_mod = max($last_mod, $family_list['last_modified']); + + $family_line_xml = $endpoint->xml2array(PHONE_MODULES_PATH.'/endpoint/'.$brand_directory.'/'.$family_list['directory'].'/family_data.xml'); + $data =& $endpoint->db->getOne("SELECT id FROM endpointman_product_list WHERE id='".$brand_id."-".$family_line_xml['data']['id']."'", array(), DB_FETCHMODE_ASSOC); + $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); + if($data) { + $sql = "UPDATE endpointman_product_list SET short_name = '".$short_name."', long_name = '".$family_line_xml['data']['name']."', cfg_ver = '".$family_line_xml['data']['version']."', config_files='".$family_line_xml['data']['configuration_files']."', hidden = '0' WHERE id = '".$brand_id."-".$family_line_xml['data']['id']."'"; + } else { + $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('".$brand_id."-".$family_line_xml['data']['id']."', '".$brand_id."', '".$short_name."', '".$family_line_xml['data']['name']."', '".$family_line_xml['data']['directory']."', '".$family_line_xml['data']['version']."','".$family_line_xml['data']['configuration_files']."', '0')"; + } + + $endpoint->db->query($sql); + $family_line_xml['data']['model_list'] = $endpoint->fix_single_array_keys($family_line_xml['data']['model_list']); + echo "--Updating Model Lines................
    "; + foreach($family_line_xml['data']['model_list'] as $model_list) { + if(is_array($model_list['template_data']['files'])) { + $template_list = implode(",",$model_list['template_data']['files']); + } else { + $template_list = $model_list['template_data']['files']; + } + $m_data =& $endpoint->db->getOne("SELECT id FROM endpointman_model_list WHERE id='".$brand_id."-".$family_line_xml['data']['id']."-".$model_list['id']."'", array(), DB_FETCHMODE_ASSOC); + if($m_data) { + $sql = "UPDATE endpointman_model_list SET model = '".$model_list['model']."', template_list = '".$template_list."', enabled = '0', hidden = '0' WHERE id = '".$brand_id."-".$family_line_xml['data']['id']."'"; + } else { + $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('".$brand_id."-".$family_line_xml['data']['id']."-".$model_list['id']."', '".$brand_id."', '".$model_list['model']."', '".$brand_id."-".$family_line_xml['data']['id']."', '".$template_list."', '0', '0')"; + } + $endpoint->db->query($sql); + } + } -?> \ No newline at end of file + $brand_version = max($last_mod, $brand_version); + echo "Updating data.........."; + $sql = "UPDATE endpointman_brand_list SET name = '".$brand_name."', cfg_ver = '".$brand_version."', installed = 1, hidden = 0 WHERE id = ".$brand_id; + $endpoint->db->query($sql); + echo "Done!
    "; + } + break; + } +} \ No newline at end of file diff --git a/includes/template_manager.inc b/includes/template_manager.inc index fac249e2..9fd06686 100644 --- a/includes/template_manager.inc +++ b/includes/template_manager.inc @@ -1,24 +1,11 @@ getAll($sql, array(), DB_FETCHMODE_ASSOC); + $row_out = array(); foreach($template_list as $row) { $row_out[$i] = $row; $row_out[$i]['custom'] = 1; @@ -84,7 +72,8 @@ if($default_display) { $i++; } - $sql = "SELECT endpointman_product_list.* FROM endpointman_product_list, endpointman_model_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.hidden = 0 AND endpointman_model_list.enabled = 1 AND endpointman_product_list.hidden != 1 AND endpointman_product_list.cfg_dir != ''"; + $sql = "SELECT DISTINCT endpointman_product_list.* FROM endpointman_product_list, endpointman_model_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.hidden = 0 AND endpointman_model_list.enabled = 1 AND endpointman_product_list.hidden != 1 AND endpointman_product_list.cfg_dir != ''"; + $template_list =& $db->getAll($sql, array(), DB_FETCHMODE_ASSOC); $i = 1; $class_row[0]['value'] = 0; @@ -103,4 +92,3 @@ if($default_display) { $tpl->assign("message", $message); echo $tpl->draw( 'template_manager' ); } -?> diff --git a/includes/update_check.php b/includes/update_check.php index d0da899c..8b709c50 100644 --- a/includes/update_check.php +++ b/includes/update_check.php @@ -1,4 +1,11 @@ \ No newline at end of file + * + */ \ No newline at end of file diff --git a/install.php b/install.php index b0b18330..882c63a1 100644 --- a/install.php +++ b/install.php @@ -19,23 +19,17 @@ http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ -require dirname($_SERVER["SCRIPT_FILENAME"]). "/modules/endpointman/includes/functions.inc"; - -global $endpoint; - -$endpoint = new endpointmanager(); - if (! function_exists("out")) { - function out($text) { - echo $text."
    "; - } + function out($text) { + echo $text."
    "; + } } if (! function_exists("outn")) { - function outn($text) { - echo $text; - } + function outn($text) { + echo $text; + } } global $db; @@ -46,100 +40,110 @@ function outn($text) { mkdir(PHONE_MODULES_PATH, 0777); //Detect Version -if($endpoint->table_exists("endpointman_global_vars")) { - $sql = "SELECT var_name, value FROM endpointman_global_vars"; +function ep_table_exists ($table) { + $sql = "SHOW TABLES FROM asterisk"; + $result = $this->db->getAll($sql); + + foreach($result as $row) { + if ($row[0] == $table) { + return TRUE; + } + } + return FALSE; +} - $result = $db->query($sql); +$version = "2.2.0"; - //$result = mysql_query("SELECT var_name, value FROM endpointman_global_vars"); - while ($row =& $result->fetchRow(DB_FETCHMODE_ASSOC)) { - $global_cfg[$row['var_name']] = $row['value']; - } +if(ep_table_exists("endpointman_global_vars")) { + $global_cfg =& $db->getAssoc("SELECT var_name, value FROM endpointman_global_vars"); } else { - $global_cfg['version'] = '?'; + $global_cfg['version'] = '?'; } -if(!isset($global_cfg['version'])){ - $ver = "1.0.3"; +if(!isset($global_cfg['version'])) { + $ver = "1.0.3"; } elseif($global_cfg['version'] == '2.0') { - $ver = "1.9.0"; + $ver = "1.9.0"; } elseif($global_cfg['version'] == '1.9.1') { - $ver = "1.9.1"; + $ver = "1.9.1"; } elseif($global_cfg['version'] == '1.9.2') { - $ver = "1.9.2"; + $ver = "1.9.2"; } elseif($global_cfg['version'] == '1.9.3') { - $ver = "1.9.3"; + $ver = "1.9.3"; } elseif($global_cfg['version'] == '1.9.4') { - $ver = "1.9.4"; + $ver = "1.9.4"; } elseif($global_cfg['version'] == '1.9.5') { - $ver = "1.9.5"; + $ver = "1.9.5"; } elseif($global_cfg['version'] == '1.9.6') { - $ver = "1.9.6"; + $ver = "1.9.6"; } elseif($global_cfg['version'] == '1.9.7') { - $ver = "1.9.7"; + $ver = "1.9.7"; } elseif($global_cfg['version'] == '1.9.8') { - $ver = "1.9.8"; + $ver = "1.9.8"; } elseif($global_cfg['version'] == '1.9.9') { - $ver = "1.9.9"; + $ver = "1.9.9"; } elseif($global_cfg['version'] == '2.0.0') { - $ver = "2.0.0"; + $ver = "2.0.0"; +} elseif($global_cfg['version'] == '2.2.0') { + $ver = "2.2.0"; } else { - $ver = "?"; + $ver = "?"; } +$ver = (float) $ver; + out('Version Identified as '. $ver); -//Done, Run Update Scripts -If ($ver < "1.9.0") { - //Run updates from 1.x releases to 2.x releases - out("Please Wait While we upgrade your old setup"); - //Expand the value option - $sql = 'ALTER TABLE `endpointman_global_vars` CHANGE `value` `value` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT \'Data\''; - $db->query($sql); - - out("Locating NMAP + ARP + ASTERISK Executables"); - - $nmap = $endpoint->find_exec("nmap"); - $arp = $endpoint->find_exec("arp"); - $asterisk = $endpoint->find_exec("asterisk"); - - out("Updating Global Variables table"); - //Add new Vars into database - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES +if($ver < "1.9.0") { + out("Please Wait While we upgrade your old setup"); + //Expand the value option + $sql = 'ALTER TABLE `endpointman_global_vars` CHANGE `value` `value` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT \'Data\''; + $db->query($sql); + + out("Locating NMAP + ARP + ASTERISK Executables"); + + $nmap = $endpoint->find_exec("nmap"); + $arp = $endpoint->find_exec("arp"); + $asterisk = $endpoint->find_exec("asterisk"); + + out("Updating Global Variables table"); + //Add new Vars into database + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (5, 'config_location', '/tftpboot/'), - (6, 'update_server', 'http://www.the159.com/endpoint/'), + (6, 'update_server', 'http://www.provisioner.net/release/'), (7, 'version', '2.0.0'), (8, 'enable_ari', '0'), (9, 'debug', '0'), (10, 'arp_location', '".$arp."'), (11, 'nmap_location', '".$nmap."'), - (12, 'asterisk_location', '".$asterisk."')"; - $db->query($sql_update_vars); - - define("UPDATE_PATH", 'http://www.the159.com/endpoint/'); - define("VER", '2.0.0'); - - out("Updating Mac List table"); - $sql = 'ALTER TABLE `endpointman_mac_list` DROP `map`'; - $db->query($sql); - - $sql = 'ALTER TABLE `endpointman_mac_list` ADD `custom_cfg_template` INT(11) NOT NULL AFTER `description`'; - $db->query($sql); - - $sql = 'ALTER TABLE `endpointman_mac_list` ADD `custom_cfg_data` TEXT NOT NULL AFTER `custom_cfg_template`'; - $db->query($sql); - - $sql = 'ALTER TABLE `endpointman_mac_list` ADD `user_cfg_data` TEXT NOT NULL AFTER `custom_cfg_data`'; - $db->query($sql); - - $sql = 'ALTER TABLE `endpointman_mac_list` ADD `config_files_override` TEXT NOT NULL AFTER `user_cfg_data`'; - $db->query($sql); - - out("Updating Brands table"); - $sql = 'DROP TABLE endpointman_brand_list'; - $db->query($sql); - - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_brand_list` ( + (12, 'asterisk_location', '".$asterisk."'), + (13, 'language', ''), + (14, 'check_updates', '1'), + (15, 'disable_htaccess', ''), + (16, 'endpoint_vers', '0')"; + $db->query($sql_update_vars); + + out("Updating Mac List table"); + $sql = 'ALTER TABLE `endpointman_mac_list` DROP `map`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `custom_cfg_template` INT(11) NOT NULL AFTER `description`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `custom_cfg_data` TEXT NOT NULL AFTER `custom_cfg_template`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `user_cfg_data` TEXT NOT NULL AFTER `custom_cfg_data`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `config_files_override` TEXT NOT NULL AFTER `user_cfg_data`'; + $db->query($sql); + + out("Updating Brands table"); + $sql = 'DROP TABLE endpointman_brand_list'; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_brand_list` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `directory` varchar(255) NOT NULL, @@ -148,13 +152,13 @@ function outn($text) { `hidden` int(1) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=22"; - $db->query($sql); - - out("Updating Models table"); - $sql = 'DROP TABLE endpointman_model_list'; - $db->query($sql); - - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_model_list` ( + $db->query($sql); + + out("Updating Models table"); + $sql = 'DROP TABLE endpointman_model_list'; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_model_list` ( `id` int(11) NOT NULL auto_increment COMMENT 'Key ', `brand` int(11) NOT NULL COMMENT 'Brand', `model` varchar(25) NOT NULL COMMENT 'Model', @@ -163,27 +167,27 @@ function outn($text) { `hidden` int(1) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=48"; - $db->query($sql); - - out("Updating OUI table"); - - $sql = 'DROP TABLE endpointman_oui_list'; - $db->query($sql); - - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_oui_list` ( + $db->query($sql); + + out("Updating OUI table"); + + $sql = 'DROP TABLE endpointman_oui_list'; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_oui_list` ( `id` int(30) NOT NULL auto_increment, `oui` varchar(30) default NULL, `brand` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=57"; - $db->query($sql); - - out("Updating Products table"); - - $sql = 'DROP TABLE IF EXISTS endpointman_product_list'; - $db->query($sql); - - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_product_list` ( + $db->query($sql); + + out("Updating Products table"); + + $sql = 'DROP TABLE IF EXISTS endpointman_product_list'; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_product_list` ( `id` int(11) NOT NULL auto_increment, `brand` int(11) NOT NULL, `long_name` varchar(255) NOT NULL, @@ -198,14 +202,14 @@ function outn($text) { `config_files` text, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8"; - $db->query($sql); - - out("Updating templates table"); - - $sql = 'DROP TABLE IF EXISTS endpointman_template_list'; - $db->query($sql); - - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_template_list` ( + $db->query($sql); + + out("Updating templates table"); + + $sql = 'DROP TABLE IF EXISTS endpointman_template_list'; + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_template_list` ( `id` int(11) NOT NULL auto_increment, `product_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, @@ -213,9 +217,9 @@ function outn($text) { `config_files_override` text, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8"; - $db->query($sql); - - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( + $db->query($sql); + + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `original_name` varchar(255) NOT NULL, @@ -223,106 +227,104 @@ function outn($text) { `data` longtext NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11"; - $db->query($sql); - - $old_models = array( - "57iCT" => array("brand" => 1, "model" => 2, "product" => 7), - "57i" => array("brand" => 1, "model" => 3, "product" => 7), - "330" => array("brand" => 4, "model" => 6, "product" => 4), - "560" => array("brand" => 4, "model" => 7, "product" => 4), - "300" => array("brand" => 6, "model" => 8, "product" => 8), - "320" => array("brand" => 6, "model" => 9, "product" => 8), - "360" => array("brand" => 6, "model" => 10, "product" => 8), - "370" => array("brand" => 6, "model" => 11, "product" => 8), - "820" => array("brand" => 6, "model" => 12, "product" => 8), - "M3" => array("brand" => 6, "model" => 13, "product" => 8), - "GXP-2000" => array("brand" => 2, "model" => 15, "product" => 1), - "BT200_201" => array("brand" => 2, "model" => 27, "product" => 2), - "spa941" => array("brand" => 0, "model" => 0, "product" => 0), - "spa942" => array("brand" => 0, "model" => 0, "product" => 0), - "spa962" => array("brand" => 0, "model" => 0, "product" => 0), - "55i" => array("brand" => 1, "model" => 4, "product" => 7) - ); - - out("Migrating Old Devices"); - $sql = "SELECT * FROM endpointman_mac_list"; - $result = $db->query($sql); - while($row =& $result->fetchRow(DB_FETCHMODE_ASSOC)) { - $id = $row['model']; - $new_model = $old_models[$id]['model']; - $sql = "UPDATE endpointman_mac_list SET model = ".$new_model." WHERE id =" . $row['id']; - $db->query($sql); - } - out("Old Devices Migrated, You must install the phone modules from within endpointmanager to see your old devices!"); - - $sql = 'ALTER TABLE endpointman_mac_list CHANGE model model INT NOT NULL'; - $db->query($sql); - - $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; - $db->query($sql); - - out("DONE! You can now use endpoint manager!"); - - -} elseif ($ver == "1.9.0") { - - - out("Locating NMAP + ARP + ASTERISK Executables"); - - $nmap = $endpoint->find_exec("nmap"); - $arp = $endpoint->find_exec("arp"); - $asterisk = $endpoint->find_exec("asterisk"); - - out("Updating Global Variables table"); - //Add new Vars into database - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (8, 'enable_ari', '0')"; - $db->query($sql_update_vars); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (9, 'debug', '0')"; - $db->query($sql_update_vars); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '".$arp."')"; - $db->query($sql_update_vars); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; - $db->query($sql_update_vars); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; - $db->query($sql_update_vars); - - out("Updating Mac List Table"); - $sql = 'ALTER TABLE `endpointman_mac_list` ADD `user_cfg_data` TEXT NOT NULL AFTER `custom_cfg_data`'; - $db->query($sql); - - $sql = 'ALTER TABLE `endpointman_mac_list` ADD `config_files_override` TEXT NOT NULL AFTER `user_cfg_data`'; - $db->query($sql); - - out("Updating OUI Table"); - $sql = 'ALTER TABLE `endpointman_oui_list` DROP model'; - $db->query($sql); - - $sql = 'ALTER TABLE `endpointman_oui_list` CHANGE `brand` `brand` INT( 11 ) NULL DEFAULT NULL'; - $db->query($sql); - - out("Updating Product List"); - $sql = 'ALTER TABLE `endpointman_product_list` ADD `firmware_vers` TEXT NULL AFTER `hidden`'; - $db->query($sql); - - $sql = 'ALTER TABLE `endpointman_product_list` ADD `firmware_files` VARCHAR( 255 ) NOT NULL AFTER `firmware_vers`'; - $db->query($sql); - - $sql = 'ALTER TABLE `endpointman_product_list` ADD `config_files_override` TEXT NULL AFTER `firmware_files`'; - $db->query($sql); - - out("Updating Template List"); - $sql = 'ALTER TABLE `endpointman_template_list` ADD `config_files_override` TEXT NULL AFTER `custom_cfg_data`'; - - out("Updating Version Number"); - $sql = "UPDATE endpointman_global_vars SET value = '2.0.0' WHERE var_name = 'version'"; - - out("Creating Custom Configs Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( + $db->query($sql); + + $old_models = array( + "57iCT" => array("brand" => 1, "model" => 2, "product" => 7), + "57i" => array("brand" => 1, "model" => 3, "product" => 7), + "330" => array("brand" => 4, "model" => 6, "product" => 4), + "560" => array("brand" => 4, "model" => 7, "product" => 4), + "300" => array("brand" => 6, "model" => 8, "product" => 8), + "320" => array("brand" => 6, "model" => 9, "product" => 8), + "360" => array("brand" => 6, "model" => 10, "product" => 8), + "370" => array("brand" => 6, "model" => 11, "product" => 8), + "820" => array("brand" => 6, "model" => 12, "product" => 8), + "M3" => array("brand" => 6, "model" => 13, "product" => 8), + "GXP-2000" => array("brand" => 2, "model" => 15, "product" => 1), + "BT200_201" => array("brand" => 2, "model" => 27, "product" => 2), + "spa941" => array("brand" => 0, "model" => 0, "product" => 0), + "spa942" => array("brand" => 0, "model" => 0, "product" => 0), + "spa962" => array("brand" => 0, "model" => 0, "product" => 0), + "55i" => array("brand" => 1, "model" => 4, "product" => 7) + ); + + out("Migrating Old Devices"); + $sql = "SELECT * FROM endpointman_mac_list"; + $result = $db->query($sql); + while($row =& $result->fetchRow(DB_FETCHMODE_ASSOC)) { + $id = $row['model']; + $new_model = $old_models[$id]['model']; + $sql = "UPDATE endpointman_mac_list SET model = ".$new_model." WHERE id =" . $row['id']; + $db->query($sql); + } + out("Old Devices Migrated, You must install the phone modules from within endpointmanager to see your old devices!"); + + $sql = 'ALTER TABLE endpointman_mac_list CHANGE model model INT NOT NULL'; + $db->query($sql); + + $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; + $db->query($sql); + + out("DONE! You can now use endpoint manager!"); +} + +if ($ver <= "1.9.0") { + out("Locating NMAP + ARP + ASTERISK Executables"); + + $nmap = $endpoint->find_exec("nmap"); + $arp = $endpoint->find_exec("arp"); + $asterisk = $endpoint->find_exec("asterisk"); + + out("Updating Global Variables table"); + //Add new Vars into database + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (8, 'enable_ari', '0')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (9, 'debug', '0')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '".$arp."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; + $db->query($sql_update_vars); + + out("Updating Mac List Table"); + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `user_cfg_data` TEXT NOT NULL AFTER `custom_cfg_data`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `config_files_override` TEXT NOT NULL AFTER `user_cfg_data`'; + $db->query($sql); + + out("Updating OUI Table"); + $sql = 'ALTER TABLE `endpointman_oui_list` DROP model'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_oui_list` CHANGE `brand` `brand` INT( 11 ) NULL DEFAULT NULL'; + $db->query($sql); + + out("Updating Product List"); + $sql = 'ALTER TABLE `endpointman_product_list` ADD `firmware_vers` TEXT NULL AFTER `hidden`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_product_list` ADD `firmware_files` VARCHAR( 255 ) NOT NULL AFTER `firmware_vers`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_product_list` ADD `config_files_override` TEXT NULL AFTER `firmware_files`'; + $db->query($sql); + + out("Updating Template List"); + $sql = 'ALTER TABLE `endpointman_template_list` ADD `config_files_override` TEXT NULL AFTER `custom_cfg_data`'; + + out("Updating Version Number"); + $sql = "UPDATE endpointman_global_vars SET value = '2.0.0' WHERE var_name = 'version'"; + + out("Creating Custom Configs Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `original_name` varchar(255) NOT NULL, @@ -330,15 +332,15 @@ function outn($text) { `data` longtext NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11"; - $db->query($sql); - - out('Alter custom_cfg_data'); - $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; - $db->query($sql); - -} elseif($ver == "1.9.1") { - out("Create Custom Configs Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( + $db->query($sql); + + out('Alter custom_cfg_data'); + $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; + $db->query($sql); +} +if ($ver <= "1.9.1") { + out("Create Custom Configs Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `original_name` varchar(255) NOT NULL, @@ -346,235 +348,403 @@ function outn($text) { `data` longtext NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11"; - $db->query($sql); - - out("Locating NMAP + ARP + ASTERISK Executables"); - - $nmap = $endpoint->find_exec("nmap"); - $arp = $endpoint->find_exec("arp"); - $asterisk = $endpoint->find_exec("asterisk"); - - out('Updating Global Variables'); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (8, 'enable_ari', '0')"; - $db->query($sql_update_vars); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (9, 'debug', '0')"; - $db->query($sql_update_vars); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '".$arp."')"; - $db->query($sql_update_vars); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; - $db->query($sql_update_vars); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; - $db->query($sql_update_vars); - - out("Update Mac List Table"); - $sql = 'ALTER TABLE `endpointman_mac_list` ADD `config_files_override` TEXT NOT NULL AFTER `user_cfg_data`'; - $db->query($sql); - - out("Update Product List Table"); - $sql = 'ALTER TABLE `endpointman_product_list` ADD `config_files` TEXT NOT NULL AFTER `firmware_files`'; - $db->query($sql); - - out("Update Template List Table"); - $sql = 'ALTER TABLE `endpointman_template_list` ADD `config_files_override` TEXT NOT NULL AFTER `custom_cfg_data`'; - $db->query($sql); - - out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; - $db->query($sql); - - out('Alter custom_cfg_data'); - $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; - $db->query($sql); - -} elseif($ver == "1.9.2") { - - out("Locating NMAP + ARP + ASTERISK Executables"); - - $nmap = $endpoint->find_exec("nmap"); - $arp = $endpoint->find_exec("arp"); - $asterisk = $endpoint->find_exec("asterisk"); - - out('Updating Global Variables'); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '".$arp."')"; - $db->query($sql_update_vars); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; - $db->query($sql_update_vars); - - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; - $db->query($sql_update_vars); - - out('Alter custom_cfg_data'); - $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; - $db->query($sql); - - out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; - $db->query($sql); - -} elseif($ver == "1.9.3") { - out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; - $db->query($sql); -} elseif($ver == "1.9.4") { - out("Your Database is already up to date!"); - out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; - $db->query($sql); -} elseif($ver == "1.9.5") { - out("Your Database is already up to date!"); - out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; - $db->query($sql); -} elseif($ver == "1.9.6") { - out("Your Database is already up to date!"); - out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; - $db->query($sql); -} elseif($ver == "1.9.7") { - out("Your Database is already up to date!"); - out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; - $db->query($sql); -} elseif($ver == "1.9.8") { - out("Your Database is already up to date!"); - out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; - $db->query($sql); -} elseif($ver == "1.9.9") { - out("Your Database is already up to date!"); - out("Update Version Number"); - $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; - $db->query($sql); -} elseif($ver == "2.0.0") { - out("Your Database is already up to date!"); -} else { - out("Creating Brand List Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_brand_list` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(255) NOT NULL, - `directory` varchar(255) NOT NULL, - `cfg_ver` varchar(255) NOT NULL, - `installed` int(1) NOT NULL default '0', - `hidden` int(1) NOT NULL default '0', - PRIMARY KEY (`id`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=22"; - $db->query($sql); - - out("Creating Global Variables Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_global_vars` ( - `idnum` int(11) NOT NULL auto_increment COMMENT 'Index', - `var_name` varchar(25) NOT NULL COMMENT 'Variable Name', - `value` varchar(100) NOT NULL COMMENT 'Data', - PRIMARY KEY (`idnum`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10"; - $db->query($sql); - - out("Locating NMAP + ARP + ASTERISK Executables"); - $nmap = $endpoint->find_exec("nmap"); - $arp = $endpoint->find_exec("arp"); - $asterisk = $endpoint->find_exec("asterisk"); - - out("Inserting data into the global vars Table"); - $sql = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES - (1, 'srvip', ''), - (2, 'tz', ''), - (3, 'gmtoff', ''), - (4, 'gmthr', ''), - (5, 'config_location', '/tftpboot/'), - (6, 'update_server', 'http://www.the159.com/endpoint/'), - (7, 'version', '2.0.0'), - (8, 'enable_ari', '0'), - (9, 'debug', '0'), - (10, 'arp_location', '".$arp."'), - (11, 'nmap_location', '".$nmap."'), - (12, 'asterisk_location', '".$asterisk."')"; - $db->query($sql); - - out("Creating mac list Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_mac_list` ( - `id` int(10) NOT NULL auto_increment, - `mac` varchar(12) default NULL, - `model` int(11) NOT NULL, - `ext` varchar(15) default 'Not Assigned', - `description` varchar(20) default NULL, - `custom_cfg_template` int(11) NOT NULL, - `custom_cfg_data` text NOT NULL, - `user_cfg_data` text NOT NULL, - `config_files_override` text NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `mac` (`mac`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=324"; - $db->query($sql); - - out("Creating model List Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_model_list` ( - `id` int(11) NOT NULL auto_increment COMMENT 'Key ', - `brand` int(11) NOT NULL COMMENT 'Brand', - `model` varchar(25) NOT NULL COMMENT 'Model', - `product_id` int(11) NOT NULL, - `enabled` int(1) NOT NULL default '0', - `hidden` int(1) NOT NULL default '0', - PRIMARY KEY (`id`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=60"; - $db->query($sql); - - out("Creating oui List Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_oui_list` ( - `id` int(30) NOT NULL auto_increment, - `oui` varchar(30) default NULL, - `brand` int(11) NOT NULL, - PRIMARY KEY (`id`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=82"; - $db->query($sql); + $db->query($sql); - out("Creating product List Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_product_list` ( - `id` int(11) NOT NULL auto_increment, - `brand` int(11) NOT NULL, - `long_name` varchar(255) NOT NULL, - `cfg_dir` varchar(255) NOT NULL, - `cfg_ver` varchar(255) NOT NULL, - `xml_data` varchar(255) NOT NULL, - `cfg_data` text NOT NULL, - `installed` int(1) NOT NULL default '0', - `hidden` int(1) NOT NULL default '0', - `firmware_vers` varchar(255) NOT NULL, - `firmware_files` text NOT NULL, - `config_files` text, - PRIMARY KEY (`id`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10"; - $db->query($sql); + out("Locating NMAP + ARP + ASTERISK Executables"); - out("Creating Template List Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_template_list` ( - `id` int(11) NOT NULL auto_increment, - `product_id` int(11) NOT NULL, - `name` varchar(255) NOT NULL, - `custom_cfg_data` text, - `config_files_override` text, - PRIMARY KEY (`id`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=23"; - $db->query($sql); + $nmap = $endpoint->find_exec("nmap"); + $arp = $endpoint->find_exec("arp"); + $asterisk = $endpoint->find_exec("asterisk"); + + out('Updating Global Variables'); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (8, 'enable_ari', '0')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (9, 'debug', '0')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '".$arp."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; + $db->query($sql_update_vars); + + out("Update Mac List Table"); + $sql = 'ALTER TABLE `endpointman_mac_list` ADD `config_files_override` TEXT NOT NULL AFTER `user_cfg_data`'; + $db->query($sql); + + out("Update Product List Table"); + $sql = 'ALTER TABLE `endpointman_product_list` ADD `config_files` TEXT NOT NULL AFTER `firmware_files`'; + $db->query($sql); + + out("Update Template List Table"); + $sql = 'ALTER TABLE `endpointman_template_list` ADD `config_files_override` TEXT NOT NULL AFTER `custom_cfg_data`'; + $db->query($sql); + + out("Update Version Number"); + $sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; + $db->query($sql); + + out('Alter custom_cfg_data'); + $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; + $db->query($sql); +} + if ($ver <= "1.9.2") { + out('Updating Global Variables'); + } + +if ($ver <= "1.9.9") { + out("Adding Custom Field to OUI List"); + $sql = 'ALTER TABLE `endpointman_oui_list` ADD `custom` INT(1) NOT NULL DEFAULT \'0\''; + $db->query($sql); + + out("Increase value Size in global Variables Table"); + $sql = 'ALTER TABLE `endpointman_global_vars` CHANGE `value` `value` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT \'Data\''; + $db->query($sql); + + out("Update global variables to include future language support"); + $sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (\'13\', \'temp_amp\', \'\');'; + $db->query($sql); + + $sql = "UPDATE endpointman_global_vars SET var_name = 'language' WHERE var_name = 'temp_amp'"; + $db->query($sql); + + out("Changing all 'LONG TEXT' or 'TEXT' to 'BLOB'"); + $sql = 'ALTER TABLE `endpointman_product_list` CHANGE `cfg_data` `cfg_data` BLOB NOT NULL'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_template_list` CHANGE `custom_cfg_data` `custom_cfg_data` BLOB NULL DEFAULT NULL'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `custom_cfg_data` `custom_cfg_data` BLOB NOT NULL, CHANGE `user_cfg_data` `user_cfg_data` BLOB NOT NULL'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_custom_configs` CHANGE `data` `data` BLOB NOT NULL'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_product_list` ADD `special_cfgs` BLOB NOT NULL;'; + $db->query($sql); + + out("Inserting Check for Updates Command"); + $sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (\'14\', \'check_updates\', \'1\');'; + $db->query($sql); + + out("Inserting Disable .htaccess command"); + $sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (\'15\', \'disable_htaccess\', \'0\');'; + $db->query($sql); + + out("Add Automatic Update Check [Can be Disabled]"); + $sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php ".LOCAL_PATH. "includes/update_check.php')"; + $db->query($sql); +} +if($ver <= "2.0.0") { + if(file_exists($amp_conf['AMPWEBROOT']."/recordings")) { + out("Installing ARI Module"); + copy(LOCAL_PATH. "Install/phonesettings.module", $amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); - out("Creating Time Zone List Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_time_zones` ( + copy(LOCAL_PATH. "templates/javascript/jquery.coda-slider-2.0.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js"); + + copy(LOCAL_PATH. "templates/javascript/jquery.easing.1.3.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js"); + + copy(LOCAL_PATH. "templates/stylesheets/coda-slider-2.0a.css", $amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css"); + + + out("Fixing permissions on ARI module"); + chmod($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module", 0664); + } + + out("Locating NMAP + ARP + ASTERISK Executables"); + $nmap = $endpoint->find_exec("nmap"); + $arp = $endpoint->find_exec("arp"); + $asterisk = $endpoint->find_exec("asterisk"); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$asterisk."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; + $db->query($sql_update_vars); + + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; + $db->query($sql_update_vars); + + out("Add Unique to Global Variables Table"); + $sql = 'ALTER TABLE `endpointman_global_vars` ADD UNIQUE(`var_name`)'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_custom_configs` CHANGE `product_id` `product_id` VARCHAR(11) NOT NULL'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `model` `model` VARCHAR(11) NOT NULL'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_model_list` ADD `template_list` TEXT NOT NULL AFTER `model`, ADD `template_data` BLOB NOT NULL AFTER `template_list`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_model_list` CHANGE `product_id` `product_id` VARCHAR(11) NOT NULL'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_model_list` CHANGE `id` `id` VARCHAR(11) NOT NULL COMMENT \'Key \''; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_product_list` CHANGE `id` `id` VARCHAR(11) NOT NULL'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_product_list` ADD `short_name` VARCHAR(255) NOT NULL AFTER `long_name`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_product_list` DROP `installed`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_product_list` DROP `xml_data`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_template_list` ADD `model_id` VARCHAR(10) NOT NULL AFTER `product_id`'; + $db->query($sql); + + $sql = 'ALTER TABLE `endpointman_template_list` CHANGE `product_id` `product_id` VARCHAR(11) NOT NULL'; + $db->query($sql); + + $sql = "UPDATE endpointman_brand_list SET cfg_ver = '0', installed = '0' WHERE installed = '1'"; + $db->query($sql); + + $sql = "TRUNCATE TABLE `endpointman_product_list`"; + $db->query($sql); + + $sql = "TRUNCATE TABLE `endpointman_oui_list`"; + $db->query($sql); + + $sql = "TRUNCATE TABLE `endpointman_brand_list`"; + $db->query($sql); + + $sql = "TRUNCATE TABLE `endpointman_model_list`"; + $db->query($sql); + + $data =& $db->getAll("SELECT * FROM `endpointman_mac_list",array(), DB_FETCHMODE_ASSOC); + + $new_model_list = array( + "2" => "1-2-11", + "3" => "1-2-10", + "4" => "1-2-9", + "6" => "", + "7" => "", + "8" => "6-1-1", + "9" => "6-1-2", + "10" => "6-1-3", + "11" => "6-1-4", + "12" => "6-1-5", + "13" => "6-1-6", + "15" => "2-1-3", + "22" => "", + "23" => "2-1-2", + "24" => "2-1-1", + "25" => "2-1-4", + "26" => "2-1-5", + "27" => "2-2-1", + "28" => "2-2-2", + "29" => "", + "30" => "", + "31" => "", + "32" => "", + "33" => "", + "34" => "4-3-1", + "35" => "4-3-2", + "36" => "4-3-3", + "37" => "4-3-4", + "38" => "4-3-5", + "39" => "4-3-6", + "40" => "4-3-8", + "41" => "4-3-9", + "42" => "4-3-10", + "43" => "4-3-11", + "44" => "4-3-12", + "45" => "", + "46" => "", + "47" => "1-2-1", + "48" => "1-2-2", + "49" => "1-1-1", + "50" => "1-1-2", + "51" => "1-2-3", + "52" => "1-2-4", + "53" => "1-2-5", + "54" => "1-2-6", + "55" => "1-2-7", + "56" => "1-2-8", + "57" => "", + "58" => "", + "59" => "", + "60" => "7-1-1", + "61" => "7-1-2", + "62" => "8-1-1", + "63" => "8-1-2", + "64" => "8-1-3", + "65" => "8-1-4", + "67" => "7-2-1", + "68" => "7-2-2", + "69" => "7-2-3", + "70" => "7-2-4", + "71" => "7-2-5", + "72" => "7-2-6" + ); + + $new_product_list = array( + "6" => "1-1", + "7" => "1-2", + "1" => "2-1", + "2" => "2-2", + "3" => "", + "5" => "", + "4" => "4-3", + "8" => "6-1", + "9" => "7-1", + "11" => "7-2", + "10" => "8-1" + ); + + foreach($data as $list) { + + $sql = "UPDATE endpointman_mac_list SET model = '".$new_model_list[$list['model']]."' WHERE id = ". $list['id']; + $db->query($sql); + } + + out("Update Version Number"); + $sql = "UPDATE endpointman_global_vars SET value = '".$version."' WHERE var_name = 'version'"; + $db->query($sql); +} + +if ($ver == "?") { + + out("Creating Brand List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_brand_list` ( + `id` varchar(11) NOT NULL, + `name` varchar(255) NOT NULL, + `directory` varchar(255) NOT NULL, + `cfg_ver` varchar(255) NOT NULL, + `installed` int(1) NOT NULL DEFAULT '0', + `hidden` int(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1"; + $db->query($sql); + + out("Creating Global Variables Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_global_vars` ( + `idnum` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Index', + `var_name` varchar(25) NOT NULL COMMENT 'Variable Name', + `value` text NOT NULL COMMENT 'Data', + PRIMARY KEY (`idnum`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=17"; + $db->query($sql); + + out("Locating NMAP + ARP + ASTERISK Executables"); + $nmap = $endpoint->find_exec("nmap"); + $arp = $endpoint->find_exec("arp"); + $asterisk = $endpoint->find_exec("asterisk"); + + out("Inserting data into the global vars Table"); + $sql = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES + (1, 'srvip', ''), + (2, 'tz', ''), + (3, 'gmtoff', ''), + (4, 'gmthr', ''), + (5, 'config_location', '/tftpboot/'), + (6, 'update_server', 'http://www.provisioner.net/release/'), + (7, 'version', '".$version."'), + (8, 'enable_ari', '1'), + (9, 'debug', '1'), + (10, 'arp_location', '".$arp."'), + (11, 'nmap_location', '".$nmap."'), + (12, 'asterisk_location', '".$asterisk."') + (13, 'language', ''), + (14, 'check_updates', '1'), + (15, 'disable_htaccess', ''), + (16, 'endpoint_vers', '0')"; + $db->query($sql); + + out("Creating mac list Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_mac_list` ( + `id` int(10) NOT NULL AUTO_INCREMENT, + `mac` varchar(12) DEFAULT NULL, + `model` varchar(11) NOT NULL, + `ext` varchar(15) DEFAULT 'Not Assigned', + `description` varchar(20) DEFAULT NULL, + `custom_cfg_template` int(11) NOT NULL, + `custom_cfg_data` blob NOT NULL, + `user_cfg_data` blob NOT NULL, + `config_files_override` text NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `mac` (`mac`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; + $db->query($sql); + + out("Creating model List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_model_list` ( + `id` varchar(11) NOT NULL COMMENT 'Key ', + `brand` int(11) NOT NULL COMMENT 'Brand', + `model` varchar(25) NOT NULL COMMENT 'Model', + `template_list` text NOT NULL, + `template_data` blob NOT NULL, + `product_id` varchar(11) NOT NULL, + `enabled` int(1) NOT NULL DEFAULT '0', + `hidden` int(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1"; + $db->query($sql); + + out("Creating oui List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_oui_list` ( + `id` int(30) NOT NULL AUTO_INCREMENT, + `oui` varchar(30) DEFAULT NULL, + `brand` int(11) NOT NULL, + `custom` int(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `oui` (`oui`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; + $db->query($sql); + + out("Creating product List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_product_list` ( + `id` varchar(11) NOT NULL, + `brand` int(11) NOT NULL, + `long_name` varchar(255) NOT NULL, + `short_name` varchar(255) NOT NULL, + `cfg_dir` varchar(255) NOT NULL, + `cfg_ver` varchar(255) NOT NULL, + `hidden` int(1) NOT NULL DEFAULT '0', + `firmware_vers` varchar(255) NOT NULL, + `firmware_files` text NOT NULL, + `config_files` text, + `special_cfgs` blob NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1;"; + $db->query($sql); + + out("Creating Template List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_template_list` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `product_id` varchar(11) NOT NULL, + `model_id` varchar(10) NOT NULL, + `name` varchar(255) NOT NULL, + `custom_cfg_data` blob, + `config_files_override` text, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; + $db->query($sql); + + out("Creating Time Zone List Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_time_zones` ( `idnum` int(11) NOT NULL auto_increment COMMENT 'Record Number', `tz` varchar(10) NOT NULL COMMENT 'Time Zone', `gmtoff` varchar(10) NOT NULL COMMENT 'Offset in Seconds', `gmthr` varchar(10) NOT NULL, PRIMARY KEY (`idnum`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=116"; - $db->query($sql); + $db->query($sql); - out("Inserting Data into table Table"); - $sql = "INSERT INTO `endpointman_time_zones` (`idnum`, `tz`, `gmtoff`, `gmthr`) VALUES + out("Inserting Data into table Table"); + $sql = "INSERT INTO `endpointman_time_zones` (`idnum`, `tz`, `gmtoff`, `gmthr`) VALUES (1, 'USA-10', '-36000', 'GMT-10:00'), (2, 'USA-9', '-32400', 'GMT-09:00'), (3, 'CAN-8', '-28800', 'GMT-08:00'), @@ -690,90 +860,34 @@ function outn($text) { (113, 'RUS+12', '43200', 'GMT+12:00'), (114, 'NZL+12.75', '45900', 'GMT+12:00'), (115, 'TON+13', '46800', 'GMT+13:00')"; - $db->query($sql); - - out("Create Custom Configs Table"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(255) NOT NULL, - `original_name` varchar(255) NOT NULL, - `product_id` int(11) NOT NULL, - `data` longtext NOT NULL, - PRIMARY KEY (`id`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11"; - $db->query($sql); - - out('Alter custom_cfg_data'); - $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; - $db->query($sql); -} + $db->query($sql); -if(file_exists($amp_conf['AMPWEBROOT']."/recordings")) { - out("Installing ARI Module"); - copy(LOCAL_PATH. "Install/phonesettings.module", $amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); + out("Create Custom Configs Table"); + $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `original_name` varchar(255) NOT NULL, + `product_id` varchar(11) NOT NULL, + `data` blob NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; + $db->query($sql); - copy(LOCAL_PATH. "templates/javascript/jquery.coda-slider-2.0.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js"); + if(file_exists($amp_conf['AMPWEBROOT']."/recordings")) { + out("Installing ARI Module"); + copy(LOCAL_PATH. "Install/phonesettings.module", $amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); - copy(LOCAL_PATH. "templates/javascript/jquery.easing.1.3.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js"); + copy(LOCAL_PATH. "templates/javascript/jquery.coda-slider-2.0.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js"); - copy(LOCAL_PATH. "templates/stylesheets/coda-slider-2.0a.css", $amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css"); + copy(LOCAL_PATH. "templates/javascript/jquery.easing.1.3.js", $amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js"); - - out("Fixing permissions on ARI module"); - chmod($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module", 0664); -} - -out("Adding Custom Field to OUI List"); -$sql = 'ALTER TABLE `endpointman_oui_list` ADD `custom` INT(1) NOT NULL DEFAULT \'0\''; -$db->query($sql); - -out("Increase value Size in global Variables Table"); -$sql = 'ALTER TABLE `endpointman_global_vars` CHANGE `value` `value` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT \'Data\''; -$db->query($sql); - -out("Update global variables to include future language support"); -$sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (\'13\', \'temp_amp\', \'\');'; -$db->query($sql); - -$sql = "UPDATE endpointman_global_vars SET var_name = 'language' WHERE var_name = 'temp_amp'"; -$db->query($sql); - -out("Changing all 'LONG TEXT' or 'TEXT' to 'BLOB'"); -$sql = 'ALTER TABLE `endpointman_product_list` CHANGE `cfg_data` `cfg_data` BLOB NOT NULL'; -$db->query($sql); - -$sql = 'ALTER TABLE `endpointman_template_list` CHANGE `custom_cfg_data` `custom_cfg_data` BLOB NULL DEFAULT NULL'; -$db->query($sql); + copy(LOCAL_PATH. "templates/stylesheets/coda-slider-2.0a.css", $amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css"); -$sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `custom_cfg_data` `custom_cfg_data` BLOB NOT NULL, CHANGE `user_cfg_data` `user_cfg_data` BLOB NOT NULL'; -$db->query($sql); -$sql = 'ALTER TABLE `endpointman_custom_configs` CHANGE `data` `data` BLOB NOT NULL'; -$db->query($sql); - -$sql = 'ALTER TABLE `endpointman_product_list` ADD `special_cfgs` BLOB NOT NULL;'; -$db->query($sql); - -out("Inserting Check for Updates Command"); -$sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (\'14\', \'check_updates\', \'1\');'; -$db->query($sql); - -out("Inserting Disable .htaccess command"); -$sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (\'15\', \'disable_htaccess\', \'0\');'; -$db->query($sql); - -out("Add Automatic Update Check [Can be Disabled]"); -$sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php ".LOCAL_PATH. "includes/update_check.php')"; -$db->query($sql); - -$arp = $endpoint->find_exec("arp"); - -out("Finding ARP again"); -$sql = "UPDATE endpointman_global_vars SET value = '".$arp."' WHERE var_name = 'arp_location'"; -$db->query($sql); + out("Fixing permissions on ARI module"); + chmod($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module", 0664); + } +} -out("Update Version Number [Yes again, just in case]"); -$sql = 'UPDATE endpointman_global_vars SET value = \'2.0.0\' WHERE var_name = "version"'; -$db->query($sql); ?> \ No newline at end of file diff --git a/page.endpointman.php b/page.endpointman.php index c8ed63ac..35676ebc 100644 --- a/page.endpointman.php +++ b/page.endpointman.php @@ -1,69 +1,5 @@ \ No newline at end of file +} \ No newline at end of file diff --git a/page.epm_advanced.php b/page.epm_advanced.php index 5ccdc367..008261ed 100644 --- a/page.epm_advanced.php +++ b/page.epm_advanced.php @@ -1,69 +1,4 @@ +include LOCAL_PATH.'includes/advanced.inc'; \ No newline at end of file diff --git a/page.epm_config.php b/page.epm_config.php index bb095b65..ff1b6d3d 100644 --- a/page.epm_config.php +++ b/page.epm_config.php @@ -1,69 +1,4 @@ +include LOCAL_PATH.'includes/brand_model_manager.inc'; \ No newline at end of file diff --git a/page.epm_devices.php b/page.epm_devices.php index a477e719..7a6988b1 100644 --- a/page.epm_devices.php +++ b/page.epm_devices.php @@ -1,69 +1,5 @@ - diff --git a/page.epm_templates.php b/page.epm_templates.php index ba0a1988..fedee9ef 100644 --- a/page.epm_templates.php +++ b/page.epm_templates.php @@ -1,69 +1,5 @@ +include LOCAL_PATH.'includes/template_manager.inc'; \ No newline at end of file diff --git a/templates/advanced_settings_manual_upload.html b/templates/advanced_settings_manual_upload.html new file mode 100755 index 00000000..6e6424e3 --- /dev/null +++ b/templates/advanced_settings_manual_upload.html @@ -0,0 +1,52 @@ +

    {$message}

    +{if condition="isset($show_installer)"} + + + + +{/if} + + Local Date Last Modified: {$provisioner_ver} +
    + + +

    +
    + Local Date Last Modified: {$master_ver} +
    + +
    +

    +
    + +
    + +
    + +
    diff --git a/templates/advanced_settings_poce.html b/templates/advanced_settings_poce.html index acf163e4..00e1990a 100644 --- a/templates/advanced_settings_poce.html +++ b/templates/advanced_settings_poce.html @@ -21,6 +21,11 @@
    +
    + {loop name="template_file_list"} + {$value.text}
    + {/loop} +

    {loop name="file_list"} {$value.text}
    @@ -41,13 +46,13 @@
    or + {if condition="!isset($temp_file)"} or + {/if}
    diff --git a/templates/advanced_settings_settings.html b/templates/advanced_settings_settings.html index d45ff529..04be4da9 100644 --- a/templates/advanced_settings_settings.html +++ b/templates/advanced_settings_settings.html @@ -49,12 +49,6 @@

    {$message}

    - - : - -
    {include="global_header"} +{include="global_header"} -

    {$error}

    diff --git a/templates/devices_manager.html b/templates/devices_manager.html index 7506247c..0de5e29b 100755 --- a/templates/devices_manager.html +++ b/templates/devices_manager.html @@ -1,13 +1,13 @@ {include="global_header"} +{if condition="isset($show_error_box)"} + {include="message_box"} +{/if}

    {$error}

    {if condition="isset($id)"} {/if}
    - {if condition="isset($message)"} -

    {$message}

    - {/if} {if condition="$no_add == FALSE"}
    + \ No newline at end of file diff --git a/templates/freepbx/alt_config_popup.html b/templates/freepbx/alt_config_popup.html index 152cc661..b1d9fa1e 100644 --- a/templates/freepbx/alt_config_popup.html +++ b/templates/freepbx/alt_config_popup.html @@ -2,6 +2,10 @@ PBX Endpoint Configuration Manager + + + + @@ -20,9 +28,9 @@


    - {if condition="isset($show_error_box)"} - {include="message_box"} - {/if} +{if condition="isset($show_error_box)"} + {include="message_box"} +{/if}

    : {$file}

    Warning! You can really mess up your phone by messing with these settings. Potentially causing it to not boot!
    {if condition="isset($location) && isset($allow_hdfiles)"} @@ -36,7 +44,7 @@


    \ No newline at end of file +

    + \ No newline at end of file diff --git a/templates/freepbx29/alt_config_popup.html b/templates/freepbx29/alt_config_popup.html index d89ccb51..b1d9fa1e 100644 --- a/templates/freepbx29/alt_config_popup.html +++ b/templates/freepbx29/alt_config_popup.html @@ -1,11 +1,12 @@ PBX Endpoint Configuration Manager - - - - - + + + + + + @@ -23,9 +28,9 @@


    - {if condition="isset($show_error_box)"} - {include="message_box"} - {/if} +{if condition="isset($show_error_box)"} + {include="message_box"} +{/if}

    : {$file}

    Warning! You can really mess up your phone by messing with these settings. Potentially causing it to not boot!
    {if condition="isset($location) && isset($allow_hdfiles)"} @@ -39,7 +44,7 @@


    \ No newline at end of file +

    + \ No newline at end of file diff --git a/templates/freepbx/alt_config_popup.html b/templates/freepbx/alt_config_popup.html index 152cc661..b1d9fa1e 100644 --- a/templates/freepbx/alt_config_popup.html +++ b/templates/freepbx/alt_config_popup.html @@ -2,6 +2,10 @@ PBX Endpoint Configuration Manager + + + + @@ -20,9 +28,9 @@


    - {if condition="isset($show_error_box)"} - {include="message_box"} - {/if} +{if condition="isset($show_error_box)"} + {include="message_box"} +{/if}

    : {$file}

    Warning! You can really mess up your phone by messing with these settings. Potentially causing it to not boot!
    {if condition="isset($location) && isset($allow_hdfiles)"} @@ -36,7 +44,7 @@


    \ No newline at end of file +

    + \ No newline at end of file diff --git a/templates/freepbx29/alt_config_popup.html b/templates/freepbx29/alt_config_popup.html index d89ccb51..b1d9fa1e 100644 --- a/templates/freepbx29/alt_config_popup.html +++ b/templates/freepbx29/alt_config_popup.html @@ -1,11 +1,12 @@ PBX Endpoint Configuration Manager - - - - - + + + + + + @@ -23,9 +28,9 @@


    - {if condition="isset($show_error_box)"} - {include="message_box"} - {/if} +{if condition="isset($show_error_box)"} + {include="message_box"} +{/if}

    : {$file}

    Warning! You can really mess up your phone by messing with these settings. Potentially causing it to not boot!
    {if condition="isset($location) && isset($allow_hdfiles)"} @@ -39,7 +44,7 @@


    ' + - '
    ' + - '
    ' + // Set to the height of the text, causes scrolling - '
    ' + - '
    ' + // Moved around its parent to cover visible view - '
    ' + - // Provides positioning relative to (visible) text origin - '
    ' + - '
     
    ' + // Absolutely positioned blinky cursor - '
    ' + // This DIV contains the actual code - '
    '; - if (place.appendChild) place.appendChild(wrapper); else place(wrapper); - // I've never seen more elegant code in my life. - var inputDiv = wrapper.firstChild, input = inputDiv.firstChild, - scroller = wrapper.lastChild, code = scroller.firstChild, - measure = code.firstChild, mover = measure.nextSibling, - gutter = mover.firstChild, gutterText = gutter.firstChild, - lineSpace = gutter.nextSibling.firstChild, - cursor = lineSpace.firstChild, lineDiv = cursor.nextSibling; - if (options.tabindex != null) input.tabindex = options.tabindex; - if (!options.gutter && !options.lineNumbers) gutter.style.display = "none"; - - // Check for problem with IE innerHTML not working when we have a - // P (or similar) parent node. - try { stringWidth("x"); } - catch (e) { - if (e.message.match(/unknown runtime/i)) - e = new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)"); - throw e; - } - - // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval. - var poll = new Delayed(), highlight = new Delayed(), blinker; - - // mode holds a mode API object. lines an array of Line objects - // (see Line constructor), work an array of lines that should be - // parsed, and history the undo history (instance of History - // constructor). - var mode, lines = [new Line("")], work, focused; - loadMode(); - // The selection. These are always maintained to point at valid - // positions. Inverted is used to remember that the user is - // selecting bottom-to-top. - var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false}; - // Selection-related flags. shiftSelecting obviously tracks - // whether the user is holding shift. reducedSelection is a hack - // to get around the fact that we can't create inverted - // selections. See below. - var shiftSelecting, reducedSelection, lastClick, lastDoubleClick, draggingText; - // Variables used by startOperation/endOperation to track what - // happened during the operation. - var updateInput, changes, textChanged, selectionChanged, leaveInputAlone, gutterDirty; - // Current visible range (may be bigger than the view window). - var showingFrom = 0, showingTo = 0, lastHeight = 0, curKeyId = null; - // editing will hold an object describing the things we put in the - // textarea, to help figure out whether something changed. - // bracketHighlighted is used to remember that a backet has been - // marked. - var editing, bracketHighlighted; - // Tracks the maximum line length so that the horizontal scrollbar - // can be kept static when scrolling. - var maxLine = "", maxWidth; - - // Initialize the content. - operation(function(){setValue(options.value || ""); updateInput = false;})(); - var history = new History(); - - // Register our event handlers. - connect(scroller, "mousedown", operation(onMouseDown)); - connect(scroller, "dblclick", operation(onDoubleClick)); - connect(lineSpace, "dragstart", onDragStart); - // Gecko browsers fire contextmenu *after* opening the menu, at - // which point we can't mess with it anymore. Context menu is - // handled in onMouseDown for Gecko. - if (!gecko) connect(scroller, "contextmenu", onContextMenu); - connect(scroller, "scroll", function() { - updateDisplay([]); - if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px"; - if (options.onScroll) options.onScroll(instance); - }); - connect(window, "resize", function() {updateDisplay(true);}); - connect(input, "keyup", operation(onKeyUp)); - connect(input, "input", function() {fastPoll(curKeyId);}); - connect(input, "keydown", operation(onKeyDown)); - connect(input, "keypress", operation(onKeyPress)); - connect(input, "focus", onFocus); - connect(input, "blur", onBlur); - - connect(scroller, "dragenter", e_stop); - connect(scroller, "dragover", e_stop); - connect(scroller, "drop", operation(onDrop)); - connect(scroller, "paste", function(){focusInput(); fastPoll();}); - connect(input, "paste", function(){fastPoll();}); - connect(input, "cut", function(){fastPoll();}); - - // IE throws unspecified error in certain cases, when - // trying to access activeElement before onload - var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { } - if (hasFocus) setTimeout(onFocus, 20); - else onBlur(); - - function isLine(l) {return l >= 0 && l < lines.length;} - // The instance object that we'll return. Mostly calls out to - // local functions in the CodeMirror function. Some do some extra - // range checking and/or clipping. operation is used to wrap the - // call so that changes it makes are tracked, and the display is - // updated afterwards. - var instance = wrapper.CodeMirror = { - getValue: getValue, - setValue: operation(setValue), - getSelection: getSelection, - replaceSelection: operation(replaceSelection), - focus: function(){focusInput(); onFocus(); fastPoll();}, - setOption: function(option, value) { - options[option] = value; - if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber") - operation(gutterChanged)(); - else if (option == "mode" || option == "indentUnit") loadMode(); - else if (option == "readOnly" && value == "nocursor") input.blur(); - else if (option == "theme") scroller.className = scroller.className.replace(/cm-s-\w+/, "cm-s-" + value); - }, - getOption: function(option) {return options[option];}, - undo: operation(undo), - redo: operation(redo), - indentLine: operation(function(n, dir) { - if (isLine(n)) indentLine(n, dir == null ? "smart" : dir ? "add" : "subtract"); - }), - historySize: function() {return {undo: history.done.length, redo: history.undone.length};}, - clearHistory: function() {history = new History();}, - matchBrackets: operation(function(){matchBrackets(true);}), - getTokenAt: function(pos) { - pos = clipPos(pos); - return lines[pos.line].getTokenAt(mode, getStateBefore(pos.line), pos.ch); - }, - getStateAfter: function(line) { - line = clipLine(line == null ? lines.length - 1: line); - return getStateBefore(line + 1); - }, - cursorCoords: function(start){ - if (start == null) start = sel.inverted; - return pageCoords(start ? sel.from : sel.to); - }, - charCoords: function(pos){return pageCoords(clipPos(pos));}, - coordsChar: function(coords) { - var off = eltOffset(lineSpace); - var line = clipLine(Math.min(lines.length - 1, showingFrom + Math.floor((coords.y - off.top) / lineHeight()))); - return clipPos({line: line, ch: charFromX(clipLine(line), coords.x - off.left)}); - }, - getSearchCursor: function(query, pos, caseFold) {return new SearchCursor(query, pos, caseFold);}, - markText: operation(markText), - setMarker: operation(addGutterMarker), - clearMarker: operation(removeGutterMarker), - setLineClass: operation(setLineClass), - lineInfo: lineInfo, - addWidget: function(pos, node, scroll, vert, horiz) { - pos = localCoords(clipPos(pos)); - var top = pos.yBot, left = pos.x; - node.style.position = "absolute"; - code.appendChild(node); - if (vert == "over") top = pos.y; - else if (vert == "near") { - var vspace = Math.max(scroller.offsetHeight, lines.length * lineHeight()), - hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft(); - if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight) - top = pos.y - node.offsetHeight; - if (left + node.offsetWidth > hspace) - left = hspace - node.offsetWidth; - } - node.style.top = (top + paddingTop()) + "px"; - node.style.left = node.style.right = ""; - if (horiz == "right") { - left = code.clientWidth - node.offsetWidth; - node.style.right = "0px"; - } else { - if (horiz == "left") left = 0; - else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2; - node.style.left = (left + paddingLeft()) + "px"; - } - if (scroll) - scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight); - }, - - lineCount: function() {return lines.length;}, - getCursor: function(start) { - if (start == null) start = sel.inverted; - return copyPos(start ? sel.from : sel.to); - }, - somethingSelected: function() {return !posEq(sel.from, sel.to);}, - setCursor: operation(function(line, ch) { - if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch); - else setCursor(line, ch); - }), - setSelection: operation(function(from, to) {setSelection(clipPos(from), clipPos(to || from));}), - getLine: function(line) {if (isLine(line)) return lines[line].text;}, - setLine: operation(function(line, text) { - if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: lines[line].text.length}); - }), - removeLine: operation(function(line) { - if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0})); - }), - replaceRange: operation(replaceRange), - getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));}, - - coordsFromIndex: function(index) { - var total = lines.length, pos = 0, line, ch, len; - - for (line = 0; line < total; line++) { - len = lines[line].text.length + 1; - if (pos + len > index) { ch = index - pos; break; } - pos += len; - } - return clipPos({line: line, ch: ch}); - }, - - operation: function(f){return operation(f)();}, - refresh: function(){updateDisplay(true);}, - getInputField: function(){return input;}, - getWrapperElement: function(){return wrapper;}, - getScrollerElement: function(){return scroller;}, - getGutterElement: function(){return gutter;} - }; - - function setValue(code) { - var top = {line: 0, ch: 0}; - updateLines(top, {line: lines.length - 1, ch: lines[lines.length-1].text.length}, - splitLines(code), top, top); - updateInput = true; - } - function getValue(code) { - var text = []; - for (var i = 0, l = lines.length; i < l; ++i) - text.push(lines[i].text); - return text.join("\n"); - } - - function onMouseDown(e) { - // Check whether this is a click in a widget - for (var n = e_target(e); n != wrapper; n = n.parentNode) - if (n.parentNode == code && n != mover) return; - - // First, see if this is a click in the gutter - for (var n = e_target(e); n != wrapper; n = n.parentNode) - if (n.parentNode == gutterText) { - if (options.onGutterClick) - options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e); - return e_preventDefault(e); - } - - var start = posFromMouse(e); - - switch (e_button(e)) { - case 3: - if (gecko && !mac) onContextMenu(e); - return; - case 2: - if (start) setCursor(start.line, start.ch, true); - return; - } - // For button 1, if it was clicked inside the editor - // (posFromMouse returning non-null), we have to adjust the - // selection. - if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;} - - if (!focused) onFocus(); - - var now = +new Date; - if (lastDoubleClick > now - 400) { - e_preventDefault(e); - return selectLine(start.line); - } else if (lastClick > now - 400) { - lastDoubleClick = now; - e_preventDefault(e); - return selectWordAt(start); - } else { lastClick = now; } - - var last = start, going; - if (dragAndDrop && !posEq(sel.from, sel.to) && - !posLess(start, sel.from) && !posLess(sel.to, start)) { - // Let the drag handler handle this. - var up = connect(targetDocument, "mouseup", operation(function(e2) { - draggingText = false; - up(); - if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { - e_preventDefault(e2); - setCursor(start.line, start.ch, true); - focusInput(); - } - }), true); - draggingText = true; - return; - } - e_preventDefault(e); - setCursor(start.line, start.ch, true); - - function extend(e) { - var cur = posFromMouse(e, true); - if (cur && !posEq(cur, last)) { - if (!focused) onFocus(); - last = cur; - setSelectionUser(start, cur); - updateInput = false; - var visible = visibleLines(); - if (cur.line >= visible.to || cur.line < visible.from) - going = setTimeout(operation(function(){extend(e);}), 150); - } - } - - var move = connect(targetDocument, "mousemove", operation(function(e) { - clearTimeout(going); - e_preventDefault(e); - extend(e); - }), true); - var up = connect(targetDocument, "mouseup", operation(function(e) { - clearTimeout(going); - var cur = posFromMouse(e); - if (cur) setSelectionUser(start, cur); - e_preventDefault(e); - focusInput(); - updateInput = true; - move(); up(); - }), true); - } - function onDoubleClick(e) { - var start = posFromMouse(e); - if (!start) return; - lastDoubleClick = +new Date; - e_preventDefault(e); - selectWordAt(start); - } - function onDrop(e) { - e.preventDefault(); - var pos = posFromMouse(e, true), files = e.dataTransfer.files; - if (!pos || options.readOnly) return; - if (files && files.length && window.FileReader && window.File) { - function loadFile(file, i) { - var reader = new FileReader; - reader.onload = function() { - text[i] = reader.result; - if (++read == n) { - pos = clipPos(pos); - var end = replaceRange(text.join(""), pos, pos); - setSelectionUser(pos, end); - } - }; - reader.readAsText(file); - } - var n = files.length, text = Array(n), read = 0; - for (var i = 0; i < n; ++i) loadFile(files[i], i); - } - else { - try { - var text = e.dataTransfer.getData("Text"); - if (text) { - var end = replaceRange(text, pos, pos); - var curFrom = sel.from, curTo = sel.to; - setSelectionUser(pos, end); - if (draggingText) replaceRange("", curFrom, curTo); - focusInput(); - } - } - catch(e){} - } - } - function onDragStart(e) { - var txt = getSelection(); - // This will reset escapeElement - htmlEscape(txt); - e.dataTransfer.setDragImage(escapeElement, 0, 0); - e.dataTransfer.setData("Text", txt); - } - function onKeyDown(e) { - if (!focused) onFocus(); - - var code = e.keyCode; - // IE does strange things with escape. - if (ie && code == 27) { e.returnValue = false; } - // Tries to detect ctrl on non-mac, cmd on mac. - var mod = (mac ? e.metaKey : e.ctrlKey) && !e.altKey, anyMod = e.ctrlKey || e.altKey || e.metaKey; - if (code == 16 || e.shiftKey) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from); - else shiftSelecting = null; - // First give onKeyEvent option a chance to handle this. - if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return; - - if (code == 33 || code == 34) {scrollPage(code == 34); return e_preventDefault(e);} // page up/down - if (mod && ((code == 36 || code == 35) || // ctrl-home/end - mac && (code == 38 || code == 40))) { // cmd-up/down - scrollEnd(code == 36 || code == 38); return e_preventDefault(e); - } - if (mod && code == 65) {selectAll(); return e_preventDefault(e);} // ctrl-a - if (!options.readOnly) { - if (!anyMod && code == 13) {return;} // enter - if (!anyMod && code == 9 && handleTab(e.shiftKey)) return e_preventDefault(e); // tab - if (mod && code == 90) {undo(); return e_preventDefault(e);} // ctrl-z - if (mod && ((e.shiftKey && code == 90) || code == 89)) {redo(); return e_preventDefault(e);} // ctrl-shift-z, ctrl-y - } - if (code == 36) { if (options.smartHome) { smartHome(); return e_preventDefault(e); } } - - // Key id to use in the movementKeys map. We also pass it to - // fastPoll in order to 'self learn'. We need this because - // reducedSelection, the hack where we collapse the selection to - // its start when it is inverted and a movement key is pressed - // (and later restore it again), shouldn't be used for - // non-movement keys. - curKeyId = (mod ? "c" : "") + (e.altKey ? "a" : "") + code; - if (sel.inverted && movementKeys[curKeyId] === true) { - var range = selRange(input); - if (range) { - reducedSelection = {anchor: range.start}; - setSelRange(input, range.start, range.start); - } - } - // Don't save the key as a movementkey unless it had a modifier - if (!mod && !e.altKey) curKeyId = null; - fastPoll(curKeyId); - } - function onKeyUp(e) { - if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return; - if (reducedSelection) { - reducedSelection = null; - updateInput = true; - } - if (e.keyCode == 16) shiftSelecting = null; - } - function onKeyPress(e) { - if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return; - if (options.electricChars && mode.electricChars) { - var ch = String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode); - if (mode.electricChars.indexOf(ch) > -1) - setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 50); - } - var code = e.keyCode; - // Re-stop tab and enter. Necessary on some browsers. - if (code == 13) {if (!options.readOnly) handleEnter(); e_preventDefault(e);} - else if (!e.ctrlKey && !e.altKey && !e.metaKey && code == 9 && options.tabMode != "default") e_preventDefault(e); - else fastPoll(curKeyId); - } - - function onFocus() { - if (options.readOnly == "nocursor") return; - if (!focused) { - if (options.onFocus) options.onFocus(instance); - focused = true; - if (wrapper.className.search(/\bCodeMirror-focused\b/) == -1) - wrapper.className += " CodeMirror-focused"; - if (!leaveInputAlone) prepareInput(); - } - slowPoll(); - restartBlink(); - } - function onBlur() { - if (focused) { - if (options.onBlur) options.onBlur(instance); - focused = false; - wrapper.className = wrapper.className.replace(" CodeMirror-focused", ""); - } - clearInterval(blinker); - setTimeout(function() {if (!focused) shiftSelecting = null;}, 150); - } - - // Replace the range from from to to by the strings in newText. - // Afterwards, set the selection to selFrom, selTo. - function updateLines(from, to, newText, selFrom, selTo) { - if (history) { - var old = []; - for (var i = from.line, e = to.line + 1; i < e; ++i) old.push(lines[i].text); - history.addChange(from.line, newText.length, old); - while (history.done.length > options.undoDepth) history.done.shift(); - } - updateLinesNoUndo(from, to, newText, selFrom, selTo); - } - function unredoHelper(from, to) { - var change = from.pop(); - if (change) { - var replaced = [], end = change.start + change.added; - for (var i = change.start; i < end; ++i) replaced.push(lines[i].text); - to.push({start: change.start, added: change.old.length, old: replaced}); - var pos = clipPos({line: change.start + change.old.length - 1, - ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])}); - updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: lines[end-1].text.length}, change.old, pos, pos); - updateInput = true; - } - } - function undo() {unredoHelper(history.done, history.undone);} - function redo() {unredoHelper(history.undone, history.done);} - - function updateLinesNoUndo(from, to, newText, selFrom, selTo) { - var recomputeMaxLength = false, maxLineLength = maxLine.length; - for (var i = from.line; i <= to.line; ++i) { - if (lines[i].text.length == maxLineLength) {recomputeMaxLength = true; break;} - } - - var nlines = to.line - from.line, firstLine = lines[from.line], lastLine = lines[to.line]; - // First adjust the line structure, taking some care to leave highlighting intact. - if (firstLine == lastLine) { - if (newText.length == 1) - firstLine.replace(from.ch, to.ch, newText[0]); - else { - lastLine = firstLine.split(to.ch, newText[newText.length-1]); - var spliceargs = [from.line + 1, nlines]; - firstLine.replace(from.ch, null, newText[0]); - for (var i = 1, e = newText.length - 1; i < e; ++i) - spliceargs.push(Line.inheritMarks(newText[i], firstLine)); - spliceargs.push(lastLine); - lines.splice.apply(lines, spliceargs); - } - } - else if (newText.length == 1) { - firstLine.replace(from.ch, null, newText[0]); - lastLine.replace(null, to.ch, ""); - firstLine.append(lastLine); - lines.splice(from.line + 1, nlines); - } - else { - var spliceargs = [from.line + 1, nlines - 1]; - firstLine.replace(from.ch, null, newText[0]); - lastLine.replace(null, to.ch, newText[newText.length-1]); - for (var i = 1, e = newText.length - 1; i < e; ++i) - spliceargs.push(Line.inheritMarks(newText[i], firstLine)); - lines.splice.apply(lines, spliceargs); - } - - - for (var i = from.line, e = i + newText.length; i < e; ++i) { - var l = lines[i].text; - if (l.length > maxLineLength) { - maxLine = l; maxLineLength = l.length; maxWidth = null; - recomputeMaxLength = false; - } - } - if (recomputeMaxLength) { - maxLineLength = 0; maxLine = ""; maxWidth = null; - for (var i = 0, e = lines.length; i < e; ++i) { - var l = lines[i].text; - if (l.length > maxLineLength) { - maxLineLength = l.length; maxLine = l; - } - } - } - - // Add these lines to the work array, so that they will be - // highlighted. Adjust work lines if lines were added/removed. - var newWork = [], lendiff = newText.length - nlines - 1; - for (var i = 0, l = work.length; i < l; ++i) { - var task = work[i]; - if (task < from.line) newWork.push(task); - else if (task > to.line) newWork.push(task + lendiff); - } - if (newText.length < 5) { - highlightLines(from.line, from.line + newText.length); - newWork.push(from.line + newText.length); - } else { - newWork.push(from.line); - } - work = newWork; - startWorker(100); - // Remember that these lines changed, for updating the display - changes.push({from: from.line, to: to.line + 1, diff: lendiff}); - textChanged = {from: from, to: to, text: newText}; - - // Update the selection - function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;} - setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line)); - - // Make sure the scroll-size div has the correct height. - code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px"; - } - - function replaceRange(code, from, to) { - from = clipPos(from); - if (!to) to = from; else to = clipPos(to); - code = splitLines(code); - function adjustPos(pos) { - if (posLess(pos, from)) return pos; - if (!posLess(to, pos)) return end; - var line = pos.line + code.length - (to.line - from.line) - 1; - var ch = pos.ch; - if (pos.line == to.line) - ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0)); - return {line: line, ch: ch}; - } - var end; - replaceRange1(code, from, to, function(end1) { - end = end1; - return {from: adjustPos(sel.from), to: adjustPos(sel.to)}; - }); - return end; - } - function replaceSelection(code, collapse) { - replaceRange1(splitLines(code), sel.from, sel.to, function(end) { - if (collapse == "end") return {from: end, to: end}; - else if (collapse == "start") return {from: sel.from, to: sel.from}; - else return {from: sel.from, to: end}; - }); - } - function replaceRange1(code, from, to, computeSel) { - var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length; - var newSel = computeSel({line: from.line + code.length - 1, ch: endch}); - updateLines(from, to, code, newSel.from, newSel.to); - } - - function getRange(from, to) { - var l1 = from.line, l2 = to.line; - if (l1 == l2) return lines[l1].text.slice(from.ch, to.ch); - var code = [lines[l1].text.slice(from.ch)]; - for (var i = l1 + 1; i < l2; ++i) code.push(lines[i].text); - code.push(lines[l2].text.slice(0, to.ch)); - return code.join("\n"); - } - function getSelection() { - return getRange(sel.from, sel.to); - } - - var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll - function slowPoll() { - if (pollingFast) return; - poll.set(2000, function() { - startOperation(); - readInput(); - if (focused) slowPoll(); - endOperation(); - }); - } - function fastPoll(keyId) { - var missed = false; - pollingFast = true; - function p() { - startOperation(); - var changed = readInput(); - if (changed && keyId) { - if (changed == "moved" && movementKeys[keyId] == null) movementKeys[keyId] = true; - if (changed == "changed") movementKeys[keyId] = false; - } - if (!changed && !missed) {missed = true; poll.set(80, p);} - else {pollingFast = false; slowPoll();} - endOperation(); - } - poll.set(20, p); - } - - // Inspects the textarea, compares its state (content, selection) - // to the data in the editing variable, and updates the editor - // content or cursor if something changed. - function readInput() { - if (leaveInputAlone || !focused) return; - var changed = false, text = input.value, sr = selRange(input); - if (!sr) return false; - var changed = editing.text != text, rs = reducedSelection; - var moved = changed || sr.start != editing.start || sr.end != (rs ? editing.start : editing.end); - if (!moved && !rs) return false; - if (changed) { - shiftSelecting = reducedSelection = null; - if (options.readOnly) {updateInput = true; return "changed";} - } - - // Compute selection start and end based on start/end offsets in textarea - function computeOffset(n, startLine) { - var pos = 0; - for (;;) { - var found = text.indexOf("\n", pos); - if (found == -1 || (text.charAt(found-1) == "\r" ? found - 1 : found) >= n) - return {line: startLine, ch: n - pos}; - ++startLine; - pos = found + 1; - } - } - var from = computeOffset(sr.start, editing.from), - to = computeOffset(sr.end, editing.from); - // Here we have to take the reducedSelection hack into account, - // so that you can, for example, press shift-up at the start of - // your selection and have the right thing happen. - if (rs) { - var head = sr.start == rs.anchor ? to : from; - var tail = shiftSelecting ? sel.to : sr.start == rs.anchor ? from : to; - if (sel.inverted = posLess(head, tail)) { from = head; to = tail; } - else { reducedSelection = null; from = tail; to = head; } - } - - // In some cases (cursor on same line as before), we don't have - // to update the textarea content at all. - if (from.line == to.line && from.line == sel.from.line && from.line == sel.to.line && !shiftSelecting) - updateInput = false; - - // Magic mess to extract precise edited range from the changed - // string. - if (changed) { - var start = 0, end = text.length, len = Math.min(end, editing.text.length); - var c, line = editing.from, nl = -1; - while (start < len && (c = text.charAt(start)) == editing.text.charAt(start)) { - ++start; - if (c == "\n") {line++; nl = start;} - } - var ch = nl > -1 ? start - nl : start, endline = editing.to - 1, edend = editing.text.length; - for (;;) { - c = editing.text.charAt(edend); - if (text.charAt(end) != c) {++end; ++edend; break;} - if (c == "\n") endline--; - if (edend <= start || end <= start) break; - --end; --edend; - } - var nl = editing.text.lastIndexOf("\n", edend - 1), endch = nl == -1 ? edend : edend - nl - 1; - updateLines({line: line, ch: ch}, {line: endline, ch: endch}, splitLines(text.slice(start, end)), from, to); - if (line != endline || from.line != line) updateInput = true; - } - else setSelection(from, to); - - editing.text = text; editing.start = sr.start; editing.end = sr.end; - return changed ? "changed" : moved ? "moved" : false; - } - - // Set the textarea content and selection range to match the - // editor state. - function prepareInput() { - var text = []; - var from = Math.max(0, sel.from.line - 1), to = Math.min(lines.length, sel.to.line + 2); - for (var i = from; i < to; ++i) text.push(lines[i].text); - text = input.value = text.join(lineSep); - var startch = sel.from.ch, endch = sel.to.ch; - for (var i = from; i < sel.from.line; ++i) - startch += lineSep.length + lines[i].text.length; - for (var i = from; i < sel.to.line; ++i) - endch += lineSep.length + lines[i].text.length; - editing = {text: text, from: from, to: to, start: startch, end: endch}; - setSelRange(input, startch, reducedSelection ? startch : endch); - } - function focusInput() { - if (options.readOnly != "nocursor") input.focus(); - } - - function scrollEditorIntoView() { - if (!cursor.getBoundingClientRect) return; - var rect = cursor.getBoundingClientRect(); - var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight); - if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView(); - } - function scrollCursorIntoView() { - var cursor = localCoords(sel.inverted ? sel.from : sel.to); - return scrollIntoView(cursor.x, cursor.y, cursor.x, cursor.yBot); - } - function scrollIntoView(x1, y1, x2, y2) { - var pl = paddingLeft(), pt = paddingTop(), lh = lineHeight(); - y1 += pt; y2 += pt; x1 += pl; x2 += pl; - var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true; - if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;} - else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;} - - var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft; - var gutterw = options.fixedGutter ? gutter.clientWidth : 0; - if (x1 < screenleft + gutterw) { - if (x1 < 50) x1 = 0; - scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw); - scrolled = true; - } - else if (x2 > screenw + screenleft) { - scroller.scrollLeft = x2 + 10 - screenw; - scrolled = true; - if (x2 > code.clientWidth) result = false; - } - if (scrolled && options.onScroll) options.onScroll(instance); - return result; - } - - function visibleLines() { - var lh = lineHeight(), top = scroller.scrollTop - paddingTop(); - return {from: Math.min(lines.length, Math.max(0, Math.floor(top / lh))), - to: Math.min(lines.length, Math.ceil((top + scroller.clientHeight) / lh))}; - } - // Uses a set of changes plus the current scroll position to - // determine which DOM updates have to be made, and makes the - // updates. - function updateDisplay(changes) { - if (!scroller.clientWidth) { - showingFrom = showingTo = 0; - return; - } - // First create a range of theoretically intact lines, and punch - // holes in that using the change info. - var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}]; - for (var i = 0, l = changes.length || 0; i < l; ++i) { - var change = changes[i], intact2 = [], diff = change.diff || 0; - for (var j = 0, l2 = intact.length; j < l2; ++j) { - var range = intact[j]; - if (change.to <= range.from) - intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart}); - else if (range.to <= change.from) - intact2.push(range); - else { - if (change.from > range.from) - intact2.push({from: range.from, to: change.from, domStart: range.domStart}); - if (change.to < range.to) - intact2.push({from: change.to + diff, to: range.to + diff, - domStart: range.domStart + (change.to - range.from)}); - } - } - intact = intact2; - } - - // Then, determine which lines we'd want to see, and which - // updates have to be made to get there. - var visible = visibleLines(); - var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)), - to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)), - updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0; - - for (var i = 0, l = intact.length; i < l; ++i) { - var range = intact[i]; - if (range.to <= from) continue; - if (range.from >= to) break; - if (range.domStart > domPos || range.from > pos) { - updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos}); - changedLines += range.from - pos; - } - pos = range.to; - domPos = range.domStart + (range.to - range.from); - } - if (domPos != domEnd || pos != to) { - changedLines += Math.abs(to - pos); - updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos}); - if (to - pos != domEnd - domPos) gutterDirty = true; - } - - if (!updates.length) return; - lineDiv.style.display = "none"; - // If more than 30% of the screen needs update, just do a full - // redraw (which is quicker than patching) - if (changedLines > (visible.to - visible.from) * .3) - refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length)); - // Otherwise, only update the stuff that needs updating. - else - patchDisplay(updates); - lineDiv.style.display = ""; - - // Position the mover div to align with the lines it's supposed - // to be showing (which will cover the visible display) - var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight; - showingFrom = from; showingTo = to; - mover.style.top = (from * lineHeight()) + "px"; - if (different) { - lastHeight = scroller.clientHeight; - code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px"; - } - if (different || gutterDirty) updateGutter(); - - if (maxWidth == null) maxWidth = stringWidth(maxLine); - if (maxWidth > scroller.clientWidth) { - lineSpace.style.width = maxWidth + "px"; - // Needed to prevent odd wrapping/hiding of widgets placed in here. - code.style.width = ""; - code.style.width = scroller.scrollWidth + "px"; - } else { - lineSpace.style.width = code.style.width = ""; - } - - // Since this is all rather error prone, it is honoured with the - // only assertion in the whole file. - if (lineDiv.childNodes.length != showingTo - showingFrom) - throw new Error("BAD PATCH! " + JSON.stringify(updates) + " size=" + (showingTo - showingFrom) + - " nodes=" + lineDiv.childNodes.length); - updateCursor(); - } - - function refreshDisplay(from, to) { - var html = [], start = {line: from, ch: 0}, inSel = posLess(sel.from, start) && !posLess(sel.to, start); - for (var i = from; i < to; ++i) { - var ch1 = null, ch2 = null; - if (inSel) { - ch1 = 0; - if (sel.to.line == i) {inSel = false; ch2 = sel.to.ch;} - } - else if (sel.from.line == i) { - if (sel.to.line == i) {ch1 = sel.from.ch; ch2 = sel.to.ch;} - else {inSel = true; ch1 = sel.from.ch;} - } - html.push(lines[i].getHTML(ch1, ch2, true)); - } - lineDiv.innerHTML = html.join(""); - } - function patchDisplay(updates) { - // Slightly different algorithm for IE (badInnerHTML), since - // there .innerHTML on PRE nodes is dumb, and discards - // whitespace. - var sfrom = sel.from.line, sto = sel.to.line, off = 0, - scratch = badInnerHTML && targetDocument.createElement("div"); - for (var i = 0, e = updates.length; i < e; ++i) { - var rec = updates[i]; - var extra = (rec.to - rec.from) - rec.domSize; - var nodeAfter = lineDiv.childNodes[rec.domStart + rec.domSize + off] || null; - if (badInnerHTML) - for (var j = Math.max(-extra, rec.domSize); j > 0; --j) - lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild); - else if (extra) { - for (var j = Math.max(0, extra); j > 0; --j) - lineDiv.insertBefore(targetDocument.createElement("pre"), nodeAfter); - for (var j = Math.max(0, -extra); j > 0; --j) - lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild); - } - var node = lineDiv.childNodes[rec.domStart + off], inSel = sfrom < rec.from && sto >= rec.from; - for (var j = rec.from; j < rec.to; ++j) { - var ch1 = null, ch2 = null; - if (inSel) { - ch1 = 0; - if (sto == j) {inSel = false; ch2 = sel.to.ch;} - } - else if (sfrom == j) { - if (sto == j) {ch1 = sel.from.ch; ch2 = sel.to.ch;} - else {inSel = true; ch1 = sel.from.ch;} - } - if (badInnerHTML) { - scratch.innerHTML = lines[j].getHTML(ch1, ch2, true); - lineDiv.insertBefore(scratch.firstChild, nodeAfter); - } - else { - node.innerHTML = lines[j].getHTML(ch1, ch2, false); - node.className = lines[j].className || ""; - node = node.nextSibling; - } - } - off += extra; - } - } - - function updateGutter() { - if (!options.gutter && !options.lineNumbers) return; - var hText = mover.offsetHeight, hEditor = scroller.clientHeight; - gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px"; - var html = []; - for (var i = showingFrom; i < Math.max(showingTo, showingFrom + 1); ++i) { - var marker = lines[i].gutterMarker; - var text = options.lineNumbers ? i + options.firstLineNumber : null; - if (marker && marker.text) - text = marker.text.replace("%N%", text != null ? text : ""); - else if (text == null) - text = "\u00a0"; - html.push((marker && marker.style ? '
    ' : "
    "), text, "
    "); - } - gutter.style.display = "none"; - gutterText.innerHTML = html.join(""); - var minwidth = String(lines.length).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = ""; - while (val.length + pad.length < minwidth) pad += "\u00a0"; - if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild); - gutter.style.display = ""; - lineSpace.style.marginLeft = gutter.offsetWidth + "px"; - gutterDirty = false; - } - function updateCursor() { - var head = sel.inverted ? sel.from : sel.to, lh = lineHeight(); - var x = charX(head.line, head.ch); - var top = head.line * lh - scroller.scrollTop; - inputDiv.style.top = Math.max(Math.min(top, scroller.offsetHeight), 0) + "px"; - inputDiv.style.left = (x - scroller.scrollLeft) + "px"; - if (posEq(sel.from, sel.to)) { - cursor.style.top = (head.line - showingFrom) * lh + "px"; - cursor.style.left = x + "px"; - cursor.style.display = ""; - } - else cursor.style.display = "none"; - } - - function setSelectionUser(from, to) { - var sh = shiftSelecting && clipPos(shiftSelecting); - if (sh) { - if (posLess(sh, from)) from = sh; - else if (posLess(to, sh)) to = sh; - } - setSelection(from, to); - } - // Update the selection. Last two args are only used by - // updateLines, since they have to be expressed in the line - // numbers before the update. - function setSelection(from, to, oldFrom, oldTo) { - if (posEq(sel.from, from) && posEq(sel.to, to)) return; - if (posLess(to, from)) {var tmp = to; to = from; from = tmp;} - - if (posEq(from, to)) sel.inverted = false; - else if (posEq(from, sel.to)) sel.inverted = false; - else if (posEq(to, sel.from)) sel.inverted = true; - - // Some ugly logic used to only mark the lines that actually did - // see a change in selection as changed, rather than the whole - // selected range. - if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;} - if (posEq(from, to)) { - if (!posEq(sel.from, sel.to)) - changes.push({from: oldFrom, to: oldTo + 1}); - } - else if (posEq(sel.from, sel.to)) { - changes.push({from: from.line, to: to.line + 1}); - } - else { - if (!posEq(from, sel.from)) { - if (from.line < oldFrom) - changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1}); - else - changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1}); - } - if (!posEq(to, sel.to)) { - if (to.line < oldTo) - changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1}); - else - changes.push({from: Math.max(from.line, oldTo), to: to.line + 1}); - } - } - sel.from = from; sel.to = to; - selectionChanged = true; - } - function setCursor(line, ch, user) { - var pos = clipPos({line: line, ch: ch || 0}); - (user ? setSelectionUser : setSelection)(pos, pos); - } - - function clipLine(n) {return Math.max(0, Math.min(n, lines.length-1));} - function clipPos(pos) { - if (pos.line < 0) return {line: 0, ch: 0}; - if (pos.line >= lines.length) return {line: lines.length-1, ch: lines[lines.length-1].text.length}; - var ch = pos.ch, linelen = lines[pos.line].text.length; - if (ch == null || ch > linelen) return {line: pos.line, ch: linelen}; - else if (ch < 0) return {line: pos.line, ch: 0}; - else return pos; - } - - function scrollPage(down) { - var linesPerPage = Math.floor(scroller.clientHeight / lineHeight()), head = sel.inverted ? sel.from : sel.to; - setCursor(head.line + (Math.max(linesPerPage - 1, 1) * (down ? 1 : -1)), head.ch, true); - } - function scrollEnd(top) { - var pos = top ? {line: 0, ch: 0} : {line: lines.length - 1, ch: lines[lines.length-1].text.length}; - setSelectionUser(pos, pos); - } - function selectAll() { - var endLine = lines.length - 1; - setSelection({line: 0, ch: 0}, {line: endLine, ch: lines[endLine].text.length}); - } - function selectWordAt(pos) { - var line = lines[pos.line].text; - var start = pos.ch, end = pos.ch; - while (start > 0 && /\w/.test(line.charAt(start - 1))) --start; - while (end < line.length && /\w/.test(line.charAt(end))) ++end; - setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end}); - } - function selectLine(line) { - setSelectionUser({line: line, ch: 0}, {line: line, ch: lines[line].text.length}); - } - function handleEnter() { - replaceSelection("\n", "end"); - if (options.enterMode != "flat") - indentLine(sel.from.line, options.enterMode == "keep" ? "prev" : "smart"); - } - function handleTab(shift) { - function indentSelected(mode) { - if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode); - var e = sel.to.line - (sel.to.ch ? 0 : 1); - for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode); - } - shiftSelecting = null; - switch (options.tabMode) { - case "default": - return false; - case "indent": - indentSelected("smart"); - break; - case "classic": - if (posEq(sel.from, sel.to)) { - if (shift) indentLine(sel.from.line, "smart"); - else replaceSelection("\t", "end"); - break; - } - case "shift": - indentSelected(shift ? "subtract" : "add"); - break; - } - return true; - } - function smartHome() { - var firstNonWS = Math.max(0, lines[sel.from.line].text.search(/\S/)); - setCursor(sel.from.line, sel.from.ch <= firstNonWS && sel.from.ch ? 0 : firstNonWS, true); - } - - function indentLine(n, how) { - if (how == "smart") { - if (!mode.indent) how = "prev"; - else var state = getStateBefore(n); - } - - var line = lines[n], curSpace = line.indentation(), curSpaceString = line.text.match(/^\s*/)[0], indentation; - if (how == "prev") { - if (n) indentation = lines[n-1].indentation(); - else indentation = 0; - } - else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length)); - else if (how == "add") indentation = curSpace + options.indentUnit; - else if (how == "subtract") indentation = curSpace - options.indentUnit; - indentation = Math.max(0, indentation); - var diff = indentation - curSpace; - - if (!diff) { - if (sel.from.line != n && sel.to.line != n) return; - var indentString = curSpaceString; - } - else { - var indentString = "", pos = 0; - if (options.indentWithTabs) - for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} - while (pos < indentation) {++pos; indentString += " ";} - } - - replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length}); - } - - function loadMode() { - mode = CodeMirror.getMode(options, options.mode); - for (var i = 0, l = lines.length; i < l; ++i) - lines[i].stateAfter = null; - work = [0]; - startWorker(); - } - function gutterChanged() { - var visible = options.gutter || options.lineNumbers; - gutter.style.display = visible ? "" : "none"; - if (visible) gutterDirty = true; - else lineDiv.parentNode.style.marginLeft = 0; - } - - function markText(from, to, className) { - from = clipPos(from); to = clipPos(to); - var set = []; - function add(line, from, to, className) { - mark = lines[line].addMark(from, to, className, set); - } - if (from.line == to.line) add(from.line, from.ch, to.ch, className); - else { - add(from.line, from.ch, null, className); - for (var i = from.line + 1, e = to.line; i < e; ++i) - add(i, 0, null, className); - add(to.line, 0, to.ch, className); - } - changes.push({from: from.line, to: to.line + 1}); - return new TextMarker(set); - } - - function TextMarker(set) { this.set = set; } - TextMarker.prototype.clear = operation(function() { - for (var i = 0, e = this.set.length; i < e; ++i) { - var mk = this.set[i].marked; - for (var j = 0; j < mk.length; ++j) { - if (mk[j].set == this.set) mk.splice(j--, 1); - } - } - // We don't know the exact lines that changed. Refreshing is - // cheaper than finding them. - changes.push({from: 0, to: lines.length}); - }); - TextMarker.prototype.find = function() { - var from, to; - for (var i = 0, e = this.set.length; i < e; ++i) { - var line = this.set[i], mk = line.marked; - for (var j = 0; j < mk.length; ++j) { - var mark = mk[j]; - if (mark.set == this.set) { - if (mark.from != null || mark.to != null) { - var found = indexOf(lines, line); - if (found > -1) { - if (mark.from != null) from = {line: found, ch: mark.from}; - if (mark.to != null) to = {line: found, ch: mark.to}; - } - } - } - } - } - return {from: from, to: to}; - }; - - function addGutterMarker(line, text, className) { - if (typeof line == "number") line = lines[clipLine(line)]; - line.gutterMarker = {text: text, style: className}; - gutterDirty = true; - return line; - } - function removeGutterMarker(line) { - if (typeof line == "number") line = lines[clipLine(line)]; - line.gutterMarker = null; - gutterDirty = true; - } - function setLineClass(line, className) { - if (typeof line == "number") { - var no = line; - line = lines[clipLine(line)]; - } - else { - var no = indexOf(lines, line); - if (no == -1) return null; - } - if (line.className != className) { - line.className = className; - changes.push({from: no, to: no + 1}); - } - return line; - } - - function lineInfo(line) { - if (typeof line == "number") { - var n = line; - line = lines[line]; - if (!line) return null; - } - else { - var n = indexOf(lines, line); - if (n == -1) return null; - } - var marker = line.gutterMarker; - return {line: n, text: line.text, markerText: marker && marker.text, markerClass: marker && marker.style}; - } - - function stringWidth(str) { - measure.innerHTML = "
    x
    "; - measure.firstChild.firstChild.firstChild.nodeValue = str; - return measure.firstChild.firstChild.offsetWidth || 10; - } - // These are used to go from pixel positions to character - // positions, taking varying character widths into account. - function charX(line, pos) { - if (pos == 0) return 0; - measure.innerHTML = "
    " + lines[line].getHTML(null, null, false, pos) + "
    "; - return measure.firstChild.firstChild.offsetWidth; - } - function charFromX(line, x) { - if (x <= 0) return 0; - var lineObj = lines[line], text = lineObj.text; - function getX(len) { - measure.innerHTML = "
    " + lineObj.getHTML(null, null, false, len) + "
    "; - return measure.firstChild.firstChild.offsetWidth; - } - var from = 0, fromX = 0, to = text.length, toX; - // Guess a suitable upper bound for our search. - var estimated = Math.min(to, Math.ceil(x / stringWidth("x"))); - for (;;) { - var estX = getX(estimated); - if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2)); - else {toX = estX; to = estimated; break;} - } - if (x > toX) return to; - // Try to guess a suitable lower bound as well. - estimated = Math.floor(to * 0.8); estX = getX(estimated); - if (estX < x) {from = estimated; fromX = estX;} - // Do a binary search between these bounds. - for (;;) { - if (to - from <= 1) return (toX - x > x - fromX) ? from : to; - var middle = Math.ceil((from + to) / 2), middleX = getX(middle); - if (middleX > x) {to = middle; toX = middleX;} - else {from = middle; fromX = middleX;} - } - } - - function localCoords(pos, inLineWrap) { - var lh = lineHeight(), line = pos.line - (inLineWrap ? showingFrom : 0); - return {x: charX(pos.line, pos.ch), y: line * lh, yBot: (line + 1) * lh}; - } - function pageCoords(pos) { - var local = localCoords(pos, true), off = eltOffset(lineSpace); - return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot}; - } - - function lineHeight() { - var nlines = lineDiv.childNodes.length; - if (nlines) return (lineDiv.offsetHeight / nlines) || 1; - measure.innerHTML = "
    x
    "; - return measure.firstChild.offsetHeight || 1; - } - function paddingTop() {return lineSpace.offsetTop;} - function paddingLeft() {return lineSpace.offsetLeft;} - - function posFromMouse(e, liberal) { - var offW = eltOffset(scroller, true), x, y; - // Fails unpredictably on IE[67] when mouse is dragged around quickly. - try { x = e.clientX; y = e.clientY; } catch (e) { return null; } - // This is a mess of a heuristic to try and determine whether a - // scroll-bar was clicked or not, and to return null if one was - // (and !liberal). - if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight)) - return null; - var offL = eltOffset(lineSpace, true); - var line = showingFrom + Math.floor((y - offL.top) / lineHeight()); - return clipPos({line: line, ch: charFromX(clipLine(line), x - offL.left)}); - } - function onContextMenu(e) { - var pos = posFromMouse(e); - if (!pos || window.opera) return; // Opera is difficult. - if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to)) - operation(setCursor)(pos.line, pos.ch); - - var oldCSS = input.style.cssText; - inputDiv.style.position = "absolute"; - input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) + - "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " + - "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; - leaveInputAlone = true; - var val = input.value = getSelection(); - focusInput(); - setSelRange(input, 0, input.value.length); - function rehide() { - var newVal = splitLines(input.value).join("\n"); - if (newVal != val) operation(replaceSelection)(newVal, "end"); - inputDiv.style.position = "relative"; - input.style.cssText = oldCSS; - leaveInputAlone = false; - prepareInput(); - slowPoll(); - } - - if (gecko) { - e_stop(e); - var mouseup = connect(window, "mouseup", function() { - mouseup(); - setTimeout(rehide, 20); - }, true); - } - else { - setTimeout(rehide, 50); - } - } - - // Cursor-blinking - function restartBlink() { - clearInterval(blinker); - var on = true; - cursor.style.visibility = ""; - blinker = setInterval(function() { - cursor.style.visibility = (on = !on) ? "" : "hidden"; - }, 650); - } - - var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; - function matchBrackets(autoclear) { - var head = sel.inverted ? sel.from : sel.to, line = lines[head.line], pos = head.ch - 1; - var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; - if (!match) return; - var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles; - for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2) - if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;} - - var stack = [line.text.charAt(pos)], re = /[(){}[\]]/; - function scan(line, from, to) { - if (!line.text) return; - var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur; - for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) { - var text = st[i]; - if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;} - for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) { - if (pos >= from && pos < to && re.test(cur = text.charAt(j))) { - var match = matching[cur]; - if (match.charAt(1) == ">" == forward) stack.push(cur); - else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false}; - else if (!stack.length) return {pos: pos, match: true}; - } - } - } - } - for (var i = head.line, e = forward ? Math.min(i + 100, lines.length) : Math.max(-1, i - 100); i != e; i+=d) { - var line = lines[i], first = i == head.line; - var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length); - if (found) break; - } - if (!found) found = {pos: null, match: false}; - var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; - var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style), - two = found.pos != null && markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style); - var clear = operation(function(){one.clear(); two && two.clear();}); - if (autoclear) setTimeout(clear, 800); - else bracketHighlighted = clear; - } - - // Finds the line to start with when starting a parse. Tries to - // find a line with a stateAfter, so that it can start with a - // valid state. If that fails, it returns the line with the - // smallest indentation, which tends to need the least context to - // parse correctly. - function findStartLine(n) { - var minindent, minline; - for (var search = n, lim = n - 40; search > lim; --search) { - if (search == 0) return 0; - var line = lines[search-1]; - if (line.stateAfter) return search; - var indented = line.indentation(); - if (minline == null || minindent > indented) { - minline = search - 1; - minindent = indented; - } - } - return minline; - } - function getStateBefore(n) { - var start = findStartLine(n), state = start && lines[start-1].stateAfter; - if (!state) state = startState(mode); - else state = copyState(mode, state); - for (var i = start; i < n; ++i) { - var line = lines[i]; - line.highlight(mode, state); - line.stateAfter = copyState(mode, state); - } - changes.push({from: start, to: n}); - if (n < lines.length && !lines[n].stateAfter) work.push(n); - return state; - } - function highlightLines(start, end) { - var state = getStateBefore(start); - for (var i = start; i < end; ++i) { - var line = lines[i]; - line.highlight(mode, state); - line.stateAfter = copyState(mode, state); - } - } - function highlightWorker() { - var end = +new Date + options.workTime; - var foundWork = work.length; - while (work.length) { - if (!lines[showingFrom].stateAfter) var task = showingFrom; - else var task = work.pop(); - if (task >= lines.length) continue; - var start = findStartLine(task), state = start && lines[start-1].stateAfter; - if (state) state = copyState(mode, state); - else state = startState(mode); - - var unchanged = 0, compare = mode.compareStates, realChange = false; - for (var i = start, l = lines.length; i < l; ++i) { - var line = lines[i], hadState = line.stateAfter; - if (+new Date > end) { - work.push(i); - startWorker(options.workDelay); - if (realChange) changes.push({from: task, to: i + 1}); - return; - } - var changed = line.highlight(mode, state); - if (changed) realChange = true; - line.stateAfter = copyState(mode, state); - if (compare) { - if (hadState && compare(hadState, state)) break; - } else { - if (changed !== false || !hadState) unchanged = 0; - else if (++unchanged > 3) break; - } - } - if (realChange) changes.push({from: task, to: i + 1}); - } - if (foundWork && options.onHighlightComplete) - options.onHighlightComplete(instance); - } - function startWorker(time) { - if (!work.length) return; - highlight.set(time, operation(highlightWorker)); - } - - // Operations are used to wrap changes in such a way that each - // change won't have to update the cursor and display (which would - // be awkward, slow, and error-prone), but instead updates are - // batched and then all combined and executed at once. - function startOperation() { - updateInput = null; changes = []; textChanged = selectionChanged = false; - } - function endOperation() { - var reScroll = false; - if (selectionChanged) reScroll = !scrollCursorIntoView(); - if (changes.length) updateDisplay(changes); - else { - if (selectionChanged) updateCursor(); - if (gutterDirty) updateGutter(); - } - if (reScroll) scrollCursorIntoView(); - if (selectionChanged) {scrollEditorIntoView(); restartBlink();} - - // updateInput can be set to a boolean value to force/prevent an - // update. - if (focused && !leaveInputAlone && - (updateInput === true || (updateInput !== false && selectionChanged))) - prepareInput(); - - if (selectionChanged && options.matchBrackets) - setTimeout(operation(function() { - if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;} - matchBrackets(false); - }), 20); - var tc = textChanged; // textChanged can be reset by cursoractivity callback - if (selectionChanged && options.onCursorActivity) - options.onCursorActivity(instance); - if (tc && options.onChange && instance) - options.onChange(instance, tc); - } - var nestedOperation = 0; - function operation(f) { - return function() { - if (!nestedOperation++) startOperation(); - try {var result = f.apply(this, arguments);} - finally {if (!--nestedOperation) endOperation();} - return result; - }; - } - - function SearchCursor(query, pos, caseFold) { - this.atOccurrence = false; - if (caseFold == null) caseFold = typeof query == "string" && query == query.toLowerCase(); - - if (pos && typeof pos == "object") pos = clipPos(pos); - else pos = {line: 0, ch: 0}; - this.pos = {from: pos, to: pos}; - - // The matches method is filled in based on the type of query. - // It takes a position and a direction, and returns an object - // describing the next occurrence of the query, or null if no - // more matches were found. - if (typeof query != "string") // Regexp match - this.matches = function(reverse, pos) { - if (reverse) { - var line = lines[pos.line].text.slice(0, pos.ch), match = line.match(query), start = 0; - while (match) { - var ind = line.indexOf(match[0]); - start += ind; - line = line.slice(ind + 1); - var newmatch = line.match(query); - if (newmatch) match = newmatch; - else break; - start++; - } - } - else { - var line = lines[pos.line].text.slice(pos.ch), match = line.match(query), - start = match && pos.ch + line.indexOf(match[0]); - } - if (match) - return {from: {line: pos.line, ch: start}, - to: {line: pos.line, ch: start + match[0].length}, - match: match}; - }; - else { // String query - if (caseFold) query = query.toLowerCase(); - var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;}; - var target = query.split("\n"); - // Different methods for single-line and multi-line queries - if (target.length == 1) - this.matches = function(reverse, pos) { - var line = fold(lines[pos.line].text), len = query.length, match; - if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1) - : (match = line.indexOf(query, pos.ch)) != -1) - return {from: {line: pos.line, ch: match}, - to: {line: pos.line, ch: match + len}}; - }; - else - this.matches = function(reverse, pos) { - var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(lines[ln].text); - var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match)); - if (reverse ? offsetA >= pos.ch || offsetA != match.length - : offsetA <= pos.ch || offsetA != line.length - match.length) - return; - for (;;) { - if (reverse ? !ln : ln == lines.length - 1) return; - line = fold(lines[ln += reverse ? -1 : 1].text); - match = target[reverse ? --idx : ++idx]; - if (idx > 0 && idx < target.length - 1) { - if (line != match) return; - else continue; - } - var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length); - if (reverse ? offsetB != line.length - match.length : offsetB != match.length) - return; - var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB}; - return {from: reverse ? end : start, to: reverse ? start : end}; - } - }; - } - } - - SearchCursor.prototype = { - findNext: function() {return this.find(false);}, - findPrevious: function() {return this.find(true);}, - - find: function(reverse) { - var self = this, pos = clipPos(reverse ? this.pos.from : this.pos.to); - function savePosAndFail(line) { - var pos = {line: line, ch: 0}; - self.pos = {from: pos, to: pos}; - self.atOccurrence = false; - return false; - } - - for (;;) { - if (this.pos = this.matches(reverse, pos)) { - this.atOccurrence = true; - return this.pos.match || true; - } - if (reverse) { - if (!pos.line) return savePosAndFail(0); - pos = {line: pos.line-1, ch: lines[pos.line-1].text.length}; - } - else { - if (pos.line == lines.length - 1) return savePosAndFail(lines.length); - pos = {line: pos.line+1, ch: 0}; - } - } - }, - - from: function() {if (this.atOccurrence) return copyPos(this.pos.from);}, - to: function() {if (this.atOccurrence) return copyPos(this.pos.to);}, - - replace: function(newText) { - var self = this; - if (this.atOccurrence) - operation(function() { - self.pos.to = replaceRange(newText, self.pos.from, self.pos.to); - })(); - } - }; - - for (var ext in extensions) - if (extensions.propertyIsEnumerable(ext) && - !instance.propertyIsEnumerable(ext)) - instance[ext] = extensions[ext]; - return instance; - } // (end of function CodeMirror) - - // The default configuration options. - CodeMirror.defaults = { - value: "", - mode: null, - theme: "default", - indentUnit: 2, - indentWithTabs: false, - tabMode: "classic", - enterMode: "indent", - electricChars: true, - onKeyEvent: null, - lineNumbers: false, - gutter: false, - fixedGutter: false, - firstLineNumber: 1, - readOnly: false, - smartHome: true, - onChange: null, - onCursorActivity: null, - onGutterClick: null, - onHighlightComplete: null, - onFocus: null, onBlur: null, onScroll: null, - matchBrackets: false, - workTime: 100, - workDelay: 200, - undoDepth: 40, - tabindex: null, - document: window.document - }; - - // Known modes, by name and by MIME - var modes = {}, mimeModes = {}; - CodeMirror.defineMode = function(name, mode) { - if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name; - modes[name] = mode; - }; - CodeMirror.defineMIME = function(mime, spec) { - mimeModes[mime] = spec; - }; - CodeMirror.getMode = function(options, spec) { - if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) - spec = mimeModes[spec]; - if (typeof spec == "string") - var mname = spec, config = {}; - else if (spec != null) - var mname = spec.name, config = spec; - var mfactory = modes[mname]; - if (!mfactory) { - if (window.console) console.warn("No mode " + mname + " found, falling back to plain text."); - return CodeMirror.getMode(options, "text/plain"); - } - return mfactory(options, config || {}); - }; - CodeMirror.listModes = function() { - var list = []; - for (var m in modes) - if (modes.propertyIsEnumerable(m)) list.push(m); - return list; - }; - CodeMirror.listMIMEs = function() { - var list = []; - for (var m in mimeModes) - if (mimeModes.propertyIsEnumerable(m)) list.push({mime: m, mode: mimeModes[m]}); - return list; - }; - - var extensions = {}; - CodeMirror.defineExtension = function(name, func) { - extensions[name] = func; - }; - - CodeMirror.fromTextArea = function(textarea, options) { - if (!options) options = {}; - options.value = textarea.value; - if (!options.tabindex && textarea.tabindex) - options.tabindex = textarea.tabindex; - - function save() {textarea.value = instance.getValue();} - if (textarea.form) { - // Deplorable hack to make the submit method do the right thing. - var rmSubmit = connect(textarea.form, "submit", save, true); - if (typeof textarea.form.submit == "function") { - var realSubmit = textarea.form.submit; - function wrappedSubmit() { - save(); - textarea.form.submit = realSubmit; - textarea.form.submit(); - textarea.form.submit = wrappedSubmit; - } - textarea.form.submit = wrappedSubmit; - } - } - - textarea.style.display = "none"; - var instance = CodeMirror(function(node) { - textarea.parentNode.insertBefore(node, textarea.nextSibling); - }, options); - instance.save = save; - instance.toTextArea = function() { - save(); - textarea.parentNode.removeChild(instance.getWrapperElement()); - textarea.style.display = ""; - if (textarea.form) { - rmSubmit(); - if (typeof textarea.form.submit == "function") - textarea.form.submit = realSubmit; - } - }; - return instance; - }; - - // Utility functions for working with state. Exported because modes - // sometimes need to do this. - function copyState(mode, state) { - if (state === true) return state; - if (mode.copyState) return mode.copyState(state); - var nstate = {}; - for (var n in state) { - var val = state[n]; - if (val instanceof Array) val = val.concat([]); - nstate[n] = val; - } - return nstate; - } - CodeMirror.startState = startState; - function startState(mode, a1, a2) { - return mode.startState ? mode.startState(a1, a2) : true; - } - CodeMirror.copyState = copyState; - - // The character stream used by a mode's parser. - function StringStream(string) { - this.pos = this.start = 0; - this.string = string; - } - StringStream.prototype = { - eol: function() {return this.pos >= this.string.length;}, - sol: function() {return this.pos == 0;}, - peek: function() {return this.string.charAt(this.pos);}, - next: function() { - if (this.pos < this.string.length) - return this.string.charAt(this.pos++); - }, - eat: function(match) { - var ch = this.string.charAt(this.pos); - if (typeof match == "string") var ok = ch == match; - else var ok = ch && (match.test ? match.test(ch) : match(ch)); - if (ok) {++this.pos; return ch;} - }, - eatWhile: function(match) { - var start = this.pos; - while (this.eat(match)){} - return this.pos > start; - }, - eatSpace: function() { - var start = this.pos; - while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; - return this.pos > start; - }, - skipToEnd: function() {this.pos = this.string.length;}, - skipTo: function(ch) { - var found = this.string.indexOf(ch, this.pos); - if (found > -1) {this.pos = found; return true;} - }, - backUp: function(n) {this.pos -= n;}, - column: function() {return countColumn(this.string, this.start);}, - indentation: function() {return countColumn(this.string);}, - match: function(pattern, consume, caseInsensitive) { - if (typeof pattern == "string") { - function cased(str) {return caseInsensitive ? str.toLowerCase() : str;} - if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) { - if (consume !== false) this.pos += pattern.length; - return true; - } - } - else { - var match = this.string.slice(this.pos).match(pattern); - if (match && consume !== false) this.pos += match[0].length; - return match; - } - }, - current: function(){return this.string.slice(this.start, this.pos);} - }; - CodeMirror.StringStream = StringStream; - - // Line objects. These hold state related to a line, including - // highlighting info (the styles array). - function Line(text, styles) { - this.styles = styles || [text, null]; - this.stateAfter = null; - this.text = text; - this.marked = this.gutterMarker = this.className = null; - } - Line.inheritMarks = function(text, orig) { - var ln = new Line(text), mk = orig.marked; - if (mk) { - for (var i = 0; i < mk.length; ++i) { - if (mk[i].to == null) { - var newmk = ln.marked || (ln.marked = []), mark = mk[i]; - newmk.push({from: null, to: null, style: mark.style, set: mark.set}); - mark.set.push(ln); - } - } - } - return ln; - } - Line.prototype = { - // Replace a piece of a line, keeping the styles around it intact. - replace: function(from, to_, text) { - var st = [], mk = this.marked, to = to_ == null ? this.text.length : to_; - copyStyles(0, from, this.styles, st); - if (text) st.push(text, null); - copyStyles(to, this.text.length, this.styles, st); - this.styles = st; - this.text = this.text.slice(0, from) + text + this.text.slice(to); - this.stateAfter = null; - if (mk) { - var diff = text.length - (to - from), end = this.text.length; - var changeStart = Math.min(from, from + diff); - for (var i = 0; i < mk.length; ++i) { - var mark = mk[i], del = false; - if (mark.from != null && mark.from >= end) del = true; - else { - if (mark.from != null && mark.from >= from) { - mark.from += diff; - if (mark.from <= 0) mark.from = from == null ? null : 0; - } - else if (to_ == null) mark.to = null; - if (mark.to != null && mark.to > from) { - mark.to += diff; - if (mark.to < 0) del = true; - } - } - if (del || (mark.from != null && mark.to != null && mark.from >= mark.to)) mk.splice(i--, 1); - } - } - }, - // Split a part off a line, keeping styles and markers intact. - split: function(pos, textBefore) { - var st = [textBefore, null], mk = this.marked; - copyStyles(pos, this.text.length, this.styles, st); - var taken = new Line(textBefore + this.text.slice(pos), st); - if (mk) { - for (var i = 0; i < mk.length; ++i) { - var mark = mk[i]; - if (mark.to > pos || mark.to == null) { - if (!taken.marked) taken.marked = []; - taken.marked.push({ - from: mark.from < pos || mark.from == null ? null : mark.from - pos + textBefore.length, - to: mark.to == null ? null : mark.to - pos + textBefore.length, - style: mark.style, set: mark.set - }); - mark.set.push(taken); - } - } - } - return taken; - }, - append: function(line) { - if (!line.text.length) return; - var mylen = this.text.length, mk = line.marked; - this.text += line.text; - copyStyles(0, line.text.length, line.styles, this.styles); - if (mk && mk.length) { - var mymk = this.marked || (this.marked = []); - for (var i = 0; i < mymk.length; ++i) - if (mymk[i].to == null) mymk[i].to = mylen; - outer: for (var i = 0; i < mk.length; ++i) { - var mark = mk[i]; - if (!mark.from) { - for (var j = 0; j < mymk.length; ++j) { - var mymark = mymk[j]; - if (mymark.to == mylen && mymark.set == mark.set) { - mymark.to = mark.to == null ? null : mark.to + mylen; - continue outer; - } - } - } - mymk.push(mark); - mark.set.push(this); - mark.from += mylen; - if (mark.to != null) mark.to += mylen; - } - } - }, - addMark: function(from, to, style, set) { - set.push(this); - if (this.marked == null) this.marked = []; - this.marked.push({from: from, to: to, style: style, set: set}); - this.marked.sort(function(a, b){return (a.from || 0) - (b.from || 0);}); - }, - // Run the given mode's parser over a line, update the styles - // array, which contains alternating fragments of text and CSS - // classes. - highlight: function(mode, state) { - var stream = new StringStream(this.text), st = this.styles, pos = 0; - var changed = false, curWord = st[0], prevWord; - if (this.text == "" && mode.blankLine) mode.blankLine(state); - while (!stream.eol()) { - var style = mode.token(stream, state); - var substr = this.text.slice(stream.start, stream.pos); - stream.start = stream.pos; - if (pos && st[pos-1] == style) - st[pos-2] += substr; - else if (substr) { - if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true; - st[pos++] = substr; st[pos++] = style; - prevWord = curWord; curWord = st[pos]; - } - // Give up when line is ridiculously long - if (stream.pos > 5000) { - st[pos++] = this.text.slice(stream.pos); st[pos++] = null; - break; - } - } - if (st.length != pos) {st.length = pos; changed = true;} - if (pos && st[pos-2] != prevWord) changed = true; - // Short lines with simple highlights return null, and are - // counted as changed by the driver because they are likely to - // highlight the same way in various contexts. - return changed || (st.length < 5 && this.text.length < 10 ? null : false); - }, - // Fetch the parser token for a given character. Useful for hacks - // that want to inspect the mode state (say, for completion). - getTokenAt: function(mode, state, ch) { - var txt = this.text, stream = new StringStream(txt); - while (stream.pos < ch && !stream.eol()) { - stream.start = stream.pos; - var style = mode.token(stream, state); - } - return {start: stream.start, - end: stream.pos, - string: stream.current(), - className: style || null, - state: state}; - }, - indentation: function() {return countColumn(this.text);}, - // Produces an HTML fragment for the line, taking selection, - // marking, and highlighting into account. - getHTML: function(sfrom, sto, includePre, endAt) { - var html = []; - if (includePre) - html.push(this.className ? '
    ': "
    ");
    -      function span(text, style) {
    -        if (!text) return;
    -        if (style) html.push('', htmlEscape(text), "");
    -        else html.push(htmlEscape(text));
    -      }
    -      var st = this.styles, allText = this.text, marked = this.marked;
    -      if (sfrom == sto) sfrom = null;
    -      var len = allText.length;
    -      if (endAt != null) len = Math.min(endAt, len);
    -
    -      if (!allText && endAt == null)
    -        span(" ", sfrom != null && sto == null ? "CodeMirror-selected" : null);
    -      else if (!marked && sfrom == null)
    -        for (var i = 0, ch = 0; ch < len; i+=2) {
    -          var str = st[i], style = st[i+1], l = str.length;
    -          if (ch + l > len) str = str.slice(0, len - ch);
    -          ch += l;
    -          span(str, style && "cm-" + style);
    -        }
    -      else {
    -        var pos = 0, i = 0, text = "", style, sg = 0;
    -        var markpos = -1, mark = null;
    -        function nextMark() {
    -          if (marked) {
    -            markpos += 1;
    -            mark = (markpos < marked.length) ? marked[markpos] : null;
    -          }
    -        }
    -        nextMark();
    -        while (pos < len) {
    -          var upto = len;
    -          var extraStyle = "";
    -          if (sfrom != null) {
    -            if (sfrom > pos) upto = sfrom;
    -            else if (sto == null || sto > pos) {
    -              extraStyle = " CodeMirror-selected";
    -              if (sto != null) upto = Math.min(upto, sto);
    -            }
    -          }
    -          while (mark && mark.to != null && mark.to <= pos) nextMark();
    -          if (mark) {
    -            if (mark.from > pos) upto = Math.min(upto, mark.from);
    -            else {
    -              extraStyle += " " + mark.style;
    -              if (mark.to != null) upto = Math.min(upto, mark.to);
    -            }
    -          }
    -          for (;;) {
    -            var end = pos + text.length;
    -            var appliedStyle = style;
    -            if (extraStyle) appliedStyle = style ? style + extraStyle : extraStyle;
    -            span(end > upto ? text.slice(0, upto - pos) : text, appliedStyle);
    -            if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
    -            pos = end;
    -            text = st[i++]; style = "cm-" + st[i++];
    -          }
    -        }
    -        if (sfrom != null && sto == null) span(" ", "CodeMirror-selected");
    -      }
    -      if (includePre) html.push("
    "); - return html.join(""); - } - }; - // Utility used by replace and split above - function copyStyles(from, to, source, dest) { - for (var i = 0, pos = 0, state = 0; pos < to; i+=2) { - var part = source[i], end = pos + part.length; - if (state == 0) { - if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]); - if (end >= from) state = 1; - } - else if (state == 1) { - if (end > to) dest.push(part.slice(0, to - pos), source[i+1]); - else dest.push(part, source[i+1]); - } - pos = end; - } - } - - // The history object 'chunks' changes that are made close together - // and at almost the same time into bigger undoable units. - function History() { - this.time = 0; - this.done = []; this.undone = []; - } - History.prototype = { - addChange: function(start, added, old) { - this.undone.length = 0; - var time = +new Date, last = this.done[this.done.length - 1]; - if (time - this.time > 400 || !last || - last.start > start + added || last.start + last.added < start - last.added + last.old.length) - this.done.push({start: start, added: added, old: old}); - else { - var oldoff = 0; - if (start < last.start) { - for (var i = last.start - start - 1; i >= 0; --i) - last.old.unshift(old[i]); - last.added += last.start - start; - last.start = start; - } - else if (last.start < start) { - oldoff = start - last.start; - added += oldoff; - } - for (var i = last.added - oldoff, e = old.length; i < e; ++i) - last.old.push(old[i]); - if (last.added < added) last.added = added; - } - this.time = time; - } - }; - - function stopMethod() {e_stop(this);} - // Ensure an event has a stop method. - function addStop(event) { - if (!event.stop) event.stop = stopMethod; - return event; - } - - function e_preventDefault(e) { - if (e.preventDefault) e.preventDefault(); - else e.returnValue = false; - } - function e_stopPropagation(e) { - if (e.stopPropagation) e.stopPropagation(); - else e.cancelBubble = true; - } - function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);} - function e_target(e) {return e.target || e.srcElement;} - function e_button(e) { - if (e.which) return e.which; - else if (e.button & 1) return 1; - else if (e.button & 2) return 3; - else if (e.button & 4) return 2; - } - - // Event handler registration. If disconnect is true, it'll return a - // function that unregisters the handler. - function connect(node, type, handler, disconnect) { - function wrapHandler(event) {handler(event || window.event);} - if (typeof node.addEventListener == "function") { - node.addEventListener(type, wrapHandler, false); - if (disconnect) return function() {node.removeEventListener(type, wrapHandler, false);}; - } - else { - node.attachEvent("on" + type, wrapHandler); - if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);}; - } - } - - function Delayed() {this.id = null;} - Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}}; - - // Some IE versions don't preserve whitespace when setting the - // innerHTML of a PRE tag. - var badInnerHTML = (function() { - var pre = document.createElement("pre"); - pre.innerHTML = " "; return !pre.innerHTML; - })(); - - // Detect drag-and-drop - var dragAndDrop = (function() { - // IE8 has ondragstart and ondrop properties, but doesn't seem to - // actually support ondragstart the way it's supposed to work. - if (/MSIE [1-8]\b/.test(navigator.userAgent)) return false; - var div = document.createElement('div'); - return "ondragstart" in div && "ondrop" in div; - })(); - - var gecko = /gecko\/\d{7}/i.test(navigator.userAgent); - var ie = /MSIE \d/.test(navigator.userAgent); - var safari = /Apple Computer/.test(navigator.vendor); - - var lineSep = "\n"; - // Feature-detect whether newlines in textareas are converted to \r\n - (function () { - var te = document.createElement("textarea"); - te.value = "foo\nbar"; - if (te.value.indexOf("\r") > -1) lineSep = "\r\n"; - }()); - - var tabSize = 8; - var mac = /Mac/.test(navigator.platform); - var movementKeys = {}; - for (var i = 35; i <= 40; ++i) - movementKeys[i] = movementKeys["c" + i] = true; - - // Counts the column offset in a string, taking tabs into account. - // Used mostly to find indentation. - function countColumn(string, end) { - if (end == null) { - end = string.search(/[^\s\u00a0]/); - if (end == -1) end = string.length; - } - for (var i = 0, n = 0; i < end; ++i) { - if (string.charAt(i) == "\t") n += tabSize - (n % tabSize); - else ++n; - } - return n; - } - - function computedStyle(elt) { - if (elt.currentStyle) return elt.currentStyle; - return window.getComputedStyle(elt, null); - } - // Find the position of an element by following the offsetParent chain. - // If screen==true, it returns screen (rather than page) coordinates. - function eltOffset(node, screen) { - var doc = node.ownerDocument.body; - var x = 0, y = 0, skipDoc = false; - for (var n = node; n; n = n.offsetParent) { - x += n.offsetLeft; y += n.offsetTop; - if (screen && computedStyle(n).position == "fixed") - skipDoc = true; - } - var e = screen && !skipDoc ? null : doc; - for (var n = node.parentNode; n != e; n = n.parentNode) - if (n.scrollLeft != null) { x -= n.scrollLeft; y -= n.scrollTop;} - return {left: x, top: y}; - } - // Get a node's text content. - function eltText(node) { - return node.textContent || node.innerText || node.nodeValue || ""; - } - - // Operations on {line, ch} objects. - function posEq(a, b) {return a.line == b.line && a.ch == b.ch;} - function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);} - function copyPos(x) {return {line: x.line, ch: x.ch};} - - var escapeElement = document.createElement("pre"); - function htmlEscape(str) { - if (badTextContent) { - escapeElement.innerHTML = ""; - escapeElement.appendChild(document.createTextNode(str)); - } else { - escapeElement.textContent = str; - } - return escapeElement.innerHTML; - } - var badTextContent = htmlEscape("\t") != "\t"; - CodeMirror.htmlEscape = htmlEscape; - - // Used to position the cursor after an undo/redo by finding the - // last edited character. - function editEnd(from, to) { - if (!to) return from ? from.length : 0; - if (!from) return to.length; - for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j) - if (from.charAt(i) != to.charAt(j)) break; - return j + 1; - } - - function indexOf(collection, elt) { - if (collection.indexOf) return collection.indexOf(elt); - for (var i = 0, e = collection.length; i < e; ++i) - if (collection[i] == elt) return i; - return -1; - } - - // See if "".split is the broken IE version, if so, provide an - // alternative way to split lines. - var splitLines, selRange, setSelRange; - if ("\n\nb".split(/\n/).length != 3) - splitLines = function(string) { - var pos = 0, nl, result = []; - while ((nl = string.indexOf("\n", pos)) > -1) { - result.push(string.slice(pos, string.charAt(nl-1) == "\r" ? nl - 1 : nl)); - pos = nl + 1; - } - result.push(string.slice(pos)); - return result; - }; - else - splitLines = function(string){return string.split(/\r?\n/);}; - CodeMirror.splitLines = splitLines; - - // Sane model of finding and setting the selection in a textarea - if (window.getSelection) { - selRange = function(te) { - try {return {start: te.selectionStart, end: te.selectionEnd};} - catch(e) {return null;} - }; - if (safari) - // On Safari, selection set with setSelectionRange are in a sort - // of limbo wrt their anchor. If you press shift-left in them, - // the anchor is put at the end, and the selection expanded to - // the left. If you press shift-right, the anchor ends up at the - // front. This is not what CodeMirror wants, so it does a - // spurious modify() call to get out of limbo. - setSelRange = function(te, start, end) { - if (start == end) - te.setSelectionRange(start, end); - else { - te.setSelectionRange(start, end - 1); - window.getSelection().modify("extend", "forward", "character"); - } - }; - else - setSelRange = function(te, start, end) { - try {te.setSelectionRange(start, end);} - catch(e) {} // Fails on Firefox when textarea isn't part of the document - }; - } - // IE model. Don't ask. - else { - selRange = function(te) { - try {var range = te.ownerDocument.selection.createRange();} - catch(e) {return null;} - if (!range || range.parentElement() != te) return null; - var val = te.value, len = val.length, localRange = te.createTextRange(); - localRange.moveToBookmark(range.getBookmark()); - var endRange = te.createTextRange(); - endRange.collapse(false); - - if (localRange.compareEndPoints("StartToEnd", endRange) > -1) - return {start: len, end: len}; - - var start = -localRange.moveStart("character", -len); - for (var i = val.indexOf("\r"); i > -1 && i < start; i = val.indexOf("\r", i+1), start++) {} - - if (localRange.compareEndPoints("EndToEnd", endRange) > -1) - return {start: start, end: len}; - - var end = -localRange.moveEnd("character", -len); - for (var i = val.indexOf("\r"); i > -1 && i < end; i = val.indexOf("\r", i+1), end++) {} - return {start: start, end: end}; - }; - setSelRange = function(te, start, end) { - var range = te.createTextRange(); - range.collapse(true); - var endrange = range.duplicate(); - var newlines = 0, txt = te.value; - for (var pos = txt.indexOf("\n"); pos > -1 && pos < start; pos = txt.indexOf("\n", pos + 1)) - ++newlines; - range.move("character", start - newlines); - for (; pos > -1 && pos < end; pos = txt.indexOf("\n", pos + 1)) - ++newlines; - endrange.move("character", end - newlines); - range.setEndPoint("EndToEnd", endrange); - range.select(); - }; - } - - CodeMirror.defineMode("null", function() { - return {token: function(stream) {stream.skipToEnd();}}; - }); - CodeMirror.defineMIME("text/plain", "null"); - - return CodeMirror; -})(); diff --git a/assets/js/codemirror.js b/assets/js/codemirror.js new file mode 120000 index 00000000..057447c6 --- /dev/null +++ b/assets/js/codemirror.js @@ -0,0 +1 @@ +/var/www/html/admin/modules/endpointman/assets/js/codemirror.js \ No newline at end of file diff --git a/assets/js/jquery.coda-slider-2.0.js b/assets/js/jquery.coda-slider-2.0.js deleted file mode 100644 index ce43e4a9..00000000 --- a/assets/js/jquery.coda-slider-2.0.js +++ /dev/null @@ -1,235 +0,0 @@ -/* - jQuery Coda-Slider v2.0 - http://www.ndoherty.biz/coda-slider - Copyright (c) 2009 Niall Doherty - This plugin available for use in all personal or commercial projects under both MIT and GPL licenses. -*/ - -$(function(){ - // Remove the coda-slider-no-js class from the body - $("body").removeClass("coda-slider-no-js"); - // Preloader - // TODO: fix - //$(".coda-slider").children('.panel').hide().end().prepend('

    Loading...
    loading...

    '); -}); - -var sliderCount = 1; - -$.fn.codaSlider = function(settings) { - - settings = $.extend({ - autoHeight: true, - autoHeightEaseDuration: 1000, - autoHeightEaseFunction: "easeInOutExpo", - autoSlide: false, - autoSlideInterval: 7000, - autoSlideStopWhenClicked: true, - crossLinking: true, - dynamicArrows: true, - dynamicArrowLeftText: "« left", - dynamicArrowRightText: "right »", - dynamicTabs: true, - dynamicTabsAlign: "center", - dynamicTabsPosition: "top", - externalTriggerSelector: "a.xtrig", - firstPanelToLoad: 1, - panelTitleSelector: "h2.title", - slideEaseDuration: 1000, - slideEaseFunction: "easeInOutExpo" - }, settings); - - return this.each(function(){ - - // Uncomment the line below to test your preloader - // alert("Testing preloader"); - - var slider = $(this); - - // If we need arrows - if (settings.dynamicArrows) { - slider.parent().addClass("arrows"); - slider.before(''); - slider.after(''); - }; - - var panelWidth = slider.find(".panel").width(); - var panelCount = slider.find(".panel").size(); - var panelContainerWidth = panelWidth*panelCount; - var navClicks = 0; // Used if autoSlideStopWhenClicked = true - - // Surround the collection of panel divs with a container div (wide enough for all panels to be lined up end-to-end) - $('.panel', slider).wrapAll('
    '); - // Specify the width of the container div (wide enough for all panels to be lined up end-to-end) - $(".panel-container", slider).css({ width: panelContainerWidth }); - - // Specify the current panel. - // If the loaded URL has a hash (cross-linking), we're going to use that hash to give the slider a specific starting position... - if (settings.crossLinking && location.hash && parseInt(location.hash.slice(1)) <= panelCount) { - var currentPanel = parseInt(location.hash.slice(1)); - var offset = - (panelWidth*(currentPanel - 1)); - $('.panel-container', slider).css({ marginLeft: offset }); - // If that's not the case, check to see if we're supposed to load a panel other than Panel 1 initially... - } else if (settings.firstPanelToLoad != 1 && settings.firstPanelToLoad <= panelCount) { - var currentPanel = settings.firstPanelToLoad; - var offset = - (panelWidth*(currentPanel - 1)); - $('.panel-container', slider).css({ marginLeft: offset }); - // Otherwise, we'll just set the current panel to 1... - } else { - var currentPanel = 1; - }; - - // Left arrow click - $("#coda-nav-left-" + sliderCount + " a").click(function(){ - navClicks++; - if (currentPanel == 1) { - offset = - (panelWidth*(panelCount - 1)); - alterPanelHeight(panelCount - 1); - currentPanel = panelCount; - slider.siblings('.coda-nav').find('a.current').removeClass('current').parents('ul').find('li:last a').addClass('current'); - } else { - currentPanel -= 1; - alterPanelHeight(currentPanel - 1); - offset = - (panelWidth*(currentPanel - 1)); - slider.siblings('.coda-nav').find('a.current').removeClass('current').parent().prev().find('a').addClass('current'); - }; - $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); - if (settings.crossLinking) { location.hash = currentPanel }; // Change the URL hash (cross-linking) - return false; - }); - - // Right arrow click - $('#coda-nav-right-' + sliderCount + ' a').click(function(){ - navClicks++; - if (currentPanel == panelCount) { - offset = 0; - currentPanel = 1; - alterPanelHeight(0); - slider.siblings('.coda-nav').find('a.current').removeClass('current').parents('ul').find('a:eq(0)').addClass('current'); - } else { - offset = - (panelWidth*currentPanel); - alterPanelHeight(currentPanel); - currentPanel += 1; - slider.siblings('.coda-nav').find('a.current').removeClass('current').parent().next().find('a').addClass('current'); - }; - $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); - if (settings.crossLinking) { location.hash = currentPanel }; // Change the URL hash (cross-linking) - return false; - }); - - // If we need a dynamic menu - if (settings.dynamicTabs) { - var dynamicTabs = '
      '; - switch (settings.dynamicTabsPosition) { - case "bottom": - slider.parent().append(dynamicTabs); - break; - default: - slider.parent().prepend(dynamicTabs); - break; - }; - ul = $('#coda-nav-' + sliderCount + ' ul'); - // Create the nav items - $('.panel', slider).each(function(n) { - ul.append('
    • ' + $(this).find(settings.panelTitleSelector).text() + '
    • '); - }); - navContainerWidth = slider.width() + slider.siblings('.coda-nav-left').width() + slider.siblings('.coda-nav-right').width(); - ul.parent().css({ width: navContainerWidth }); - switch (settings.dynamicTabsAlign) { - case "center": - ul.css({ width: ($("li", ul).width() + 2) * panelCount }); - break; - case "right": - ul.css({ float: 'right' }); - break; - }; - }; - - // If we need a tabbed nav - $('#coda-nav-' + sliderCount + ' a').each(function(z) { - // What happens when a nav link is clicked - $(this).bind("click", function() { - navClicks++; - $(this).addClass('current').parents('ul').find('a').not($(this)).removeClass('current'); - offset = - (panelWidth*z); - alterPanelHeight(z); - currentPanel = z + 1; - $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); - if (!settings.crossLinking) { return false }; // Don't change the URL hash unless cross-linking is specified - }); - }); - - // External triggers (anywhere on the page) - $(settings.externalTriggerSelector).each(function() { - // Make sure this only affects the targeted slider - if (sliderCount == parseInt($(this).attr("rel").slice(12))) { - $(this).bind("click", function() { - navClicks++; - targetPanel = parseInt($(this).attr("href").slice(1)); - offset = - (panelWidth*(targetPanel - 1)); - alterPanelHeight(targetPanel - 1); - currentPanel = targetPanel; - // Switch the current tab: - slider.siblings('.coda-nav').find('a').removeClass('current').parents('ul').find('li:eq(' + (targetPanel - 1) + ') a').addClass('current'); - // Slide - $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); - if (!settings.crossLinking) { return false }; // Don't change the URL hash unless cross-linking is specified - }); - }; - }); - - // Specify which tab is initially set to "current". Depends on if the loaded URL had a hash or not (cross-linking). - if (settings.crossLinking && location.hash && parseInt(location.hash.slice(1)) <= panelCount) { - $("#coda-nav-" + sliderCount + " a:eq(" + (location.hash.slice(1) - 1) + ")").addClass("current"); - // If there's no cross-linking, check to see if we're supposed to load a panel other than Panel 1 initially... - } else if (settings.firstPanelToLoad != 1 && settings.firstPanelToLoad <= panelCount) { - $("#coda-nav-" + sliderCount + " a:eq(" + (settings.firstPanelToLoad - 1) + ")").addClass("current"); - // Otherwise we must be loading Panel 1, so make the first tab the current one. - } else { - $("#coda-nav-" + sliderCount + " a:eq(0)").addClass("current"); - }; - - // Set the height of the first panel - if (settings.autoHeight) { - panelHeight = $('.panel:eq(' + (currentPanel - 1) + ')', slider).height(); - slider.css({ height: panelHeight }); - }; - - // Trigger autoSlide - if (settings.autoSlide) { - slider.ready(function() { - setTimeout(autoSlide,settings.autoSlideInterval); - }); - }; - - function alterPanelHeight(x) { - if (settings.autoHeight) { - panelHeight = $('.panel:eq(' + x + ')', slider).height() - slider.animate({ height: panelHeight }, settings.autoHeightEaseDuration, settings.autoHeightEaseFunction); - }; - }; - - function autoSlide() { - if (navClicks == 0 || !settings.autoSlideStopWhenClicked) { - if (currentPanel == panelCount) { - var offset = 0; - currentPanel = 1; - } else { - var offset = - (panelWidth*currentPanel); - currentPanel += 1; - }; - alterPanelHeight(currentPanel - 1); - // Switch the current tab: - slider.siblings('.coda-nav').find('a').removeClass('current').parents('ul').find('li:eq(' + (currentPanel - 1) + ') a').addClass('current'); - // Slide: - $('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction); - setTimeout(autoSlide,settings.autoSlideInterval); - }; - }; - - // Kill the preloader - $('.panel', slider).show().end().find("p.loading").remove(); - slider.removeClass("preload"); - - sliderCount++; - - }); -}; \ No newline at end of file diff --git a/assets/js/jquery.coda-slider-2.0.js b/assets/js/jquery.coda-slider-2.0.js new file mode 120000 index 00000000..4e96d6fd --- /dev/null +++ b/assets/js/jquery.coda-slider-2.0.js @@ -0,0 +1 @@ +/var/www/html/admin/modules/endpointman/assets/js/jquery.coda-slider-2.0.js \ No newline at end of file diff --git a/assets/js/jquery.cookie.js b/assets/js/jquery.cookie.js deleted file mode 100644 index a80bfa29..00000000 --- a/assets/js/jquery.cookie.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Cookie plugin - * - * Copyright (c) 2006 Klaus Hartl (stilbuero.de) - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - */ - -/** - * Create a cookie with the given name and value and other optional parameters. - * - * @example $.cookie('the_cookie', 'the_value'); - * @desc Set the value of a cookie. - * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); - * @desc Create a cookie with all available options. - * @example $.cookie('the_cookie', 'the_value'); - * @desc Create a session cookie. - * @example $.cookie('the_cookie', null); - * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain - * used when the cookie was set. - * - * @param String name The name of the cookie. - * @param String value The value of the cookie. - * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. - * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. - * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. - * If set to null or omitted, the cookie will be a session cookie and will not be retained - * when the the browser exits. - * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). - * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). - * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will - * require a secure protocol (like HTTPS). - * @type undefined - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ - -/** - * Get the value of a cookie with the given name. - * - * @example $.cookie('the_cookie'); - * @desc Get the value of a cookie. - * - * @param String name The name of the cookie. - * @return The value of the cookie. - * @type String - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ -jQuery.cookie = function(name, value, options) { - if (typeof value != 'undefined') { // name and value given, set cookie - options = options || {}; - if (value === null) { - value = ''; - options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed - options.expires = -1; - } - var expires = ''; - if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { - var date; - if (typeof options.expires == 'number') { - date = new Date(); - date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); - } else { - date = options.expires; - } - expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE - } - // NOTE Needed to parenthesize options.path and options.domain - // in the following expressions, otherwise they evaluate to undefined - // in the packed version for some reason... - var path = options.path ? '; path=' + (options.path) : ''; - var domain = options.domain ? '; domain=' + (options.domain) : ''; - var secure = options.secure ? '; secure' : ''; - document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); - } else { // only name given, get cookie - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; - } -}; \ No newline at end of file diff --git a/assets/js/jquery.cookie.js b/assets/js/jquery.cookie.js new file mode 120000 index 00000000..3218a886 --- /dev/null +++ b/assets/js/jquery.cookie.js @@ -0,0 +1 @@ +/var/www/html/admin/modules/endpointman/assets/js/jquery.cookie.js \ No newline at end of file diff --git a/assets/js/jquery.easing.1.3.js b/assets/js/jquery.easing.1.3.js deleted file mode 100644 index ef743210..00000000 --- a/assets/js/jquery.easing.1.3.js +++ /dev/null @@ -1,205 +0,0 @@ -/* - * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ - * - * Uses the built in easing capabilities added In jQuery 1.1 - * to offer multiple easing options - * - * TERMS OF USE - jQuery Easing - * - * Open source under the BSD License. - * - * Copyright © 2008 George McGinley Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * Neither the name of the author nor the names of contributors may be used to endorse - * or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * -*/ - -// t: current time, b: begInnIng value, c: change In value, d: duration -jQuery.easing['jswing'] = jQuery.easing['swing']; - -jQuery.extend( jQuery.easing, -{ - def: 'easeOutQuad', - swing: function (x, t, b, c, d) { - //alert(jQuery.easing.default); - return jQuery.easing[jQuery.easing.def](x, t, b, c, d); - }, - easeInQuad: function (x, t, b, c, d) { - return c*(t/=d)*t + b; - }, - easeOutQuad: function (x, t, b, c, d) { - return -c *(t/=d)*(t-2) + b; - }, - easeInOutQuad: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t + b; - return -c/2 * ((--t)*(t-2) - 1) + b; - }, - easeInCubic: function (x, t, b, c, d) { - return c*(t/=d)*t*t + b; - }, - easeOutCubic: function (x, t, b, c, d) { - return c*((t=t/d-1)*t*t + 1) + b; - }, - easeInOutCubic: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t + b; - return c/2*((t-=2)*t*t + 2) + b; - }, - easeInQuart: function (x, t, b, c, d) { - return c*(t/=d)*t*t*t + b; - }, - easeOutQuart: function (x, t, b, c, d) { - return -c * ((t=t/d-1)*t*t*t - 1) + b; - }, - easeInOutQuart: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t*t + b; - return -c/2 * ((t-=2)*t*t*t - 2) + b; - }, - easeInQuint: function (x, t, b, c, d) { - return c*(t/=d)*t*t*t*t + b; - }, - easeOutQuint: function (x, t, b, c, d) { - return c*((t=t/d-1)*t*t*t*t + 1) + b; - }, - easeInOutQuint: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; - return c/2*((t-=2)*t*t*t*t + 2) + b; - }, - easeInSine: function (x, t, b, c, d) { - return -c * Math.cos(t/d * (Math.PI/2)) + c + b; - }, - easeOutSine: function (x, t, b, c, d) { - return c * Math.sin(t/d * (Math.PI/2)) + b; - }, - easeInOutSine: function (x, t, b, c, d) { - return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; - }, - easeInExpo: function (x, t, b, c, d) { - return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; - }, - easeOutExpo: function (x, t, b, c, d) { - return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; - }, - easeInOutExpo: function (x, t, b, c, d) { - if (t==0) return b; - if (t==d) return b+c; - if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; - return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; - }, - easeInCirc: function (x, t, b, c, d) { - return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; - }, - easeOutCirc: function (x, t, b, c, d) { - return c * Math.sqrt(1 - (t=t/d-1)*t) + b; - }, - easeInOutCirc: function (x, t, b, c, d) { - if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; - return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; - }, - easeInElastic: function (x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; - }, - easeOutElastic: function (x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; - }, - easeInOutElastic: function (x, t, b, c, d) { - var s=1.70158;var p=0;var a=c; - if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); - if (a < Math.abs(c)) { a=c; var s=p/4; } - else var s = p/(2*Math.PI) * Math.asin (c/a); - if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; - return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; - }, - easeInBack: function (x, t, b, c, d, s) { - if (s == undefined) s = 1.70158; - return c*(t/=d)*t*((s+1)*t - s) + b; - }, - easeOutBack: function (x, t, b, c, d, s) { - if (s == undefined) s = 1.70158; - return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; - }, - easeInOutBack: function (x, t, b, c, d, s) { - if (s == undefined) s = 1.70158; - if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; - return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; - }, - easeInBounce: function (x, t, b, c, d) { - return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; - }, - easeOutBounce: function (x, t, b, c, d) { - if ((t/=d) < (1/2.75)) { - return c*(7.5625*t*t) + b; - } else if (t < (2/2.75)) { - return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; - } else if (t < (2.5/2.75)) { - return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; - } else { - return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; - } - }, - easeInOutBounce: function (x, t, b, c, d) { - if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; - return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; - } -}); - -/* - * - * TERMS OF USE - EASING EQUATIONS - * - * Open source under the BSD License. - * - * Copyright © 2001 Robert Penner - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * Neither the name of the author nor the names of contributors may be used to endorse - * or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ \ No newline at end of file diff --git a/assets/js/jquery.easing.1.3.js b/assets/js/jquery.easing.1.3.js new file mode 120000 index 00000000..e072e293 --- /dev/null +++ b/assets/js/jquery.easing.1.3.js @@ -0,0 +1 @@ +/var/www/html/admin/modules/endpointman/assets/js/jquery.easing.1.3.js \ No newline at end of file diff --git a/assets/js/jquery.jstree.js b/assets/js/jquery.jstree.js deleted file mode 100644 index 0eea2f66..00000000 --- a/assets/js/jquery.jstree.js +++ /dev/null @@ -1,3510 +0,0 @@ -/* - * jsTree 1.0-rc1 - * http://jstree.com/ - * - * Copyright (c) 2010 Ivan Bozhanov (vakata.com) - * - * Dual licensed under the MIT and GPL licenses (same as jQuery): - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * $Date: 2010-07-01 10:51:11 +0300 (четв, 01 юли 2010) $ - * $Revision: 191 $ - */ - -/*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */ -/*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/ - -"use strict"; -// Common functions not related to jsTree -// decided to move them to a `vakata` "namespace" -(function ($) { - $.vakata = {}; - // CSS related functions - $.vakata.css = { - get_css : function(rule_name, delete_flag, sheet) { - rule_name = rule_name.toLowerCase(); - var css_rules = sheet.cssRules || sheet.rules, - j = 0; - do { - if(css_rules.length && j > css_rules.length + 5) { return false; } - if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) { - if(delete_flag === true) { - if(sheet.removeRule) { sheet.removeRule(j); } - if(sheet.deleteRule) { sheet.deleteRule(j); } - return true; - } - else { return css_rules[j]; } - } - } - while (css_rules[++j]); - return false; - }, - add_css : function(rule_name, sheet) { - if($.jstree.css.get_css(rule_name, false, sheet)) { return false; } - if(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); } - return $.vakata.css.get_css(rule_name); - }, - remove_css : function(rule_name, sheet) { - return $.vakata.css.get_css(rule_name, true, sheet); - }, - add_sheet : function(opts) { - var tmp; - if(opts.str) { - tmp = document.createElement("style"); - tmp.setAttribute('type',"text/css"); - if(tmp.styleSheet) { - document.getElementsByTagName("head")[0].appendChild(tmp); - tmp.styleSheet.cssText = opts.str; - } - else { - tmp.appendChild(document.createTextNode(opts.str)); - document.getElementsByTagName("head")[0].appendChild(tmp); - } - return tmp.sheet || tmp.styleSheet; - } - if(opts.url) { - if(document.createStyleSheet) { - try { tmp = document.createStyleSheet(opts.url); } catch (e) { } - } - else { - tmp = document.createElement('link'); - tmp.rel = 'stylesheet'; - tmp.type = 'text/css'; - tmp.media = "all"; - tmp.href = opts.url; - document.getElementsByTagName("head")[0].appendChild(tmp); - return tmp.styleSheet; - } - } - } - }; -})(jQuery); - -/* - * jsTree core 1.0 - */ -(function ($) { - // private variables - var instances = [], // instance array (used by $.jstree.reference/create/focused) - focused_instance = -1, // the index in the instance array of the currently focused instance - plugins = {}, // list of included plugins - prepared_move = {}, // for the move plugin - is_ie6 = false; - - // jQuery plugin wrapper (thanks to jquery UI widget function) - $.fn.jstree = function (settings) { - var isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree("open_node") - args = Array.prototype.slice.call(arguments, 1), - returnValue = this; - - // extend settings and allow for multiple hashes and metadata - if(!isMethodCall && $.meta) { args.push($.metadata.get(this).jstree); } - settings = !isMethodCall && args.length ? $.extend.apply(null, [true, settings].concat(args)) : settings; - // block calls to "private" methods - if(isMethodCall && settings.substring(0, 1) == '_') { return returnValue; } - - // if a method call execute the method on all selected instances - if(isMethodCall) { - this.each(function() { - var instance = instances[$.data(this, "jstree-instance-id")], - methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance; - if(typeof methodValue !== "undefined" && (settings.indexOf("is_" === 0) || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; } - }); - } - else { - this.each(function() { - var instance_id = $.data(this, "jstree-instance-id"), - s = false; - // if an instance already exists, destroy it first - if(typeof instance_id !== "undefined" && instances[instance_id]) { instances[instance_id].destroy(); } - // push a new empty object to the instances array - instance_id = parseInt(instances.push({}),10) - 1; - // store the jstree instance id to the container element - $.data(this, "jstree-instance-id", instance_id); - // clean up all plugins - if(!settings) { settings = {}; } - settings.plugins = $.isArray(settings.plugins) ? settings.plugins : $.jstree.defaults.plugins; - if($.inArray("core", settings.plugins) === -1) { settings.plugins.unshift("core"); } - - // only unique plugins (NOT WORKING) - // settings.plugins = settings.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(","); - - // extend defaults with passed data - s = $.extend(true, {}, $.jstree.defaults, settings); - s.plugins = settings.plugins; - $.each(plugins, function (i, val) { if($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; } }); - // push the new object to the instances array (at the same time set the default classes to the container) and init - instances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass("jstree jstree-" + instance_id), s); - // init all activated plugins for this instance - $.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; }); - $.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } }); - // initialize the instance - instances[instance_id].init(); - }); - } - // return the jquery selection (or if it was a method call that returned a value - the returned value) - return returnValue; - }; - // object to store exposed functions and objects - $.jstree = { - defaults : { - plugins : [] - }, - _focused : function () { return instances[focused_instance] || null; }, - _reference : function (needle) { - // get by instance id - if(instances[needle]) { return instances[needle]; } - // get by DOM (if still no luck - return null - var o = $(needle); - if(!o.length && typeof needle === "string") { o = $("#" + needle); } - if(!o.length) { return null; } - return instances[o.closest(".jstree").data("jstree-instance-id")] || null; - }, - _instance : function (index, container, settings) { - // for plugins to store data in - this.data = { core : {} }; - this.get_settings = function () { return $.extend(true, {}, settings); }; - this._get_settings = function () { return settings; }; - this.get_index = function () { return index; }; - this.get_container = function () { return container; }; - this._set_settings = function (s) { - settings = $.extend(true, {}, settings, s); - }; - }, - _fn : { }, - plugin : function (pname, pdata) { - pdata = $.extend({}, { - __init : $.noop, - __destroy : $.noop, - _fn : {}, - defaults : false - }, pdata); - plugins[pname] = pdata; - - $.jstree.defaults[pname] = pdata.defaults; - $.each(pdata._fn, function (i, val) { - val.plugin = pname; - val.old = $.jstree._fn[i]; - $.jstree._fn[i] = function () { - var rslt, - func = val, - args = Array.prototype.slice.call(arguments), - evnt = new $.Event("before.jstree"), - rlbk = false; - - // Check if function belongs to the included plugins of this instance - do { - if(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; } - func = func.old; - } while(func); - if(!func) { return; } - - // a chance to stop execution (or change arguments): - // * just bind to jstree.before - // * check the additional data object (func property) - // * call event.stopImmediatePropagation() - // * return false (or an array of arguments) - rslt = this.get_container().triggerHandler(evnt, { "func" : i, "inst" : this, "args" : args }); - if(rslt === false) { return; } - if(typeof rslt !== "undefined") { args = rslt; } - - // context and function to trigger events, then finally call the function - if(i.indexOf("_") === 0) { - rslt = func.apply(this, args); - } - else { - rslt = func.apply( - $.extend({}, this, { - __callback : function (data) { - this.get_container().triggerHandler( i + '.jstree', { "inst" : this, "args" : args, "rslt" : data, "rlbk" : rlbk }); - }, - __rollback : function () { - rlbk = this.get_rollback(); - return rlbk; - }, - __call_old : function (replace_arguments) { - return func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) ); - } - }), args); - } - - // return the result - return rslt; - }; - $.jstree._fn[i].old = val.old; - $.jstree._fn[i].plugin = pname; - }); - }, - rollback : function (rb) { - if(rb) { - if(!$.isArray(rb)) { rb = [ rb ]; } - $.each(rb, function (i, val) { - instances[val.i].set_rollback(val.h, val.d); - }); - } - } - }; - // set the prototype for all instances - $.jstree._fn = $.jstree._instance.prototype = {}; - - // css functions - used internally - - // load the css when DOM is ready - $(function() { - // code is copied form jQuery ($.browser is deprecated + there is a bug in IE) - var u = navigator.userAgent.toLowerCase(), - v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], - css_string = '' + - '.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' + - '.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; } ' + - '.jstree-rtl li { margin-left:0; margin-right:18px; } ' + - '.jstree > ul > li { margin-left:0px; } ' + - '.jstree-rtl > ul > li { margin-right:0px; } ' + - '.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' + - '.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' + - '.jstree a:focus { outline: none; } ' + - '.jstree a > ins { height:16px; width:16px; } ' + - '.jstree a > .jstree-icon { margin-right:3px; } ' + - '.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' + - 'li.jstree-open > ul { display:block; } ' + - 'li.jstree-closed > ul { display:none; } '; - // Correct IE 6 (does not support the > CSS selector) - if(/msie/.test(u) && parseInt(v, 10) == 6) { - is_ie6 = true; - css_string += '' + - '.jstree li { height:18px; margin-left:0; margin-right:0; } ' + - '.jstree li li { margin-left:18px; } ' + - '.jstree-rtl li li { margin-left:0px; margin-right:18px; } ' + - 'li.jstree-open ul { display:block; } ' + - 'li.jstree-closed ul { display:none !important; } ' + - '.jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } ' + - '.jstree li a ins { height:16px; width:16px; margin-right:3px; } ' + - '.jstree-rtl li a ins { margin-right:0px; margin-left:3px; } '; - } - // Correct IE 7 (shifts anchor nodes onhover) - if(/msie/.test(u) && parseInt(v, 10) == 7) { - css_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } '; - } - $.vakata.css.add_sheet({ str : css_string }); - }); - - // core functions (open, close, create, update, delete) - $.jstree.plugin("core", { - __init : function () { - this.data.core.to_open = $.map($.makeArray(this.get_settings().core.initially_open), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); }); - }, - defaults : { - html_titles : false, - animation : 500, - initially_open : [], - rtl : false, - strings : { - loading : "Loading ...", - new_node : "New node" - } - }, - _fn : { - init : function () { - this.set_focus(); - if(this._get_settings().core.rtl) { - this.get_container().addClass("jstree-rtl").css("direction", "rtl"); - } - this.get_container().html(""); - this.data.core.li_height = this.get_container().find("ul li.jstree-closed, ul li.jstree-leaf").eq(0).height() || 18; - - this.get_container() - .delegate("li > ins", "click.jstree", $.proxy(function (event) { - var trgt = $(event.target); - if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); } - }, this)) - .bind("mousedown.jstree", $.proxy(function () { - this.set_focus(); // This used to be setTimeout(set_focus,0) - why? - }, this)) - .bind("dblclick.jstree", function (event) { - var sel; - if(document.selection && document.selection.empty) { document.selection.empty(); } - else { - if(window.getSelection) { - sel = window.getSelection(); - try { - sel.removeAllRanges(); - sel.collapse(); - } catch (err) { } - } - } - }); - this.__callback(); - this.load_node(-1, function () { this.loaded(); this.reopen(); }); - }, - destroy : function () { - var i, - n = this.get_index(), - s = this._get_settings(), - _this = this; - - $.each(s.plugins, function (i, val) { - try { plugins[val].__destroy.apply(_this); } catch(err) { } - }); - this.__callback(); - // set focus to another instance if this one is focused - if(this.is_focused()) { - for(i in instances) { - if(instances.hasOwnProperty(i) && i != n) { - instances[i].set_focus(); - break; - } - } - } - // if no other instance found - if(n === focused_instance) { focused_instance = -1; } - // remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events - this.get_container() - .unbind(".jstree") - .undelegate(".jstree") - .removeData("jstree-instance-id") - .find("[class^='jstree']") - .andSelf() - .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); }); - // remove the actual data - instances[n] = null; - delete instances[n]; - }, - save_opened : function () { - var _this = this; - this.data.core.to_open = []; - this.get_container().find(".jstree-open").each(function () { - _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/')); - }); - this.__callback(_this.data.core.to_open); - }, - reopen : function (is_callback) { - var _this = this, - done = true, - current = [], - remaining = []; - if(!is_callback) { this.data.core.reopen = false; this.data.core.refreshing = true; } - if(this.data.core.to_open.length) { - $.each(this.data.core.to_open, function (i, val) { - if(val == "#") { return true; } - if($(val).length && $(val).is(".jstree-closed")) { current.push(val); } - else { remaining.push(val); } - }); - if(current.length) { - this.data.core.to_open = remaining; - $.each(current, function (i, val) { - _this.open_node(val, function () { _this.reopen(true); }, true); - }); - done = false; - } - } - if(done) { - // TODO: find a more elegant approach to syncronizing returning requests - if(this.data.core.reopen) { clearTimeout(this.data.core.reopen); } - this.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50); - this.data.core.refreshing = false; - } - }, - refresh : function (obj) { - var _this = this; - this.save_opened(); - if(!obj) { obj = -1; } - obj = this._get_node(obj); - if(!obj) { obj = -1; } - if(obj !== -1) { obj.children("UL").remove(); } - this.load_node(obj, function () { _this.__callback({ "obj" : obj}); _this.reopen(); }); - }, - // Dummy function to fire after the first load (so that there is a jstree.loaded event) - loaded : function () { - this.__callback(); - }, - // deal with focus - set_focus : function () { - var f = $.jstree._focused(); - if(f && f !== this) { - f.get_container().removeClass("jstree-focused"); - } - if(f !== this) { - this.get_container().addClass("jstree-focused"); - focused_instance = this.get_index(); - } - this.__callback(); - }, - is_focused : function () { - return focused_instance == this.get_index(); - }, - - // traverse - _get_node : function (obj) { - var $obj = $(obj, this.get_container()); - if($obj.is(".jstree") || obj == -1) { return -1; } - $obj = $obj.closest("li", this.get_container()); - return $obj.length ? $obj : false; - }, - _get_next : function (obj, strict) { - obj = this._get_node(obj); - if(obj === -1) { return this.get_container().find("> ul > li:first-child"); } - if(!obj.length) { return false; } - if(strict) { return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false; } - - if(obj.hasClass("jstree-open")) { return obj.find("li:eq(0)"); } - else if(obj.nextAll("li").size() > 0) { return obj.nextAll("li:eq(0)"); } - else { return obj.parentsUntil(".jstree","li").next("li").eq(0); } - }, - _get_prev : function (obj, strict) { - obj = this._get_node(obj); - if(obj === -1) { return this.get_container().find("> ul > li:last-child"); } - if(!obj.length) { return false; } - if(strict) { return (obj.prevAll("li").length > 0) ? obj.prevAll("li:eq(0)") : false; } - - if(obj.prev("li").length) { - obj = obj.prev("li").eq(0); - while(obj.hasClass("jstree-open")) { obj = obj.children("ul:eq(0)").children("li:last"); } - return obj; - } - else { var o = obj.parentsUntil(".jstree","li:eq(0)"); return o.length ? o : false; } - }, - _get_parent : function (obj) { - obj = this._get_node(obj); - if(obj == -1 || !obj.length) { return false; } - var o = obj.parentsUntil(".jstree", "li:eq(0)"); - return o.length ? o : -1; - }, - _get_children : function (obj) { - obj = this._get_node(obj); - if(obj === -1) { return this.get_container().children("ul:eq(0)").children("li"); } - if(!obj.length) { return false; } - return obj.children("ul:eq(0)").children("li"); - }, - get_path : function (obj, id_mode) { - var p = [], - _this = this; - obj = this._get_node(obj); - if(obj === -1 || !obj || !obj.length) { return false; } - obj.parentsUntil(".jstree", "li").each(function () { - p.push( id_mode ? this.id : _this.get_text(this) ); - }); - p.reverse(); - p.push( id_mode ? obj.attr("id") : this.get_text(obj) ); - return p; - }, - - is_open : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-open"); }, - is_closed : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-closed"); }, - is_leaf : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-leaf"); }, - // open/close - open_node : function (obj, callback, skip_animation) { - obj = this._get_node(obj); - if(!obj.length) { return false; } - if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; } - var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation, - t = this; - if(!this._is_loaded(obj)) { - obj.children("a").addClass("jstree-loading"); - this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback); - } - else { - if(s) { obj.children("ul").css("display","none"); } - obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading"); - if(s) { obj.children("ul").stop(true).slideDown(s, function () { this.style.display = ""; }); } - this.__callback({ "obj" : obj }); - if(callback) { callback.call(); } - } - }, - close_node : function (obj, skip_animation) { - obj = this._get_node(obj); - var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation; - if(!obj.length || !obj.hasClass("jstree-open")) { return false; } - if(s) { obj.children("ul").attr("style","display:block !important"); } - obj.removeClass("jstree-open").addClass("jstree-closed"); - if(s) { obj.children("ul").stop(true).slideUp(s, function () { this.style.display = ""; }); } - this.__callback({ "obj" : obj }); - }, - toggle_node : function (obj) { - obj = this._get_node(obj); - if(obj.hasClass("jstree-closed")) { return this.open_node(obj); } - if(obj.hasClass("jstree-open")) { return this.close_node(obj); } - }, - open_all : function (obj, original_obj) { - obj = obj ? this._get_node(obj) : this.get_container(); - if(!obj || obj === -1) { obj = this.get_container(); } - if(original_obj) { - obj = obj.find("li.jstree-closed"); - } - else { - original_obj = obj; - if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); } - else { obj = obj.find("li.jstree-closed"); } - } - var _this = this; - obj.each(function () { - var __this = this; - if(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, original_obj); }, true); } - else { _this.open_node(this, false, true); } - }); - // so that callback is fired AFTER all nodes are open - if(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ "obj" : original_obj }); } - }, - close_all : function (obj) { - var _this = this; - obj = obj ? this._get_node(obj) : this.get_container(); - if(!obj || obj === -1) { obj = this.get_container(); } - obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this); }); - this.__callback({ "obj" : obj }); - }, - clean_node : function (obj) { - obj = obj && obj != -1 ? $(obj) : this.get_container(); - obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li"); - obj.removeClass("jstree-last") - .filter("li:last-child").addClass("jstree-last").end() - .filter(":has(li)") - .not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed"); - obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove(); - this.__callback({ "obj" : obj }); - }, - // rollback - get_rollback : function () { - this.__callback(); - return { i : this.get_index(), h : this.get_container().children("ul").clone(true), d : this.data }; - }, - set_rollback : function (html, data) { - this.get_container().empty().append(html); - this.data = data; - this.__callback(); - }, - // Dummy functions to be overwritten by any datastore plugin included - load_node : function (obj, s_call, e_call) { this.__callback({ "obj" : obj }); }, - _is_loaded : function (obj) { return true; }, - - // Basic operations: create - create_node : function (obj, position, js, callback, is_loaded) { - obj = this._get_node(obj); - position = typeof position === "undefined" ? "last" : position; - var d = $("
    • "), - s = this._get_settings().core, - tmp; - - if(obj !== -1 && !obj.length) { return false; } - if(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; } - - this.__rollback(); - - if(typeof js === "string") { js = { "data" : js }; } - if(!js) { js = {}; } - if(js.attr) { d.attr(js.attr); } - if(js.state) { d.addClass("jstree-" + js.state); } - if(!js.data) { js.data = s.strings.new_node; } - if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); } - $.each(js.data, function (i, m) { - tmp = $(""); - if($.isFunction(m)) { m = m.call(this, js); } - if(typeof m == "string") { tmp.attr('href','#')[ s.html_titles ? "html" : "text" ](m); } - else { - if(!m.attr) { m.attr = {}; } - if(!m.attr.href) { m.attr.href = '#'; } - tmp.attr(m.attr)[ s.html_titles ? "html" : "text" ](m.title); - if(m.language) { tmp.addClass(m.language); } - } - tmp.prepend(" "); - if(m.icon) { - if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); } - else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); } - } - d.append(tmp); - }); - d.prepend(" "); - if(obj === -1) { - obj = this.get_container(); - if(position === "before") { position = "first"; } - if(position === "after") { position = "last"; } - } - switch(position) { - case "before": obj.before(d); tmp = this._get_parent(obj); break; - case "after" : obj.after(d); tmp = this._get_parent(obj); break; - case "inside": - case "first" : - if(!obj.children("ul").length) { obj.append("
    • - - - + + + + +
      '>
      Reboot Phones
      - '>
      -
      + + '> +
      + Reboot Phones + +
      +

      + '>
      +
      +
      (products)

      + +
      + (models)

      + +
      diff --git a/templates/freepbx/global_header.html b/templates/freepbx/global_header.html index e3863ef8..6ee7dacc 100644 --- a/templates/freepbx/global_header.html +++ b/templates/freepbx/global_header.html @@ -79,6 +79,19 @@ }) }) }) + $(function(){ + $("select#model_select").change(function(){ + $.ajaxSetup({ cache: false }); + $.getJSON("config.php?type=tool&quietmode=1&handler=file&module=endpointman&file=ajax_select.html.php&atype=mtemplate",{id: $(this).val()}, function(j){ + var options = ''; + for (var i = 0; i < j.length; i++) { + options += ''; + } + $("#model_template_selector").html(options); + $('#model_template_selector option:first').attr('selected', 'selected'); + }) + }) + }) $(function(){ $("select#model_new").change(function(){ $.ajaxSetup({ cache: false }); diff --git a/templates/freepbx29/devices_manager.html b/templates/freepbx29/devices_manager.html index 6f71f6d9..c349bd5b 100644 --- a/templates/freepbx29/devices_manager.html +++ b/templates/freepbx29/devices_manager.html @@ -369,24 +369,48 @@

      - - - + + + + +
      '>
      Reboot Phones
      - '>
      -
      + + '> +
      + Reboot Phones + +
      +

      + '>
      +
      +
      (products)

      + +
      + (models)

      + +
      diff --git a/templates/freepbx29/global_header.html b/templates/freepbx29/global_header.html index a3cf65fa..6ee7dacc 100644 --- a/templates/freepbx29/global_header.html +++ b/templates/freepbx29/global_header.html @@ -2,16 +2,11 @@ PBX Endpoint Configuration Manager {if condition="isset($silent_mode)"} - - - - - - {/if} - {if condition="$amp_ver < 29"} + + {/if} -{loop name="brand2_list"} - - - - - - - - -
      {$value.name}
      {else}{/if}">
       {loop name="value.products"} - - - - - - - - -
      {$value.long_name}
      {else}{/if}">
       {loop name="value.models"} - - - - -
      {$value.model}
      {else}{/if}">
      {/loop}
      {/loop}
      -
      -
      -{/loop} - - - - - - - diff --git a/templates/freepbx29/advanced_subheader.html b/templates/freepbx29/advanced_subheader.html deleted file mode 100644 index 67a4c9d7..00000000 --- a/templates/freepbx29/advanced_subheader.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - -
      {if condition="$subhead_area == 'settings'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'oui_manager'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'poce'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'iedl'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'manual_upload'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'sh_manager'"}

      {else}

      {/if}
      -
      \ No newline at end of file diff --git a/templates/freepbx29/alt_config_popup.html b/templates/freepbx29/alt_config_popup.html deleted file mode 100644 index b1d9fa1e..00000000 --- a/templates/freepbx29/alt_config_popup.html +++ /dev/null @@ -1,58 +0,0 @@ - - - PBX Endpoint Configuration Manager - - - - - - - - - -
      -
      -
      -

      -
      -{if condition="isset($show_error_box)"} - {include="message_box"} -{/if} -

      : {$file}

      - Warning! You can really mess up your phone by messing with these settings. Potentially causing it to not boot!
      - {if condition="isset($location) && isset($allow_hdfiles)"} - You are editing a global file. This will effect any & all phones that reference this hard file -
      It is NOT individual to this template!!!

      - You can setup individual templates in the "Product Options/Configuration Editor" under "End Point Advanced Settings" - {/if} -
      - - - - -
      {if condition="isset($location)"}File Location: {$location}{/if}
      - -
      - -
      -
      -
      - - diff --git a/templates/freepbx29/brand_model_manager.html b/templates/freepbx29/brand_model_manager.html deleted file mode 100644 index 64605829..00000000 --- a/templates/freepbx29/brand_model_manager.html +++ /dev/null @@ -1,193 +0,0 @@ -{include="global_header"} -{if condition="isset($show_error_box)"} - {include="message_box"} -{/if} - - -
      -
      - -
      -
      - -

      - -{if condition="1 == 0"} - - - -
      -{if condition="!isset($update_check)"} -
      - -
      - - -{else} -
      - -
      - - -{/if} - -
      -{/if} -{if condition="isset($installer)"} - - -{/if} -{if condition="1 == 1"} - {loop name="brand2_list"} - - - - - - - - -
      {$value.name} {if condition="$value.installed == '1'"}( [{$value.cfg_ver}]) {/if}{if condition="$value.installed == '1'"}Check Online{/if}
      {else}{/if}">{if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}New Package Modified [{$value.update_vers}]{/if}{/if}
       {loop name="value.products"} - - - - - - - - -
      {$value.long_name} {if condition="$value.cfg_ver != ''"}{/if}
      {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}{/if}{/if}{if condition="$value.fw_type == 'install'"}{elseif condition="$value.fw_type == 'remove'"}{/if}{if condition="array_key_exists('update_fw',$value)"}{if condition="$value.update_fw == 1"}{/if}{/if}
       {loop name="value.models"} - - - - -
      {$value.model}
      {else}{/if}">
      {/loop}
      {/loop}
      -
      -
      - {/loop} -{/if} -
      -
      Want to participate? Add new phones? Join us at http://www.provisioner.net
      -{include="global_footer"} - - - - - diff --git a/templates/freepbx29/credits.html b/templates/freepbx29/credits.html deleted file mode 100644 index e69de29b..00000000 diff --git a/templates/freepbx29/devices_manager.html b/templates/freepbx29/devices_manager.html deleted file mode 100644 index c349bd5b..00000000 --- a/templates/freepbx29/devices_manager.html +++ /dev/null @@ -1,423 +0,0 @@ -{include="global_header"} -{if condition="isset($show_error_box)"} -{include="message_box"} -{/if} -
      - - -
      - {if condition="$no_add == FALSE"} -
      - - -
      - {/if} -
      - - - - - - - - - - - - - - - - {if condition="$no_add == FALSE"} - - - - - - - - - - - - - -{loop name="line_list_edit"} - - - - - - - - - - - - -{/loop} -{if condition="$mode != 'EDIT'"} - - - - - - - - - - - - -{/if} -{if condition="$mode == 'EDIT'"} - - - - - - - - - - - -{else} - - - - - - - - - - - -{/if} -{/if} -

        - {if condition="$mode == 'EDIT'"} - {$mac} - {else} - - {/if} - {/if} - -
      -
      -
      - {if condition="$mode == 'EDIT'"} - '> - {else} - '> - {/if} - {if condition="$mode != 'EDIT'"}'>{/if}
        - - - - {if condition="!isset($disabled_delete_line)"}
      {/if}
        - - - -
         
      Add Line
         Add Line
      - - -{if condition="$searched == 1"} - - - - - - - - - - - {if condition="is_array($unmanaged)"} - - {loop name="unmanaged"} - - - - - - - - - - - - - - - {/loop} - -
         

         
      {$value.mac_strip}
      ({$value.ip})
      {$value.brand} - - - - -   
      - - - -

      Reboot Phones
      - - - {/if} - -{/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - {loop name="list"} - - - - - - - - - - - - - {loop name="value.line"} - - - - - - - - - - - - - {/loop} - {/loop} -
         

       
      Expand All Line Info
       

      Mac Address

      Brand

      Model of Phone

      Line

      Extension Number

      Template

      Edit

      Delete

      {$value.status.ip}:{$value.status.port}
      {$value.mac}{$value.name}{$value.model}
      {$value.template_name}
      - -
      -
      -

      - -

      -
      - - - - - - -

      Reboot Phones
      :
      : :

      Reboot Phones
      - -
      -
      -

      -
      - - - - - - - - -
      -
      - '> -
      - Reboot Phones -
      -
      -

      - '>
      -
      -
      (products)

      - -
      - (models)

      - -
      - - -{if condition="!isset($disable_help)"} - -{/if} -{include="global_footer"} \ No newline at end of file diff --git a/templates/freepbx29/global_footer.html b/templates/freepbx29/global_footer.html deleted file mode 100644 index cb8ed4cd..00000000 --- a/templates/freepbx29/global_footer.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/templates/freepbx29/global_header.html b/templates/freepbx29/global_header.html deleted file mode 100644 index 6ee7dacc..00000000 --- a/templates/freepbx29/global_header.html +++ /dev/null @@ -1,182 +0,0 @@ - - - PBX Endpoint Configuration Manager - {if condition="isset($silent_mode)"} - - - - - - {/if} - - {if condition="isset($template_editor_display)"} - - - - {/if} - {if condition="isset($amp_conf_serial)"} - - {/if} - - -
      -
      -
      -

      -
      \ No newline at end of file diff --git a/templates/freepbx29/global_links.html b/templates/freepbx29/global_links.html deleted file mode 100644 index eb518c79..00000000 --- a/templates/freepbx29/global_links.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - -

      -
      diff --git a/templates/freepbx29/message_box.html b/templates/freepbx29/message_box.html deleted file mode 100644 index c3a6632e..00000000 --- a/templates/freepbx29/message_box.html +++ /dev/null @@ -1 +0,0 @@ -
      {$error_message}{if condition="$advanced_debug == 1"}
      Backtrace

      Extended Backtrace

      Last Error
      {/if}
      \ No newline at end of file diff --git a/templates/freepbx29/specifics_pop.html b/templates/freepbx29/specifics_pop.html deleted file mode 100644 index 5b1b017f..00000000 --- a/templates/freepbx29/specifics_pop.html +++ /dev/null @@ -1,58 +0,0 @@ - - - PBX Endpoint Configuration Manager - - - - - - - - -
      -
      -
      -

      -
      - {if condition="isset($show_error_box)"} - {include="message_box"} - {/if} -
      - - - {loop name="display_name"} - - {/loop} - - - - - - - - - - -
      General Settings
      Display Name Line {$value.line}:
       
      IP Settings
      IP Type - -
      IPv4 Address:
      IPv6 Address:
      Subnet Mask Address:
      Gateway Address:
      -
      - -
      -
      - - diff --git a/templates/freepbx29/template_editor.html b/templates/freepbx29/template_editor.html deleted file mode 100644 index cb080a7f..00000000 --- a/templates/freepbx29/template_editor.html +++ /dev/null @@ -1,171 +0,0 @@ -{if condition="isset($in_ari)"} - - - - - - - - - - -{else} - - - - - {if condition="$custom != 0"} - : Custom Template: Extension {$ext}
      - : {$product}
      - : {$model}
      - - {if condition="isset($silent_mode)"} - - {/if} - {loop name="area_ava"} - - {/loop} - - (Note: This is NOT the number of supported lines on the phone(s)) - {/if} -
      - {if condition="isset($silent_mode)"} - - {/if} - {if condition="$custom == 0"} - : {$template_name}
      - : {$product}
      - : -
      - - {if condition="isset($silent_mode)"} - - {/if} - {loop name="area_ava"} - - {/loop} - - (Note: This is NOT the number of supported lines on the phone(s)) - {/if} -
      - : <?php echo _(' border='0'> -
      - {if condition="$alt != 0"} -
      - {loop name="alt_configs"} - - {$value.name} - <?php echo _(' border='0'> -
      - {/loop} -
      - {/if} - {loop name="only_configs"} - {$value.name} - <?php echo _(' border='0'> -
      - {/loop} -
      - :
      {noparse} - -"{$server.ip.1}" =
      - -"{$server.port.1}" =
      - -"{$mac}" =
      - -"{$model}" =
      - -"{$ext.line.1}" =
      - -"{$displayname.line.1}" =
      {/noparse} -
      - {/if} - -
      -
      - {loop name="template_editor"} -
      -
      -

      {$value.title}

      - - {loop name="value.data"} - - - - {if condition="$value.type == 'break'"} - - - - - {/if} - {/loop} -
      - {if condition="$value.type == 'input'"} - - {elseif condition="$value.type == 'textarea'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: - {elseif condition="$value.type == 'file'"} - - {elseif condition="$value.type == 'radio'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if} - {loop name="value.data"} - - {/loop} - {elseif condition="$value.type == 'list'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: - {/if} - - {if condition="isset($value.aried)"} - - {/if} -
        
      -
      -
      - {/loop} -
      -
      - - - {if condition="!isset($in_ari)"} - Reboot Phone(s)
      - -
      - {include="global_footer"} - {/if} diff --git a/templates/freepbx29/template_manager.html b/templates/freepbx29/template_manager.html deleted file mode 100644 index b7d5a62e..00000000 --- a/templates/freepbx29/template_manager.html +++ /dev/null @@ -1,52 +0,0 @@ -{include="global_header"} -{if condition="isset($show_error_box)"} - {include="message_box"} -{/if} -{if condition="$no_add == FALSE"} -
      -

      :

      - : - - : - - Clone Template From: - - -
      - - - - - - - - -{loop name="templates_list"} - - - - - - - - -{/loop} -

      {$value.name}{$value.model_class}{$value.model_clone}<?php echo _(' border='0'>{if condition="$value.custom == 0"} - <?php echo _(' border='0'>{/if}
      -
      -{/if} -{include="global_footer"} \ No newline at end of file From fe2623f95e0a4ef606206302d351496254fa5913 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 3 Nov 2011 23:39:59 -0700 Subject: [PATCH 223/623] Tweak'n --- templates/freepbx/global_header.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/freepbx/global_header.html b/templates/freepbx/global_header.html index 3f0dc8b9..8b072502 100644 --- a/templates/freepbx/global_header.html +++ b/templates/freepbx/global_header.html @@ -1,8 +1,10 @@ PBX Endpoint Configuration Manager - {if condition="(isset($silent_mode)) OR ($amp_ver < 9)"} + {if condition="isset($silent_mode)"} + {/if} + {if condition="(isset($silent_mode)) OR ($amp_ver < 9)"} From 7d2f5bb2e2415f055d3e11cbe1b80327df134297 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 4 Nov 2011 00:32:27 -0700 Subject: [PATCH 224/623] Fixed installer...finally.. --- install.php | 185 ++++++++++++++-------------------------------------- module.xml | 2 +- 2 files changed, 49 insertions(+), 138 deletions(-) diff --git a/install.php b/install.php index a3a6e486..3a41b8ab 100644 --- a/install.php +++ b/install.php @@ -93,36 +93,51 @@ function ep_table_exists ($table) { $epm_module_xml = epm_install_xml2array(LOCAL_PATH."module.xml"); -$version = $epm_module_xml['module']['version']; +preg_match('/^(\d*)\.(\d*)/', $epm_module_xml['module']['version'], $versions); + +$xml_full_version = $epm_module_xml['module']['version']; + +$version['major'] = $versions[1]; +$version['minor'] = $versions[2]; + +$sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; +preg_match('/^(\d*)\.(\d*)/', $db->getOne($sql), $versions); + +$amp_version['minor'] = $versions[2]; -$sql = 'SELECT `version` FROM `modules` WHERE `modulename` = CONVERT(_utf8 \'endpointman\' USING latin1) COLLATE latin1_swedish_ci'; +$sql = 'SELECT `version` FROM `modules` WHERE `modulename` = CONVERT(_utf8 \'endpointman\' USING latin1) COLLATE latin1_swedish_ci'; $full_vers = $db->getOne($sql); -$db_version = (float)preg_replace('/[^0-9]*/i', '', $full_vers); if($db->getOne($sql)) { + $new_install = FALSE; $global_cfg =& $db->getAssoc("SELECT var_name, value FROM endpointman_global_vars"); - $global_cfg['version'] = $db_version; -} else { - $global_cfg['version'] = '?'; -} -$new_install = FALSE; -if($global_cfg['version'] != "?") { - $ver = $global_cfg['version']; + + if(preg_match('/^(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)) { + + }elseif(preg_match('/^(\d*)\.(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)){ + + }elseif(preg_match('/^(\d*)\.(\d*)\.(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)){ + + } + + $very['major'] = $versions[1]; + $very['minor'] = isset($versions[2]) ? $versions[2] : '0'; + $very['subminor'] = isset($versions[3]) ? $versions[3] : '0'; + $very['subsubminor'] = isset($versions[4]) ? $versions[4] : '0'; + + $ver = $very['major'] . $very['minor'] . $very['subminor'] . $very['subsubminor']; + + out('Version Identified as '. $full_vers); } else { - $ver = "1000"; $new_install = TRUE; -} - -if($new_install) { out('New Installation Detected!'); -} else { - out('Version Identified as '. $full_vers); } + if(!$new_install) { - if(($ver < "190") AND ($ver > 0)) { + if(($ver < "1900") AND ($ver > 0)) { out("Please Wait While we upgrade your old setup"); //Expand the value option $sql = 'ALTER TABLE `endpointman_global_vars` CHANGE `value` `value` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT \'Data\''; @@ -297,7 +312,7 @@ function ep_table_exists ($table) { out("DONE! You can now use endpoint manager!"); } - if ($ver <= "190") { + if ($ver <= "1900") { out("Locating NMAP + ARP + ASTERISK Executables"); $nmap = find_exec("nmap"); @@ -367,7 +382,7 @@ function ep_table_exists ($table) { $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; $db->query($sql); } - if ($ver <= "191") { + if ($ver <= "1910") { out("Create Custom Configs Table"); $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( `id` int(11) NOT NULL auto_increment, @@ -422,11 +437,11 @@ function ep_table_exists ($table) { $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; $db->query($sql); } - if ($ver <= "192") { + if ($ver <= "1920") { out('Updating Global Variables'); } - if ($ver <= "199") { + if ($ver <= "1990") { out("Adding Custom Field to OUI List"); $sql = 'ALTER TABLE `endpointman_oui_list` ADD `custom` INT(1) NOT NULL DEFAULT \'0\''; $db->query($sql); @@ -470,7 +485,7 @@ function ep_table_exists ($table) { $sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php ".LOCAL_PATH. "includes/update_check.php')"; $db->query($sql); } - if($ver <= "200") { + if($ver <= "2000") { out("Locating NMAP + ARP + ASTERISK Executables"); $nmap = find_exec("nmap"); $arp = find_exec("arp"); @@ -660,10 +675,8 @@ function ep_table_exists ($table) { out("Creating temp folder"); } } - if ($ver <= "221") { - } - if ($ver <= "222") { + if ($ver <= "2220") { out("Remove all Dashes in IDs"); $data = array(); @@ -707,16 +720,16 @@ function ep_table_exists ($table) { $db->query($sql); } } - if ($ver <= "223") { + if ($ver <= "2230") { $sql = "UPDATE endpointman_global_vars SET value = 'http://www.provisioner.net/release/' WHERE var_name = 'update_server'"; $db->query($sql); } - if ($ver <= "224") { + if ($ver <= "2240") { } - if ($ver <= "225") { + if ($ver <= "2250") { out("Fixing Permissions of Phone Modules Directory"); $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PHONE_MODULES_PATH), RecursiveIteratorIterator::SELF_FIRST); foreach($iterator as $item) { @@ -728,7 +741,7 @@ function ep_table_exists ($table) { $db->query($sql); } - if ($ver <= "226") { + if ($ver <= "2260") { $sql = "CREATE TABLE IF NOT EXISTS `endpointman_line_list` ( `luid` int(11) NOT NULL AUTO_INCREMENT, `mac_id` int(11) NOT NULL, @@ -780,11 +793,7 @@ function ep_table_exists ($table) { } - if ($ver <= "227") { - - } - - if ($ver <= "228") { + if ($ver <= "2280") { out("Fix Debug Left on Error, this turns off debug."); $sql = "UPDATE endpointman_global_vars SET value = '0' WHERE var_name = 'debug'"; $db->query($sql); @@ -793,12 +802,9 @@ function ep_table_exists ($table) { $db->query($sql); } - if ($ver <= "240") { + if ($ver <= "2400") { out("Uninstalling All Installed Brands (You'll just simply have to update again, no loss of data)"); $db->query("UPDATE endpointman_brand_list SET installed = '0'"); - out("Changing update server"); - $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/' WHERE var_name ='update_server'"; - $db->query($sql); $sql = "UPDATE endpointman_model_list SET enabled = '0', template_data = '".serialize(array())."'"; $db->query($sql); @@ -846,13 +852,6 @@ function ep_table_exists ($table) { $db->query($sql); } - if($ver <= "2909") { - out("Successfully Migrated to the new Installer!"); - $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/' WHERE var_name ='update_server'"; - $db->query($sql); - out("Mirgrated to FreePBX Mirror"); - } - if($ver <= "2910") { out("Fix again to the 'Allow Duplicate Extensions' Error"); $sql = 'ALTER TABLE `endpointman_global_vars` ADD UNIQUE `var_name` (`var_name`)'; @@ -985,7 +984,6 @@ function ep_table_exists ($table) { } - if ($new_install) { out("Creating Brand List Table"); @@ -1038,7 +1036,7 @@ function ep_table_exists ($table) { (4, 'gmthr', ''), (5, 'config_location', '/tftpboot/'), (6, 'update_server', 'http://mirror.freepbx.org/provisioner/v2.5/'), - (7, 'version', '".$version."'), + (7, 'version', '".$xml_full_version."'), (8, 'enable_ari', '0'), (9, 'debug', '0'), (10, 'arp_location', '".$arp."'), @@ -1127,88 +1125,6 @@ function ep_table_exists ($table) { ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; $db->query($sql); - out("Creating Time Zone List Tables"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_time_zones_desc` ( - `id` int(11) NOT NULL auto_increment, - `tid` int(11) NOT NULL, - `name` varchar(255) NOT NULL, - `description` varchar(255) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=32"; - $db->query($sql); - - $sql = "INSERT INTO `endpointman_time_zones_desc` (`id`, `tid`, `name`, `description`) VALUES -(1, 1, 'UTC', 'Universal Coordinated Time (and Greenwich Mean Time)'), -(2, 2, 'ECT', 'European Central Time'), -(3, 3, 'EET', 'Eastern European Time'), -(4, 3, 'ART', '(Arabic) Egypt Standard Time'), -(5, 4, 'EAT', 'Eastern African Time'), -(6, 5, 'MET', 'Middle East Time'), -(7, 6, 'NET', 'Near East Time'), -(8, 7, 'PLT', 'Pakistan Lahore Time'), -(9, 8, 'IST', 'India Standard Time'), -(10, 9, 'BST', 'Bangladesh Standard Time'), -(11, 10, 'VST', 'Vietnam Standard Time'), -(12, 11, 'CTT', 'China Taiwan Time'), -(13, 12, 'JST', 'Japan Standard Time'), -(14, 13, 'ACT', 'Australia Central Time'), -(15, 14, 'AET', 'Australia Eastern Time'), -(16, 15, 'SST', 'Solomon Standard Time'), -(17, 16, 'NST', 'New Zealand Standard Time'), -(18, 17, 'MIT', 'Midway Islands Time'), -(19, 18, 'HST', 'Hawaii Standard Time'), -(20, 19, 'AST', 'Alaska Standard Time'), -(21, 20, 'PST', 'Pacific Standard Time'), -(22, 21, 'PNT', 'Phoenix Standard Time'), -(23, 21, 'MST', 'Mountain Standard Time'), -(24, 22, 'CST', 'Central Standard Time'), -(25, 23, 'EST', 'Eastern Standard Time'), -(26, 23, 'IET', 'Indiana Eastern Standard Time'), -(27, 24, 'PRT', 'Puerto Rico and US Virgin Islands Time'), -(28, 25, 'CNT', 'Canada Newfoundland Time'), -(29, 26, 'AGT', 'Argentina Standard Time'), -(30, 26, 'BET', 'Brazil Eastern Time'), -(31, 27, 'CAT', 'Central African Time')"; - $db->query($sql); - - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_time_zones_new` ( - `id` int(11) NOT NULL auto_increment, - `gmt` varchar(255) NOT NULL, - `offset` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=28"; - $db->query($sql); - - $sql = "INSERT INTO `endpointman_time_zones_new` (`id`, `gmt`, `offset`) VALUES -(1, 'GMT', 0), -(2, 'GMT+1:00', 3600), -(3, 'GMT+2:00', 7200), -(4, 'GMT+3:00', 10800), -(5, 'GMT+3:30', 12600), -(6, 'GMT+4:00', 14400), -(7, 'GMT+5:00', 18000), -(8, 'GMT+5:30', 19800), -(9, 'GMT+6:00', 21600), -(10, 'GMT+7:00', 25200), -(11, 'GMT+8:00', 28800), -(12, 'GMT+9:00', 32400), -(13, 'GMT+9:30', 34200), -(14, 'GMT+10:00', 36000), -(15, 'GMT+11:00', 39600), -(16, 'GMT+12:00', 43200), -(17, 'GMT-11:00', -39600), -(18, 'GMT-10:00', -36000), -(19, 'GMT-9:00', -32400), -(20, 'GMT-8:00', -28800), -(21, 'GMT-7:00', -25200), -(22, 'GMT-6:00', -21600), -(23, 'GMT-5:00', -18000), -(24, 'GMT-4:00', -14400), -(25, 'GMT-3:30', -12600), -(26, 'GMT-3:00', -10800), -(27, 'GMT-1:00', -3600)"; - $db->query($sql); - out("Create Custom Configs Table"); $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -1222,22 +1138,17 @@ function ep_table_exists ($table) { out('Creating symlink to web provisioner'); if(!symlink(LOCAL_PATH."provisioning",$amp_conf['AMPWEBROOT']."/provisioning")) { - out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); + //out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); } } -out("Update Version Number to ".$version); -$sql = "UPDATE endpointman_global_vars SET value = '".$version."' WHERE var_name = 'version'"; +out("Update Version Number to ".$xml_full_version); +$sql = "UPDATE endpointman_global_vars SET value = '".$xml_full_version."' WHERE var_name = 'version'"; $db->query($sql); $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/v2.5/' WHERE var_name = 'update_server'"; $db->query($sql); -$sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; -preg_match('/^(\d*)\.(\d*)/', $db->getOne($sql), $versions); - -$amp_version['minor'] = $versions[2]; - if(file_exists($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module")) { unlink($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); } diff --git a/module.xml b/module.xml index fbcbcdca..c8e9d298 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.1.0 + 2.10.1.1 setup Connectivity Andrew Nagy From 5521370a97beca9435df564b743cdfd6b88a9955 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 4 Nov 2011 08:11:08 +0000 Subject: [PATCH 225/623] Fixing epm 2.10 to work in lower than 2.10 --- includes/functions.inc | 6 +- install.php | 185 ++------ module.xml | 2 +- templates/freepbx/alt_config_popup.html | 4 + templates/freepbx/brand_model_manager.html | 39 ++ templates/freepbx/global_header.html | 10 + .../freepbx29/advanced_settings_iedl.html | 20 - .../advanced_settings_manual_upload.html | 55 --- .../freepbx29/advanced_settings_oui.html | 35 -- .../freepbx29/advanced_settings_poce.html | 71 --- .../freepbx29/advanced_settings_settings.html | 114 ----- .../advanced_settings_settings_pop.html | 67 --- .../advanced_settings_sh_manager.html | 53 --- templates/freepbx29/advanced_subheader.html | 14 - templates/freepbx29/alt_config_popup.html | 58 --- templates/freepbx29/brand_model_manager.html | 193 -------- templates/freepbx29/credits.html | 0 templates/freepbx29/devices_manager.html | 423 ------------------ templates/freepbx29/global_footer.html | 7 - templates/freepbx29/global_header.html | 182 -------- templates/freepbx29/global_links.html | 9 - templates/freepbx29/message_box.html | 1 - templates/freepbx29/specifics_pop.html | 58 --- templates/freepbx29/template_editor.html | 171 ------- templates/freepbx29/template_manager.html | 52 --- 25 files changed, 103 insertions(+), 1726 deletions(-) delete mode 100644 templates/freepbx29/advanced_settings_iedl.html delete mode 100644 templates/freepbx29/advanced_settings_manual_upload.html delete mode 100644 templates/freepbx29/advanced_settings_oui.html delete mode 100644 templates/freepbx29/advanced_settings_poce.html delete mode 100644 templates/freepbx29/advanced_settings_settings.html delete mode 100755 templates/freepbx29/advanced_settings_settings_pop.html delete mode 100644 templates/freepbx29/advanced_settings_sh_manager.html delete mode 100644 templates/freepbx29/advanced_subheader.html delete mode 100644 templates/freepbx29/alt_config_popup.html delete mode 100644 templates/freepbx29/brand_model_manager.html delete mode 100644 templates/freepbx29/credits.html delete mode 100644 templates/freepbx29/devices_manager.html delete mode 100644 templates/freepbx29/global_footer.html delete mode 100644 templates/freepbx29/global_header.html delete mode 100644 templates/freepbx29/global_links.html delete mode 100644 templates/freepbx29/message_box.html delete mode 100644 templates/freepbx29/specifics_pop.html delete mode 100644 templates/freepbx29/template_editor.html delete mode 100644 templates/freepbx29/template_manager.html diff --git a/includes/functions.inc b/includes/functions.inc index 6bd18184..362f0a6b 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -31,8 +31,6 @@ class endpointmanager { $this->global_cfg['disable_epm'] = FALSE; - //$this->db = $this->eda->db; - $this->global_cfg['tz'] = !empty($this->global_cfg['tz']) ? $this->global_cfg['tz'] : 'America/Los_Angeles'; date_default_timezone_set($this->global_cfg['tz']); @@ -122,15 +120,13 @@ class endpointmanager { $this->global_cfg['amp_ver']['major'] = $versions[1]; $this->global_cfg['amp_ver']['minor'] = $versions[2]; - $suffix = $this->global_cfg['amp_ver']['minor'] < '10' ? '29' : ''; - $this->tpl = new RainTPL( LOCAL_PATH.'templates/freepbx'.$suffix, LOCAL_PATH.'templates/freepbx/compiled', '/admin/modules/endpointman/templates/images' ); + $this->tpl = new RainTPL( LOCAL_PATH.'templates/freepbx', LOCAL_PATH.'templates/freepbx/compiled', '/admin/assets/endpointman/images' ); if($this->global_cfg['disable_help']) { $this->tpl->assign("disable_help", 1); } - $this->tpl->assign("amp_ver", $this->global_cfg['amp_ver']['minor']); } diff --git a/install.php b/install.php index a3a6e486..3a41b8ab 100644 --- a/install.php +++ b/install.php @@ -93,36 +93,51 @@ function ep_table_exists ($table) { $epm_module_xml = epm_install_xml2array(LOCAL_PATH."module.xml"); -$version = $epm_module_xml['module']['version']; +preg_match('/^(\d*)\.(\d*)/', $epm_module_xml['module']['version'], $versions); + +$xml_full_version = $epm_module_xml['module']['version']; + +$version['major'] = $versions[1]; +$version['minor'] = $versions[2]; + +$sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; +preg_match('/^(\d*)\.(\d*)/', $db->getOne($sql), $versions); + +$amp_version['minor'] = $versions[2]; -$sql = 'SELECT `version` FROM `modules` WHERE `modulename` = CONVERT(_utf8 \'endpointman\' USING latin1) COLLATE latin1_swedish_ci'; +$sql = 'SELECT `version` FROM `modules` WHERE `modulename` = CONVERT(_utf8 \'endpointman\' USING latin1) COLLATE latin1_swedish_ci'; $full_vers = $db->getOne($sql); -$db_version = (float)preg_replace('/[^0-9]*/i', '', $full_vers); if($db->getOne($sql)) { + $new_install = FALSE; $global_cfg =& $db->getAssoc("SELECT var_name, value FROM endpointman_global_vars"); - $global_cfg['version'] = $db_version; -} else { - $global_cfg['version'] = '?'; -} -$new_install = FALSE; -if($global_cfg['version'] != "?") { - $ver = $global_cfg['version']; + + if(preg_match('/^(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)) { + + }elseif(preg_match('/^(\d*)\.(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)){ + + }elseif(preg_match('/^(\d*)\.(\d*)\.(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)){ + + } + + $very['major'] = $versions[1]; + $very['minor'] = isset($versions[2]) ? $versions[2] : '0'; + $very['subminor'] = isset($versions[3]) ? $versions[3] : '0'; + $very['subsubminor'] = isset($versions[4]) ? $versions[4] : '0'; + + $ver = $very['major'] . $very['minor'] . $very['subminor'] . $very['subsubminor']; + + out('Version Identified as '. $full_vers); } else { - $ver = "1000"; $new_install = TRUE; -} - -if($new_install) { out('New Installation Detected!'); -} else { - out('Version Identified as '. $full_vers); } + if(!$new_install) { - if(($ver < "190") AND ($ver > 0)) { + if(($ver < "1900") AND ($ver > 0)) { out("Please Wait While we upgrade your old setup"); //Expand the value option $sql = 'ALTER TABLE `endpointman_global_vars` CHANGE `value` `value` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT \'Data\''; @@ -297,7 +312,7 @@ function ep_table_exists ($table) { out("DONE! You can now use endpoint manager!"); } - if ($ver <= "190") { + if ($ver <= "1900") { out("Locating NMAP + ARP + ASTERISK Executables"); $nmap = find_exec("nmap"); @@ -367,7 +382,7 @@ function ep_table_exists ($table) { $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; $db->query($sql); } - if ($ver <= "191") { + if ($ver <= "1910") { out("Create Custom Configs Table"); $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( `id` int(11) NOT NULL auto_increment, @@ -422,11 +437,11 @@ function ep_table_exists ($table) { $sql = "ALTER TABLE endpointman_mac_list CHANGE custom_cfg_data custom_cfg_data TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL"; $db->query($sql); } - if ($ver <= "192") { + if ($ver <= "1920") { out('Updating Global Variables'); } - if ($ver <= "199") { + if ($ver <= "1990") { out("Adding Custom Field to OUI List"); $sql = 'ALTER TABLE `endpointman_oui_list` ADD `custom` INT(1) NOT NULL DEFAULT \'0\''; $db->query($sql); @@ -470,7 +485,7 @@ function ep_table_exists ($table) { $sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php ".LOCAL_PATH. "includes/update_check.php')"; $db->query($sql); } - if($ver <= "200") { + if($ver <= "2000") { out("Locating NMAP + ARP + ASTERISK Executables"); $nmap = find_exec("nmap"); $arp = find_exec("arp"); @@ -660,10 +675,8 @@ function ep_table_exists ($table) { out("Creating temp folder"); } } - if ($ver <= "221") { - } - if ($ver <= "222") { + if ($ver <= "2220") { out("Remove all Dashes in IDs"); $data = array(); @@ -707,16 +720,16 @@ function ep_table_exists ($table) { $db->query($sql); } } - if ($ver <= "223") { + if ($ver <= "2230") { $sql = "UPDATE endpointman_global_vars SET value = 'http://www.provisioner.net/release/' WHERE var_name = 'update_server'"; $db->query($sql); } - if ($ver <= "224") { + if ($ver <= "2240") { } - if ($ver <= "225") { + if ($ver <= "2250") { out("Fixing Permissions of Phone Modules Directory"); $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PHONE_MODULES_PATH), RecursiveIteratorIterator::SELF_FIRST); foreach($iterator as $item) { @@ -728,7 +741,7 @@ function ep_table_exists ($table) { $db->query($sql); } - if ($ver <= "226") { + if ($ver <= "2260") { $sql = "CREATE TABLE IF NOT EXISTS `endpointman_line_list` ( `luid` int(11) NOT NULL AUTO_INCREMENT, `mac_id` int(11) NOT NULL, @@ -780,11 +793,7 @@ function ep_table_exists ($table) { } - if ($ver <= "227") { - - } - - if ($ver <= "228") { + if ($ver <= "2280") { out("Fix Debug Left on Error, this turns off debug."); $sql = "UPDATE endpointman_global_vars SET value = '0' WHERE var_name = 'debug'"; $db->query($sql); @@ -793,12 +802,9 @@ function ep_table_exists ($table) { $db->query($sql); } - if ($ver <= "240") { + if ($ver <= "2400") { out("Uninstalling All Installed Brands (You'll just simply have to update again, no loss of data)"); $db->query("UPDATE endpointman_brand_list SET installed = '0'"); - out("Changing update server"); - $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/' WHERE var_name ='update_server'"; - $db->query($sql); $sql = "UPDATE endpointman_model_list SET enabled = '0', template_data = '".serialize(array())."'"; $db->query($sql); @@ -846,13 +852,6 @@ function ep_table_exists ($table) { $db->query($sql); } - if($ver <= "2909") { - out("Successfully Migrated to the new Installer!"); - $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/' WHERE var_name ='update_server'"; - $db->query($sql); - out("Mirgrated to FreePBX Mirror"); - } - if($ver <= "2910") { out("Fix again to the 'Allow Duplicate Extensions' Error"); $sql = 'ALTER TABLE `endpointman_global_vars` ADD UNIQUE `var_name` (`var_name`)'; @@ -985,7 +984,6 @@ function ep_table_exists ($table) { } - if ($new_install) { out("Creating Brand List Table"); @@ -1038,7 +1036,7 @@ function ep_table_exists ($table) { (4, 'gmthr', ''), (5, 'config_location', '/tftpboot/'), (6, 'update_server', 'http://mirror.freepbx.org/provisioner/v2.5/'), - (7, 'version', '".$version."'), + (7, 'version', '".$xml_full_version."'), (8, 'enable_ari', '0'), (9, 'debug', '0'), (10, 'arp_location', '".$arp."'), @@ -1127,88 +1125,6 @@ function ep_table_exists ($table) { ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; $db->query($sql); - out("Creating Time Zone List Tables"); - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_time_zones_desc` ( - `id` int(11) NOT NULL auto_increment, - `tid` int(11) NOT NULL, - `name` varchar(255) NOT NULL, - `description` varchar(255) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=32"; - $db->query($sql); - - $sql = "INSERT INTO `endpointman_time_zones_desc` (`id`, `tid`, `name`, `description`) VALUES -(1, 1, 'UTC', 'Universal Coordinated Time (and Greenwich Mean Time)'), -(2, 2, 'ECT', 'European Central Time'), -(3, 3, 'EET', 'Eastern European Time'), -(4, 3, 'ART', '(Arabic) Egypt Standard Time'), -(5, 4, 'EAT', 'Eastern African Time'), -(6, 5, 'MET', 'Middle East Time'), -(7, 6, 'NET', 'Near East Time'), -(8, 7, 'PLT', 'Pakistan Lahore Time'), -(9, 8, 'IST', 'India Standard Time'), -(10, 9, 'BST', 'Bangladesh Standard Time'), -(11, 10, 'VST', 'Vietnam Standard Time'), -(12, 11, 'CTT', 'China Taiwan Time'), -(13, 12, 'JST', 'Japan Standard Time'), -(14, 13, 'ACT', 'Australia Central Time'), -(15, 14, 'AET', 'Australia Eastern Time'), -(16, 15, 'SST', 'Solomon Standard Time'), -(17, 16, 'NST', 'New Zealand Standard Time'), -(18, 17, 'MIT', 'Midway Islands Time'), -(19, 18, 'HST', 'Hawaii Standard Time'), -(20, 19, 'AST', 'Alaska Standard Time'), -(21, 20, 'PST', 'Pacific Standard Time'), -(22, 21, 'PNT', 'Phoenix Standard Time'), -(23, 21, 'MST', 'Mountain Standard Time'), -(24, 22, 'CST', 'Central Standard Time'), -(25, 23, 'EST', 'Eastern Standard Time'), -(26, 23, 'IET', 'Indiana Eastern Standard Time'), -(27, 24, 'PRT', 'Puerto Rico and US Virgin Islands Time'), -(28, 25, 'CNT', 'Canada Newfoundland Time'), -(29, 26, 'AGT', 'Argentina Standard Time'), -(30, 26, 'BET', 'Brazil Eastern Time'), -(31, 27, 'CAT', 'Central African Time')"; - $db->query($sql); - - $sql = "CREATE TABLE IF NOT EXISTS `endpointman_time_zones_new` ( - `id` int(11) NOT NULL auto_increment, - `gmt` varchar(255) NOT NULL, - `offset` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=28"; - $db->query($sql); - - $sql = "INSERT INTO `endpointman_time_zones_new` (`id`, `gmt`, `offset`) VALUES -(1, 'GMT', 0), -(2, 'GMT+1:00', 3600), -(3, 'GMT+2:00', 7200), -(4, 'GMT+3:00', 10800), -(5, 'GMT+3:30', 12600), -(6, 'GMT+4:00', 14400), -(7, 'GMT+5:00', 18000), -(8, 'GMT+5:30', 19800), -(9, 'GMT+6:00', 21600), -(10, 'GMT+7:00', 25200), -(11, 'GMT+8:00', 28800), -(12, 'GMT+9:00', 32400), -(13, 'GMT+9:30', 34200), -(14, 'GMT+10:00', 36000), -(15, 'GMT+11:00', 39600), -(16, 'GMT+12:00', 43200), -(17, 'GMT-11:00', -39600), -(18, 'GMT-10:00', -36000), -(19, 'GMT-9:00', -32400), -(20, 'GMT-8:00', -28800), -(21, 'GMT-7:00', -25200), -(22, 'GMT-6:00', -21600), -(23, 'GMT-5:00', -18000), -(24, 'GMT-4:00', -14400), -(25, 'GMT-3:30', -12600), -(26, 'GMT-3:00', -10800), -(27, 'GMT-1:00', -3600)"; - $db->query($sql); - out("Create Custom Configs Table"); $sql = "CREATE TABLE IF NOT EXISTS `endpointman_custom_configs` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -1222,22 +1138,17 @@ function ep_table_exists ($table) { out('Creating symlink to web provisioner'); if(!symlink(LOCAL_PATH."provisioning",$amp_conf['AMPWEBROOT']."/provisioning")) { - out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); + //out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); } } -out("Update Version Number to ".$version); -$sql = "UPDATE endpointman_global_vars SET value = '".$version."' WHERE var_name = 'version'"; +out("Update Version Number to ".$xml_full_version); +$sql = "UPDATE endpointman_global_vars SET value = '".$xml_full_version."' WHERE var_name = 'version'"; $db->query($sql); $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/v2.5/' WHERE var_name = 'update_server'"; $db->query($sql); -$sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; -preg_match('/^(\d*)\.(\d*)/', $db->getOne($sql), $versions); - -$amp_version['minor'] = $versions[2]; - if(file_exists($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module")) { unlink($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); } diff --git a/module.xml b/module.xml index 0e25ae86..c8e9d298 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.0.9 + 2.10.1.1 setup Connectivity Andrew Nagy diff --git a/templates/freepbx/alt_config_popup.html b/templates/freepbx/alt_config_popup.html index b1d9fa1e..c4246433 100644 --- a/templates/freepbx/alt_config_popup.html +++ b/templates/freepbx/alt_config_popup.html @@ -6,7 +6,11 @@ + {if condition="$amp_ver < 10"} + {else} + + {/if} diff --git a/templates/freepbx/global_header.html b/templates/freepbx/global_header.html index 6ee7dacc..8b072502 100644 --- a/templates/freepbx/global_header.html +++ b/templates/freepbx/global_header.html @@ -3,9 +3,19 @@ PBX Endpoint Configuration Manager {if condition="isset($silent_mode)"} + {/if} + {if condition="(isset($silent_mode)) OR ($amp_ver < 9)"} + {/if} + {if condition="$amp_ver < 9"} + + + + + + {elseif condition="$amp_ver >= 10"} {/if} -{loop name="brand2_list"} - - - - - - - - -
      {$value.name}
      {else}{/if}">
       {loop name="value.products"} - - - - - - - - -
      {$value.long_name}
      {else}{/if}">
       {loop name="value.models"} - - - - -
      {$value.model}
      {else}{/if}">
      {/loop}
      {/loop}
      -
      -
      -{/loop} - - - - - - - diff --git a/templates/freepbx29/advanced_subheader.html b/templates/freepbx29/advanced_subheader.html deleted file mode 100644 index 67a4c9d7..00000000 --- a/templates/freepbx29/advanced_subheader.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - -
      {if condition="$subhead_area == 'settings'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'oui_manager'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'poce'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'iedl'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'manual_upload'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'sh_manager'"}

      {else}

      {/if}
      -
      \ No newline at end of file diff --git a/templates/freepbx29/alt_config_popup.html b/templates/freepbx29/alt_config_popup.html deleted file mode 100644 index b1d9fa1e..00000000 --- a/templates/freepbx29/alt_config_popup.html +++ /dev/null @@ -1,58 +0,0 @@ - - - PBX Endpoint Configuration Manager - - - - - - - - - -
      -
      -
      -

      -
      -{if condition="isset($show_error_box)"} - {include="message_box"} -{/if} -

      : {$file}

      - Warning! You can really mess up your phone by messing with these settings. Potentially causing it to not boot!
      - {if condition="isset($location) && isset($allow_hdfiles)"} - You are editing a global file. This will effect any & all phones that reference this hard file -
      It is NOT individual to this template!!!

      - You can setup individual templates in the "Product Options/Configuration Editor" under "End Point Advanced Settings" - {/if} -
      - - - - -
      {if condition="isset($location)"}File Location: {$location}{/if}
      - -
      - -
      -
      -
      - - diff --git a/templates/freepbx29/brand_model_manager.html b/templates/freepbx29/brand_model_manager.html deleted file mode 100644 index 64605829..00000000 --- a/templates/freepbx29/brand_model_manager.html +++ /dev/null @@ -1,193 +0,0 @@ -{include="global_header"} -{if condition="isset($show_error_box)"} - {include="message_box"} -{/if} - - -
      -
      - -
      -
      - -

      - -{if condition="1 == 0"} - - - -
      -{if condition="!isset($update_check)"} -
      - -
      - - -{else} -
      - -
      - - -{/if} - -
      -{/if} -{if condition="isset($installer)"} - - -{/if} -{if condition="1 == 1"} - {loop name="brand2_list"} - - - - - - - - -
      {$value.name} {if condition="$value.installed == '1'"}( [{$value.cfg_ver}]) {/if}{if condition="$value.installed == '1'"}Check Online{/if}
      {else}{/if}">{if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}New Package Modified [{$value.update_vers}]{/if}{/if}
       {loop name="value.products"} - - - - - - - - -
      {$value.long_name} {if condition="$value.cfg_ver != ''"}{/if}
      {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}{/if}{/if}{if condition="$value.fw_type == 'install'"}{elseif condition="$value.fw_type == 'remove'"}{/if}{if condition="array_key_exists('update_fw',$value)"}{if condition="$value.update_fw == 1"}{/if}{/if}
       {loop name="value.models"} - - - - -
      {$value.model}
      {else}{/if}">
      {/loop}
      {/loop}
      -
      -
      - {/loop} -{/if} -
      -
      Want to participate? Add new phones? Join us at http://www.provisioner.net
      -{include="global_footer"} - - - - - diff --git a/templates/freepbx29/credits.html b/templates/freepbx29/credits.html deleted file mode 100644 index e69de29b..00000000 diff --git a/templates/freepbx29/devices_manager.html b/templates/freepbx29/devices_manager.html deleted file mode 100644 index c349bd5b..00000000 --- a/templates/freepbx29/devices_manager.html +++ /dev/null @@ -1,423 +0,0 @@ -{include="global_header"} -{if condition="isset($show_error_box)"} -{include="message_box"} -{/if} -
      - - -
      - {if condition="$no_add == FALSE"} -
      - - -
      - {/if} -
      - - - - - - - - - - - - - - - - {if condition="$no_add == FALSE"} - - - - - - - - - - - - - -{loop name="line_list_edit"} - - - - - - - - - - - - -{/loop} -{if condition="$mode != 'EDIT'"} - - - - - - - - - - - - -{/if} -{if condition="$mode == 'EDIT'"} - - - - - - - - - - - -{else} - - - - - - - - - - - -{/if} -{/if} -

        - {if condition="$mode == 'EDIT'"} - {$mac} - {else} - - {/if} - {/if} - -
      -
      -
      - {if condition="$mode == 'EDIT'"} - '> - {else} - '> - {/if} - {if condition="$mode != 'EDIT'"}'>{/if}
        - - - - {if condition="!isset($disabled_delete_line)"}
      {/if}
        - - - -
         
      Add Line
         Add Line
      - - -{if condition="$searched == 1"} - - - - - - - - - - - {if condition="is_array($unmanaged)"} - - {loop name="unmanaged"} - - - - - - - - - - - - - - - {/loop} - -
         

         
      {$value.mac_strip}
      ({$value.ip})
      {$value.brand} - - - - -   
      - - - -

      Reboot Phones
      - - - {/if} - -{/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - {loop name="list"} - - - - - - - - - - - - - {loop name="value.line"} - - - - - - - - - - - - - {/loop} - {/loop} -
         

       
      Expand All Line Info
       

      Mac Address

      Brand

      Model of Phone

      Line

      Extension Number

      Template

      Edit

      Delete

      {$value.status.ip}:{$value.status.port}
      {$value.mac}{$value.name}{$value.model}
      {$value.template_name}
      - -
      -
      -

      - -

      -
      - - - - - - -

      Reboot Phones
      :
      : :

      Reboot Phones
      - -
      -
      -

      -
      - - - - - - - - -
      -
      - '> -
      - Reboot Phones -
      -
      -

      - '>
      -
      -
      (products)

      - -
      - (models)

      - -
      - - -{if condition="!isset($disable_help)"} - -{/if} -{include="global_footer"} \ No newline at end of file diff --git a/templates/freepbx29/global_footer.html b/templates/freepbx29/global_footer.html deleted file mode 100644 index cb8ed4cd..00000000 --- a/templates/freepbx29/global_footer.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/templates/freepbx29/global_header.html b/templates/freepbx29/global_header.html deleted file mode 100644 index 6ee7dacc..00000000 --- a/templates/freepbx29/global_header.html +++ /dev/null @@ -1,182 +0,0 @@ - - - PBX Endpoint Configuration Manager - {if condition="isset($silent_mode)"} - - - - - - {/if} - - {if condition="isset($template_editor_display)"} - - - - {/if} - {if condition="isset($amp_conf_serial)"} - - {/if} - - -
      -
      -
      -

      -
      \ No newline at end of file diff --git a/templates/freepbx29/global_links.html b/templates/freepbx29/global_links.html deleted file mode 100644 index eb518c79..00000000 --- a/templates/freepbx29/global_links.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - -

      -
      diff --git a/templates/freepbx29/message_box.html b/templates/freepbx29/message_box.html deleted file mode 100644 index c3a6632e..00000000 --- a/templates/freepbx29/message_box.html +++ /dev/null @@ -1 +0,0 @@ -
      {$error_message}{if condition="$advanced_debug == 1"}
      Backtrace

      Extended Backtrace

      Last Error
      {/if}
      \ No newline at end of file diff --git a/templates/freepbx29/specifics_pop.html b/templates/freepbx29/specifics_pop.html deleted file mode 100644 index 5b1b017f..00000000 --- a/templates/freepbx29/specifics_pop.html +++ /dev/null @@ -1,58 +0,0 @@ - - - PBX Endpoint Configuration Manager - - - - - - - - -
      -
      -
      -

      -
      - {if condition="isset($show_error_box)"} - {include="message_box"} - {/if} -
      - - - {loop name="display_name"} - - {/loop} - - - - - - - - - - -
      General Settings
      Display Name Line {$value.line}:
       
      IP Settings
      IP Type - -
      IPv4 Address:
      IPv6 Address:
      Subnet Mask Address:
      Gateway Address:
      -
      - -
      -
      - - diff --git a/templates/freepbx29/template_editor.html b/templates/freepbx29/template_editor.html deleted file mode 100644 index cb080a7f..00000000 --- a/templates/freepbx29/template_editor.html +++ /dev/null @@ -1,171 +0,0 @@ -{if condition="isset($in_ari)"} - - - - - - - - - - -{else} - - - - - {if condition="$custom != 0"} - : Custom Template: Extension {$ext}
      - : {$product}
      - : {$model}
      - - {if condition="isset($silent_mode)"} - - {/if} - {loop name="area_ava"} - - {/loop} - - (Note: This is NOT the number of supported lines on the phone(s)) - {/if} -
      - {if condition="isset($silent_mode)"} - - {/if} - {if condition="$custom == 0"} - : {$template_name}
      - : {$product}
      - : -
      - - {if condition="isset($silent_mode)"} - - {/if} - {loop name="area_ava"} - - {/loop} - - (Note: This is NOT the number of supported lines on the phone(s)) - {/if} -
      - : <?php echo _(' border='0'> -
      - {if condition="$alt != 0"} -
      - {loop name="alt_configs"} - - {$value.name} - <?php echo _(' border='0'> -
      - {/loop} -
      - {/if} - {loop name="only_configs"} - {$value.name} - <?php echo _(' border='0'> -
      - {/loop} -
      - :
      {noparse} - -"{$server.ip.1}" =
      - -"{$server.port.1}" =
      - -"{$mac}" =
      - -"{$model}" =
      - -"{$ext.line.1}" =
      - -"{$displayname.line.1}" =
      {/noparse} -
      - {/if} - -
      -
      - {loop name="template_editor"} -
      -
      -

      {$value.title}

      - - {loop name="value.data"} - - - - {if condition="$value.type == 'break'"} - - - - - {/if} - {/loop} -
      - {if condition="$value.type == 'input'"} - - {elseif condition="$value.type == 'textarea'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: - {elseif condition="$value.type == 'file'"} - - {elseif condition="$value.type == 'radio'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if} - {loop name="value.data"} - - {/loop} - {elseif condition="$value.type == 'list'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: - {/if} - - {if condition="isset($value.aried)"} - - {/if} -
        
      -
      -
      - {/loop} -
      -
      - - - {if condition="!isset($in_ari)"} - Reboot Phone(s)
      - -
      - {include="global_footer"} - {/if} diff --git a/templates/freepbx29/template_manager.html b/templates/freepbx29/template_manager.html deleted file mode 100644 index b7d5a62e..00000000 --- a/templates/freepbx29/template_manager.html +++ /dev/null @@ -1,52 +0,0 @@ -{include="global_header"} -{if condition="isset($show_error_box)"} - {include="message_box"} -{/if} -{if condition="$no_add == FALSE"} -
      -

      :

      - : - - : - - Clone Template From: - - -
      - - - - - - - - -{loop name="templates_list"} - - - - - - - - -{/loop} -

      {$value.name}{$value.model_class}{$value.model_clone}<?php echo _(' border='0'>{if condition="$value.custom == 0"} - <?php echo _(' border='0'>{/if}
      -
      -{/if} -{include="global_footer"} \ No newline at end of file From 94e846391b5fab179b0148d118d44d6454f48841 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 4 Nov 2011 01:17:20 -0700 Subject: [PATCH 226/623] Adding a different warning message -Just a simple warn about FreePBX 2.8 and below --- install.php | 4 ++++ module.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/install.php b/install.php index 3a41b8ab..98a1810b 100644 --- a/install.php +++ b/install.php @@ -105,6 +105,10 @@ function ep_table_exists ($table) { $amp_version['minor'] = $versions[2]; +if($amp_version['minor'] < 9) { + out("Warning: Endpoint Manager is unsupported on FreePBX 2.".$amp_version['minor'].". We do check it on occasion but it is not a supported platform"); +} + $sql = 'SELECT `version` FROM `modules` WHERE `modulename` = CONVERT(_utf8 \'endpointman\' USING latin1) COLLATE latin1_swedish_ci'; $full_vers = $db->getOne($sql); diff --git a/module.xml b/module.xml index c8e9d298..a518b5af 100644 --- a/module.xml +++ b/module.xml @@ -20,7 +20,7 @@ https://github.com/tm1000/freepbx-endpointmanager 2.10/endpointman-2.10.0.3.tgz - 2.7 + 2.6 core From 2c326ee9983316cb4af131e42ef9c1b762470862 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 4 Nov 2011 08:19:59 +0000 Subject: [PATCH 227/623] Fixes #5415 --- install.php | 4 ++++ module.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/install.php b/install.php index 3a41b8ab..98a1810b 100644 --- a/install.php +++ b/install.php @@ -105,6 +105,10 @@ function ep_table_exists ($table) { $amp_version['minor'] = $versions[2]; +if($amp_version['minor'] < 9) { + out("Warning: Endpoint Manager is unsupported on FreePBX 2.".$amp_version['minor'].". We do check it on occasion but it is not a supported platform"); +} + $sql = 'SELECT `version` FROM `modules` WHERE `modulename` = CONVERT(_utf8 \'endpointman\' USING latin1) COLLATE latin1_swedish_ci'; $full_vers = $db->getOne($sql); diff --git a/module.xml b/module.xml index c8e9d298..a518b5af 100644 --- a/module.xml +++ b/module.xml @@ -20,7 +20,7 @@ https://github.com/tm1000/freepbx-endpointmanager 2.10/endpointman-2.10.0.3.tgz - 2.7 + 2.6 core From 0aabfba5a276871448a925cfe3ca39e7c0391a22 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 4 Nov 2011 01:36:18 -0700 Subject: [PATCH 228/623] Updated readme file --- README | 10 ---------- README.md | 9 ++++----- 2 files changed, 4 insertions(+), 15 deletions(-) delete mode 100644 README diff --git a/README b/README deleted file mode 100644 index 2f1166c4..00000000 --- a/README +++ /dev/null @@ -1,10 +0,0 @@ -# Endpoint Manager FreePBX Module # - -### Issue Reporting ### -Issue can be reported here on github or http://www.freepbx.org/trac/newticket - -### Download Locations ### -Precomplied FreePBX Packages can be found here: http://www.the159.com/endpointman/ - -If Using FreePBX 2.9 or less please use one of the 2.9.x packages -If Using FreePBX 2.10 or greater please use one of the 2.10.x packages diff --git a/README.md b/README.md index 2f1166c4..ecc36f72 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ # Endpoint Manager FreePBX Module # ### Issue Reporting ### -Issue can be reported here on github or http://www.freepbx.org/trac/newticket +Issues can be reported here on github or http://www.freepbx.org/trac/newticket ### Download Locations ### -Precomplied FreePBX Packages can be found here: http://www.the159.com/endpointman/ - -If Using FreePBX 2.9 or less please use one of the 2.9.x packages -If Using FreePBX 2.10 or greater please use one of the 2.10.x packages +Precomplied FreePBX Packages from the Development Branch can be found here: http://www.the159.com/endpointman/ +Stable FreePBX 2.10 Packages can be found here: http://mirror.freepbx.org/modules/release/2.10/endpointman-2.10.latest.tgz +Stable FreePBX 2.9 or lower Packages can be found here: http://mirror.freepbx.org/modules/release/2.9/endpointman-2.9.latest.tgz \ No newline at end of file From aec4970ef60de5293cc45262b80d21144e93b7a4 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 4 Nov 2011 08:37:17 +0000 Subject: [PATCH 229/623] Some small merge fixes for endpoint manager --- README.md | 9 +++++++++ functions.inc.php | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..ecc36f72 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Endpoint Manager FreePBX Module # + +### Issue Reporting ### +Issues can be reported here on github or http://www.freepbx.org/trac/newticket + +### Download Locations ### +Precomplied FreePBX Packages from the Development Branch can be found here: http://www.the159.com/endpointman/ +Stable FreePBX 2.10 Packages can be found here: http://mirror.freepbx.org/modules/release/2.10/endpointman-2.10.latest.tgz +Stable FreePBX 2.9 or lower Packages can be found here: http://mirror.freepbx.org/modules/release/2.9/endpointman-2.9.latest.tgz \ No newline at end of file diff --git a/functions.inc.php b/functions.inc.php index 9c51f61e..a40e1bb6 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -51,8 +51,7 @@ function endpointman_configpageinit($pagename) { $delete = isset($_REQUEST['epm_delete'])?$_REQUEST['epm_delete']:null; $tech = isset($_REQUEST['tech_hardware'])?$_REQUEST['tech_hardware']:null; - - if((($display == "extensions") OR ($display == "devices")) && (isset($extdisplay) OR ($tech == "sip_generic"))) { + if((($display == "extensions") OR ($display == "devices")) && (isset($extdisplay) OR ($tech == "sip_generic"))) { global $endpoint; $doc_root = $amp_conf['AMPWEBROOT'] ."/admin/modules/endpointman/"; @@ -183,7 +182,6 @@ function endpointman_configpageload() { $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; $tech = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : null; $tech = isset($tech) ? $tech : $_REQUEST['tech']; - if((isset($tech)) && (($tech == 'sip_generic') OR ($tech == 'sip'))) { // Don't display this stuff it it's on a 'This xtn has been deleted' page. if ($action != 'del') { From 2d2260a536cc4127d445e97ebe28fcff0202933f Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 4 Nov 2011 02:14:59 -0700 Subject: [PATCH 230/623] Bug Fixes -Fixing adding lines update issue --- includes/functions.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 362f0a6b..7f3226c3 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -361,10 +361,10 @@ class endpointmanager { $lines_list = $this->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); foreach($lines_list as $row) { - $sql = "SELECT description FROM devices WHERE id = ".$ext; + $sql = "SELECT description FROM devices WHERE id = ".$row['ext']; $name=$this->eda->sql($sql,'getOne'); - $sql = "UPDATE endpointman_line_list SET line = '".$line."', ext = ".$ext.", description = '".addslashes($name)."' WHERE luid = ". $row['luid']; + $sql = "UPDATE endpointman_line_list SET line = '".$row['line']."', ext = ".$row['ext'].", description = '".addslashes($name)."' WHERE luid = ". $row['luid']; $this->eda->sql($sql); } From f9b3e99d5ea9d76e6a77b9d4b7dc9e59502bb9c4 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 4 Nov 2011 09:35:26 +0000 Subject: [PATCH 231/623] Fixing line adding issue --- includes/functions.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 362f0a6b..7f3226c3 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -361,10 +361,10 @@ class endpointmanager { $lines_list = $this->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); foreach($lines_list as $row) { - $sql = "SELECT description FROM devices WHERE id = ".$ext; + $sql = "SELECT description FROM devices WHERE id = ".$row['ext']; $name=$this->eda->sql($sql,'getOne'); - $sql = "UPDATE endpointman_line_list SET line = '".$line."', ext = ".$ext.", description = '".addslashes($name)."' WHERE luid = ". $row['luid']; + $sql = "UPDATE endpointman_line_list SET line = '".$row['line']."', ext = ".$row['ext'].", description = '".addslashes($name)."' WHERE luid = ". $row['luid']; $this->eda->sql($sql); } From 182bce7f59aeb2580cc1619c878a0f97dba9b81f Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Sat, 5 Nov 2011 15:55:47 -0700 Subject: [PATCH 232/623] Starting to ajax-ize everything --- ajax_select.html.php | 2 +- assets/js/jquery.form.js | 911 ++++++++++++++++++ includes/JSON/LICENSE | 21 - includes/JSON/Test-JSON.php | 521 ---------- includes/ajax.inc | 102 +- includes/ajax_post.php | 4 - includes/ajax_select.php | 98 -- includes/devices_manager.inc | 7 +- includes/{export.php => export.inc} | 0 includes/functions.inc | 12 +- includes/{installer.php => installer.inc} | 0 includes/{JSON/JSON.php => json.inc} | 79 +- includes/jsonwrapper.php | 6 - includes/jsonwrapper_inner.php | 23 - includes/{popup.php => popup.inc} | 0 includes/{rain.error.php => rain.error.inc} | 0 ...{rain.tpl.class.php => rain.tpl.class.inc} | 0 includes/{timezone.php => timezone.inc} | 0 module.xml | 2 +- page.endpointman.php | 41 +- popup.html.php | 2 +- templates/freepbx/devices_manager.html | 186 +++- templates/freepbx/global_header.html | 136 +-- templates/freepbx/template_editor.html | 7 + templates/freepbx/template_manager.html | 15 + 25 files changed, 1290 insertions(+), 885 deletions(-) create mode 100644 assets/js/jquery.form.js delete mode 100644 includes/JSON/LICENSE delete mode 100644 includes/JSON/Test-JSON.php delete mode 100644 includes/ajax_post.php delete mode 100644 includes/ajax_select.php rename includes/{export.php => export.inc} (100%) rename includes/{installer.php => installer.inc} (100%) rename includes/{JSON/JSON.php => json.inc} (94%) delete mode 100644 includes/jsonwrapper.php delete mode 100644 includes/jsonwrapper_inner.php rename includes/{popup.php => popup.inc} (100%) rename includes/{rain.error.php => rain.error.inc} (100%) rename includes/{rain.tpl.class.php => rain.tpl.class.inc} (100%) rename includes/{timezone.php => timezone.inc} (100%) diff --git a/ajax_select.html.php b/ajax_select.html.php index db55739e..d432db61 100644 --- a/ajax_select.html.php +++ b/ajax_select.html.php @@ -6,4 +6,4 @@ * @license MPL / GPLv2 / LGPL * @package Endpoint Manager */ -include('includes/ajax_select.php'); \ No newline at end of file +include('includes/ajax.inc'); \ No newline at end of file diff --git a/assets/js/jquery.form.js b/assets/js/jquery.form.js new file mode 100644 index 00000000..af2eaf31 --- /dev/null +++ b/assets/js/jquery.form.js @@ -0,0 +1,911 @@ +/*! + * jQuery Form Plugin + * version: 2.84 (12-AUG-2011) + * @requires jQuery v1.3.2 or later + * + * Examples and documentation at: http://malsup.com/jquery/form/ + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ +;(function($) { + +/* + Usage Note: + ----------- + Do not use both ajaxSubmit and ajaxForm on the same form. These + functions are intended to be exclusive. Use ajaxSubmit if you want + to bind your own submit handler to the form. For example, + + $(document).ready(function() { + $('#myForm').bind('submit', function(e) { + e.preventDefault(); // <-- important + $(this).ajaxSubmit({ + target: '#output' + }); + }); + }); + + Use ajaxForm when you want the plugin to manage all the event binding + for you. For example, + + $(document).ready(function() { + $('#myForm').ajaxForm({ + target: '#output' + }); + }); + + When using ajaxForm, the ajaxSubmit function will be invoked for you + at the appropriate time. +*/ + +/** + * ajaxSubmit() provides a mechanism for immediately submitting + * an HTML form using AJAX. + */ +$.fn.ajaxSubmit = function(options) { + // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) + if (!this.length) { + log('ajaxSubmit: skipping submit process - no element selected'); + return this; + } + + var method, action, url, $form = this; + + if (typeof options == 'function') { + options = { success: options }; + } + + method = this.attr('method'); + action = this.attr('action'); + url = (typeof action === 'string') ? $.trim(action) : ''; + url = url || window.location.href || ''; + if (url) { + // clean url (don't include hash vaue) + url = (url.match(/^([^#]+)/)||[])[1]; + } + + options = $.extend(true, { + url: url, + success: $.ajaxSettings.success, + type: method || 'GET', + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' + }, options); + + // hook for manipulating the form data before it is extracted; + // convenient for use with rich editors like tinyMCE or FCKEditor + var veto = {}; + this.trigger('form-pre-serialize', [this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); + return this; + } + + // provide opportunity to alter form data before it is serialized + if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSerialize callback'); + return this; + } + + var n,v,a = this.formToArray(options.semantic); + if (options.data) { + options.extraData = options.data; + for (n in options.data) { + if( $.isArray(options.data[n]) ) { + for (var k in options.data[n]) { + a.push( { name: n, value: options.data[n][k] } ); + } + } + else { + v = options.data[n]; + v = $.isFunction(v) ? v() : v; // if value is fn, invoke it + a.push( { name: n, value: v } ); + } + } + } + + // give pre-submit callback an opportunity to abort the submit + if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSubmit callback'); + return this; + } + + // fire vetoable 'validate' event + this.trigger('form-submit-validate', [a, this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); + return this; + } + + var q = $.param(a); + + if (options.type.toUpperCase() == 'GET') { + options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; + options.data = null; // data is null for 'get' + } + else { + options.data = q; // data is the query string for 'post' + } + + var callbacks = []; + if (options.resetForm) { + callbacks.push(function() { $form.resetForm(); }); + } + if (options.clearForm) { + callbacks.push(function() { $form.clearForm(); }); + } + + // perform a load on the target only if dataType is not provided + if (!options.dataType && options.target) { + var oldSuccess = options.success || function(){}; + callbacks.push(function(data) { + var fn = options.replaceTarget ? 'replaceWith' : 'html'; + $(options.target)[fn](data).each(oldSuccess, arguments); + }); + } + else if (options.success) { + callbacks.push(options.success); + } + + options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg + var context = options.context || options; // jQuery 1.4+ supports scope context + for (var i=0, max=callbacks.length; i < max; i++) { + callbacks[i].apply(context, [data, status, xhr || $form, $form]); + } + }; + + // are there files to upload? + var fileInputs = $('input:file', this).length > 0; + var mp = 'multipart/form-data'; + var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); + + // options.iframe allows user to force iframe mode + // 06-NOV-09: now defaulting to iframe mode if file input is detected + if (options.iframe !== false && (fileInputs || options.iframe || multipart)) { + // hack to fix Safari hang (thanks to Tim Molendijk for this) + // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d + if (options.closeKeepAlive) { + $.get(options.closeKeepAlive, function() { fileUpload(a); }); + } + else { + fileUpload(a); + } + } + else { + // IE7 massage (see issue 57) + if ($.browser.msie && method == 'get') { + var ieMeth = $form[0].getAttribute('method'); + if (typeof ieMeth === 'string') + options.type = ieMeth; + } + $.ajax(options); + } + + // fire 'notify' event + this.trigger('form-submit-notify', [this, options]); + return this; + + + // private function for handling file uploads (hat tip to YAHOO!) + function fileUpload(a) { + var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; + var useProp = !!$.fn.prop; + + if (a) { + // ensure that every serialized input is still enabled + for (i=0; i < a.length; i++) { + el = $(form[a[i].name]); + el[ useProp ? 'prop' : 'attr' ]('disabled', false); + } + } + + if ($(':input[name=submit],:input[id=submit]', form).length) { + // if there is an input with a name or id of 'submit' then we won't be + // able to invoke the submit fn on the form (at least not x-browser) + alert('Error: Form elements must not have name or id of "submit".'); + return; + } + + s = $.extend(true, {}, $.ajaxSettings, options); + s.context = s.context || s; + id = 'jqFormIO' + (new Date().getTime()); + if (s.iframeTarget) { + $io = $(s.iframeTarget); + n = $io.attr('name'); + if (n == null) + $io.attr('name', id); + else + id = n; + } + else { + $io = $('') + .dialog({ + title: 'Status - Please Wait', + resizable: false, + modal: true, + position: ['center', 50], + width: '400px', + height: 230, + close: function (e) { + close_module_actions(true); + $(e.target).dialog("destroy").remove(); + } + }); + }); +} +function close_module_actions(goback) { + box.dialog("destroy").remove(); + if (goback) { + location.href = 'config.php?type=tool&display=epm_advanced&subpage=manual_upload'; + } +} +{else} function process_module_actions(actions) { freepbx_modal_show('moduleBox'); urlStr = "config.php?type=tool&display=epm_config&quietmode=1&handler=file&file=installer.html.php&module=endpointman&type=manual_install&package={$package}&xml={$xml}&install_type={$type}"; @@ -19,6 +51,7 @@ location.href = 'config.php?type=tool&display=epm_advanced&subpage=manual_upload'; } } +{/if} process_module_actions(); From d3b2e84743e920de80dad1ac04ec10b81efd230f Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Mon, 30 Jan 2012 12:23:50 -0800 Subject: [PATCH 264/623] Bump version number & fix install.php --- install.php | 12 ++++++++---- module.xml | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/install.php b/install.php index afd9ffc3..f11ab90f 100644 --- a/install.php +++ b/install.php @@ -935,10 +935,14 @@ function ep_table_exists ($table) { out('Updating Mirror Location...again'); $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/v3/' WHERE var_name ='update_server'"; $db->query($sql); - - //$sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'tftp_check\', \'0\');'; - //$sql = 'INSERT INTO `asterisk`.`endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'nmap_search\', \'\');'; - + } + + if($ver <= "21031") { + out("Adding tftp server check and nmap search save values"); + $sql = 'INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'tftp_check\', \'0\');'; + $db->query($sql); + $sql = 'INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'nmap_search\', \'\');'; + $db->query($sql); } } diff --git a/module.xml b/module.xml index 721356f6..47fcac48 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.2.4 + 2.10.3.1 setup Connectivity Andrew Nagy From 83a35cf85b4b516652b2f3cd9129fcfb2408a4c0 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 31 Jan 2012 10:59:12 -0800 Subject: [PATCH 265/623] Fixing a pretty big oops in terms of order of functions --- includes/functions.inc | 8 ++++---- module.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index d5898944..61e9af42 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -2458,13 +2458,13 @@ class endpointmanager { if (preg_match('/200/', $http_response_header[0])) { $dirname = dirname($destination_file); - if (!is_writable($dirname)) { - $this->error['download_file'] = "Directory '".$dirname."' is not writable! Unable to download files"; - return false; - } if (!file_exists($dirname)) { mkdir($dirname); } + if (!is_writable($dirname)) { + $this->error['download_file'] = "Directory '".$dirname."' is not writable! Unable to download files"; + return false; + } file_put_contents($destination_file, $contents); //check file placement if (!file_exists($destination_file)) { diff --git a/module.xml b/module.xml index 47fcac48..d3587770 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.3.1 + 2.10.3.2 setup Connectivity Andrew Nagy From a01b45390ba215d5504f8cd7b3994cffb5454247 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Wed, 22 Feb 2012 21:37:11 -0800 Subject: [PATCH 266/623] Bug Fixes Galore -Fixed Extensions/Devices/Users Pages, for reals this time -Updated http provisioner to correct yealink issues -fixed json class conflicts --- functions.inc.php | 230 ++++--- includes/ajax.inc | 2 +- includes/functions.inc | 2 - includes/json.inc | 1365 ++++++++++++++++++++-------------------- module.xml | 2 +- provisioning/.htaccess | 10 +- provisioning/p.php | 3 +- 7 files changed, 825 insertions(+), 789 deletions(-) diff --git a/functions.inc.php b/functions.inc.php index fb49c7f9..73686b24 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -1,4 +1,5 @@ getOne($sql); - switch($engine) { + switch ($engine) { case "asterisk": if (isset($core_conf) && is_a($core_conf, "core_conf") && ($amp_version >= "2.8.0")) { - $core_conf->addSipNotify('polycom-check-cfg',array('Event' => 'check-sync','Content-Length' => '0')); - $core_conf->addSipNotify('polycom-reboot',array('Event' => 'check-sync','Content-Length' => '0')); - $core_conf->addSipNotify('sipura-check-cfg',array('Event' => 'resync','Content-Length' => '0')); - $core_conf->addSipNotify('grandstream-check-cfg',array('Event' => 'sys-control')); - $core_conf->addSipNotify('cisco-check-cfg',array('Event' => 'check-sync','Content-Length' => '0')); - $core_conf->addSipNotify('reboot-snom',array('Event' => 'reboot','Content-Length' => '0')); - $core_conf->addSipNotify('aastra-check-cfg',array('Event' => 'check-sync','Content-Length' => '0')); - $core_conf->addSipNotify('linksys-cold-restart',array('Event' => 'reboot_now','Content-Length' => '0')); - $core_conf->addSipNotify('linksys-warm-restart',array('Event' => 'restart_now','Content-Length' => '0')); - $core_conf->addSipNotify('spa-reboot',array('Event' => 'reboot','Content-Length' => '0')); + $core_conf->addSipNotify('polycom-check-cfg', array('Event' => 'check-sync', 'Content-Length' => '0')); + $core_conf->addSipNotify('polycom-reboot', array('Event' => 'check-sync', 'Content-Length' => '0')); + $core_conf->addSipNotify('sipura-check-cfg', array('Event' => 'resync', 'Content-Length' => '0')); + $core_conf->addSipNotify('grandstream-check-cfg', array('Event' => 'sys-control')); + $core_conf->addSipNotify('cisco-check-cfg', array('Event' => 'check-sync', 'Content-Length' => '0')); + $core_conf->addSipNotify('reboot-snom', array('Event' => 'reboot', 'Content-Length' => '0')); + $core_conf->addSipNotify('aastra-check-cfg', array('Event' => 'check-sync', 'Content-Length' => '0')); + $core_conf->addSipNotify('linksys-cold-restart', array('Event' => 'reboot_now', 'Content-Length' => '0')); + $core_conf->addSipNotify('linksys-warm-restart', array('Event' => 'restart_now', 'Content-Length' => '0')); + $core_conf->addSipNotify('spa-reboot', array('Event' => 'reboot', 'Content-Length' => '0')); } break; } } + function endpointman_configpageinit($pagename) { global $currentcomponent, $amp_conf, $db; - - $display = isset($_REQUEST['display'])?$_REQUEST['display']:null; - - if($display == "extensions") { - if(isset($_REQUEST['extension'])) { - $extdisplay = isset($_REQUEST['extension'])?$_REQUEST['extension']:null; + + $display = isset($_REQUEST['display']) ? $_REQUEST['display'] : null; + $type = ''; + $tech = ''; + $extdisplay = ''; + + if ($display == "extensions") { + if (isset($_REQUEST['extension'])) { + $extdisplay = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : null; } else { - $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; + $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null; } - } elseif($display == "devices") { - $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; + } elseif ($display == "devices") { + if (isset($_REQUEST['deviceid'])) { + $extdisplay = isset($_REQUEST['deviceid']) ? $_REQUEST['deviceid'] : null; + } else { + $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null; + } + } + + if (isset($extdisplay) && !empty($extdisplay)) { + $sql = "SELECT tech FROM devices WHERE id = " . $extdisplay; + $tech = $db->getOne($sql); + if(!$tech) { + $tech = "sip"; + $type = 'new'; + } elseif($tech == 'sip') { + $type = 'edit'; + $tech = 'sip'; + } + } elseif(isset($_REQUEST['tech_hardware']) OR isset($_REQUEST['tech'])) { + $tech = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : $_REQUEST['tech']; + if(($tech == 'sip_generic') OR ($tech == 'sip')) { + $tech = "sip"; + $type = 'new'; + } } - $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; - $delete = isset($_REQUEST['epm_delete'])?$_REQUEST['epm_delete']:null; - $tech = isset($_REQUEST['tech_hardware'])?$_REQUEST['tech_hardware']:null; - - if((($display == "extensions") OR ($display == "devices")) && (isset($extdisplay) OR ($tech == "sip_generic"))) { + if (($tech == 'sip') AND (!empty($type))) { global $endpoint; - $doc_root = $amp_conf['AMPWEBROOT'] ."/admin/modules/endpointman/"; - if(file_exists($doc_root . "includes/functions.inc")) { + $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; + $delete = isset($_REQUEST['epm_delete']) ? $_REQUEST['epm_delete'] : null; + + $doc_root = $amp_conf['AMPWEBROOT'] . "/admin/modules/endpointman/"; + if (file_exists($doc_root . "includes/functions.inc")) { require($doc_root . "includes/functions.inc"); $endpoint = new endpointmanager(); ini_set('display_errors', 0); if ($action == "del") { - $sql = "SELECT mac_id,luid FROM endpointman_line_list WHERE ext = ". $extdisplay; - $macid = $endpoint->eda->sql($sql,'getRow',DB_FETCHMODE_ASSOC); - if($macid) { + $sql = "SELECT mac_id,luid FROM endpointman_line_list WHERE ext = " . $extdisplay; + $macid = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + if ($macid) { $endpoint->delete_line($macid['luid'], TRUE); } } - if(($action == "edit") OR ($action == "add")) { - if(isset($delete)) { - $sql = "SELECT mac_id,luid FROM endpointman_line_list WHERE ext = ". $extdisplay; - $macid = $endpoint->eda->sql($sql,'getRow',DB_FETCHMODE_ASSOC); - if($macid) { + if (($action == "edit") OR ($action == "add")) { + if (isset($delete)) { + $sql = "SELECT mac_id,luid FROM endpointman_line_list WHERE ext = " . $extdisplay; + $macid = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + if ($macid) { $endpoint->delete_line($macid['luid'], TRUE); } } - $mac = isset($_REQUEST['epm_mac'])?$_REQUEST['epm_mac']:null; + $mac = isset($_REQUEST['epm_mac']) ? $_REQUEST['epm_mac'] : null; - if(!empty($mac)) { + if (!empty($mac)) { //Mac is set - $brand = isset($_REQUEST['epm_brand'])?$_REQUEST['epm_brand']:null; - $model = isset($_REQUEST['epm_model'])?$_REQUEST['epm_model']:null; - $line = isset($_REQUEST['epm_line'])?$_REQUEST['epm_line']:null; - $temp = isset($_REQUEST['epm_temps'])?$_REQUEST['epm_temps']:null; - if(isset($_REQUEST['name'])) { - $name = isset($_REQUEST['name'])?$_REQUEST['name']:null; + $brand = isset($_REQUEST['epm_brand']) ? $_REQUEST['epm_brand'] : null; + $model = isset($_REQUEST['epm_model']) ? $_REQUEST['epm_model'] : null; + $line = isset($_REQUEST['epm_line']) ? $_REQUEST['epm_line'] : null; + $temp = isset($_REQUEST['epm_temps']) ? $_REQUEST['epm_temps'] : null; + if (isset($_REQUEST['name'])) { + $name = isset($_REQUEST['name']) ? $_REQUEST['name'] : null; + echo "hi"; } else { - $name = isset($_REQUEST['description'])?$_REQUEST['description']:null; + echo "hi"; + $name = isset($_REQUEST['description']) ? $_REQUEST['description'] : null; + echo $name; } - if(isset($_REQUEST['deviceid'])) { - if($_REQUEST['devicetype'] == "fixed") { + if (isset($_REQUEST['deviceid'])) { + if ($_REQUEST['devicetype'] == "fixed") { //SQL to get the Description of the extension from the extension table - $sql = "SELECT name FROM users WHERE extension = '".$_REQUEST['deviceuser']."'"; - $name = $endpoint->eda->sql($sql,'getOne'); - + $sql = "SELECT name FROM users WHERE extension = '" . $_REQUEST['deviceuser'] . "'"; + $name_o = $endpoint->eda->sql($sql, 'getOne'); + if($name_o) { + $name = $name_o; + } } } - $reboot = isset($_REQUEST['epm_reboot'])?$_REQUEST['epm_reboot']:null; + $reboot = isset($_REQUEST['epm_reboot']) ? $_REQUEST['epm_reboot'] : null; - if($endpoint->mac_check_clean($mac)) { - $sql = "SELECT id FROM endpointman_mac_list WHERE mac = '".$endpoint->mac_check_clean($mac)."'"; - $macid = $endpoint->eda->sql($sql,'getOne'); - if($macid) { + if ($endpoint->mac_check_clean($mac)) { + $sql = "SELECT id FROM endpointman_mac_list WHERE mac = '" . $endpoint->mac_check_clean($mac) . "'"; + $macid = $endpoint->eda->sql($sql, 'getOne'); + if ($macid) { //In Database already - - $sql = 'SELECT * FROM endpointman_line_list WHERE ext = '.$extdisplay.' AND mac_id = '. $macid; - $lines_list =& $endpoint->eda->sql($sql,'getRow',DB_FETCHMODE_ASSOC); - - if(($lines_list) AND (isset($model)) AND (isset($line)) AND (!isset($delete)) AND (isset($temp))) { + + $sql = 'SELECT * FROM endpointman_line_list WHERE ext = ' . $extdisplay . ' AND mac_id = ' . $macid; + $lines_list = & $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + if (($lines_list) AND (isset($model)) AND (isset($line)) AND (!isset($delete)) AND (isset($temp))) { //Modifying line already in the database - $endpoint->update_device($macid, $model, $temp, $lines_list['luid'],$name,$lines_list['line']); + $endpoint->update_device($macid, $model, $temp, $lines_list['luid'], $name, $lines_list['line']); $row = $endpoint->get_phone_info($macid); - if(isset($reboot)) { + if (isset($reboot)) { $endpoint->prepare_configs($row); } else { - $endpoint->prepare_configs($row,FALSE); + $endpoint->prepare_configs($row, FALSE); } - } elseif((isset($model)) AND (!isset($delete)) AND (isset($line)) AND (isset($temp))) { + } elseif ((isset($model)) AND (!isset($delete)) AND (isset($line)) AND (isset($temp))) { //Add line to the database - if(empty($line)) { + if (empty($line)) { $endpoint->add_line($macid, NULL, $extdisplay, $name); } else { - $endpoint->add_line($macid, $line, $extdisplay, $name); + $endpoint->add_line($macid, $line, $extdisplay, $name); } - + $endpoint->update_device($macid, $model, $temp, NULL, NULL, NULL, FALSE); $row = $endpoint->get_phone_info($macid); - if(isset($reboot)) { + if (isset($reboot)) { $endpoint->prepare_configs($row); } else { - $endpoint->prepare_configs($row,FALSE); + $endpoint->prepare_configs($row, FALSE); } } - } elseif(!isset($delete)) { + } elseif (!isset($delete)) { //Add Extension/Phone to database $mac_id = $endpoint->add_device($mac, $model, $extdisplay, $temp, NULL, $name); - if($mac_id) { + if ($mac_id) { $row = $endpoint->get_phone_info($mac_id); $endpoint->prepare_configs($row); } @@ -157,6 +187,7 @@ function endpointman_configpageinit($pagename) { } } } + function endpointman_applyhooks() { global $currentcomponent; @@ -164,19 +195,23 @@ function endpointman_applyhooks() { // displaying stuff on the page. $currentcomponent->addguifunc('endpointman_configpageload'); } + // This is called before the page is actually displayed, so we can use addguielem(). function endpointman_configpageload() { global $currentcomponent, $endpoint, $db; - $display = isset($_REQUEST['display'])?$_REQUEST['display']:null; + $display = isset($_REQUEST['display']) ? $_REQUEST['display'] : null; + $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; + $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null; + if (isset($extdisplay) && !empty($extdisplay)) { + $sql = "SELECT tech FROM devices WHERE id = " . $extdisplay; + $tech = $endpoint->eda->sql($sql, 'getOne'); + } else { + $tech = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : null; + } - // Init vars from $_REQUEST[] - $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; - $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; - $tech = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : null; - $tech = isset($tech) ? $tech : $_REQUEST['tech']; - if((isset($tech)) && (($tech == 'sip_generic') OR ($tech == 'sip'))) { - // Don't display this stuff it it's on a 'This xtn has been deleted' page. + if (isset($tech) && (($tech == 'sip') OR ($tech == 'sip_generic'))) { + // Don't display this stuff it it's on a 'This xtn has been deleted' page. if ($action != 'del') { $js = " @@ -199,9 +234,9 @@ function endpointman_configpageload() { $section = _('End Point Manager'); - $sql = "SELECT mac_id,luid,line FROM endpointman_line_list WHERE ext = '".$extdisplay."' "; + $sql = "SELECT mac_id,luid,line FROM endpointman_line_list WHERE ext = '" . $extdisplay . "' "; $line_info = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - if($line_info) { + if ($line_info) { $js = " $.ajaxSetup({ cache: false }); @@ -228,8 +263,8 @@ function endpointman_configpageload() { $info = $endpoint->get_phone_info($line_info['mac_id']); $brand_list = $endpoint->brands_available($info['brand_id'], true); - if(!empty($info['brand_id'])) { - $model_list = $endpoint->models_available(NULL,$info['brand_id']); + if (!empty($info['brand_id'])) { + $model_list = $endpoint->models_available(NULL, $info['brand_id']); $line_list = $endpoint->linesAvailable($line_info['luid']); $template_list = $endpoint->display_templates($info['product_id']); } else { @@ -240,14 +275,13 @@ function endpointman_configpageload() { $checked = false; - $currentcomponent->addguielem($section, new gui_checkbox('epm_delete', $checked, 'Delete','Delete this Extension from Endpoint Manager'),9); - $currentcomponent->addguielem($section, new gui_textbox('epm_mac', $info['mac'], 'MAC Address', 'The MAC Address of the Phone Assigned to this Extension/Device.
      (Leave Blank to Remove from Endpoint Manager)', '', 'Please enter a valid MAC Address', true, 17, false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_brand', $brand_list, $info['brand_id'], 'Brand', 'The Brand of this Phone.', false, 'frm_'.$display.'_brand_change(this.options[this.selectedIndex].value)', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_model', $model_list, $info['model_id'], 'Model', 'The Model of this Phone.', false, 'frm_'.$display.'_model_change(this.options[this.selectedIndex].value,\''.$line_info['luid'].'\')', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_line', $line_list, $line_info['line'], 'Line', 'The Line of this Extension/Device.', false, '', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_temps', $template_list, $info['template_id'], 'Template', 'The Template of this Phone.', false, '', false),9); - $currentcomponent->addguielem($section, new gui_checkbox('epm_reboot', $checked, 'Reboot','Reboot this Phone on Submit'),9); - + $currentcomponent->addguielem($section, new gui_checkbox('epm_delete', $checked, 'Delete', 'Delete this Extension from Endpoint Manager'), 9); + $currentcomponent->addguielem($section, new gui_textbox('epm_mac', $info['mac'], 'MAC Address', 'The MAC Address of the Phone Assigned to this Extension/Device.
      (Leave Blank to Remove from Endpoint Manager)', '', 'Please enter a valid MAC Address', true, 17, false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_brand', $brand_list, $info['brand_id'], 'Brand', 'The Brand of this Phone.', false, 'frm_' . $display . '_brand_change(this.options[this.selectedIndex].value)', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_model', $model_list, $info['model_id'], 'Model', 'The Model of this Phone.', false, 'frm_' . $display . '_model_change(this.options[this.selectedIndex].value,\'' . $line_info['luid'] . '\')', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_line', $line_list, $line_info['line'], 'Line', 'The Line of this Extension/Device.', false, '', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_temps', $template_list, $info['template_id'], 'Template', 'The Template of this Phone.', false, '', false), 9); + $currentcomponent->addguielem($section, new gui_checkbox('epm_reboot', $checked, 'Reboot', 'Reboot this Phone on Submit'), 9); } else { $js = " @@ -277,17 +311,17 @@ function endpointman_configpageload() { $line_list = array(); $template_list = array(); - $currentcomponent->addguielem($section, new gui_textbox('epm_mac', $info['mac'], 'MAC Address', 'The MAC Address of the Phone Assigned to this Extension/Device.
      (Leave Blank to Remove from Endpoint Manager)', '', 'Please enter a valid MAC Address', true, 17, false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_brand', $brand_list, $info['brand_id'], 'Brand', 'The Brand of this Phone.', false, 'frm_'.$display.'_brand_change(this.options[this.selectedIndex].value)', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_model', $model_list, $info['model_id'], 'Model', 'The Model of this Phone.', false, 'frm_'.$display.'_model_change(this.options[this.selectedIndex].value,document.getElementById(\'epm_mac\').value)', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_line', $line_list, $line_info['line'], 'Line', 'The Line of this Extension/Device.', false, '', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_temps', $template_list, $info['template_id'], 'Template', 'The Template of this Phone.', false, '', false),9); - $currentcomponent->addguielem($section, new guitext('epm_note','Note: This might reboot the phone if it\'s already registered to Asterisk')); - + $currentcomponent->addguielem($section, new gui_textbox('epm_mac', $info['mac'], 'MAC Address', 'The MAC Address of the Phone Assigned to this Extension/Device.
      (Leave Blank to Remove from Endpoint Manager)', '', 'Please enter a valid MAC Address', true, 17, false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_brand', $brand_list, $info['brand_id'], 'Brand', 'The Brand of this Phone.', false, 'frm_' . $display . '_brand_change(this.options[this.selectedIndex].value)', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_model', $model_list, $info['model_id'], 'Model', 'The Model of this Phone.', false, 'frm_' . $display . '_model_change(this.options[this.selectedIndex].value,document.getElementById(\'epm_mac\').value)', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_line', $line_list, $line_info['line'], 'Line', 'The Line of this Extension/Device.', false, '', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_temps', $template_list, $info['template_id'], 'Template', 'The Template of this Phone.', false, '', false), 9); + $currentcomponent->addguielem($section, new guitext('epm_note', 'Note: This might reboot the phone if it\'s already registered to Asterisk')); } } } } function endpointman_hookProcess_core($viewing_itemid, $request) { + } \ No newline at end of file diff --git a/includes/ajax.inc b/includes/ajax.inc index 2e7bbb33..cb184f75 100644 --- a/includes/ajax.inc +++ b/includes/ajax.inc @@ -10,7 +10,7 @@ require 'functions.inc'; $endpoint = new endpointmanager(); -include 'jsonwrapper.php'; +include 'json.inc'; function in_array_recursive($needle, $haystack) { $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($haystack)); diff --git a/includes/functions.inc b/includes/functions.inc index 61e9af42..b8d216bd 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1602,8 +1602,6 @@ class endpointmanager { $this->error['prepare_configs'] = 'Error Returned From Provisioner Library: '. $e->getMessage(); return(FALSE); } - - //print_r($provisioner_lib->debug_return); //End timer $time_end = microtime(true); diff --git a/includes/json.inc b/includes/json.inc index aace5c62..1cf6eb25 100644 --- a/includes/json.inc +++ b/includes/json.inc @@ -187,693 +187,694 @@ define('JSON_PRETTY_PRINT', 100); * $value = $json->decode($input); * */ -class Services_JSON -{ - /** - * constructs a new JSON instance - * - * @param int $use object behavior flags; combine with boolean-OR - * - * possible values: - * - SERVICES_JSON_LOOSE_TYPE: loose typing. - * "{...}" syntax creates associative arrays - * instead of objects in decode(). - * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. - * Values which can't be encoded (e.g. resources) - * appear as NULL instead of throwing errors. - * By default, a deeply-nested resource will - * bubble up with an error, so all return values - * from encode() should be checked with isError() - */ - function Services_JSON($use = 0) - { - $this->use = $use; - } - - /** - * convert a string from one UTF-16 char to one UTF-8 char - * - * Normally should be handled by mb_convert_encoding, but - * provides a slower PHP-only method for installations - * that lack the multibye string extension. - * - * @param string $utf16 UTF-16 character - * @return string UTF-8 character - * @access private - */ - function utf162utf8($utf16) - { - // oh please oh please oh please oh please oh please - if(function_exists('mb_convert_encoding')) { - return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); - } - - $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); - - switch(true) { - case ((0x7F & $bytes) == $bytes): - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x7F & $bytes); - - case (0x07FF & $bytes) == $bytes: - // return a 2-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0xC0 | (($bytes >> 6) & 0x1F)) - . chr(0x80 | ($bytes & 0x3F)); - - case (0xFFFF & $bytes) == $bytes: - // return a 3-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0xE0 | (($bytes >> 12) & 0x0F)) - . chr(0x80 | (($bytes >> 6) & 0x3F)) - . chr(0x80 | ($bytes & 0x3F)); - } - - // ignoring UTF-32 for now, sorry - return ''; - } - - /** - * convert a string from one UTF-8 char to one UTF-16 char - * - * Normally should be handled by mb_convert_encoding, but - * provides a slower PHP-only method for installations - * that lack the multibye string extension. - * - * @param string $utf8 UTF-8 character - * @return string UTF-16 character - * @access private - */ - function utf82utf16($utf8) - { - // oh please oh please oh please oh please oh please - if(function_exists('mb_convert_encoding')) { - return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); - } - - switch(strlen($utf8)) { - case 1: - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return $utf8; - - case 2: - // return a UTF-16 character from a 2-byte UTF-8 char - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x07 & (ord($utf8{0}) >> 2)) - . chr((0xC0 & (ord($utf8{0}) << 6)) - | (0x3F & ord($utf8{1}))); - - case 3: - // return a UTF-16 character from a 3-byte UTF-8 char - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr((0xF0 & (ord($utf8{0}) << 4)) - | (0x0F & (ord($utf8{1}) >> 2))) - . chr((0xC0 & (ord($utf8{1}) << 6)) - | (0x7F & ord($utf8{2}))); - } - - // ignoring UTF-32 for now, sorry - return ''; - } - - /** - * encodes an arbitrary variable into JSON format - * - * @param mixed $var any number, boolean, string, array, or object to be encoded. - * see argument 1 to Services_JSON() above for array-parsing behavior. - * if var is a strng, note that encode() always expects it - * to be in ASCII or UTF-8 format! - * - * @return mixed JSON string representation of input var or an error if a problem occurs - * @access public - */ - function encode($var) - { - switch (gettype($var)) { - case 'boolean': - return $var ? 'true' : 'false'; - - case 'NULL': - return 'null'; - - case 'integer': - return (int) $var; - - case 'double': - case 'float': - return (float) $var; - - case 'string': - // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT - $ascii = ''; - $strlen_var = strlen($var); - - /* - * Iterate over every character in the string, - * escaping with a slash or encoding to UTF-8 where necessary - */ - for ($c = 0; $c < $strlen_var; ++$c) { - - $ord_var_c = ord($var{$c}); - - switch (true) { - case $ord_var_c == 0x08: - $ascii .= '\b'; - break; - case $ord_var_c == 0x09: - $ascii .= '\t'; - break; - case $ord_var_c == 0x0A: - $ascii .= '\n'; - break; - case $ord_var_c == 0x0C: - $ascii .= '\f'; - break; - case $ord_var_c == 0x0D: - $ascii .= '\r'; - break; - - case $ord_var_c == 0x22: - case $ord_var_c == 0x2F: - case $ord_var_c == 0x5C: - // double quote, slash, slosh - $ascii .= '\\'.$var{$c}; - break; - - case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): - // characters U-00000000 - U-0000007F (same as ASCII) - $ascii .= $var{$c}; - break; - - case (($ord_var_c & 0xE0) == 0xC0): - // characters U-00000080 - U-000007FF, mask 110XXXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($var{$c + 1})); - $c += 1; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xF0) == 0xE0): - // characters U-00000800 - U-0000FFFF, mask 1110XXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2})); - $c += 2; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xF8) == 0xF0): - // characters U-00010000 - U-001FFFFF, mask 11110XXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3})); - $c += 3; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xFC) == 0xF8): - // characters U-00200000 - U-03FFFFFF, mask 111110XX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4})); - $c += 4; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xFE) == 0xFC): - // characters U-04000000 - U-7FFFFFFF, mask 1111110X - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4}), - ord($var{$c + 5})); - $c += 5; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - } - } - - return '"'.$ascii.'"'; - - case 'array': - /* - * As per JSON spec if any array key is not an integer - * we must treat the the whole array as an object. We - * also try to catch a sparsely populated associative - * array with numeric keys here because some JS engines - * will create an array with empty indexes up to - * max_index which can cause memory issues and because - * the keys, which may be relevant, will be remapped - * otherwise. - * - * As per the ECMA and JSON specification an object may - * have any string as a property. Unfortunately due to - * a hole in the ECMA specification if the key is a - * ECMA reserved word or starts with a digit the - * parameter is only accessible using ECMAScript's - * bracket notation. - */ - - // treat as a JSON object - if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { - $properties = array_map(array($this, 'name_value'), - array_keys($var), - array_values($var)); - - foreach($properties as $property) { - if(Services_JSON::isError($property)) { - return $property; - } - } - - return '{' . join(',', $properties) . '}'; - } - - // treat it like a regular array - $elements = array_map(array($this, 'encode'), $var); - - foreach($elements as $element) { - if(Services_JSON::isError($element)) { - return $element; - } - } - - return '[' . join(',', $elements) . ']'; - - case 'object': - $vars = get_object_vars($var); - - $properties = array_map(array($this, 'name_value'), - array_keys($vars), - array_values($vars)); - - foreach($properties as $property) { - if(Services_JSON::isError($property)) { - return $property; - } - } - - return '{' . join(',', $properties) . '}'; - - default: - return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) - ? 'null' - : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); - } - } - - /** - * array-walking function for use in generating JSON-formatted name-value pairs - * - * @param string $name name of key to use - * @param mixed $value reference to an array element to be encoded - * - * @return string JSON-formatted name-value pair, like '"name":value' - * @access private - */ - function name_value($name, $value) - { - $encoded_value = $this->encode($value); - - if(Services_JSON::isError($encoded_value)) { - return $encoded_value; - } - - return $this->encode(strval($name)) . ':' . $encoded_value; - } - - /** - * reduce a string by removing leading and trailing comments and whitespace - * - * @param $str string string value to strip of comments and whitespace - * - * @return string string value stripped of comments and whitespace - * @access private - */ - function reduce_string($str) - { - $str = preg_replace(array( - - // eliminate single line comments in '// ...' form - '#^\s*//(.+)$#m', - - // eliminate multi-line comments in '/* ... */' form, at start of string - '#^\s*/\*(.+)\*/#Us', - - // eliminate multi-line comments in '/* ... */' form, at end of string - '#/\*(.+)\*/\s*$#Us' - - ), '', $str); - - // eliminate extraneous space - return trim($str); - } - - /** - * decodes a JSON string into appropriate variable - * - * @param string $str JSON-formatted string - * - * @return mixed number, boolean, string, array, or object - * corresponding to given JSON input string. - * See argument 1 to Services_JSON() above for object-output behavior. - * Note that decode() always returns strings - * in ASCII or UTF-8 format! - * @access public - */ - function decode($str) - { - $str = $this->reduce_string($str); - - switch (strtolower($str)) { - case 'true': - return true; - - case 'false': - return false; - - case 'null': - return null; - - default: - $m = array(); - - if (is_numeric($str)) { - // Lookie-loo, it's a number - - // This would work on its own, but I'm trying to be - // good about returning integers where appropriate: - // return (float)$str; - - // Return float or int, as appropriate - return ((float)$str == (integer)$str) - ? (integer)$str - : (float)$str; - - } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { - // STRINGS RETURNED IN UTF-8 FORMAT - $delim = substr($str, 0, 1); - $chrs = substr($str, 1, -1); - $utf8 = ''; - $strlen_chrs = strlen($chrs); - - for ($c = 0; $c < $strlen_chrs; ++$c) { - - $substr_chrs_c_2 = substr($chrs, $c, 2); - $ord_chrs_c = ord($chrs{$c}); - - switch (true) { - case $substr_chrs_c_2 == '\b': - $utf8 .= chr(0x08); - ++$c; - break; - case $substr_chrs_c_2 == '\t': - $utf8 .= chr(0x09); - ++$c; - break; - case $substr_chrs_c_2 == '\n': - $utf8 .= chr(0x0A); - ++$c; - break; - case $substr_chrs_c_2 == '\f': - $utf8 .= chr(0x0C); - ++$c; - break; - case $substr_chrs_c_2 == '\r': - $utf8 .= chr(0x0D); - ++$c; - break; - - case $substr_chrs_c_2 == '\\"': - case $substr_chrs_c_2 == '\\\'': - case $substr_chrs_c_2 == '\\\\': - case $substr_chrs_c_2 == '\\/': - if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || - ($delim == "'" && $substr_chrs_c_2 != '\\"')) { - $utf8 .= $chrs{++$c}; - } - break; - - case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): - // single, escaped unicode character - $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) - . chr(hexdec(substr($chrs, ($c + 4), 2))); - $utf8 .= $this->utf162utf8($utf16); - $c += 5; - break; - - case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): - $utf8 .= $chrs{$c}; - break; - - case ($ord_chrs_c & 0xE0) == 0xC0: - // characters U-00000080 - U-000007FF, mask 110XXXXX - //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 2); - ++$c; - break; - - case ($ord_chrs_c & 0xF0) == 0xE0: - // characters U-00000800 - U-0000FFFF, mask 1110XXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 3); - $c += 2; - break; - - case ($ord_chrs_c & 0xF8) == 0xF0: - // characters U-00010000 - U-001FFFFF, mask 11110XXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 4); - $c += 3; - break; - - case ($ord_chrs_c & 0xFC) == 0xF8: - // characters U-00200000 - U-03FFFFFF, mask 111110XX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 5); - $c += 4; - break; - - case ($ord_chrs_c & 0xFE) == 0xFC: - // characters U-04000000 - U-7FFFFFFF, mask 1111110X - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 6); - $c += 5; - break; - - } - - } - - return $utf8; - - } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { - // array, or object notation - - if ($str{0} == '[') { - $stk = array(SERVICES_JSON_IN_ARR); - $arr = array(); - } else { - if ($this->use & SERVICES_JSON_LOOSE_TYPE) { - $stk = array(SERVICES_JSON_IN_OBJ); - $obj = array(); - } else { - $stk = array(SERVICES_JSON_IN_OBJ); - $obj = new stdClass(); - } - } - - array_push($stk, array('what' => SERVICES_JSON_SLICE, - 'where' => 0, - 'delim' => false)); - - $chrs = substr($str, 1, -1); - $chrs = $this->reduce_string($chrs); - - if ($chrs == '') { - if (reset($stk) == SERVICES_JSON_IN_ARR) { - return $arr; - - } else { - return $obj; - - } - } - - //print("\nparsing {$chrs}\n"); - - $strlen_chrs = strlen($chrs); - - for ($c = 0; $c <= $strlen_chrs; ++$c) { - - $top = end($stk); - $substr_chrs_c_2 = substr($chrs, $c, 2); - - if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { - // found a comma that is not inside a string, array, etc., - // OR we've reached the end of the character list - $slice = substr($chrs, $top['where'], ($c - $top['where'])); - array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); - //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - if (reset($stk) == SERVICES_JSON_IN_ARR) { - // we are in an array, so just push an element onto the stack - array_push($arr, $this->decode($slice)); - - } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { - // we are in an object, so figure - // out the property name and set an - // element in an associative array, - // for now - $parts = array(); +if(!class_exists('Services_JSON')) { + class Services_JSON + { + /** + * constructs a new JSON instance + * + * @param int $use object behavior flags; combine with boolean-OR + * + * possible values: + * - SERVICES_JSON_LOOSE_TYPE: loose typing. + * "{...}" syntax creates associative arrays + * instead of objects in decode(). + * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. + * Values which can't be encoded (e.g. resources) + * appear as NULL instead of throwing errors. + * By default, a deeply-nested resource will + * bubble up with an error, so all return values + * from encode() should be checked with isError() + */ + function Services_JSON($use = 0) + { + $this->use = $use; + } + + /** + * convert a string from one UTF-16 char to one UTF-8 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf16 UTF-16 character + * @return string UTF-8 character + * @access private + */ + function utf162utf8($utf16) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); + } + + $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + + switch(true) { + case ((0x7F & $bytes) == $bytes): + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x7F & $bytes); + + case (0x07FF & $bytes) == $bytes: + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xC0 | (($bytes >> 6) & 0x1F)) + . chr(0x80 | ($bytes & 0x3F)); + + case (0xFFFF & $bytes) == $bytes: + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xE0 | (($bytes >> 12) & 0x0F)) + . chr(0x80 | (($bytes >> 6) & 0x3F)) + . chr(0x80 | ($bytes & 0x3F)); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encode($var) + { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + $properties = array_map(array($this, 'name_value'), + array_keys($var), + array_values($var)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + // treat it like a regular array + $elements = array_map(array($this, 'encode'), $var); + + foreach($elements as $element) { + if(Services_JSON::isError($element)) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = get_object_vars($var); + + $properties = array_map(array($this, 'name_value'), + array_keys($vars), + array_values($vars)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) + ? 'null' + : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function name_value($name, $value) + { + $encoded_value = $this->encode($value); + + if(Services_JSON::isError($encoded_value)) { + return $encoded_value; + } + + return $this->encode(strval($name)) . ':' . $encoded_value; + } + + /** + * reduce a string by removing leading and trailing comments and whitespace + * + * @param $str string string value to strip of comments and whitespace + * + * @return string string value stripped of comments and whitespace + * @access private + */ + function reduce_string($str) + { + $str = preg_replace(array( + + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + + ), '', $str); + + // eliminate extraneous space + return trim($str); + } + + /** + * decodes a JSON string into appropriate variable + * + * @param string $str JSON-formatted string + * + * @return mixed number, boolean, string, array, or object + * corresponding to given JSON input string. + * See argument 1 to Services_JSON() above for object-output behavior. + * Note that decode() always returns strings + * in ASCII or UTF-8 format! + * @access public + */ + function decode($str) + { + $str = $this->reduce_string($str); + + switch (strtolower($str)) { + case 'true': + return true; + + case 'false': + return false; + + case 'null': + return null; + + default: + $m = array(); + + if (is_numeric($str)) { + // Lookie-loo, it's a number + + // This would work on its own, but I'm trying to be + // good about returning integers where appropriate: + // return (float)$str; + + // Return float or int, as appropriate + return ((float)$str == (integer)$str) + ? (integer)$str + : (float)$str; + + } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { + // STRINGS RETURNED IN UTF-8 FORMAT + $delim = substr($str, 0, 1); + $chrs = substr($str, 1, -1); + $utf8 = ''; + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c < $strlen_chrs; ++$c) { + + $substr_chrs_c_2 = substr($chrs, $c, 2); + $ord_chrs_c = ord($chrs{$c}); + + switch (true) { + case $substr_chrs_c_2 == '\b': + $utf8 .= chr(0x08); + ++$c; + break; + case $substr_chrs_c_2 == '\t': + $utf8 .= chr(0x09); + ++$c; + break; + case $substr_chrs_c_2 == '\n': + $utf8 .= chr(0x0A); + ++$c; + break; + case $substr_chrs_c_2 == '\f': + $utf8 .= chr(0x0C); + ++$c; + break; + case $substr_chrs_c_2 == '\r': + $utf8 .= chr(0x0D); + ++$c; + break; + + case $substr_chrs_c_2 == '\\"': + case $substr_chrs_c_2 == '\\\'': + case $substr_chrs_c_2 == '\\\\': + case $substr_chrs_c_2 == '\\/': + if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || + ($delim == "'" && $substr_chrs_c_2 != '\\"')) { + $utf8 .= $chrs{++$c}; + } + break; + + case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): + // single, escaped unicode character + $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) + . chr(hexdec(substr($chrs, ($c + 4), 2))); + $utf8 .= $this->utf162utf8($utf16); + $c += 5; + break; + + case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): + $utf8 .= $chrs{$c}; + break; + + case ($ord_chrs_c & 0xE0) == 0xC0: + // characters U-00000080 - U-000007FF, mask 110XXXXX + //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 2); + ++$c; + break; + + case ($ord_chrs_c & 0xF0) == 0xE0: + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 3); + $c += 2; + break; + + case ($ord_chrs_c & 0xF8) == 0xF0: + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 4); + $c += 3; + break; + + case ($ord_chrs_c & 0xFC) == 0xF8: + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 5); + $c += 4; + break; + + case ($ord_chrs_c & 0xFE) == 0xFC: + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 6); + $c += 5; + break; + + } + + } + + return $utf8; + + } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { + // array, or object notation + + if ($str{0} == '[') { + $stk = array(SERVICES_JSON_IN_ARR); + $arr = array(); + } else { + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = array(); + } else { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = new stdClass(); + } + } + + array_push($stk, array('what' => SERVICES_JSON_SLICE, + 'where' => 0, + 'delim' => false)); + + $chrs = substr($str, 1, -1); + $chrs = $this->reduce_string($chrs); + + if ($chrs == '') { + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } else { + return $obj; + + } + } + + //print("\nparsing {$chrs}\n"); + + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c <= $strlen_chrs; ++$c) { + + $top = end($stk); + $substr_chrs_c_2 = substr($chrs, $c, 2); + + if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + // found a comma that is not inside a string, array, etc., + // OR we've reached the end of the character list + $slice = substr($chrs, $top['where'], ($c - $top['where'])); + array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + // we are in an array, so just push an element onto the stack + array_push($arr, $this->decode($slice)); + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + // we are in an object, so figure + // out the property name and set an + // element in an associative array, + // for now + $parts = array(); - if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { - // "name":value pair - $key = $this->decode($parts[1]); - $val = $this->decode($parts[2]); - - if ($this->use & SERVICES_JSON_LOOSE_TYPE) { - $obj[$key] = $val; - } else { - $obj->$key = $val; - } - } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { - // name:value pair, where name is unquoted - $key = $parts[1]; - $val = $this->decode($parts[2]); - - if ($this->use & SERVICES_JSON_LOOSE_TYPE) { - $obj[$key] = $val; - } else { - $obj->$key = $val; - } - } - - } - - } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { - // found a quote, and we are not inside a string - array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); - //print("Found start of string at {$c}\n"); - - } elseif (($chrs{$c} == $top['delim']) && - ($top['what'] == SERVICES_JSON_IN_STR) && - ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { - // found a quote, we're in a string, and it's not escaped - // we know that it's not escaped becase there is _not_ an - // odd number of backslashes at the end of the string so far - array_pop($stk); - //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); - - } elseif (($chrs{$c} == '[') && - in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { - // found a left-bracket, and we are in an array, object, or slice - array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); - //print("Found start of array at {$c}\n"); - - } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { - // found a right-bracket, and we're in an array - array_pop($stk); - //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - } elseif (($chrs{$c} == '{') && - in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { - // found a left-brace, and we are in an array, object, or slice - array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); - //print("Found start of object at {$c}\n"); - - } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { - // found a right-brace, and we're in an object - array_pop($stk); - //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - } elseif (($substr_chrs_c_2 == '/*') && - in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { - // found a comment start, and we are in an array, object, or slice - array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); - $c++; - //print("Found start of comment at {$c}\n"); - - } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { - // found a comment end, and we're in one now - array_pop($stk); - $c++; - - for ($i = $top['where']; $i <= $c; ++$i) - $chrs = substr_replace($chrs, ' ', $i, 1); - - //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - } - - } - - if (reset($stk) == SERVICES_JSON_IN_ARR) { - return $arr; - - } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { - return $obj; - - } - - } - } - } - - /** - * @todo Ultimately, this should just call PEAR::isError() - */ - function isError($data, $code = null) - { - if (class_exists('pear')) { - return PEAR::isError($data, $code); - } elseif (is_object($data) && (get_class($data) == 'services_json_error' || - is_subclass_of($data, 'services_json_error'))) { - return true; - } - - return false; - } -} + if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // "name":value pair + $key = $this->decode($parts[1]); + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // name:value pair, where name is unquoted + $key = $parts[1]; + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } + + } + + } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + // found a quote, and we are not inside a string + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + //print("Found start of string at {$c}\n"); + + } elseif (($chrs{$c} == $top['delim']) && + ($top['what'] == SERVICES_JSON_IN_STR) && + ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { + // found a quote, we're in a string, and it's not escaped + // we know that it's not escaped becase there is _not_ an + // odd number of backslashes at the end of the string so far + array_pop($stk); + //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '[') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-bracket, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); + //print("Found start of array at {$c}\n"); + + } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + // found a right-bracket, and we're in an array + array_pop($stk); + //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '{') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-brace, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + //print("Found start of object at {$c}\n"); + + } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + // found a right-brace, and we're in an object + array_pop($stk); + //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($substr_chrs_c_2 == '/*') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a comment start, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $c++; + //print("Found start of comment at {$c}\n"); + + } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { + // found a comment end, and we're in one now + array_pop($stk); + $c++; + + for ($i = $top['where']; $i <= $c; ++$i) + $chrs = substr_replace($chrs, ' ', $i, 1); + + //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } + + } + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + return $obj; + + } + + } + } + } + + /** + * @todo Ultimately, this should just call PEAR::isError() + */ + function isError($data, $code = null) + { + if (class_exists('pear')) { + return PEAR::isError($data, $code); + } elseif (is_object($data) && (get_class($data) == 'services_json_error' || + is_subclass_of($data, 'services_json_error'))) { + return true; + } -if (class_exists('PEAR_Error')) { + return false; + } + } - class Services_JSON_Error extends PEAR_Error - { - function Services_JSON_Error($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { - parent::PEAR_Error($message, $code, $mode, $options, $userinfo); - } - } + if (class_exists('PEAR_Error')) { -} else { + class Services_JSON_Error extends PEAR_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + parent::PEAR_Error($message, $code, $mode, $options, $userinfo); + } + } - /** - * @todo Ultimately, this class shall be descended from PEAR_Error - */ - class Services_JSON_Error - { - function Services_JSON_Error($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { + } else { - } - } + /** + * @todo Ultimately, this class shall be descended from PEAR_Error + */ + class Services_JSON_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + } + } + } } \ No newline at end of file diff --git a/module.xml b/module.xml index d3587770..ec6a6f5b 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.3.2 + 2.10.3.3 setup Connectivity Andrew Nagy diff --git a/provisioning/.htaccess b/provisioning/.htaccess index 515d7214..fcbb24fa 100644 --- a/provisioning/.htaccess +++ b/provisioning/.htaccess @@ -1,8 +1,10 @@ RewriteEngine on -RewriteRule ([^/]+\.cfg) p.php?request=$1 [L] -RewriteRule ([^/]+\.tuz) p.php?request=$1 [L] -RewriteRule ([^/]+\.xml) p.php?request=$1 [L] -RewriteRule ([0-9a-f]{12}.*) p.php?request=$1 [L] +#RewriteRule ([^/]+\.cfg) p.php?request=$1 [L] +#RewriteRule ([^/]+\.tuz) p.php?request=$1 [L] +#RewriteRule ([^/]+\.xml) p.php?request=$1 [L] +#RewriteRule ([0-9a-f]{12}.*) p.php?request=$1 [L] + +RewriteRule ^.*$ p.php [QSA,L] RewriteCond %{THE_REQUEST} ^PUT* RewriteRule /prov/[^/]+/([^/]+)\.log p.php?putfile=$1 \ No newline at end of file diff --git a/provisioning/p.php b/provisioning/p.php index 8cbb1cca..d223dbb1 100755 --- a/provisioning/p.php +++ b/provisioning/p.php @@ -28,6 +28,7 @@ # Workaround for SPAs that don't actually request their type of device # Assume they're 504G's. Faulty in firmware 7.4.3a $filename = basename($_SERVER["REQUEST_URI"]); + $web_path = 'http://'.$_SERVER["SERVER_NAME"].dirname($_SERVER["PHP_SELF"]).'/'; /* if ($filename == "p.php") { @@ -59,7 +60,7 @@ $files = $endpoint->prepare_configs($phone_info,FALSE,FALSE); - if(!files) { + if(!$files) { header("HTTP/1.0 500 Internal Server Error"); die(); } From f0acadc3682aae27bae87f116cbd4285ddfc8a08 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Mon, 27 Feb 2012 00:34:29 -0800 Subject: [PATCH 267/623] Update SQL Error --- includes/template_manager.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/template_manager.inc b/includes/template_manager.inc index 682b8397..3591fd3e 100644 --- a/includes/template_manager.inc +++ b/includes/template_manager.inc @@ -39,7 +39,7 @@ if(isset($_REQUEST['edit_template'])) { } elseif(isset($_REQUEST['delete_template'])) { $sql = "DELETE FROM endpointman_template_list WHERE id = ". $_REQUEST['id']; $endpoint->eda->sql($sql); - $sql = "UPDATE endpointman_mac_list SET custom_cfg_template = 0 WHERE custom_cfg_template = ".$_REQUEST['id']; + $sql = "UPDATE endpointman_mac_list SET template_id = 0 WHERE template_id = ".$_REQUEST['id']; $endpoint->eda->sql($sql); $default_display = TRUE; $endpoint->message['general'] = _('Deleted'); From 088dec960fe648a48f3e781ce0274b12b583500b Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Mon, 27 Feb 2012 00:35:36 -0800 Subject: [PATCH 268/623] Update module.xml --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index ec6a6f5b..630f4263 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.3.3 + 2.10.3.4 setup Connectivity Andrew Nagy From dfa0ffd83c1021a52c2843c0838c80e9d0d95155 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Mon, 27 Feb 2012 13:27:32 -0800 Subject: [PATCH 269/623] Several Small Changes --- functions.inc.php | 6 ++---- install.php | 8 +------- module.xml | 2 +- templates/freepbx/variables.html | 10 +++++----- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/functions.inc.php b/functions.inc.php index 73686b24..8271629a 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -12,12 +12,9 @@ function endpointman_get_config($engine) { global $ext; global $core_conf; - $sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; - $amp_version = $db->getOne($sql); - switch ($engine) { case "asterisk": - if (isset($core_conf) && is_a($core_conf, "core_conf") && ($amp_version >= "2.8.0")) { + if (isset($core_conf) && is_a($core_conf, "core_conf") && (method_exists($core_conf, 'addSipNotify'))) { $core_conf->addSipNotify('polycom-check-cfg', array('Event' => 'check-sync', 'Content-Length' => '0')); $core_conf->addSipNotify('polycom-reboot', array('Event' => 'check-sync', 'Content-Length' => '0')); $core_conf->addSipNotify('sipura-check-cfg', array('Event' => 'resync', 'Content-Length' => '0')); @@ -28,6 +25,7 @@ function endpointman_get_config($engine) { $core_conf->addSipNotify('linksys-cold-restart', array('Event' => 'reboot_now', 'Content-Length' => '0')); $core_conf->addSipNotify('linksys-warm-restart', array('Event' => 'restart_now', 'Content-Length' => '0')); $core_conf->addSipNotify('spa-reboot', array('Event' => 'reboot', 'Content-Length' => '0')); + $core_conf->addSipNotify('reboot-yealink', array('Event' => 'check-sync\;reboot=true', 'Content-Length' => '0')); } break; } diff --git a/install.php b/install.php index f11ab90f..eb01fa55 100644 --- a/install.php +++ b/install.php @@ -931,12 +931,6 @@ function ep_table_exists ($table) { } } - if($ver <= "21024") { - out('Updating Mirror Location...again'); - $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/v3/' WHERE var_name ='update_server'"; - $db->query($sql); - } - if($ver <= "21031") { out("Adding tftp server check and nmap search save values"); $sql = 'INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'tftp_check\', \'0\');'; @@ -1111,7 +1105,7 @@ function ep_table_exists ($table) { $sql = "UPDATE endpointman_global_vars SET value = '".$xml_full_version."' WHERE var_name = 'version'"; $db->query($sql); -$sql = "UPDATE endpointman_global_vars SET value = 'http://www.provisioner.net/release/v3/' WHERE var_name = 'update_server'"; +$sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/v3/' WHERE var_name = 'update_server'"; $db->query($sql); if(file_exists($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module")) { diff --git a/module.xml b/module.xml index 630f4263..aafde6b3 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.3.4 + 2.10.3.6 setup Connectivity Andrew Nagy diff --git a/templates/freepbx/variables.html b/templates/freepbx/variables.html index cf5594ab..f9ba7213 100644 --- a/templates/freepbx/variables.html +++ b/templates/freepbx/variables.html @@ -1,7 +1,7 @@ :
      {noparse} - -"{$server.ip.1}" =
      - -"{$server.port.1}" =
      + -"{$username.line.1}" =
      + -"{$displayname.line.1}" =
      + -"{$server_host.line.1}" =
      + -"{$server_port.line.1}" =
      -"{$mac}" =
      - -"{$model}" =
      - -"{$ext.line.1}" =
      - -"{$displayname.line.1}" =
      {/noparse} \ No newline at end of file + -"{$model}" =
      {/noparse} \ No newline at end of file From 6f0a82d3f62f5ca75c1d2bb898a38cd4971972f1 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 28 Feb 2012 09:11:50 +0000 Subject: [PATCH 270/623] Bring endpoint manager up to 2.10.3.6 --- functions.inc.php | 230 +-- includes/abstraction/freepbx.inc | 5 +- includes/advanced.inc | 26 +- includes/ajax.inc | 2 +- includes/devices_manager.inc | 8 +- includes/functions.inc | 63 +- includes/json.inc | 1365 +++++++++-------- includes/template_manager.inc | 2 +- install.php | 12 +- module.xml | 2 +- provisioning/.htaccess | 10 +- provisioning/p.php | 3 +- .../advanced_settings_manual_upload.html | 33 + .../freepbx/advanced_settings_settings.html | 6 + templates/freepbx/devices_manager.html | 2 +- templates/freepbx/template_editor.html | 13 +- 16 files changed, 948 insertions(+), 834 deletions(-) diff --git a/functions.inc.php b/functions.inc.php index fb49c7f9..73686b24 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -1,4 +1,5 @@ getOne($sql); - switch($engine) { + switch ($engine) { case "asterisk": if (isset($core_conf) && is_a($core_conf, "core_conf") && ($amp_version >= "2.8.0")) { - $core_conf->addSipNotify('polycom-check-cfg',array('Event' => 'check-sync','Content-Length' => '0')); - $core_conf->addSipNotify('polycom-reboot',array('Event' => 'check-sync','Content-Length' => '0')); - $core_conf->addSipNotify('sipura-check-cfg',array('Event' => 'resync','Content-Length' => '0')); - $core_conf->addSipNotify('grandstream-check-cfg',array('Event' => 'sys-control')); - $core_conf->addSipNotify('cisco-check-cfg',array('Event' => 'check-sync','Content-Length' => '0')); - $core_conf->addSipNotify('reboot-snom',array('Event' => 'reboot','Content-Length' => '0')); - $core_conf->addSipNotify('aastra-check-cfg',array('Event' => 'check-sync','Content-Length' => '0')); - $core_conf->addSipNotify('linksys-cold-restart',array('Event' => 'reboot_now','Content-Length' => '0')); - $core_conf->addSipNotify('linksys-warm-restart',array('Event' => 'restart_now','Content-Length' => '0')); - $core_conf->addSipNotify('spa-reboot',array('Event' => 'reboot','Content-Length' => '0')); + $core_conf->addSipNotify('polycom-check-cfg', array('Event' => 'check-sync', 'Content-Length' => '0')); + $core_conf->addSipNotify('polycom-reboot', array('Event' => 'check-sync', 'Content-Length' => '0')); + $core_conf->addSipNotify('sipura-check-cfg', array('Event' => 'resync', 'Content-Length' => '0')); + $core_conf->addSipNotify('grandstream-check-cfg', array('Event' => 'sys-control')); + $core_conf->addSipNotify('cisco-check-cfg', array('Event' => 'check-sync', 'Content-Length' => '0')); + $core_conf->addSipNotify('reboot-snom', array('Event' => 'reboot', 'Content-Length' => '0')); + $core_conf->addSipNotify('aastra-check-cfg', array('Event' => 'check-sync', 'Content-Length' => '0')); + $core_conf->addSipNotify('linksys-cold-restart', array('Event' => 'reboot_now', 'Content-Length' => '0')); + $core_conf->addSipNotify('linksys-warm-restart', array('Event' => 'restart_now', 'Content-Length' => '0')); + $core_conf->addSipNotify('spa-reboot', array('Event' => 'reboot', 'Content-Length' => '0')); } break; } } + function endpointman_configpageinit($pagename) { global $currentcomponent, $amp_conf, $db; - - $display = isset($_REQUEST['display'])?$_REQUEST['display']:null; - - if($display == "extensions") { - if(isset($_REQUEST['extension'])) { - $extdisplay = isset($_REQUEST['extension'])?$_REQUEST['extension']:null; + + $display = isset($_REQUEST['display']) ? $_REQUEST['display'] : null; + $type = ''; + $tech = ''; + $extdisplay = ''; + + if ($display == "extensions") { + if (isset($_REQUEST['extension'])) { + $extdisplay = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : null; } else { - $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; + $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null; } - } elseif($display == "devices") { - $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; + } elseif ($display == "devices") { + if (isset($_REQUEST['deviceid'])) { + $extdisplay = isset($_REQUEST['deviceid']) ? $_REQUEST['deviceid'] : null; + } else { + $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null; + } + } + + if (isset($extdisplay) && !empty($extdisplay)) { + $sql = "SELECT tech FROM devices WHERE id = " . $extdisplay; + $tech = $db->getOne($sql); + if(!$tech) { + $tech = "sip"; + $type = 'new'; + } elseif($tech == 'sip') { + $type = 'edit'; + $tech = 'sip'; + } + } elseif(isset($_REQUEST['tech_hardware']) OR isset($_REQUEST['tech'])) { + $tech = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : $_REQUEST['tech']; + if(($tech == 'sip_generic') OR ($tech == 'sip')) { + $tech = "sip"; + $type = 'new'; + } } - $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; - $delete = isset($_REQUEST['epm_delete'])?$_REQUEST['epm_delete']:null; - $tech = isset($_REQUEST['tech_hardware'])?$_REQUEST['tech_hardware']:null; - - if((($display == "extensions") OR ($display == "devices")) && (isset($extdisplay) OR ($tech == "sip_generic"))) { + if (($tech == 'sip') AND (!empty($type))) { global $endpoint; - $doc_root = $amp_conf['AMPWEBROOT'] ."/admin/modules/endpointman/"; - if(file_exists($doc_root . "includes/functions.inc")) { + $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; + $delete = isset($_REQUEST['epm_delete']) ? $_REQUEST['epm_delete'] : null; + + $doc_root = $amp_conf['AMPWEBROOT'] . "/admin/modules/endpointman/"; + if (file_exists($doc_root . "includes/functions.inc")) { require($doc_root . "includes/functions.inc"); $endpoint = new endpointmanager(); ini_set('display_errors', 0); if ($action == "del") { - $sql = "SELECT mac_id,luid FROM endpointman_line_list WHERE ext = ". $extdisplay; - $macid = $endpoint->eda->sql($sql,'getRow',DB_FETCHMODE_ASSOC); - if($macid) { + $sql = "SELECT mac_id,luid FROM endpointman_line_list WHERE ext = " . $extdisplay; + $macid = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + if ($macid) { $endpoint->delete_line($macid['luid'], TRUE); } } - if(($action == "edit") OR ($action == "add")) { - if(isset($delete)) { - $sql = "SELECT mac_id,luid FROM endpointman_line_list WHERE ext = ". $extdisplay; - $macid = $endpoint->eda->sql($sql,'getRow',DB_FETCHMODE_ASSOC); - if($macid) { + if (($action == "edit") OR ($action == "add")) { + if (isset($delete)) { + $sql = "SELECT mac_id,luid FROM endpointman_line_list WHERE ext = " . $extdisplay; + $macid = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + if ($macid) { $endpoint->delete_line($macid['luid'], TRUE); } } - $mac = isset($_REQUEST['epm_mac'])?$_REQUEST['epm_mac']:null; + $mac = isset($_REQUEST['epm_mac']) ? $_REQUEST['epm_mac'] : null; - if(!empty($mac)) { + if (!empty($mac)) { //Mac is set - $brand = isset($_REQUEST['epm_brand'])?$_REQUEST['epm_brand']:null; - $model = isset($_REQUEST['epm_model'])?$_REQUEST['epm_model']:null; - $line = isset($_REQUEST['epm_line'])?$_REQUEST['epm_line']:null; - $temp = isset($_REQUEST['epm_temps'])?$_REQUEST['epm_temps']:null; - if(isset($_REQUEST['name'])) { - $name = isset($_REQUEST['name'])?$_REQUEST['name']:null; + $brand = isset($_REQUEST['epm_brand']) ? $_REQUEST['epm_brand'] : null; + $model = isset($_REQUEST['epm_model']) ? $_REQUEST['epm_model'] : null; + $line = isset($_REQUEST['epm_line']) ? $_REQUEST['epm_line'] : null; + $temp = isset($_REQUEST['epm_temps']) ? $_REQUEST['epm_temps'] : null; + if (isset($_REQUEST['name'])) { + $name = isset($_REQUEST['name']) ? $_REQUEST['name'] : null; + echo "hi"; } else { - $name = isset($_REQUEST['description'])?$_REQUEST['description']:null; + echo "hi"; + $name = isset($_REQUEST['description']) ? $_REQUEST['description'] : null; + echo $name; } - if(isset($_REQUEST['deviceid'])) { - if($_REQUEST['devicetype'] == "fixed") { + if (isset($_REQUEST['deviceid'])) { + if ($_REQUEST['devicetype'] == "fixed") { //SQL to get the Description of the extension from the extension table - $sql = "SELECT name FROM users WHERE extension = '".$_REQUEST['deviceuser']."'"; - $name = $endpoint->eda->sql($sql,'getOne'); - + $sql = "SELECT name FROM users WHERE extension = '" . $_REQUEST['deviceuser'] . "'"; + $name_o = $endpoint->eda->sql($sql, 'getOne'); + if($name_o) { + $name = $name_o; + } } } - $reboot = isset($_REQUEST['epm_reboot'])?$_REQUEST['epm_reboot']:null; + $reboot = isset($_REQUEST['epm_reboot']) ? $_REQUEST['epm_reboot'] : null; - if($endpoint->mac_check_clean($mac)) { - $sql = "SELECT id FROM endpointman_mac_list WHERE mac = '".$endpoint->mac_check_clean($mac)."'"; - $macid = $endpoint->eda->sql($sql,'getOne'); - if($macid) { + if ($endpoint->mac_check_clean($mac)) { + $sql = "SELECT id FROM endpointman_mac_list WHERE mac = '" . $endpoint->mac_check_clean($mac) . "'"; + $macid = $endpoint->eda->sql($sql, 'getOne'); + if ($macid) { //In Database already - - $sql = 'SELECT * FROM endpointman_line_list WHERE ext = '.$extdisplay.' AND mac_id = '. $macid; - $lines_list =& $endpoint->eda->sql($sql,'getRow',DB_FETCHMODE_ASSOC); - - if(($lines_list) AND (isset($model)) AND (isset($line)) AND (!isset($delete)) AND (isset($temp))) { + + $sql = 'SELECT * FROM endpointman_line_list WHERE ext = ' . $extdisplay . ' AND mac_id = ' . $macid; + $lines_list = & $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + if (($lines_list) AND (isset($model)) AND (isset($line)) AND (!isset($delete)) AND (isset($temp))) { //Modifying line already in the database - $endpoint->update_device($macid, $model, $temp, $lines_list['luid'],$name,$lines_list['line']); + $endpoint->update_device($macid, $model, $temp, $lines_list['luid'], $name, $lines_list['line']); $row = $endpoint->get_phone_info($macid); - if(isset($reboot)) { + if (isset($reboot)) { $endpoint->prepare_configs($row); } else { - $endpoint->prepare_configs($row,FALSE); + $endpoint->prepare_configs($row, FALSE); } - } elseif((isset($model)) AND (!isset($delete)) AND (isset($line)) AND (isset($temp))) { + } elseif ((isset($model)) AND (!isset($delete)) AND (isset($line)) AND (isset($temp))) { //Add line to the database - if(empty($line)) { + if (empty($line)) { $endpoint->add_line($macid, NULL, $extdisplay, $name); } else { - $endpoint->add_line($macid, $line, $extdisplay, $name); + $endpoint->add_line($macid, $line, $extdisplay, $name); } - + $endpoint->update_device($macid, $model, $temp, NULL, NULL, NULL, FALSE); $row = $endpoint->get_phone_info($macid); - if(isset($reboot)) { + if (isset($reboot)) { $endpoint->prepare_configs($row); } else { - $endpoint->prepare_configs($row,FALSE); + $endpoint->prepare_configs($row, FALSE); } } - } elseif(!isset($delete)) { + } elseif (!isset($delete)) { //Add Extension/Phone to database $mac_id = $endpoint->add_device($mac, $model, $extdisplay, $temp, NULL, $name); - if($mac_id) { + if ($mac_id) { $row = $endpoint->get_phone_info($mac_id); $endpoint->prepare_configs($row); } @@ -157,6 +187,7 @@ function endpointman_configpageinit($pagename) { } } } + function endpointman_applyhooks() { global $currentcomponent; @@ -164,19 +195,23 @@ function endpointman_applyhooks() { // displaying stuff on the page. $currentcomponent->addguifunc('endpointman_configpageload'); } + // This is called before the page is actually displayed, so we can use addguielem(). function endpointman_configpageload() { global $currentcomponent, $endpoint, $db; - $display = isset($_REQUEST['display'])?$_REQUEST['display']:null; + $display = isset($_REQUEST['display']) ? $_REQUEST['display'] : null; + $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; + $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null; + if (isset($extdisplay) && !empty($extdisplay)) { + $sql = "SELECT tech FROM devices WHERE id = " . $extdisplay; + $tech = $endpoint->eda->sql($sql, 'getOne'); + } else { + $tech = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : null; + } - // Init vars from $_REQUEST[] - $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; - $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; - $tech = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : null; - $tech = isset($tech) ? $tech : $_REQUEST['tech']; - if((isset($tech)) && (($tech == 'sip_generic') OR ($tech == 'sip'))) { - // Don't display this stuff it it's on a 'This xtn has been deleted' page. + if (isset($tech) && (($tech == 'sip') OR ($tech == 'sip_generic'))) { + // Don't display this stuff it it's on a 'This xtn has been deleted' page. if ($action != 'del') { $js = " @@ -199,9 +234,9 @@ function endpointman_configpageload() { $section = _('End Point Manager'); - $sql = "SELECT mac_id,luid,line FROM endpointman_line_list WHERE ext = '".$extdisplay."' "; + $sql = "SELECT mac_id,luid,line FROM endpointman_line_list WHERE ext = '" . $extdisplay . "' "; $line_info = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - if($line_info) { + if ($line_info) { $js = " $.ajaxSetup({ cache: false }); @@ -228,8 +263,8 @@ function endpointman_configpageload() { $info = $endpoint->get_phone_info($line_info['mac_id']); $brand_list = $endpoint->brands_available($info['brand_id'], true); - if(!empty($info['brand_id'])) { - $model_list = $endpoint->models_available(NULL,$info['brand_id']); + if (!empty($info['brand_id'])) { + $model_list = $endpoint->models_available(NULL, $info['brand_id']); $line_list = $endpoint->linesAvailable($line_info['luid']); $template_list = $endpoint->display_templates($info['product_id']); } else { @@ -240,14 +275,13 @@ function endpointman_configpageload() { $checked = false; - $currentcomponent->addguielem($section, new gui_checkbox('epm_delete', $checked, 'Delete','Delete this Extension from Endpoint Manager'),9); - $currentcomponent->addguielem($section, new gui_textbox('epm_mac', $info['mac'], 'MAC Address', 'The MAC Address of the Phone Assigned to this Extension/Device.
      (Leave Blank to Remove from Endpoint Manager)', '', 'Please enter a valid MAC Address', true, 17, false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_brand', $brand_list, $info['brand_id'], 'Brand', 'The Brand of this Phone.', false, 'frm_'.$display.'_brand_change(this.options[this.selectedIndex].value)', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_model', $model_list, $info['model_id'], 'Model', 'The Model of this Phone.', false, 'frm_'.$display.'_model_change(this.options[this.selectedIndex].value,\''.$line_info['luid'].'\')', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_line', $line_list, $line_info['line'], 'Line', 'The Line of this Extension/Device.', false, '', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_temps', $template_list, $info['template_id'], 'Template', 'The Template of this Phone.', false, '', false),9); - $currentcomponent->addguielem($section, new gui_checkbox('epm_reboot', $checked, 'Reboot','Reboot this Phone on Submit'),9); - + $currentcomponent->addguielem($section, new gui_checkbox('epm_delete', $checked, 'Delete', 'Delete this Extension from Endpoint Manager'), 9); + $currentcomponent->addguielem($section, new gui_textbox('epm_mac', $info['mac'], 'MAC Address', 'The MAC Address of the Phone Assigned to this Extension/Device.
      (Leave Blank to Remove from Endpoint Manager)', '', 'Please enter a valid MAC Address', true, 17, false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_brand', $brand_list, $info['brand_id'], 'Brand', 'The Brand of this Phone.', false, 'frm_' . $display . '_brand_change(this.options[this.selectedIndex].value)', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_model', $model_list, $info['model_id'], 'Model', 'The Model of this Phone.', false, 'frm_' . $display . '_model_change(this.options[this.selectedIndex].value,\'' . $line_info['luid'] . '\')', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_line', $line_list, $line_info['line'], 'Line', 'The Line of this Extension/Device.', false, '', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_temps', $template_list, $info['template_id'], 'Template', 'The Template of this Phone.', false, '', false), 9); + $currentcomponent->addguielem($section, new gui_checkbox('epm_reboot', $checked, 'Reboot', 'Reboot this Phone on Submit'), 9); } else { $js = " @@ -277,17 +311,17 @@ function endpointman_configpageload() { $line_list = array(); $template_list = array(); - $currentcomponent->addguielem($section, new gui_textbox('epm_mac', $info['mac'], 'MAC Address', 'The MAC Address of the Phone Assigned to this Extension/Device.
      (Leave Blank to Remove from Endpoint Manager)', '', 'Please enter a valid MAC Address', true, 17, false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_brand', $brand_list, $info['brand_id'], 'Brand', 'The Brand of this Phone.', false, 'frm_'.$display.'_brand_change(this.options[this.selectedIndex].value)', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_model', $model_list, $info['model_id'], 'Model', 'The Model of this Phone.', false, 'frm_'.$display.'_model_change(this.options[this.selectedIndex].value,document.getElementById(\'epm_mac\').value)', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_line', $line_list, $line_info['line'], 'Line', 'The Line of this Extension/Device.', false, '', false),9); - $currentcomponent->addguielem($section, new gui_selectbox('epm_temps', $template_list, $info['template_id'], 'Template', 'The Template of this Phone.', false, '', false),9); - $currentcomponent->addguielem($section, new guitext('epm_note','Note: This might reboot the phone if it\'s already registered to Asterisk')); - + $currentcomponent->addguielem($section, new gui_textbox('epm_mac', $info['mac'], 'MAC Address', 'The MAC Address of the Phone Assigned to this Extension/Device.
      (Leave Blank to Remove from Endpoint Manager)', '', 'Please enter a valid MAC Address', true, 17, false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_brand', $brand_list, $info['brand_id'], 'Brand', 'The Brand of this Phone.', false, 'frm_' . $display . '_brand_change(this.options[this.selectedIndex].value)', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_model', $model_list, $info['model_id'], 'Model', 'The Model of this Phone.', false, 'frm_' . $display . '_model_change(this.options[this.selectedIndex].value,document.getElementById(\'epm_mac\').value)', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_line', $line_list, $line_info['line'], 'Line', 'The Line of this Extension/Device.', false, '', false), 9); + $currentcomponent->addguielem($section, new gui_selectbox('epm_temps', $template_list, $info['template_id'], 'Template', 'The Template of this Phone.', false, '', false), 9); + $currentcomponent->addguielem($section, new guitext('epm_note', 'Note: This might reboot the phone if it\'s already registered to Asterisk')); } } } } function endpointman_hookProcess_core($viewing_itemid, $request) { + } \ No newline at end of file diff --git a/includes/abstraction/freepbx.inc b/includes/abstraction/freepbx.inc index 5df19b88..a80fa455 100644 --- a/includes/abstraction/freepbx.inc +++ b/includes/abstraction/freepbx.inc @@ -34,9 +34,12 @@ class epm_data_abstraction { } function sql_error($results) { + echo "

      FATAL SQL ERROR! ::::: "; + echo $results->getDebugInfo() . "SQL -
      $sql"; + echo "

      "; echo "
      ";
               var_dump(debug_backtrace());
      -        die($results->getDebugInfo() . "SQL - 
      $sql"); + die(); } function get_stored_globals() { diff --git a/includes/advanced.inc b/includes/advanced.inc index 9530890a..700ce1a8 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -454,11 +454,6 @@ switch($_REQUEST['subpage']) { } else { $endpoint->error['config_dir'] = "No Configuration Location Defined!"; } - - //Check tftp server to make sure it's functioning if we are using it - if(($_POST['cfg_type'] == 'file') AND ($tftp_writable)) { - $endpoint->tftp_check(); - } if((isset($_POST['enable_ari'])) AND ($_POST['enable_ari'] == "on")) { $_POST['enable_ari'] = 1; @@ -485,6 +480,19 @@ switch($_REQUEST['subpage']) { } else { $_POST['allow_hdfiles'] = 0; } + if((isset($_POST['tftp_check'])) AND ($_POST['tftp_check'] == "on")) { + $_POST['tftp_check'] = 1; + } else { + $_POST['tftp_check'] = 0; + } + + $sql="UPDATE endpointman_global_vars SET value='" . $_POST['tftp_check'] . "' WHERE var_name='tftp_check'"; + $endpoint->eda->sql($sql); + + //Check tftp server to make sure it's functioning if we are using it + if(($_POST['cfg_type'] == 'file') AND ($tftp_writable)) { + $endpoint->tftp_check(); + } $sql="UPDATE endpointman_global_vars SET value='" . $_POST['package_server'] . "' WHERE var_name='update_server'"; $endpoint->eda->sql($sql); @@ -554,6 +562,12 @@ switch($_REQUEST['subpage']) { } else { $allow_hdfiles = ""; } + + if($endpoint->global_cfg['tftp_check']) { + $tftp_checked = "checked"; + } else { + $tftp_checked = ""; + } if($endpoint->global_cfg['debug']) { $debug_selected = "checked"; @@ -574,6 +588,8 @@ switch($_REQUEST['subpage']) { $endpoint->tpl->assign("debug_selected", $debug_selected); $endpoint->tpl->assign("hdfiles_selected", $allow_hdfiles); + + $endpoint->tpl->assign("tftp_selected", $tftp_checked); $endpoint->tpl->assign("ip", $_SERVER["SERVER_ADDR"]); $endpoint->tpl->assign("srvip", $endpoint->global_cfg['srvip']); diff --git a/includes/ajax.inc b/includes/ajax.inc index 2e7bbb33..cb184f75 100644 --- a/includes/ajax.inc +++ b/includes/ajax.inc @@ -10,7 +10,7 @@ require 'functions.inc'; $endpoint = new endpointmanager(); -include 'jsonwrapper.php'; +include 'json.inc'; function in_array_recursive($needle, $haystack) { $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($haystack)); diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc index c6075805..33110192 100644 --- a/includes/devices_manager.inc +++ b/includes/devices_manager.inc @@ -230,6 +230,9 @@ switch ($sub_type) { } break; case "go" : + $sql = "UPDATE endpointman_global_vars SET value = '".$_REQUEST['netmask']."' WHERE var_name = 'nmap_search'"; + $endpoint->eda->sql($sql); + $endpoint->global_cfg['nmap_search'] = $_REQUEST['netmask']; if ((isset($_REQUEST['nmap'])) AND ($_REQUEST['nmap'] == 1)) { $temp = $endpoint->discover_new($_REQUEST['netmask']); } else { @@ -453,10 +456,11 @@ foreach($template_list as $row) { //initialize a Rain TPL object if (isset($template_editor)) { -} else { +} else { $endpoint->tpl->assign("list", $list); $endpoint->tpl->assign("error", ""); - $endpoint->tpl->assign("srvip", $_SERVER["SERVER_ADDR"]); + $serv_address = !empty($endpoint->global_cfg['nmap_search']) ? $endpoint->global_cfg['nmap_search'] : $_SERVER["SERVER_ADDR"].'/24'; + $endpoint->tpl->assign("netmask", $serv_address); $endpoint->tpl->assign("web_var", "?type=$type"); $ma = $endpoint->models_available(); if($ma != FALSE) { diff --git a/includes/functions.inc b/includes/functions.inc index 76602595..b8d216bd 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -172,31 +172,42 @@ class endpointmanager { } function tftp_check() { - $subject = shell_exec("netstat -luan --numeric-ports"); - if(preg_match('/:69\s/i', $subject)) { - $rand = md5(rand(10,2000)); - if(file_put_contents($this->global_cfg['config_location'].'TEST', $rand)) { - if($this->tftp_fetch('127.0.0.1','TEST') != $rand) { - $this->error['tftp_check'] = 'Local TFTP Server is not correctly configured'; - } - unlink($this->global_cfg['config_location'].'TEST'); + //create a simple block here incase people have strange issues going on as we will kill http + //by running this if the server isn't really running! + $sql = 'SELECT value FROM endpointman_global_vars WHERE var_name = \'tftp_check\''; + if($this->eda->sql($sql, 'getOne') != 1){ + $sql = 'UPDATE endpointman_global_vars SET value = \'1\' WHERE var_name = \'tftp_check\''; + $this->eda->sql($sql); + $subject = shell_exec("netstat -luan --numeric-ports"); + if(preg_match('/:69\s/i', $subject)) { + $rand = md5(rand(10,2000)); + if(file_put_contents($this->global_cfg['config_location'].'TEST', $rand)) { + if($this->tftp_fetch('127.0.0.1','TEST') != $rand) { + $this->error['tftp_check'] = 'Local TFTP Server is not correctly configured'; + } + unlink($this->global_cfg['config_location'].'TEST'); + } else { + $this->error['tftp_check'] = 'Unable to write to '.$this->global_cfg['config_location']; + } } else { - $this->error['tftp_check'] = 'Unable to write to '.$this->global_cfg['config_location']; - } - } else { - $dis = FALSE; - if (file_exists('/etc/xinetd.d/tftp')) { - $contents = file_get_contents('/etc/xinetd.d/tftp'); - if (preg_match('/disable.*=.*yes/i', $contents)) { - $this->error['tftp_check'] = 'Disabled is set to "yes" in /etc/xinetd.d/tftp. Please fix
      Then restart your TFTP service'; - $dis = TRUE; + $dis = FALSE; + if (file_exists('/etc/xinetd.d/tftp')) { + $contents = file_get_contents('/etc/xinetd.d/tftp'); + if (preg_match('/disable.*=.*yes/i', $contents)) { + $this->error['tftp_check'] = 'Disabled is set to "yes" in /etc/xinetd.d/tftp. Please fix
      Then restart your TFTP service'; + $dis = TRUE; + } + } + if(!$dis) { + $this->error['tftp_check'] = 'TFTP Server is not running.
      '. + 'See here for instructions on how to install one: http://wiki.provisioner.net/index.php/Tftp'; + } } - if(!$dis) { - $this->error['tftp_check'] = 'TFTP Server is not running.
      '. - 'See here for instructions on how to install one: http://wiki.provisioner.net/index.php/Tftp'; - - } + $sql = 'UPDATE endpointman_global_vars SET value = \'0\' WHERE var_name = \'tftp_check\''; + $this->eda->sql($sql); + } else { + $this->error['tftp_check'] = 'TFTP Server check failed on last past. Skipping'; } } @@ -1591,8 +1602,6 @@ class endpointmanager { $this->error['prepare_configs'] = 'Error Returned From Provisioner Library: '. $e->getMessage(); return(FALSE); } - - //print_r($provisioner_lib->debug_return); //End timer $time_end = microtime(true); @@ -2450,13 +2459,19 @@ class endpointmanager { if (!file_exists($dirname)) { mkdir($dirname); } + if (!is_writable($dirname)) { + $this->error['download_file'] = "Directory '".$dirname."' is not writable! Unable to download files"; + return false; + } file_put_contents($destination_file, $contents); //check file placement if (!file_exists($destination_file)) { + $this->error['download_file'] = "File Doesn't Exist in '".$dirname."'. Unable to download files"; return false; } return true; } else { + $this->error['download_file'] = "Server Replied with error '".$http_response_header[0]."'. Unable to download files"; return false; } } diff --git a/includes/json.inc b/includes/json.inc index aace5c62..1cf6eb25 100644 --- a/includes/json.inc +++ b/includes/json.inc @@ -187,693 +187,694 @@ define('JSON_PRETTY_PRINT', 100); * $value = $json->decode($input); * */ -class Services_JSON -{ - /** - * constructs a new JSON instance - * - * @param int $use object behavior flags; combine with boolean-OR - * - * possible values: - * - SERVICES_JSON_LOOSE_TYPE: loose typing. - * "{...}" syntax creates associative arrays - * instead of objects in decode(). - * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. - * Values which can't be encoded (e.g. resources) - * appear as NULL instead of throwing errors. - * By default, a deeply-nested resource will - * bubble up with an error, so all return values - * from encode() should be checked with isError() - */ - function Services_JSON($use = 0) - { - $this->use = $use; - } - - /** - * convert a string from one UTF-16 char to one UTF-8 char - * - * Normally should be handled by mb_convert_encoding, but - * provides a slower PHP-only method for installations - * that lack the multibye string extension. - * - * @param string $utf16 UTF-16 character - * @return string UTF-8 character - * @access private - */ - function utf162utf8($utf16) - { - // oh please oh please oh please oh please oh please - if(function_exists('mb_convert_encoding')) { - return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); - } - - $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); - - switch(true) { - case ((0x7F & $bytes) == $bytes): - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x7F & $bytes); - - case (0x07FF & $bytes) == $bytes: - // return a 2-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0xC0 | (($bytes >> 6) & 0x1F)) - . chr(0x80 | ($bytes & 0x3F)); - - case (0xFFFF & $bytes) == $bytes: - // return a 3-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0xE0 | (($bytes >> 12) & 0x0F)) - . chr(0x80 | (($bytes >> 6) & 0x3F)) - . chr(0x80 | ($bytes & 0x3F)); - } - - // ignoring UTF-32 for now, sorry - return ''; - } - - /** - * convert a string from one UTF-8 char to one UTF-16 char - * - * Normally should be handled by mb_convert_encoding, but - * provides a slower PHP-only method for installations - * that lack the multibye string extension. - * - * @param string $utf8 UTF-8 character - * @return string UTF-16 character - * @access private - */ - function utf82utf16($utf8) - { - // oh please oh please oh please oh please oh please - if(function_exists('mb_convert_encoding')) { - return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); - } - - switch(strlen($utf8)) { - case 1: - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return $utf8; - - case 2: - // return a UTF-16 character from a 2-byte UTF-8 char - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x07 & (ord($utf8{0}) >> 2)) - . chr((0xC0 & (ord($utf8{0}) << 6)) - | (0x3F & ord($utf8{1}))); - - case 3: - // return a UTF-16 character from a 3-byte UTF-8 char - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr((0xF0 & (ord($utf8{0}) << 4)) - | (0x0F & (ord($utf8{1}) >> 2))) - . chr((0xC0 & (ord($utf8{1}) << 6)) - | (0x7F & ord($utf8{2}))); - } - - // ignoring UTF-32 for now, sorry - return ''; - } - - /** - * encodes an arbitrary variable into JSON format - * - * @param mixed $var any number, boolean, string, array, or object to be encoded. - * see argument 1 to Services_JSON() above for array-parsing behavior. - * if var is a strng, note that encode() always expects it - * to be in ASCII or UTF-8 format! - * - * @return mixed JSON string representation of input var or an error if a problem occurs - * @access public - */ - function encode($var) - { - switch (gettype($var)) { - case 'boolean': - return $var ? 'true' : 'false'; - - case 'NULL': - return 'null'; - - case 'integer': - return (int) $var; - - case 'double': - case 'float': - return (float) $var; - - case 'string': - // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT - $ascii = ''; - $strlen_var = strlen($var); - - /* - * Iterate over every character in the string, - * escaping with a slash or encoding to UTF-8 where necessary - */ - for ($c = 0; $c < $strlen_var; ++$c) { - - $ord_var_c = ord($var{$c}); - - switch (true) { - case $ord_var_c == 0x08: - $ascii .= '\b'; - break; - case $ord_var_c == 0x09: - $ascii .= '\t'; - break; - case $ord_var_c == 0x0A: - $ascii .= '\n'; - break; - case $ord_var_c == 0x0C: - $ascii .= '\f'; - break; - case $ord_var_c == 0x0D: - $ascii .= '\r'; - break; - - case $ord_var_c == 0x22: - case $ord_var_c == 0x2F: - case $ord_var_c == 0x5C: - // double quote, slash, slosh - $ascii .= '\\'.$var{$c}; - break; - - case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): - // characters U-00000000 - U-0000007F (same as ASCII) - $ascii .= $var{$c}; - break; - - case (($ord_var_c & 0xE0) == 0xC0): - // characters U-00000080 - U-000007FF, mask 110XXXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($var{$c + 1})); - $c += 1; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xF0) == 0xE0): - // characters U-00000800 - U-0000FFFF, mask 1110XXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2})); - $c += 2; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xF8) == 0xF0): - // characters U-00010000 - U-001FFFFF, mask 11110XXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3})); - $c += 3; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xFC) == 0xF8): - // characters U-00200000 - U-03FFFFFF, mask 111110XX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4})); - $c += 4; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xFE) == 0xFC): - // characters U-04000000 - U-7FFFFFFF, mask 1111110X - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4}), - ord($var{$c + 5})); - $c += 5; - $utf16 = $this->utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - } - } - - return '"'.$ascii.'"'; - - case 'array': - /* - * As per JSON spec if any array key is not an integer - * we must treat the the whole array as an object. We - * also try to catch a sparsely populated associative - * array with numeric keys here because some JS engines - * will create an array with empty indexes up to - * max_index which can cause memory issues and because - * the keys, which may be relevant, will be remapped - * otherwise. - * - * As per the ECMA and JSON specification an object may - * have any string as a property. Unfortunately due to - * a hole in the ECMA specification if the key is a - * ECMA reserved word or starts with a digit the - * parameter is only accessible using ECMAScript's - * bracket notation. - */ - - // treat as a JSON object - if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { - $properties = array_map(array($this, 'name_value'), - array_keys($var), - array_values($var)); - - foreach($properties as $property) { - if(Services_JSON::isError($property)) { - return $property; - } - } - - return '{' . join(',', $properties) . '}'; - } - - // treat it like a regular array - $elements = array_map(array($this, 'encode'), $var); - - foreach($elements as $element) { - if(Services_JSON::isError($element)) { - return $element; - } - } - - return '[' . join(',', $elements) . ']'; - - case 'object': - $vars = get_object_vars($var); - - $properties = array_map(array($this, 'name_value'), - array_keys($vars), - array_values($vars)); - - foreach($properties as $property) { - if(Services_JSON::isError($property)) { - return $property; - } - } - - return '{' . join(',', $properties) . '}'; - - default: - return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) - ? 'null' - : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); - } - } - - /** - * array-walking function for use in generating JSON-formatted name-value pairs - * - * @param string $name name of key to use - * @param mixed $value reference to an array element to be encoded - * - * @return string JSON-formatted name-value pair, like '"name":value' - * @access private - */ - function name_value($name, $value) - { - $encoded_value = $this->encode($value); - - if(Services_JSON::isError($encoded_value)) { - return $encoded_value; - } - - return $this->encode(strval($name)) . ':' . $encoded_value; - } - - /** - * reduce a string by removing leading and trailing comments and whitespace - * - * @param $str string string value to strip of comments and whitespace - * - * @return string string value stripped of comments and whitespace - * @access private - */ - function reduce_string($str) - { - $str = preg_replace(array( - - // eliminate single line comments in '// ...' form - '#^\s*//(.+)$#m', - - // eliminate multi-line comments in '/* ... */' form, at start of string - '#^\s*/\*(.+)\*/#Us', - - // eliminate multi-line comments in '/* ... */' form, at end of string - '#/\*(.+)\*/\s*$#Us' - - ), '', $str); - - // eliminate extraneous space - return trim($str); - } - - /** - * decodes a JSON string into appropriate variable - * - * @param string $str JSON-formatted string - * - * @return mixed number, boolean, string, array, or object - * corresponding to given JSON input string. - * See argument 1 to Services_JSON() above for object-output behavior. - * Note that decode() always returns strings - * in ASCII or UTF-8 format! - * @access public - */ - function decode($str) - { - $str = $this->reduce_string($str); - - switch (strtolower($str)) { - case 'true': - return true; - - case 'false': - return false; - - case 'null': - return null; - - default: - $m = array(); - - if (is_numeric($str)) { - // Lookie-loo, it's a number - - // This would work on its own, but I'm trying to be - // good about returning integers where appropriate: - // return (float)$str; - - // Return float or int, as appropriate - return ((float)$str == (integer)$str) - ? (integer)$str - : (float)$str; - - } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { - // STRINGS RETURNED IN UTF-8 FORMAT - $delim = substr($str, 0, 1); - $chrs = substr($str, 1, -1); - $utf8 = ''; - $strlen_chrs = strlen($chrs); - - for ($c = 0; $c < $strlen_chrs; ++$c) { - - $substr_chrs_c_2 = substr($chrs, $c, 2); - $ord_chrs_c = ord($chrs{$c}); - - switch (true) { - case $substr_chrs_c_2 == '\b': - $utf8 .= chr(0x08); - ++$c; - break; - case $substr_chrs_c_2 == '\t': - $utf8 .= chr(0x09); - ++$c; - break; - case $substr_chrs_c_2 == '\n': - $utf8 .= chr(0x0A); - ++$c; - break; - case $substr_chrs_c_2 == '\f': - $utf8 .= chr(0x0C); - ++$c; - break; - case $substr_chrs_c_2 == '\r': - $utf8 .= chr(0x0D); - ++$c; - break; - - case $substr_chrs_c_2 == '\\"': - case $substr_chrs_c_2 == '\\\'': - case $substr_chrs_c_2 == '\\\\': - case $substr_chrs_c_2 == '\\/': - if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || - ($delim == "'" && $substr_chrs_c_2 != '\\"')) { - $utf8 .= $chrs{++$c}; - } - break; - - case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): - // single, escaped unicode character - $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) - . chr(hexdec(substr($chrs, ($c + 4), 2))); - $utf8 .= $this->utf162utf8($utf16); - $c += 5; - break; - - case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): - $utf8 .= $chrs{$c}; - break; - - case ($ord_chrs_c & 0xE0) == 0xC0: - // characters U-00000080 - U-000007FF, mask 110XXXXX - //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 2); - ++$c; - break; - - case ($ord_chrs_c & 0xF0) == 0xE0: - // characters U-00000800 - U-0000FFFF, mask 1110XXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 3); - $c += 2; - break; - - case ($ord_chrs_c & 0xF8) == 0xF0: - // characters U-00010000 - U-001FFFFF, mask 11110XXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 4); - $c += 3; - break; - - case ($ord_chrs_c & 0xFC) == 0xF8: - // characters U-00200000 - U-03FFFFFF, mask 111110XX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 5); - $c += 4; - break; - - case ($ord_chrs_c & 0xFE) == 0xFC: - // characters U-04000000 - U-7FFFFFFF, mask 1111110X - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $utf8 .= substr($chrs, $c, 6); - $c += 5; - break; - - } - - } - - return $utf8; - - } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { - // array, or object notation - - if ($str{0} == '[') { - $stk = array(SERVICES_JSON_IN_ARR); - $arr = array(); - } else { - if ($this->use & SERVICES_JSON_LOOSE_TYPE) { - $stk = array(SERVICES_JSON_IN_OBJ); - $obj = array(); - } else { - $stk = array(SERVICES_JSON_IN_OBJ); - $obj = new stdClass(); - } - } - - array_push($stk, array('what' => SERVICES_JSON_SLICE, - 'where' => 0, - 'delim' => false)); - - $chrs = substr($str, 1, -1); - $chrs = $this->reduce_string($chrs); - - if ($chrs == '') { - if (reset($stk) == SERVICES_JSON_IN_ARR) { - return $arr; - - } else { - return $obj; - - } - } - - //print("\nparsing {$chrs}\n"); - - $strlen_chrs = strlen($chrs); - - for ($c = 0; $c <= $strlen_chrs; ++$c) { - - $top = end($stk); - $substr_chrs_c_2 = substr($chrs, $c, 2); - - if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { - // found a comma that is not inside a string, array, etc., - // OR we've reached the end of the character list - $slice = substr($chrs, $top['where'], ($c - $top['where'])); - array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); - //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - if (reset($stk) == SERVICES_JSON_IN_ARR) { - // we are in an array, so just push an element onto the stack - array_push($arr, $this->decode($slice)); - - } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { - // we are in an object, so figure - // out the property name and set an - // element in an associative array, - // for now - $parts = array(); +if(!class_exists('Services_JSON')) { + class Services_JSON + { + /** + * constructs a new JSON instance + * + * @param int $use object behavior flags; combine with boolean-OR + * + * possible values: + * - SERVICES_JSON_LOOSE_TYPE: loose typing. + * "{...}" syntax creates associative arrays + * instead of objects in decode(). + * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. + * Values which can't be encoded (e.g. resources) + * appear as NULL instead of throwing errors. + * By default, a deeply-nested resource will + * bubble up with an error, so all return values + * from encode() should be checked with isError() + */ + function Services_JSON($use = 0) + { + $this->use = $use; + } + + /** + * convert a string from one UTF-16 char to one UTF-8 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf16 UTF-16 character + * @return string UTF-8 character + * @access private + */ + function utf162utf8($utf16) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); + } + + $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + + switch(true) { + case ((0x7F & $bytes) == $bytes): + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x7F & $bytes); + + case (0x07FF & $bytes) == $bytes: + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xC0 | (($bytes >> 6) & 0x1F)) + . chr(0x80 | ($bytes & 0x3F)); + + case (0xFFFF & $bytes) == $bytes: + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0xE0 | (($bytes >> 12) & 0x0F)) + . chr(0x80 | (($bytes >> 6) & 0x3F)) + . chr(0x80 | ($bytes & 0x3F)); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * convert a string from one UTF-8 char to one UTF-16 char + * + * Normally should be handled by mb_convert_encoding, but + * provides a slower PHP-only method for installations + * that lack the multibye string extension. + * + * @param string $utf8 UTF-8 character + * @return string UTF-16 character + * @access private + */ + function utf82utf16($utf8) + { + // oh please oh please oh please oh please oh please + if(function_exists('mb_convert_encoding')) { + return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); + } + + switch(strlen($utf8)) { + case 1: + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return $utf8; + + case 2: + // return a UTF-16 character from a 2-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr(0x07 & (ord($utf8{0}) >> 2)) + . chr((0xC0 & (ord($utf8{0}) << 6)) + | (0x3F & ord($utf8{1}))); + + case 3: + // return a UTF-16 character from a 3-byte UTF-8 char + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + return chr((0xF0 & (ord($utf8{0}) << 4)) + | (0x0F & (ord($utf8{1}) >> 2))) + . chr((0xC0 & (ord($utf8{1}) << 6)) + | (0x7F & ord($utf8{2}))); + } + + // ignoring UTF-32 for now, sorry + return ''; + } + + /** + * encodes an arbitrary variable into JSON format + * + * @param mixed $var any number, boolean, string, array, or object to be encoded. + * see argument 1 to Services_JSON() above for array-parsing behavior. + * if var is a strng, note that encode() always expects it + * to be in ASCII or UTF-8 format! + * + * @return mixed JSON string representation of input var or an error if a problem occurs + * @access public + */ + function encode($var) + { + switch (gettype($var)) { + case 'boolean': + return $var ? 'true' : 'false'; + + case 'NULL': + return 'null'; + + case 'integer': + return (int) $var; + + case 'double': + case 'float': + return (float) $var; + + case 'string': + // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT + $ascii = ''; + $strlen_var = strlen($var); + + /* + * Iterate over every character in the string, + * escaping with a slash or encoding to UTF-8 where necessary + */ + for ($c = 0; $c < $strlen_var; ++$c) { + + $ord_var_c = ord($var{$c}); + + switch (true) { + case $ord_var_c == 0x08: + $ascii .= '\b'; + break; + case $ord_var_c == 0x09: + $ascii .= '\t'; + break; + case $ord_var_c == 0x0A: + $ascii .= '\n'; + break; + case $ord_var_c == 0x0C: + $ascii .= '\f'; + break; + case $ord_var_c == 0x0D: + $ascii .= '\r'; + break; + + case $ord_var_c == 0x22: + case $ord_var_c == 0x2F: + case $ord_var_c == 0x5C: + // double quote, slash, slosh + $ascii .= '\\'.$var{$c}; + break; + + case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): + // characters U-00000000 - U-0000007F (same as ASCII) + $ascii .= $var{$c}; + break; + + case (($ord_var_c & 0xE0) == 0xC0): + // characters U-00000080 - U-000007FF, mask 110XXXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, ord($var{$c + 1})); + $c += 1; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF0) == 0xE0): + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2})); + $c += 2; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xF8) == 0xF0): + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3})); + $c += 3; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFC) == 0xF8): + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4})); + $c += 4; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + + case (($ord_var_c & 0xFE) == 0xFC): + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $char = pack('C*', $ord_var_c, + ord($var{$c + 1}), + ord($var{$c + 2}), + ord($var{$c + 3}), + ord($var{$c + 4}), + ord($var{$c + 5})); + $c += 5; + $utf16 = $this->utf82utf16($char); + $ascii .= sprintf('\u%04s', bin2hex($utf16)); + break; + } + } + + return '"'.$ascii.'"'; + + case 'array': + /* + * As per JSON spec if any array key is not an integer + * we must treat the the whole array as an object. We + * also try to catch a sparsely populated associative + * array with numeric keys here because some JS engines + * will create an array with empty indexes up to + * max_index which can cause memory issues and because + * the keys, which may be relevant, will be remapped + * otherwise. + * + * As per the ECMA and JSON specification an object may + * have any string as a property. Unfortunately due to + * a hole in the ECMA specification if the key is a + * ECMA reserved word or starts with a digit the + * parameter is only accessible using ECMAScript's + * bracket notation. + */ + + // treat as a JSON object + if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { + $properties = array_map(array($this, 'name_value'), + array_keys($var), + array_values($var)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + } + + // treat it like a regular array + $elements = array_map(array($this, 'encode'), $var); + + foreach($elements as $element) { + if(Services_JSON::isError($element)) { + return $element; + } + } + + return '[' . join(',', $elements) . ']'; + + case 'object': + $vars = get_object_vars($var); + + $properties = array_map(array($this, 'name_value'), + array_keys($vars), + array_values($vars)); + + foreach($properties as $property) { + if(Services_JSON::isError($property)) { + return $property; + } + } + + return '{' . join(',', $properties) . '}'; + + default: + return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) + ? 'null' + : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); + } + } + + /** + * array-walking function for use in generating JSON-formatted name-value pairs + * + * @param string $name name of key to use + * @param mixed $value reference to an array element to be encoded + * + * @return string JSON-formatted name-value pair, like '"name":value' + * @access private + */ + function name_value($name, $value) + { + $encoded_value = $this->encode($value); + + if(Services_JSON::isError($encoded_value)) { + return $encoded_value; + } + + return $this->encode(strval($name)) . ':' . $encoded_value; + } + + /** + * reduce a string by removing leading and trailing comments and whitespace + * + * @param $str string string value to strip of comments and whitespace + * + * @return string string value stripped of comments and whitespace + * @access private + */ + function reduce_string($str) + { + $str = preg_replace(array( + + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + + ), '', $str); + + // eliminate extraneous space + return trim($str); + } + + /** + * decodes a JSON string into appropriate variable + * + * @param string $str JSON-formatted string + * + * @return mixed number, boolean, string, array, or object + * corresponding to given JSON input string. + * See argument 1 to Services_JSON() above for object-output behavior. + * Note that decode() always returns strings + * in ASCII or UTF-8 format! + * @access public + */ + function decode($str) + { + $str = $this->reduce_string($str); + + switch (strtolower($str)) { + case 'true': + return true; + + case 'false': + return false; + + case 'null': + return null; + + default: + $m = array(); + + if (is_numeric($str)) { + // Lookie-loo, it's a number + + // This would work on its own, but I'm trying to be + // good about returning integers where appropriate: + // return (float)$str; + + // Return float or int, as appropriate + return ((float)$str == (integer)$str) + ? (integer)$str + : (float)$str; + + } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { + // STRINGS RETURNED IN UTF-8 FORMAT + $delim = substr($str, 0, 1); + $chrs = substr($str, 1, -1); + $utf8 = ''; + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c < $strlen_chrs; ++$c) { + + $substr_chrs_c_2 = substr($chrs, $c, 2); + $ord_chrs_c = ord($chrs{$c}); + + switch (true) { + case $substr_chrs_c_2 == '\b': + $utf8 .= chr(0x08); + ++$c; + break; + case $substr_chrs_c_2 == '\t': + $utf8 .= chr(0x09); + ++$c; + break; + case $substr_chrs_c_2 == '\n': + $utf8 .= chr(0x0A); + ++$c; + break; + case $substr_chrs_c_2 == '\f': + $utf8 .= chr(0x0C); + ++$c; + break; + case $substr_chrs_c_2 == '\r': + $utf8 .= chr(0x0D); + ++$c; + break; + + case $substr_chrs_c_2 == '\\"': + case $substr_chrs_c_2 == '\\\'': + case $substr_chrs_c_2 == '\\\\': + case $substr_chrs_c_2 == '\\/': + if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || + ($delim == "'" && $substr_chrs_c_2 != '\\"')) { + $utf8 .= $chrs{++$c}; + } + break; + + case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): + // single, escaped unicode character + $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) + . chr(hexdec(substr($chrs, ($c + 4), 2))); + $utf8 .= $this->utf162utf8($utf16); + $c += 5; + break; + + case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): + $utf8 .= $chrs{$c}; + break; + + case ($ord_chrs_c & 0xE0) == 0xC0: + // characters U-00000080 - U-000007FF, mask 110XXXXX + //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 2); + ++$c; + break; + + case ($ord_chrs_c & 0xF0) == 0xE0: + // characters U-00000800 - U-0000FFFF, mask 1110XXXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 3); + $c += 2; + break; + + case ($ord_chrs_c & 0xF8) == 0xF0: + // characters U-00010000 - U-001FFFFF, mask 11110XXX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 4); + $c += 3; + break; + + case ($ord_chrs_c & 0xFC) == 0xF8: + // characters U-00200000 - U-03FFFFFF, mask 111110XX + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 5); + $c += 4; + break; + + case ($ord_chrs_c & 0xFE) == 0xFC: + // characters U-04000000 - U-7FFFFFFF, mask 1111110X + // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + $utf8 .= substr($chrs, $c, 6); + $c += 5; + break; + + } + + } + + return $utf8; + + } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { + // array, or object notation + + if ($str{0} == '[') { + $stk = array(SERVICES_JSON_IN_ARR); + $arr = array(); + } else { + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = array(); + } else { + $stk = array(SERVICES_JSON_IN_OBJ); + $obj = new stdClass(); + } + } + + array_push($stk, array('what' => SERVICES_JSON_SLICE, + 'where' => 0, + 'delim' => false)); + + $chrs = substr($str, 1, -1); + $chrs = $this->reduce_string($chrs); + + if ($chrs == '') { + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } else { + return $obj; + + } + } + + //print("\nparsing {$chrs}\n"); + + $strlen_chrs = strlen($chrs); + + for ($c = 0; $c <= $strlen_chrs; ++$c) { + + $top = end($stk); + $substr_chrs_c_2 = substr($chrs, $c, 2); + + if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { + // found a comma that is not inside a string, array, etc., + // OR we've reached the end of the character list + $slice = substr($chrs, $top['where'], ($c - $top['where'])); + array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + // we are in an array, so just push an element onto the stack + array_push($arr, $this->decode($slice)); + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + // we are in an object, so figure + // out the property name and set an + // element in an associative array, + // for now + $parts = array(); - if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { - // "name":value pair - $key = $this->decode($parts[1]); - $val = $this->decode($parts[2]); - - if ($this->use & SERVICES_JSON_LOOSE_TYPE) { - $obj[$key] = $val; - } else { - $obj->$key = $val; - } - } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { - // name:value pair, where name is unquoted - $key = $parts[1]; - $val = $this->decode($parts[2]); - - if ($this->use & SERVICES_JSON_LOOSE_TYPE) { - $obj[$key] = $val; - } else { - $obj->$key = $val; - } - } - - } - - } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { - // found a quote, and we are not inside a string - array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); - //print("Found start of string at {$c}\n"); - - } elseif (($chrs{$c} == $top['delim']) && - ($top['what'] == SERVICES_JSON_IN_STR) && - ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { - // found a quote, we're in a string, and it's not escaped - // we know that it's not escaped becase there is _not_ an - // odd number of backslashes at the end of the string so far - array_pop($stk); - //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); - - } elseif (($chrs{$c} == '[') && - in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { - // found a left-bracket, and we are in an array, object, or slice - array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); - //print("Found start of array at {$c}\n"); - - } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { - // found a right-bracket, and we're in an array - array_pop($stk); - //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - } elseif (($chrs{$c} == '{') && - in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { - // found a left-brace, and we are in an array, object, or slice - array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); - //print("Found start of object at {$c}\n"); - - } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { - // found a right-brace, and we're in an object - array_pop($stk); - //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - } elseif (($substr_chrs_c_2 == '/*') && - in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { - // found a comment start, and we are in an array, object, or slice - array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); - $c++; - //print("Found start of comment at {$c}\n"); - - } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { - // found a comment end, and we're in one now - array_pop($stk); - $c++; - - for ($i = $top['where']; $i <= $c; ++$i) - $chrs = substr_replace($chrs, ' ', $i, 1); - - //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); - - } - - } - - if (reset($stk) == SERVICES_JSON_IN_ARR) { - return $arr; - - } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { - return $obj; - - } - - } - } - } - - /** - * @todo Ultimately, this should just call PEAR::isError() - */ - function isError($data, $code = null) - { - if (class_exists('pear')) { - return PEAR::isError($data, $code); - } elseif (is_object($data) && (get_class($data) == 'services_json_error' || - is_subclass_of($data, 'services_json_error'))) { - return true; - } - - return false; - } -} + if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // "name":value pair + $key = $this->decode($parts[1]); + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { + // name:value pair, where name is unquoted + $key = $parts[1]; + $val = $this->decode($parts[2]); + + if ($this->use & SERVICES_JSON_LOOSE_TYPE) { + $obj[$key] = $val; + } else { + $obj->$key = $val; + } + } + + } + + } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { + // found a quote, and we are not inside a string + array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + //print("Found start of string at {$c}\n"); + + } elseif (($chrs{$c} == $top['delim']) && + ($top['what'] == SERVICES_JSON_IN_STR) && + ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { + // found a quote, we're in a string, and it's not escaped + // we know that it's not escaped becase there is _not_ an + // odd number of backslashes at the end of the string so far + array_pop($stk); + //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '[') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-bracket, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); + //print("Found start of array at {$c}\n"); + + } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { + // found a right-bracket, and we're in an array + array_pop($stk); + //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($chrs{$c} == '{') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a left-brace, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + //print("Found start of object at {$c}\n"); + + } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { + // found a right-brace, and we're in an object + array_pop($stk); + //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } elseif (($substr_chrs_c_2 == '/*') && + in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { + // found a comment start, and we are in an array, object, or slice + array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $c++; + //print("Found start of comment at {$c}\n"); + + } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { + // found a comment end, and we're in one now + array_pop($stk); + $c++; + + for ($i = $top['where']; $i <= $c; ++$i) + $chrs = substr_replace($chrs, ' ', $i, 1); + + //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); + + } + + } + + if (reset($stk) == SERVICES_JSON_IN_ARR) { + return $arr; + + } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { + return $obj; + + } + + } + } + } + + /** + * @todo Ultimately, this should just call PEAR::isError() + */ + function isError($data, $code = null) + { + if (class_exists('pear')) { + return PEAR::isError($data, $code); + } elseif (is_object($data) && (get_class($data) == 'services_json_error' || + is_subclass_of($data, 'services_json_error'))) { + return true; + } -if (class_exists('PEAR_Error')) { + return false; + } + } - class Services_JSON_Error extends PEAR_Error - { - function Services_JSON_Error($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { - parent::PEAR_Error($message, $code, $mode, $options, $userinfo); - } - } + if (class_exists('PEAR_Error')) { -} else { + class Services_JSON_Error extends PEAR_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + parent::PEAR_Error($message, $code, $mode, $options, $userinfo); + } + } - /** - * @todo Ultimately, this class shall be descended from PEAR_Error - */ - class Services_JSON_Error - { - function Services_JSON_Error($message = 'unknown error', $code = null, - $mode = null, $options = null, $userinfo = null) - { + } else { - } - } + /** + * @todo Ultimately, this class shall be descended from PEAR_Error + */ + class Services_JSON_Error + { + function Services_JSON_Error($message = 'unknown error', $code = null, + $mode = null, $options = null, $userinfo = null) + { + } + } + } } \ No newline at end of file diff --git a/includes/template_manager.inc b/includes/template_manager.inc index 682b8397..3591fd3e 100644 --- a/includes/template_manager.inc +++ b/includes/template_manager.inc @@ -39,7 +39,7 @@ if(isset($_REQUEST['edit_template'])) { } elseif(isset($_REQUEST['delete_template'])) { $sql = "DELETE FROM endpointman_template_list WHERE id = ". $_REQUEST['id']; $endpoint->eda->sql($sql); - $sql = "UPDATE endpointman_mac_list SET custom_cfg_template = 0 WHERE custom_cfg_template = ".$_REQUEST['id']; + $sql = "UPDATE endpointman_mac_list SET template_id = 0 WHERE template_id = ".$_REQUEST['id']; $endpoint->eda->sql($sql); $default_display = TRUE; $endpoint->message['general'] = _('Deleted'); diff --git a/install.php b/install.php index aeb39c18..f11ab90f 100644 --- a/install.php +++ b/install.php @@ -936,6 +936,14 @@ function ep_table_exists ($table) { $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/v3/' WHERE var_name ='update_server'"; $db->query($sql); } + + if($ver <= "21031") { + out("Adding tftp server check and nmap search save values"); + $sql = 'INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'tftp_check\', \'0\');'; + $db->query($sql); + $sql = 'INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'nmap_search\', \'\');'; + $db->query($sql); + } } @@ -1005,7 +1013,9 @@ function ep_table_exists ($table) { (18, 'show_all_registrations', '0'), (19, 'ntp', ''), (20, 'server_type', 'file'), - (21, 'allow_hdfiles', '0')"; + (21, 'allow_hdfiles', '0'), + (22, 'tftp_check', '0'), + (23, 'nmap_search', '')"; $db->query($sql); out("Creating mac list Table"); diff --git a/module.xml b/module.xml index 721356f6..630f4263 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.2.4 + 2.10.3.4 setup Connectivity Andrew Nagy diff --git a/provisioning/.htaccess b/provisioning/.htaccess index 515d7214..fcbb24fa 100644 --- a/provisioning/.htaccess +++ b/provisioning/.htaccess @@ -1,8 +1,10 @@ RewriteEngine on -RewriteRule ([^/]+\.cfg) p.php?request=$1 [L] -RewriteRule ([^/]+\.tuz) p.php?request=$1 [L] -RewriteRule ([^/]+\.xml) p.php?request=$1 [L] -RewriteRule ([0-9a-f]{12}.*) p.php?request=$1 [L] +#RewriteRule ([^/]+\.cfg) p.php?request=$1 [L] +#RewriteRule ([^/]+\.tuz) p.php?request=$1 [L] +#RewriteRule ([^/]+\.xml) p.php?request=$1 [L] +#RewriteRule ([0-9a-f]{12}.*) p.php?request=$1 [L] + +RewriteRule ^.*$ p.php [QSA,L] RewriteCond %{THE_REQUEST} ^PUT* RewriteRule /prov/[^/]+/([^/]+)\.log p.php?putfile=$1 \ No newline at end of file diff --git a/provisioning/p.php b/provisioning/p.php index 8cbb1cca..d223dbb1 100755 --- a/provisioning/p.php +++ b/provisioning/p.php @@ -28,6 +28,7 @@ # Workaround for SPAs that don't actually request their type of device # Assume they're 504G's. Faulty in firmware 7.4.3a $filename = basename($_SERVER["REQUEST_URI"]); + $web_path = 'http://'.$_SERVER["SERVER_NAME"].dirname($_SERVER["PHP_SELF"]).'/'; /* if ($filename == "p.php") { @@ -59,7 +60,7 @@ $files = $endpoint->prepare_configs($phone_info,FALSE,FALSE); - if(!files) { + if(!$files) { header("HTTP/1.0 500 Internal Server Error"); die(); } diff --git a/templates/freepbx/advanced_settings_manual_upload.html b/templates/freepbx/advanced_settings_manual_upload.html index fa2ad61d..104645dd 100644 --- a/templates/freepbx/advanced_settings_manual_upload.html +++ b/templates/freepbx/advanced_settings_manual_upload.html @@ -3,6 +3,38 @@ {/if} {if condition="isset($show_installer)"} diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html index da7e2603..b5d881fa 100644 --- a/templates/freepbx/advanced_settings_settings.html +++ b/templates/freepbx/advanced_settings_settings.html @@ -107,6 +107,12 @@ + + + + '> diff --git a/templates/freepbx/devices_manager.html b/templates/freepbx/devices_manager.html index 4d546a9d..b9f8781e 100644 --- a/templates/freepbx/devices_manager.html +++ b/templates/freepbx/devices_manager.html @@ -197,7 +197,7 @@ {if condition="$no_add == FALSE"}
      - + @@ -113,6 +113,12 @@ + + + + '> From 349a1a608e19fb9c6546cda2eb0a8b22778099a2 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 27 Mar 2012 12:50:59 -0700 Subject: [PATCH 280/623] Reset back to add after an edit -Fixes #36 --- includes/devices_manager.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc index 33110192..625c0cad 100644 --- a/includes/devices_manager.inc +++ b/includes/devices_manager.inc @@ -51,6 +51,7 @@ if((isset($_REQUEST['sub_type'])) AND ((!$no_add) OR (($_REQUEST['sub_type'] == switch ($sub_type) { //Edit Mode case "edit": + $mode = "EDIT"; switch ($sub_type_sub) { case "add_line_x": $_REQUEST['id'] = $_REQUEST['edit_id']; @@ -92,6 +93,7 @@ switch ($sub_type) { $endpoint->prepare_configs($row); $endpoint->message['edit_save'] = _("Saved")."!"; + $mode = NULL; break; case "delete": $sql = 'SELECT mac_id FROM endpointman_line_list WHERE luid = '.$_REQUEST['edit_id'] ; @@ -104,7 +106,6 @@ switch ($sub_type) { } $edit_row=$endpoint->get_phone_info($_REQUEST['edit_id']); $edit_row['id'] = $_REQUEST['edit_id']; - $mode = "EDIT"; break; case "add" : $mac_id = $endpoint->add_device($_REQUEST['mac'],$_REQUEST['model_list'],$_REQUEST['ext_list'],$_REQUEST['template_list'],$_REQUEST['line_list']); From d0f1ee9fe0f3e162accc8af05b605698a2d72046 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 27 Mar 2012 13:04:18 -0700 Subject: [PATCH 281/623] Clean up .htaccess -Cant use the ?request method incase some people cant figure out how to turn on AllowOverride -Fixes #49 --- provisioning/.htaccess | 13 ++++++------- provisioning/p.php | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/provisioning/.htaccess b/provisioning/.htaccess index fcbb24fa..71326406 100644 --- a/provisioning/.htaccess +++ b/provisioning/.htaccess @@ -1,10 +1,9 @@ RewriteEngine on -#RewriteRule ([^/]+\.cfg) p.php?request=$1 [L] -#RewriteRule ([^/]+\.tuz) p.php?request=$1 [L] -#RewriteRule ([^/]+\.xml) p.php?request=$1 [L] -#RewriteRule ([0-9a-f]{12}.*) p.php?request=$1 [L] - -RewriteRule ^.*$ p.php [QSA,L] +RewriteCond %{THE_REQUEST} ^GET* +RewriteRule ^(.*)$ p.php [QSA,L] RewriteCond %{THE_REQUEST} ^PUT* -RewriteRule /prov/[^/]+/([^/]+)\.log p.php?putfile=$1 \ No newline at end of file +RewriteRule ^(.*)$ p.php [QSA,L] + +RewriteCond %{THE_REQUEST} ^POST* +RewriteRule ^(.*)$ p.php [QSA,L] \ No newline at end of file diff --git a/provisioning/p.php b/provisioning/p.php index d223dbb1..422814ad 100755 --- a/provisioning/p.php +++ b/provisioning/p.php @@ -18,8 +18,23 @@ $provis_ip = $endpoint->global_cfg['srvip']; -if((isset($_REQUEST['putfile'])) && ((getMethod() == 'PUT') OR (getMethod() == 'POST'))) { +if(((getMethod() == 'PUT') OR (getMethod() == 'POST'))) { //write log files or other files to drive. not sussed out yet completely. + + /* PUT data comes in on the stdin stream */ + //$putdata = fopen("php://input", "r"); + + /* Open a file for writing */ + //$fp = fopen($endpoint->global_cfg['config_location'] . $_SERVER['REDIRECT_URL'], "a"); + + /* Read the data 1 KB at a time + and write to the file */ + //while ($data = fread($putdata, 1024)) + // fwrite($fp, $data); + + /* Close the streams */ + //fclose($fp); + //fclose($putdata); header('HTTP/1.1 200 OK'); die(); } From 9bf9673ce018690e49443a0e186c68756851e907 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 27 Mar 2012 13:14:01 -0700 Subject: [PATCH 282/623] Finally fix tooltips -They are hard to see in FreePBX 2.10... -Fixes #46 --- includes/functions.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index d34e68f3..4ac5398b 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1103,8 +1103,8 @@ class endpointmanager { break; } - if (isset($cfg_data['description_attr']['tooltip'])) { - $template_variables_array['tooltip'] = $cfg_data['description_attr']['tooltip']; + if (isset($cfg_data['tooltip'])) { + $template_variables_array['tooltip'] = htmlentities($cfg_data['tooltip']); } if (($this->global_cfg['enable_ari']) AND ($admin) AND ($cfg_data['type'] != "break") AND ($cfg_data['type'] != "group") AND ($template_type == 'GENERAL')) { From 6f6f577f74e7930e1e93798adb2dccb965484ee1 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Sun, 1 Apr 2012 22:44:53 -0700 Subject: [PATCH 283/623] Finally fix non-existant model error messages -http://www.freepbx.org/trac/ticket/5653 --- includes/functions.inc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/includes/functions.inc b/includes/functions.inc index 4ac5398b..f31e1314 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -2172,7 +2172,26 @@ class endpointmanager { echo "System Error in Sync Model Function, Load Failure!
      "; } } - //TODO: Phone Models Move Here + //Phone Models Move Here + $family_id = $brand_id . $family_line_xml['data']['id']; + $sql = "SELECT * FROM endpointman_model_list WHERE product_id = ".$family_id; + $products = $this->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); + foreach($products as $data) { + if(!$this->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { + echo "Moving/Removing Model '".$data['model']."' not present in JSON file......
      "; + $model_name = $data['model']; + $sql = 'DELETE FROM endpointman_model_list WHERE id = '.$data['id']; + $this->eda->sql($sql); + $sql = "SELECT id FROM endpointman_model_list WHERE model LIKE '".$model_name."'"; + $new_model_id = $this->eda->sql($sql,'getOne'); + if($new_model_id) { + $sql = "UPDATE endpointman_mac_list SET model = '".$new_model_id."' WHERE model = '".$data['id']."'"; + } else { + $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '".$data['id']."'"; + } + $this->eda->sql($sql); + } + } } foreach ($temp['data']['brands']['oui_list'] as $oui) { From ef7a90e80cd3a805651eee8dca64b03943a10a4c Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Sun, 1 Apr 2012 22:58:07 -0700 Subject: [PATCH 284/623] Fixing links on manual upload page -http://www.freepbx.org/trac/ticket/5617 --- templates/freepbx/advanced_settings_manual_upload.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/freepbx/advanced_settings_manual_upload.html b/templates/freepbx/advanced_settings_manual_upload.html index 104645dd..98539679 100644 --- a/templates/freepbx/advanced_settings_manual_upload.html +++ b/templates/freepbx/advanced_settings_manual_upload.html @@ -58,7 +58,7 @@ {/if}

      Import/Upload Packages

      -

      Note: These files can be downloaded from: http://www.provisioner.net/releases3

      +

      Note: These files can be downloaded from: http://wiki.provisioner.net/index.php/Releases

      + + + + '> From c5329fb0ed0a64862a42b76e8d9fd8a4808390ba Mon Sep 17 00:00:00 2001 From: root Date: Wed, 9 May 2012 23:38:42 -0700 Subject: [PATCH 287/623] More Changes --- .gitignore | 0 ENDPOINTMAN_LICENSE.txt | 0 README.md | 0 ajax_select.html.php | 0 ari/js/ajax_req.js | 0 ari/js/jquery-1.3.2.min.js | 0 ari/js/jquery.coda-slider-2.0.js | 0 ari/js/jquery.cookie.js | 0 ari/js/jquery.easing.1.3.js | 0 ari/js/jquery.js | 0 ari/js/jquery.jstree.js | 0 ari/js/jquery.tools.min.js | 0 ari/modules/phonesettings.module | 0 ari/theme/coda-slider-2.0a.css | 0 ari/theme/reset.css | 0 assets/css/coda-slider-2.0a.css | 0 assets/css/codemirror.css | 0 assets/css/default.css | 0 assets/css/main.css | 0 assets/css/reset.css | 0 assets/images/add.png | Bin assets/images/add_old.png | Bin assets/images/ajax-loader.gif | Bin assets/images/black_arrow.png | Bin assets/images/bullet_minus.png | Bin assets/images/bullet_plus.png | Bin assets/images/circle_green.png | Bin assets/images/circle_orange.png | Bin assets/images/circle_red.png | Bin assets/images/collapse.png | Bin assets/images/delete.gif | Bin assets/images/delete.png | Bin assets/images/edit.gif | Bin assets/images/edit.png | Bin assets/images/expand.png | Bin assets/images/trash.gif | Bin assets/js/ajax_req.js | 0 assets/js/codemirror.js | 0 assets/js/jquery.coda-slider-2.0.js | 0 assets/js/jquery.cookie.js | 0 assets/js/jquery.easing.1.3.js | 0 assets/js/jquery.form.js | 0 assets/js/jquery.jstree.js | 0 assets/js/jquery.tools.min.js | 0 assets/js/xml.js | 0 assets/theme/coda-slider-2.0a.css | 0 assets/theme/codemirror.css | 0 assets/theme/default.css | 0 assets/theme/main.css | 0 assets/theme/reset.css | 0 config.php | 0 etc/sip_notify_endpointman.conf | 0 export.html.php | 0 functions.inc.php | 0 i18n/endpointman.pot | 0 i18n/fr_FR/LC_MESSAGES/endpointman.mo | Bin i18n/fr_FR/LC_MESSAGES/endpointman.po | 0 i18n/he_IL/LC_MESSAGES/endpointman.mo | Bin i18n/he_IL/LC_MESSAGES/endpointman.po | 0 includes/abstraction/freepbx.inc | 0 includes/advanced.inc | 0 includes/ajax.inc | 0 includes/brand_model_manager.inc | 0 includes/devices_manager.inc | 0 includes/diff.class.inc | 0 includes/export.inc | 0 includes/functions.inc | 57 ++++++++++-------- includes/installer.inc | 0 includes/json.inc | 0 includes/pear_diff/Diff.php | 0 includes/pear_diff/Diff/Engine/native.php | 0 includes/pear_diff/Diff/Engine/shell.php | 0 includes/pear_diff/Diff/Engine/string.php | 0 includes/pear_diff/Diff/Engine/xdiff.php | 0 includes/pear_diff/Diff/Mapped.php | 0 includes/pear_diff/Diff/Renderer.php | 0 includes/pear_diff/Diff/Renderer/context.php | 0 includes/pear_diff/Diff/Renderer/inline.php | 0 includes/pear_diff/Diff/Renderer/unified.php | 0 includes/pear_diff/Diff/ThreeWay.php | 0 includes/pear_diff/Diff3.php | 0 includes/pear_diff/docs/examples/1.txt | 0 includes/pear_diff/docs/examples/2.txt | 0 includes/pear_diff/docs/examples/diff.php | 0 includes/pear_diff/tests/1.txt | 0 includes/pear_diff/tests/2.txt | 0 includes/pear_diff/tests/3.txt | 0 includes/pear_diff/tests/4.txt | 0 includes/pear_diff/tests/5.txt | 0 includes/pear_diff/tests/6.txt | 0 includes/pear_diff/tests/context.patch | 0 includes/pear_diff/tests/context.phpt | 0 includes/pear_diff/tests/context2.phpt | 0 includes/pear_diff/tests/diff.phpt | 0 includes/pear_diff/tests/inline.phpt | 0 includes/pear_diff/tests/inline2.phpt | 0 includes/pear_diff/tests/pear_bug12740.phpt | 0 includes/pear_diff/tests/pear_bug4879.phpt | 0 includes/pear_diff/tests/pear_bug6251.phpt | 0 includes/pear_diff/tests/pear_bug6428.phpt | 0 includes/pear_diff/tests/string.phpt | 0 includes/pear_diff/tests/unified.patch | 0 includes/pear_diff/tests/unified.phpt | 0 includes/pear_diff/tests/unified2.phpt | 0 includes/pear_diff/tests/xdiff.phpt | 0 includes/popup.inc | 0 includes/rain.error.inc | 0 includes/rain.tpl.class.inc | 0 includes/rain.tpl.compile.class.php | 0 includes/template_manager.inc | 0 includes/timezone.inc | 0 index.php | 0 install.php | 0 install/setup.php | 0 installer.html.php | 0 javascript.html.php | 0 module.xml | 0 page.endpointman.php | 0 page.epm_advanced.php | 0 page.epm_config.php | 0 page.epm_devices.php | 0 page.epm_templates.php | 0 popup.html.php | 0 provisioning/.htaccess | 0 templates/freepbx/advanced_settings_iedl.html | 0 .../advanced_settings_manual_upload.html | 0 templates/freepbx/advanced_settings_oui.html | 0 templates/freepbx/advanced_settings_poce.html | 0 .../freepbx/advanced_settings_settings.html | 0 .../freepbx/advanced_settings_sh_manager.html | 0 templates/freepbx/advanced_subheader.html | 0 templates/freepbx/alt_config_popup.html | 0 templates/freepbx/brand_model_manager.html | 0 templates/freepbx/credits.html | 0 templates/freepbx/devices_manager.html | 0 templates/freepbx/global_footer.html | 0 templates/freepbx/global_header.html | 0 templates/freepbx/global_links.html | 0 templates/freepbx/message_box.html | 0 templates/freepbx/specifics_pop.html | 0 templates/freepbx/template_editor.html | 0 templates/freepbx/template_manager.html | 0 templates/freepbx/variables.html | 0 uninstall.php | 0 144 files changed, 33 insertions(+), 24 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 ENDPOINTMAN_LICENSE.txt mode change 100644 => 100755 README.md mode change 100644 => 100755 ajax_select.html.php mode change 100644 => 100755 ari/js/ajax_req.js mode change 100644 => 100755 ari/js/jquery-1.3.2.min.js mode change 100644 => 100755 ari/js/jquery.coda-slider-2.0.js mode change 100644 => 100755 ari/js/jquery.cookie.js mode change 100644 => 100755 ari/js/jquery.easing.1.3.js mode change 100644 => 100755 ari/js/jquery.js mode change 100644 => 100755 ari/js/jquery.jstree.js mode change 100644 => 100755 ari/js/jquery.tools.min.js mode change 100644 => 100755 ari/modules/phonesettings.module mode change 100644 => 100755 ari/theme/coda-slider-2.0a.css mode change 100644 => 100755 ari/theme/reset.css mode change 100644 => 100755 assets/css/coda-slider-2.0a.css mode change 100644 => 100755 assets/css/codemirror.css mode change 100644 => 100755 assets/css/default.css mode change 100644 => 100755 assets/css/main.css mode change 100644 => 100755 assets/css/reset.css mode change 100644 => 100755 assets/images/add.png mode change 100644 => 100755 assets/images/add_old.png mode change 100644 => 100755 assets/images/ajax-loader.gif mode change 100644 => 100755 assets/images/black_arrow.png mode change 100644 => 100755 assets/images/bullet_minus.png mode change 100644 => 100755 assets/images/bullet_plus.png mode change 100644 => 100755 assets/images/circle_green.png mode change 100644 => 100755 assets/images/circle_orange.png mode change 100644 => 100755 assets/images/circle_red.png mode change 100644 => 100755 assets/images/collapse.png mode change 100644 => 100755 assets/images/delete.gif mode change 100644 => 100755 assets/images/delete.png mode change 100644 => 100755 assets/images/edit.gif mode change 100644 => 100755 assets/images/edit.png mode change 100644 => 100755 assets/images/expand.png mode change 100644 => 100755 assets/images/trash.gif mode change 100644 => 100755 assets/js/ajax_req.js mode change 100644 => 100755 assets/js/codemirror.js mode change 100644 => 100755 assets/js/jquery.coda-slider-2.0.js mode change 100644 => 100755 assets/js/jquery.cookie.js mode change 100644 => 100755 assets/js/jquery.easing.1.3.js mode change 100644 => 100755 assets/js/jquery.form.js mode change 100644 => 100755 assets/js/jquery.jstree.js mode change 100644 => 100755 assets/js/jquery.tools.min.js mode change 100644 => 100755 assets/js/xml.js mode change 100644 => 100755 assets/theme/coda-slider-2.0a.css mode change 100644 => 100755 assets/theme/codemirror.css mode change 100644 => 100755 assets/theme/default.css mode change 100644 => 100755 assets/theme/main.css mode change 100644 => 100755 assets/theme/reset.css mode change 100644 => 100755 config.php mode change 100644 => 100755 etc/sip_notify_endpointman.conf mode change 100644 => 100755 export.html.php mode change 100644 => 100755 functions.inc.php mode change 100644 => 100755 i18n/endpointman.pot mode change 100644 => 100755 i18n/fr_FR/LC_MESSAGES/endpointman.mo mode change 100644 => 100755 i18n/fr_FR/LC_MESSAGES/endpointman.po mode change 100644 => 100755 i18n/he_IL/LC_MESSAGES/endpointman.mo mode change 100644 => 100755 i18n/he_IL/LC_MESSAGES/endpointman.po mode change 100644 => 100755 includes/abstraction/freepbx.inc mode change 100644 => 100755 includes/advanced.inc mode change 100644 => 100755 includes/ajax.inc mode change 100644 => 100755 includes/brand_model_manager.inc mode change 100644 => 100755 includes/devices_manager.inc mode change 100644 => 100755 includes/diff.class.inc mode change 100644 => 100755 includes/export.inc mode change 100644 => 100755 includes/functions.inc mode change 100644 => 100755 includes/installer.inc mode change 100644 => 100755 includes/json.inc mode change 100644 => 100755 includes/pear_diff/Diff.php mode change 100644 => 100755 includes/pear_diff/Diff/Engine/native.php mode change 100644 => 100755 includes/pear_diff/Diff/Engine/shell.php mode change 100644 => 100755 includes/pear_diff/Diff/Engine/string.php mode change 100644 => 100755 includes/pear_diff/Diff/Engine/xdiff.php mode change 100644 => 100755 includes/pear_diff/Diff/Mapped.php mode change 100644 => 100755 includes/pear_diff/Diff/Renderer.php mode change 100644 => 100755 includes/pear_diff/Diff/Renderer/context.php mode change 100644 => 100755 includes/pear_diff/Diff/Renderer/inline.php mode change 100644 => 100755 includes/pear_diff/Diff/Renderer/unified.php mode change 100644 => 100755 includes/pear_diff/Diff/ThreeWay.php mode change 100644 => 100755 includes/pear_diff/Diff3.php mode change 100644 => 100755 includes/pear_diff/docs/examples/1.txt mode change 100644 => 100755 includes/pear_diff/docs/examples/2.txt mode change 100644 => 100755 includes/pear_diff/docs/examples/diff.php mode change 100644 => 100755 includes/pear_diff/tests/1.txt mode change 100644 => 100755 includes/pear_diff/tests/2.txt mode change 100644 => 100755 includes/pear_diff/tests/3.txt mode change 100644 => 100755 includes/pear_diff/tests/4.txt mode change 100644 => 100755 includes/pear_diff/tests/5.txt mode change 100644 => 100755 includes/pear_diff/tests/6.txt mode change 100644 => 100755 includes/pear_diff/tests/context.patch mode change 100644 => 100755 includes/pear_diff/tests/context.phpt mode change 100644 => 100755 includes/pear_diff/tests/context2.phpt mode change 100644 => 100755 includes/pear_diff/tests/diff.phpt mode change 100644 => 100755 includes/pear_diff/tests/inline.phpt mode change 100644 => 100755 includes/pear_diff/tests/inline2.phpt mode change 100644 => 100755 includes/pear_diff/tests/pear_bug12740.phpt mode change 100644 => 100755 includes/pear_diff/tests/pear_bug4879.phpt mode change 100644 => 100755 includes/pear_diff/tests/pear_bug6251.phpt mode change 100644 => 100755 includes/pear_diff/tests/pear_bug6428.phpt mode change 100644 => 100755 includes/pear_diff/tests/string.phpt mode change 100644 => 100755 includes/pear_diff/tests/unified.patch mode change 100644 => 100755 includes/pear_diff/tests/unified.phpt mode change 100644 => 100755 includes/pear_diff/tests/unified2.phpt mode change 100644 => 100755 includes/pear_diff/tests/xdiff.phpt mode change 100644 => 100755 includes/popup.inc mode change 100644 => 100755 includes/rain.error.inc mode change 100644 => 100755 includes/rain.tpl.class.inc mode change 100644 => 100755 includes/rain.tpl.compile.class.php mode change 100644 => 100755 includes/template_manager.inc mode change 100644 => 100755 includes/timezone.inc mode change 100644 => 100755 index.php mode change 100644 => 100755 install.php mode change 100644 => 100755 install/setup.php mode change 100644 => 100755 installer.html.php mode change 100644 => 100755 javascript.html.php mode change 100644 => 100755 module.xml mode change 100644 => 100755 page.endpointman.php mode change 100644 => 100755 page.epm_advanced.php mode change 100644 => 100755 page.epm_config.php mode change 100644 => 100755 page.epm_devices.php mode change 100644 => 100755 page.epm_templates.php mode change 100644 => 100755 popup.html.php mode change 100644 => 100755 provisioning/.htaccess mode change 100644 => 100755 templates/freepbx/advanced_settings_iedl.html mode change 100644 => 100755 templates/freepbx/advanced_settings_manual_upload.html mode change 100644 => 100755 templates/freepbx/advanced_settings_oui.html mode change 100644 => 100755 templates/freepbx/advanced_settings_poce.html mode change 100644 => 100755 templates/freepbx/advanced_settings_settings.html mode change 100644 => 100755 templates/freepbx/advanced_settings_sh_manager.html mode change 100644 => 100755 templates/freepbx/advanced_subheader.html mode change 100644 => 100755 templates/freepbx/alt_config_popup.html mode change 100644 => 100755 templates/freepbx/brand_model_manager.html mode change 100644 => 100755 templates/freepbx/credits.html mode change 100644 => 100755 templates/freepbx/devices_manager.html mode change 100644 => 100755 templates/freepbx/global_footer.html mode change 100644 => 100755 templates/freepbx/global_header.html mode change 100644 => 100755 templates/freepbx/global_links.html mode change 100644 => 100755 templates/freepbx/message_box.html mode change 100644 => 100755 templates/freepbx/specifics_pop.html mode change 100644 => 100755 templates/freepbx/template_editor.html mode change 100644 => 100755 templates/freepbx/template_manager.html mode change 100644 => 100755 templates/freepbx/variables.html mode change 100644 => 100755 uninstall.php diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/ENDPOINTMAN_LICENSE.txt b/ENDPOINTMAN_LICENSE.txt old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/ajax_select.html.php b/ajax_select.html.php old mode 100644 new mode 100755 diff --git a/ari/js/ajax_req.js b/ari/js/ajax_req.js old mode 100644 new mode 100755 diff --git a/ari/js/jquery-1.3.2.min.js b/ari/js/jquery-1.3.2.min.js old mode 100644 new mode 100755 diff --git a/ari/js/jquery.coda-slider-2.0.js b/ari/js/jquery.coda-slider-2.0.js old mode 100644 new mode 100755 diff --git a/ari/js/jquery.cookie.js b/ari/js/jquery.cookie.js old mode 100644 new mode 100755 diff --git a/ari/js/jquery.easing.1.3.js b/ari/js/jquery.easing.1.3.js old mode 100644 new mode 100755 diff --git a/ari/js/jquery.js b/ari/js/jquery.js old mode 100644 new mode 100755 diff --git a/ari/js/jquery.jstree.js b/ari/js/jquery.jstree.js old mode 100644 new mode 100755 diff --git a/ari/js/jquery.tools.min.js b/ari/js/jquery.tools.min.js old mode 100644 new mode 100755 diff --git a/ari/modules/phonesettings.module b/ari/modules/phonesettings.module old mode 100644 new mode 100755 diff --git a/ari/theme/coda-slider-2.0a.css b/ari/theme/coda-slider-2.0a.css old mode 100644 new mode 100755 diff --git a/ari/theme/reset.css b/ari/theme/reset.css old mode 100644 new mode 100755 diff --git a/assets/css/coda-slider-2.0a.css b/assets/css/coda-slider-2.0a.css old mode 100644 new mode 100755 diff --git a/assets/css/codemirror.css b/assets/css/codemirror.css old mode 100644 new mode 100755 diff --git a/assets/css/default.css b/assets/css/default.css old mode 100644 new mode 100755 diff --git a/assets/css/main.css b/assets/css/main.css old mode 100644 new mode 100755 diff --git a/assets/css/reset.css b/assets/css/reset.css old mode 100644 new mode 100755 diff --git a/assets/images/add.png b/assets/images/add.png old mode 100644 new mode 100755 diff --git a/assets/images/add_old.png b/assets/images/add_old.png old mode 100644 new mode 100755 diff --git a/assets/images/ajax-loader.gif b/assets/images/ajax-loader.gif old mode 100644 new mode 100755 diff --git a/assets/images/black_arrow.png b/assets/images/black_arrow.png old mode 100644 new mode 100755 diff --git a/assets/images/bullet_minus.png b/assets/images/bullet_minus.png old mode 100644 new mode 100755 diff --git a/assets/images/bullet_plus.png b/assets/images/bullet_plus.png old mode 100644 new mode 100755 diff --git a/assets/images/circle_green.png b/assets/images/circle_green.png old mode 100644 new mode 100755 diff --git a/assets/images/circle_orange.png b/assets/images/circle_orange.png old mode 100644 new mode 100755 diff --git a/assets/images/circle_red.png b/assets/images/circle_red.png old mode 100644 new mode 100755 diff --git a/assets/images/collapse.png b/assets/images/collapse.png old mode 100644 new mode 100755 diff --git a/assets/images/delete.gif b/assets/images/delete.gif old mode 100644 new mode 100755 diff --git a/assets/images/delete.png b/assets/images/delete.png old mode 100644 new mode 100755 diff --git a/assets/images/edit.gif b/assets/images/edit.gif old mode 100644 new mode 100755 diff --git a/assets/images/edit.png b/assets/images/edit.png old mode 100644 new mode 100755 diff --git a/assets/images/expand.png b/assets/images/expand.png old mode 100644 new mode 100755 diff --git a/assets/images/trash.gif b/assets/images/trash.gif old mode 100644 new mode 100755 diff --git a/assets/js/ajax_req.js b/assets/js/ajax_req.js old mode 100644 new mode 100755 diff --git a/assets/js/codemirror.js b/assets/js/codemirror.js old mode 100644 new mode 100755 diff --git a/assets/js/jquery.coda-slider-2.0.js b/assets/js/jquery.coda-slider-2.0.js old mode 100644 new mode 100755 diff --git a/assets/js/jquery.cookie.js b/assets/js/jquery.cookie.js old mode 100644 new mode 100755 diff --git a/assets/js/jquery.easing.1.3.js b/assets/js/jquery.easing.1.3.js old mode 100644 new mode 100755 diff --git a/assets/js/jquery.form.js b/assets/js/jquery.form.js old mode 100644 new mode 100755 diff --git a/assets/js/jquery.jstree.js b/assets/js/jquery.jstree.js old mode 100644 new mode 100755 diff --git a/assets/js/jquery.tools.min.js b/assets/js/jquery.tools.min.js old mode 100644 new mode 100755 diff --git a/assets/js/xml.js b/assets/js/xml.js old mode 100644 new mode 100755 diff --git a/assets/theme/coda-slider-2.0a.css b/assets/theme/coda-slider-2.0a.css old mode 100644 new mode 100755 diff --git a/assets/theme/codemirror.css b/assets/theme/codemirror.css old mode 100644 new mode 100755 diff --git a/assets/theme/default.css b/assets/theme/default.css old mode 100644 new mode 100755 diff --git a/assets/theme/main.css b/assets/theme/main.css old mode 100644 new mode 100755 diff --git a/assets/theme/reset.css b/assets/theme/reset.css old mode 100644 new mode 100755 diff --git a/config.php b/config.php old mode 100644 new mode 100755 diff --git a/etc/sip_notify_endpointman.conf b/etc/sip_notify_endpointman.conf old mode 100644 new mode 100755 diff --git a/export.html.php b/export.html.php old mode 100644 new mode 100755 diff --git a/functions.inc.php b/functions.inc.php old mode 100644 new mode 100755 diff --git a/i18n/endpointman.pot b/i18n/endpointman.pot old mode 100644 new mode 100755 diff --git a/i18n/fr_FR/LC_MESSAGES/endpointman.mo b/i18n/fr_FR/LC_MESSAGES/endpointman.mo old mode 100644 new mode 100755 diff --git a/i18n/fr_FR/LC_MESSAGES/endpointman.po b/i18n/fr_FR/LC_MESSAGES/endpointman.po old mode 100644 new mode 100755 diff --git a/i18n/he_IL/LC_MESSAGES/endpointman.mo b/i18n/he_IL/LC_MESSAGES/endpointman.mo old mode 100644 new mode 100755 diff --git a/i18n/he_IL/LC_MESSAGES/endpointman.po b/i18n/he_IL/LC_MESSAGES/endpointman.po old mode 100644 new mode 100755 diff --git a/includes/abstraction/freepbx.inc b/includes/abstraction/freepbx.inc old mode 100644 new mode 100755 diff --git a/includes/advanced.inc b/includes/advanced.inc old mode 100644 new mode 100755 diff --git a/includes/ajax.inc b/includes/ajax.inc old mode 100644 new mode 100755 diff --git a/includes/brand_model_manager.inc b/includes/brand_model_manager.inc old mode 100644 new mode 100755 diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc old mode 100644 new mode 100755 diff --git a/includes/diff.class.inc b/includes/diff.class.inc old mode 100644 new mode 100755 diff --git a/includes/export.inc b/includes/export.inc old mode 100644 new mode 100755 diff --git a/includes/functions.inc b/includes/functions.inc old mode 100644 new mode 100755 index 87af618a..6a282426 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1926,6 +1926,11 @@ class endpointmanager { $this->error['remote_server'] = "The Remote Server Is Currently Syncing With the Master Server, Please try again later"; } } else { + $o = getcwd(); + chdir(dirname(PHONE_MODULES_PATH)); + $path = $this->has_git(); + exec($path.' git pull',$output); + chdir($o); $temp = $this->file2json(PHONE_MODULES_PATH . 'endpoint/master.json'); $endpoint_package = $temp['data']['package']; $endpoint_last_mod = $temp['data']['last_modified']; @@ -2322,30 +2327,34 @@ class endpointmanager { * @param int $id Brand ID */ function remove_brand($id=NULL, $remove_configs=FALSE) { - $sql = 'SELECT id, firmware_vers FROM endpointman_product_list WHERE brand = ' . $id; - $products = $this->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); - foreach ($products as $data) { - if ($data['firmware_vers'] != "") { - $this->remove_firmware($data['id']); - } - } - - $brand_dir = $this->eda->sql("SELECT directory FROM endpointman_brand_list WHERE id=" . $id, 'getone'); - $this->rmrf(PHONE_MODULES_PATH . "endpoint/" . $brand_dir); - - $sql = "DELETE FROM endpointman_model_list WHERE brand = '" . $id . "'"; - $this->eda->sql($sql); - - $sql = "DELETE FROM endpointman_product_list WHERE brand = '" . $id . "'"; - $this->eda->sql($sql); - - $sql = "DELETE FROM endpointman_oui_list WHERE brand = '" . $id . "'"; - $this->eda->sql($sql); - - $this->rmrf(PHONE_MODULES_PATH . $brand_dir); - $sql = "DELETE FROM endpointman_brand_list WHERE id = " . $id; - - $this->eda->sql($sql); + if(!$this->global_cfg['use_repo']) { + $sql = 'SELECT id, firmware_vers FROM endpointman_product_list WHERE brand = ' . $id; + $products = $this->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); + foreach ($products as $data) { + if ($data['firmware_vers'] != "") { + $this->remove_firmware($data['id']); + } + } + + $brand_dir = $this->eda->sql("SELECT directory FROM endpointman_brand_list WHERE id=" . $id, 'getone'); + $this->rmrf(PHONE_MODULES_PATH . "endpoint/" . $brand_dir); + + $sql = "DELETE FROM endpointman_model_list WHERE brand = '" . $id . "'"; + $this->eda->sql($sql); + + $sql = "DELETE FROM endpointman_product_list WHERE brand = '" . $id . "'"; + $this->eda->sql($sql); + + $sql = "DELETE FROM endpointman_oui_list WHERE brand = '" . $id . "'"; + $this->eda->sql($sql); + + $this->rmrf(PHONE_MODULES_PATH . $brand_dir); + $sql = "DELETE FROM endpointman_brand_list WHERE id = " . $id; + + $this->eda->sql($sql); + } else { + $this->error['remove_brand'] = "Not allowed in repo mode"; + } } function merge_data($path, $template_list, $maxlines = 3) { diff --git a/includes/installer.inc b/includes/installer.inc old mode 100644 new mode 100755 diff --git a/includes/json.inc b/includes/json.inc old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff.php b/includes/pear_diff/Diff.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff/Engine/native.php b/includes/pear_diff/Diff/Engine/native.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff/Engine/shell.php b/includes/pear_diff/Diff/Engine/shell.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff/Engine/string.php b/includes/pear_diff/Diff/Engine/string.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff/Engine/xdiff.php b/includes/pear_diff/Diff/Engine/xdiff.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff/Mapped.php b/includes/pear_diff/Diff/Mapped.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff/Renderer.php b/includes/pear_diff/Diff/Renderer.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff/Renderer/context.php b/includes/pear_diff/Diff/Renderer/context.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff/Renderer/inline.php b/includes/pear_diff/Diff/Renderer/inline.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff/Renderer/unified.php b/includes/pear_diff/Diff/Renderer/unified.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff/ThreeWay.php b/includes/pear_diff/Diff/ThreeWay.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/Diff3.php b/includes/pear_diff/Diff3.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/docs/examples/1.txt b/includes/pear_diff/docs/examples/1.txt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/docs/examples/2.txt b/includes/pear_diff/docs/examples/2.txt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/docs/examples/diff.php b/includes/pear_diff/docs/examples/diff.php old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/1.txt b/includes/pear_diff/tests/1.txt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/2.txt b/includes/pear_diff/tests/2.txt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/3.txt b/includes/pear_diff/tests/3.txt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/4.txt b/includes/pear_diff/tests/4.txt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/5.txt b/includes/pear_diff/tests/5.txt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/6.txt b/includes/pear_diff/tests/6.txt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/context.patch b/includes/pear_diff/tests/context.patch old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/context.phpt b/includes/pear_diff/tests/context.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/context2.phpt b/includes/pear_diff/tests/context2.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/diff.phpt b/includes/pear_diff/tests/diff.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/inline.phpt b/includes/pear_diff/tests/inline.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/inline2.phpt b/includes/pear_diff/tests/inline2.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/pear_bug12740.phpt b/includes/pear_diff/tests/pear_bug12740.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/pear_bug4879.phpt b/includes/pear_diff/tests/pear_bug4879.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/pear_bug6251.phpt b/includes/pear_diff/tests/pear_bug6251.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/pear_bug6428.phpt b/includes/pear_diff/tests/pear_bug6428.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/string.phpt b/includes/pear_diff/tests/string.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/unified.patch b/includes/pear_diff/tests/unified.patch old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/unified.phpt b/includes/pear_diff/tests/unified.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/unified2.phpt b/includes/pear_diff/tests/unified2.phpt old mode 100644 new mode 100755 diff --git a/includes/pear_diff/tests/xdiff.phpt b/includes/pear_diff/tests/xdiff.phpt old mode 100644 new mode 100755 diff --git a/includes/popup.inc b/includes/popup.inc old mode 100644 new mode 100755 diff --git a/includes/rain.error.inc b/includes/rain.error.inc old mode 100644 new mode 100755 diff --git a/includes/rain.tpl.class.inc b/includes/rain.tpl.class.inc old mode 100644 new mode 100755 diff --git a/includes/rain.tpl.compile.class.php b/includes/rain.tpl.compile.class.php old mode 100644 new mode 100755 diff --git a/includes/template_manager.inc b/includes/template_manager.inc old mode 100644 new mode 100755 diff --git a/includes/timezone.inc b/includes/timezone.inc old mode 100644 new mode 100755 diff --git a/index.php b/index.php old mode 100644 new mode 100755 diff --git a/install.php b/install.php old mode 100644 new mode 100755 diff --git a/install/setup.php b/install/setup.php old mode 100644 new mode 100755 diff --git a/installer.html.php b/installer.html.php old mode 100644 new mode 100755 diff --git a/javascript.html.php b/javascript.html.php old mode 100644 new mode 100755 diff --git a/module.xml b/module.xml old mode 100644 new mode 100755 diff --git a/page.endpointman.php b/page.endpointman.php old mode 100644 new mode 100755 diff --git a/page.epm_advanced.php b/page.epm_advanced.php old mode 100644 new mode 100755 diff --git a/page.epm_config.php b/page.epm_config.php old mode 100644 new mode 100755 diff --git a/page.epm_devices.php b/page.epm_devices.php old mode 100644 new mode 100755 diff --git a/page.epm_templates.php b/page.epm_templates.php old mode 100644 new mode 100755 diff --git a/popup.html.php b/popup.html.php old mode 100644 new mode 100755 diff --git a/provisioning/.htaccess b/provisioning/.htaccess old mode 100644 new mode 100755 diff --git a/templates/freepbx/advanced_settings_iedl.html b/templates/freepbx/advanced_settings_iedl.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/advanced_settings_manual_upload.html b/templates/freepbx/advanced_settings_manual_upload.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/advanced_settings_oui.html b/templates/freepbx/advanced_settings_oui.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/advanced_settings_poce.html b/templates/freepbx/advanced_settings_poce.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/advanced_settings_sh_manager.html b/templates/freepbx/advanced_settings_sh_manager.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/advanced_subheader.html b/templates/freepbx/advanced_subheader.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/alt_config_popup.html b/templates/freepbx/alt_config_popup.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/brand_model_manager.html b/templates/freepbx/brand_model_manager.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/credits.html b/templates/freepbx/credits.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/devices_manager.html b/templates/freepbx/devices_manager.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/global_footer.html b/templates/freepbx/global_footer.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/global_header.html b/templates/freepbx/global_header.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/global_links.html b/templates/freepbx/global_links.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/message_box.html b/templates/freepbx/message_box.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/specifics_pop.html b/templates/freepbx/specifics_pop.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/template_editor.html b/templates/freepbx/template_editor.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/template_manager.html b/templates/freepbx/template_manager.html old mode 100644 new mode 100755 diff --git a/templates/freepbx/variables.html b/templates/freepbx/variables.html old mode 100644 new mode 100755 diff --git a/uninstall.php b/uninstall.php old mode 100644 new mode 100755 From 1ffbcabd6e804f9c63e5796005ca834c0158c234 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Wed, 9 May 2012 23:39:32 -0700 Subject: [PATCH 288/623] Stupid Permissions --- .gitignore | 0 ENDPOINTMAN_LICENSE.txt | 0 README.md | 0 ajax_select.html.php | 0 ari/js/ajax_req.js | 0 ari/js/jquery-1.3.2.min.js | 0 ari/js/jquery.coda-slider-2.0.js | 0 ari/js/jquery.cookie.js | 0 ari/js/jquery.easing.1.3.js | 0 ari/js/jquery.js | 0 ari/js/jquery.jstree.js | 0 ari/js/jquery.tools.min.js | 0 ari/modules/phonesettings.module | 0 ari/theme/coda-slider-2.0a.css | 0 ari/theme/reset.css | 0 assets/css/coda-slider-2.0a.css | 0 assets/css/codemirror.css | 0 assets/css/default.css | 0 assets/css/main.css | 0 assets/css/reset.css | 0 assets/images/.htaccess | 0 assets/images/add.png | Bin assets/images/add_old.png | Bin assets/images/ajax-loader.gif | Bin assets/images/black_arrow.png | Bin assets/images/bullet_minus.png | Bin assets/images/bullet_plus.png | Bin assets/images/circle_green.png | Bin assets/images/circle_orange.png | Bin assets/images/circle_red.png | Bin assets/images/collapse.png | Bin assets/images/delete.gif | Bin assets/images/delete.png | Bin assets/images/edit.gif | Bin assets/images/edit.png | Bin assets/images/expand.png | Bin assets/images/trash.gif | Bin assets/js/ajax_req.js | 0 assets/js/codemirror.js | 0 assets/js/jquery.coda-slider-2.0.js | 0 assets/js/jquery.cookie.js | 0 assets/js/jquery.easing.1.3.js | 0 assets/js/jquery.form.js | 0 assets/js/jquery.jstree.js | 0 assets/js/jquery.tools.min.js | 0 assets/js/xml.js | 0 assets/theme/coda-slider-2.0a.css | 0 assets/theme/codemirror.css | 0 assets/theme/default.css | 0 assets/theme/main.css | 0 assets/theme/reset.css | 0 config.php | 0 emportal | 0 etc/sip_notify_endpointman.conf | 0 export.html.php | 0 functions.inc.php | 0 i18n/endpointman.pot | 0 i18n/fr_FR/LC_MESSAGES/endpointman.mo | Bin i18n/fr_FR/LC_MESSAGES/endpointman.po | 0 i18n/he_IL/LC_MESSAGES/endpointman.mo | Bin i18n/he_IL/LC_MESSAGES/endpointman.po | 0 includes/abstraction/freepbx.inc | 0 includes/advanced.inc | 0 includes/ajax.inc | 0 includes/brand_model_manager.inc | 0 includes/devices_manager.inc | 0 includes/diff.class.inc | 0 includes/export.inc | 0 includes/functions.inc | 0 includes/installer.inc | 0 includes/json.inc | 0 includes/pear_diff/Diff.php | 0 includes/pear_diff/Diff/Engine/native.php | 0 includes/pear_diff/Diff/Engine/shell.php | 0 includes/pear_diff/Diff/Engine/string.php | 0 includes/pear_diff/Diff/Engine/xdiff.php | 0 includes/pear_diff/Diff/Mapped.php | 0 includes/pear_diff/Diff/Renderer.php | 0 includes/pear_diff/Diff/Renderer/context.php | 0 includes/pear_diff/Diff/Renderer/inline.php | 0 includes/pear_diff/Diff/Renderer/unified.php | 0 includes/pear_diff/Diff/ThreeWay.php | 0 includes/pear_diff/Diff3.php | 0 includes/pear_diff/docs/examples/1.txt | 0 includes/pear_diff/docs/examples/2.txt | 0 includes/pear_diff/docs/examples/diff.php | 0 includes/pear_diff/tests/1.txt | 0 includes/pear_diff/tests/2.txt | 0 includes/pear_diff/tests/3.txt | 0 includes/pear_diff/tests/4.txt | 0 includes/pear_diff/tests/5.txt | 0 includes/pear_diff/tests/6.txt | 0 includes/pear_diff/tests/context.patch | 0 includes/pear_diff/tests/context.phpt | 0 includes/pear_diff/tests/context2.phpt | 0 includes/pear_diff/tests/diff.phpt | 0 includes/pear_diff/tests/inline.phpt | 0 includes/pear_diff/tests/inline2.phpt | 0 includes/pear_diff/tests/pear_bug12740.phpt | 0 includes/pear_diff/tests/pear_bug4879.phpt | 0 includes/pear_diff/tests/pear_bug6251.phpt | 0 includes/pear_diff/tests/pear_bug6428.phpt | 0 includes/pear_diff/tests/string.phpt | 0 includes/pear_diff/tests/unified.patch | 0 includes/pear_diff/tests/unified.phpt | 0 includes/pear_diff/tests/unified2.phpt | 0 includes/pear_diff/tests/xdiff.phpt | 0 includes/popup.inc | 0 includes/rain.error.inc | 0 includes/rain.tpl.class.inc | 0 includes/rain.tpl.compile.class.php | 0 includes/template_manager.inc | 0 includes/timezone.inc | 0 index.php | 0 install.php | 0 install/phonesettings.module | 0 install/setup.php | 0 installer.html.php | 0 javascript.html.php | 0 module.xml | 0 page.endpointman.php | 0 page.epm_advanced.php | 0 page.epm_config.php | 0 page.epm_devices.php | 0 page.epm_templates.php | 0 popup.html.php | 0 provisioning/.htaccess | 0 provisioning/p.php | 0 templates/freepbx/advanced_settings_iedl.html | 0 .../freepbx/advanced_settings_manual_upload.html | 0 templates/freepbx/advanced_settings_oui.html | 0 templates/freepbx/advanced_settings_poce.html | 0 templates/freepbx/advanced_settings_settings.html | 0 .../freepbx/advanced_settings_settings_pop.html | 0 templates/freepbx/advanced_settings_sh_manager.html | 0 templates/freepbx/advanced_subheader.html | 0 templates/freepbx/alt_config_popup.html | 0 templates/freepbx/brand_model_manager.html | 0 templates/freepbx/credits.html | 0 templates/freepbx/devices_manager.html | 0 templates/freepbx/global_footer.html | 0 templates/freepbx/global_header.html | 0 templates/freepbx/global_links.html | 0 templates/freepbx/message_box.html | 0 templates/freepbx/specifics_pop.html | 0 templates/freepbx/template_editor.html | 0 templates/freepbx/template_manager.html | 0 templates/freepbx/variables.html | 0 uninstall.php | 0 149 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 .gitignore mode change 100755 => 100644 ENDPOINTMAN_LICENSE.txt mode change 100755 => 100644 README.md mode change 100755 => 100644 ajax_select.html.php mode change 100755 => 100644 ari/js/ajax_req.js mode change 100755 => 100644 ari/js/jquery-1.3.2.min.js mode change 100755 => 100644 ari/js/jquery.coda-slider-2.0.js mode change 100755 => 100644 ari/js/jquery.cookie.js mode change 100755 => 100644 ari/js/jquery.easing.1.3.js mode change 100755 => 100644 ari/js/jquery.js mode change 100755 => 100644 ari/js/jquery.jstree.js mode change 100755 => 100644 ari/js/jquery.tools.min.js mode change 100755 => 100644 ari/modules/phonesettings.module mode change 100755 => 100644 ari/theme/coda-slider-2.0a.css mode change 100755 => 100644 ari/theme/reset.css mode change 100755 => 100644 assets/css/coda-slider-2.0a.css mode change 100755 => 100644 assets/css/codemirror.css mode change 100755 => 100644 assets/css/default.css mode change 100755 => 100644 assets/css/main.css mode change 100755 => 100644 assets/css/reset.css mode change 100755 => 100644 assets/images/.htaccess mode change 100755 => 100644 assets/images/add.png mode change 100755 => 100644 assets/images/add_old.png mode change 100755 => 100644 assets/images/ajax-loader.gif mode change 100755 => 100644 assets/images/black_arrow.png mode change 100755 => 100644 assets/images/bullet_minus.png mode change 100755 => 100644 assets/images/bullet_plus.png mode change 100755 => 100644 assets/images/circle_green.png mode change 100755 => 100644 assets/images/circle_orange.png mode change 100755 => 100644 assets/images/circle_red.png mode change 100755 => 100644 assets/images/collapse.png mode change 100755 => 100644 assets/images/delete.gif mode change 100755 => 100644 assets/images/delete.png mode change 100755 => 100644 assets/images/edit.gif mode change 100755 => 100644 assets/images/edit.png mode change 100755 => 100644 assets/images/expand.png mode change 100755 => 100644 assets/images/trash.gif mode change 100755 => 100644 assets/js/ajax_req.js mode change 100755 => 100644 assets/js/codemirror.js mode change 100755 => 100644 assets/js/jquery.coda-slider-2.0.js mode change 100755 => 100644 assets/js/jquery.cookie.js mode change 100755 => 100644 assets/js/jquery.easing.1.3.js mode change 100755 => 100644 assets/js/jquery.form.js mode change 100755 => 100644 assets/js/jquery.jstree.js mode change 100755 => 100644 assets/js/jquery.tools.min.js mode change 100755 => 100644 assets/js/xml.js mode change 100755 => 100644 assets/theme/coda-slider-2.0a.css mode change 100755 => 100644 assets/theme/codemirror.css mode change 100755 => 100644 assets/theme/default.css mode change 100755 => 100644 assets/theme/main.css mode change 100755 => 100644 assets/theme/reset.css mode change 100755 => 100644 config.php mode change 100755 => 100644 emportal mode change 100755 => 100644 etc/sip_notify_endpointman.conf mode change 100755 => 100644 export.html.php mode change 100755 => 100644 functions.inc.php mode change 100755 => 100644 i18n/endpointman.pot mode change 100755 => 100644 i18n/fr_FR/LC_MESSAGES/endpointman.mo mode change 100755 => 100644 i18n/fr_FR/LC_MESSAGES/endpointman.po mode change 100755 => 100644 i18n/he_IL/LC_MESSAGES/endpointman.mo mode change 100755 => 100644 i18n/he_IL/LC_MESSAGES/endpointman.po mode change 100755 => 100644 includes/abstraction/freepbx.inc mode change 100755 => 100644 includes/advanced.inc mode change 100755 => 100644 includes/ajax.inc mode change 100755 => 100644 includes/brand_model_manager.inc mode change 100755 => 100644 includes/devices_manager.inc mode change 100755 => 100644 includes/diff.class.inc mode change 100755 => 100644 includes/export.inc mode change 100755 => 100644 includes/functions.inc mode change 100755 => 100644 includes/installer.inc mode change 100755 => 100644 includes/json.inc mode change 100755 => 100644 includes/pear_diff/Diff.php mode change 100755 => 100644 includes/pear_diff/Diff/Engine/native.php mode change 100755 => 100644 includes/pear_diff/Diff/Engine/shell.php mode change 100755 => 100644 includes/pear_diff/Diff/Engine/string.php mode change 100755 => 100644 includes/pear_diff/Diff/Engine/xdiff.php mode change 100755 => 100644 includes/pear_diff/Diff/Mapped.php mode change 100755 => 100644 includes/pear_diff/Diff/Renderer.php mode change 100755 => 100644 includes/pear_diff/Diff/Renderer/context.php mode change 100755 => 100644 includes/pear_diff/Diff/Renderer/inline.php mode change 100755 => 100644 includes/pear_diff/Diff/Renderer/unified.php mode change 100755 => 100644 includes/pear_diff/Diff/ThreeWay.php mode change 100755 => 100644 includes/pear_diff/Diff3.php mode change 100755 => 100644 includes/pear_diff/docs/examples/1.txt mode change 100755 => 100644 includes/pear_diff/docs/examples/2.txt mode change 100755 => 100644 includes/pear_diff/docs/examples/diff.php mode change 100755 => 100644 includes/pear_diff/tests/1.txt mode change 100755 => 100644 includes/pear_diff/tests/2.txt mode change 100755 => 100644 includes/pear_diff/tests/3.txt mode change 100755 => 100644 includes/pear_diff/tests/4.txt mode change 100755 => 100644 includes/pear_diff/tests/5.txt mode change 100755 => 100644 includes/pear_diff/tests/6.txt mode change 100755 => 100644 includes/pear_diff/tests/context.patch mode change 100755 => 100644 includes/pear_diff/tests/context.phpt mode change 100755 => 100644 includes/pear_diff/tests/context2.phpt mode change 100755 => 100644 includes/pear_diff/tests/diff.phpt mode change 100755 => 100644 includes/pear_diff/tests/inline.phpt mode change 100755 => 100644 includes/pear_diff/tests/inline2.phpt mode change 100755 => 100644 includes/pear_diff/tests/pear_bug12740.phpt mode change 100755 => 100644 includes/pear_diff/tests/pear_bug4879.phpt mode change 100755 => 100644 includes/pear_diff/tests/pear_bug6251.phpt mode change 100755 => 100644 includes/pear_diff/tests/pear_bug6428.phpt mode change 100755 => 100644 includes/pear_diff/tests/string.phpt mode change 100755 => 100644 includes/pear_diff/tests/unified.patch mode change 100755 => 100644 includes/pear_diff/tests/unified.phpt mode change 100755 => 100644 includes/pear_diff/tests/unified2.phpt mode change 100755 => 100644 includes/pear_diff/tests/xdiff.phpt mode change 100755 => 100644 includes/popup.inc mode change 100755 => 100644 includes/rain.error.inc mode change 100755 => 100644 includes/rain.tpl.class.inc mode change 100755 => 100644 includes/rain.tpl.compile.class.php mode change 100755 => 100644 includes/template_manager.inc mode change 100755 => 100644 includes/timezone.inc mode change 100755 => 100644 index.php mode change 100755 => 100644 install.php mode change 100755 => 100644 install/phonesettings.module mode change 100755 => 100644 install/setup.php mode change 100755 => 100644 installer.html.php mode change 100755 => 100644 javascript.html.php mode change 100755 => 100644 module.xml mode change 100755 => 100644 page.endpointman.php mode change 100755 => 100644 page.epm_advanced.php mode change 100755 => 100644 page.epm_config.php mode change 100755 => 100644 page.epm_devices.php mode change 100755 => 100644 page.epm_templates.php mode change 100755 => 100644 popup.html.php mode change 100755 => 100644 provisioning/.htaccess mode change 100755 => 100644 provisioning/p.php mode change 100755 => 100644 templates/freepbx/advanced_settings_iedl.html mode change 100755 => 100644 templates/freepbx/advanced_settings_manual_upload.html mode change 100755 => 100644 templates/freepbx/advanced_settings_oui.html mode change 100755 => 100644 templates/freepbx/advanced_settings_poce.html mode change 100755 => 100644 templates/freepbx/advanced_settings_settings.html mode change 100755 => 100644 templates/freepbx/advanced_settings_settings_pop.html mode change 100755 => 100644 templates/freepbx/advanced_settings_sh_manager.html mode change 100755 => 100644 templates/freepbx/advanced_subheader.html mode change 100755 => 100644 templates/freepbx/alt_config_popup.html mode change 100755 => 100644 templates/freepbx/brand_model_manager.html mode change 100755 => 100644 templates/freepbx/credits.html mode change 100755 => 100644 templates/freepbx/devices_manager.html mode change 100755 => 100644 templates/freepbx/global_footer.html mode change 100755 => 100644 templates/freepbx/global_header.html mode change 100755 => 100644 templates/freepbx/global_links.html mode change 100755 => 100644 templates/freepbx/message_box.html mode change 100755 => 100644 templates/freepbx/specifics_pop.html mode change 100755 => 100644 templates/freepbx/template_editor.html mode change 100755 => 100644 templates/freepbx/template_manager.html mode change 100755 => 100644 templates/freepbx/variables.html mode change 100755 => 100644 uninstall.php diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/ENDPOINTMAN_LICENSE.txt b/ENDPOINTMAN_LICENSE.txt old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/ajax_select.html.php b/ajax_select.html.php old mode 100755 new mode 100644 diff --git a/ari/js/ajax_req.js b/ari/js/ajax_req.js old mode 100755 new mode 100644 diff --git a/ari/js/jquery-1.3.2.min.js b/ari/js/jquery-1.3.2.min.js old mode 100755 new mode 100644 diff --git a/ari/js/jquery.coda-slider-2.0.js b/ari/js/jquery.coda-slider-2.0.js old mode 100755 new mode 100644 diff --git a/ari/js/jquery.cookie.js b/ari/js/jquery.cookie.js old mode 100755 new mode 100644 diff --git a/ari/js/jquery.easing.1.3.js b/ari/js/jquery.easing.1.3.js old mode 100755 new mode 100644 diff --git a/ari/js/jquery.js b/ari/js/jquery.js old mode 100755 new mode 100644 diff --git a/ari/js/jquery.jstree.js b/ari/js/jquery.jstree.js old mode 100755 new mode 100644 diff --git a/ari/js/jquery.tools.min.js b/ari/js/jquery.tools.min.js old mode 100755 new mode 100644 diff --git a/ari/modules/phonesettings.module b/ari/modules/phonesettings.module old mode 100755 new mode 100644 diff --git a/ari/theme/coda-slider-2.0a.css b/ari/theme/coda-slider-2.0a.css old mode 100755 new mode 100644 diff --git a/ari/theme/reset.css b/ari/theme/reset.css old mode 100755 new mode 100644 diff --git a/assets/css/coda-slider-2.0a.css b/assets/css/coda-slider-2.0a.css old mode 100755 new mode 100644 diff --git a/assets/css/codemirror.css b/assets/css/codemirror.css old mode 100755 new mode 100644 diff --git a/assets/css/default.css b/assets/css/default.css old mode 100755 new mode 100644 diff --git a/assets/css/main.css b/assets/css/main.css old mode 100755 new mode 100644 diff --git a/assets/css/reset.css b/assets/css/reset.css old mode 100755 new mode 100644 diff --git a/assets/images/.htaccess b/assets/images/.htaccess old mode 100755 new mode 100644 diff --git a/assets/images/add.png b/assets/images/add.png old mode 100755 new mode 100644 diff --git a/assets/images/add_old.png b/assets/images/add_old.png old mode 100755 new mode 100644 diff --git a/assets/images/ajax-loader.gif b/assets/images/ajax-loader.gif old mode 100755 new mode 100644 diff --git a/assets/images/black_arrow.png b/assets/images/black_arrow.png old mode 100755 new mode 100644 diff --git a/assets/images/bullet_minus.png b/assets/images/bullet_minus.png old mode 100755 new mode 100644 diff --git a/assets/images/bullet_plus.png b/assets/images/bullet_plus.png old mode 100755 new mode 100644 diff --git a/assets/images/circle_green.png b/assets/images/circle_green.png old mode 100755 new mode 100644 diff --git a/assets/images/circle_orange.png b/assets/images/circle_orange.png old mode 100755 new mode 100644 diff --git a/assets/images/circle_red.png b/assets/images/circle_red.png old mode 100755 new mode 100644 diff --git a/assets/images/collapse.png b/assets/images/collapse.png old mode 100755 new mode 100644 diff --git a/assets/images/delete.gif b/assets/images/delete.gif old mode 100755 new mode 100644 diff --git a/assets/images/delete.png b/assets/images/delete.png old mode 100755 new mode 100644 diff --git a/assets/images/edit.gif b/assets/images/edit.gif old mode 100755 new mode 100644 diff --git a/assets/images/edit.png b/assets/images/edit.png old mode 100755 new mode 100644 diff --git a/assets/images/expand.png b/assets/images/expand.png old mode 100755 new mode 100644 diff --git a/assets/images/trash.gif b/assets/images/trash.gif old mode 100755 new mode 100644 diff --git a/assets/js/ajax_req.js b/assets/js/ajax_req.js old mode 100755 new mode 100644 diff --git a/assets/js/codemirror.js b/assets/js/codemirror.js old mode 100755 new mode 100644 diff --git a/assets/js/jquery.coda-slider-2.0.js b/assets/js/jquery.coda-slider-2.0.js old mode 100755 new mode 100644 diff --git a/assets/js/jquery.cookie.js b/assets/js/jquery.cookie.js old mode 100755 new mode 100644 diff --git a/assets/js/jquery.easing.1.3.js b/assets/js/jquery.easing.1.3.js old mode 100755 new mode 100644 diff --git a/assets/js/jquery.form.js b/assets/js/jquery.form.js old mode 100755 new mode 100644 diff --git a/assets/js/jquery.jstree.js b/assets/js/jquery.jstree.js old mode 100755 new mode 100644 diff --git a/assets/js/jquery.tools.min.js b/assets/js/jquery.tools.min.js old mode 100755 new mode 100644 diff --git a/assets/js/xml.js b/assets/js/xml.js old mode 100755 new mode 100644 diff --git a/assets/theme/coda-slider-2.0a.css b/assets/theme/coda-slider-2.0a.css old mode 100755 new mode 100644 diff --git a/assets/theme/codemirror.css b/assets/theme/codemirror.css old mode 100755 new mode 100644 diff --git a/assets/theme/default.css b/assets/theme/default.css old mode 100755 new mode 100644 diff --git a/assets/theme/main.css b/assets/theme/main.css old mode 100755 new mode 100644 diff --git a/assets/theme/reset.css b/assets/theme/reset.css old mode 100755 new mode 100644 diff --git a/config.php b/config.php old mode 100755 new mode 100644 diff --git a/emportal b/emportal old mode 100755 new mode 100644 diff --git a/etc/sip_notify_endpointman.conf b/etc/sip_notify_endpointman.conf old mode 100755 new mode 100644 diff --git a/export.html.php b/export.html.php old mode 100755 new mode 100644 diff --git a/functions.inc.php b/functions.inc.php old mode 100755 new mode 100644 diff --git a/i18n/endpointman.pot b/i18n/endpointman.pot old mode 100755 new mode 100644 diff --git a/i18n/fr_FR/LC_MESSAGES/endpointman.mo b/i18n/fr_FR/LC_MESSAGES/endpointman.mo old mode 100755 new mode 100644 diff --git a/i18n/fr_FR/LC_MESSAGES/endpointman.po b/i18n/fr_FR/LC_MESSAGES/endpointman.po old mode 100755 new mode 100644 diff --git a/i18n/he_IL/LC_MESSAGES/endpointman.mo b/i18n/he_IL/LC_MESSAGES/endpointman.mo old mode 100755 new mode 100644 diff --git a/i18n/he_IL/LC_MESSAGES/endpointman.po b/i18n/he_IL/LC_MESSAGES/endpointman.po old mode 100755 new mode 100644 diff --git a/includes/abstraction/freepbx.inc b/includes/abstraction/freepbx.inc old mode 100755 new mode 100644 diff --git a/includes/advanced.inc b/includes/advanced.inc old mode 100755 new mode 100644 diff --git a/includes/ajax.inc b/includes/ajax.inc old mode 100755 new mode 100644 diff --git a/includes/brand_model_manager.inc b/includes/brand_model_manager.inc old mode 100755 new mode 100644 diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc old mode 100755 new mode 100644 diff --git a/includes/diff.class.inc b/includes/diff.class.inc old mode 100755 new mode 100644 diff --git a/includes/export.inc b/includes/export.inc old mode 100755 new mode 100644 diff --git a/includes/functions.inc b/includes/functions.inc old mode 100755 new mode 100644 diff --git a/includes/installer.inc b/includes/installer.inc old mode 100755 new mode 100644 diff --git a/includes/json.inc b/includes/json.inc old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff.php b/includes/pear_diff/Diff.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff/Engine/native.php b/includes/pear_diff/Diff/Engine/native.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff/Engine/shell.php b/includes/pear_diff/Diff/Engine/shell.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff/Engine/string.php b/includes/pear_diff/Diff/Engine/string.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff/Engine/xdiff.php b/includes/pear_diff/Diff/Engine/xdiff.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff/Mapped.php b/includes/pear_diff/Diff/Mapped.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff/Renderer.php b/includes/pear_diff/Diff/Renderer.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff/Renderer/context.php b/includes/pear_diff/Diff/Renderer/context.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff/Renderer/inline.php b/includes/pear_diff/Diff/Renderer/inline.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff/Renderer/unified.php b/includes/pear_diff/Diff/Renderer/unified.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff/ThreeWay.php b/includes/pear_diff/Diff/ThreeWay.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/Diff3.php b/includes/pear_diff/Diff3.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/docs/examples/1.txt b/includes/pear_diff/docs/examples/1.txt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/docs/examples/2.txt b/includes/pear_diff/docs/examples/2.txt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/docs/examples/diff.php b/includes/pear_diff/docs/examples/diff.php old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/1.txt b/includes/pear_diff/tests/1.txt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/2.txt b/includes/pear_diff/tests/2.txt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/3.txt b/includes/pear_diff/tests/3.txt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/4.txt b/includes/pear_diff/tests/4.txt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/5.txt b/includes/pear_diff/tests/5.txt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/6.txt b/includes/pear_diff/tests/6.txt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/context.patch b/includes/pear_diff/tests/context.patch old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/context.phpt b/includes/pear_diff/tests/context.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/context2.phpt b/includes/pear_diff/tests/context2.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/diff.phpt b/includes/pear_diff/tests/diff.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/inline.phpt b/includes/pear_diff/tests/inline.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/inline2.phpt b/includes/pear_diff/tests/inline2.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/pear_bug12740.phpt b/includes/pear_diff/tests/pear_bug12740.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/pear_bug4879.phpt b/includes/pear_diff/tests/pear_bug4879.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/pear_bug6251.phpt b/includes/pear_diff/tests/pear_bug6251.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/pear_bug6428.phpt b/includes/pear_diff/tests/pear_bug6428.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/string.phpt b/includes/pear_diff/tests/string.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/unified.patch b/includes/pear_diff/tests/unified.patch old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/unified.phpt b/includes/pear_diff/tests/unified.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/unified2.phpt b/includes/pear_diff/tests/unified2.phpt old mode 100755 new mode 100644 diff --git a/includes/pear_diff/tests/xdiff.phpt b/includes/pear_diff/tests/xdiff.phpt old mode 100755 new mode 100644 diff --git a/includes/popup.inc b/includes/popup.inc old mode 100755 new mode 100644 diff --git a/includes/rain.error.inc b/includes/rain.error.inc old mode 100755 new mode 100644 diff --git a/includes/rain.tpl.class.inc b/includes/rain.tpl.class.inc old mode 100755 new mode 100644 diff --git a/includes/rain.tpl.compile.class.php b/includes/rain.tpl.compile.class.php old mode 100755 new mode 100644 diff --git a/includes/template_manager.inc b/includes/template_manager.inc old mode 100755 new mode 100644 diff --git a/includes/timezone.inc b/includes/timezone.inc old mode 100755 new mode 100644 diff --git a/index.php b/index.php old mode 100755 new mode 100644 diff --git a/install.php b/install.php old mode 100755 new mode 100644 diff --git a/install/phonesettings.module b/install/phonesettings.module old mode 100755 new mode 100644 diff --git a/install/setup.php b/install/setup.php old mode 100755 new mode 100644 diff --git a/installer.html.php b/installer.html.php old mode 100755 new mode 100644 diff --git a/javascript.html.php b/javascript.html.php old mode 100755 new mode 100644 diff --git a/module.xml b/module.xml old mode 100755 new mode 100644 diff --git a/page.endpointman.php b/page.endpointman.php old mode 100755 new mode 100644 diff --git a/page.epm_advanced.php b/page.epm_advanced.php old mode 100755 new mode 100644 diff --git a/page.epm_config.php b/page.epm_config.php old mode 100755 new mode 100644 diff --git a/page.epm_devices.php b/page.epm_devices.php old mode 100755 new mode 100644 diff --git a/page.epm_templates.php b/page.epm_templates.php old mode 100755 new mode 100644 diff --git a/popup.html.php b/popup.html.php old mode 100755 new mode 100644 diff --git a/provisioning/.htaccess b/provisioning/.htaccess old mode 100755 new mode 100644 diff --git a/provisioning/p.php b/provisioning/p.php old mode 100755 new mode 100644 diff --git a/templates/freepbx/advanced_settings_iedl.html b/templates/freepbx/advanced_settings_iedl.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/advanced_settings_manual_upload.html b/templates/freepbx/advanced_settings_manual_upload.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/advanced_settings_oui.html b/templates/freepbx/advanced_settings_oui.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/advanced_settings_poce.html b/templates/freepbx/advanced_settings_poce.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/advanced_settings_settings_pop.html b/templates/freepbx/advanced_settings_settings_pop.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/advanced_settings_sh_manager.html b/templates/freepbx/advanced_settings_sh_manager.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/advanced_subheader.html b/templates/freepbx/advanced_subheader.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/alt_config_popup.html b/templates/freepbx/alt_config_popup.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/brand_model_manager.html b/templates/freepbx/brand_model_manager.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/credits.html b/templates/freepbx/credits.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/devices_manager.html b/templates/freepbx/devices_manager.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/global_footer.html b/templates/freepbx/global_footer.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/global_header.html b/templates/freepbx/global_header.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/global_links.html b/templates/freepbx/global_links.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/message_box.html b/templates/freepbx/message_box.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/specifics_pop.html b/templates/freepbx/specifics_pop.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/template_editor.html b/templates/freepbx/template_editor.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/template_manager.html b/templates/freepbx/template_manager.html old mode 100755 new mode 100644 diff --git a/templates/freepbx/variables.html b/templates/freepbx/variables.html old mode 100755 new mode 100644 diff --git a/uninstall.php b/uninstall.php old mode 100755 new mode 100644 From 3640f3d109b54b2dc528fcb9dc117d79aa42ee37 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 17 May 2012 23:14:59 -0700 Subject: [PATCH 289/623] Firmware fixes -Dont redownload firmware if file copy error happened -Allow firmware download if using repo mode -save firmware temporary files in proper temp file location --- includes/functions.inc | 116 ++++++++++++++++++++++++++--------------- 1 file changed, 74 insertions(+), 42 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 6a282426..df70a5bb 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1711,62 +1711,94 @@ class endpointmanager { $sql = 'UPDATE endpointman_product_list SET firmware_files = "", firmware_vers = "" WHERE id = ' . $id; $this->eda->sql($sql); } + + function sys_get_temp_dir() { + if (!empty($_ENV['TMP'])) { + return realpath($_ENV['TMP']); + } + if (!empty($_ENV['TMPDIR'])) { + return realpath($_ENV['TMPDIR']); + } + if (!empty($_ENV['TEMP'])) { + return realpath($_ENV['TEMP']); + } + $tempfile = tempnam(uniqid(rand(), TRUE), ''); + if (file_exists($tempfile)) { + unlink($tempfile); + return realpath(dirname($tempfile)); + } + } /** * Install Firmware for the specified Product Line * @param $product_id Product ID */ function install_firmware($product_id) { - if(!$this->global_cfg['use_repo']) { - $sql = 'SELECT endpointman_product_list.*, endpointman_brand_list.directory FROM endpointman_product_list, endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = ' . $product_id; - $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - $temp = $this->file2json(PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/family_data.json"); - if ($temp['data']['firmware_ver'] > $row['firmware_vers']) { + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + $sql = 'SELECT endpointman_product_list.*, endpointman_brand_list.directory FROM endpointman_product_list, endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = ' . $product_id; + $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + $json_data = $this->file2json(PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/family_data.json"); + if ($json_data['data']['firmware_ver'] > $row['firmware_vers']) { + if (!file_exists($temp_directory)) { + mkdir($temp_directory); + } + $md5_xml = $json_data['data']['firmware_md5sum']; + $firmware_pkg = $json_data['data']['firmware_pkg']; + if (file_exists($temp_directory . $firmware_pkg)) { + $md5_pkg = md5_file($temp_directory . $firmware_pkg); + if ($md5_xml = $md5_pkg) { + echo "Skipping download....
      "; + } else { + echo "
      Downloading firmware...
      .
      "; + $this->download_file_with_progress_bar(UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg); + echo "
      "; + $md5_pkg = md5_file($temp_directory . $firmware_pkg); + } + } else { echo "
      Downloading firmware...
      .
      "; - $this->download_file_with_progress_bar(UPDATE_PATH . $row['directory'] . "/" . $temp['data']['firmware_pkg'], PHONE_MODULES_PATH . "temp/" . $temp['data']['firmware_pkg']); + $this->download_file_with_progress_bar(UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg); echo "
      "; - $md5_xml = $temp['data']['firmware_md5sum']; - $md5_pkg = md5_file(PHONE_MODULES_PATH . 'temp/' . $temp['data']['firmware_pkg']); - echo "Checking MD5sum of Package..."; - if ($md5_xml == $md5_pkg) { - echo "Matches!
      "; - if (!file_exists(PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware")) { - mkdir(PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware"); - } - echo "Installing Firmware..."; - exec("rm -Rf " . PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware"); - mkdir(PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware"); - exec("tar -xvf " . PHONE_MODULES_PATH . 'temp/' . $temp['data']['firmware_pkg'] . " -C " . PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir']); - $i = 0; - foreach (glob(PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware/*") as $filename) { - $file = basename($filename); - $list[$i] = $file; - if (!@copy($filename, $this->global_cfg['config_location'] . $file)) { - echo "
      --Failed To Copy $file..."; - $copy_error = TRUE; - } elseif ($this->global_cfg['debug']) { - echo"
      --Copied " . $file . " to " . $this->global_cfg['config_location']; - } - $i++; - } - $list = implode(",", $list); - $sql = "UPDATE endpointman_product_list SET firmware_vers = '" . $temp['data']['firmware_ver'] . "', firmware_files = '" . $list . "' WHERE id = " . $row['id']; - $this->eda->sql($sql); - if (isset($copy_error)) { - echo "
      Copy Error Detected! Aborting Install!"; - $this->remove_firmware($product_id); - echo "
      Please Check Directory/Permissions"; - } else { - echo "
      Done!"; + $md5_pkg = md5_file($temp_directory . $firmware_pkg); + } + + echo "Checking MD5sum of Package..."; + if ($md5_xml == $md5_pkg) { + echo "Matches!
      "; + if (file_exists($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware")) { + $this->rmrf($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware"); + } + mkdir($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware", 0777, TRUE); + echo "Installing Firmware..."; + exec("tar -xvf " . $temp_directory . $firmware_pkg . " -C " . $temp_directory . $row['directory'] . "/" . $row['cfg_dir']); + $i = 0; + foreach (glob($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware/*") as $filename) { + $file = basename($filename); + $list[$i] = $file; + if (!@copy($filename, $this->global_cfg['config_location'] . $file)) { + echo "
      --Failed To Copy $file..."; + $copy_error = TRUE; + } elseif ($this->global_cfg['debug']) { + echo"
      --Copied " . $file . " to " . $this->global_cfg['config_location']; } + $i++; + } + + $this->rmrf($temp_directory . $row['directory']); + $list = implode(",", $list); + $sql = "UPDATE endpointman_product_list SET firmware_vers = '" . $json_data['data']['firmware_ver'] . "', firmware_files = '" . $list . "' WHERE id = " . $row['id']; + $this->eda->sql($sql); + if (isset($copy_error)) { + echo "
      Copy Error Detected! Aborting Install!"; + $this->remove_firmware($product_id); + echo "
      Please Check Directory/Permissions"; } else { - echo "
      Firmware MD5 didn't match
      "; + echo "
      Done!"; } } else { - echo "
      Your Firmware is already up to date"; + echo "
      Firmware MD5 didn't match
      "; } } else { - echo 'This function is disabled when set to repo mode'; + echo "
      Your Firmware is already up to date"; } } From 54056c3cff84f42c651b15e7f9d413a325eb7070 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 18 May 2012 00:24:16 -0700 Subject: [PATCH 290/623] Fixes to non-repo style downloads -Fix all old download scripts to use system temp directory -Allows users to use old non-repo download method -fixed ending ) issue --- config.php | 41 +- includes/advanced.inc | 424 +++++++++--------- includes/functions.inc | 293 ++++++------ module.xml | 4 +- .../freepbx/advanced_settings_settings.html | 2 +- 5 files changed, 390 insertions(+), 374 deletions(-) diff --git a/config.php b/config.php index b4da6c14..60ad017c 100644 --- a/config.php +++ b/config.php @@ -1,4 +1,5 @@ global_cfg['debug']) { - $debug .= "Request Variables: \n".print_r($_REQUEST, TRUE); +if ($endpoint->global_cfg['debug']) { + $debug .= "Request Variables: \n" . print_r($_REQUEST, TRUE); } \ No newline at end of file diff --git a/includes/advanced.inc b/includes/advanced.inc index ccdde7b8..dd7f1e1a 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -1,4 +1,5 @@ tpl->draw( 'global_header' ); -if(!isset($_REQUEST['subpage'])) { +echo $endpoint->tpl->draw('global_header'); +if (!isset($_REQUEST['subpage'])) { $_REQUEST['subpage'] = ""; - $endpoint->tpl->assign("subhead_area", 'settings'); + $endpoint->tpl->assign("subhead_area", 'settings'); } else { $endpoint->tpl->assign("subhead_area", $_REQUEST['subpage']); } -echo $endpoint->tpl->draw( 'advanced_subheader' ); +echo $endpoint->tpl->draw('advanced_subheader'); -switch($_REQUEST['subpage']) { +switch ($_REQUEST['subpage']) { case "iedl": - $endpoint->tpl->assign("exporter_address", "config.php?type=tool&display=epm_config&quietmode=1&handler=file&file=export.html.php&module=endpointman&rand=".rand()); + $endpoint->tpl->assign("exporter_address", "config.php?type=tool&display=epm_config&quietmode=1&handler=file&file=export.html.php&module=endpointman&rand=" . rand()); //Dave B's Q&D file upload security code (http://us2.php.net/manual/en/features.file-upload.php) - if((isset($_REQUEST['button_import'])) AND ($action == "import")) { - $allowedExtensions = array("csv","txt"); + if ((isset($_REQUEST['button_import'])) AND ($action == "import")) { + $allowedExtensions = array("csv", "txt"); foreach ($_FILES as $file) { if ($file['tmp_name'] > '') { if (!in_array(end(explode(".", strtolower($file['name']))), $allowedExtensions)) { - $endpoint->message['iedl'] = "We support only CVS and TXT files"; + $endpoint->message['iedl'] = "We support only CVS and TXT files"; } else { $uploaddir = LOCAL_PATH; $uploadfile = $uploaddir . basename($_FILES['import_csv']['name']); if (move_uploaded_file($_FILES['import_csv']['tmp_name'], $uploadfile)) { //Parse the uploaded file - $handle = fopen(LOCAL_PATH.$_FILES['import_csv']['name'], "r"); + $handle = fopen(LOCAL_PATH . $_FILES['import_csv']['name'], "r"); $i = 1; - while (($device = fgetcsv($handle, filesize(LOCAL_PATH.$_FILES['import_csv']['name']))) !== FALSE) { - if($device[0] != "") { - if($mac = $endpoint->mac_check_clean($device[0])) { - $sql = "SELECT id FROM endpointman_brand_list WHERE name LIKE '%".$device[1]."%' LIMIT 1"; + while (($device = fgetcsv($handle, filesize(LOCAL_PATH . $_FILES['import_csv']['name']))) !== FALSE) { + if ($device[0] != "") { + if ($mac = $endpoint->mac_check_clean($device[0])) { + $sql = "SELECT id FROM endpointman_brand_list WHERE name LIKE '%" . $device[1] . "%' LIMIT 1"; $res = $endpoint->eda->sql($sql); - if($res->numRows() > 0) { + if ($res->numRows() > 0) { $brand_id = $endpoint->eda->sql($sql, 'getOne'); $brand_id = $brand_id[0]; - $sql_model = "SELECT id FROM endpointman_model_list WHERE brand = ".$brand_id." AND model LIKE '%".$device[2]."%' LIMIT 1"; - $sql_ext = "SELECT extension, name FROM users WHERE extension LIKE '%".$device[3]."%' LIMIT 1"; - + $sql_model = "SELECT id FROM endpointman_model_list WHERE brand = " . $brand_id . " AND model LIKE '%" . $device[2] . "%' LIMIT 1"; + $sql_ext = "SELECT extension, name FROM users WHERE extension LIKE '%" . $device[3] . "%' LIMIT 1"; + $line_id = isset($device[4]) ? $device[4] : 1; $res_model = $endpoint->eda->sql($sql_model); - if($res_model->numRows()) { - $model_id = $endpoint->eda->sql($sql_model,'getRow', DB_FETCHMODE_ASSOC); + if ($res_model->numRows()) { + $model_id = $endpoint->eda->sql($sql_model, 'getRow', DB_FETCHMODE_ASSOC); $model_id = $model_id['id']; $res_ext = $endpoint->eda->sql($sql_ext); - if($res_ext->numRows()) { - $ext = $endpoint->eda->sql($sql_ext,'getRow', DB_FETCHMODE_ASSOC); + if ($res_ext->numRows()) { + $ext = $endpoint->eda->sql($sql_ext, 'getRow', DB_FETCHMODE_ASSOC); $description = $ext['name']; $ext = $ext['extension']; - $endpoint->add_device($mac,$model_id,$ext,0,$line_id,$description); + $endpoint->add_device($mac, $model_id, $ext, 0, $line_id, $description); } else { - $endpoint->error['csv_upload'] .= "Invalid Extension Specified on line ". $i. "
      "; + $endpoint->error['csv_upload'] .= "Invalid Extension Specified on line " . $i . "
      "; } } else { - $endpoint->error['csv_upload'] .= "Invalid Model Specified on line ". $i. "
      "; + $endpoint->error['csv_upload'] .= "Invalid Model Specified on line " . $i . "
      "; } } else { - $endpoint->error['csv_upload'] .= "Invalid Brand Specified on line ". $i. "
      "; + $endpoint->error['csv_upload'] .= "Invalid Brand Specified on line " . $i . "
      "; } } else { - $endpoint->error['csv_upload'] .= "Invalid Mac on line ". $i. "
      "; + $endpoint->error['csv_upload'] .= "Invalid Mac on line " . $i . "
      "; } } $i++; } fclose($handle); - unlink(LOCAL_PATH.$_FILES['import_csv']['name']); + unlink(LOCAL_PATH . $_FILES['import_csv']['name']); $endpoint->message['file_upload'] = "Please reboot & rebuild all imported phones
      "; } else { $endpoint->error['file_upload'] = "Possible file upload attack!"; - } } } } - } elseif(isset($_REQUEST['action'])) { + } elseif (isset($_REQUEST['action'])) { $endpoint->error['iedl'] = "No File uploaded"; } $endpoint->prepare_message_box(); - echo $endpoint->tpl->draw( 'advanced_settings_iedl' ); + echo $endpoint->tpl->draw('advanced_settings_iedl'); break; case "manual_upload": $sql = "SELECT value FROM endpointman_global_vars WHERE var_name LIKE 'endpoint_vers'"; - $provisioner_ver = $endpoint->eda->sql($sql,'getOne'); - $provisioner_ver = date("n-j-y",$provisioner_ver) . " at " . date("g:ia",$provisioner_ver); + $provisioner_ver = $endpoint->eda->sql($sql, 'getOne'); + $provisioner_ver = date("n-j-y", $provisioner_ver) . " at " . date("g:ia", $provisioner_ver); $endpoint->tpl->assign("provisioner_ver", $provisioner_ver); $endpoint->tpl->assign("brand_ava", $endpoint->brands_available()); $provisioner_ver = ""; $endpoint->tpl->assign("master_ver", $provisioner_ver); - $uploads_dir = PHONE_MODULES_PATH."temp"; + $uploads_dir = PHONE_MODULES_PATH . "temp"; - if(isset($_REQUEST['upload_provisioner'])) { + if (isset($_REQUEST['upload_provisioner'])) { - $extension = pathinfo($_FILES["package"]["name"],PATHINFO_EXTENSION); - if($extension == "tgz") { + $extension = pathinfo($_FILES["package"]["name"], PATHINFO_EXTENSION); + if ($extension == "tgz") { if ($_FILES['package']['error'] == UPLOAD_ERR_OK) { $tmp_name = $_FILES["package"]["tmp_name"]; $name = $_FILES["package"]["name"]; @@ -122,13 +122,13 @@ switch($_REQUEST['subpage']) { } else { $endpoint->error['manual_upload'] = "Invalid File Extension"; } - } elseif(isset($_REQUEST['upload_brand'])) { + } elseif (isset($_REQUEST['upload_brand'])) { $error = FALSE; $files_list = array(); $i = 0; - foreach($_FILES as $files) { - $extension = pathinfo($files["name"],PATHINFO_EXTENSION); - if($extension == "tgz") { + foreach ($_FILES as $files) { + $extension = pathinfo($files["name"], PATHINFO_EXTENSION); + if ($extension == "tgz") { if ($files['error'] == UPLOAD_ERR_OK) { $tmp_name = $files["tmp_name"]; $name = $files["name"]; @@ -144,56 +144,56 @@ switch($_REQUEST['subpage']) { $error = TRUE; } } - if(!$error){ + if (!$error) { $endpoint->tpl->assign("show_installer", 1); $endpoint->tpl->assign("package", $files_list[0]); $endpoint->tpl->assign("type", "upload_brand"); - } - } elseif(isset($_REQUEST['export_brand'])) { + } + } elseif (isset($_REQUEST['export_brand'])) { $endpoint->tpl->assign("show_installer", 1); $endpoint->tpl->assign("type", "export_brand"); $endpoint->tpl->assign("package", $_REQUEST['exp_brand']); } $endpoint->prepare_message_box(); - echo $endpoint->tpl->draw( 'advanced_settings_manual_upload' ); + echo $endpoint->tpl->draw('advanced_settings_manual_upload'); break; case "sh_manager": - if(isset($_REQUEST['button_hide'])) { - if(isset($_REQUEST['model'])) { - $sql = "UPDATE endpointman_model_list SET hidden = 1 WHERE id = '".$_REQUEST['model']."'"; - } elseif(isset($_REQUEST['brand'])) { - $sql = "UPDATE endpointman_brand_list SET hidden = 1 WHERE id = ".$_REQUEST['brand']; - } elseif(isset($_REQUEST['product'])) { - $sql = "UPDATE endpointman_product_list SET hidden = 1 WHERE id = '".$_REQUEST['product']."'"; + if (isset($_REQUEST['button_hide'])) { + if (isset($_REQUEST['model'])) { + $sql = "UPDATE endpointman_model_list SET hidden = 1 WHERE id = '" . $_REQUEST['model'] . "'"; + } elseif (isset($_REQUEST['brand'])) { + $sql = "UPDATE endpointman_brand_list SET hidden = 1 WHERE id = " . $_REQUEST['brand']; + } elseif (isset($_REQUEST['product'])) { + $sql = "UPDATE endpointman_product_list SET hidden = 1 WHERE id = '" . $_REQUEST['product'] . "'"; } $endpoint->eda->sql($sql); - }elseif(isset($_REQUEST['button_show'])) { - if(isset($_REQUEST['model'])) { - $sql = "UPDATE endpointman_model_list SET hidden = 0 WHERE id = '".$_REQUEST['model']."'"; - } elseif(isset($_REQUEST['brand'])) { - $sql = "UPDATE endpointman_brand_list SET hidden = 0 WHERE id = ".$_REQUEST['brand']; - } elseif(isset($_REQUEST['product'])) { - $sql = "UPDATE endpointman_product_list SET hidden = 0 WHERE id = '".$_REQUEST['product']."'"; + } elseif (isset($_REQUEST['button_show'])) { + if (isset($_REQUEST['model'])) { + $sql = "UPDATE endpointman_model_list SET hidden = 0 WHERE id = '" . $_REQUEST['model'] . "'"; + } elseif (isset($_REQUEST['brand'])) { + $sql = "UPDATE endpointman_brand_list SET hidden = 0 WHERE id = " . $_REQUEST['brand']; + } elseif (isset($_REQUEST['product'])) { + $sql = "UPDATE endpointman_product_list SET hidden = 0 WHERE id = '" . $_REQUEST['product'] . "'"; } $endpoint->eda->sql($sql); } - $sql="SELECT * from endpointman_brand_list WHERE id > 0 ORDER BY id ASC "; - $result =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $sql = "SELECT * from endpointman_brand_list WHERE id > 0 ORDER BY id ASC "; + $result = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 0; - foreach($result as $row) { + foreach ($result as $row) { $row_out[$i] = $row; $row_out[$i]['count'] = $i; - if($row['installed']) { + if ($row['installed']) { $j = 0; - $sql = 'SELECT * FROM endpointman_product_list WHERE brand = '.$row['id'].' ORDER BY long_name ASC'; - $result2 =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $sql = 'SELECT * FROM endpointman_product_list WHERE brand = ' . $row['id'] . ' ORDER BY long_name ASC'; + $result2 = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $xml_data = ""; - foreach($result2 as $row2) { + foreach ($result2 as $row2) { $row_out[$i]['products'][$j] = $row2; - $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = '.$row2['id']; - $result3 =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = ' . $row2['id']; + $result3 = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $k = 0; - foreach($result3 as $row3) { + foreach ($result3 as $row3) { $row_out[$i]['products'][$j]['models'][$k] = $row3; $k++; } @@ -204,26 +204,26 @@ switch($_REQUEST['subpage']) { } $endpoint->tpl->assign("brand2_list", $row_out); $endpoint->prepare_message_box(); - echo $endpoint->tpl->draw( 'advanced_settings_sh_manager' ); + echo $endpoint->tpl->draw('advanced_settings_sh_manager'); break; case "oui_manager": - if((isset($_REQUEST['oui_sub'])) AND ($_REQUEST['rb_brand'] > 0) AND ($_REQUEST['oui'] != "")) { - $sql = "INSERT INTO endpointman_oui_list (oui, brand, custom) VALUES ('".$_REQUEST['oui']."', '".$_REQUEST['rb_brand']."', '1')"; + if ((isset($_REQUEST['oui_sub'])) AND ($_REQUEST['rb_brand'] > 0) AND ($_REQUEST['oui'] != "")) { + $sql = "INSERT INTO endpointman_oui_list (oui, brand, custom) VALUES ('" . $_REQUEST['oui'] . "', '" . $_REQUEST['rb_brand'] . "', '1')"; $endpoint->eda->sql($sql); $endpoint->message['oui_manager'] = "Added!"; - } elseif(isset($_REQUEST['oui_sub'])) { + } elseif (isset($_REQUEST['oui_sub'])) { $endpoint->error['oui_manager'] = "No OUI Set!"; } - if((isset($_REQUEST['delete'])) AND ($_REQUEST['id'] > 0)) { - $sql = "DELETE FROM endpointman_oui_list WHERE id = ". $_REQUEST['id']; + if ((isset($_REQUEST['delete'])) AND ($_REQUEST['id'] > 0)) { + $sql = "DELETE FROM endpointman_oui_list WHERE id = " . $_REQUEST['id']; $endpoint->eda->sql($sql); $endpoint->message['oui_manager'] = "Deleted!"; } $sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id AND endpointman_oui_list.custom = 0'; - $data =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $data = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 0; $row_out = array(); - foreach($data as $row) { + foreach ($data as $row) { $row_out[$i] = $row; $i++; } @@ -232,46 +232,46 @@ switch($_REQUEST['subpage']) { $data = $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 0; $row_out_custom = array(); - foreach($data as $row) { + foreach ($data as $row) { $row_out_custom[$i] = $row; $i++; } $endpoint->tpl->assign("oui_list_custom", $row_out_custom); $endpoint->tpl->assign("brand_ava", $endpoint->brands_available()); $endpoint->prepare_message_box(); - echo $endpoint->tpl->draw( 'advanced_settings_oui' ); + echo $endpoint->tpl->draw('advanced_settings_oui'); break; case "poce": $sql = 'SELECT * FROM `endpointman_product_list` WHERE `hidden` = 0 AND `id` > 0'; - $data =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $data = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 0; - foreach($data as $row) { + foreach ($data as $row) { $product_list[$i]['value'] = $row['id']; $product_list[$i]['text'] = $row['long_name']; - if((isset($_REQUEST['product_select'])) AND ($_REQUEST['product_select'] == $row['id'])) { + if ((isset($_REQUEST['product_select'])) AND ($_REQUEST['product_select'] == $row['id'])) { $product_list[$i]['selected'] = 1; } $i++; } - if(isset($_REQUEST['delete'])) { - $sql = "DELETE FROM endpointman_custom_configs WHERE id =". $_REQUEST['sql']; + if (isset($_REQUEST['delete'])) { + $sql = "DELETE FROM endpointman_custom_configs WHERE id =" . $_REQUEST['sql']; $endpoint->eda->sql($sql); $endpoint->message['poce'] = "Deleted!"; } - if(isset($_REQUEST['file'])) { - $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '". $_REQUEST['product_select'] ."'"; + if (isset($_REQUEST['file'])) { + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $_REQUEST['product_select'] . "'"; $row = $endpoint->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - $config_files = explode(",",$row['config_files']); - $file=PHONE_MODULES_PATH.'endpoint/'.$row['directory']."/".$row['cfg_dir']."/".$config_files[$_REQUEST['file']]; - if(isset($_REQUEST['config_text'])) { - if(isset($_REQUEST['button_save'])) { - $wfh=fopen($file,'w'); - fwrite($wfh,$_REQUEST['config_text']); + $config_files = explode(",", $row['config_files']); + $file = PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $config_files[$_REQUEST['file']]; + if (isset($_REQUEST['config_text'])) { + if (isset($_REQUEST['button_save'])) { + $wfh = fopen($file, 'w'); + fwrite($wfh, $_REQUEST['config_text']); fclose($wfh); $endpoint->message['poce'] = "Saved to Hard Drive!"; - }elseif(isset($_REQUEST['button_save_as'])) { - $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("'.addslashes($_REQUEST['save_as_name']).'","'.addslashes($config_files[$_REQUEST['file']]).'","'.$_REQUEST['product_select'].'","'.addslashes($_REQUEST['config_text']).'")'; + } elseif (isset($_REQUEST['button_save_as'])) { + $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("' . addslashes($_REQUEST['save_as_name']) . '","' . addslashes($config_files[$_REQUEST['file']]) . '","' . $_REQUEST['product_select'] . '","' . addslashes($_REQUEST['config_text']) . '")'; $endpoint->eda->sql($sql); $endpoint->message['poce'] = "Saved to Database!"; } @@ -281,8 +281,8 @@ switch($_REQUEST['subpage']) { $contents = fread($handle, filesize($file)); fclose($handle); - if(isset($_REQUEST['sendid'])) { - $error = $endpoint->submit_config($row['directory'],$row['cfg_dir'],$config_files[$_REQUEST['file']],$contents); + if (isset($_REQUEST['sendid'])) { + $error = $endpoint->submit_config($row['directory'], $row['cfg_dir'], $config_files[$_REQUEST['file']], $contents); $endpoint->message['poce'] = 'Sent! Thanks :-)'; } @@ -295,29 +295,28 @@ switch($_REQUEST['subpage']) { $endpoint->tpl->assign('sendid', $_REQUEST['file']); $endpoint->tpl->assign("type", 'file'); $endpoint->tpl->assign("location", $file); - - } elseif(isset($_REQUEST['sql'])) { - if(isset($_REQUEST['config_text'])) { - if(isset($_REQUEST['button_save'])) { - $sql = "UPDATE endpointman_custom_configs SET data = '".addslashes($_REQUEST['config_text'])."' WHERE id = ".$_REQUEST['sql']; + } elseif (isset($_REQUEST['sql'])) { + if (isset($_REQUEST['config_text'])) { + if (isset($_REQUEST['button_save'])) { + $sql = "UPDATE endpointman_custom_configs SET data = '" . addslashes($_REQUEST['config_text']) . "' WHERE id = " . $_REQUEST['sql']; $endpoint->eda->sql($sql); $endpoint->message['poce'] = "Saved to Database!"; - }elseif(isset($_REQUEST['button_save_as'])) { - $sql = 'SELECT original_name FROM endpointman_custom_configs WHERE id = '.$_REQUEST['sql']; - $file_name = $endpoint->eda->sql($sql,'getOne'); + } elseif (isset($_REQUEST['button_save_as'])) { + $sql = 'SELECT original_name FROM endpointman_custom_configs WHERE id = ' . $_REQUEST['sql']; + $file_name = $endpoint->eda->sql($sql, 'getOne'); - $sql = "INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ('".addslashes($_REQUEST['save_as_name'])."','".addslashes($file_name)."','".$_REQUEST['product_select']."','".addslashes($_REQUEST['config_text'])."')"; + $sql = "INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ('" . addslashes($_REQUEST['save_as_name']) . "','" . addslashes($file_name) . "','" . $_REQUEST['product_select'] . "','" . addslashes($_REQUEST['config_text']) . "')"; $endpoint->eda->sql($sql); $endpoint->message['poce'] = "Saved to Database!"; } } $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $_REQUEST['sql']; - $row =& $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); + $row = & $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - if(isset($_REQUEST['sendid'])) { - $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '". $_REQUEST['product_select'] ."'"; - $row22 =& $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - $endpoint->submit_config($row22['directory'],$row22['cfg_dir'],$row['original_name'],$row['data']); + if (isset($_REQUEST['sendid'])) { + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $_REQUEST['product_select'] . "'"; + $row22 = & $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); + $endpoint->submit_config($row22['directory'], $row22['cfg_dir'], $row['original_name'], $row['data']); $endpoint->message['poce'] = 'Sent! Thanks! :-)'; } @@ -329,23 +328,23 @@ switch($_REQUEST['subpage']) { $endpoint->tpl->assign("type", 'sql'); $endpoint->tpl->assign("config_data", $row['data']); } - if(isset($_REQUEST['product_select'])) { + if (isset($_REQUEST['product_select'])) { $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id ='" . $_REQUEST['product_select'] . "'"; - - $row =& $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - $config_files = explode(",",$row['config_files']); + + $row = & $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); + $config_files = explode(",", $row['config_files']); $i = 0; - foreach($config_files as $config_files_data) { + foreach ($config_files as $config_files_data) { $file_list[$i]['value'] = $i; $file_list[$i]['text'] = $config_files_data; $i++; } - $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '". $_REQUEST['product_select'] . "'"; - $res =& $endpoint->eda->sql($sql); + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $_REQUEST['product_select'] . "'"; + $res = & $endpoint->eda->sql($sql); $i = 0; - if($res->numRows()) { - $data =& $endpoint->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); - foreach($data as $row2) { + if ($res->numRows()) { + $data = & $endpoint->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); + foreach ($data as $row2) { $sql_file_list[$i]['value'] = $row2['id']; $sql_file_list[$i]['text'] = $row2['name']; $sql_file_list[$i]['ref'] = $row2['original_name']; @@ -354,21 +353,21 @@ switch($_REQUEST['subpage']) { } else { $sql_file_list = NULL; } - require(PHONE_MODULES_PATH.'setup.php'); + require(PHONE_MODULES_PATH . 'setup.php'); $class = "endpoint_" . $row['directory'] . "_" . $row['cfg_dir'] . '_phone'; - $base_class = "endpoint_" . $row['directory']. '_base'; + $base_class = "endpoint_" . $row['directory'] . '_base'; $master_class = "endpoint_base"; - /**Quick Fix for FreePBX Distro - * I seriously want to figure out why ONLY the FreePBX Distro can't do autoloads. - **/ - if(!class_exists($master_class)) { + /* * Quick Fix for FreePBX Distro + * I seriously want to figure out why ONLY the FreePBX Distro can't do autoloads. + * */ + if (!class_exists($master_class)) { ProvisionerConfig::endpointsAutoload($master_class); } - if(!class_exists($base_class)) { + if (!class_exists($base_class)) { ProvisionerConfig::endpointsAutoload($base_class); } - if(!class_exists($class)) { + if (!class_exists($class)) { ProvisionerConfig::endpointsAutoload($class); } //end quick fix @@ -380,18 +379,18 @@ switch($_REQUEST['subpage']) { $template_file_list[0]['text'] = "template_data_custom.xml"; $sql = 'SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE CONVERT(_utf8 \'1-2\' USING latin1) COLLATE latin1_swedish_ci AND `enabled` = 1 AND `hidden` = 0'; - $data =& $endpoint->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); + $data = & $endpoint->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); $i = 1; - foreach($data as $list) { + foreach ($data as $list) { $template_file_list[$i]['value'] = "template_data_" . $list['model'] . "_custom.xml"; $template_file_list[$i]['text'] = "template_data_" . $list['model'] . "_custom.xml"; } - $endpoint->tpl->assign("template_file_list",$template_file_list); - if(isset($_REQUEST['temp_file'])) { - $endpoint->tpl->assign("temp_file",1); + $endpoint->tpl->assign("template_file_list", $template_file_list); + if (isset($_REQUEST['temp_file'])) { + $endpoint->tpl->assign("temp_file", 1); } else { - $endpoint->tpl->assign("temp_file",NULL); + $endpoint->tpl->assign("temp_file", NULL); } $endpoint->tpl->assign("file_list", $file_list); @@ -400,26 +399,26 @@ switch($_REQUEST['subpage']) { } $endpoint->tpl->assign("product_list", $product_list); $endpoint->prepare_message_box(); - echo $endpoint->tpl->draw( 'advanced_settings_poce' ); + echo $endpoint->tpl->draw('advanced_settings_poce'); break; case "settings": default: - if(isset($_REQUEST['button_update_globals'])) { + if (isset($_REQUEST['button_update_globals'])) { $_POST['srvip'] = trim($_POST['srvip']); #trim whitespace from IP address $_POST['config_loc'] = trim($_POST['config_loc']); #trim whitespace from Config Location - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['srvip'] . "' WHERE var_name='srvip'"; + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['srvip'] . "' WHERE var_name='srvip'"; $endpoint->eda->sql($sql); - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['tz'] . "' WHERE var_name='tz'"; + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['tz'] . "' WHERE var_name='tz'"; $endpoint->eda->sql($sql); - if($_POST['cfg_type'] == 'http') { - $symlink = $amp_conf['AMPWEBROOT']."/provisioning"; - $reallink = LOCAL_PATH."provisioning"; - if((!is_link($symlink)) OR (!readlink($symlink) == $reallink)) { - if(!symlink($reallink,$symlink)) { - $endpoint->error['config_dir'] = "Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"; + if ($_POST['cfg_type'] == 'http') { + $symlink = $amp_conf['AMPWEBROOT'] . "/provisioning"; + $reallink = LOCAL_PATH . "provisioning"; + if ((!is_link($symlink)) OR (!readlink($symlink) == $reallink)) { + if (!symlink($reallink, $symlink)) { + $endpoint->error['config_dir'] = "Your permissions are wrong on " . $amp_conf['AMPWEBROOT'] . ", web provisioning link not created!"; $_POST['cfg_type'] = 'file'; } else { $_POST['cfg_type'] = 'http'; @@ -432,73 +431,73 @@ switch($_REQUEST['subpage']) { } $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['cfg_type'] . "' WHERE var_name='server_type'"; $endpoint->eda->sql($sql); - + //No trailing slash. Help the user out and add one :-) - if($_POST['config_loc'][strlen($_POST['config_loc'])-1] != "/") { - $_POST['config_loc'] = $_POST['config_loc'] ."/"; + if ($_POST['config_loc'][strlen($_POST['config_loc']) - 1] != "/") { + $_POST['config_loc'] = $_POST['config_loc'] . "/"; } - + $tftp_writable = FALSE; - if((isset($_POST['config_loc'])) AND ($_POST['config_loc'] != "")) { - if((file_exists($_POST['config_loc'])) AND (is_dir($_POST['config_loc']))) { - if(is_writable($_POST['config_loc'])) { - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['config_loc'] . "' WHERE var_name='config_location'"; + if ((isset($_POST['config_loc'])) AND ($_POST['config_loc'] != "")) { + if ((file_exists($_POST['config_loc'])) AND (is_dir($_POST['config_loc']))) { + if (is_writable($_POST['config_loc'])) { + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['config_loc'] . "' WHERE var_name='config_location'"; $endpoint->eda->sql($sql); $tftp_writable = TRUE; } else { $endpoint->error['config_dir'] = "Directory Not Writable!"; } } else { - $endpoint->error['config_dir'] = "Not a Vaild Directory
      Try to run 'mkdir ".$_POST['config_loc']."' as root"; + $endpoint->error['config_dir'] = "Not a Vaild Directory
      Try to run 'mkdir " . $_POST['config_loc'] . "' as root"; } } else { $endpoint->error['config_dir'] = "No Configuration Location Defined!"; } - - if((isset($_POST['enable_ari'])) AND ($_POST['enable_ari'] == "on")) { + + if ((isset($_POST['enable_ari'])) AND ($_POST['enable_ari'] == "on")) { $_POST['enable_ari'] = 1; } else { $_POST['enable_ari'] = 0; } - if((isset($_POST['enable_debug'])) AND ($_POST['enable_debug'] == "on")) { + if ((isset($_POST['enable_debug'])) AND ($_POST['enable_debug'] == "on")) { $_POST['enable_debug'] = 1; } else { $_POST['enable_debug'] = 0; } - if((isset($_POST['disable_help'])) AND ($_POST['disable_help'] == "on")) { + if ((isset($_POST['disable_help'])) AND ($_POST['disable_help'] == "on")) { $_POST['disable_help'] = 1; } else { $_POST['disable_help'] = 0; } - if((isset($_POST['allow_dupext'])) AND ($_POST['allow_dupext'] == "on")) { + if ((isset($_POST['allow_dupext'])) AND ($_POST['allow_dupext'] == "on")) { $_POST['allow_dupext'] = 1; } else { $_POST['allow_dupext'] = 0; } - if((isset($_POST['allow_hdfiles'])) AND ($_POST['allow_hdfiles'] == "on")) { + if ((isset($_POST['allow_hdfiles'])) AND ($_POST['allow_hdfiles'] == "on")) { $_POST['allow_hdfiles'] = 1; } else { $_POST['allow_hdfiles'] = 0; } - if((isset($_POST['tftp_check'])) AND ($_POST['tftp_check'] == "on")) { + if ((isset($_POST['tftp_check'])) AND ($_POST['tftp_check'] == "on")) { $_POST['tftp_check'] = 1; } else { $_POST['tftp_check'] = 0; } - if((isset($_POST['backup_check'])) AND ($_POST['backup_check'] == "on")) { + if ((isset($_POST['backup_check'])) AND ($_POST['backup_check'] == "on")) { $_POST['backup_check'] = 1; } else { $_POST['backup_check'] = 0; } - if((isset($_POST['use_repo'])) AND ($_POST['use_repo'] == "on")) { - if($endpoint->has_git()) { + if ((isset($_POST['use_repo'])) AND ($_POST['use_repo'] == "on")) { + if ($endpoint->has_git()) { $_POST['use_repo'] = 1; - if(!file_exists(PHONE_MODULES_PATH.'/.git')) { + if (!file_exists(PHONE_MODULES_PATH . '/.git')) { $o = getcwd(); chdir(dirname(PHONE_MODULES_PATH)); $endpoint->rmrf(PHONE_MODULES_PATH); $path = $endpoint->has_git(); - exec($path.' clone https://github.com/provisioner/Provisioner.git _ep_phone_modules',$output); + exec($path . ' clone https://github.com/provisioner/Provisioner.git _ep_phone_modules', $output); chdir($o); } } else { @@ -506,122 +505,127 @@ switch($_REQUEST['subpage']) { } } else { $_POST['use_repo'] = 0; - if(file_exists(PHONE_MODULES_PATH.'/.git')) { + if (file_exists(PHONE_MODULES_PATH . '/.git')) { $endpoint->rmrf(PHONE_MODULES_PATH); + $sql = "SELECT * FROM `endpointman_brand_list` WHERE `installed` =1"; + $result = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach ($result as $row) { + $endpoint->remove_brand($row['id'], FALSE, TRUE); + } } } - - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['tftp_check'] . "' WHERE var_name='tftp_check'"; + + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['tftp_check'] . "' WHERE var_name='tftp_check'"; $endpoint->eda->sql($sql); - + //Check tftp server to make sure it's functioning if we are using it - if(($_POST['cfg_type'] == 'file') AND ($tftp_writable)) { + if (($_POST['cfg_type'] == 'file') AND ($tftp_writable)) { $endpoint->tftp_check(); } - - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['package_server'] . "' WHERE var_name='update_server'"; + + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['package_server'] . "' WHERE var_name='update_server'"; $endpoint->eda->sql($sql); - - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['allow_hdfiles'] . "' WHERE var_name='allow_hdfiles'"; + + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['allow_hdfiles'] . "' WHERE var_name='allow_hdfiles'"; $endpoint->eda->sql($sql); - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['allow_dupext'] . "' WHERE var_name='show_all_registrations'"; + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['allow_dupext'] . "' WHERE var_name='show_all_registrations'"; $endpoint->eda->sql($sql); - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['enable_ari'] . "' WHERE var_name='enable_ari'"; + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['enable_ari'] . "' WHERE var_name='enable_ari'"; $endpoint->eda->sql($sql); - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['enable_debug'] . "' WHERE var_name='debug'"; + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['enable_debug'] . "' WHERE var_name='debug'"; $endpoint->eda->sql($sql); - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['enable_debug'] . "' WHERE var_name='debug'"; + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['enable_debug'] . "' WHERE var_name='debug'"; $endpoint->eda->sql($sql); - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['ntp_server'] . "' WHERE var_name='ntp'"; + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['ntp_server'] . "' WHERE var_name='ntp'"; $endpoint->eda->sql($sql); - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['nmap_loc'] . "' WHERE var_name='nmap_location'"; + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['nmap_loc'] . "' WHERE var_name='nmap_location'"; $endpoint->eda->sql($sql); - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['arp_loc'] . "' WHERE var_name='arp_location'"; + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['arp_loc'] . "' WHERE var_name='arp_location'"; $endpoint->eda->sql($sql); - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['disable_help'] . "' WHERE var_name='disable_help'"; + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['disable_help'] . "' WHERE var_name='disable_help'"; $endpoint->eda->sql($sql); - - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['backup_check'] . "' WHERE var_name='backup_check'"; + + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['backup_check'] . "' WHERE var_name='backup_check'"; $endpoint->eda->sql($sql); - - $sql="UPDATE endpointman_global_vars SET value='" . $_POST['use_repo'] . "' WHERE var_name='use_repo'"; + + $sql = "UPDATE endpointman_global_vars SET value='" . $_POST['use_repo'] . "' WHERE var_name='use_repo'"; $endpoint->eda->sql($sql); - if($_POST['cfg_type'] == 'http') { - $endpoint->message['advanced_settings'] = "Updated! - Point your phones to: http://".$_SERVER['SERVER_ADDR']."/provisioning/p.php/"; + if ($_POST['cfg_type'] == 'http') { + $endpoint->message['advanced_settings'] = "Updated! - Point your phones to: http://" . $_SERVER['SERVER_ADDR'] . "/provisioning/p.php/"; } else { $endpoint->message['advanced_settings'] = "Updated!"; } } //Because we are working with global variables we probably updated them, so lets refresh those variables - $endpoint->global_cfg = $endpoint->eda->sql("SELECT var_name, value FROM endpointman_global_vars",'getAssoc'); + $endpoint->global_cfg = $endpoint->eda->sql("SELECT var_name, value FROM endpointman_global_vars", 'getAssoc'); - if($endpoint->global_cfg['server_type'] == 'http') { + if ($endpoint->global_cfg['server_type'] == 'http') { $endpoint->tpl->assign("type_http", 'yes'); } else { $endpoint->tpl->assign("type_file", 'yes'); } - if($endpoint->global_cfg['show_all_registrations']) { - $dupext_selected= "checked"; + if ($endpoint->global_cfg['show_all_registrations']) { + $dupext_selected = "checked"; } else { $dupext_selected = ""; } - if($endpoint->global_cfg['enable_ari']) { + if ($endpoint->global_cfg['enable_ari']) { $ari_selected = "checked"; } else { $ari_selected = ""; } - - if($endpoint->global_cfg['disable_help']) { + + if ($endpoint->global_cfg['disable_help']) { $help_selected = "checked"; } else { $help_selected = ""; } - if($endpoint->global_cfg['allow_hdfiles']) { + if ($endpoint->global_cfg['allow_hdfiles']) { $allow_hdfiles = "checked"; } else { $allow_hdfiles = ""; } - - if($endpoint->global_cfg['tftp_check']) { + + if ($endpoint->global_cfg['tftp_check']) { $tftp_checked = "checked"; } else { $tftp_checked = ""; } - - if($endpoint->global_cfg['backup_check']) { + + if ($endpoint->global_cfg['backup_check']) { $backup_checked = "checked"; } else { $backup_checked = ""; } - - if($endpoint->global_cfg['use_repo']) { + + if ($endpoint->global_cfg['use_repo']) { $use_repo = "checked"; } else { $use_repo = ""; } - if($endpoint->global_cfg['debug']) { + if ($endpoint->global_cfg['debug']) { $debug_selected = "checked"; global $debug; - $debug = $debug . print_r($_REQUEST,true); + $debug = $debug . print_r($_REQUEST, true); $endpoint->tpl->assign("debug", $debug); } else { $debug_selected = ""; } - - + + $endpoint->tpl->assign("package_server", $endpoint->global_cfg['update_server']); $endpoint->tpl->assign("help_selected", $help_selected); @@ -631,11 +635,11 @@ switch($_REQUEST['subpage']) { $endpoint->tpl->assign("debug_selected", $debug_selected); $endpoint->tpl->assign("hdfiles_selected", $allow_hdfiles); - + $endpoint->tpl->assign("tftp_selected", $tftp_checked); - + $endpoint->tpl->assign("backup_selected", $backup_checked); - + $endpoint->tpl->assign("use_repo", $use_repo); $endpoint->tpl->assign("ip", $_SERVER["SERVER_ADDR"]); @@ -651,6 +655,6 @@ switch($_REQUEST['subpage']) { $endpoint->prepare_message_box(); - echo $endpoint->tpl->draw( 'advanced_settings_settings' ); + echo $endpoint->tpl->draw('advanced_settings_settings'); break; } \ No newline at end of file diff --git a/includes/functions.inc b/includes/functions.inc index df70a5bb..f6758743 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -49,10 +49,10 @@ class endpointmanager { $this->error['amp_conf'] = 'The Global Variable $amp_conf is empty or not set! Can\'t connect to the database.'; $this->global_cfg['disable_epm'] = TRUE; } - + define("UPDATE_PATH", $this->global_cfg['update_server']); - define("MODULES_PATH", dirname(dirname(dirname(__FILE__))).'/'); - + define("MODULES_PATH", dirname(dirname(dirname(__FILE__))) . '/'); + //Determine if local path is correct! if (file_exists(MODULES_PATH . "endpointman/")) { define("LOCAL_PATH", MODULES_PATH . "endpointman/"); @@ -69,13 +69,10 @@ class endpointmanager { mkdir(PHONE_MODULES_PATH, 0764); } - if (!file_exists(PHONE_MODULES_PATH . "setup.php")) { - copy(LOCAL_PATH . "install/setup.php", PHONE_MODULES_PATH . "setup.php"); + if (file_exists(PHONE_MODULES_PATH . "setup.php")) { + unlink(PHONE_MODULES_PATH . "setup.php"); } - if (!file_exists(PHONE_MODULES_PATH . "temp/")) { - mkdir(PHONE_MODULES_PATH . "temp/", 0764); - } if (!file_exists(MODULES_PATH . "_ep_phone_modules/")) { die('Endpoint Manager can not create the modules folder!'); } @@ -137,7 +134,7 @@ class endpointmanager { * @param type $filename * @return type */ - function tftp_fetch($host, $filename) { + function tftp_fetch($host, $filename) { //first off let's check if this is installed or disabled $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); @@ -168,26 +165,26 @@ class endpointmanager { // for large files this function should take a file handle as an arg $ret .= substr($buffer, 4); } while (strlen($buffer) == 516); // the first non-full packet is the last. - return $ret; + return $ret; } - + function tftp_check() { //create a simple block here incase people have strange issues going on as we will kill http //by running this if the server isn't really running! $sql = 'SELECT value FROM endpointman_global_vars WHERE var_name = \'tftp_check\''; - if($this->eda->sql($sql, 'getOne') != 1){ + if ($this->eda->sql($sql, 'getOne') != 1) { $sql = 'UPDATE endpointman_global_vars SET value = \'1\' WHERE var_name = \'tftp_check\''; $this->eda->sql($sql); $subject = shell_exec("netstat -luan --numeric-ports"); - if(preg_match('/:69\s/i', $subject)) { - $rand = md5(rand(10,2000)); - if(file_put_contents($this->global_cfg['config_location'].'TEST', $rand)) { - if($this->tftp_fetch('127.0.0.1','TEST') != $rand) { + if (preg_match('/:69\s/i', $subject)) { + $rand = md5(rand(10, 2000)); + if (file_put_contents($this->global_cfg['config_location'] . 'TEST', $rand)) { + if ($this->tftp_fetch('127.0.0.1', 'TEST') != $rand) { $this->error['tftp_check'] = 'Local TFTP Server is not correctly configured'; } - unlink($this->global_cfg['config_location'].'TEST'); + unlink($this->global_cfg['config_location'] . 'TEST'); } else { - $this->error['tftp_check'] = 'Unable to write to '.$this->global_cfg['config_location']; + $this->error['tftp_check'] = 'Unable to write to ' . $this->global_cfg['config_location']; } } else { $dis = FALSE; @@ -198,10 +195,9 @@ class endpointmanager { $dis = TRUE; } } - if(!$dis) { - $this->error['tftp_check'] = 'TFTP Server is not running.
      '. - 'See here for instructions on how to install one: http://wiki.provisioner.net/index.php/Tftp'; - + if (!$dis) { + $this->error['tftp_check'] = 'TFTP Server is not running.
      ' . + 'See here for instructions on how to install one: http://wiki.provisioner.net/index.php/Tftp'; } } $sql = 'UPDATE endpointman_global_vars SET value = \'0\' WHERE var_name = \'tftp_check\''; @@ -209,7 +205,6 @@ class endpointmanager { } else { $this->error['tftp_check'] = 'TFTP Server check failed on last past. Skipping'; } - } function display_htmlspecialchars($contents) { @@ -691,7 +686,7 @@ class endpointmanager { foreach ($lines_info as $line) { $phone_info['line'][$line['line']] = $line; $phone_info['line'][$line['line']]['description'] = $line['epm_description']; - } + } } else { $sql = "SELECT id, mac, ext FROM endpointman_mac_list WHERE id =" . $mac_id; //Phone is unknown, we need to display this to the end user so that they can make corrections @@ -854,7 +849,7 @@ class endpointmanager { if (!empty($custom_cfg_data)) { $custom_cfg_data = unserialize($custom_cfg_data); if (array_key_exists('data', $custom_cfg_data)) { - if(array_key_exists('ari', $custom_cfg_data)) { + if (array_key_exists('ari', $custom_cfg_data)) { $extra_data = $custom_cfg_data['ari']; } else { $template_type = 'GLOBAL'; @@ -901,7 +896,7 @@ class endpointmanager { $lcount = isset($var_items['line_count']) ? $var_items['line_count'] : $lcount; $key = "line|" . $lcount . "|" . $var_name; $items[$variables_count] = $items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data,$template_type); + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; $variables_count++; } @@ -920,7 +915,7 @@ class endpointmanager { $tv = explode('_', $variable); $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; $items[$variables_count] = $var_items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data,$template_type); + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; $variables_count++; } @@ -943,7 +938,7 @@ class endpointmanager { $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; if (isset($extra_data[$key])) { $items[$variables_count] = $var_items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data,$template_type); + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; $variables_count++; } @@ -954,7 +949,7 @@ class endpointmanager { //Both Views switch ($config_options['type']) { case "break": - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data,$template_type); + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); $variables_count++; break; default: @@ -972,10 +967,10 @@ class endpointmanager { } if ((!$admin) AND (isset($extra_data[$key]))) { $custom_cfg_data[$key] = $user_cfg_data[$key]; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data,$template_type); + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); $variables_count++; } elseif ($admin) { - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data,$template_type); + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); $variables_count++; } } @@ -997,7 +992,7 @@ class endpointmanager { * @param array $custom_cfg_data * @return array */ - function generate_form_data($i, $cfg_data, $key=NULL, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $extra_data=NULL,$template_type='GENERAL') { + function generate_form_data($i, $cfg_data, $key=NULL, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $extra_data=NULL, $template_type='GENERAL') { switch ($cfg_data['type']) { case "input": if ((!$admin) && (isset($user_cfg_data[$key]))) { @@ -1116,11 +1111,11 @@ class endpointmanager { $template_variables_array['ari']['checked'] = "checked"; } } - - if($template_type == 'GLOBAL') { + + if ($template_type == 'GLOBAL') { $template_variables_array['freepbxed'] = 1; $template_variables_array['freepbx']['key'] = $key; - if(empty($extra_data)) { + if (empty($extra_data)) { $template_variables_array['freepbx']['checked'] = TRUE; } elseif (isset($extra_data[$key])) { $template_variables_array['freepbx']['checked'] = TRUE; @@ -1281,11 +1276,11 @@ class endpointmanager { //Create Directory Structure (If needed) if (isset($provisioner_lib->directory_structure)) { foreach ($provisioner_lib->directory_structure as $data) { - if(file_exists(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { + if (file_exists(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { $dir_iterator = new RecursiveDirectoryIterator(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data . "/"); $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST); // could use CHILD_FIRST if you so wish - foreach ($iterator as $file) { + foreach ($iterator as $file) { $dir = $write_path . str_replace(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/", "", dirname($file)); if (!file_exists($dir)) { if (!@mkdir($dir, 0755, TRUE)) { @@ -1312,7 +1307,7 @@ class endpointmanager { if (file_exists(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { $file = $write_path . $data; $orig = PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data; - if(!file_exists($file)) { + if (!file_exists($file)) { if (!@copy($orig, $file)) { $this->error['parse_configs'] = "Could Not Create File: " . $data; return(FALSE); @@ -1325,21 +1320,21 @@ class endpointmanager { foreach ($returned_data as $file => $data) { if (((file_exists($write_path . $file)) AND (is_writable($write_path . $file)) AND (!in_array($file, $provisioner_lib->protected_files))) OR (!file_exists($write_path . $file))) { //Move old file to backup - if(!$this->global_cfg['backup_check']) { - if(!file_exists($write_path.'config_bkup')) { - if (!@mkdir($write_path.'config_bkup', 0755)) { + if (!$this->global_cfg['backup_check']) { + if (!file_exists($write_path . 'config_bkup')) { + if (!@mkdir($write_path . 'config_bkup', 0755)) { $this->error['parse_configs'] = "Could Not Create Backup Directory"; return(FALSE); } } if (file_exists($write_path . $file)) { - copy($write_path . $file, $write_path . 'config_bkup/' . $file . '.'.time()); + copy($write_path . $file, $write_path . 'config_bkup/' . $file . '.' . time()); } } file_put_contents($write_path . $file, $data); chmod($write_path . $file, 0666); if (!file_exists($write_path . $file)) { - $this->error['parse_configs'] = "File (".$file.") not written to hard drive!"; + $this->error['parse_configs'] = "File (" . $file . ") not written to hard drive!"; return(FALSE); } } elseif (!in_array($file, $provisioner_lib->protected_files)) { @@ -1535,7 +1530,7 @@ class endpointmanager { $new_template_data['network']['gateway'] = ''; $new_template_data['network']['vlan']['id'] = ''; $new_template_data['network']['vlan']['qos'] = ''; - + //Overwrite all specific settings variables now if (!empty($phone_info['specific_settings'])) { $specific_settings = unserialize($phone_info['specific_settings']); @@ -1543,13 +1538,13 @@ class endpointmanager { } else { $specific_settings = array(); } - + //Set Variables according to the template_data files included. We can include different template.xml files within family_data.xml also one can create //template_data_custom.xml which will get included or template_data__custom.xml which will also get included //line 'global' will set variables that aren't line dependant - - + + $provisioner_lib->settings = $new_template_data; //Loop through Lines! @@ -1557,24 +1552,24 @@ class endpointmanager { foreach ($phone_info['line'] as $line) { $line_options = is_array($line_ops[$line['line']]) ? $line_ops[$line['line']] : array(); $line_statics = array('line' => $line['line'], 'username' => $line['ext'], 'authname' => $line['ext'], 'secret' => $line['secret'], 'displayname' => $line['description'], 'server_host' => $this->global_cfg['srvip'], 'server_port' => '5060'); - + $provisioner_lib->settings['line'][$li] = array_merge($line_options, $line_statics); $li++; } - - foreach($specific_settings['data'] as $key => $data) { + + foreach ($specific_settings['data'] as $key => $data) { $default_exp = preg_split("/\|/i", $key); - if(isset($default_exp[2])) { + if (isset($default_exp[2])) { //lineloop $var = $default_exp[2]; $line = $default_exp[1]; $loc = $this->arraysearchrecursive($line, $provisioner_lib->settings['line'], 'line'); - if($loc !== FALSE) { + if ($loc !== FALSE) { $k = $loc[0]; $provisioner_lib->settings['line'][$k][$var] = $data; } else { //Adding a new line-ish type options - if(isset($specific_settings['data']['line|'.$line.'|line_enabled'])) { + if (isset($specific_settings['data']['line|' . $line . '|line_enabled'])) { $lastkey = array_pop(array_keys($provisioner_lib->settings['line'])); $lastkey++; $provisioner_lib->settings['line'][$lastkey]['line'] = $line; @@ -1602,7 +1597,7 @@ class endpointmanager { try { $returned_data = $provisioner_lib->generate_all_files(); } catch (Exception $e) { - $this->error['prepare_configs'] = 'Error Returned From Provisioner Library: '. $e->getMessage(); + $this->error['prepare_configs'] = 'Error Returned From Provisioner Library: ' . $e->getMessage(); return(FALSE); } //print_r($provisioner_lib->debug_return); @@ -1711,7 +1706,7 @@ class endpointmanager { $sql = 'UPDATE endpointman_product_list SET firmware_files = "", firmware_vers = "" WHERE id = ' . $id; $this->eda->sql($sql); } - + function sys_get_temp_dir() { if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); @@ -1803,6 +1798,7 @@ class endpointmanager { } function download_json($location, $directory=NULL) { + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; if (!isset($directory)) { $destination_file = PHONE_MODULES_PATH . 'endpoint/master.json'; $directory = "master"; @@ -1812,7 +1808,7 @@ class endpointmanager { } $destination_file = PHONE_MODULES_PATH . '/' . $directory . '/brand_data.json'; } - $temp_file = PHONE_MODULES_PATH . 'temp/' . $directory . '.json'; + $temp_file = $temp_directory . $directory . '.json'; file_exists(dirname($temp_file)) ? '' : mkdir(dirname($temp_file)); if ($this->download_file($location, $temp_file)) { @@ -1841,7 +1837,8 @@ class endpointmanager { * @return array An array of all the brands/products/models and information about what's enabled, installed or otherwise */ function update_check() { - if(!$this->global_cfg['use_repo']) { + $temp_location = $this->sys_get_temp_dir() . "/epm_temp/"; + if (!$this->global_cfg['use_repo']) { $master_result = $this->download_file(UPDATE_PATH . "master.json", PHONE_MODULES_PATH . "endpoint/master.json"); if (!$master_result) { @@ -1860,19 +1857,20 @@ class endpointmanager { if ($contents != '1') { if (($data == "") OR ($data <= $endpoint_last_mod)) { - if ((!$master_result) OR (!$this->download_file(UPDATE_PATH . '/' . $endpoint_package, PHONE_MODULES_PATH . "temp/" . $endpoint_package))) { + if ((!$master_result) OR (!$this->download_file(UPDATE_PATH . '/' . $endpoint_package, $temp_location . $endpoint_package))) { $this->error['brand_update_check_json'] = "
      Not able to connect to repository. Using local Provisioner.net Package"; } else { - exec("tar -xvf " . PHONE_MODULES_PATH . 'temp/' . $endpoint_package . " -C " . PHONE_MODULES_PATH . "temp/"); + exec("tar -xvf " . $temp_location . $endpoint_package . " -C " . $temp_location); if (!file_exists(PHONE_MODULES_PATH . "endpoint")) { mkdir(PHONE_MODULES_PATH . "endpoint"); } //TODO: Automate this somehow... - unlink(PHONE_MODULES_PATH . "temp/setup.php"); - rename(PHONE_MODULES_PATH . "temp/endpoint/base.php", PHONE_MODULES_PATH . "endpoint/base.php"); - rename(PHONE_MODULES_PATH . "temp/endpoint/global_template_data.json", PHONE_MODULES_PATH . "endpoint/global_template_data.json"); + + rename($temp_location . "setup.php", PHONE_MODULES_PATH . "autoload.php"); + rename($temp_location . "endpoint/base.php", PHONE_MODULES_PATH . "endpoint/base.php"); + rename($temp_location . "endpoint/global_template_data.json", PHONE_MODULES_PATH . "endpoint/global_template_data.json"); $sql = "UPDATE endpointman_global_vars SET value = '" . $endpoint_last_mod . "' WHERE var_name = 'endpoint_vers'"; $this->eda->sql($sql); @@ -1958,32 +1956,32 @@ class endpointmanager { $this->error['remote_server'] = "The Remote Server Is Currently Syncing With the Master Server, Please try again later"; } } else { - $o = getcwd(); + $o = getcwd(); chdir(dirname(PHONE_MODULES_PATH)); $path = $this->has_git(); - exec($path.' git pull',$output); + exec($path . ' git pull', $output); chdir($o); $temp = $this->file2json(PHONE_MODULES_PATH . 'endpoint/master.json'); $endpoint_package = $temp['data']['package']; $endpoint_last_mod = $temp['data']['last_modified']; - + $sql = "UPDATE endpointman_global_vars SET value = '" . $endpoint_last_mod . "' WHERE var_name = 'endpoint_vers'"; $this->eda->sql($sql); - + $out = $temp['data']['brands']; - + $row = $this->eda->sql('SELECT * FROM endpointman_brand_list WHERE id > 0', 'getAll', DB_FETCHMODE_ASSOC); foreach ($out as $data) { $temp = $this->file2json(PHONE_MODULES_PATH . 'endpoint/' . $data['directory'] . '/brand_data.json'); if (key_exists('directory', $temp['data']['brands'])) { - + //Pull in all variables $directory = $temp['data']['brands']['directory']; $brand_name = $temp['data']['brands']['name']; $brand_id = $temp['data']['brands']['brand_id']; $brand_version = $temp['data']['brands']['last_modified']; - + $b_data = $this->eda->sql("SELECT id FROM endpointman_brand_list WHERE id = '" . $brand_id . "'", 'getOne'); if ($b_data) { $sql = "UPDATE endpointman_brand_list SET local = '1', name = '" . $brand_name . "', cfg_ver = '" . $brand_version . "', installed = 1, hidden = 0 WHERE id = " . $brand_id; @@ -1992,7 +1990,7 @@ class endpointmanager { $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '1', '1')"; $this->eda->sql($sql); } - + $last_mod = ""; foreach ($temp['data']['brands']['family_list'] as $family_list) { $last_mod = max($last_mod, $family_list['last_modified']); @@ -2000,13 +1998,13 @@ class endpointmanager { $family_line_xml = $this->file2json(PHONE_MODULES_PATH . '/endpoint/' . $directory . '/' . $family_list['directory'] . '/family_data.json'); $family_line_xml['data']['last_modified'] = isset($family_line_xml['data']['last_modified']) ? $family_line_xml['data']['last_modified'] : ''; - + /* DONT DO THIS YET - $require_firmware = NULL; - if ((key_exists('require_firmware', $family_line_xml['data'])) && ($remote) && ($family_line_xml['data']['require_firmware'] == "TRUE")) { - echo "Firmware Requirment Detected!..........
      "; - $this->install_firmware($family_line_xml['data']['id']); - } + $require_firmware = NULL; + if ((key_exists('require_firmware', $family_line_xml['data'])) && ($remote) && ($family_line_xml['data']['require_firmware'] == "TRUE")) { + echo "Firmware Requirment Detected!..........
      "; + $this->install_firmware($family_line_xml['data']['id']); + } * */ @@ -2018,10 +2016,10 @@ class endpointmanager { $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . $short_name . "', '" . $family_line_xml['data']['name'] . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['last_modified'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')"; } $this->eda->sql($sql); - + foreach ($family_line_xml['data']['model_list'] as $model_list) { $template_list = implode(",", $model_list['template_data']); - + $m_data = $this->eda->sql("SELECT id FROM endpointman_model_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'", 'getone'); if ($m_data) { $sql = "UPDATE endpointman_model_list SET max_lines = '" . $model_list['lines'] . "', model = '" . $model_list['model'] . "', template_list = '" . $template_list . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'"; @@ -2031,7 +2029,7 @@ class endpointmanager { $this->eda->sql($sql); if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'])) { - echo "System Error in Sync Model Function, Load Failure!".$model_list['model']; + echo "System Error in Sync Model Function, Load Failure!" . $model_list['model']; } } //Phone Models Move Here @@ -2053,7 +2051,7 @@ class endpointmanager { } $this->eda->sql($sql); } - } + } } foreach ($temp['data']['brands']['oui_list'] as $oui) { $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('" . $oui . "', '" . $brand_id . "', '0')"; @@ -2069,7 +2067,8 @@ class endpointmanager { * @param integer $id Brand ID */ function download_brand($id) { - if(!$this->global_cfg['use_repo']) { + if (!$this->global_cfg['use_repo']) { + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; $row = $this->eda->sql('SELECT * FROM endpointman_brand_list WHERE id =' . $id, 'getAll', DB_FETCHMODE_ASSOC); echo "Downloading Brand JSON....."; $result = $this->download_file(UPDATE_PATH . $row[0]['directory'] . "/" . $row[0]['directory'] . ".json", PHONE_MODULES_PATH . "endpoint/" . $row[0]['directory'] . "/brand_data.json"); @@ -2081,29 +2080,29 @@ class endpointmanager { $package = $temp['data']['brands']['package']; echo "
      Downloading Brand Package...
      .
      "; - $this->download_file_with_progress_bar(UPDATE_PATH . $row[0]['directory'] . '/' . $package, PHONE_MODULES_PATH . "temp/" . $package); + $this->download_file_with_progress_bar(UPDATE_PATH . $row[0]['directory'] . '/' . $package, $temp_directory . $package); echo "
      "; - if (file_exists(PHONE_MODULES_PATH . 'temp/' . $package)) { + if (file_exists($temp_directory . $package)) { $md5_xml = $temp['data']['brands']['md5sum']; - $md5_pkg = md5_file(PHONE_MODULES_PATH . 'temp/' . $package); + $md5_pkg = md5_file($temp_directory . $package); echo "Checking MD5sum of Package...."; if ($md5_xml == $md5_pkg) { echo "Done!
      "; echo "Extracting Tarball........"; - exec("tar -xvf " . PHONE_MODULES_PATH . 'temp/' . $package . " -C " . PHONE_MODULES_PATH . "temp/"); + exec("tar -xvf " . $temp_directory . $package . " -C " . $temp_directory); echo "Done!
      "; //Update File in the temp directory - copy(PHONE_MODULES_PATH . 'endpoint/' . $row[0]['directory'] . '/brand_data.json', PHONE_MODULES_PATH . 'temp/' . $row[0]['directory'] . '/brand_data.json'); + copy(PHONE_MODULES_PATH . 'endpoint/' . $row[0]['directory'] . '/brand_data.json', $temp_directory . $row[0]['directory'] . '/brand_data.json'); $this->update_brand($row[0]['directory'], TRUE); } else { echo "MD5 Did not match!"; } } else { - $this->error['uploader'] = "Can't Find Downloaded File!"; + echo "Can't Find Downloaded File!"; } } else { echo "
      Error Connecting to the Package Repository. Module not installed. Please Try again later.
      You Can Also Manually Update The Repository By Downloading Files here: Release Repo
      Then Use Manual Upload in Advanced Settings"; @@ -2118,8 +2117,9 @@ class endpointmanager { * Still needs way to determine when models move...perhaps another function? */ function update_brand($package, $remote=TRUE) { - if (file_exists(PHONE_MODULES_PATH . 'temp/' . $package . '/brand_data.json')) { - $temp = $this->file2json(PHONE_MODULES_PATH . 'temp/' . $package . '/brand_data.json'); + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + if (file_exists($temp_directory . $package . '/brand_data.json')) { + $temp = $this->file2json($temp_directory . $package . '/brand_data.json'); if (key_exists('directory', $temp['data']['brands'])) { echo "Appears to be a valid Provisioner.net JSON file.....Continuing
      "; @@ -2136,18 +2136,18 @@ class endpointmanager { mkdir(PHONE_MODULES_PATH . "endpoint/" . $directory); } - $dir_iterator = new RecursiveDirectoryIterator(PHONE_MODULES_PATH . "temp/" . $directory . "/"); + $dir_iterator = new RecursiveDirectoryIterator($temp_directory . $directory . "/"); $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file) { if (is_dir($file)) { - $dir = str_replace(PHONE_MODULES_PATH . "temp/" . $directory . "/", "", $file); + $dir = str_replace($temp_directory . $directory . "/", "", $file); if (!file_exists(PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir)) { mkdir(PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0764, TRUE); echo "."; } } else { if ((basename($file) != "brand_data.json") OR (!$remote)) { - $dir = str_replace(PHONE_MODULES_PATH . "temp/" . $directory . "/", "", $file); + $dir = str_replace($temp_directory . $directory . "/", "", $file); $stats = rename($file, PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir); if ($stats === FALSE) { echo "Error Moving " . basename($file); @@ -2316,20 +2316,20 @@ class endpointmanager { } //Phone Models Move Here $family_id = $brand_id . $family_line_xml['data']['id']; - $sql = "SELECT * FROM endpointman_model_list WHERE product_id = ".$family_id; + $sql = "SELECT * FROM endpointman_model_list WHERE product_id = " . $family_id; $products = $this->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); - foreach($products as $data) { - if(!$this->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { - echo "Moving/Removing Model '".$data['model']."' not present in JSON file......
      "; + foreach ($products as $data) { + if (!$this->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { + echo "Moving/Removing Model '" . $data['model'] . "' not present in JSON file......
      "; $model_name = $data['model']; - $sql = 'DELETE FROM endpointman_model_list WHERE id = '.$data['id']; + $sql = 'DELETE FROM endpointman_model_list WHERE id = ' . $data['id']; $this->eda->sql($sql); - $sql = "SELECT id FROM endpointman_model_list WHERE model LIKE '".$model_name."'"; - $new_model_id = $this->eda->sql($sql,'getOne'); - if($new_model_id) { - $sql = "UPDATE endpointman_mac_list SET model = '".$new_model_id."' WHERE model = '".$data['id']."'"; + $sql = "SELECT id FROM endpointman_model_list WHERE model LIKE '" . $model_name . "'"; + $new_model_id = $this->eda->sql($sql, 'getOne'); + if ($new_model_id) { + $sql = "UPDATE endpointman_mac_list SET model = '" . $new_model_id . "' WHERE model = '" . $data['id'] . "'"; } else { - $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '".$data['id']."'"; + $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '" . $data['id'] . "'"; } $this->eda->sql($sql); } @@ -2350,7 +2350,7 @@ class endpointmanager { } echo "Removing Temporary Files.............."; - $this->rmrf(PHONE_MODULES_PATH . "temp/" . $package); + $this->rmrf($temp_directory . $package); echo "Done!
      "; } @@ -2358,35 +2358,50 @@ class endpointmanager { * Remove the brand * @param int $id Brand ID */ - function remove_brand($id=NULL, $remove_configs=FALSE) { - if(!$this->global_cfg['use_repo']) { - $sql = 'SELECT id, firmware_vers FROM endpointman_product_list WHERE brand = ' . $id; - $products = $this->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); - foreach ($products as $data) { - if ($data['firmware_vers'] != "") { - $this->remove_firmware($data['id']); - } - } - - $brand_dir = $this->eda->sql("SELECT directory FROM endpointman_brand_list WHERE id=" . $id, 'getone'); - $this->rmrf(PHONE_MODULES_PATH . "endpoint/" . $brand_dir); - - $sql = "DELETE FROM endpointman_model_list WHERE brand = '" . $id . "'"; - $this->eda->sql($sql); - - $sql = "DELETE FROM endpointman_product_list WHERE brand = '" . $id . "'"; - $this->eda->sql($sql); - - $sql = "DELETE FROM endpointman_oui_list WHERE brand = '" . $id . "'"; - $this->eda->sql($sql); - - $this->rmrf(PHONE_MODULES_PATH . $brand_dir); - $sql = "DELETE FROM endpointman_brand_list WHERE id = " . $id; - - $this->eda->sql($sql); - } else { - $this->error['remove_brand'] = "Not allowed in repo mode"; - } + function remove_brand($id=NULL, $remove_configs=FALSE, $force=FALSE) { + if (!$this->global_cfg['use_repo']) { + $sql = 'SELECT id, firmware_vers FROM endpointman_product_list WHERE brand = ' . $id; + $products = $this->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); + foreach ($products as $data) { + if ($data['firmware_vers'] != "") { + $this->remove_firmware($data['id']); + } + } + + $brand_dir = $this->eda->sql("SELECT directory FROM endpointman_brand_list WHERE id=" . $id, 'getone'); + $this->rmrf(PHONE_MODULES_PATH . "endpoint/" . $brand_dir); + + $sql = "DELETE FROM endpointman_model_list WHERE brand = '" . $id . "'"; + $this->eda->sql($sql); + + $sql = "DELETE FROM endpointman_product_list WHERE brand = '" . $id . "'"; + $this->eda->sql($sql); + + $sql = "DELETE FROM endpointman_oui_list WHERE brand = '" . $id . "'"; + $this->eda->sql($sql); + + $this->rmrf(PHONE_MODULES_PATH . $brand_dir); + $sql = "DELETE FROM endpointman_brand_list WHERE id = " . $id; + + $this->eda->sql($sql); + } elseif ($force) { + $brand_dir = $this->eda->sql("SELECT directory FROM endpointman_brand_list WHERE id=" . $id, 'getone'); + + $sql = "DELETE FROM endpointman_model_list WHERE brand = '" . $id . "'"; + $this->eda->sql($sql); + + $sql = "DELETE FROM endpointman_product_list WHERE brand = '" . $id . "'"; + $this->eda->sql($sql); + + $sql = "DELETE FROM endpointman_oui_list WHERE brand = '" . $id . "'"; + $this->eda->sql($sql); + + $sql = "DELETE FROM endpointman_brand_list WHERE id = " . $id; + + $this->eda->sql($sql); + } else { + $this->error['remove_brand'] = "Not allowed in repo mode"; + } } function merge_data($path, $template_list, $maxlines = 3) { @@ -2539,7 +2554,7 @@ class endpointmanager { $template_data_array = array(); $template_data_array = $this->merge_data(PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/', $template_list_array); - + $sql = "UPDATE endpointman_model_list SET template_data = '" . serialize($template_data_array) . "' WHERE id = '" . $model . "'"; $this->eda->sql($sql); return(TRUE); @@ -2618,25 +2633,25 @@ class endpointmanager { function download_file($url_file, $destination_file) { $contents = file_get_contents($url_file); - + if (preg_match('/200/', $http_response_header[0])) { $dirname = dirname($destination_file); if (!file_exists($dirname)) { mkdir($dirname); } if (!is_writable($dirname)) { - $this->error['download_file'] = "Directory '".$dirname."' is not writable! Unable to download files"; - return false; + $this->error['download_file'] = "Directory '" . $dirname . "' is not writable! Unable to download files"; + return false; } file_put_contents($destination_file, $contents); //check file placement if (!file_exists($destination_file)) { - $this->error['download_file'] = "File Doesn't Exist in '".$dirname."'. Unable to download files"; + $this->error['download_file'] = "File Doesn't Exist in '" . $dirname . "'. Unable to download files"; return false; } return true; } else { - $this->error['download_file'] = "Server Replied with error '".$http_response_header[0]."'. Unable to download files"; + $this->error['download_file'] = "Server Replied with error '" . $http_response_header[0] . "'. Unable to download files"; return false; } } @@ -3094,7 +3109,7 @@ class endpointmanager { function validate_json($json) { return(TRUE); } - + function has_git() { exec('which git', $output); diff --git a/module.xml b/module.xml index 8ecfc558..b8e5badc 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.3.9 + 2.10.4.0 setup Connectivity Andrew Nagy @@ -15,7 +15,7 @@ PBX End Point Manager supports automated deployment of multiple manufacturers IP telephones. - *2.10.3.8* https://github.com/tm1000/freepbx-endpointmanager/commits/master + *2.10.4.0* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager release/2.10/endpointman-2.10.3.7.tgz diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html index 6e4644c6..dca948f0 100644 --- a/templates/freepbx/advanced_settings_settings.html +++ b/templates/freepbx/advanced_settings_settings.html @@ -120,7 +120,7 @@ - + From 8b2220ae5a09d826380671984b81d5d8ba4e7dbc Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 7 Jun 2012 16:20:30 -0700 Subject: [PATCH 291/623] Overall fixes/changes -Added tooltips to options on settings page to further explain settings -fixed latin1 defaults on endpoint manager installer -allow updating of extensions with leading zeros -fixed static network assignment of devices (if used/needed) -brought module up to 2.10.4.1 -Added brackets [] for radio options inside template editor for better viewing --- includes/functions.inc | 37 +- install.php | 674 +++++++++--------- module.xml | 2 +- .../freepbx/advanced_settings_settings.html | 14 +- templates/freepbx/template_editor.html | 4 +- 5 files changed, 370 insertions(+), 361 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index f6758743..8a2d3cf5 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -450,7 +450,7 @@ class endpointmanager { $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; $name = $this->eda->sql($sql, 'getOne'); - $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = " . $row['ext'] . ", description = '" . addslashes($name) . "' WHERE luid = " . $row['luid']; + $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . addslashes($name) . "' WHERE luid = " . $row['luid']; $this->eda->sql($sql); } @@ -1523,14 +1523,6 @@ class endpointmanager { $new_template_data['ntp'] = $settings['ntp']; - $new_template_data['network']['dhcp'] = TRUE; - $new_template_data['network']['ipv4'] = ''; - $new_template_data['network']['ipv6'] = ''; - $new_template_data['network']['subnet'] = '255.255.255.0'; - $new_template_data['network']['gateway'] = ''; - $new_template_data['network']['vlan']['id'] = ''; - $new_template_data['network']['vlan']['qos'] = ''; - //Overwrite all specific settings variables now if (!empty($phone_info['specific_settings'])) { $specific_settings = unserialize($phone_info['specific_settings']); @@ -1539,7 +1531,6 @@ class endpointmanager { $specific_settings = array(); } - //Set Variables according to the template_data files included. We can include different template.xml files within family_data.xml also one can create //template_data_custom.xml which will get included or template_data__custom.xml which will also get included //line 'global' will set variables that aren't line dependant @@ -1577,10 +1568,32 @@ class endpointmanager { } } } else { - $provisioner_lib->settings[$var] = $data; + switch ($key) { + case "connection_type": + $provisioner_lib->settings['network'][$key] = $data; + break; + case "ip4_address": + $provisioner_lib->settings['network']['ipv4'] = $data; + break; + case "ip6_address": + $provisioner_lib->settings['network']['ipv6'] = $data; + break; + case "subnet_mask": + $provisioner_lib->settings['network']['subnet'] = $data; + break; + case "gateway_address": + $provisioner_lib->settings['network']['gateway'] = $data; + break; + case "primary_dns": + $provisioner_lib->settings['network'][$key] = $data; + break; + default: + $provisioner_lib->settings[$key] = $data; + break; + } } } - + $provisioner_lib->settings['mac'] = $phone_info['mac']; $provisioner_lib->mac = $phone_info['mac']; diff --git a/install.php b/install.php index 78d0bbe9..50caf781 100644 --- a/install.php +++ b/install.php @@ -1,4 +1,5 @@ "; + echo $text . "
      "; } + } -if (! function_exists("outn")) { +if (!function_exists("outn")) { + function outn($text) { echo $text; } + } function epm_rmrf($dir) { - if(file_exists($dir)) { + if (file_exists($dir)) { $iterator = new RecursiveDirectoryIterator($dir); foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) { if ($file->isDir()) { @@ -34,21 +39,21 @@ function epm_rmrf($dir) { } function find_exec($exec) { - $usr_bin = glob("/usr/bin/".$exec); - $usr_sbin = glob("/usr/sbin/".$exec); - $sbin = glob("/sbin/".$exec); - $bin = glob("/bin/".$exec); - $etc = glob("/etc/".$exec); - if(isset($usr_bin[0])) { - return("/usr/bin/".$exec); - } elseif(isset($usr_sbin[0])) { - return("/usr/sbin/".$exec); - } elseif(isset($sbin[0])) { - return("/sbin/".$exec); - } elseif(isset($bin[0])) { - return("/bin/".$exec); - } elseif(isset($etc[0])) { - return("/etc/".$exec); + $usr_bin = glob("/usr/bin/" . $exec); + $usr_sbin = glob("/usr/sbin/" . $exec); + $sbin = glob("/sbin/" . $exec); + $bin = glob("/bin/" . $exec); + $etc = glob("/etc/" . $exec); + if (isset($usr_bin[0])) { + return("/usr/bin/" . $exec); + } elseif (isset($usr_sbin[0])) { + return("/usr/sbin/" . $exec); + } elseif (isset($sbin[0])) { + return("/sbin/" . $exec); + } elseif (isset($bin[0])) { + return("/bin/" . $exec); + } elseif (isset($etc[0])) { + return("/etc/" . $exec); } else { return($exec); } @@ -58,32 +63,33 @@ function find_exec($exec) { out("Endpoint Manager Installer"); -define("PHONE_MODULES_PATH", $amp_conf['AMPWEBROOT'].'/admin/modules/_ep_phone_modules/'); -define("LOCAL_PATH", $amp_conf['AMPWEBROOT'].'/admin/modules/endpointman/'); +define("PHONE_MODULES_PATH", $amp_conf['AMPWEBROOT'] . '/admin/modules/_ep_phone_modules/'); +define("LOCAL_PATH", $amp_conf['AMPWEBROOT'] . '/admin/modules/endpointman/'); -if(!file_exists(PHONE_MODULES_PATH)) { +if (!file_exists(PHONE_MODULES_PATH)) { mkdir(PHONE_MODULES_PATH, 0764); out("Creating Phone Modules Directory"); } -if(!file_exists(PHONE_MODULES_PATH."setup.php")) { - copy(LOCAL_PATH."install/setup.php",PHONE_MODULES_PATH."setup.php"); +if (!file_exists(PHONE_MODULES_PATH . "setup.php")) { + copy(LOCAL_PATH . "install/setup.php", PHONE_MODULES_PATH . "setup.php"); out("Moving Auto Provisioner Class"); } -if(!file_exists(PHONE_MODULES_PATH."temp/")) { - mkdir(PHONE_MODULES_PATH."temp/", 0764); +if (!file_exists(PHONE_MODULES_PATH . "temp/")) { + mkdir(PHONE_MODULES_PATH . "temp/", 0764); out("Creating temp folder"); } + //Detect Version -function ep_table_exists ($table) { - global $amp_conf,$db; - $sql = "SHOW TABLES FROM ".$amp_conf['AMPDBNAME']; +function ep_table_exists($table) { + global $amp_conf, $db; + $sql = "SHOW TABLES FROM " . $amp_conf['AMPDBNAME']; $result = $db->getAll($sql); - foreach($result as $row) { + foreach ($result as $row) { if ($row[0] == $table) { return TRUE; } @@ -91,7 +97,7 @@ function ep_table_exists ($table) { return FALSE; } -$epm_module_xml = epm_install_xml2array(LOCAL_PATH."module.xml"); +$epm_module_xml = epm_install_xml2array(LOCAL_PATH . "module.xml"); preg_match('/^(\d*)\.(\d*)/', $epm_module_xml['module']['version'], $versions); @@ -105,8 +111,8 @@ function ep_table_exists ($table) { $amp_version['minor'] = $versions[2]; -if($amp_version['minor'] < 9) { - out("Warning: Endpoint Manager is unsupported on FreePBX 2.".$amp_version['minor'].". We do check it on occasion but it is not a supported platform"); +if ($amp_version['minor'] < 9) { + out("Warning: Endpoint Manager is unsupported on FreePBX 2." . $amp_version['minor'] . ". We do check it on occasion but it is not a supported platform"); } @@ -114,16 +120,16 @@ function ep_table_exists ($table) { $full_vers = $db->getOne($sql); -if($db->getOne($sql)) { +if ($db->getOne($sql)) { $new_install = FALSE; - $global_cfg =& $db->getAssoc("SELECT var_name, value FROM endpointman_global_vars"); - - if(preg_match('/^(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)) { - - }elseif(preg_match('/^(\d*)\.(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)){ - - }elseif(preg_match('/^(\d*)\.(\d*)\.(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)){ + $global_cfg = & $db->getAssoc("SELECT var_name, value FROM endpointman_global_vars"); + if (preg_match('/^(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)) { + + } elseif (preg_match('/^(\d*)\.(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)) { + + } elseif (preg_match('/^(\d*)\.(\d*)\.(\d*)\.(\d*)\.(\d*)$/', $full_vers, $versions)) { + } $very['major'] = $versions[1]; @@ -132,17 +138,17 @@ function ep_table_exists ($table) { $very['subsubminor'] = isset($versions[4]) ? $versions[4] : '0'; $ver = $very['major'] . $very['minor'] . $very['subminor'] . $very['subsubminor']; - - out('Version Identified as '. $full_vers); - out('Internal Reference Number: '.$ver); + + out('Version Identified as ' . $full_vers); + out('Internal Reference Number: ' . $ver); } else { $new_install = TRUE; out('New Installation Detected!'); } -if(!$new_install) { +if (!$new_install) { - if(($ver < "1900") AND ($ver > 0)) { + if (($ver < "1900") AND ($ver > 0)) { out("Please Wait While we upgrade your old setup"); //Expand the value option $sql = 'ALTER TABLE `endpointman_global_vars` CHANGE `value` `value` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT \'Data\''; @@ -162,9 +168,9 @@ function ep_table_exists ($table) { (7, 'version', '2.0.0'), (8, 'enable_ari', '0'), (9, 'debug', '0'), - (10, 'arp_location', '".$arp."'), - (11, 'nmap_location', '".$nmap."'), - (12, 'asterisk_location', '".$asterisk."'), + (10, 'arp_location', '" . $arp . "'), + (11, 'nmap_location', '" . $nmap . "'), + (12, 'asterisk_location', '" . $asterisk . "'), (13, 'language', ''), (14, 'check_updates', '1'), (15, 'disable_htaccess', ''), @@ -279,31 +285,31 @@ function ep_table_exists ($table) { $db->query($sql); $old_models = array( - "57iCT" => array("brand" => 1, "model" => 2, "product" => 7), - "57i" => array("brand" => 1, "model" => 3, "product" => 7), - "330" => array("brand" => 4, "model" => 6, "product" => 4), - "560" => array("brand" => 4, "model" => 7, "product" => 4), - "300" => array("brand" => 6, "model" => 8, "product" => 8), - "320" => array("brand" => 6, "model" => 9, "product" => 8), - "360" => array("brand" => 6, "model" => 10, "product" => 8), - "370" => array("brand" => 6, "model" => 11, "product" => 8), - "820" => array("brand" => 6, "model" => 12, "product" => 8), - "M3" => array("brand" => 6, "model" => 13, "product" => 8), - "GXP-2000" => array("brand" => 2, "model" => 15, "product" => 1), - "BT200_201" => array("brand" => 2, "model" => 27, "product" => 2), - "spa941" => array("brand" => 0, "model" => 0, "product" => 0), - "spa942" => array("brand" => 0, "model" => 0, "product" => 0), - "spa962" => array("brand" => 0, "model" => 0, "product" => 0), - "55i" => array("brand" => 1, "model" => 4, "product" => 7) + "57iCT" => array("brand" => 1, "model" => 2, "product" => 7), + "57i" => array("brand" => 1, "model" => 3, "product" => 7), + "330" => array("brand" => 4, "model" => 6, "product" => 4), + "560" => array("brand" => 4, "model" => 7, "product" => 4), + "300" => array("brand" => 6, "model" => 8, "product" => 8), + "320" => array("brand" => 6, "model" => 9, "product" => 8), + "360" => array("brand" => 6, "model" => 10, "product" => 8), + "370" => array("brand" => 6, "model" => 11, "product" => 8), + "820" => array("brand" => 6, "model" => 12, "product" => 8), + "M3" => array("brand" => 6, "model" => 13, "product" => 8), + "GXP-2000" => array("brand" => 2, "model" => 15, "product" => 1), + "BT200_201" => array("brand" => 2, "model" => 27, "product" => 2), + "spa941" => array("brand" => 0, "model" => 0, "product" => 0), + "spa942" => array("brand" => 0, "model" => 0, "product" => 0), + "spa962" => array("brand" => 0, "model" => 0, "product" => 0), + "55i" => array("brand" => 1, "model" => 4, "product" => 7) ); out("Migrating Old Devices"); $sql = "SELECT * FROM endpointman_mac_list"; $result = $db->query($sql); - while($row =& $result->fetchRow(DB_FETCHMODE_ASSOC)) { + while ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC)) { $id = $row['model']; $new_model = $old_models[$id]['model']; - $sql = "UPDATE endpointman_mac_list SET model = ".$new_model." WHERE id =" . $row['id']; + $sql = "UPDATE endpointman_mac_list SET model = " . $new_model . " WHERE id =" . $row['id']; $db->query($sql); } out("Old Devices Migrated, You must install the phone modules from within endpointmanager to see your old devices!"); @@ -333,13 +339,13 @@ function ep_table_exists ($table) { $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (9, 'debug', '0')"; $db->query($sql_update_vars); - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '".$arp."')"; + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '" . $arp . "')"; $db->query($sql_update_vars); - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '" . $nmap . "')"; $db->query($sql_update_vars); - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '" . $asterisk . "')"; $db->query($sql_update_vars); out("Updating Mac List Table"); @@ -413,13 +419,13 @@ function ep_table_exists ($table) { $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (9, 'debug', '0')"; $db->query($sql_update_vars); - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '".$arp."')"; + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (10, 'arp_location', '" . $arp . "')"; $db->query($sql_update_vars); - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '" . $nmap . "')"; $db->query($sql_update_vars); - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '" . $asterisk . "')"; $db->query($sql_update_vars); out("Update Mac List Table"); @@ -487,22 +493,22 @@ function ep_table_exists ($table) { $db->query($sql); out("Add Automatic Update Check [Can be Disabled]"); - $sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php ".LOCAL_PATH. "includes/update_check.php')"; + $sql = "INSERT INTO cronmanager (module, id, time, freq, lasttime, command) VALUES ('endpointman', 'UPDATES', '23', '24', '0', 'php " . LOCAL_PATH . "includes/update_check.php')"; $db->query($sql); } - if($ver <= "2000") { + if ($ver <= "2000") { out("Locating NMAP + ARP + ASTERISK Executables"); $nmap = find_exec("nmap"); $arp = find_exec("arp"); $asterisk = find_exec("asterisk"); - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$asterisk."')"; + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '" . $asterisk . "')"; $db->query($sql_update_vars); - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '".$nmap."')"; + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (11, 'nmap_location', '" . $nmap . "')"; $db->query($sql_update_vars); - $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '".$asterisk."')"; + $sql_update_vars = "INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (12, 'asterisk_location', '" . $asterisk . "')"; $db->query($sql_update_vars); out("Add Unique to Global Variables Table"); @@ -557,105 +563,105 @@ function ep_table_exists ($table) { $sql = "TRUNCATE TABLE `endpointman_model_list`"; $db->query($sql); - $data =& $db->getAll("SELECT * FROM `endpointman_mac_list",array(), DB_FETCHMODE_ASSOC); + $data = & $db->getAll("SELECT * FROM `endpointman_mac_list", array(), DB_FETCHMODE_ASSOC); $new_model_list = array( - "2" => "1-2-11", - "3" => "1-2-10", - "4" => "1-2-9", - "6" => "4-2-3", - "7" => "4-3-7", - "8" => "6-1-1", - "9" => "6-1-2", - "10" => "6-1-3", - "11" => "6-1-4", - "12" => "6-1-5", - "13" => "6-1-6", - "15" => "2-1-3", - "22" => "4-2-4", - "23" => "2-1-2", - "24" => "2-1-1", - "25" => "2-1-4", - "26" => "2-1-5", - "27" => "2-2-1", - "28" => "2-2-2", - "29" => "4-2-1", - "30" => "4-2-5", - "31" => "4-2-6", - "32" => "4-2-7", - "33" => "4-2-2", - "34" => "4-3-1", - "35" => "4-3-2", - "36" => "4-3-3", - "37" => "4-3-4", - "38" => "4-3-5", - "39" => "4-3-6", - "40" => "4-3-8", - "41" => "4-3-9", - "42" => "4-3-10", - "43" => "4-3-11", - "44" => "4-3-12", - "45" => "4-1-1", - "46" => "4-1-2", - "47" => "1-2-1", - "48" => "1-2-2", - "49" => "1-1-1", - "50" => "1-1-2", - "51" => "1-2-3", - "52" => "1-2-4", - "53" => "1-2-5", - "54" => "1-2-6", - "55" => "1-2-7", - "56" => "1-2-8", - "57" => "", - "58" => "", - "59" => "", - "60" => "7-1-1", - "61" => "7-1-2", - "62" => "8-1-1", - "63" => "8-1-2", - "64" => "8-1-3", - "65" => "8-1-4", - "67" => "7-2-1", - "68" => "7-2-2", - "69" => "7-2-3", - "70" => "7-2-4", - "71" => "7-2-5", - "72" => "7-2-6" + "2" => "1-2-11", + "3" => "1-2-10", + "4" => "1-2-9", + "6" => "4-2-3", + "7" => "4-3-7", + "8" => "6-1-1", + "9" => "6-1-2", + "10" => "6-1-3", + "11" => "6-1-4", + "12" => "6-1-5", + "13" => "6-1-6", + "15" => "2-1-3", + "22" => "4-2-4", + "23" => "2-1-2", + "24" => "2-1-1", + "25" => "2-1-4", + "26" => "2-1-5", + "27" => "2-2-1", + "28" => "2-2-2", + "29" => "4-2-1", + "30" => "4-2-5", + "31" => "4-2-6", + "32" => "4-2-7", + "33" => "4-2-2", + "34" => "4-3-1", + "35" => "4-3-2", + "36" => "4-3-3", + "37" => "4-3-4", + "38" => "4-3-5", + "39" => "4-3-6", + "40" => "4-3-8", + "41" => "4-3-9", + "42" => "4-3-10", + "43" => "4-3-11", + "44" => "4-3-12", + "45" => "4-1-1", + "46" => "4-1-2", + "47" => "1-2-1", + "48" => "1-2-2", + "49" => "1-1-1", + "50" => "1-1-2", + "51" => "1-2-3", + "52" => "1-2-4", + "53" => "1-2-5", + "54" => "1-2-6", + "55" => "1-2-7", + "56" => "1-2-8", + "57" => "", + "58" => "", + "59" => "", + "60" => "7-1-1", + "61" => "7-1-2", + "62" => "8-1-1", + "63" => "8-1-2", + "64" => "8-1-3", + "65" => "8-1-4", + "67" => "7-2-1", + "68" => "7-2-2", + "69" => "7-2-3", + "70" => "7-2-4", + "71" => "7-2-5", + "72" => "7-2-6" ); - foreach($data as $list) { - $sql = "UPDATE endpointman_mac_list SET model = '".$new_model_list[$list['model']]."' WHERE id = ". $list['id']; + foreach ($data as $list) { + $sql = "UPDATE endpointman_mac_list SET model = '" . $new_model_list[$list['model']] . "' WHERE id = " . $list['id']; $db->query($sql); } $new_product_list = array( - "6" => array("product_id" => "1-1", "model_id" => "1-1-1"), - "7" => array("product_id" => "1-2", "model_id" => "1-2-1"), - "1" => array("product_id" => "2-1", "model_id" => "2-1-1"), - "2" => array("product_id" => "2-2", "model_id" => "2-2-1"), - "3" => array("product_id" => "4-2", "model_id" => "4-2-1"), - "5" => array("product_id" => "4-1", "model_id" => "4-1-1"), - "4" => array("product_id" => "4-3", "model_id" => "4-3-1"), - "8" => array("product_id" => "6-1", "model_id" => "6-1-1"), - "9" => array("product_id" => "7-1", "model_id" => "7-1-1"), - "11" => array("product_id" => "7-2", "model_id" => "7-2-1"), - "10" => array("product_id" => "8-1", "model_id" => "8-1-1") + "6" => array("product_id" => "1-1", "model_id" => "1-1-1"), + "7" => array("product_id" => "1-2", "model_id" => "1-2-1"), + "1" => array("product_id" => "2-1", "model_id" => "2-1-1"), + "2" => array("product_id" => "2-2", "model_id" => "2-2-1"), + "3" => array("product_id" => "4-2", "model_id" => "4-2-1"), + "5" => array("product_id" => "4-1", "model_id" => "4-1-1"), + "4" => array("product_id" => "4-3", "model_id" => "4-3-1"), + "8" => array("product_id" => "6-1", "model_id" => "6-1-1"), + "9" => array("product_id" => "7-1", "model_id" => "7-1-1"), + "11" => array("product_id" => "7-2", "model_id" => "7-2-1"), + "10" => array("product_id" => "8-1", "model_id" => "8-1-1") ); $data = array(); - $data =& $db->getAll("SELECT * FROM endpointman_custom_configs",array(), DB_FETCHMODE_ASSOC); - foreach($data as $list) { - $sql = "UPDATE endpointman_custom_configs SET product_id = '".$new_product_list[$list['product_id']]['product_id']."' WHERE id = ". $list['id']; + $data = & $db->getAll("SELECT * FROM endpointman_custom_configs", array(), DB_FETCHMODE_ASSOC); + foreach ($data as $list) { + $sql = "UPDATE endpointman_custom_configs SET product_id = '" . $new_product_list[$list['product_id']]['product_id'] . "' WHERE id = " . $list['id']; $db->query($sql); } $data = array(); - $data =& $db->getAll("SELECT * FROM endpointman_template_list",array(), DB_FETCHMODE_ASSOC); - foreach($data as $list) { - $sql = "UPDATE endpointman_template_list SET model_id = '".$new_product_list[$list['product_id']]['model_id']."', product_id = '".$new_product_list[$list['product_id']]['product_id']."' WHERE id = ". $list['id']; + $data = & $db->getAll("SELECT * FROM endpointman_template_list", array(), DB_FETCHMODE_ASSOC); + foreach ($data as $list) { + $sql = "UPDATE endpointman_template_list SET model_id = '" . $new_product_list[$list['product_id']]['model_id'] . "', product_id = '" . $new_product_list[$list['product_id']]['product_id'] . "' WHERE id = " . $list['id']; $db->query($sql); } @@ -663,20 +669,20 @@ function ep_table_exists ($table) { $db->query('TRUNCATE TABLE `endpointman_custom_configs`'); - exec("rm -Rf ".PHONE_MODULES_PATH); + exec("rm -Rf " . PHONE_MODULES_PATH); - if(!file_exists(PHONE_MODULES_PATH)) { + if (!file_exists(PHONE_MODULES_PATH)) { mkdir(PHONE_MODULES_PATH, 0764); out("Creating Phone Modules Directory"); } - if(!file_exists(PHONE_MODULES_PATH."setup.php")) { - copy(LOCAL_PATH."install/setup.php",PHONE_MODULES_PATH."setup.php"); + if (!file_exists(PHONE_MODULES_PATH . "setup.php")) { + copy(LOCAL_PATH . "install/setup.php", PHONE_MODULES_PATH . "setup.php"); out("Moving Auto Provisioner Class"); } - if(!file_exists(PHONE_MODULES_PATH."temp/")) { - mkdir(PHONE_MODULES_PATH."temp/", 0764); + if (!file_exists(PHONE_MODULES_PATH . "temp/")) { + mkdir(PHONE_MODULES_PATH . "temp/", 0764); out("Creating temp folder"); } } @@ -685,43 +691,43 @@ function ep_table_exists ($table) { out("Remove all Dashes in IDs"); $data = array(); - $data =& $db->getAll("SELECT * FROM `endpointman_model_list",array(), DB_FETCHMODE_ASSOC); - foreach($data as $list) { + $data = & $db->getAll("SELECT * FROM `endpointman_model_list", array(), DB_FETCHMODE_ASSOC); + foreach ($data as $list) { $new_model_id = str_replace("-", "", $list['id']); - $sql = "UPDATE endpointman_model_list SET id = '".$new_model_id."' WHERE id = ". $list['id']; + $sql = "UPDATE endpointman_model_list SET id = '" . $new_model_id . "' WHERE id = " . $list['id']; $db->query($sql); } $data = array(); - $data =& $db->getAll("SELECT * FROM `endpointman_product_list",array(), DB_FETCHMODE_ASSOC); - foreach($data as $list) { + $data = & $db->getAll("SELECT * FROM `endpointman_product_list", array(), DB_FETCHMODE_ASSOC); + foreach ($data as $list) { $new_product_id = str_replace("-", "", $list['id']); - $sql = "UPDATE endpointman_product_list SET id = '".$new_product_id."' WHERE id = ". $list['id']; + $sql = "UPDATE endpointman_product_list SET id = '" . $new_product_id . "' WHERE id = " . $list['id']; $db->query($sql); } $data = array(); - $data =& $db->getAll("SELECT * FROM `endpointman_mac_list",array(), DB_FETCHMODE_ASSOC); - foreach($data as $list) { + $data = & $db->getAll("SELECT * FROM `endpointman_mac_list", array(), DB_FETCHMODE_ASSOC); + foreach ($data as $list) { $new_model_id = str_replace("-", "", $list['model']); - $sql = "UPDATE endpointman_mac_list SET model = '".$new_model_id."' WHERE id = ". $list['id']; + $sql = "UPDATE endpointman_mac_list SET model = '" . $new_model_id . "' WHERE id = " . $list['id']; $db->query($sql); } $data = array(); - $data =& $db->getAll("SELECT * FROM endpointman_template_list",array(), DB_FETCHMODE_ASSOC); - foreach($data as $list) { + $data = & $db->getAll("SELECT * FROM endpointman_template_list", array(), DB_FETCHMODE_ASSOC); + foreach ($data as $list) { $new_model_id = str_replace("-", "", $list['model_id']); $new_product_id = str_replace("-", "", $list['product_id']); - $sql = "UPDATE endpointman_template_list SET model_id = '".$new_model_id."', product_id = '".$new_product_id."' WHERE id = ". $list['id']; + $sql = "UPDATE endpointman_template_list SET model_id = '" . $new_model_id . "', product_id = '" . $new_product_id . "' WHERE id = " . $list['id']; $db->query($sql); } $data = array(); - $data =& $db->getAll("SELECT * FROM endpointman_custom_configs",array(), DB_FETCHMODE_ASSOC); - foreach($data as $list) { + $data = & $db->getAll("SELECT * FROM endpointman_custom_configs", array(), DB_FETCHMODE_ASSOC); + foreach ($data as $list) { $new_product_id = str_replace("-", "", $list['product_id']); - $sql = "UPDATE endpointman_custom_configs SET product_id = '".$new_product_id."' WHERE id = ". $list['id']; + $sql = "UPDATE endpointman_custom_configs SET product_id = '" . $new_product_id . "' WHERE id = " . $list['id']; $db->query($sql); } } @@ -731,13 +737,13 @@ function ep_table_exists ($table) { } if ($ver <= "2240") { - + } if ($ver <= "2250") { out("Fixing Permissions of Phone Modules Directory"); $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PHONE_MODULES_PATH), RecursiveIteratorIterator::SELF_FIRST); - foreach($iterator as $item) { + foreach ($iterator as $item) { chmod($item, 0764); } @@ -760,9 +766,9 @@ function ep_table_exists ($table) { $db->query($sql); $data = array(); - $data =& $db->getAll("SELECT * FROM endpointman_mac_list",array(), DB_FETCHMODE_ASSOC); - foreach($data as $list) { - $sql = "INSERT INTO endpointman_line_list (mac_id, line, ext, description) VALUES ('".$list['id']."', '1', '".$list['ext']."', '".$list['description']."')"; + $data = & $db->getAll("SELECT * FROM endpointman_mac_list", array(), DB_FETCHMODE_ASSOC); + foreach ($data as $list) { + $sql = "INSERT INTO endpointman_line_list (mac_id, line, ext, description) VALUES ('" . $list['id'] . "', '1', '" . $list['ext'] . "', '" . $list['description'] . "')"; $db->query($sql); } @@ -795,7 +801,6 @@ function ep_table_exists ($table) { $sql = 'ALTER TABLE `endpointman_mac_list` CHANGE `custom_cfg_data` `global_custom_cfg_data` LONGBLOB NOT NULL'; $db->query($sql); - } if ($ver <= "2280") { @@ -810,23 +815,23 @@ function ep_table_exists ($table) { if ($ver <= "2400") { out("Uninstalling All Installed Brands (You'll just simply have to update again, no loss of data)"); $db->query("UPDATE endpointman_brand_list SET installed = '0'"); - $sql = "UPDATE endpointman_model_list SET enabled = '0', template_data = '".serialize(array())."'"; + $sql = "UPDATE endpointman_model_list SET enabled = '0', template_data = '" . serialize(array()) . "'"; $db->query($sql); - exec("rm -Rf ".PHONE_MODULES_PATH); + exec("rm -Rf " . PHONE_MODULES_PATH); - if(!file_exists(PHONE_MODULES_PATH)) { + if (!file_exists(PHONE_MODULES_PATH)) { mkdir(PHONE_MODULES_PATH, 0764); out("Creating Phone Modules Directory"); } - if(!file_exists(PHONE_MODULES_PATH."setup.php")) { - copy(LOCAL_PATH."install/setup.php",PHONE_MODULES_PATH."setup.php"); + if (!file_exists(PHONE_MODULES_PATH . "setup.php")) { + copy(LOCAL_PATH . "install/setup.php", PHONE_MODULES_PATH . "setup.php"); out("Moving Auto Provisioner Class"); } - if(!file_exists(PHONE_MODULES_PATH."temp/")) { - mkdir(PHONE_MODULES_PATH."temp/", 0764); + if (!file_exists(PHONE_MODULES_PATH . "temp/")) { + mkdir(PHONE_MODULES_PATH . "temp/", 0764); out("Creating temp folder"); } } @@ -836,18 +841,18 @@ function ep_table_exists ($table) { $db->query($sql); } - if($ver <= "2903") { + if ($ver <= "2903") { $sql = 'ALTER TABLE `endpointman_custom_configs` CHANGE `data` `data` LONGBLOB NOT NULL'; $db->query($sql); } - if($ver <= "2904") { + if ($ver <= "2904") { out("Adding 'local' column to brand_list"); $sql = 'ALTER TABLE `endpointman_brand_list` ADD `local` INT( 1 ) NOT NULL DEFAULT \'0\' AFTER `cfg_ver`'; $db->query($sql); } - if($ver <= "2907") { + if ($ver <= "2907") { out("Adding UNIQUE key to table global_vars for var_name"); $sql = "ALTER TABLE `endpointman_global_vars` ADD UNIQUE `unique` (`var_name`)"; $db->query($sql); @@ -857,7 +862,7 @@ function ep_table_exists ($table) { $db->query($sql); } - if($ver <= "2910") { + if ($ver <= "2910") { out("Fix again to the 'Allow Duplicate Extensions' Error"); $sql = 'ALTER TABLE `endpointman_global_vars` ADD UNIQUE `var_name` (`var_name`)'; $db->query($sql); @@ -899,53 +904,53 @@ function ep_table_exists ($table) { $sql = 'ALTER TABLE `endpointman_mac_list` ADD `specific_settings` LONGBLOB NULL;'; $db->query($sql); } - - if($ver <= "21021") { + + if ($ver <= "21021") { out('Updating Mirror Location...again'); $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/v3/' WHERE var_name ='update_server'"; $db->query($sql); - + out("Uninstalling All Installed Brands (You'll just simply have to update again, no loss of data)"); $db->query("UPDATE endpointman_brand_list SET installed = '0'"); $db->query("TRUNCATE TABLE endpointman_brand_list"); - - $sql = "UPDATE endpointman_model_list SET enabled = '0', template_data = '".serialize(array())."'"; + + $sql = "UPDATE endpointman_model_list SET enabled = '0', template_data = '" . serialize(array()) . "'"; $db->query($sql); - out("Moving old brand data for backups, its now in ". $amp_conf['AMPWEBROOT']."/admin/modules/_ep_phone_modules_old"); - exec("mv ". $amp_conf['AMPWEBROOT']."/admin/modules/_ep_phone_modules" . " ". $amp_conf['AMPWEBROOT']."/admin/modules/_ep_phone_modules_old"); + out("Moving old brand data for backups, its now in " . $amp_conf['AMPWEBROOT'] . "/admin/modules/_ep_phone_modules_old"); + exec("mv " . $amp_conf['AMPWEBROOT'] . "/admin/modules/_ep_phone_modules" . " " . $amp_conf['AMPWEBROOT'] . "/admin/modules/_ep_phone_modules_old"); - if(!file_exists(PHONE_MODULES_PATH)) { + if (!file_exists(PHONE_MODULES_PATH)) { mkdir(PHONE_MODULES_PATH, 0764); out("Creating Phone Modules Directory"); } - if(!file_exists(PHONE_MODULES_PATH."setup.php")) { - copy(LOCAL_PATH."install/setup.php",PHONE_MODULES_PATH."setup.php"); + if (!file_exists(PHONE_MODULES_PATH . "setup.php")) { + copy(LOCAL_PATH . "install/setup.php", PHONE_MODULES_PATH . "setup.php"); out("Moving Auto Provisioner Class"); } - if(!file_exists(PHONE_MODULES_PATH."temp/")) { - mkdir(PHONE_MODULES_PATH."temp/", 0764); + if (!file_exists(PHONE_MODULES_PATH . "temp/")) { + mkdir(PHONE_MODULES_PATH . "temp/", 0764); out("Creating temp folder"); } } - - if($ver <= "21031") { + + if ($ver <= "21031") { out("Adding tftp server check and nmap search save values"); $sql = 'INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'tftp_check\', \'0\');'; $db->query($sql); $sql = 'INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'nmap_search\', \'\');'; $db->query($sql); } - - if($ver <= "21037") { + + if ($ver <= "21037") { out("Adding Config File Backups"); $sql = 'INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'backup_check\', \'1\');'; $db->query($sql); } - - if($ver <= "21038") { + + if ($ver <= "21038") { out("Adding Use Repo Option"); $sql = 'INSERT INTO `endpointman_global_vars` (`idnum`, `var_name`, `value`) VALUES (NULL, \'use_repo\', \'0\');'; $db->query($sql); @@ -964,7 +969,7 @@ function ep_table_exists ($table) { `local` int(1) NOT NULL DEFAULT '0', `hidden` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1"; + ) ENGINE=MyISAM"; $db->query($sql); out("Creating Line List Table"); @@ -978,7 +983,7 @@ function ep_table_exists ($table) { `custom_cfg_data` longblob NOT NULL, `user_cfg_data` longblob NOT NULL, PRIMARY KEY (`luid`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;"; +) ENGINE=MyISAM"; $db->query($sql); out("Creating Global Variables Table"); @@ -988,7 +993,7 @@ function ep_table_exists ($table) { `value` text NOT NULL COMMENT 'Data', PRIMARY KEY (`idnum`), UNIQUE KEY `var_name` (`var_name`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=17"; + ) ENGINE=MyISAM"; $db->query($sql); out("Locating NMAP + ARP + ASTERISK Executables"); @@ -1004,12 +1009,12 @@ function ep_table_exists ($table) { (4, 'gmthr', ''), (5, 'config_location', '/tftpboot/'), (6, 'update_server', 'http://mirror.freepbx.org/provisioner/v3/'), - (7, 'version', '".$xml_full_version."'), + (7, 'version', '" . $xml_full_version . "'), (8, 'enable_ari', '0'), (9, 'debug', '0'), - (10, 'arp_location', '".$arp."'), - (11, 'nmap_location', '".$nmap."'), - (12, 'asterisk_location', '".$asterisk."'), + (10, 'arp_location', '" . $arp . "'), + (11, 'nmap_location', '" . $nmap . "'), + (12, 'asterisk_location', '" . $asterisk . "'), (13, 'language', ''), (14, 'check_updates', '0'), (15, 'disable_htaccess', ''), @@ -1038,7 +1043,7 @@ function ep_table_exists ($table) { `specific_settings` longblob, PRIMARY KEY (`id`), UNIQUE KEY `mac` (`mac`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; +) ENGINE=MyISAM"; $db->query($sql); out("Creating model List Table"); @@ -1053,7 +1058,7 @@ function ep_table_exists ($table) { `enabled` int(1) NOT NULL DEFAULT '0', `hidden` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1"; +) ENGINE=MyISAM"; $db->query($sql); out("Creating oui List Table"); @@ -1064,7 +1069,7 @@ function ep_table_exists ($table) { `custom` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `oui` (`oui`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; + ) ENGINE=MyISAM"; $db->query($sql); out("Creating product List Table"); @@ -1081,7 +1086,7 @@ function ep_table_exists ($table) { `config_files` text, `special_cfgs` blob NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1"; +) ENGINE=MyISAM"; $db->query($sql); out("Creating Template List Table"); @@ -1094,7 +1099,7 @@ function ep_table_exists ($table) { `config_files_override` text, `global_settings_override` longblob, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; +) ENGINE=MyISAM"; $db->query($sql); out("Create Custom Configs Table"); @@ -1105,136 +1110,135 @@ function ep_table_exists ($table) { `product_id` varchar(11) NOT NULL, `data` longblob NOT NULL, PRIMARY KEY (`id`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; + ) ENGINE=MyISAM"; $db->query($sql); out('Creating symlink to web provisioner'); - if(!symlink(LOCAL_PATH."provisioning",$amp_conf['AMPWEBROOT']."/provisioning")) { + if (!symlink(LOCAL_PATH . "provisioning", $amp_conf['AMPWEBROOT'] . "/provisioning")) { //out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); } } -out("Update Version Number to ".$xml_full_version); -$sql = "UPDATE endpointman_global_vars SET value = '".$xml_full_version."' WHERE var_name = 'version'"; +out("Update Version Number to " . $xml_full_version); +$sql = "UPDATE endpointman_global_vars SET value = '" . $xml_full_version . "' WHERE var_name = 'version'"; $db->query($sql); $sql = "UPDATE endpointman_global_vars SET value = 'http://mirror.freepbx.org/provisioner/v3/' WHERE var_name = 'update_server'"; $db->query($sql); -if(file_exists($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module")) { - unlink($amp_conf['AMPWEBROOT']."/recordings/modules/phonesettings.module"); +if (file_exists($amp_conf['AMPWEBROOT'] . "/recordings/modules/phonesettings.module")) { + unlink($amp_conf['AMPWEBROOT'] . "/recordings/modules/phonesettings.module"); } -if(file_exists($amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js")) { - unlink($amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.coda-slider-2.0.js"); +if (file_exists($amp_conf['AMPWEBROOT'] . "/recordings/theme/js/jquery.coda-slider-2.0.js")) { + unlink($amp_conf['AMPWEBROOT'] . "/recordings/theme/js/jquery.coda-slider-2.0.js"); } -if(file_exists($amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js")) { - unlink($amp_conf['AMPWEBROOT']."/recordings/theme/js/jquery.easing.1.3.js"); +if (file_exists($amp_conf['AMPWEBROOT'] . "/recordings/theme/js/jquery.easing.1.3.js")) { + unlink($amp_conf['AMPWEBROOT'] . "/recordings/theme/js/jquery.easing.1.3.js"); } -if(file_exists($amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css")) { - unlink($amp_conf['AMPWEBROOT']."/recordings/theme/coda-slider-2.0a.css"); +if (file_exists($amp_conf['AMPWEBROOT'] . "/recordings/theme/coda-slider-2.0a.css")) { + unlink($amp_conf['AMPWEBROOT'] . "/recordings/theme/coda-slider-2.0a.css"); } -if($amp_version['minor'] < 9) { +if ($amp_version['minor'] < 9) { //Do symlinks ourself because retrieve_conf is OLD - //images - $dir = $amp_conf['AMPWEBROOT'].'/admin/assets/endpointman/images'; - if(!file_exists($dir)) { + $dir = $amp_conf['AMPWEBROOT'] . '/admin/assets/endpointman/images'; + if (!file_exists($dir)) { mkdir($dir, 0777, TRUE); } - foreach (glob(LOCAL_PATH."assets/images/*.*") as $filename) { - if(file_exists($dir.'/'.basename($filename))) { - unlink($dir.'/'.basename($filename)); - symlink($filename, $dir.'/'.basename($filename)); + foreach (glob(LOCAL_PATH . "assets/images/*.*") as $filename) { + if (file_exists($dir . '/' . basename($filename))) { + unlink($dir . '/' . basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } else { - symlink($filename, $dir.'/'.basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } } //javascripts - $dir = $amp_conf['AMPWEBROOT'].'/admin/assets/endpointman/js'; - if(!file_exists($dir)) { + $dir = $amp_conf['AMPWEBROOT'] . '/admin/assets/endpointman/js'; + if (!file_exists($dir)) { mkdir($dir, 0777, TRUE); } - foreach (glob(LOCAL_PATH."assets/js/*.*") as $filename) { - if(file_exists($dir.'/'.basename($filename))) { - unlink($dir.'/'.basename($filename)); - symlink($filename, $dir.'/'.basename($filename)); + foreach (glob(LOCAL_PATH . "assets/js/*.*") as $filename) { + if (file_exists($dir . '/' . basename($filename))) { + unlink($dir . '/' . basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } else { - symlink($filename, $dir.'/'.basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } } //theme (css/stylesheets) - $dir = $amp_conf['AMPWEBROOT'].'/admin/assets/endpointman/theme'; - if(!file_exists($dir)) { + $dir = $amp_conf['AMPWEBROOT'] . '/admin/assets/endpointman/theme'; + if (!file_exists($dir)) { mkdir($dir, 0777, TRUE); } - foreach (glob(LOCAL_PATH."assets/theme/*.*") as $filename) { - if(file_exists($dir.'/'.basename($filename))) { - unlink($dir.'/'.basename($filename)); - symlink($filename, $dir.'/'.basename($filename)); + foreach (glob(LOCAL_PATH . "assets/theme/*.*") as $filename) { + if (file_exists($dir . '/' . basename($filename))) { + unlink($dir . '/' . basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } else { - symlink($filename, $dir.'/'.basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } } //ari-theme (css/stylesheets) - $dir = $amp_conf['AMPWEBROOT'].'/recordings/theme'; - if(!file_exists($dir)) { + $dir = $amp_conf['AMPWEBROOT'] . '/recordings/theme'; + if (!file_exists($dir)) { mkdir($dir, 0777, TRUE); } - foreach (glob(LOCAL_PATH."ari/theme/*.*") as $filename) { - if(file_exists($dir.'/'.basename($filename))) { - unlink($dir.'/'.basename($filename)); - symlink($filename, $dir.'/'.basename($filename)); + foreach (glob(LOCAL_PATH . "ari/theme/*.*") as $filename) { + if (file_exists($dir . '/' . basename($filename))) { + unlink($dir . '/' . basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } else { - symlink($filename, $dir.'/'.basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } } //ari-images - $dir = $amp_conf['AMPWEBROOT'].'/recordings/theme/images'; - if(!file_exists($dir)) { + $dir = $amp_conf['AMPWEBROOT'] . '/recordings/theme/images'; + if (!file_exists($dir)) { mkdir($dir, 0777, TRUE); } - foreach (glob(LOCAL_PATH."ari/images/*.*") as $filename) { - if(file_exists($dir.'/'.basename($filename))) { - unlink($dir.'/'.basename($filename)); - symlink($filename, $dir.'/'.basename($filename)); + foreach (glob(LOCAL_PATH . "ari/images/*.*") as $filename) { + if (file_exists($dir . '/' . basename($filename))) { + unlink($dir . '/' . basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } else { - symlink($filename, $dir.'/'.basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } } //ari-js - $dir = $amp_conf['AMPWEBROOT'].'/recordings/theme/js'; - if(!file_exists($dir)) { + $dir = $amp_conf['AMPWEBROOT'] . '/recordings/theme/js'; + if (!file_exists($dir)) { mkdir($dir, 0777, TRUE); } - foreach (glob(LOCAL_PATH."ari/js/*.*") as $filename) { - if(file_exists($dir.'/'.basename($filename))) { - unlink($dir.'/'.basename($filename)); - symlink($filename, $dir.'/'.basename($filename)); + foreach (glob(LOCAL_PATH . "ari/js/*.*") as $filename) { + if (file_exists($dir . '/' . basename($filename))) { + unlink($dir . '/' . basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } else { - symlink($filename, $dir.'/'.basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } } //ari-modules - $dir = $amp_conf['AMPWEBROOT'].'/recordings/modules'; - if(!file_exists($dir)) { + $dir = $amp_conf['AMPWEBROOT'] . '/recordings/modules'; + if (!file_exists($dir)) { mkdir($dir, 0777, TRUE); } - foreach (glob(LOCAL_PATH."ari/modules/*.*") as $filename) { - if(file_exists($dir.'/'.basename($filename))) { - unlink($dir.'/'.basename($filename)); - symlink($filename, $dir.'/'.basename($filename)); + foreach (glob(LOCAL_PATH . "ari/modules/*.*") as $filename) { + if (file_exists($dir . '/' . basename($filename))) { + unlink($dir . '/' . basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } else { - symlink($filename, $dir.'/'.basename($filename)); + symlink($filename, $dir . '/' . basename($filename)); } } } @@ -1242,13 +1246,13 @@ function ep_table_exists ($table) { function epm_install_xml2array($url, $get_attributes = 1, $priority = 'tag') { $contents = ""; if (!function_exists('xml_parser_create')) { - return array (); + return array(); } $parser = xml_parser_create(''); - if(!($fp = @ fopen($url, 'rb'))) { - return array (); + if (!($fp = @ fopen($url, 'rb'))) { + return array(); } - while(!feof($fp)) { + while (!feof($fp)) { $contents .= fread($fp, 8192); } fclose($fp); @@ -1257,88 +1261,81 @@ function epm_install_xml2array($url, $get_attributes = 1, $priority = 'tag') { xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, trim($contents), $xml_values); xml_parser_free($parser); - if(!$xml_values) { + if (!$xml_values) { return; //Hmm... } - $xml_array = array (); - $parents = array (); - $opened_tags = array (); - $arr = array (); + $xml_array = array(); + $parents = array(); + $opened_tags = array(); + $arr = array(); $current = & $xml_array; - $repeated_tag_index = array (); + $repeated_tag_index = array(); foreach ($xml_values as $data) { - unset ($attributes, $value); + unset($attributes, $value); extract($data); - $result = array (); - $attributes_data = array (); - if (isset ($value)) { - if($priority == 'tag') { + $result = array(); + $attributes_data = array(); + if (isset($value)) { + if ($priority == 'tag') { $result = $value; - } - else { + } else { $result['value'] = $value; } } - if(isset($attributes) and $get_attributes) { - foreach($attributes as $attr => $val) { - if($priority == 'tag') { + if (isset($attributes) and $get_attributes) { + foreach ($attributes as $attr => $val) { + if ($priority == 'tag') { $attributes_data[$attr] = $val; - } - else { + } else { $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr' } } } if ($type == "open") { - $parent[$level -1] = & $current; - if(!is_array($current) or (!in_array($tag, array_keys($current)))) { + $parent[$level - 1] = & $current; + if (!is_array($current) or (!in_array($tag, array_keys($current)))) { $current[$tag] = $result; - if($attributes_data) { + if ($attributes_data) { $current[$tag . '_attr'] = $attributes_data; } $repeated_tag_index[$tag . '_' . $level] = 1; $current = & $current[$tag]; - } - else { - if (isset ($current[$tag][0])) { + } else { + if (isset($current[$tag][0])) { $current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result; $repeated_tag_index[$tag . '_' . $level]++; - } - else { - $current[$tag] = array($current[$tag],$result); + } else { + $current[$tag] = array($current[$tag], $result); $repeated_tag_index[$tag . '_' . $level] = 2; - if(isset($current[$tag . '_attr'])) { + if (isset($current[$tag . '_attr'])) { $current[$tag]['0_attr'] = $current[$tag . '_attr']; - unset ($current[$tag . '_attr']); + unset($current[$tag . '_attr']); } } $last_item_index = $repeated_tag_index[$tag . '_' . $level] - 1; $current = & $current[$tag][$last_item_index]; } - } - else if($type == "complete") { - if(!isset ($current[$tag])) { + } else if ($type == "complete") { + if (!isset($current[$tag])) { $current[$tag] = $result; $repeated_tag_index[$tag . '_' . $level] = 1; - if($priority == 'tag' and $attributes_data) { + if ($priority == 'tag' and $attributes_data) { $current[$tag . '_attr'] = $attributes_data; } - } - else { - if (isset ($current[$tag][0]) and is_array($current[$tag])) { + } else { + if (isset($current[$tag][0]) and is_array($current[$tag])) { $current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result; if ($priority == 'tag' and $get_attributes and $attributes_data) { $current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data; } $repeated_tag_index[$tag . '_' . $level]++; - } - else { - $current[$tag] = array($current[$tag],$result); + } else { + $current[$tag] = array($current[$tag], $result); $repeated_tag_index[$tag . '_' . $level] = 1; if ($priority == 'tag' and $get_attributes) { - if (isset ($current[$tag . '_attr'])) { + if (isset($current[$tag . '_attr'])) { $current[$tag]['0_attr'] = $current[$tag . '_attr']; - unset ($current[$tag . '_attr']); + unset($current[$tag . '_attr']); } if ($attributes_data) { $current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data; @@ -1347,9 +1344,8 @@ function epm_install_xml2array($url, $get_attributes = 1, $priority = 'tag') { $repeated_tag_index[$tag . '_' . $level]++; //0 and 1 index is already taken } } - } - else if($type == 'close') { - $current = & $parent[$level -1]; + } else if ($type == 'close') { + $current = & $parent[$level - 1]; } } return ($xml_array); diff --git a/module.xml b/module.xml index b8e5badc..9d176d4f 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.4.0 + 2.10.4.1 setup Connectivity Andrew Nagy diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html index dca948f0..77e955ed 100644 --- a/templates/freepbx/advanced_settings_settings.html +++ b/templates/freepbx/advanced_settings_settings.html @@ -84,43 +84,43 @@ - + Enable Advanced debugging mode for endpoint manager - + Disable Tooltip popups - + Assign the same extension to multiple phones (Note: This is not supported by Asterisk) - + When editing the configuration files allows one to save over the global template default instead of saving directly to the database. These types of changes can and will be overwritten when updating the brand packages from the configuration/installation page - + Disable checking for a valid, working TFTP server which can sometimes cause Apache to crash - + Disable backing up the tftboot directory on every phone rebuild or save - + Use the live github repository (WARN: Beta!) diff --git a/templates/freepbx/template_editor.html b/templates/freepbx/template_editor.html index d45f5646..36d30260 100644 --- a/templates/freepbx/template_editor.html +++ b/templates/freepbx/template_editor.html @@ -116,9 +116,9 @@

      {$value.title}

      {elseif condition="$value.type == 'file'"} {elseif condition="$value.type == 'radio'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if} + {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: {loop name="value.data"} - + [] {/loop} {elseif condition="$value.type == 'list'"} {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html index b5d881fa..77e955ed 100644 --- a/templates/freepbx/advanced_settings_settings.html +++ b/templates/freepbx/advanced_settings_settings.html @@ -84,35 +84,47 @@ - + Enable Advanced debugging mode for endpoint manager - + Disable Tooltip popups - + Assign the same extension to multiple phones (Note: This is not supported by Asterisk) - + When editing the configuration files allows one to save over the global template default instead of saving directly to the database. These types of changes can and will be overwritten when updating the brand packages from the configuration/installation page - + Disable checking for a valid, working TFTP server which can sometimes cause Apache to crash + + Disable backing up the tftboot directory on every phone rebuild or save + + + + Use the live github repository (WARN: Beta!) + + '> diff --git a/templates/freepbx/template_editor.html b/templates/freepbx/template_editor.html index d45f5646..36d30260 100644 --- a/templates/freepbx/template_editor.html +++ b/templates/freepbx/template_editor.html @@ -116,9 +116,9 @@

      {$value.title}

      {elseif condition="$value.type == 'file'"} {elseif condition="$value.type == 'radio'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if} + {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: {loop name="value.data"} - + [] {/loop} {elseif condition="$value.type == 'list'"} {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: +{if condition="$git_enabled === TRUE"} + + GIT Branch Select the live github repository branch (WARN: Beta!) + + + + +{/if} '> From c530f2a102258d8207874f56499fbd3add0e820c Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Sun, 26 Aug 2012 23:38:46 -0700 Subject: [PATCH 298/623] Fixes #56 --- includes/functions.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/functions.inc b/includes/functions.inc index 95500204..62ecfbfe 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1333,7 +1333,7 @@ class endpointmanager { } } file_put_contents($write_path . $file, $data); - chmod($write_path . $file, 0666); + chmod($write_path . $file, 0755); if (!file_exists($write_path . $file)) { $this->error['parse_configs'] = "File (" . $file . ") not written to hard drive!"; return(FALSE); From ba203ab33e87d3a33f5595298bba0b23339b521e Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Sun, 26 Aug 2012 23:40:11 -0700 Subject: [PATCH 299/623] Update to version 2.10.4.3 --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index 5caf9069..35dbea2d 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.4.2 + 2.10.4.3 setup Connectivity Andrew Nagy From 0e2e898207ceb7addbff34ea15f75c965ecba44f Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Sun, 26 Aug 2012 23:44:31 -0700 Subject: [PATCH 300/623] Go to 775 fully --- includes/functions.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 4d024601..75a24373 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1284,7 +1284,7 @@ class endpointmanager { foreach ($iterator as $file) { $dir = $write_path . str_replace(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/", "", dirname($file)); if (!file_exists($dir)) { - if (!@mkdir($dir, 0755, TRUE)) { + if (!@mkdir($dir, 0775, TRUE)) { $this->error['parse_configs'] = "Could Not Create Directory: " . $data; return(FALSE); } @@ -1293,7 +1293,7 @@ class endpointmanager { } else { $dir = $write_path . $data; if (!file_exists($dir)) { - if (!@mkdir($dir, 0755)) { + if (!@mkdir($dir, 0775)) { $this->error['parse_configs'] = "Could Not Create Directory: " . $data; return(FALSE); } @@ -1331,7 +1331,7 @@ class endpointmanager { //Move old file to backup if (!$this->global_cfg['backup_check']) { if (!file_exists($write_path . 'config_bkup')) { - if (!@mkdir($write_path . 'config_bkup', 0755)) { + if (!@mkdir($write_path . 'config_bkup', 0775)) { $this->error['parse_configs'] = "Could Not Create Backup Directory"; return(FALSE); } @@ -1341,7 +1341,7 @@ class endpointmanager { } } file_put_contents($write_path . $file, $data); - chmod($write_path . $file, 0755); + chmod($write_path . $file, 0775); if (!file_exists($write_path . $file)) { $this->error['parse_configs'] = "File (" . $file . ") not written to hard drive!"; return(FALSE); From 0c5e8126bf897da3f180e0d3ec3a1c7f955f9645 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Mon, 27 Aug 2012 00:32:36 -0700 Subject: [PATCH 301/623] Final repo:branch tweaks --- includes/advanced.inc | 33 +++++++++++++++---- .../freepbx/advanced_settings_settings.html | 2 +- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/includes/advanced.inc b/includes/advanced.inc index c579170f..f10ff8fa 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -611,20 +611,39 @@ switch ($_REQUEST['subpage']) { } if ($endpoint->global_cfg['use_repo']) { + $endpoint->tpl->assign("git_enabled", TRUE); $use_repo = "checked"; $path = $endpoint->has_git(); $o = getcwd(); chdir(PHONE_MODULES_PATH); - exec($path.' branch -a',$output); + + if(isset($_REQUEST['git_branch'])) { + if(preg_match('/remotes\/origin\/(.*)/i', $_REQUEST['git_branch'],$matches)) { + //Pull from a remote. + if(!exec($path.' checkout origin_'. $matches[1])) { + //We must remote track this branch + exec($path . ' branch --track origin_'.$matches[1].' origin/'.$matches[1]); + exec($path . ' checkout origin_'.$matches[1]); + } + exec($path . ' pull origin ' . $matches[1]); + } else { + exec($path.' checkout '. $_REQUEST['git_branch'],$output); + } + } + + exec($path . ' fetch origin'); + exec($path . ' branch -a',$output); foreach($output as $data) { - $selected = preg_match('/\*/i', $data) ? TRUE : FALSE; - $data = preg_replace('/\*/i', '', $data); - $branchoutput[] = array( - 'name' => $data, - 'selected' => $selected - ); + if(!preg_match('/Your branch is ahead of/i', $data)) { + $selected = preg_match('/\*/i', $data) ? TRUE : FALSE; + $data = preg_replace('/\*/i', '', $data); + $branchoutput[] = array( + 'name' => $data, + 'selected' => $selected + ); + } } $endpoint->tpl->assign("branches", $branchoutput); chdir($o); diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html index e86f1a87..0909c8be 100644 --- a/templates/freepbx/advanced_settings_settings.html +++ b/templates/freepbx/advanced_settings_settings.html @@ -129,7 +129,7 @@ GIT Branch Select the live github repository branch (WARN: Beta!) - {loop name="branches"} {/loop} From a4911e0bbbe3ec926a909018f55b807bd7799136 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Mon, 10 Sep 2012 01:15:32 -0700 Subject: [PATCH 302/623] Version bump --- includes/functions.inc | 2 +- module.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 75a24373..778c51dc 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1982,7 +1982,7 @@ class endpointmanager { chdir(dirname(PHONE_MODULES_PATH)); $path = $this->has_git(); exec($path . ' git pull', $output); - exec($path . ' git checkout master', $output); + //exec($path . ' git checkout master', $output); //Why am I doing this? chdir($o); $temp = $this->file2json(PHONE_MODULES_PATH . 'endpoint/master.json'); $endpoint_package = $temp['data']['package']; diff --git a/module.xml b/module.xml index 35dbea2d..46d88cb5 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.4.3 + 2.10.4.4 setup Connectivity Andrew Nagy From 1b5e35fe466aaae598b6e74ccc124aa5447acaaf Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 21 Sep 2012 14:31:54 -0700 Subject: [PATCH 303/623] Final fixes to #56 --- includes/functions.inc | 14 +++++++------- module.xml | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 778c51dc..63e1a4cb 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1314,12 +1314,12 @@ class endpointmanager { return(FALSE); } } else { - if(file_exists(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { - if(!file_exists(dirname($write_path . $data))) { - !@mkdir(dirname($write_path . $data)); - } + if (file_exists(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { + if (!file_exists(dirname($write_path . $data))) { + !@mkdir(dirname($write_path . $data), 0775); + } copy(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data, $write_path . $data); - chmod($write_path . $data, 0666); + chmod($write_path . $data, 0775); } } } @@ -1602,7 +1602,7 @@ class endpointmanager { } } } - + $provisioner_lib->settings['mac'] = $phone_info['mac']; $provisioner_lib->mac = $phone_info['mac']; @@ -3191,4 +3191,4 @@ function endpointmanager_read_body($ch, $string) { //ob_flush(); endpointman_flush_buffers(); return $length; -} +} \ No newline at end of file diff --git a/module.xml b/module.xml index 46d88cb5..f55f5c17 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.4.4 + 2.10.4.5 setup Connectivity Andrew Nagy @@ -15,7 +15,7 @@ PBX End Point Manager supports automated deployment of multiple manufacturers IP telephones. - *2.10.4.0* https://github.com/tm1000/freepbx-endpointmanager/commits/master + *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager release/2.10/endpointman-2.10.3.7.tgz From 8031dd53671df653c4fdab96038a8dc99e178409 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 25 Sep 2012 13:48:26 -0700 Subject: [PATCH 304/623] Update includes/functions.inc TFTP location should always be '$settings['srvip']' not the $_SERVER IP Value. DUH! --- includes/functions.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/functions.inc b/includes/functions.inc index 63e1a4cb..9408d06d 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -1526,7 +1526,7 @@ class endpointmanager { } else { $new_template_data['provision']['type'] = 'file'; $new_template_data['provision']['protocol'] = 'tftp'; - $new_template_data['provision']['path'] = $_SERVER["SERVER_ADDR"]; + $new_template_data['provision']['path'] = $settings['srvip']; $new_template_data['provision']['encryption'] = FALSE; } From 174bf3b326ba2c1c9c82c61af3d689e8254d92d3 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 25 Sep 2012 13:49:04 -0700 Subject: [PATCH 305/623] Update module.xml Version Bump --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index f55f5c17..757aea69 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.4.5 + 2.10.4.6 setup Connectivity Andrew Nagy From 7fbfe24c5a9de797ba648895d2e81a0d8c97091d Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 4 Oct 2012 08:40:32 +0000 Subject: [PATCH 306/623] Merge branch 'master' of github.com:tm1000/freepbx-endpointmanager Conflicts: assets/images/.htaccess includes/advanced.inc includes/devices_manager.inc includes/functions.inc install/phonesettings.module module.xml provisioning/p.php templates/freepbx/advanced_settings_settings.html templates/freepbx/advanced_settings_settings_pop.html --- assets/images/.htaccess | 0 includes/advanced.inc | 35 ++++++++++++++++ includes/devices_manager.inc | 5 ++- includes/functions.inc | 41 +++++++++++-------- install/phonesettings.module | 0 module.xml | 4 +- provisioning/p.php | 0 .../freepbx/advanced_settings_settings.html | 12 ++++++ .../advanced_settings_settings_pop.html | 0 9 files changed, 77 insertions(+), 20 deletions(-) mode change 100755 => 100644 assets/images/.htaccess mode change 100755 => 100644 install/phonesettings.module mode change 100755 => 100644 provisioning/p.php mode change 100755 => 100644 templates/freepbx/advanced_settings_settings_pop.html diff --git a/assets/images/.htaccess b/assets/images/.htaccess old mode 100755 new mode 100644 diff --git a/includes/advanced.inc b/includes/advanced.inc index dd7f1e1a..f10ff8fa 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -611,7 +611,42 @@ switch ($_REQUEST['subpage']) { } if ($endpoint->global_cfg['use_repo']) { + + $endpoint->tpl->assign("git_enabled", TRUE); $use_repo = "checked"; + $path = $endpoint->has_git(); + $o = getcwd(); + chdir(PHONE_MODULES_PATH); + + if(isset($_REQUEST['git_branch'])) { + if(preg_match('/remotes\/origin\/(.*)/i', $_REQUEST['git_branch'],$matches)) { + //Pull from a remote. + if(!exec($path.' checkout origin_'. $matches[1])) { + //We must remote track this branch + exec($path . ' branch --track origin_'.$matches[1].' origin/'.$matches[1]); + exec($path . ' checkout origin_'.$matches[1]); + } + exec($path . ' pull origin ' . $matches[1]); + } else { + exec($path.' checkout '. $_REQUEST['git_branch'],$output); + } + } + + exec($path . ' fetch origin'); + exec($path . ' branch -a',$output); + + foreach($output as $data) { + if(!preg_match('/Your branch is ahead of/i', $data)) { + $selected = preg_match('/\*/i', $data) ? TRUE : FALSE; + $data = preg_replace('/\*/i', '', $data); + $branchoutput[] = array( + 'name' => $data, + 'selected' => $selected + ); + } + } + $endpoint->tpl->assign("branches", $branchoutput); + chdir($o); } else { $use_repo = ""; } diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc index 625c0cad..4e949e41 100644 --- a/includes/devices_manager.inc +++ b/includes/devices_manager.inc @@ -212,13 +212,14 @@ switch ($sub_type) { $provisioner_lib->root_dir = PHONE_MODULES_PATH; $provisioner_lib->engine = 'asterisk'; + $provisioner_lib->engine_location = !empty($endpoint->global_cfg['asterisk_location']) ? $endpoint->global_cfg['asterisk_location'] : 'asterisk'; $provisioner_lib->system = 'unix'; //have to because of versions less than php5.3 $provisioner_lib->brand_name = $phone_info['directory']; $provisioner_lib->family_line = $phone_info['cfg_dir']; - - $provisioner_lib->lines[1] = array('ext' => $phone_info['line'][1]['ext']); + + $provisioner_lib->settings['line'][0] = array('username' => $phone_info['line'][1]['ext'], 'authname' => $phone_info['line'][1]['ext']); $provisioner_lib->reboot(); unset($provisioner_lib); } diff --git a/includes/functions.inc b/includes/functions.inc index 675f339b..9408d06d 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -66,7 +66,7 @@ class endpointmanager { } else { define("PHONE_MODULES_PATH", MODULES_PATH . "_ep_phone_modules/"); if (!file_exists(PHONE_MODULES_PATH)) { - mkdir(PHONE_MODULES_PATH, 0764); + mkdir(PHONE_MODULES_PATH, 0775); } if (file_exists(PHONE_MODULES_PATH . "setup.php")) { @@ -450,7 +450,7 @@ class endpointmanager { $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; $name = $this->eda->sql($sql, 'getOne'); - $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . addslashes($name) . "' WHERE luid = " . $row['luid']; + $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . mysql_real_escape_string($name) . "' WHERE luid = " . $row['luid']; $this->eda->sql($sql); } @@ -541,7 +541,7 @@ class endpointmanager { if (!isset($line)) { $line = $row['line']; } - $sql = "UPDATE endpointman_line_list SET line = '" . $line . "', ext = '" . $row['ext'] . "', description = '" . $name . "' WHERE luid = " . $row['luid']; + $sql = "UPDATE endpointman_line_list SET line = '" . $line . "', ext = '" . $row['ext'] . "', description = '" . mysql_real_escape_string($name) . "' WHERE luid = " . $row['luid']; $this->eda->sql($sql); return(TRUE); } else { @@ -551,7 +551,7 @@ class endpointmanager { $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; $name = $this->eda->sql($sql, 'getOne'); - $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . $name . "' WHERE luid = " . $row['luid']; + $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . mysql_real_escape_string($name) . "' WHERE luid = " . $row['luid']; $this->eda->sql($sql); } return(TRUE); @@ -1284,7 +1284,7 @@ class endpointmanager { foreach ($iterator as $file) { $dir = $write_path . str_replace(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/", "", dirname($file)); if (!file_exists($dir)) { - if (!@mkdir($dir, 0755, TRUE)) { + if (!@mkdir($dir, 0775, TRUE)) { $this->error['parse_configs'] = "Could Not Create Directory: " . $data; return(FALSE); } @@ -1293,7 +1293,7 @@ class endpointmanager { } else { $dir = $write_path . $data; if (!file_exists($dir)) { - if (!@mkdir($dir, 0755)) { + if (!@mkdir($dir, 0775)) { $this->error['parse_configs'] = "Could Not Create Directory: " . $data; return(FALSE); } @@ -1313,6 +1313,14 @@ class endpointmanager { $this->error['parse_configs'] = "Could Not Create File: " . $data; return(FALSE); } + } else { + if (file_exists(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { + if (!file_exists(dirname($write_path . $data))) { + !@mkdir(dirname($write_path . $data), 0775); + } + copy(PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data, $write_path . $data); + chmod($write_path . $data, 0775); + } } } } @@ -1323,7 +1331,7 @@ class endpointmanager { //Move old file to backup if (!$this->global_cfg['backup_check']) { if (!file_exists($write_path . 'config_bkup')) { - if (!@mkdir($write_path . 'config_bkup', 0755)) { + if (!@mkdir($write_path . 'config_bkup', 0775)) { $this->error['parse_configs'] = "Could Not Create Backup Directory"; return(FALSE); } @@ -1333,7 +1341,7 @@ class endpointmanager { } } file_put_contents($write_path . $file, $data); - chmod($write_path . $file, 0666); + chmod($write_path . $file, 0775); if (!file_exists($write_path . $file)) { $this->error['parse_configs'] = "File (" . $file . ") not written to hard drive!"; return(FALSE); @@ -1410,7 +1418,7 @@ class endpointmanager { //Tell the system who we are and were to find the data. $provisioner_lib->root_dir = PHONE_MODULES_PATH; $provisioner_lib->engine = 'asterisk'; - $provisioner_lib->engine_location = $this->global_cfg['asterisk_location']; + $provisioner_lib->engine_location = !empty($this->global_cfg['asterisk_location']) ? $this->global_cfg['asterisk_location'] : 'asterisk'; $provisioner_lib->system = 'unix'; //have to because of versions less than php5.3 @@ -1518,7 +1526,7 @@ class endpointmanager { } else { $new_template_data['provision']['type'] = 'file'; $new_template_data['provision']['protocol'] = 'tftp'; - $new_template_data['provision']['path'] = $_SERVER["SERVER_ADDR"]; + $new_template_data['provision']['path'] = $settings['srvip']; $new_template_data['provision']['encryption'] = FALSE; } @@ -1594,7 +1602,7 @@ class endpointmanager { } } } - + $provisioner_lib->settings['mac'] = $phone_info['mac']; $provisioner_lib->mac = $phone_info['mac']; @@ -1818,7 +1826,7 @@ class endpointmanager { $directory = "master"; } else { if (!file_exists(PHONE_MODULES_PATH . '/' . $directory)) { - mkdir(PHONE_MODULES_PATH . '/' . $directory, 0764, TRUE); + mkdir(PHONE_MODULES_PATH . '/' . $directory, 0775, TRUE); } $destination_file = PHONE_MODULES_PATH . '/' . $directory . '/brand_data.json'; } @@ -1837,7 +1845,7 @@ class endpointmanager { return(FALSE); } else { rename($temp_file, $destination_file); - chmod($destination_file, 0764); + chmod($destination_file, 0775); return(TRUE); } } else { @@ -1974,6 +1982,7 @@ class endpointmanager { chdir(dirname(PHONE_MODULES_PATH)); $path = $this->has_git(); exec($path . ' git pull', $output); + //exec($path . ' git checkout master', $output); //Why am I doing this? chdir($o); $temp = $this->file2json(PHONE_MODULES_PATH . 'endpoint/master.json'); $endpoint_package = $temp['data']['package']; @@ -2156,7 +2165,7 @@ class endpointmanager { if (is_dir($file)) { $dir = str_replace($temp_directory . $directory . "/", "", $file); if (!file_exists(PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir)) { - mkdir(PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0764, TRUE); + mkdir(PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0775, TRUE); echo "."; } } else { @@ -2166,7 +2175,7 @@ class endpointmanager { if ($stats === FALSE) { echo "Error Moving " . basename($file); } - chmod(PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0764); + chmod(PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0775); echo "."; } } @@ -3182,4 +3191,4 @@ function endpointmanager_read_body($ch, $string) { //ob_flush(); endpointman_flush_buffers(); return $length; -} +} \ No newline at end of file diff --git a/install/phonesettings.module b/install/phonesettings.module old mode 100755 new mode 100644 diff --git a/module.xml b/module.xml index 9d176d4f..757aea69 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.4.1 + 2.10.4.6 setup Connectivity Andrew Nagy @@ -15,7 +15,7 @@ PBX End Point Manager supports automated deployment of multiple manufacturers IP telephones. - *2.10.4.0* https://github.com/tm1000/freepbx-endpointmanager/commits/master + *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager release/2.10/endpointman-2.10.3.7.tgz diff --git a/provisioning/p.php b/provisioning/p.php old mode 100755 new mode 100644 diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html index 77e955ed..0909c8be 100644 --- a/templates/freepbx/advanced_settings_settings.html +++ b/templates/freepbx/advanced_settings_settings.html @@ -125,6 +125,18 @@ +{if condition="$git_enabled === TRUE"} + + GIT Branch Select the live github repository branch (WARN: Beta!) + + + + +{/if} '> diff --git a/templates/freepbx/advanced_settings_settings_pop.html b/templates/freepbx/advanced_settings_settings_pop.html old mode 100755 new mode 100644 From 363441daef3494b82abd5a9d151b93995d508ba3 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Wed, 10 Oct 2012 06:48:52 +0000 Subject: [PATCH 307/623] [Module package script: endpointman 2.10.4.6] --- module.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module.xml b/module.xml index 757aea69..b4256774 100644 --- a/module.xml +++ b/module.xml @@ -18,7 +18,7 @@ *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager - release/2.10/endpointman-2.10.3.7.tgz + release/2.11/endpointman-2.10.4.6.tgz 2.6 @@ -26,5 +26,5 @@ core fw_ari -2832e12476c29c6a72c85225fb7ad143 +819f0db9675a0fcfd7f92fe25dac8cbd From 60cea20e1ec2f396eb529cc70606efea19142b1c Mon Sep 17 00:00:00 2001 From: dpaks51 Date: Sat, 10 Nov 2012 21:26:20 -0500 Subject: [PATCH 308/623] Fixes for incorrect temporary directory for brand uploads resulting in brand upload silently failing. Also added some more explicit info on extisting messages and added ability to log additional detailed status messages if the global debug option is set in the EPM --- includes/functions.inc | 32 +++++++++++++++++++++++--------- includes/installer.inc | 30 +++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 9408d06d..3ff6db21 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -2092,6 +2092,10 @@ class endpointmanager { function download_brand($id) { if (!$this->global_cfg['use_repo']) { $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + if (!file_exists($temp_directory)) { + echo "Creating EPM temp directory
      "; + mkdir($temp_directory); + } $row = $this->eda->sql('SELECT * FROM endpointman_brand_list WHERE id =' . $id, 'getAll', DB_FETCHMODE_ASSOC); echo "Downloading Brand JSON....."; $result = $this->download_file(UPDATE_PATH . $row[0]['directory'] . "/" . $row[0]['directory'] . ".json", PHONE_MODULES_PATH . "endpoint/" . $row[0]['directory'] . "/brand_data.json"); @@ -2140,7 +2144,10 @@ class endpointmanager { * Still needs way to determine when models move...perhaps another function? */ function update_brand($package, $remote=TRUE) { - $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + $debug = $this->global_cfg['debug']; + if ($debug) echo "update_brand(): Debug is set to $debug
      "; + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + if ($debug) echo "Processing $temp_directory$package/brand_data.json...
      "; if (file_exists($temp_directory . $package . '/brand_data.json')) { $temp = $this->file2json($temp_directory . $package . '/brand_data.json'); if (key_exists('directory', $temp['data']['brands'])) { @@ -2153,7 +2160,7 @@ class endpointmanager { $brand_version = $temp['data']['brands']['last_modified']; //create directory structure and move files - echo "Creating Directory Structure/Moving Files.."; + echo "Creating Directory Structure for Brand '$brand_name' and Moving Files .."; if (!file_exists(PHONE_MODULES_PATH . "endpoint/" . $directory)) { mkdir(PHONE_MODULES_PATH . "endpoint/" . $directory); @@ -2180,7 +2187,7 @@ class endpointmanager { } } } - echo "Done!
      "; + echo " Done!
      "; if ($remote) { $local = 0; @@ -2190,11 +2197,12 @@ class endpointmanager { $b_data = $this->eda->sql("SELECT id FROM endpointman_brand_list WHERE id = '" . $brand_id . "'", 'getOne'); if ($b_data) { - echo "Updating data.........."; + echo "Updating $brand_name brand data..........
      "; $sql = "UPDATE endpointman_brand_list SET local = '" . $local . "', name = '" . $brand_name . "', cfg_ver = '" . $brand_version . "', installed = 1, hidden = 0 WHERE id = " . $brand_id; $this->eda->sql($sql); } else { - $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '" . $local . "', '1')"; + echo "Inserting $brand_name brand data..........
      "; + $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '" . $local . "', '1')"; $this->eda->sql($sql); } @@ -2202,11 +2210,9 @@ class endpointmanager { foreach ($temp['data']['brands']['family_list'] as $family_list) { echo "Updating Family Lines.................
      "; - $last_mod = max($last_mod, $family_list['last_modified']); $family_line_xml = $this->file2json(PHONE_MODULES_PATH . '/endpoint/' . $directory . '/' . $family_list['directory'] . '/family_data.json'); - $family_line_xml['data']['last_modified'] = isset($family_line_xml['data']['last_modified']) ? $family_line_xml['data']['last_modified'] : ''; $require_firmware = NULL; @@ -2217,9 +2223,11 @@ class endpointmanager { $data = $this->eda->sql("SELECT id FROM endpointman_product_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . "'", 'getOne'); $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); - if ($data) { + if ($data) { + if ($debug) echo "-Updating Family $short_name
      "; $sql = "UPDATE endpointman_product_list SET short_name = '" . $short_name . "', long_name = '" . $family_line_xml['data']['name'] . "', cfg_ver = '" . $family_line_xml['data']['version'] . "', config_files='" . $family_line_xml['data']['configuration_files'] . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . "'"; } else { + if ($debug) echo "-Inserting Family $short_name
      "; $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . $short_name . "', '" . $family_line_xml['data']['name'] . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['last_modified'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')"; } @@ -2326,8 +2334,10 @@ class endpointmanager { $m_data = $this->eda->sql("SELECT id FROM endpointman_model_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'", 'getone'); if ($m_data) { + if ($debug) echo "---Updating Model {$model_list['model']}
      "; $sql = "UPDATE endpointman_model_list SET max_lines = '" . $model_list['lines'] . "', model = '" . $model_list['model'] . "', template_list = '" . $template_list . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'"; } else { + if ($debug) echo "---Inserting Model {$model_list['model']}
      "; $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "', '" . $brand_id . "', '" . $model_list['model'] . "', '" . $model_list['lines'] . "', '" . $brand_id . $family_line_xml['data']['id'] . "', '" . $template_list . "', '0', '0')"; } $this->eda->sql($sql); @@ -2359,6 +2369,10 @@ class endpointmanager { } } + if ($debug) { + echo "Done!
      "; + echo "Updating OUI list in DB
      "; + } foreach ($temp['data']['brands']['oui_list'] as $oui) { $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('" . $oui . "', '" . $brand_id . "', '0')"; $this->eda->sql($sql); @@ -2366,7 +2380,7 @@ class endpointmanager { echo "Done!
      "; } else { - echo "Invalid XML Structure
      "; + echo "Invalid JSON Structure in $temp_directory$package/brand_data.json
      "; } } else { echo "No 'brand_data.xml' file exists!
      "; diff --git a/includes/installer.inc b/includes/installer.inc index abf85376..6ae56aad 100644 --- a/includes/installer.inc +++ b/includes/installer.inc @@ -81,22 +81,38 @@ if($_REQUEST['type'] == "brand") { } break; case "upload_brand": + $debug = $endpoint->global_cfg['debug']; + if ($debug) echo "upload_brand(): Debug is set to ". $debug ."
      "; +// Bramd file (*.tgz) will have been copied into the location under which all endpoint definitions reside + /temp/ if (file_exists(PHONE_MODULES_PATH."temp/".$_REQUEST['package'])) { - echo "Extracting Tarball........"; - exec("tar -xvf ".PHONE_MODULES_PATH.'temp/'. $_REQUEST['package'] ." -C ".PHONE_MODULES_PATH."temp/"); +// The untarred brand file will go into /tmp (or wherever the "temporary" location the OS tells us) + /epm-temp/ + $temp_directory = sys_get_temp_dir() . "/epm_temp/"; + if (!file_exists($temp_directory)) { + echo "Creating EPM temp directory
      "; + mkdir($temp_directory); + } + if ($debug) { + echo "Extracting Tarball ".PHONE_MODULES_PATH.'temp/'. $_REQUEST['package']." to $temp_directory ........"; + } else { + echo "Extracting Tarball........ "; + } + exec("tar -xvf ".PHONE_MODULES_PATH.'temp/'. $_REQUEST['package'] ." -C ".$temp_directory); echo "Done!
      "; - $package = basename($_REQUEST['package'], ".tgz"); + $package = basename($_REQUEST['package'], ".tgz"); $package = explode("-",$package); - if(file_exists(PHONE_MODULES_PATH."temp/".$package[0])) { - $endpoint->update_brand($package[0],FALSE); - unlink(PHONE_MODULES_PATH.'temp/'. $_REQUEST['package']); + if ($debug) echo "Looking for file $temp_directory$package[0] to pass on to update_brand()
      "; + if(file_exists($temp_directory.$package[0])) { + $endpoint->update_brand($package[0],FALSE); +// Note: no need to delete/unlink/rmdir as this is handled in update_brand() } else { - echo "Please name the Package the same name as your brand!"; + echo "Please name the Package the same name as your brand!
      "; } } else { +// Did not find the .tgz file $endpoint->error['upload'] = "No File Provided"; + echo "File ".PHONE_MODULES_PATH."temp/".$_REQUEST['package']." not found.
      "; } break; } From 7ba628beda22d8cdffd755d6ef6c71ee5b868beb Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 16 Nov 2012 10:09:27 -0800 Subject: [PATCH 309/623] Cleaned up debug statements and variables --- includes/functions.inc | 19 +++++++++---------- includes/installer.inc | 11 +++++------ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 3ff6db21..9634cfed 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -2144,10 +2144,9 @@ class endpointmanager { * Still needs way to determine when models move...perhaps another function? */ function update_brand($package, $remote=TRUE) { - $debug = $this->global_cfg['debug']; - if ($debug) echo "update_brand(): Debug is set to $debug
      "; + if ($this->global_cfg['debug']) echo "update_brand(): Debug is set to ".$this->global_cfg['debug']."
      "; $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; - if ($debug) echo "Processing $temp_directory$package/brand_data.json...
      "; + if ($this->global_cfg['debug']) echo "Processing ".$temp_directory.$package."/brand_data.json...
      "; if (file_exists($temp_directory . $package . '/brand_data.json')) { $temp = $this->file2json($temp_directory . $package . '/brand_data.json'); if (key_exists('directory', $temp['data']['brands'])) { @@ -2160,7 +2159,7 @@ class endpointmanager { $brand_version = $temp['data']['brands']['last_modified']; //create directory structure and move files - echo "Creating Directory Structure for Brand '$brand_name' and Moving Files .."; + echo "Creating Directory Structure for Brand '".$brand_name."' and Moving Files .."; if (!file_exists(PHONE_MODULES_PATH . "endpoint/" . $directory)) { mkdir(PHONE_MODULES_PATH . "endpoint/" . $directory); @@ -2224,10 +2223,10 @@ class endpointmanager { $data = $this->eda->sql("SELECT id FROM endpointman_product_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . "'", 'getOne'); $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); if ($data) { - if ($debug) echo "-Updating Family $short_name
      "; + if ($this->global_cfg['debug']) echo "-Updating Family ".$short_name."
      "; $sql = "UPDATE endpointman_product_list SET short_name = '" . $short_name . "', long_name = '" . $family_line_xml['data']['name'] . "', cfg_ver = '" . $family_line_xml['data']['version'] . "', config_files='" . $family_line_xml['data']['configuration_files'] . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . "'"; } else { - if ($debug) echo "-Inserting Family $short_name
      "; + if ($this->global_cfg['debug']) echo "-Inserting Family ".$short_name."
      "; $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . $short_name . "', '" . $family_line_xml['data']['name'] . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['last_modified'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')"; } @@ -2334,10 +2333,10 @@ class endpointmanager { $m_data = $this->eda->sql("SELECT id FROM endpointman_model_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'", 'getone'); if ($m_data) { - if ($debug) echo "---Updating Model {$model_list['model']}
      "; + if ($this->global_cfg['debug']) echo "---Updating Model ".$model_list['model']."
      "; $sql = "UPDATE endpointman_model_list SET max_lines = '" . $model_list['lines'] . "', model = '" . $model_list['model'] . "', template_list = '" . $template_list . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'"; } else { - if ($debug) echo "---Inserting Model {$model_list['model']}
      "; + if ($this->global_cfg['debug']) echo "---Inserting Model ".$model_list['model']."
      "; $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "', '" . $brand_id . "', '" . $model_list['model'] . "', '" . $model_list['lines'] . "', '" . $brand_id . $family_line_xml['data']['id'] . "', '" . $template_list . "', '0', '0')"; } $this->eda->sql($sql); @@ -2369,7 +2368,7 @@ class endpointmanager { } } - if ($debug) { + if ($this->global_cfg['debug']) { echo "Done!
      "; echo "Updating OUI list in DB
      "; } @@ -3205,4 +3204,4 @@ function endpointmanager_read_body($ch, $string) { //ob_flush(); endpointman_flush_buffers(); return $length; -} \ No newline at end of file +} diff --git a/includes/installer.inc b/includes/installer.inc index 6ae56aad..98225f0c 100644 --- a/includes/installer.inc +++ b/includes/installer.inc @@ -81,8 +81,7 @@ if($_REQUEST['type'] == "brand") { } break; case "upload_brand": - $debug = $endpoint->global_cfg['debug']; - if ($debug) echo "upload_brand(): Debug is set to ". $debug ."
      "; + if ($this->global_cfg['debug']) echo "upload_brand(): Debug is set to ". $this->global_cfg['debug'] ."
      "; // Bramd file (*.tgz) will have been copied into the location under which all endpoint definitions reside + /temp/ if (file_exists(PHONE_MODULES_PATH."temp/".$_REQUEST['package'])) { // The untarred brand file will go into /tmp (or wherever the "temporary" location the OS tells us) + /epm-temp/ @@ -91,8 +90,8 @@ if($_REQUEST['type'] == "brand") { echo "Creating EPM temp directory
      "; mkdir($temp_directory); } - if ($debug) { - echo "Extracting Tarball ".PHONE_MODULES_PATH.'temp/'. $_REQUEST['package']." to $temp_directory ........"; + if ($this->global_cfg['debug']) { + echo "Extracting Tarball ".PHONE_MODULES_PATH.'temp/'. $_REQUEST['package']." to ".$temp_directory." ........"; } else { echo "Extracting Tarball........ "; } @@ -102,7 +101,7 @@ if($_REQUEST['type'] == "brand") { $package = basename($_REQUEST['package'], ".tgz"); $package = explode("-",$package); - if ($debug) echo "Looking for file $temp_directory$package[0] to pass on to update_brand()
      "; + if ($this->global_cfg['debug']) echo "Looking for file ".$temp_directory.$package[0]." to pass on to update_brand()
      "; if(file_exists($temp_directory.$package[0])) { $endpoint->update_brand($package[0],FALSE); // Note: no need to delete/unlink/rmdir as this is handled in update_brand() @@ -118,4 +117,4 @@ if($_REQUEST['type'] == "brand") { } } -echo "
      \n\t"._("Return").""; \ No newline at end of file +echo "
      \n\t"._("Return").""; From ab71e45aeaf10fbac11fe6c441545f5d23b1937b Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 16 Nov 2012 10:10:56 -0800 Subject: [PATCH 310/623] Updating EPM to 2.11 --- module.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module.xml b/module.xml index 757aea69..e3ea609f 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.10.4.6 + 2.11.0.1 setup Connectivity Andrew Nagy @@ -18,7 +18,7 @@ *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager - release/2.10/endpointman-2.10.3.7.tgz + release/2.11/endpointman-2.11.0.1.tgz 2.6 From f2d0b10bcefb28de8acfb94813aa22f3991d57c4 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 11 Dec 2012 10:46:40 -0800 Subject: [PATCH 311/623] Update includes/installer.inc Removed this for that --- includes/installer.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/installer.inc b/includes/installer.inc index 98225f0c..d96ace77 100644 --- a/includes/installer.inc +++ b/includes/installer.inc @@ -81,7 +81,7 @@ if($_REQUEST['type'] == "brand") { } break; case "upload_brand": - if ($this->global_cfg['debug']) echo "upload_brand(): Debug is set to ". $this->global_cfg['debug'] ."
      "; + if ($endpoint->global_cfg['debug']) echo "upload_brand(): Debug is set to ". $endpoint->global_cfg['debug'] ."
      "; // Bramd file (*.tgz) will have been copied into the location under which all endpoint definitions reside + /temp/ if (file_exists(PHONE_MODULES_PATH."temp/".$_REQUEST['package'])) { // The untarred brand file will go into /tmp (or wherever the "temporary" location the OS tells us) + /epm-temp/ @@ -90,7 +90,7 @@ if($_REQUEST['type'] == "brand") { echo "Creating EPM temp directory
      "; mkdir($temp_directory); } - if ($this->global_cfg['debug']) { + if ($endpoint->global_cfg['debug']) { echo "Extracting Tarball ".PHONE_MODULES_PATH.'temp/'. $_REQUEST['package']." to ".$temp_directory." ........"; } else { echo "Extracting Tarball........ "; @@ -101,7 +101,7 @@ if($_REQUEST['type'] == "brand") { $package = basename($_REQUEST['package'], ".tgz"); $package = explode("-",$package); - if ($this->global_cfg['debug']) echo "Looking for file ".$temp_directory.$package[0]." to pass on to update_brand()
      "; + if ($endpoint->global_cfg['debug']) echo "Looking for file ".$temp_directory.$package[0]." to pass on to update_brand()
      "; if(file_exists($temp_directory.$package[0])) { $endpoint->update_brand($package[0],FALSE); // Note: no need to delete/unlink/rmdir as this is handled in update_brand() From b73a00a0548daf50df58dfa096ba32c5b2b58df2 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 11 Dec 2012 10:46:59 -0800 Subject: [PATCH 312/623] Update module.xml Bump Version --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index e3ea609f..45fcf86b 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard PBX End Point Manager - 2.11.0.1 + 2.11.0.2 setup Connectivity Andrew Nagy From 13ef5d219d756026e6dcb2796766997aeba39675 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Wed, 16 Jan 2013 00:42:38 -0800 Subject: [PATCH 313/623] Fixing a few bugs and issues especially with sonicwall --- bin/freepbx_engine_hook_endpointman | 14 ++ config.php | 8 +- functions.inc.php | 12 +- includes/advanced.inc | 2 +- includes/functions.inc | 220 ++++++++++++++------------ includes/popup.inc | 2 +- includes/system_functions.class | 231 ++++++++++++++++++++++++++++ install.php | 2 +- module.xml | 21 +-- provisioning/p.php | 2 +- uninstall.php | 2 +- 11 files changed, 390 insertions(+), 126 deletions(-) create mode 100755 bin/freepbx_engine_hook_endpointman create mode 100644 includes/system_functions.class diff --git a/bin/freepbx_engine_hook_endpointman b/bin/freepbx_engine_hook_endpointman new file mode 100755 index 00000000..fc2dadc2 --- /dev/null +++ b/bin/freepbx_engine_hook_endpointman @@ -0,0 +1,14 @@ +#!/bin/bash +# This script is called when the user executes amportal +# +# Check to make sure we are in the chown mode +if [ "$1" == "chown" ] + then + #Check for tftboot + if [ -f /tftpboot ] + then + #Change permissions regardless + chown -hR $AMPASTERISKUSER:$AMPASTERISKGROUP /tftpboot + chmod g+w /tftpboot + fi +fi \ No newline at end of file diff --git a/config.php b/config.php index 60ad017c..c828e4d3 100644 --- a/config.php +++ b/config.php @@ -13,8 +13,8 @@ die(_('Turn Off Safe Mode')); } -if (PHP_VERSION < '5.1.0') { - die(_('PHP Version MUST be greater than') . ' 5.1.0!'); +if (PHP_VERSION < '5.3.0') { + die(_('PHP Version MUST be greater than') . ' 5.3.0!'); } include 'includes/functions.inc'; @@ -23,10 +23,6 @@ $endpoint = new endpointmanager(); -if (!file_exists(dirname(dirname(dirname(__FILE__))) . '/assets/endpointman/images/add.png')) { - echo "WARNING: Assets Missing! ^^Please click the \"Apply Configuration Changes\" Button"; -} - if (!is_writeable(LOCAL_PATH)) { if (!chmod(LOCAL_PATH, 0764)) { die('My own path is not writable (' . LOCAL_PATH . ')'); diff --git a/functions.inc.php b/functions.inc.php index 722ef0cb..74653c2f 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -51,10 +51,10 @@ function endpointman_configpageinit($pagename) { } else { $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null; } - } else { - // we only care about extensions or devices, otherwise return - return true; - } + } else { + // we only care about extensions or devices, otherwise return + return true; + } if (isset($extdisplay) && !empty($extdisplay)) { $sql = "SELECT tech FROM devices WHERE id = " . $extdisplay; @@ -114,11 +114,8 @@ function endpointman_configpageinit($pagename) { $temp = isset($_REQUEST['epm_temps']) ? $_REQUEST['epm_temps'] : null; if (isset($_REQUEST['name'])) { $name = isset($_REQUEST['name']) ? $_REQUEST['name'] : null; - echo "hi"; } else { - echo "hi"; $name = isset($_REQUEST['description']) ? $_REQUEST['description'] : null; - echo $name; } if (isset($_REQUEST['deviceid'])) { if ($_REQUEST['devicetype'] == "fixed") { @@ -175,6 +172,7 @@ function endpointman_configpageinit($pagename) { $mac_id = $endpoint->add_device($mac, $model, $extdisplay, $temp, NULL, $name); if ($mac_id) { + debug('Write files?'); $row = $endpoint->get_phone_info($mac_id); $endpoint->prepare_configs($row); } diff --git a/includes/advanced.inc b/includes/advanced.inc index f10ff8fa..0da75278 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -378,7 +378,7 @@ switch ($_REQUEST['subpage']) { $template_file_list[0]['value'] = "template_data_custom.xml"; $template_file_list[0]['text'] = "template_data_custom.xml"; - $sql = 'SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE CONVERT(_utf8 \'1-2\' USING latin1) COLLATE latin1_swedish_ci AND `enabled` = 1 AND `hidden` = 0'; + $sql = "SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE '1-2' AND `enabled` = 1 AND `hidden` = 0"; $data = & $endpoint->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); $i = 1; foreach ($data as $list) { diff --git a/includes/functions.inc b/includes/functions.inc index 9634cfed..65b7291e 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -28,8 +28,12 @@ class endpointmanager { function __construct() { global $amp_conf; require_once('abstraction/freepbx.inc'); - require_once('json.inc'); $this->eda = new epm_data_abstraction(); + + require_once('system_functions.class'); + $this->system = new epm_system(); + + require_once('json.inc'); $this->global_cfg = $this->eda->get_stored_globals(); @@ -112,7 +116,7 @@ class endpointmanager { } } - $sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; + $sql = "SELECT value FROM `admin` WHERE `variable` LIKE 'version'"; preg_match('/^(\d*)\.(\d*)/', $this->eda->sql($sql, 'getone'), $versions); @@ -128,46 +132,6 @@ class endpointmanager { $this->tpl->assign("amp_ver", $this->global_cfg['amp_ver']['minor']); } - /** - * @author http://www.php.net/manual/en/function.socket-create.php#43057 - * @param type $host - * @param type $filename - * @return type - */ - function tftp_fetch($host, $filename) { - //first off let's check if this is installed or disabled - $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); - - // create the request packet - $packet = chr(0) . chr(1) . $filename . chr(0) . 'octet' . chr(0); - // UDP is connectionless, so we just send on it. - socket_sendto($socket, $packet, strlen($packet), 0x100, $host, 69); - - $buffer = ''; - $port = ''; - $ret = ''; - $time = time(); - do { - $new_time = time() - $time; - if ($new_time > 5) { - break; - } - // $buffer and $port both come back with information for the ack - // 516 = 4 bytes for the header + 512 bytes of data - socket_recvfrom($socket, $buffer, 516, 0, $host, $port); - - // add the block number from the data packet to the ack packet - $packet = chr(0) . chr(4) . substr($buffer, 2, 2); - // send ack - socket_sendto($socket, $packet, strlen($packet), 0, $host, $port); - - // append the data to the return variable - // for large files this function should take a file handle as an arg - $ret .= substr($buffer, 4); - } while (strlen($buffer) == 516); // the first non-full packet is the last. - return $ret; - } - function tftp_check() { //create a simple block here incase people have strange issues going on as we will kill http //by running this if the server isn't really running! @@ -179,7 +143,7 @@ class endpointmanager { if (preg_match('/:69\s/i', $subject)) { $rand = md5(rand(10, 2000)); if (file_put_contents($this->global_cfg['config_location'] . 'TEST', $rand)) { - if ($this->tftp_fetch('127.0.0.1', 'TEST') != $rand) { + if ($this->system->tftp_fetch('127.0.0.1', 'TEST') != $rand) { $this->error['tftp_check'] = 'Local TFTP Server is not correctly configured'; } unlink($this->global_cfg['config_location'] . 'TEST'); @@ -207,6 +171,11 @@ class endpointmanager { } } + /** + * Fixes the display are special strings so we can visible see them instead of them being transformed + * @param string $contents a string of course + * @return string fixed string + */ function display_htmlspecialchars($contents) { $contents = str_replace("&", "&amp;", $contents); $contents = str_replace("<", "&lt;", $contents); @@ -2610,6 +2579,7 @@ class endpointmanager { * @param bool $Strict * @param array $Path * @return array + * @package epm_system */ function arraysearchrecursive($Needle, $Haystack, $NeedleKey="", $Strict=false, $Path=array()) { if (!is_array($Haystack)) @@ -2630,19 +2600,37 @@ class endpointmanager { return false; } + /** + * Send process to run in background + * @version 2.11 + * @param string $command the command to run + * @param integer $Priority the Priority of the command to run + * @return int $PID process id + * @package epm_system + */ function run_in_background($Command, $Priority = 0) { - if ($Priority) - $PID = shell_exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!"); - else - $PID = shell_exec("nohup $Command > /dev/null 2> /dev/null & echo $!"); - return($PID); + return($Priority ? shell_exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!") : shell_exec("nohup $Command > /dev/null 2> /dev/null & echo $!")); } + /** + * Check if process is running in background + * @version 2.11 + * @param string $PID proccess ID + * @return bool true or false + * @package epm_system + */ function is_process_running($PID) { exec("ps $PID", $ProcessState); return(count($ProcessState) >= 2); } + /** + * Downloads a file and places it in the destination defined with progress + * @version 2.11 + * @param string $url_file URL of File + * @param string $destination_file Destination of file + * @package epm_system + */ function download_file_with_progress_bar($url_file, $destination_file) { set_time_limit(0); $headers = get_headers($url_file, 1); @@ -2667,10 +2655,27 @@ class endpointmanager { } } + /** + * Downloads a file and places it in the destination defined + * @version 2.11 + * @param string $url_file URL of File + * @param string $destination_file Destination of file + * @package epm_system + */ function download_file($url_file, $destination_file) { - $contents = file_get_contents($url_file); - - if (preg_match('/200/', $http_response_header[0])) { + //Determine if file_get_contents_url exists which is the default FreePBX Standard for downloading straight files + if(function_exists('file_get_contents_url')) { + $contents = file_get_contents_url($url_file); + } else { + //I really hope we NEVER get here. + $contents = file_get_contents($url_file); + if (!preg_match('/200/', $http_response_header[0])) { + $this->error['download_file'] = "Unknown Error in Download_file"; + return false; + } + } + //If contents are emtpy then we failed. Or something is wrong + if(!empty($contents)) { $dirname = dirname($destination_file); if (!file_exists($dirname)) { mkdir($dirname); @@ -2687,30 +2692,27 @@ class endpointmanager { } return true; } else { - $this->error['download_file'] = "Server Replied with error '" . $http_response_header[0] . "'. Unable to download files"; + $this->error['download_file'] = "Contents of Remote file are blank! URL:".$url_file; return false; } } - //This function looks in common linux directories for system executable files. Like ARP & NMAP + /** + * Uses which to find executables that asterisk can run/use + * @version 2.11 + * @param string $exec Executable to find + * @package epm_system + */ function find_exec($exec) { - $usr_bin = glob("/usr/bin/" . $exec); - $usr_sbin = glob("/usr/sbin/" . $exec); - $sbin = glob("/sbin/" . $exec); - $bin = glob("/bin/" . $exec); - $etc = glob("/etc/" . $exec); - if (isset($usr_bin[0])) { - return("/usr/bin/" . $exec); - } elseif (isset($usr_sbin[0])) { - return("/usr/sbin/" . $exec); - } elseif (isset($sbin[0])) { - return("/sbin/" . $exec); - } elseif (isset($bin[0])) { - return("/bin/" . $exec); - } elseif (isset($etc[0])) { - return("/etc/" . $exec); + $o = exec('which '.$exec); + if($o) { + if(file_exists($o) && is_executable($o)) { + return($o); + } else { + return(''); + } } else { - return($exec); + return(''); } } @@ -2719,6 +2721,8 @@ class endpointmanager { * Using RecursiveIteratorIterator is the only way PHP is able to see hidden files. * @author http://www.webcheatsheet.com/PHP/working_with_directories.php * @param string $dir Full Directory path to delete + * @version 2.11 + * @package epm_system */ function rmrf($dir) { if (file_exists($dir)) { @@ -2737,14 +2741,13 @@ class endpointmanager { /** * Only used once in all of Endpoint Manager to determine if a table exists - * @param $table - * @return + * @param string $table Table to look for + * @return bool */ function table_exists($table) { global $amp_conf; $sql = "SHOW TABLES FROM " . $amp_conf['AMPDBNAME']; $result = $this->eda->sql($sql, 'getAll'); - foreach ($result as $row) { if ($row[0] == $table) { return TRUE; @@ -2753,13 +2756,46 @@ class endpointmanager { return FALSE; } + /** + * Reads a file. Json decodes it and will report any errors back + * @param string $file location of file + * @return mixed false on error, array on success + * @version 2.11 + */ function file2json($file) { if (file_exists($file)) { $json = file_get_contents($file); $data = json_decode($json, TRUE); - return($data); + if(function_exists('json_last_error')) { + switch (json_last_error()) { + case JSON_ERROR_NONE: + return($data); + break; + case JSON_ERROR_DEPTH: + $this->error['file2json'] = 'Maximum stack depth exceeded'; + break; + case JSON_ERROR_STATE_MISMATCH: + $this->error['file2json'] = 'Underflow or the modes mismatch'; + break; + case JSON_ERROR_CTRL_CHAR: + $this->error['file2json'] = 'Unexpected control character found'; + break; + case JSON_ERROR_SYNTAX: + $this->error['file2json'] = 'Syntax error, malformed JSON'; + break; + case JSON_ERROR_UTF8: + $this->error['file2json'] = 'Malformed UTF-8 characters, possibly incorrectly encoded'; + break; + default: + $this->error['file2json'] = 'Unknown error'; + break; + } + return(false); + } else { + return($data); + } } else { - return(array()); + return(false); } } @@ -2779,7 +2815,7 @@ class endpointmanager { "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f]/i", $mac)) { return(strtoupper(str_replace(":", "", str_replace("-", "", $mac)))); - //Is the string exactly 12 characters? + //Is the string exactly 12 characters? } elseif (strlen($mac) == "12") { //Now is the string a valid HEX mac address? if (preg_match("/[0-9a-f][0-9a-f]" . @@ -2792,7 +2828,7 @@ class endpointmanager { } else { return(FALSE); } - //Is the mac separated by whitespaces? + //Is the mac separated by whitespaces? } elseif (preg_match("/[0-9a-f][0-9a-f][\s]" . "[0-9a-f][0-9a-f][\s]" . "[0-9a-f][0-9a-f][\s]" . @@ -2812,13 +2848,10 @@ class endpointmanager { * Check for valid netmast to avoid security issues * @param string $mask the complete netmask, eg [1.1.1.1/24] * @return boolean True if valid, False if not + * @version 2.11 */ function validate_netmask($mask) { - if (preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/", $mask)) { - return(TRUE); - } else { - return(FALSE); - } + return preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/", $mask) ? TRUE : FALSE; } /** @@ -2826,14 +2859,16 @@ class endpointmanager { * nmap will actually discover 'unseen' devices that the VoIP server hasn't heard from * If the user just wishes to use the local arp cache they can tell the function to not use nmap * This results in a speed increase from 60 seconds to less than one second. - * @author tm1000 - * @version 1.5 + * + * This is the original function that started it all + * http://www.pbxinaflash.com/community/index.php?threads/end-point-configuration-manager-module-for-freepbx-part-1.4514/page-4#post-37671 + * + * @version 2.11 * @param mixed $netmask The netmask, eg [1.1.1.1/24] * @param boolean $use_nmap True use nmap, false don't use it * @return array List of devices found on the network */ function discover_new($netmask, $use_nmap=TRUE) { - if (($use_nmap) AND (file_exists($this->global_cfg['nmap_location'])) AND ($this->validate_netmask($netmask))) { shell_exec($this->global_cfg['nmap_location'] . ' -v -sP ' . $netmask); } elseif (!$this->validate_netmask($netmask)) { @@ -2849,7 +2884,6 @@ class endpointmanager { //Throw arp list into an array, break by new lines $arp_array = explode("\n", $arp_list); - //Find all references to active computers by searching out mac addresses. $temp = array_values(array_unique(preg_grep("/[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . @@ -2897,27 +2931,15 @@ class endpointmanager { $epm_row = $this->eda->sql($epm_sql, 'getRow', DB_FETCHMODE_ASSOC); $res = $this->eda->sql($epm_sql); - $epm_count = $res->numRows(); - if ($epm_count) { - $epm = TRUE; - } else { - $epm = FALSE; - } + $epm = $res->numRows() ? TRUE : FALSE; //Add into a final array $final[$z] = array("ip" => $ip, "mac" => $mac, "mac_strip" => $mac_strip, "oui" => $oui, "brand" => $brand['name'], "brand_id" => $brand['id'], "endpoint_managed" => $epm); $z++; } } - - //$final = array_values($final); - - if (!is_array($final)) { - return(FALSE); - } else { - return ($final); - } + return !is_array($final) ? FALSE : $final; } function areaAvailable($model, $area=NULL) { diff --git a/includes/popup.inc b/includes/popup.inc index bd27c5d3..269039c2 100644 --- a/includes/popup.inc +++ b/includes/popup.inc @@ -431,7 +431,7 @@ if($_REQUEST['pop_type'] == "alt_cfg_edit") { $template_file_list[0]['value'] = "template_data_custom.xml"; $template_file_list[0]['text'] = "template_data_custom.xml"; - $sql = 'SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE CONVERT(_utf8 \'1-2\' USING latin1) COLLATE latin1_swedish_ci AND `enabled` = 1 AND `hidden` = 0'; + $sql = "SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE '1-2' AND `enabled` = 1 AND `hidden` = 0"; $data =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 1; foreach($data as $list) { diff --git a/includes/system_functions.class b/includes/system_functions.class new file mode 100644 index 00000000..c95d6bb5 --- /dev/null +++ b/includes/system_functions.class @@ -0,0 +1,231 @@ + 5) { + break; + } + // $buffer and $port both come back with information for the ack + // 516 = 4 bytes for the header + 512 bytes of data + socket_recvfrom($socket, $buffer, 516, 0, $host, $port); + + // add the block number from the data packet to the ack packet + $packet = chr(0) . chr(4) . substr($buffer, 2, 2); + // send ack + socket_sendto($socket, $packet, strlen($packet), 0, $host, $port); + + // append the data to the return variable + // for large files this function should take a file handle as an arg + $ret .= substr($buffer, 4); + } while (strlen($buffer) == 516); // the first non-full packet is the last. + return $ret; + } + + /** + * The RecursiveIteratorIterator must be told to provide children (files and subdirectories) before parents with its CHILD_FIRST constant. + * Using RecursiveIteratorIterator is the only way PHP is able to see hidden files. + * @author http://www.webcheatsheet.com/PHP/working_with_directories.php + * @param string $dir Full Directory path to delete + * @version 2.11 + */ + function rmrf($dir) { + if (file_exists($dir)) { + $iterator = new RecursiveDirectoryIterator($dir); + foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) { + if ($file->isDir()) { + @rmdir($file->getPathname()); + } else { + @unlink($file->getPathname()); + } + } + //Remove parent path as the last step + @rmdir($dir); + } + } + + /** + * Uses which to find executables that asterisk can run/use + * @version 2.11 + * @param string $exec Executable to find + * @package epm_system + */ + function find_exec($exec) { + $o = exec('which '.$exec); + if($o) { + if(file_exists($o) && is_executable($o)) { + return($o); + } else { + return(''); + } + } else { + return(''); + } + } + + /** + * Downloads a file and places it in the destination defined + * @version 2.11 + * @param string $url_file URL of File + * @param string $destination_file Destination of file + * @package epm_system + */ + function download_file($url_file, $destination_file) { + //Determine if file_get_contents_url exists which is the default FreePBX Standard for downloading straight files + if(function_exists('file_get_contents_url')) { + $contents = file_get_contents_url($url_file); + } else { + //I really hope we NEVER get here. + $contents = file_get_contents($url_file); + if (!preg_match('/200/', $http_response_header[0])) { + $this->error['download_file'] = "Unknown Error in Download_file"; + return false; + } + } + //If contents are emtpy then we failed. Or something is wrong + if(!empty($contents)) { + $dirname = dirname($destination_file); + if (!file_exists($dirname)) { + mkdir($dirname); + } + if (!is_writable($dirname)) { + $this->error['download_file'] = "Directory '" . $dirname . "' is not writable! Unable to download files"; + return false; + } + file_put_contents($destination_file, $contents); + //check file placement + if (!file_exists($destination_file)) { + $this->error['download_file'] = "File Doesn't Exist in '" . $dirname . "'. Unable to download files"; + return false; + } + return true; + } else { + $this->error['download_file'] = "Contents of Remote file are blank! URL:".$url_file; + return false; + } + } + + /** + * Downloads a file and places it in the destination defined with progress + * @version 2.11 + * @param string $url_file URL of File + * @param string $destination_file Destination of file + * @package epm_system + */ + function download_file_with_progress_bar($url_file, $destination_file) { + set_time_limit(0); + $headers = get_headers($url_file, 1); + $size = $headers['Content-Length']; + + if (preg_match('/200/', $headers[0])) { + $pid = $this->run_in_background("wget " . $url_file . " -O " . $destination_file); + + while ($this->is_process_running($pid)) { + + $out = 100 * round(filesize($destination_file) / $size, 2); + echo ''; + + usleep('500'); + ob_end_flush(); + //ob_flush(); + flush(); + ob_start(); + + + clearstatcache(); // make sure PHP actually checks dest. file size + } + return true; + } else { + return false; + } + } + + /** + * Taken from http://www.php.net/manual/en/function.array-search.php#69232 + * search haystack for needle and return an array of the key path, FALSE otherwise. + * if NeedleKey is given, return only for this key mixed ArraySearchRecursive(mixed Needle,array Haystack[,NeedleKey[,bool Strict[,array Path]]]) + * @author ob (at) babcom (dot) biz + * @param mixed $Needle + * @param array $Haystack + * @param mixed $NeedleKey + * @param bool $Strict + * @param array $Path + * @return array + * @package epm_system + */ + function arraysearchrecursive($Needle, $Haystack, $NeedleKey="", $Strict=false, $Path=array()) { + if (!is_array($Haystack)) + return false; + foreach ($Haystack as $Key => $Val) { + if (is_array($Val) && + $SubPath = $this->arraysearchrecursive($Needle, $Val, $NeedleKey, $Strict, $Path)) { + $Path = array_merge($Path, Array($Key), $SubPath); + return $Path; + } elseif ((!$Strict && $Val == $Needle && + $Key == (strlen($NeedleKey) > 0 ? $NeedleKey : $Key)) || + ($Strict && $Val === $Needle && + $Key == (strlen($NeedleKey) > 0 ? $NeedleKey : $Key))) { + $Path[] = $Key; + return $Path; + } + } + return false; + } + + /** + * Send process to run in background + * @version 2.11 + * @param string $command the command to run + * @param integer $Priority the Priority of the command to run + * @return int $PID process id + * @package epm_system + */ + function run_in_background($Command, $Priority = 0) { + return($Priority ? shell_exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!") : shell_exec("nohup $Command > /dev/null 2> /dev/null & echo $!")); + } + + /** + * Check if process is running in background + * @version 2.11 + * @param string $PID proccess ID + * @return bool true or false + * @package epm_system + */ + function is_process_running($PID) { + exec("ps $PID", $ProcessState); + return(count($ProcessState) >= 2); + } +} \ No newline at end of file diff --git a/install.php b/install.php index 50caf781..d8707579 100644 --- a/install.php +++ b/install.php @@ -106,7 +106,7 @@ function ep_table_exists($table) { $version['major'] = $versions[1]; $version['minor'] = $versions[2]; -$sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; +$sql = "SELECT value FROM `admin` WHERE `variable` LIKE 'version'"; preg_match('/^(\d*)\.(\d*)/', $db->getOne($sql), $versions); $amp_version['minor'] = $versions[2]; diff --git a/module.xml b/module.xml index 45fcf86b..cab27d52 100644 --- a/module.xml +++ b/module.xml @@ -1,29 +1,32 @@ endpointman standard - PBX End Point Manager - 2.11.0.2 + OSS PBX End Point Manager + 2.11.4.8 setup Connectivity Andrew Nagy MPLv1.1 - End Point Device List - End Point Template Manager - End Point Configuration - End Point Advanced Settings + OSS Endpoint Device List + OSS Endpoint Template Manager + OSS Endpoint Configuration + OSS Endpoint Advanced Settings - PBX End Point Manager supports automated deployment of multiple manufacturers IP telephones. + + OSS PBX End Point Manager is the free supported PBX Endpoint Manager for FreePBX. + It is NOT to be confused with the commercial version called 'endpoint'. + The main differences between the two versions is that the developer of Commercial Endpoint works 30 hours a week paid by Schmoozecom to work on it. + *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager release/2.11/endpointman-2.11.0.1.tgz - 2.6 + 2.10 - core fw_ari 2832e12476c29c6a72c85225fb7ad143 diff --git a/provisioning/p.php b/provisioning/p.php index 422814ad..87a004d7 100644 --- a/provisioning/p.php +++ b/provisioning/p.php @@ -68,7 +68,7 @@ if(preg_match('/[0-9A-Fa-f]{12}/i', $strip, $matches) && !(preg_match('/[0]{10}[0-9]{2}/i',$strip))) { $mac_address = $matches[0]; - $sql = 'SELECT id FROM `endpointman_mac_list` WHERE `mac` LIKE CONVERT(_utf8 \'%' . $mac_address . '%\' USING latin1) COLLATE latin1_swedish_ci'; + $sql = "SELECT id FROM `endpointman_mac_list` WHERE `mac` LIKE '%" . $mac_address . "%'"; $mac_id = $endpoint->eda->sql($sql, 'getOne'); $phone_info = $endpoint->get_phone_info($mac_id); diff --git a/uninstall.php b/uninstall.php index c6c41c47..4fd362d3 100644 --- a/uninstall.php +++ b/uninstall.php @@ -61,7 +61,7 @@ function outn($text) { $sql = "DROP TABLE `endpointman_custom_configs`"; $result = $db->query($sql); -$sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; +$sql = "SELECT value FROM `admin` WHERE `variable` LIKE 'version'"; $amp_version = $db->getOne($sql); //Do unlinks ourself because retrieve_conf doesn't always remove stuff... From 1a3cd31092382de62b9e22dccb2ec98da9b4957f Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Wed, 16 Jan 2013 08:48:16 +0000 Subject: [PATCH 314/623] Updating Endpoint manager with a new more identifiable name plus some sonicwall fixes --- bin/freepbx_engine_hook_endpointman | 14 ++ config.php | 8 +- functions.inc.php | 12 +- includes/advanced.inc | 2 +- includes/functions.inc | 253 ++++++++++++++++------------ includes/installer.inc | 31 +++- includes/popup.inc | 2 +- includes/system_functions.class | 231 +++++++++++++++++++++++++ install.php | 2 +- module.xml | 25 +-- provisioning/p.php | 2 +- uninstall.php | 2 +- 12 files changed, 438 insertions(+), 146 deletions(-) create mode 100755 bin/freepbx_engine_hook_endpointman create mode 100644 includes/system_functions.class diff --git a/bin/freepbx_engine_hook_endpointman b/bin/freepbx_engine_hook_endpointman new file mode 100755 index 00000000..fc2dadc2 --- /dev/null +++ b/bin/freepbx_engine_hook_endpointman @@ -0,0 +1,14 @@ +#!/bin/bash +# This script is called when the user executes amportal +# +# Check to make sure we are in the chown mode +if [ "$1" == "chown" ] + then + #Check for tftboot + if [ -f /tftpboot ] + then + #Change permissions regardless + chown -hR $AMPASTERISKUSER:$AMPASTERISKGROUP /tftpboot + chmod g+w /tftpboot + fi +fi \ No newline at end of file diff --git a/config.php b/config.php index 60ad017c..c828e4d3 100644 --- a/config.php +++ b/config.php @@ -13,8 +13,8 @@ die(_('Turn Off Safe Mode')); } -if (PHP_VERSION < '5.1.0') { - die(_('PHP Version MUST be greater than') . ' 5.1.0!'); +if (PHP_VERSION < '5.3.0') { + die(_('PHP Version MUST be greater than') . ' 5.3.0!'); } include 'includes/functions.inc'; @@ -23,10 +23,6 @@ $endpoint = new endpointmanager(); -if (!file_exists(dirname(dirname(dirname(__FILE__))) . '/assets/endpointman/images/add.png')) { - echo "WARNING: Assets Missing! ^^Please click the \"Apply Configuration Changes\" Button"; -} - if (!is_writeable(LOCAL_PATH)) { if (!chmod(LOCAL_PATH, 0764)) { die('My own path is not writable (' . LOCAL_PATH . ')'); diff --git a/functions.inc.php b/functions.inc.php index 722ef0cb..74653c2f 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -51,10 +51,10 @@ function endpointman_configpageinit($pagename) { } else { $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null; } - } else { - // we only care about extensions or devices, otherwise return - return true; - } + } else { + // we only care about extensions or devices, otherwise return + return true; + } if (isset($extdisplay) && !empty($extdisplay)) { $sql = "SELECT tech FROM devices WHERE id = " . $extdisplay; @@ -114,11 +114,8 @@ function endpointman_configpageinit($pagename) { $temp = isset($_REQUEST['epm_temps']) ? $_REQUEST['epm_temps'] : null; if (isset($_REQUEST['name'])) { $name = isset($_REQUEST['name']) ? $_REQUEST['name'] : null; - echo "hi"; } else { - echo "hi"; $name = isset($_REQUEST['description']) ? $_REQUEST['description'] : null; - echo $name; } if (isset($_REQUEST['deviceid'])) { if ($_REQUEST['devicetype'] == "fixed") { @@ -175,6 +172,7 @@ function endpointman_configpageinit($pagename) { $mac_id = $endpoint->add_device($mac, $model, $extdisplay, $temp, NULL, $name); if ($mac_id) { + debug('Write files?'); $row = $endpoint->get_phone_info($mac_id); $endpoint->prepare_configs($row); } diff --git a/includes/advanced.inc b/includes/advanced.inc index f10ff8fa..0da75278 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -378,7 +378,7 @@ switch ($_REQUEST['subpage']) { $template_file_list[0]['value'] = "template_data_custom.xml"; $template_file_list[0]['text'] = "template_data_custom.xml"; - $sql = 'SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE CONVERT(_utf8 \'1-2\' USING latin1) COLLATE latin1_swedish_ci AND `enabled` = 1 AND `hidden` = 0'; + $sql = "SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE '1-2' AND `enabled` = 1 AND `hidden` = 0"; $data = & $endpoint->eda->sql($sql, 'getall', DB_FETCHMODE_ASSOC); $i = 1; foreach ($data as $list) { diff --git a/includes/functions.inc b/includes/functions.inc index 9408d06d..65b7291e 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -28,8 +28,12 @@ class endpointmanager { function __construct() { global $amp_conf; require_once('abstraction/freepbx.inc'); - require_once('json.inc'); $this->eda = new epm_data_abstraction(); + + require_once('system_functions.class'); + $this->system = new epm_system(); + + require_once('json.inc'); $this->global_cfg = $this->eda->get_stored_globals(); @@ -112,7 +116,7 @@ class endpointmanager { } } - $sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; + $sql = "SELECT value FROM `admin` WHERE `variable` LIKE 'version'"; preg_match('/^(\d*)\.(\d*)/', $this->eda->sql($sql, 'getone'), $versions); @@ -128,46 +132,6 @@ class endpointmanager { $this->tpl->assign("amp_ver", $this->global_cfg['amp_ver']['minor']); } - /** - * @author http://www.php.net/manual/en/function.socket-create.php#43057 - * @param type $host - * @param type $filename - * @return type - */ - function tftp_fetch($host, $filename) { - //first off let's check if this is installed or disabled - $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); - - // create the request packet - $packet = chr(0) . chr(1) . $filename . chr(0) . 'octet' . chr(0); - // UDP is connectionless, so we just send on it. - socket_sendto($socket, $packet, strlen($packet), 0x100, $host, 69); - - $buffer = ''; - $port = ''; - $ret = ''; - $time = time(); - do { - $new_time = time() - $time; - if ($new_time > 5) { - break; - } - // $buffer and $port both come back with information for the ack - // 516 = 4 bytes for the header + 512 bytes of data - socket_recvfrom($socket, $buffer, 516, 0, $host, $port); - - // add the block number from the data packet to the ack packet - $packet = chr(0) . chr(4) . substr($buffer, 2, 2); - // send ack - socket_sendto($socket, $packet, strlen($packet), 0, $host, $port); - - // append the data to the return variable - // for large files this function should take a file handle as an arg - $ret .= substr($buffer, 4); - } while (strlen($buffer) == 516); // the first non-full packet is the last. - return $ret; - } - function tftp_check() { //create a simple block here incase people have strange issues going on as we will kill http //by running this if the server isn't really running! @@ -179,7 +143,7 @@ class endpointmanager { if (preg_match('/:69\s/i', $subject)) { $rand = md5(rand(10, 2000)); if (file_put_contents($this->global_cfg['config_location'] . 'TEST', $rand)) { - if ($this->tftp_fetch('127.0.0.1', 'TEST') != $rand) { + if ($this->system->tftp_fetch('127.0.0.1', 'TEST') != $rand) { $this->error['tftp_check'] = 'Local TFTP Server is not correctly configured'; } unlink($this->global_cfg['config_location'] . 'TEST'); @@ -207,6 +171,11 @@ class endpointmanager { } } + /** + * Fixes the display are special strings so we can visible see them instead of them being transformed + * @param string $contents a string of course + * @return string fixed string + */ function display_htmlspecialchars($contents) { $contents = str_replace("&", "&amp;", $contents); $contents = str_replace("<", "&lt;", $contents); @@ -2092,6 +2061,10 @@ class endpointmanager { function download_brand($id) { if (!$this->global_cfg['use_repo']) { $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + if (!file_exists($temp_directory)) { + echo "Creating EPM temp directory
      "; + mkdir($temp_directory); + } $row = $this->eda->sql('SELECT * FROM endpointman_brand_list WHERE id =' . $id, 'getAll', DB_FETCHMODE_ASSOC); echo "Downloading Brand JSON....."; $result = $this->download_file(UPDATE_PATH . $row[0]['directory'] . "/" . $row[0]['directory'] . ".json", PHONE_MODULES_PATH . "endpoint/" . $row[0]['directory'] . "/brand_data.json"); @@ -2140,7 +2113,9 @@ class endpointmanager { * Still needs way to determine when models move...perhaps another function? */ function update_brand($package, $remote=TRUE) { - $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + if ($this->global_cfg['debug']) echo "update_brand(): Debug is set to ".$this->global_cfg['debug']."
      "; + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + if ($this->global_cfg['debug']) echo "Processing ".$temp_directory.$package."/brand_data.json...
      "; if (file_exists($temp_directory . $package . '/brand_data.json')) { $temp = $this->file2json($temp_directory . $package . '/brand_data.json'); if (key_exists('directory', $temp['data']['brands'])) { @@ -2153,7 +2128,7 @@ class endpointmanager { $brand_version = $temp['data']['brands']['last_modified']; //create directory structure and move files - echo "Creating Directory Structure/Moving Files.."; + echo "Creating Directory Structure for Brand '".$brand_name."' and Moving Files .."; if (!file_exists(PHONE_MODULES_PATH . "endpoint/" . $directory)) { mkdir(PHONE_MODULES_PATH . "endpoint/" . $directory); @@ -2180,7 +2155,7 @@ class endpointmanager { } } } - echo "Done!
      "; + echo " Done!
      "; if ($remote) { $local = 0; @@ -2190,11 +2165,12 @@ class endpointmanager { $b_data = $this->eda->sql("SELECT id FROM endpointman_brand_list WHERE id = '" . $brand_id . "'", 'getOne'); if ($b_data) { - echo "Updating data.........."; + echo "Updating $brand_name brand data..........
      "; $sql = "UPDATE endpointman_brand_list SET local = '" . $local . "', name = '" . $brand_name . "', cfg_ver = '" . $brand_version . "', installed = 1, hidden = 0 WHERE id = " . $brand_id; $this->eda->sql($sql); } else { - $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '" . $local . "', '1')"; + echo "Inserting $brand_name brand data..........
      "; + $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '" . $local . "', '1')"; $this->eda->sql($sql); } @@ -2202,11 +2178,9 @@ class endpointmanager { foreach ($temp['data']['brands']['family_list'] as $family_list) { echo "Updating Family Lines.................
      "; - $last_mod = max($last_mod, $family_list['last_modified']); $family_line_xml = $this->file2json(PHONE_MODULES_PATH . '/endpoint/' . $directory . '/' . $family_list['directory'] . '/family_data.json'); - $family_line_xml['data']['last_modified'] = isset($family_line_xml['data']['last_modified']) ? $family_line_xml['data']['last_modified'] : ''; $require_firmware = NULL; @@ -2217,9 +2191,11 @@ class endpointmanager { $data = $this->eda->sql("SELECT id FROM endpointman_product_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . "'", 'getOne'); $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); - if ($data) { + if ($data) { + if ($this->global_cfg['debug']) echo "-Updating Family ".$short_name."
      "; $sql = "UPDATE endpointman_product_list SET short_name = '" . $short_name . "', long_name = '" . $family_line_xml['data']['name'] . "', cfg_ver = '" . $family_line_xml['data']['version'] . "', config_files='" . $family_line_xml['data']['configuration_files'] . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . "'"; } else { + if ($this->global_cfg['debug']) echo "-Inserting Family ".$short_name."
      "; $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . $short_name . "', '" . $family_line_xml['data']['name'] . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['last_modified'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')"; } @@ -2326,8 +2302,10 @@ class endpointmanager { $m_data = $this->eda->sql("SELECT id FROM endpointman_model_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'", 'getone'); if ($m_data) { + if ($this->global_cfg['debug']) echo "---Updating Model ".$model_list['model']."
      "; $sql = "UPDATE endpointman_model_list SET max_lines = '" . $model_list['lines'] . "', model = '" . $model_list['model'] . "', template_list = '" . $template_list . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'"; } else { + if ($this->global_cfg['debug']) echo "---Inserting Model ".$model_list['model']."
      "; $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "', '" . $brand_id . "', '" . $model_list['model'] . "', '" . $model_list['lines'] . "', '" . $brand_id . $family_line_xml['data']['id'] . "', '" . $template_list . "', '0', '0')"; } $this->eda->sql($sql); @@ -2359,6 +2337,10 @@ class endpointmanager { } } + if ($this->global_cfg['debug']) { + echo "Done!
      "; + echo "Updating OUI list in DB
      "; + } foreach ($temp['data']['brands']['oui_list'] as $oui) { $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('" . $oui . "', '" . $brand_id . "', '0')"; $this->eda->sql($sql); @@ -2366,7 +2348,7 @@ class endpointmanager { echo "Done!
      "; } else { - echo "Invalid XML Structure
      "; + echo "Invalid JSON Structure in $temp_directory$package/brand_data.json
      "; } } else { echo "No 'brand_data.xml' file exists!
      "; @@ -2597,6 +2579,7 @@ class endpointmanager { * @param bool $Strict * @param array $Path * @return array + * @package epm_system */ function arraysearchrecursive($Needle, $Haystack, $NeedleKey="", $Strict=false, $Path=array()) { if (!is_array($Haystack)) @@ -2617,19 +2600,37 @@ class endpointmanager { return false; } + /** + * Send process to run in background + * @version 2.11 + * @param string $command the command to run + * @param integer $Priority the Priority of the command to run + * @return int $PID process id + * @package epm_system + */ function run_in_background($Command, $Priority = 0) { - if ($Priority) - $PID = shell_exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!"); - else - $PID = shell_exec("nohup $Command > /dev/null 2> /dev/null & echo $!"); - return($PID); + return($Priority ? shell_exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!") : shell_exec("nohup $Command > /dev/null 2> /dev/null & echo $!")); } + /** + * Check if process is running in background + * @version 2.11 + * @param string $PID proccess ID + * @return bool true or false + * @package epm_system + */ function is_process_running($PID) { exec("ps $PID", $ProcessState); return(count($ProcessState) >= 2); } + /** + * Downloads a file and places it in the destination defined with progress + * @version 2.11 + * @param string $url_file URL of File + * @param string $destination_file Destination of file + * @package epm_system + */ function download_file_with_progress_bar($url_file, $destination_file) { set_time_limit(0); $headers = get_headers($url_file, 1); @@ -2654,10 +2655,27 @@ class endpointmanager { } } + /** + * Downloads a file and places it in the destination defined + * @version 2.11 + * @param string $url_file URL of File + * @param string $destination_file Destination of file + * @package epm_system + */ function download_file($url_file, $destination_file) { - $contents = file_get_contents($url_file); - - if (preg_match('/200/', $http_response_header[0])) { + //Determine if file_get_contents_url exists which is the default FreePBX Standard for downloading straight files + if(function_exists('file_get_contents_url')) { + $contents = file_get_contents_url($url_file); + } else { + //I really hope we NEVER get here. + $contents = file_get_contents($url_file); + if (!preg_match('/200/', $http_response_header[0])) { + $this->error['download_file'] = "Unknown Error in Download_file"; + return false; + } + } + //If contents are emtpy then we failed. Or something is wrong + if(!empty($contents)) { $dirname = dirname($destination_file); if (!file_exists($dirname)) { mkdir($dirname); @@ -2674,30 +2692,27 @@ class endpointmanager { } return true; } else { - $this->error['download_file'] = "Server Replied with error '" . $http_response_header[0] . "'. Unable to download files"; + $this->error['download_file'] = "Contents of Remote file are blank! URL:".$url_file; return false; } } - //This function looks in common linux directories for system executable files. Like ARP & NMAP + /** + * Uses which to find executables that asterisk can run/use + * @version 2.11 + * @param string $exec Executable to find + * @package epm_system + */ function find_exec($exec) { - $usr_bin = glob("/usr/bin/" . $exec); - $usr_sbin = glob("/usr/sbin/" . $exec); - $sbin = glob("/sbin/" . $exec); - $bin = glob("/bin/" . $exec); - $etc = glob("/etc/" . $exec); - if (isset($usr_bin[0])) { - return("/usr/bin/" . $exec); - } elseif (isset($usr_sbin[0])) { - return("/usr/sbin/" . $exec); - } elseif (isset($sbin[0])) { - return("/sbin/" . $exec); - } elseif (isset($bin[0])) { - return("/bin/" . $exec); - } elseif (isset($etc[0])) { - return("/etc/" . $exec); + $o = exec('which '.$exec); + if($o) { + if(file_exists($o) && is_executable($o)) { + return($o); + } else { + return(''); + } } else { - return($exec); + return(''); } } @@ -2706,6 +2721,8 @@ class endpointmanager { * Using RecursiveIteratorIterator is the only way PHP is able to see hidden files. * @author http://www.webcheatsheet.com/PHP/working_with_directories.php * @param string $dir Full Directory path to delete + * @version 2.11 + * @package epm_system */ function rmrf($dir) { if (file_exists($dir)) { @@ -2724,14 +2741,13 @@ class endpointmanager { /** * Only used once in all of Endpoint Manager to determine if a table exists - * @param $table - * @return + * @param string $table Table to look for + * @return bool */ function table_exists($table) { global $amp_conf; $sql = "SHOW TABLES FROM " . $amp_conf['AMPDBNAME']; $result = $this->eda->sql($sql, 'getAll'); - foreach ($result as $row) { if ($row[0] == $table) { return TRUE; @@ -2740,13 +2756,46 @@ class endpointmanager { return FALSE; } + /** + * Reads a file. Json decodes it and will report any errors back + * @param string $file location of file + * @return mixed false on error, array on success + * @version 2.11 + */ function file2json($file) { if (file_exists($file)) { $json = file_get_contents($file); $data = json_decode($json, TRUE); - return($data); + if(function_exists('json_last_error')) { + switch (json_last_error()) { + case JSON_ERROR_NONE: + return($data); + break; + case JSON_ERROR_DEPTH: + $this->error['file2json'] = 'Maximum stack depth exceeded'; + break; + case JSON_ERROR_STATE_MISMATCH: + $this->error['file2json'] = 'Underflow or the modes mismatch'; + break; + case JSON_ERROR_CTRL_CHAR: + $this->error['file2json'] = 'Unexpected control character found'; + break; + case JSON_ERROR_SYNTAX: + $this->error['file2json'] = 'Syntax error, malformed JSON'; + break; + case JSON_ERROR_UTF8: + $this->error['file2json'] = 'Malformed UTF-8 characters, possibly incorrectly encoded'; + break; + default: + $this->error['file2json'] = 'Unknown error'; + break; + } + return(false); + } else { + return($data); + } } else { - return(array()); + return(false); } } @@ -2766,7 +2815,7 @@ class endpointmanager { "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f]/i", $mac)) { return(strtoupper(str_replace(":", "", str_replace("-", "", $mac)))); - //Is the string exactly 12 characters? + //Is the string exactly 12 characters? } elseif (strlen($mac) == "12") { //Now is the string a valid HEX mac address? if (preg_match("/[0-9a-f][0-9a-f]" . @@ -2779,7 +2828,7 @@ class endpointmanager { } else { return(FALSE); } - //Is the mac separated by whitespaces? + //Is the mac separated by whitespaces? } elseif (preg_match("/[0-9a-f][0-9a-f][\s]" . "[0-9a-f][0-9a-f][\s]" . "[0-9a-f][0-9a-f][\s]" . @@ -2799,13 +2848,10 @@ class endpointmanager { * Check for valid netmast to avoid security issues * @param string $mask the complete netmask, eg [1.1.1.1/24] * @return boolean True if valid, False if not + * @version 2.11 */ function validate_netmask($mask) { - if (preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/", $mask)) { - return(TRUE); - } else { - return(FALSE); - } + return preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/", $mask) ? TRUE : FALSE; } /** @@ -2813,14 +2859,16 @@ class endpointmanager { * nmap will actually discover 'unseen' devices that the VoIP server hasn't heard from * If the user just wishes to use the local arp cache they can tell the function to not use nmap * This results in a speed increase from 60 seconds to less than one second. - * @author tm1000 - * @version 1.5 + * + * This is the original function that started it all + * http://www.pbxinaflash.com/community/index.php?threads/end-point-configuration-manager-module-for-freepbx-part-1.4514/page-4#post-37671 + * + * @version 2.11 * @param mixed $netmask The netmask, eg [1.1.1.1/24] * @param boolean $use_nmap True use nmap, false don't use it * @return array List of devices found on the network */ function discover_new($netmask, $use_nmap=TRUE) { - if (($use_nmap) AND (file_exists($this->global_cfg['nmap_location'])) AND ($this->validate_netmask($netmask))) { shell_exec($this->global_cfg['nmap_location'] . ' -v -sP ' . $netmask); } elseif (!$this->validate_netmask($netmask)) { @@ -2836,7 +2884,6 @@ class endpointmanager { //Throw arp list into an array, break by new lines $arp_array = explode("\n", $arp_list); - //Find all references to active computers by searching out mac addresses. $temp = array_values(array_unique(preg_grep("/[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . @@ -2884,27 +2931,15 @@ class endpointmanager { $epm_row = $this->eda->sql($epm_sql, 'getRow', DB_FETCHMODE_ASSOC); $res = $this->eda->sql($epm_sql); - $epm_count = $res->numRows(); - if ($epm_count) { - $epm = TRUE; - } else { - $epm = FALSE; - } + $epm = $res->numRows() ? TRUE : FALSE; //Add into a final array $final[$z] = array("ip" => $ip, "mac" => $mac, "mac_strip" => $mac_strip, "oui" => $oui, "brand" => $brand['name'], "brand_id" => $brand['id'], "endpoint_managed" => $epm); $z++; } } - - //$final = array_values($final); - - if (!is_array($final)) { - return(FALSE); - } else { - return ($final); - } + return !is_array($final) ? FALSE : $final; } function areaAvailable($model, $area=NULL) { @@ -3191,4 +3226,4 @@ function endpointmanager_read_body($ch, $string) { //ob_flush(); endpointman_flush_buffers(); return $length; -} \ No newline at end of file +} diff --git a/includes/installer.inc b/includes/installer.inc index abf85376..d96ace77 100644 --- a/includes/installer.inc +++ b/includes/installer.inc @@ -81,25 +81,40 @@ if($_REQUEST['type'] == "brand") { } break; case "upload_brand": + if ($endpoint->global_cfg['debug']) echo "upload_brand(): Debug is set to ". $endpoint->global_cfg['debug'] ."
      "; +// Bramd file (*.tgz) will have been copied into the location under which all endpoint definitions reside + /temp/ if (file_exists(PHONE_MODULES_PATH."temp/".$_REQUEST['package'])) { - echo "Extracting Tarball........"; - exec("tar -xvf ".PHONE_MODULES_PATH.'temp/'. $_REQUEST['package'] ." -C ".PHONE_MODULES_PATH."temp/"); +// The untarred brand file will go into /tmp (or wherever the "temporary" location the OS tells us) + /epm-temp/ + $temp_directory = sys_get_temp_dir() . "/epm_temp/"; + if (!file_exists($temp_directory)) { + echo "Creating EPM temp directory
      "; + mkdir($temp_directory); + } + if ($endpoint->global_cfg['debug']) { + echo "Extracting Tarball ".PHONE_MODULES_PATH.'temp/'. $_REQUEST['package']." to ".$temp_directory." ........"; + } else { + echo "Extracting Tarball........ "; + } + exec("tar -xvf ".PHONE_MODULES_PATH.'temp/'. $_REQUEST['package'] ." -C ".$temp_directory); echo "Done!
      "; - $package = basename($_REQUEST['package'], ".tgz"); + $package = basename($_REQUEST['package'], ".tgz"); $package = explode("-",$package); - if(file_exists(PHONE_MODULES_PATH."temp/".$package[0])) { - $endpoint->update_brand($package[0],FALSE); - unlink(PHONE_MODULES_PATH.'temp/'. $_REQUEST['package']); + if ($endpoint->global_cfg['debug']) echo "Looking for file ".$temp_directory.$package[0]." to pass on to update_brand()
      "; + if(file_exists($temp_directory.$package[0])) { + $endpoint->update_brand($package[0],FALSE); +// Note: no need to delete/unlink/rmdir as this is handled in update_brand() } else { - echo "Please name the Package the same name as your brand!"; + echo "Please name the Package the same name as your brand!
      "; } } else { +// Did not find the .tgz file $endpoint->error['upload'] = "No File Provided"; + echo "File ".PHONE_MODULES_PATH."temp/".$_REQUEST['package']." not found.
      "; } break; } } -echo "
      \n\t"._("Return").""; \ No newline at end of file +echo "
      \n\t"._("Return").""; diff --git a/includes/popup.inc b/includes/popup.inc index bd27c5d3..269039c2 100644 --- a/includes/popup.inc +++ b/includes/popup.inc @@ -431,7 +431,7 @@ if($_REQUEST['pop_type'] == "alt_cfg_edit") { $template_file_list[0]['value'] = "template_data_custom.xml"; $template_file_list[0]['text'] = "template_data_custom.xml"; - $sql = 'SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE CONVERT(_utf8 \'1-2\' USING latin1) COLLATE latin1_swedish_ci AND `enabled` = 1 AND `hidden` = 0'; + $sql = "SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE '1-2' AND `enabled` = 1 AND `hidden` = 0"; $data =& $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 1; foreach($data as $list) { diff --git a/includes/system_functions.class b/includes/system_functions.class new file mode 100644 index 00000000..c95d6bb5 --- /dev/null +++ b/includes/system_functions.class @@ -0,0 +1,231 @@ + 5) { + break; + } + // $buffer and $port both come back with information for the ack + // 516 = 4 bytes for the header + 512 bytes of data + socket_recvfrom($socket, $buffer, 516, 0, $host, $port); + + // add the block number from the data packet to the ack packet + $packet = chr(0) . chr(4) . substr($buffer, 2, 2); + // send ack + socket_sendto($socket, $packet, strlen($packet), 0, $host, $port); + + // append the data to the return variable + // for large files this function should take a file handle as an arg + $ret .= substr($buffer, 4); + } while (strlen($buffer) == 516); // the first non-full packet is the last. + return $ret; + } + + /** + * The RecursiveIteratorIterator must be told to provide children (files and subdirectories) before parents with its CHILD_FIRST constant. + * Using RecursiveIteratorIterator is the only way PHP is able to see hidden files. + * @author http://www.webcheatsheet.com/PHP/working_with_directories.php + * @param string $dir Full Directory path to delete + * @version 2.11 + */ + function rmrf($dir) { + if (file_exists($dir)) { + $iterator = new RecursiveDirectoryIterator($dir); + foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) { + if ($file->isDir()) { + @rmdir($file->getPathname()); + } else { + @unlink($file->getPathname()); + } + } + //Remove parent path as the last step + @rmdir($dir); + } + } + + /** + * Uses which to find executables that asterisk can run/use + * @version 2.11 + * @param string $exec Executable to find + * @package epm_system + */ + function find_exec($exec) { + $o = exec('which '.$exec); + if($o) { + if(file_exists($o) && is_executable($o)) { + return($o); + } else { + return(''); + } + } else { + return(''); + } + } + + /** + * Downloads a file and places it in the destination defined + * @version 2.11 + * @param string $url_file URL of File + * @param string $destination_file Destination of file + * @package epm_system + */ + function download_file($url_file, $destination_file) { + //Determine if file_get_contents_url exists which is the default FreePBX Standard for downloading straight files + if(function_exists('file_get_contents_url')) { + $contents = file_get_contents_url($url_file); + } else { + //I really hope we NEVER get here. + $contents = file_get_contents($url_file); + if (!preg_match('/200/', $http_response_header[0])) { + $this->error['download_file'] = "Unknown Error in Download_file"; + return false; + } + } + //If contents are emtpy then we failed. Or something is wrong + if(!empty($contents)) { + $dirname = dirname($destination_file); + if (!file_exists($dirname)) { + mkdir($dirname); + } + if (!is_writable($dirname)) { + $this->error['download_file'] = "Directory '" . $dirname . "' is not writable! Unable to download files"; + return false; + } + file_put_contents($destination_file, $contents); + //check file placement + if (!file_exists($destination_file)) { + $this->error['download_file'] = "File Doesn't Exist in '" . $dirname . "'. Unable to download files"; + return false; + } + return true; + } else { + $this->error['download_file'] = "Contents of Remote file are blank! URL:".$url_file; + return false; + } + } + + /** + * Downloads a file and places it in the destination defined with progress + * @version 2.11 + * @param string $url_file URL of File + * @param string $destination_file Destination of file + * @package epm_system + */ + function download_file_with_progress_bar($url_file, $destination_file) { + set_time_limit(0); + $headers = get_headers($url_file, 1); + $size = $headers['Content-Length']; + + if (preg_match('/200/', $headers[0])) { + $pid = $this->run_in_background("wget " . $url_file . " -O " . $destination_file); + + while ($this->is_process_running($pid)) { + + $out = 100 * round(filesize($destination_file) / $size, 2); + echo ''; + + usleep('500'); + ob_end_flush(); + //ob_flush(); + flush(); + ob_start(); + + + clearstatcache(); // make sure PHP actually checks dest. file size + } + return true; + } else { + return false; + } + } + + /** + * Taken from http://www.php.net/manual/en/function.array-search.php#69232 + * search haystack for needle and return an array of the key path, FALSE otherwise. + * if NeedleKey is given, return only for this key mixed ArraySearchRecursive(mixed Needle,array Haystack[,NeedleKey[,bool Strict[,array Path]]]) + * @author ob (at) babcom (dot) biz + * @param mixed $Needle + * @param array $Haystack + * @param mixed $NeedleKey + * @param bool $Strict + * @param array $Path + * @return array + * @package epm_system + */ + function arraysearchrecursive($Needle, $Haystack, $NeedleKey="", $Strict=false, $Path=array()) { + if (!is_array($Haystack)) + return false; + foreach ($Haystack as $Key => $Val) { + if (is_array($Val) && + $SubPath = $this->arraysearchrecursive($Needle, $Val, $NeedleKey, $Strict, $Path)) { + $Path = array_merge($Path, Array($Key), $SubPath); + return $Path; + } elseif ((!$Strict && $Val == $Needle && + $Key == (strlen($NeedleKey) > 0 ? $NeedleKey : $Key)) || + ($Strict && $Val === $Needle && + $Key == (strlen($NeedleKey) > 0 ? $NeedleKey : $Key))) { + $Path[] = $Key; + return $Path; + } + } + return false; + } + + /** + * Send process to run in background + * @version 2.11 + * @param string $command the command to run + * @param integer $Priority the Priority of the command to run + * @return int $PID process id + * @package epm_system + */ + function run_in_background($Command, $Priority = 0) { + return($Priority ? shell_exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!") : shell_exec("nohup $Command > /dev/null 2> /dev/null & echo $!")); + } + + /** + * Check if process is running in background + * @version 2.11 + * @param string $PID proccess ID + * @return bool true or false + * @package epm_system + */ + function is_process_running($PID) { + exec("ps $PID", $ProcessState); + return(count($ProcessState) >= 2); + } +} \ No newline at end of file diff --git a/install.php b/install.php index 50caf781..d8707579 100644 --- a/install.php +++ b/install.php @@ -106,7 +106,7 @@ function ep_table_exists($table) { $version['major'] = $versions[1]; $version['minor'] = $versions[2]; -$sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; +$sql = "SELECT value FROM `admin` WHERE `variable` LIKE 'version'"; preg_match('/^(\d*)\.(\d*)/', $db->getOne($sql), $versions); $amp_version['minor'] = $versions[2]; diff --git a/module.xml b/module.xml index b4256774..cab27d52 100644 --- a/module.xml +++ b/module.xml @@ -1,30 +1,33 @@ endpointman standard - PBX End Point Manager - 2.10.4.6 + OSS PBX End Point Manager + 2.11.4.8 setup Connectivity Andrew Nagy MPLv1.1 - End Point Device List - End Point Template Manager - End Point Configuration - End Point Advanced Settings + OSS Endpoint Device List + OSS Endpoint Template Manager + OSS Endpoint Configuration + OSS Endpoint Advanced Settings - PBX End Point Manager supports automated deployment of multiple manufacturers IP telephones. + + OSS PBX End Point Manager is the free supported PBX Endpoint Manager for FreePBX. + It is NOT to be confused with the commercial version called 'endpoint'. + The main differences between the two versions is that the developer of Commercial Endpoint works 30 hours a week paid by Schmoozecom to work on it. + *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager - release/2.11/endpointman-2.10.4.6.tgz + release/2.11/endpointman-2.11.0.1.tgz - 2.6 + 2.10 - core fw_ari -819f0db9675a0fcfd7f92fe25dac8cbd +2832e12476c29c6a72c85225fb7ad143 diff --git a/provisioning/p.php b/provisioning/p.php index 422814ad..87a004d7 100644 --- a/provisioning/p.php +++ b/provisioning/p.php @@ -68,7 +68,7 @@ if(preg_match('/[0-9A-Fa-f]{12}/i', $strip, $matches) && !(preg_match('/[0]{10}[0-9]{2}/i',$strip))) { $mac_address = $matches[0]; - $sql = 'SELECT id FROM `endpointman_mac_list` WHERE `mac` LIKE CONVERT(_utf8 \'%' . $mac_address . '%\' USING latin1) COLLATE latin1_swedish_ci'; + $sql = "SELECT id FROM `endpointman_mac_list` WHERE `mac` LIKE '%" . $mac_address . "%'"; $mac_id = $endpoint->eda->sql($sql, 'getOne'); $phone_info = $endpoint->get_phone_info($mac_id); diff --git a/uninstall.php b/uninstall.php index c6c41c47..4fd362d3 100644 --- a/uninstall.php +++ b/uninstall.php @@ -61,7 +61,7 @@ function outn($text) { $sql = "DROP TABLE `endpointman_custom_configs`"; $result = $db->query($sql); -$sql = 'SELECT value FROM `admin` WHERE `variable` LIKE CONVERT(_utf8 \'version\' USING latin1) COLLATE latin1_swedish_ci'; +$sql = "SELECT value FROM `admin` WHERE `variable` LIKE 'version'"; $amp_version = $db->getOne($sql); //Do unlinks ourself because retrieve_conf doesn't always remove stuff... From da8db339f9790c8906ac13b9130f71d4a7fdb7bc Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Wed, 16 Jan 2013 08:49:20 +0000 Subject: [PATCH 315/623] [Module package script: endpointman 2.11.4.8] --- module.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module.xml b/module.xml index cab27d52..f1fa4e33 100644 --- a/module.xml +++ b/module.xml @@ -22,12 +22,12 @@ *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager - release/2.11/endpointman-2.11.0.1.tgz + release/2.11/endpointman-2.11.4.8.tgz 2.10 fw_ari -2832e12476c29c6a72c85225fb7ad143 +e2f328eb2946e2baeb4fa8304379d9f0
      From f97cf2f66d8151c09b27dd99138bc9847910db8e Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Wed, 30 Jan 2013 23:17:46 -0800 Subject: [PATCH 316/623] Fix stupid requirement of PHP 5.3 --- config.php | 21 ------- emportal | 132 ----------------------------------------- includes/functions.inc | 2 + module.xml | 8 ++- 4 files changed, 7 insertions(+), 156 deletions(-) delete mode 100644 emportal diff --git a/config.php b/config.php index c828e4d3..a8d7d40a 100644 --- a/config.php +++ b/config.php @@ -1,5 +1,4 @@ fg_color("bold_red", "Sorry FreePBX 2.9+ is required\n")); -} - -require_once 'includes/functions.inc'; -if(!include_once 'Console/Getopt.php') { - die($colors->fg_color("bold_red", "Pear Console_Getopt Required\nTry to run 'pear install Console_Getopt'")); -} - -$debug = NULL; -$endpoint = new endpointmanager(); -echo $colors->fg_color("bold_red", "Endpoint Manager CLI\n\n"); - -$cg = new Console_Getopt(); -$args = $cg->readPHPArgv(); -array_shift($args); - -$shortOpts = 'h::'; -$longOpts = array('user=', 'group='); - -$params = $cg->getopt2($args, $shortOpts, $longOpts); - -print_r(condense_arguments($params)); - - -echo "\n"; - -if (PEAR::isError($params)) { - echo 'Error: ' . $params->getMessage() . "\n"; - exit(1); -} - -function &condense_arguments($params) -{ - $new_params = array(); - foreach ($params[0] as $param) { - $new_params[$param[0]] = $param[1]; - } - return $new_params; -} - -/** - * Color escapes for bash output - */ -class Escape_Colors -{ - private static $foreground = array( - 'black' => '0;30', - 'dark_gray' => '1;30', - 'red' => '0;31', - 'bold_red' => '1;31', - 'green' => '0;32', - 'bold_green' => '1;32', - 'brown' => '0;33', - 'yellow' => '1;33', - 'blue' => '0;34', - 'bold_blue' => '1;34', - 'purple' => '0;35', - 'bold_purple' => '1;35', - 'cyan' => '0;36', - 'bold_cyan' => '1;36', - 'white' => '1;37', - 'bold_gray' => '0;37', - ); - - private static $background = array( - 'black' => '40', - 'red' => '41', - 'magenta' => '45', - 'yellow' => '43', - 'green' => '42', - 'blue' => '44', - 'cyan' => '46', - 'light_gray' => '47', - ); - - /** - * Make string appear in color - */ - public static function fg_color($color, $string) - { - if (!isset(self::$foreground[$color])) - { - throw new Exception('Foreground color is not defined'); - } - - return "\033[" . self::$foreground[$color] . "m" . $string . "\033[0m"; - } - - /** - * Make string appear with background color - */ - public static function bg_color($color, $string) - { - if (!isset(self::$background[$color])) - { - throw new Exception('Background color is not defined'); - } - - return "\033[" . self::$background[$color] . 'm' . $string . "\033[0m"; - } - - /** - * See what they all look like - */ - public static function all_fg() - { - foreach (self::$foreground as $color => $code) - { - echo "$color - " . self::fg_color($color, 'Hello, world!') . PHP_EOL; - } - } - - /** - * See what they all look like - */ - public static function all_bg() - { - foreach (self::$background as $color => $code) - { - echo "$color - " . self::bg_color($color, 'Hello, world!') . PHP_EOL; - } - } -} diff --git a/includes/functions.inc b/includes/functions.inc index 65b7291e..59ca37f3 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -2792,9 +2792,11 @@ class endpointmanager { } return(false); } else { + //Probably an older version of PHP. That's ok though return($data); } } else { + $this->error['file2json'] = 'Cant find file: '.$file ; return(false); } } diff --git a/module.xml b/module.xml index cab27d52..7d47bc23 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard OSS PBX End Point Manager - 2.11.4.8 + 2.11.4.9 setup Connectivity Andrew Nagy @@ -19,8 +19,9 @@ The main differences between the two versions is that the developer of Commercial Endpoint works 30 hours a week paid by Schmoozecom to work on it. - *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master - + *2.11.4.9* Fix a stupid error on my part with requiring php 5.3 SORRY! :-( + *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master + https://github.com/tm1000/freepbx-endpointmanager release/2.11/endpointman-2.11.0.1.tgz @@ -28,6 +29,7 @@ fw_ari + 5.1.0 2832e12476c29c6a72c85225fb7ad143 From 715289b3a6317f773bd77db402484f12cee84fc6 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 31 Jan 2013 07:23:55 +0000 Subject: [PATCH 317/623] Fixes to stupid PHP 5.3 requirement --- config.php | 21 --------------------- includes/functions.inc | 2 ++ module.xml | 12 +++++++----- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/config.php b/config.php index c828e4d3..a8d7d40a 100644 --- a/config.php +++ b/config.php @@ -1,5 +1,4 @@ error['file2json'] = 'Cant find file: '.$file ; return(false); } } diff --git a/module.xml b/module.xml index f1fa4e33..7d47bc23 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard OSS PBX End Point Manager - 2.11.4.8 + 2.11.4.9 setup Connectivity Andrew Nagy @@ -19,15 +19,17 @@ The main differences between the two versions is that the developer of Commercial Endpoint works 30 hours a week paid by Schmoozecom to work on it. - *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master - + *2.11.4.9* Fix a stupid error on my part with requiring php 5.3 SORRY! :-( + *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master + https://github.com/tm1000/freepbx-endpointmanager - release/2.11/endpointman-2.11.4.8.tgz + release/2.11/endpointman-2.11.0.1.tgz 2.10 fw_ari + 5.1.0 -e2f328eb2946e2baeb4fa8304379d9f0 +2832e12476c29c6a72c85225fb7ad143 From 5754a911f8be4cf852c8d486f4508ccf1db349a6 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 31 Jan 2013 07:24:35 +0000 Subject: [PATCH 318/623] [Module package script: endpointman 2.11.4.9] --- module.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module.xml b/module.xml index 7d47bc23..4a383f17 100644 --- a/module.xml +++ b/module.xml @@ -23,7 +23,7 @@ *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager - release/2.11/endpointman-2.11.0.1.tgz + release/2.11/endpointman-2.11.4.9.tgz 2.10 @@ -31,5 +31,5 @@ fw_ari 5.1.0 -2832e12476c29c6a72c85225fb7ad143 +ca102c2a63a441f9ae5fd9a532aa3bca From 2c2fa4a437f3462499e9b6982d1f9666ce1f0302 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Mon, 18 Mar 2013 14:09:07 -0700 Subject: [PATCH 319/623] Fix to sql error --- includes/functions.inc | 2 +- module.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 59ca37f3..5ad3500c 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -658,7 +658,7 @@ class endpointmanager { $phone_info['line'][$line['line']]['user_extension'] = $line['user']; } } else { - $sql = "SELECT id, mac, ext FROM endpointman_mac_list WHERE id =" . $mac_id; + $sql = "SELECT id, mac FROM endpointman_mac_list WHERE id =" . $mac_id; //Phone is unknown, we need to display this to the end user so that they can make corrections $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); diff --git a/module.xml b/module.xml index 7d47bc23..2bb319b1 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard OSS PBX End Point Manager - 2.11.4.9 + 2.11.4.10 setup Connectivity Andrew Nagy @@ -19,6 +19,7 @@ The main differences between the two versions is that the developer of Commercial Endpoint works 30 hours a week paid by Schmoozecom to work on it. + *2.11.4.10* Fixes #6428 *2.11.4.9* Fix a stupid error on my part with requiring php 5.3 SORRY! :-( *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master From aaf853f5cb9c1b637695f84dd506090131d447fc Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Mon, 18 Mar 2013 23:57:19 +0000 Subject: [PATCH 320/623] Fixes #6428 --- includes/functions.inc | 2 +- module.xml | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 59ca37f3..5ad3500c 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -658,7 +658,7 @@ class endpointmanager { $phone_info['line'][$line['line']]['user_extension'] = $line['user']; } } else { - $sql = "SELECT id, mac, ext FROM endpointman_mac_list WHERE id =" . $mac_id; + $sql = "SELECT id, mac FROM endpointman_mac_list WHERE id =" . $mac_id; //Phone is unknown, we need to display this to the end user so that they can make corrections $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); diff --git a/module.xml b/module.xml index 4a383f17..2bb319b1 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard OSS PBX End Point Manager - 2.11.4.9 + 2.11.4.10 setup Connectivity Andrew Nagy @@ -19,11 +19,12 @@ The main differences between the two versions is that the developer of Commercial Endpoint works 30 hours a week paid by Schmoozecom to work on it. + *2.11.4.10* Fixes #6428 *2.11.4.9* Fix a stupid error on my part with requiring php 5.3 SORRY! :-( *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager - release/2.11/endpointman-2.11.4.9.tgz + release/2.11/endpointman-2.11.0.1.tgz 2.10 @@ -31,5 +32,5 @@ fw_ari 5.1.0 -ca102c2a63a441f9ae5fd9a532aa3bca +2832e12476c29c6a72c85225fb7ad143 From e8f5a291d1efdbdc2882fd5616c65cd4c5cd0607 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 19 Mar 2013 00:01:59 +0000 Subject: [PATCH 321/623] [Module package script: endpointman 2.11.4.10] --- module.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module.xml b/module.xml index 2bb319b1..c414f28d 100644 --- a/module.xml +++ b/module.xml @@ -24,7 +24,7 @@ *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager - release/2.11/endpointman-2.11.0.1.tgz + release/2.11/endpointman-2.11.4.10.tgz 2.10 @@ -32,5 +32,5 @@ fw_ari 5.1.0 -2832e12476c29c6a72c85225fb7ad143 +7c15f189cbdc170f1a9c873a25fcac09 From 71344173c5692a3349a6e824dbc0b50ba44a1bcc Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 19 Mar 2013 01:34:50 -0700 Subject: [PATCH 322/623] Fatal SQL error - Device cfg submit with apostrophe in extn text description --- includes/devices_manager.inc | 8 ++++---- module.xml | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc index 4e949e41..e4a412ef 100644 --- a/includes/devices_manager.inc +++ b/includes/devices_manager.inc @@ -81,7 +81,7 @@ switch ($sub_type) { $sql = "SELECT description FROM devices WHERE id = ".$_REQUEST['ext_list_'.$row['luid']]; $name = $endpoint->eda->sql($sql,'getOne'); - $sql = "UPDATE endpointman_line_list SET line = '".$_REQUEST['line_list_'.$row['luid']]."', ext = '".$_REQUEST['ext_list_'.$row['luid']]."', description = '".$name."' WHERE luid = ". $row['luid']; + $sql = "UPDATE endpointman_line_list SET line = '".$_REQUEST['line_list_'.$row['luid']]."', ext = '".$_REQUEST['ext_list_'.$row['luid']]."', description = '".mysql_real_escape_string($name)."' WHERE luid = ". $row['luid']; $endpoint->eda->sql($sql); } @@ -166,7 +166,7 @@ switch ($sub_type) { foreach($mac_list as $data) { $phone_info = $endpoint->get_phone_info($data['id']); foreach($phone_info['line'] as $line) { - $sql = "UPDATE endpointman_line_list SET description = '".$line['description']."' WHERE luid = ".$line['luid']; + $sql = "UPDATE endpointman_line_list SET description = '".mysql_real_escape_string($line['description'])."' WHERE luid = ".$line['luid']; $endpoint->eda->sql($sql); } if(isset($_REQUEST['reboot'])) { @@ -321,7 +321,7 @@ switch ($sub_type) { $rebooted_msg = ""; } foreach($phone_info['line'] as $line) { - $sql = "UPDATE endpointman_line_list SET description = '".$line['description']."' WHERE luid = ".$line['luid']; + $sql = "UPDATE endpointman_line_list SET description = '".mysql_real_escape_string($line['description'])."' WHERE luid = ".$line['luid']; $endpoint->eda->sql($sql); } } @@ -348,7 +348,7 @@ switch ($sub_type) { $rebooted_msg = ""; } foreach($phone_info['line'] as $line) { - $sql = "UPDATE endpointman_line_list SET description = '".$line['description']."' WHERE luid = ".$line['luid']; + $sql = "UPDATE endpointman_line_list SET description = '".mysql_real_escape_string($line['description'])."' WHERE luid = ".$line['luid']; $endpoint->eda->sql($sql); } } diff --git a/module.xml b/module.xml index 2bb319b1..50ff6d06 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard OSS PBX End Point Manager - 2.11.4.10 + 2.11.4.11 setup Connectivity Andrew Nagy @@ -19,6 +19,7 @@ The main differences between the two versions is that the developer of Commercial Endpoint works 30 hours a week paid by Schmoozecom to work on it. + *2.11.4.11* Fixes #6426 (Fatal SQL error - Device cfg submit with apostrophe in extn text description) *2.11.4.10* Fixes #6428 *2.11.4.9* Fix a stupid error on my part with requiring php 5.3 SORRY! :-( *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master From f105bd21948bb5f0da690d792b1481e573a7a7ed Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 19 Mar 2013 08:36:51 +0000 Subject: [PATCH 323/623] Fixes #6426, sql error with apostrophes --- includes/devices_manager.inc | 8 ++++---- module.xml | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/includes/devices_manager.inc b/includes/devices_manager.inc index 4e949e41..e4a412ef 100644 --- a/includes/devices_manager.inc +++ b/includes/devices_manager.inc @@ -81,7 +81,7 @@ switch ($sub_type) { $sql = "SELECT description FROM devices WHERE id = ".$_REQUEST['ext_list_'.$row['luid']]; $name = $endpoint->eda->sql($sql,'getOne'); - $sql = "UPDATE endpointman_line_list SET line = '".$_REQUEST['line_list_'.$row['luid']]."', ext = '".$_REQUEST['ext_list_'.$row['luid']]."', description = '".$name."' WHERE luid = ". $row['luid']; + $sql = "UPDATE endpointman_line_list SET line = '".$_REQUEST['line_list_'.$row['luid']]."', ext = '".$_REQUEST['ext_list_'.$row['luid']]."', description = '".mysql_real_escape_string($name)."' WHERE luid = ". $row['luid']; $endpoint->eda->sql($sql); } @@ -166,7 +166,7 @@ switch ($sub_type) { foreach($mac_list as $data) { $phone_info = $endpoint->get_phone_info($data['id']); foreach($phone_info['line'] as $line) { - $sql = "UPDATE endpointman_line_list SET description = '".$line['description']."' WHERE luid = ".$line['luid']; + $sql = "UPDATE endpointman_line_list SET description = '".mysql_real_escape_string($line['description'])."' WHERE luid = ".$line['luid']; $endpoint->eda->sql($sql); } if(isset($_REQUEST['reboot'])) { @@ -321,7 +321,7 @@ switch ($sub_type) { $rebooted_msg = ""; } foreach($phone_info['line'] as $line) { - $sql = "UPDATE endpointman_line_list SET description = '".$line['description']."' WHERE luid = ".$line['luid']; + $sql = "UPDATE endpointman_line_list SET description = '".mysql_real_escape_string($line['description'])."' WHERE luid = ".$line['luid']; $endpoint->eda->sql($sql); } } @@ -348,7 +348,7 @@ switch ($sub_type) { $rebooted_msg = ""; } foreach($phone_info['line'] as $line) { - $sql = "UPDATE endpointman_line_list SET description = '".$line['description']."' WHERE luid = ".$line['luid']; + $sql = "UPDATE endpointman_line_list SET description = '".mysql_real_escape_string($line['description'])."' WHERE luid = ".$line['luid']; $endpoint->eda->sql($sql); } } diff --git a/module.xml b/module.xml index c414f28d..50ff6d06 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard OSS PBX End Point Manager - 2.11.4.10 + 2.11.4.11 setup Connectivity Andrew Nagy @@ -19,12 +19,13 @@ The main differences between the two versions is that the developer of Commercial Endpoint works 30 hours a week paid by Schmoozecom to work on it. + *2.11.4.11* Fixes #6426 (Fatal SQL error - Device cfg submit with apostrophe in extn text description) *2.11.4.10* Fixes #6428 *2.11.4.9* Fix a stupid error on my part with requiring php 5.3 SORRY! :-( *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager - release/2.11/endpointman-2.11.4.10.tgz + release/2.11/endpointman-2.11.0.1.tgz 2.10 @@ -32,5 +33,5 @@ fw_ari 5.1.0 -7c15f189cbdc170f1a9c873a25fcac09 +2832e12476c29c6a72c85225fb7ad143 From d48b048c681d2714839f2d3d2ca1d065f6cf1d32 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Tue, 19 Mar 2013 08:37:29 +0000 Subject: [PATCH 324/623] [Module package script: endpointman 2.11.4.11] --- module.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module.xml b/module.xml index 50ff6d06..094e802b 100644 --- a/module.xml +++ b/module.xml @@ -25,7 +25,7 @@ *2.XX.X.X* https://github.com/tm1000/freepbx-endpointmanager/commits/master https://github.com/tm1000/freepbx-endpointmanager - release/2.11/endpointman-2.11.0.1.tgz + release/2.11/endpointman-2.11.4.11.tgz 2.10 @@ -33,5 +33,5 @@ fw_ari 5.1.0 -2832e12476c29c6a72c85225fb7ad143 +a3f341e28698ea988c987efd72d0d9c8 From 60d8a3c91e8b973f643f5ede2479074e3dc674c5 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 15:11:25 -0400 Subject: [PATCH 325/623] Enchanced Vocubulary with additional terms --- i18n/fr_FR/LC_MESSAGES/endpointman.po | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/i18n/fr_FR/LC_MESSAGES/endpointman.po b/i18n/fr_FR/LC_MESSAGES/endpointman.po index 832f6d12..36f56ac7 100644 --- a/i18n/fr_FR/LC_MESSAGES/endpointman.po +++ b/i18n/fr_FR/LC_MESSAGES/endpointman.po @@ -66,6 +66,12 @@ msgstr "" msgid "End Point Manager" msgstr "" +#~ msgid "Device List" +#~ msgstr "Liste des Périphériques" + +#~ msgid "Device" +#~ msgstr "Périphérique" + #~ msgid "My Devices List" #~ msgstr "Ma liste de terminaux" @@ -136,7 +142,7 @@ msgstr "" #~ msgid "Use NMAP" #~ msgstr "Utiliser NMAP" -#~ msgid "Mac Address" +#~ msgid "MAC Address" #~ msgstr "Adresse MAC" #~ msgid "Model of Phone" @@ -795,4 +801,4 @@ msgid "Debug Log" msgstr "Log Debug" msgid "Delete selected phone" -msgstr "Suppression des téléphones sélectionnés" \ No newline at end of file +msgstr "Suppression des téléphones sélectionnés" From f1d6c25bd721a8c848e38a8f055a9102f79e1aa1 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 15:13:03 -0400 Subject: [PATCH 326/623] Prepare CSS with generic colors --- assets/css/main.css | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/assets/css/main.css b/assets/css/main.css index 047fdcd8..23fbe00e 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -11,4 +11,32 @@ Syntax recommendation http://www.w3.org/TR/REC-CSS2/ */ +.red, .error { + color: #d9534f; + font-color: #d9534f; +} +.green, .success { + color: #5cb85c; + font-color: #5cb85c; +} + +.yellow, .warning { + color: #f0ad4e; + font-color: #f0ad4e; +} + +.cyan, .info { + color: #5bc0de; + font-color: #5bc0de; +} + +.blue, .primary { + color: #428bca; + font-color: #428bca; +} + +.gray, .disabled { + color: #474949; + font-color: #474949; +} From 1af6c89c42aafda9240b2e4a23b3e20e89787925 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 15:14:13 -0400 Subject: [PATCH 327/623] Add Font-Awesome --- templates/freepbx/global_header.html | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/freepbx/global_header.html b/templates/freepbx/global_header.html index 694fe6c7..f6e1de7f 100644 --- a/templates/freepbx/global_header.html +++ b/templates/freepbx/global_header.html @@ -17,6 +17,7 @@ {elseif condition="$amp_ver >= 10"} + {/if} -
      -
      -
      -

      -
      \ No newline at end of file +
      +

      From 89f4b9500e612b6d8ab43ab463c2317f5f81f891 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 15:24:49 -0400 Subject: [PATCH 329/623] FreePBX look-and-feel compliance --- templates/freepbx/devices_manager.html | 37 +++++++++++++------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/templates/freepbx/devices_manager.html b/templates/freepbx/devices_manager.html index b9f8781e..b09beb8a 100644 --- a/templates/freepbx/devices_manager.html +++ b/templates/freepbx/devices_manager.html @@ -1,8 +1,9 @@ {include="global_header"} +

      +
      {if condition="isset($show_error_box)"} {include="message_box"} {/if} -
      {/if} -{include="global_footer"} \ No newline at end of file +{include="global_footer"} From d937592de026a1d5c3c563dbd32e023fc7943878 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 15:30:00 -0400 Subject: [PATCH 330/623] Table Alignment and Font-Awesome Additions --- templates/freepbx/devices_manager.html | 95 +++++++++++++------------- 1 file changed, 46 insertions(+), 49 deletions(-) diff --git a/templates/freepbx/devices_manager.html b/templates/freepbx/devices_manager.html index b09beb8a..a28733cf 100644 --- a/templates/freepbx/devices_manager.html +++ b/templates/freepbx/devices_manager.html @@ -86,27 +86,27 @@

      $(".toggle_all").each(function (i) { var rowClass = 'rowGroup'+$(this).attr('id'); if(mode == 'expand') { - $("#img2"+rowClass).attr("src", "assets/endpointman/images/collapse.png"); - $("#img3"+rowClass).attr("src", "assets/endpointman/images/collapse.png"); + $("#img2"+rowClass).removeClass().addClass('info icon-chevron-up'); + $("#img3"+rowClass).removeClass().addClass('info icon-chevron-up'); $('.'+rowClass).show(); - $('#expander').html('Collapse All'); + $('#expander').html(' Collapse All'); } else { - $("#img2"+rowClass).attr("src", "assets/endpointman/images/expand.png"); - $("#img3"+rowClass).attr("src", "assets/endpointman/images/expand.png"); + $("#img2"+rowClass).removeClass().addClass('info icon-chevron-down'); + $("#img3"+rowClass).removeClass().addClass('info icon-chevron-down'); $('.'+rowClass).hide(); - $('#expander').html('Expand All'); + $('#expander').html(' Expand All'); } }); } function toggleDisplay(tbl, rowClass) { - if($("#img2"+rowClass).attr("src") == 'assets/endpointman/images/expand.png') { - $("#img2"+rowClass).attr("src", "assets/endpointman/images/collapse.png"); - $("#img3"+rowClass).attr("src", "assets/endpointman/images/collapse.png"); + if($("#img2"+rowClass).hasClass("icon-chevron-down")) { + $("#img2"+rowClass).removeClass().addClass('info icon-chevron-up'); + $("#img3"+rowClass).removeClass().addClass('info icon-chevron-up'); $('.'+rowClass).show(); } else { - $("#img2"+rowClass).attr("src", "assets/endpointman/images/expand.png"); - $("#img3"+rowClass).attr("src", "assets/endpointman/images/expand.png"); + $("#img2"+rowClass).removeClass().addClass('info icon-chevron-down'); + $("#img3"+rowClass).removeClass().addClass('info icon-chevron-down'); $('.'+rowClass).hide(); } } @@ -212,16 +212,16 @@

      {if condition="$mode != 'EDIT'"}{else} - -

      -

      -

      -

      -

      -

      + + + + + + + - - + + @@ -266,17 +266,17 @@

      {if condition="$mode != 'EDIT'"}{else}{$value.text} {/loop} - + {if condition="$mode == 'EDIT'"} - '> + {else} - '> + {/if} - {if condition="$mode != 'EDIT'"}'>{/if} + {if condition="$mode != 'EDIT'"}

      +

      ()

      +

      +  + ()

      -
      -
      -

      - {if condition="$no_add == FALSE"} -
      - - -
      -
      - {/if} -
      - - - - - - - - -
      -
      - '> -
      - Reboot Phones -
      -
      -

      - '>
      -
      -
      (products)

      - -
      - (models)

      - -
      +

      +{if condition="$no_add == FALSE"} +

      + + + + + () + +

      +{/if} + +

      +  () +

      + +

      + +

      + +

      +  + (products) + +() +

      + +

      +  + (models) + +() +

      + {if condition="!isset($disable_help)"} From 2cbbdec0b21e495ddb32cfd1b16d66e070e357c4 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 17:12:47 -0400 Subject: [PATCH 334/623] Add current managed table buttons --- templates/freepbx/devices_manager.html | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/templates/freepbx/devices_manager.html b/templates/freepbx/devices_manager.html index f1bdae3b..e02a6641 100644 --- a/templates/freepbx/devices_manager.html +++ b/templates/freepbx/devices_manager.html @@ -89,12 +89,14 @@

      $("#img2"+rowClass).removeClass().addClass('info icon-chevron-up'); $("#img3"+rowClass).removeClass().addClass('info icon-chevron-up'); $('.'+rowClass).show(); - $('#expander').html(' Collapse All'); + $('#expander').hide(); + $('#collapser').show(); } else { $("#img2"+rowClass).removeClass().addClass('info icon-chevron-down'); $("#img3"+rowClass).removeClass().addClass('info icon-chevron-down'); $('.'+rowClass).hide(); - $('#expander').html(' Expand All'); + $('#expander').show(); + $('#collapser').hide(); } }); } @@ -192,6 +194,9 @@

      if (window.focus) {newwindow.focus()} return false; } + function togglePhones(action) { + $('#devList .device').prop('checked', action); + }

      {if condition="$mode != 'EDIT'"}{else}{/if}

      @@ -392,8 +397,11 @@

      {if condition="$mode != 'EDIT'"}{else}

      - Expand All Line Info + + + + @@ -411,7 +419,7 @@

      {loop name="list"} - + @@ -487,4 +495,7 @@

      $("#demo img[title]").tooltip(); {/if} + {include="global_footer"} From 9798308ae50ee6090109d96b5261e7a87546f0fb Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 17:16:18 -0400 Subject: [PATCH 335/623] Errant spacing :/ --- templates/freepbx/devices_manager.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/freepbx/devices_manager.html b/templates/freepbx/devices_manager.html index e02a6641..aa766f5c 100644 --- a/templates/freepbx/devices_manager.html +++ b/templates/freepbx/devices_manager.html @@ -475,14 +475,14 @@

      -  + (products) ()

      -  + (models) () From 2aaa2b1ad1c718538a4c3d66f3d41746852cb36b Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 18:02:40 -0400 Subject: [PATCH 336/623] FreePBX Look-and-feel --- .../freepbx/advanced_settings_settings.html | 101 +++++++++--------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html index 0909c8be..1ede021e 100644 --- a/templates/freepbx/advanced_settings_settings.html +++ b/templates/freepbx/advanced_settings_settings.html @@ -2,14 +2,15 @@ {include="message_box"} {/if} -

      {$value.mac} {$value.name} {$value.model}
      + +
      - - + + - - + - - + +
      ::
      +
      + +
      Time
      + - - - - - - + - - + +

      ( USA-5) ( USA-5)
      + +
      Local Paths
      + - - - - - - + - - + - - + +

      NMAP :NMAP :
      ARP :ARP :
      Asterisk :Asterisk :
      + +
      Web Directories
      + - - - - - - + +

      Package Server:Package Server:
      + +
      Experimental
      + - - - - - + @@ -90,45 +91,45 @@ - - + - - + - - + - - + - - + - - + {if condition="$git_enabled === TRUE"} - - + - + - + @@ -405,10 +405,10 @@


      (What?) (What?)
      Disable Tooltip popups Disable Tooltip popups
      Assign the same extension to multiple phones (Note: This is not supported by Asterisk) Assign the same extension to multiple phones (Note: This is not supported by Asterisk)
      When editing the configuration files allows one to save over the global template default instead of saving directly to the database. These types of changes can and will be overwritten when updating the brand packages from the configuration/installation page When editing the configuration files allows one to save over the global template default instead of saving directly to the database. These types of changes can and will be overwritten when updating the brand packages from the configuration/installation page
      Disable checking for a valid, working TFTP server which can sometimes cause Apache to crash Disable checking for a valid, working TFTP server which can sometimes cause Apache to crash
      Disable backing up the tftboot directory on every phone rebuild or save Disable backing up the tftboot directory on every phone rebuild or save
      Use the live github repository (WARN: Beta!) Use the live github repository (WARN: Beta!)
      GIT Branch Select the live github repository branch (WARN: Beta!) + GIT Branch Select the live github repository branch (WARN: Beta!) '; - '; +

      + + {$value.name} {$value.name}'> +
      + {$value.name} + - <?php echo _(' border='0'>
      {/loop}
      {/if} {loop name="only_configs"} - {$value.name} - <?php echo _(' border='0'> +   + {$value.name} '>
      {/loop}
      @@ -109,26 +113,31 @@

      {$value.title}

      {loop name="value.data"}
      - {if condition="$value.type == 'input'"} - - {elseif condition="$value.type == 'textarea'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: - {elseif condition="$value.type == 'file'"} - - {elseif condition="$value.type == 'radio'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: + {if condition="$value.type == 'input'"} + + {elseif condition="$value.type == 'textarea'"} + {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: + {elseif condition="$value.type == 'file'"} + + {elseif condition="$value.type == 'radio'"} + {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: {loop name="value.data"} - [] + [] {/loop} - {elseif condition="$value.type == 'list'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: - {elseif condition="$value.type == 'checkbox'"} - - {/if} + + {elseif condition="$value.type == 'checkbox'"} + + {/if} {if condition="isset($value.aried)"} @@ -151,8 +160,9 @@

      {$value.title}

      {if condition="!isset($in_ari)"} - Reboot Phone(s)
      - + +
      + {include="global_footer"} {/if} diff --git a/templates/freepbx/template_manager.html b/templates/freepbx/template_manager.html index accbe181..7f6bc930 100644 --- a/templates/freepbx/template_manager.html +++ b/templates/freepbx/template_manager.html @@ -1,4 +1,5 @@ {include="global_header"} +

      Template Manager

      {if condition="isset($show_error_box)"} {include="message_box"} {/if} @@ -18,37 +19,14 @@ }) }) -
      -

      :

      - : - - : - - Clone Template From: - - -
      - +

      +
      - - - - - + {loop name="templates_list"} @@ -56,12 +34,39 @@

      :

      <?php echo _(' border='0'> - + + {/loop}

      + + + +
      {if condition="$value.custom == 0"} - <?php echo _(' border='0'>{/if}'> + {if condition="$value.custom == 0"} + ' + {/if} +
      -
      + +

      + + : + + : + + Clone Template From: + + + + {/if} -{include="global_footer"} \ No newline at end of file +{include="global_footer"} diff --git a/templates/freepbx/variables.html b/templates/freepbx/variables.html index f9ba7213..e6ea6c52 100644 --- a/templates/freepbx/variables.html +++ b/templates/freepbx/variables.html @@ -1,7 +1,11 @@ - :
      {noparse} - -"{$username.line.1}" =
      - -"{$displayname.line.1}" =
      - -"{$server_host.line.1}" =
      - -"{$server_port.line.1}" =
      - -"{$mac}" =
      - -"{$model}" =
      {/noparse} \ No newline at end of file +
      + {noparse} +
        +
      • {$username.line.1}
      • +
      • {$displayname.line.1}
      • +
      • {$server_host.line.1}
      • +
      • {$server_port.line.1}
      • +
      • {$mac}
      • +
      • {$model}
      • +
      + {/noparse} From f6b542ca6d9a8ba56a057c316781b572b5af5207 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 20:08:28 -0400 Subject: [PATCH 338/623] Corrected table widths --- templates/freepbx/devices_manager.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/freepbx/devices_manager.html b/templates/freepbx/devices_manager.html index aa766f5c..8db38593 100644 --- a/templates/freepbx/devices_manager.html +++ b/templates/freepbx/devices_manager.html @@ -204,10 +204,10 @@

      {if condition="$mode != 'EDIT'"}{else}

      - + - + @@ -419,10 +419,10 @@

      {loop name="list"} - + - + @@ -431,10 +431,10 @@

      {loop name="value.line"} - + - + From 1bb9066e86e7f3313336b7e96d9924b8012e9db7 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 20:11:04 -0400 Subject: [PATCH 339/623] Consistency rules --- templates/freepbx/template_editor.html | 1 + templates/freepbx/template_manager.html | 1 + 2 files changed, 2 insertions(+) diff --git a/templates/freepbx/template_editor.html b/templates/freepbx/template_editor.html index a1947810..969e73f7 100644 --- a/templates/freepbx/template_editor.html +++ b/templates/freepbx/template_editor.html @@ -1,5 +1,6 @@

      Template Manager

      Template Editor

      +
      {if condition="isset($in_ari)"} diff --git a/templates/freepbx/template_manager.html b/templates/freepbx/template_manager.html index 7f6bc930..823b6490 100644 --- a/templates/freepbx/template_manager.html +++ b/templates/freepbx/template_manager.html @@ -1,5 +1,6 @@ {include="global_header"}

      Template Manager

      +
      {if condition="isset($show_error_box)"} {include="message_box"} {/if} From c5feb7b39aabfc6e6e0dbee34efeb4cfa68333dc Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 21:13:29 -0400 Subject: [PATCH 340/623] Colorize the buttons --- assets/css/main.css | 12 ++++++++++++ .../freepbx/advanced_settings_sh_manager.html | 6 ------ templates/freepbx/brand_model_manager.html | 16 ++++++---------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/assets/css/main.css b/assets/css/main.css index 52bfd287..4df10827 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -55,3 +55,15 @@ ul.nobullets { li { line-height: 24px; } + +.button_Enable { + background: none; + color: #003300; + background-color: #66F966; +} + +.button_Disable { + background: none; + color: #330000; + background-color: #F96666; +} diff --git a/templates/freepbx/advanced_settings_sh_manager.html b/templates/freepbx/advanced_settings_sh_manager.html index ebd5a057..4b961453 100644 --- a/templates/freepbx/advanced_settings_sh_manager.html +++ b/templates/freepbx/advanced_settings_sh_manager.html @@ -9,12 +9,6 @@ .model { border: thin dotted #000; } -.button_Enable { - background-color: #3C0; -} -.button_Disable { - background-color: #F00; -} --> {loop name="brand2_list"} diff --git a/templates/freepbx/brand_model_manager.html b/templates/freepbx/brand_model_manager.html index 77785179..4fb1cd86 100644 --- a/templates/freepbx/brand_model_manager.html +++ b/templates/freepbx/brand_model_manager.html @@ -1,4 +1,6 @@ {include="global_header"} +

      Package Manager

      +
      {if condition="isset($show_error_box)"} {include="message_box"} {/if} @@ -13,12 +15,6 @@ .model { border: thin dotted #000; } -.button_Enable { - background-color: #3C0; -} -.button_Disable { - background-color: #F00; -} -->
      - +
      @@ -191,21 +187,21 @@ {loop name="brand2_list"}
      {$value.mac} {$value.name}{$value.model}{$value.model}
      {$value.template_name}
      - + - +
      {$value.name} {if condition="$value.installed == '1'"}( [{$value.cfg_ver}]) {/if}{if condition="$value.installed == '1'"}Check Online{/if}
      {else}{/if}">{if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}New Package Modified [{$value.update_vers}]{/if}{/if}
      {$value.name} {if condition="$value.installed == '1'"}( [{$value.cfg_ver}]) {/if}{if condition="$value.installed == '1'"}Check Online{/if}
      {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}New Package Modified [{$value.update_vers}]{/if}{/if}
        {loop name="value.products"} - + From 5122ee30fc76250fba2a8eb78c5d497add10a105 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 22:27:14 -0400 Subject: [PATCH 341/623] Migrate Brand/Models editing to Package Manager --- includes/advanced.inc | 51 +-- includes/brand_model_manager.inc | 335 +++++++++++------- .../freepbx/advanced_settings_sh_manager.html | 47 --- templates/freepbx/advanced_subheader.html | 11 +- templates/freepbx/brand_model_editor.html | 38 ++ templates/freepbx/brand_model_manager.html | 35 +- templates/freepbx/brand_model_subheader.html | 8 + 7 files changed, 268 insertions(+), 257 deletions(-) delete mode 100644 templates/freepbx/advanced_settings_sh_manager.html create mode 100644 templates/freepbx/brand_model_editor.html create mode 100644 templates/freepbx/brand_model_subheader.html diff --git a/includes/advanced.inc b/includes/advanced.inc index 0da75278..31862824 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -157,55 +157,6 @@ switch ($_REQUEST['subpage']) { $endpoint->prepare_message_box(); echo $endpoint->tpl->draw('advanced_settings_manual_upload'); break; - case "sh_manager": - if (isset($_REQUEST['button_hide'])) { - if (isset($_REQUEST['model'])) { - $sql = "UPDATE endpointman_model_list SET hidden = 1 WHERE id = '" . $_REQUEST['model'] . "'"; - } elseif (isset($_REQUEST['brand'])) { - $sql = "UPDATE endpointman_brand_list SET hidden = 1 WHERE id = " . $_REQUEST['brand']; - } elseif (isset($_REQUEST['product'])) { - $sql = "UPDATE endpointman_product_list SET hidden = 1 WHERE id = '" . $_REQUEST['product'] . "'"; - } - $endpoint->eda->sql($sql); - } elseif (isset($_REQUEST['button_show'])) { - if (isset($_REQUEST['model'])) { - $sql = "UPDATE endpointman_model_list SET hidden = 0 WHERE id = '" . $_REQUEST['model'] . "'"; - } elseif (isset($_REQUEST['brand'])) { - $sql = "UPDATE endpointman_brand_list SET hidden = 0 WHERE id = " . $_REQUEST['brand']; - } elseif (isset($_REQUEST['product'])) { - $sql = "UPDATE endpointman_product_list SET hidden = 0 WHERE id = '" . $_REQUEST['product'] . "'"; - } - $endpoint->eda->sql($sql); - } - $sql = "SELECT * from endpointman_brand_list WHERE id > 0 ORDER BY id ASC "; - $result = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $i = 0; - foreach ($result as $row) { - $row_out[$i] = $row; - $row_out[$i]['count'] = $i; - if ($row['installed']) { - $j = 0; - $sql = 'SELECT * FROM endpointman_product_list WHERE brand = ' . $row['id'] . ' ORDER BY long_name ASC'; - $result2 = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $xml_data = ""; - foreach ($result2 as $row2) { - $row_out[$i]['products'][$j] = $row2; - $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = ' . $row2['id']; - $result3 = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $k = 0; - foreach ($result3 as $row3) { - $row_out[$i]['products'][$j]['models'][$k] = $row3; - $k++; - } - $j++; - } - } - $i++; - } - $endpoint->tpl->assign("brand2_list", $row_out); - $endpoint->prepare_message_box(); - echo $endpoint->tpl->draw('advanced_settings_sh_manager'); - break; case "oui_manager": if ((isset($_REQUEST['oui_sub'])) AND ($_REQUEST['rb_brand'] > 0) AND ($_REQUEST['oui'] != "")) { $sql = "INSERT INTO endpointman_oui_list (oui, brand, custom) VALUES ('" . $_REQUEST['oui'] . "', '" . $_REQUEST['rb_brand'] . "', '1')"; @@ -692,4 +643,4 @@ switch ($_REQUEST['subpage']) { echo $endpoint->tpl->draw('advanced_settings_settings'); break; -} \ No newline at end of file +} diff --git a/includes/brand_model_manager.inc b/includes/brand_model_manager.inc index 73f92404..bc151e3f 100644 --- a/includes/brand_model_manager.inc +++ b/includes/brand_model_manager.inc @@ -6,145 +6,212 @@ * @license MPL / GPLv2 / LGPL * @package Provisioner */ -$check_for_updates = FALSE; -global $type; - -if((isset($_REQUEST['button_install'])) OR (isset($_REQUEST['button_update']))) { - if(isset($_REQUEST['brand'])) { - $installer = array("type" => 'brand', "id" => $_REQUEST['brand']); - } -} elseif(isset($_REQUEST['product'])) { - if(isset($_REQUEST['button_install_firmware'])) { - $installer = array("type" => 'firmware', "id" => $_REQUEST['product']); - } elseif(isset($_REQUEST['button_update_firmware'])) { - $endpoint->remove_firmware($_REQUEST['product']); - $installer = array("type" => 'firmware', "id" => $_REQUEST['product']); - } elseif(isset($_REQUEST['button_remove_firmware'])) { - $endpoint->remove_firmware($_REQUEST['product']); - $message = "Firmware Removed"; - } -} elseif(isset($_REQUEST['button_disable'])) { - if(isset($_REQUEST['model'])) { - $sql = "UPDATE endpointman_model_list SET enabled = 0 WHERE id = '".$_REQUEST['model']."'"; - } elseif(isset($_REQUEST['brand'])) { - $sql = "UPDATE endpointman_brand_list SET enabled = 0 WHERE id = '".$_REQUEST['model']."'"; - } - $endpoint->eda->sql($sql); -} elseif(isset($_REQUEST['button_enable'])) { - if(isset($_REQUEST['model'])) { - $sql = "UPDATE endpointman_model_list SET enabled = 1 WHERE id = '".$_REQUEST['model']."'"; - } elseif(isset($_REQUEST['brand'])) { - $sql = "UPDATE endpointman_brand_list SET enabled = 1 WHERE id = '".$_REQUEST['model']."'"; - } - $endpoint->eda->sql($sql); -} elseif(isset($_REQUEST['button_uninstall'])) { - if(isset($_REQUEST['brand'])) { - $endpoint->remove_brand($_REQUEST['brand']); - } -} elseif(isset($_REQUEST['button_check_for_updates'])) { - //die('hi'); - $brand_up = $endpoint->update_check(); - $endpoint->tpl->assign("update_check", 1); - - $check_for_updates = TRUE; -} elseif(isset($_REQUEST['install-jstree'])) { - $installer = array("type" => 'js-multiple', "id" => $_REQUEST['hidden']); -} -$sql="SELECT * from endpointman_brand_list WHERE id > 0 AND hidden = 0 ORDER BY id ASC "; -$brand_list =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); -$i = 0; -$note = ""; -$row_out = array(); -foreach($brand_list as $row) { - $row_out[$i] = $row; - $row_out[$i]['cfg_ver'] = date("n-j-y",$row['cfg_ver']) . " at " . date("g:ia",$row['cfg_ver']); - - $row_out[$i]['count'] = $i; - if($check_for_updates) { - $id = $endpoint->arraysearchrecursive($row['name'], $brand_up,'name'); - - $id = $id[0]; - if((isset($brand_up[$id]['update'])) AND ($row['installed'] == 1)) { - $row_out[$i]['update'] = $brand_up[$id]['update']; - //$endpoint->add_freepbx_notification("PU_".$brand_up[$id]['name'], '', "Brand \'".$brand_up[$id]['name']."\' has updates available", "Old Version: ".$row['cfg_ver']." New Version: ".$brand_up[$id]['version']."
      "."Changes: ". $brand_up[$id]['changes'].$note, ""); - } else { - $row_out[$i]['update'] = NULL; - } - if(isset($brand_up[$id]['update_vers'])) { - $row_out[$i]['update_vers'] = date("n-j-y",$brand_up[$id]['update_vers']) . " at " . date("g:ia",$brand_up[$id]['update_vers']); - } else { - $row_out[$i]['update_vers'] = NULL; - } - } - if($row['installed']){ - $j = 0; - $sql = 'SELECT * FROM endpointman_product_list WHERE hidden = 0 AND brand = '.$row['id'].' ORDER BY long_name ASC'; - $product_list =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); - foreach($product_list as $row2) { - $row_out[$i]['products'][$j] = $row2; - if($check_for_updates) { - if(($temp = $endpoint->firmware_update_check($row2['id'])) AND (array_key_exists('firmware_vers', $row2)) AND ($row2['firmware_vers'] > 0)) { - $row_out[$i]['products'][$j]['update_fw'] = 1; - $row_out[$i]['products'][$j]['update_vers_fw'] = $temp['data']['version']; - //$endpoint->add_freepbx_notification("PU_".$row2['long_name'], '', "There is a firmware update for phone module ".$row2['long_name'], "Old Version: ".$row2['firmware_vers']." New Version: ".$temp['data']['version'].$note, ""); - } else { - $row_out[$i]['products'][$j]['update_fw'] = 0; - } - } - - $row_out[$i]['products'][$j]['fw_type'] = $endpoint->firmware_local_check($row2['id']); - - - if(1 == 1) { - $sql = "SELECT * FROM endpointman_model_list WHERE hidden = 0 AND product_id = '".$row2['id']."'"; - $model_list =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); - $k = 0; - foreach($model_list as $row3) { - $row_out[$i]['products'][$j]['models'][$k] = $row3; - if($row_out[$i]['products'][$j]['models'][$k]['enabled']){ - $row_out[$i]['products'][$j]['models'][$k]['enabled_checked'] = 'checked'; - } - $k++; - } - } - $j++; - } - } - $i++; -} +$check_for_updates = FALSE; +$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; -if (!isset($error)) { - $error = ""; -} -if (!isset($_POST['brand'])) { - $brand = NULL; +echo $endpoint->tpl->draw('global_header'); +if (!isset($_REQUEST['subpage'])) { + $_REQUEST['subpage'] = "manager"; + $endpoint->tpl->assign("subhead_area", 'manager'); } else { - $brand = $_POST['brand']; + $endpoint->tpl->assign("subhead_area", $_REQUEST['subpage']); } +echo $endpoint->tpl->draw('brand_model_subheader'); -if (isset($installer)) { - $endpoint->tpl->assign("brand", $brand); - $endpoint->tpl->assign("installer", $installer); -} +switch ($_REQUEST['subpage']) { + case "manager": -$endpoint->tpl->assign("web_var", "?type=$type"); -$endpoint->tpl->assign("brand2_list", $row_out); + global $type; -$error_message = NULL; -foreach($endpoint->error as $key => $error) { - $error_message .= $error; - if($endpoint->global_cfg['debug']) { - $error_message .= " Function: [".$key."]"; - } - $error_message .= "
      "; -} -if(isset($error_message)) { - $endpoint->display_message_box($error_message,$endpoint->tpl,1); -} elseif(isset($message)) { - $endpoint->display_message_box($message,$endpoint->tpl,0); -} + if((isset($_REQUEST['button_install'])) OR (isset($_REQUEST['button_update']))) { + if(isset($_REQUEST['brand'])) { + $installer = array("type" => 'brand', "id" => $_REQUEST['brand']); + } + } elseif(isset($_REQUEST['product'])) { + if(isset($_REQUEST['button_install_firmware'])) { + $installer = array("type" => 'firmware', "id" => $_REQUEST['product']); + } elseif(isset($_REQUEST['button_update_firmware'])) { + $endpoint->remove_firmware($_REQUEST['product']); + $installer = array("type" => 'firmware', "id" => $_REQUEST['product']); + } elseif(isset($_REQUEST['button_remove_firmware'])) { + $endpoint->remove_firmware($_REQUEST['product']); + $message = "Firmware Removed"; + } + } elseif(isset($_REQUEST['button_disable'])) { + if(isset($_REQUEST['model'])) { + $sql = "UPDATE endpointman_model_list SET enabled = 0 WHERE id = '".$_REQUEST['model']."'"; + } elseif(isset($_REQUEST['brand'])) { + $sql = "UPDATE endpointman_brand_list SET enabled = 0 WHERE id = '".$_REQUEST['model']."'"; + } + $endpoint->eda->sql($sql); + } elseif(isset($_REQUEST['button_enable'])) { + if(isset($_REQUEST['model'])) { + $sql = "UPDATE endpointman_model_list SET enabled = 1 WHERE id = '".$_REQUEST['model']."'"; + } elseif(isset($_REQUEST['brand'])) { + $sql = "UPDATE endpointman_brand_list SET enabled = 1 WHERE id = '".$_REQUEST['model']."'"; + } + $endpoint->eda->sql($sql); + } elseif(isset($_REQUEST['button_uninstall'])) { + if(isset($_REQUEST['brand'])) { + $endpoint->remove_brand($_REQUEST['brand']); + } + } elseif(isset($_REQUEST['button_check_for_updates'])) { + //die('hi'); + $brand_up = $endpoint->update_check(); + $endpoint->tpl->assign("update_check", 1); + + $check_for_updates = TRUE; + } elseif(isset($_REQUEST['install-jstree'])) { + $installer = array("type" => 'js-multiple', "id" => $_REQUEST['hidden']); + } + + $sql="SELECT * from endpointman_brand_list WHERE id > 0 AND hidden = 0 ORDER BY id ASC "; + $brand_list =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); + $i = 0; + $note = ""; + $row_out = array(); + foreach($brand_list as $row) { + $row_out[$i] = $row; + $row_out[$i]['cfg_ver'] = date("n-j-y",$row['cfg_ver']) . " at " . date("g:ia",$row['cfg_ver']); + + $row_out[$i]['count'] = $i; + if($check_for_updates) { + $id = $endpoint->arraysearchrecursive($row['name'], $brand_up,'name'); -//draw the template -//echo "test"; -echo $endpoint->tpl->draw( 'brand_model_manager' ); + $id = $id[0]; + if((isset($brand_up[$id]['update'])) AND ($row['installed'] == 1)) { + $row_out[$i]['update'] = $brand_up[$id]['update']; + //$endpoint->add_freepbx_notification("PU_".$brand_up[$id]['name'], '', "Brand \'".$brand_up[$id]['name']."\' has updates available", "Old Version: ".$row['cfg_ver']." New Version: ".$brand_up[$id]['version']."
      "."Changes: ". $brand_up[$id]['changes'].$note, ""); + } else { + $row_out[$i]['update'] = NULL; + } + if(isset($brand_up[$id]['update_vers'])) { + $row_out[$i]['update_vers'] = date("n-j-y",$brand_up[$id]['update_vers']) . " at " . date("g:ia",$brand_up[$id]['update_vers']); + } else { + $row_out[$i]['update_vers'] = NULL; + } + } + if($row['installed']){ + $j = 0; + $sql = 'SELECT * FROM endpointman_product_list WHERE hidden = 0 AND brand = '.$row['id'].' ORDER BY long_name ASC'; + $product_list =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); + foreach($product_list as $row2) { + $row_out[$i]['products'][$j] = $row2; + if($check_for_updates) { + if(($temp = $endpoint->firmware_update_check($row2['id'])) AND (array_key_exists('firmware_vers', $row2)) AND ($row2['firmware_vers'] > 0)) { + $row_out[$i]['products'][$j]['update_fw'] = 1; + $row_out[$i]['products'][$j]['update_vers_fw'] = $temp['data']['version']; + //$endpoint->add_freepbx_notification("PU_".$row2['long_name'], '', "There is a firmware update for phone module ".$row2['long_name'], "Old Version: ".$row2['firmware_vers']." New Version: ".$temp['data']['version'].$note, ""); + } else { + $row_out[$i]['products'][$j]['update_fw'] = 0; + } + } + + $row_out[$i]['products'][$j]['fw_type'] = $endpoint->firmware_local_check($row2['id']); + + + if(1 == 1) { + $sql = "SELECT * FROM endpointman_model_list WHERE hidden = 0 AND product_id = '".$row2['id']."'"; + $model_list =& $endpoint->eda->sql($sql,'getAll',DB_FETCHMODE_ASSOC); + $k = 0; + foreach($model_list as $row3) { + $row_out[$i]['products'][$j]['models'][$k] = $row3; + if($row_out[$i]['products'][$j]['models'][$k]['enabled']){ + $row_out[$i]['products'][$j]['models'][$k]['enabled_checked'] = 'checked'; + } + $k++; + } + } + $j++; + } + } + $i++; + } + + if (!isset($error)) { + $error = ""; + } + if (!isset($_POST['brand'])) { + $brand = NULL; + } else { + $brand = $_POST['brand']; + } + + if (isset($installer)) { + $endpoint->tpl->assign("brand", $brand); + $endpoint->tpl->assign("installer", $installer); + } + + $endpoint->tpl->assign("web_var", "?type=$type"); + $endpoint->tpl->assign("brand2_list", $row_out); + + $error_message = NULL; + foreach($endpoint->error as $key => $error) { + $error_message .= $error; + if($endpoint->global_cfg['debug']) { + $error_message .= " Function: [".$key."]"; + } + $error_message .= "
      "; + } + if(isset($error_message)) { + $endpoint->display_message_box($error_message,$endpoint->tpl,1); + } elseif(isset($message)) { + $endpoint->display_message_box($message,$endpoint->tpl,0); + } + + //draw the template + //echo "test"; + echo $endpoint->tpl->draw( 'brand_model_manager' ); + break; + + case "editor": + if (isset($_REQUEST['button_hide'])) { + if (isset($_REQUEST['model'])) { + $sql = "UPDATE endpointman_model_list SET hidden = 1 WHERE id = '" . $_REQUEST['model'] . "'"; + } elseif (isset($_REQUEST['brand'])) { + $sql = "UPDATE endpointman_brand_list SET hidden = 1 WHERE id = " . $_REQUEST['brand']; + } elseif (isset($_REQUEST['product'])) { + $sql = "UPDATE endpointman_product_list SET hidden = 1 WHERE id = '" . $_REQUEST['product'] . "'"; + } + $endpoint->eda->sql($sql); + } elseif (isset($_REQUEST['button_show'])) { + if (isset($_REQUEST['model'])) { + $sql = "UPDATE endpointman_model_list SET hidden = 0 WHERE id = '" . $_REQUEST['model'] . "'"; + } elseif (isset($_REQUEST['brand'])) { + $sql = "UPDATE endpointman_brand_list SET hidden = 0 WHERE id = " . $_REQUEST['brand']; + } elseif (isset($_REQUEST['product'])) { + $sql = "UPDATE endpointman_product_list SET hidden = 0 WHERE id = '" . $_REQUEST['product'] . "'"; + } + $endpoint->eda->sql($sql); + } + $sql = "SELECT * from endpointman_brand_list WHERE id > 0 ORDER BY id ASC "; + $result = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $i = 0; + foreach ($result as $row) { + $row_out[$i] = $row; + $row_out[$i]['count'] = $i; + if ($row['installed']) { + $j = 0; + $sql = 'SELECT * FROM endpointman_product_list WHERE brand = ' . $row['id'] . ' ORDER BY long_name ASC'; + $result2 = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $xml_data = ""; + foreach ($result2 as $row2) { + $row_out[$i]['products'][$j] = $row2; + $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = ' . $row2['id']; + $result3 = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $k = 0; + foreach ($result3 as $row3) { + $row_out[$i]['products'][$j]['models'][$k] = $row3; + $k++; + } + $j++; + } + } + $i++; + } + $endpoint->tpl->assign("brand2_list", $row_out); + $endpoint->prepare_message_box(); + echo $endpoint->tpl->draw('brand_model_editor'); + break; +} diff --git a/templates/freepbx/advanced_settings_sh_manager.html b/templates/freepbx/advanced_settings_sh_manager.html deleted file mode 100644 index 4b961453..00000000 --- a/templates/freepbx/advanced_settings_sh_manager.html +++ /dev/null @@ -1,47 +0,0 @@ - -{loop name="brand2_list"} -
      {$value.long_name} {if condition="$value.cfg_ver != ''"}{/if}
      {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}{/if}{/if}{if condition="$value.fw_type == 'install'"}{elseif condition="$value.fw_type == 'remove'"}{/if}{if condition="array_key_exists('update_fw',$value)"}{if condition="$value.update_fw == 1"}{/if}{/if}
      {$value.long_name} {if condition="$value.cfg_ver != ''"}{/if}
      {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}{/if}{/if}{if condition="$value.fw_type == 'install'"}{elseif condition="$value.fw_type == 'remove'"}{/if}{if condition="array_key_exists('update_fw',$value)"}{if condition="$value.update_fw == 1"}
        {loop name="value.models"} - +
      {$value.model}
      {else}{/if}">
      {$value.model}
      {/loop}
      - - - - - - - -
      {$value.name}
      {else}{/if}">
       {loop name="value.products"} - - - - - - - - -
      {$value.long_name}
      {else}{/if}">
       {loop name="value.models"} - - - - -
      {$value.model}
      {else}{/if}">
      {/loop}
      {/loop}
      -
      -
      -{/loop} - - - - - - - diff --git a/templates/freepbx/advanced_subheader.html b/templates/freepbx/advanced_subheader.html index 67a4c9d7..70812866 100644 --- a/templates/freepbx/advanced_subheader.html +++ b/templates/freepbx/advanced_subheader.html @@ -1,14 +1,11 @@ - +

      Advanced Settings

      +
      - - - - - +
      {if condition="$subhead_area == 'settings'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'oui_manager'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'poce'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'iedl'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'manual_upload'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'sh_manager'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'manual_upload'"}

      {else}

      {/if}
      -
      \ No newline at end of file +
      diff --git a/templates/freepbx/brand_model_editor.html b/templates/freepbx/brand_model_editor.html new file mode 100644 index 00000000..698b3dfb --- /dev/null +++ b/templates/freepbx/brand_model_editor.html @@ -0,0 +1,38 @@ + +{loop name="brand2_list"} +
      {$value.name}
      +{if condition="$value.hidden == '0'"} + + + + + +
       {loop name="value.products"} + + + + + + + + +
      {$value.long_name}
       {loop name="value.models"} + + + + +
      {$value.model}
      {/loop}
      {/loop}
      +{/if} +{/loop} diff --git a/templates/freepbx/brand_model_manager.html b/templates/freepbx/brand_model_manager.html index 4fb1cd86..25fcd9fe 100644 --- a/templates/freepbx/brand_model_manager.html +++ b/templates/freepbx/brand_model_manager.html @@ -1,19 +1,19 @@ -{include="global_header"} -

      Package Manager

      -
      {if condition="isset($show_error_box)"} {include="message_box"} {/if} @@ -25,7 +25,7 @@

      Package Manager

      - +
      @@ -185,23 +185,25 @@

      Package Manager

      {/if} {if condition="1 == 1"} {loop name="brand2_list"} +
      {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}New Package Modified [{$value.update_vers}]{/if}{/if}{$value.name} +
      {if condition="$value.installed == '1'"}( [{$value.cfg_ver}]) {/if}{if condition="$value.installed == '1'"}Check Online{/if}
      + - - + diff --git a/templates/freepbx/alt_config_popup.html b/templates/freepbx/alt_config_popup.html index c4246433..df735ded 100644 --- a/templates/freepbx/alt_config_popup.html +++ b/templates/freepbx/alt_config_popup.html @@ -40,7 +40,7 @@

      You are editing a global file. This will effect any & all phones that reference this hard file
      It is NOT individual to this template!!!
      - You can setup individual templates in the "Product Options/Configuration Editor" under "End Point Advanced Settings" + You can setup individual templates in the "Product Configuration Editor" under "End Point Advanced Settings" {/if}

      {$value.name} {if condition="$value.installed == '1'"}( [{$value.cfg_ver}]) {/if}{if condition="$value.installed == '1'"}Check Online{/if}
      {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}New Package Modified [{$value.update_vers}]{/if}{/if}
        {loop name="value.products"} - +
      - + @@ -215,8 +217,3 @@

      Package Manager


      Want to participate? Add new phones? Join us at http://www.provisioner.net
      {include="global_footer"} - - - - - diff --git a/templates/freepbx/brand_model_subheader.html b/templates/freepbx/brand_model_subheader.html new file mode 100644 index 00000000..9b848085 --- /dev/null +++ b/templates/freepbx/brand_model_subheader.html @@ -0,0 +1,8 @@ +

      Package Manager

      +
      {$value.long_name} {if condition="$value.cfg_ver != ''"}{/if}
      {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}{/if}{/if}{if condition="$value.fw_type == 'install'"}{elseif condition="$value.fw_type == 'remove'"}{/if}{if condition="array_key_exists('update_fw',$value)"}{if condition="$value.update_fw == 1"}
      {if condition="$value.cfg_ver != ''"}{/if}
      {if condition="array_key_exists('update',$value)"}{if condition="$value.update == 1"}{/if}{/if}{if condition="$value.fw_type == 'install'"}{elseif condition="$value.fw_type == 'remove'"}{/if}{if condition="array_key_exists('update_fw',$value)"}{if condition="$value.update_fw == 1"}
        {loop name="value.models"} - +
      {$value.model}
      {$value.model}
      {/loop}
      + + + + +
      {if condition="$subhead_area == 'manager'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'editor'"}

      {else}

      {/if}
      +
      From 374fe632fdb089b6f825586c2f36b9b9a182769c Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sat, 27 Jul 2013 22:27:56 -0400 Subject: [PATCH 342/623] Change 'Endpoint Configuration' menu item to 'Endpoint Package Manager' --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index 50ff6d06..94d0a671 100644 --- a/module.xml +++ b/module.xml @@ -10,7 +10,7 @@ OSS Endpoint Device List OSS Endpoint Template Manager - OSS Endpoint Configuration + OSS Endpoint Package Manager OSS Endpoint Advanced Settings From e965cd7d41dcd97f7a8b78926bf6cd0c70957a08 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 28 Jul 2013 08:23:53 -0400 Subject: [PATCH 343/623] Fix alignment errors --- templates/freepbx/advanced_settings_settings.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html index 1ede021e..0f52135b 100644 --- a/templates/freepbx/advanced_settings_settings.html +++ b/templates/freepbx/advanced_settings_settings.html @@ -80,13 +80,13 @@
      Experimental
      - - - + @@ -139,7 +139,7 @@
      Experimental
      {/if} - +
      (What?)
      Enable Advanced debugging mode for endpoint manager Enable Advanced debugging mode for endpoint manager
      '>
      From 8aa062f915563ec2816826b60eec6f5ad23b9a8d Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 28 Jul 2013 08:27:03 -0400 Subject: [PATCH 344/623] Make OUI Manager Look-and-feel Consistent --- includes/advanced.inc | 13 +---- templates/freepbx/advanced_settings_oui.html | 54 ++++++++++---------- 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/includes/advanced.inc b/includes/advanced.inc index 31862824..b90cb247 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -170,24 +170,15 @@ switch ($_REQUEST['subpage']) { $endpoint->eda->sql($sql); $endpoint->message['oui_manager'] = "Deleted!"; } - $sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id AND endpointman_oui_list.custom = 0'; + $sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name, endpointman_oui_list.custom FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id ORDER BY endpointman_oui_list.oui ASC'; $data = & $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 0; $row_out = array(); foreach ($data as $row) { $row_out[$i] = $row; + $endpoint->tpl->assign("oui_list", $row_out); $i++; } - $endpoint->tpl->assign("oui_list", $row_out); - $sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id AND endpointman_oui_list.custom = 1'; - $data = $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $i = 0; - $row_out_custom = array(); - foreach ($data as $row) { - $row_out_custom[$i] = $row; - $i++; - } - $endpoint->tpl->assign("oui_list_custom", $row_out_custom); $endpoint->tpl->assign("brand_ava", $endpoint->brands_available()); $endpoint->prepare_message_box(); echo $endpoint->tpl->draw('advanced_settings_oui'); diff --git a/templates/freepbx/advanced_settings_oui.html b/templates/freepbx/advanced_settings_oui.html index 6ba6bc80..d424827d 100644 --- a/templates/freepbx/advanced_settings_oui.html +++ b/templates/freepbx/advanced_settings_oui.html @@ -1,35 +1,35 @@ {if condition="isset($show_error_box)"} {include="message_box"} {/if} - + +
      - - - + + + + {loop name="oui_list"} - - - + + + {/loop} -{if condition="isset($oui_list_custom)"} - {loop name="oui_list_custom"} - - - - {/loop} -{/if} - - - - - - - - - +

      OUI

      OUI

      {$value.oui}{$value.name}
      {$value.oui}{$value.name} + {if condition="$value.custom == 1"}' border='0'>{/if} +
      {$value.oui}{$value.name}Delete

      OUI

      + + + + + + + + + + +

      OUI

      From 0b73252173ca14eea75b26ad071bc0133acc1151 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Sun, 28 Jul 2013 07:35:01 -0700 Subject: [PATCH 345/623] Update module.xml --- module.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module.xml b/module.xml index 94d0a671..e8bebde9 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman standard OSS PBX End Point Manager - 2.11.4.11 + 2.11.5.0 setup Connectivity Andrew Nagy @@ -19,6 +19,7 @@ The main differences between the two versions is that the developer of Commercial Endpoint works 30 hours a week paid by Schmoozecom to work on it.
      + *2.11.5.0* Major cosmetic changes thanks to jnovack! *2.11.4.11* Fixes #6426 (Fatal SQL error - Device cfg submit with apostrophe in extn text description) *2.11.4.10* Fixes #6428 *2.11.4.9* Fix a stupid error on my part with requiring php 5.3 SORRY! :-( From e7fc16f81f4fb1b2ada2849f1518b151abfd4e19 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 28 Jul 2013 13:52:40 -0400 Subject: [PATCH 346/623] MAJOR: Product Options/Configuration Editor to Product Configuration Editor --- i18n/fr_FR/LC_MESSAGES/endpointman.po | 4 +- templates/freepbx/advanced_settings_poce.html | 76 ++++++++++--------- templates/freepbx/advanced_subheader.html | 2 +- templates/freepbx/alt_config_popup.html | 2 +- 4 files changed, 45 insertions(+), 39 deletions(-) diff --git a/i18n/fr_FR/LC_MESSAGES/endpointman.po b/i18n/fr_FR/LC_MESSAGES/endpointman.po index 36f56ac7..25de6ff7 100644 --- a/i18n/fr_FR/LC_MESSAGES/endpointman.po +++ b/i18n/fr_FR/LC_MESSAGES/endpointman.po @@ -123,8 +123,8 @@ msgstr "" #~ msgid "OUI Manager" #~ msgstr "Gestion des OUI" -#~ msgid "Product Options/Configuration Editor" -#~ msgstr "Editeur de configuration/options du produit" +#~ msgid "Product Configuration Editor" +#~ msgstr "Editeur de configuration du produit" #~ msgid "Show/Hide Brands/Models" #~ msgstr "Montrer/Cacher les marques/modèles" diff --git a/templates/freepbx/advanced_settings_poce.html b/templates/freepbx/advanced_settings_poce.html index 295330b9..2844bdf8 100644 --- a/templates/freepbx/advanced_settings_poce.html +++ b/templates/freepbx/advanced_settings_poce.html @@ -1,30 +1,27 @@ {if condition="isset($show_error_box)"} {include="message_box"} {/if} -
      - +

      + + -
      -
      -
      {if condition="isset($options)"} {$options} {/if}
      -
      -

      - - +
      {if condition="isset($location)"}File Location: {$location}{/if}
      - + + + + - - +
      + {if condition="isset($location)"}File:{/if}{if condition="isset($location)"}{$location}{/if}
      -
      +
      {loop name="file_list"} - {$value.text}
      + {$value.text}
      {/loop} -
      -
      +
      {if condition="isset($sql_file_list)"} {loop name="sql_file_list"} - {$value.text} [{$value.ref}] Delete + {$value.text} '> +
      [ref: {$value.ref}]
      {/loop} {/if}
      - -
      - {if condition="!isset($temp_file)"} or - - {/if}{if condition="isset($type)"}|| Click here to send this configuration file to the Provisioner.net Team{/if}
      -
      (Note: 'Save' Saves to the local hard drive, if the phone module is ever updated this file will be over-written, 'Save As' Saves to the database and is not over-written on updates)
      +
      + +

      + +

      + {if condition="!isset($temp_file)"} + + NOTE: File is permanently saved and not over-written during next package update. + {/if} + {if condition="isset($type)"} +

      + + Upload this configuration file to the Provisioner.net Team. Files shared are confidential and help improve the quality of releases. + {/if} +

      +
      +
      -
      \ No newline at end of file + diff --git a/templates/freepbx/advanced_subheader.html b/templates/freepbx/advanced_subheader.html index 70812866..f5798a49 100644 --- a/templates/freepbx/advanced_subheader.html +++ b/templates/freepbx/advanced_subheader.html @@ -3,7 +3,7 @@

      Advanced Settings

      {if condition="$subhead_area == 'settings'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'oui_manager'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'poce'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'poce'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'iedl'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'manual_upload'"}

      {else}

      {/if}
      From 7f3e0681422b98f13b721b3518e43a79a82f40ce Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 28 Jul 2013 14:33:48 -0400 Subject: [PATCH 347/623] MAJOR: 'Manual Endpoint Upload/Export' to 'Package Import/Export' --- includes/advanced.inc | 2 +- .../advanced_settings_manual_upload.html | 52 ++++++++++++------- templates/freepbx/advanced_subheader.html | 2 +- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/includes/advanced.inc b/includes/advanced.inc index b90cb247..dcc7c416 100644 --- a/includes/advanced.inc +++ b/includes/advanced.inc @@ -96,7 +96,7 @@ switch ($_REQUEST['subpage']) { case "manual_upload": $sql = "SELECT value FROM endpointman_global_vars WHERE var_name LIKE 'endpoint_vers'"; $provisioner_ver = $endpoint->eda->sql($sql, 'getOne'); - $provisioner_ver = date("n-j-y", $provisioner_ver) . " at " . date("g:ia", $provisioner_ver); + $provisioner_ver = date("d-M-Y", $provisioner_ver) . " at " . date("g:ia", $provisioner_ver); $endpoint->tpl->assign("provisioner_ver", $provisioner_ver); $endpoint->tpl->assign("brand_ava", $endpoint->brands_available()); diff --git a/templates/freepbx/advanced_settings_manual_upload.html b/templates/freepbx/advanced_settings_manual_upload.html index 98539679..02ead671 100644 --- a/templates/freepbx/advanced_settings_manual_upload.html +++ b/templates/freepbx/advanced_settings_manual_upload.html @@ -57,32 +57,48 @@ {/if} -

      Import/Upload Packages

      -

      Note: These files can be downloaded from: http://wiki.provisioner.net/index.php/Releases

      - -
      + + + + + + + + +
      + + + + + + + +
      + - Local Date Last Modified: {$provisioner_ver} -
      - - -

      -
      - -
      Note: The Brand XML File is no longer needed as it is contained within the Brand Package.

      Learn How to Create your own brand package here: http://www.provisioner.net/adding_new_phones

      - -
      + +
      + +


      -

      Export Brand Packages

      +

      Export Brand Packages

      +Learn how to create your own brand package at http://www.provisioner.net/adding_new_phones +

      - +
      +

      diff --git a/templates/freepbx/advanced_subheader.html b/templates/freepbx/advanced_subheader.html index f5798a49..cbf4a460 100644 --- a/templates/freepbx/advanced_subheader.html +++ b/templates/freepbx/advanced_subheader.html @@ -5,7 +5,7 @@

      Advanced Settings

      {if condition="$subhead_area == 'oui_manager'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'poce'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'iedl'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'manual_upload'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'manual_upload'"}

      {else}

      {/if}

      From cb0495d965a7c0a40e4e84cd323bb896ff8ef2ae Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 28 Jul 2013 16:12:44 -0400 Subject: [PATCH 348/623] MINOR: Look-and-feel for Import/Export My Devices List --- templates/freepbx/advanced_settings_iedl.html | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/templates/freepbx/advanced_settings_iedl.html b/templates/freepbx/advanced_settings_iedl.html index 91738a75..bff589bb 100644 --- a/templates/freepbx/advanced_settings_iedl.html +++ b/templates/freepbx/advanced_settings_iedl.html @@ -1,20 +1,30 @@ {if condition="isset($show_error_box)"} {include="message_box"} {/if} -

      : -
      -

      -

      :

      +

      +

      .

      + + +

      + +

      .

      + -
      -
      -

      :

      -

      <Mac>, <>, <>, <>, <>

      -

      , , &

      -

      Note:The Extensions need to be previously added into FreePBX before you import

      +Warning: The extensions need to be added into FreePBX before you import.

      + +
      +<>,<>,<>,<>,<> +
        +
      • -
      • +
      • -
      • +
      • -
      • +
      • -
      • +
      • -
      • +
      +
      :
      +001122334455,Cisco/Linksys,7940,4321,1
      +112233445566,Cisco/Linksys,7945,, From 0d82fbe1d92254f94fb2edcfe12c04f6c8a24357 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 28 Jul 2013 16:56:30 -0400 Subject: [PATCH 349/623] MINOR: Advanced Settings main config --- templates/freepbx/advanced_settings_settings.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/freepbx/advanced_settings_settings.html b/templates/freepbx/advanced_settings_settings.html index 0f52135b..e4e8e4a9 100644 --- a/templates/freepbx/advanced_settings_settings.html +++ b/templates/freepbx/advanced_settings_settings.html @@ -6,7 +6,7 @@ - + @@ -28,7 +28,7 @@
      Time
      :
      - + -
      ( USA-5) ( England/London)
      '>'> + + + +
      + - \ No newline at end of file + diff --git a/templates/freepbx/alt_config_popup.html b/templates/freepbx/alt_config_popup.html index df735ded..4ce8f19a 100644 --- a/templates/freepbx/alt_config_popup.html +++ b/templates/freepbx/alt_config_popup.html @@ -1,16 +1,16 @@ PBX Endpoint Configuration Manager - + + + - {if condition="$amp_ver < 10"} - {else} - - {/if} + + - + +
      -


      {if condition="isset($show_error_box)"} @@ -52,11 +52,13 @@


      +

      diff --git a/templates/freepbx/specifics_pop.html b/templates/freepbx/specifics_pop.html index 0538fb0d..158f08dc 100644 --- a/templates/freepbx/specifics_pop.html +++ b/templates/freepbx/specifics_pop.html @@ -1,8 +1,12 @@ PBX Endpoint Configuration Manager - + + + + + - -
      + +


      {if condition="isset($show_error_box)"} @@ -22,36 +26,36 @@

      - +
      {loop name="html_array"} - - + + {loop name="value.data"} {if condition="$value.type != 'break'"} - + {/if} {if condition="$value.type == 'break'"} @@ -63,7 +67,11 @@

      - +

      + + +

      + From b80bc72ade43ccd75b888e5455afe892e0f6b3c7 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Wed, 7 Aug 2013 06:57:44 -0400 Subject: [PATCH 351/623] Standardized jquery and jquery-ui includes --- templates/freepbx/advanced_settings_settings_pop.html | 4 ++-- templates/freepbx/alt_config_popup.html | 6 +++--- templates/freepbx/global_header.html | 5 +---- templates/freepbx/specifics_pop.html | 4 ++-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/templates/freepbx/advanced_settings_settings_pop.html b/templates/freepbx/advanced_settings_settings_pop.html index 4db08913..30276fb2 100644 --- a/templates/freepbx/advanced_settings_settings_pop.html +++ b/templates/freepbx/advanced_settings_settings_pop.html @@ -1,8 +1,8 @@ PBX Endpoint Configuration Manager - - + + diff --git a/templates/freepbx/alt_config_popup.html b/templates/freepbx/alt_config_popup.html index 4ce8f19a..588392d0 100644 --- a/templates/freepbx/alt_config_popup.html +++ b/templates/freepbx/alt_config_popup.html @@ -1,7 +1,9 @@ PBX Endpoint Configuration Manager - + + + @@ -9,8 +11,6 @@ - - - {/if} {if condition="(isset($silent_mode)) OR ($amp_ver < 9)"} @@ -17,7 +14,7 @@ {elseif condition="$amp_ver >= 10"} - + {/if} -{loop name="brand2_list"} -
      {$value.name} -{if condition="$value.hidden == '0'"} -

       
      {$value.title}
       
      {$value.title}Use Defaults
      {if condition="$value.type == 'input'"} - + {elseif condition="$value.type == 'textarea'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: + {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: {elseif condition="$value.type == 'file'"} - + {elseif condition="$value.type == 'radio'"} {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if} {loop name="value.data"} - + {/loop} {elseif condition="$value.type == 'list'"} - {if condition="isset($value.tooltip)"}{$value.description}{$value.tooltip}{else}{$value.description}{/if}: {elseif condition="$value.type == 'checkbox'"} - + {/if}
      - - - - -
       {loop name="value.products"} - - - - - - - - -
      {$value.long_name}
       {loop name="value.models"} - - - - -
      {$value.model}
      {/loop}
      {/loop}
      -{/if} -{/loop} diff --git a/templates/freepbx/brand_model_subheader.html b/templates/freepbx/brand_model_subheader.html deleted file mode 100644 index 9b848085..00000000 --- a/templates/freepbx/brand_model_subheader.html +++ /dev/null @@ -1,8 +0,0 @@ -

      Package Manager

      - - - - - -
      {if condition="$subhead_area == 'manager'"}

      {else}

      {/if}
      {if condition="$subhead_area == 'editor'"}

      {else}

      {/if}
      -
      diff --git a/uninstall.php b/uninstall.php deleted file mode 100644 index 53272136..00000000 --- a/uninstall.php +++ /dev/null @@ -1,63 +0,0 @@ -rmrf(PHONE_MODULES_PATH); -exec("rm -R ". PHONE_MODULES_PATH); - -out("Dropping all relevant tables"); -$sql = "DROP TABLE `endpointman_brand_list`"; -$result = $db->query($sql); - -$sql = "DROP TABLE `endpointman_global_vars`"; -$result = $db->query($sql); - -$sql = "DROP TABLE `endpointman_mac_list`"; -$result = $db->query($sql); - -$sql = "DROP TABLE `endpointman_line_list`"; -$result = $db->query($sql); - -$sql = "DROP TABLE `endpointman_model_list`"; -$result = $db->query($sql); - -$sql = "DROP TABLE `endpointman_oui_list`"; -$result = $db->query($sql); - -$sql = "DROP TABLE `endpointman_product_list`"; -$result = $db->query($sql); - -$sql = "DROP TABLE `endpointman_template_list`"; -$result = $db->query($sql); - -$sql = "DROP TABLE `endpointman_time_zones`"; -$result = $db->query($sql); - -$sql = "DROP TABLE `endpointman_custom_configs`"; -$result = $db->query($sql); - - -//Do unlinks ourself because retrieve_conf doesn't always remove stuff... - - - -out('Removing symlink to web provisioner'); -if(is_link($amp_conf['AMPWEBROOT']."/provisioning")) { - unlink($amp_conf['AMPWEBROOT']."/provisioning"); -} - -if(!is_link($amp_conf['AMPWEBROOT'].'/admin/assets/endpointman')) { - $endpoint->rmrf($amp_conf['AMPWEBROOT'].'/admin/assets/endpointman'); -} \ No newline at end of file From 4024bfce19943d88268a9a53f1d60fc999047168 Mon Sep 17 00:00:00 2001 From: vsc55 Date: Sat, 20 Feb 2016 22:37:51 +0100 Subject: [PATCH 415/623] More Fix OOS Advanced Settings --- Endpointman.class.php | 378 +++++++++++++++++- assets/css/epm_advanced.css | 115 ++++-- assets/js/epm_advanced.js | 282 ++++++++++++- assets/js/epm_global.js | 12 + module.xml | 3 +- views/epm_advanced/poce.views.bootnav.php | 9 +- views/epm_advanced/poce.views.file_list.php | 7 - .../epm_advanced/poce.views.file_list_sql.php | 9 - .../poce.views.file_list_template.php | 7 - views/epm_advanced_iedl.page.php | 4 +- views/epm_advanced_manual_upload.page.php | 150 +++---- views/epm_advanced_poce.page.php | 292 ++++---------- 12 files changed, 852 insertions(+), 416 deletions(-) delete mode 100644 views/epm_advanced/poce.views.file_list.php delete mode 100644 views/epm_advanced/poce.views.file_list_sql.php delete mode 100644 views/epm_advanced/poce.views.file_list_template.php diff --git a/Endpointman.class.php b/Endpointman.class.php index 5fd0ab54..4d9f5355 100644 --- a/Endpointman.class.php +++ b/Endpointman.class.php @@ -129,6 +129,9 @@ public function chownFreepbx() { $files[] = array('type' => 'file', 'path' => $modulesdir . '/_ep_phone_modules/setup.php', 'perms' => 0755); + $files[] = array('type' => 'dir', + 'path' => '/tftpboot', + 'perms' => 0755); return $files; } @@ -155,6 +158,10 @@ public function ajaxRequest($req, &$setting) { case "oui": case "oui_add": case "oui_del": + case "poce_select": + case "poce_select_file": + case "poce_save_file": + case "poce_save_as_file": case "saveconfig": $setting['authenticate'] = true; $setting['allowremote'] = false; @@ -320,6 +327,28 @@ public function ajaxHandler() { } //$retarr['txt'] = $txt['settings']; } + elseif ($module_tab == "poce") { + switch ($command) + { + case "poce_select": + $retarr = $this->epm_advanced_poce_select(); + break; + + case "poce_select_file": + $retarr = $this->epm_advanced_poce_select_file(); + break; + + case "poce_save_file": + case "poce_save_as_file": + $retarr = $this->epm_advanced_poce_save_file(); + break; + + default: + $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); + break; + } + //$retarr['txt'] = $txt['settings']; + } else { $retarr = array("status" => false, "message" => _("Tab is not valid!") . " [" .$module_tab. "]"); } @@ -681,6 +710,333 @@ private function epm_config_manual_install($install_type = "", $package ="") + + + + + + + + + + + + + + + + + + + + + + + + + /************************************************************ + **** FUNCIONES SEC MODULO "epm_advanced\poce". **** + ***********************************************************/ + + public function epm_advanced_poce_select() + { + if (! isset($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("No send Product Select!")); + } + elseif (! is_numeric($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("Product Select send is not number!")); + } + elseif ($_REQUEST['product_select'] < 0) { + $retarr = array("status" => false, "message" => _("Product Select send is number not valid!")); + } + else + { + $dget['product_select'] = $_REQUEST['product_select']; + + $sql = 'SELECT * FROM `endpointman_product_list` WHERE `hidden` = 0 AND `id` = '.$dget['product_select']; + $product_select_info = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id ='" . $dget['product_select'] . "'"; + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + $config_files = explode(",", $row['config_files']); + $i = 0; + $file_list = ""; + foreach ($config_files as $config_files_data) { + $file_list[$i]['value'] = $i; + $file_list[$i]['text'] = $config_files_data; + $i++; + } + + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $dget['product_select'] . "'"; + $res = sql($sql,'getAll', DB_FETCHMODE_ASSOC); + $i = 0; + if (count($res)) { + $data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach ($data as $row2) { + $sql_file_list[$i]['value'] = $row2['id']; + $sql_file_list[$i]['text'] = $row2['name']; + $sql_file_list[$i]['ref'] = $row2['original_name']; + $i++; + } + } else { + $sql_file_list = NULL; + } + require_once($this->PHONE_MODULES_PATH . 'setup.php'); + + $class = "endpoint_" . $row['directory'] . "_" . $row['cfg_dir'] . '_phone'; + $base_class = "endpoint_" . $row['directory'] . '_base'; + $master_class = "endpoint_base"; + + /********************************************************************************* + *** Quick Fix for FreePBX Distro + *** I seriously want to figure out why ONLY the FreePBX Distro can't do autoloads. + **********************************************************************************/ + if (!class_exists($master_class)) { + ProvisionerConfig::endpointsAutoload($master_class); + } + if (!class_exists($base_class)) { + ProvisionerConfig::endpointsAutoload($base_class); + } + if (!class_exists($class)) { + ProvisionerConfig::endpointsAutoload($class); + } + //end quick fix + + $phone_config = new $class(); + + //TODO: remove + $template_file_list[0]['value'] = "template_data_custom.xml"; + $template_file_list[0]['text'] = "template_data_custom.xml"; + + $sql = "SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE '1-2' AND `enabled` = 1 AND `hidden` = 0"; + $data = sql($sql, 'getall', DB_FETCHMODE_ASSOC); + $i = 1; + foreach ($data as $list) { + $template_file_list[$i]['value'] = "template_data_" . $list['model'] . "_custom.xml"; + $template_file_list[$i]['text'] = "template_data_" . $list['model'] . "_custom.xml"; + } + + $retarr = array("status" => true, "message" => "OK", "product_select" => $dget['product_select'], "product_select_info" => $product_select_info, "file_list" => $file_list, "template_file_list" => $template_file_list, "sql_file_list" => $sql_file_list); + unset($dget); + } + return $retarr; + } + + public function epm_advanced_poce_select_file() + { + if (! isset($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("No send Product Select!")); + } + elseif (! is_numeric($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("Product Select send is not number!")); + } + elseif ($_REQUEST['product_select'] < 0) { + $retarr = array("status" => false, "message" => _("Product Select send is number not valid!")); + } + elseif (! isset($_REQUEST['file_id'])) { + $retarr = array("status" => false, "message" => _("No send File ID!")); + } + elseif (! isset($_REQUEST['file_name'])) { + $retarr = array("status" => false, "message" => _("No send File Name!")); + } + elseif (! isset($_REQUEST['type_file'])) { + $retarr = array("status" => false, "message" => _("No send Type File!")); + } + else + { + $dget['product_select'] = $_REQUEST['product_select']; + $dget['file_name'] = $_REQUEST['file_name']; + $dget['file_id'] = $_REQUEST['file_id']; + $dget['type_file'] = $_REQUEST['type_file']; + + + if ($dget['type_file'] == "sql") { + $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $dget['file_id']; + $row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); + $config_data = $this->display_htmlspecialchars($row['data']); + + $save_as_name_value = $row['name']; + $filename = $row['original_name']; + $sendidt = $dget['file_id']; + $type = $dget['type_file']; + $location = "SQL"; + } + elseif ($dget['type_file'] == "file") { + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $config_files = explode(",", $row['config_files']); + $file = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $config_files[$dget['file_id']]; + + if (is_readable($file)) { + if(filesize($file)>0) { + $handle = fopen($file, "rb"); + $contents = fread($handle, filesize($file)); + fclose($handle); + $contents = $this->display_htmlspecialchars($contents); + } + else { + $contents = ""; + } + + $config_data = $contents; + $save_as_name_value = $config_files[$dget['file_id']]; + $filename = $config_files[$dget['file_id']]; + $sendidt = $dget['file_id']; + $type = $dget['type_file']; + $location = $file; + } + else { + $retarr = array("status" => false, "message" => _("File not readable, check the permission! ").$file); + } + } + elseif ($dget['type_file'] == "tfile") { + + $save_as_name_value =""; + $filename = $dget['file_name']; + $sendidt = ""; + $type = $dget['type_file']; + $location = "New ".$dget['file_name']; + $config_data = ""; + } + + + //$endpoint->tpl->assign("config_data", $row['data']); + //$endpoint->tpl->assign("save_as_name_value", $row['name']); + //$endpoint->tpl->assign("filename", $row['original_name']); + //$endpoint->tpl->assign('sendid', $_REQUEST['sql']); + //$endpoint->tpl->assign("type", 'sql'); + + + $retarr = array("status" => true, + "message" => "OK", + "product_select" => $dget['product_select'], + "config_data" => $config_data, + "save_as_name_value" => $save_as_name_value, + "sendidt" => $sendidt, + "type" => $type, + "location" => $location); + + unset($dget); + } + return $retarr; + } + + function epm_advanced_poce_sendid() + { + $dget['type_file'] = $_REQUEST['type_file']; + $dget['sendid'] = $_REQUEST['sendid']; + $dget['product_select'] = $_REQUEST['product_select']; + + + + if ($dget['type_file'] == "sql") { + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; + $row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); + + $this->submit_config($row['directory'], $row['cfg_dir'], $row_original['original_name'], $row_original['data']); + $retarr = array("status" => true, "message" => "Sent! Thanks :-)"); + } + elseif ($dget['type_file'] == "file") { + $error = $this->submit_config($row['directory'], $row['cfg_dir'], $config_files[$_REQUEST['file']], $contents); + $retarr = array("status" => true, "message" => "Sent! Thanks :-)"); + } + else { + $retarr = array("status" => false, "message" => "Type not valid!"); + } + return $retarr; + } + + function epm_advanced_poce_save_file() + { + if (! isset($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("No send Product Select!")); + } + elseif (! isset($_REQUEST['type_file'])) { + $retarr = array("status" => false, "message" => _("No send Type File!")); + } + elseif (! isset($_REQUEST['config_text'])) { + $retarr = array("status" => false, "message" => _("No send Text File!")); + } + elseif (! isset($_REQUEST['save_as_name'])) { + $retarr = array("status" => false, "message" => _("No send Save Name!")); + } + elseif (! isset($_REQUEST['file'])) { + $retarr = array("status" => false, "message" => _("No send Name File!")); + } + else + { + $dget['command'] = $_REQUEST['command']; + $dget['type_file'] = $_REQUEST['type_file']; + $dget['product_select'] = $_REQUEST['product_select']; + $dget['config_text'] = $_REQUEST['config_text']; + $dget['save_as_name'] = $_REQUEST['save_as_name']; + $dget['file'] = $_REQUEST['file']; + + + if ($dget['type_file'] == "sql") { + + if ($dget['command'] == "poce_save_file") { + $sql = "UPDATE endpointman_custom_configs SET data = '" . addslashes($dget['config_text']) . "' WHERE id = " . $dget['product_select']; + sql($sql); + $retarr = array("status" => true, "message" => "Saved to Database!"); + } + elseif ($dget['command'] == "poce_save_as_file") { + $sql = 'SELECT original_name FROM endpointman_custom_configs WHERE id = ' . $dget['product_select']; + $file_name = sql($sql, 'getOne'); + + $sql = "INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ('" . addslashes($dget['save_as_name']) . "','" . addslashes($dget['file']) . "','" . $dget['product_select'] . "','" . addslashes($dget['config_text']) . "')"; + sql($sql); + $retarr = array("status" => true, "message" => "Saved to Database!"); + } + else { $retarr = array("status" => false, "message" => "Command not valid!"); } + + } + elseif (($dget['type_file'] == "file") || ($dget['type_file'] == "tfile")) + { + if ($dget['command'] == "poce_save_file") { + $wfh = fopen($dget['file'], 'w'); + fwrite($wfh, $dget['config_text']); + fclose($wfh); + $retarr = array("status" => true, "message" => "Saved to Hard Drive!"); + } + elseif ($dget['command'] == "poce_save_as_file") { + $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("' . addslashes($dget['save_as_name']) . '","' . addslashes($dget['file']) . '","' . $dget['product_select'] . '","' . addslashes($dget['config_text']) . '")'; + sql($sql); + $retarr = array("status" => true, "message" => "Saved to Database!"); + } + else { + $retarr = array("status" => false, "message" => "Command not valid!"); + } + } + else { + $retarr = array("status" => false, "message" => "Type not valid!"); + } + + $retarr['file'] = $dget['file']; + $retarr['save_as_name'] = $dget['save_as_name']; + unset($dget); + } + return $retarr; + } + + /******************** + * END SEC FUNCTIONS * + ********************/ + + + + + + + + + + + + + + /************************************************************ @@ -904,11 +1260,6 @@ public function epm_advanced_manual_upload_export_brans_available() - - - - - /*************************************************** **** FUNCIONES SEC MODULO "epm_advanced\iedl". **** **************************************************/ @@ -927,7 +1278,6 @@ public function epm_advanced_iedl_export($sFileName = "devices_list.csv") exit; } - //Dave B's Q&D file upload security code (http://us2.php.net/manual/en/features.file-upload.php) public function epm_advanced_iedl_import() { @@ -1076,9 +1426,6 @@ private function epm_advanced_oui_add() - - - /****************************************************** **** FUNCIONES SEC MODULO "epm_advanced\settings". **** ******************************************************/ @@ -1246,11 +1593,6 @@ private function epm_advanced_settings_saveconfig () - - - - - /*************************************************** **** FUNCIONES SEC MODULO "epm_config\manager". **** ***************************************************/ @@ -1462,14 +1804,6 @@ public function epm_config_manager_hardware_get_list_all($check_for_updates = tr - - - - - - - - /************************************************** **** FUNCIONES SEC MODULO "epm_config\editor". **** **************************************************/ diff --git a/assets/css/epm_advanced.css b/assets/css/epm_advanced.css index 9b82d8dd..bd963481 100644 --- a/assets/css/epm_advanced.css +++ b/assets/css/epm_advanced.css @@ -50,20 +50,20 @@ /* -------------------- Select Box Styles: bavotasan.com Method (with special adaptations by ericrasch.com) */ /* -------------------- Source: http://bavotasan.com/2011/style-select-box-using-only-css/ */ -#AddDlgModal .styled-select +.styled-select { background: url(../images/15xvbd5.png) no-repeat 96% 0; background-color: #3b8ec2; height: 35px; overflow: hidden; - /*width: 240px;*/ + width: 240px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } -#AddDlgModal .styled-select select +.styled-select select { background: transparent; border: none; @@ -71,59 +71,31 @@ font-size: 14px; height: 35px; padding: 5px; /* If you add too much padding here, the options won't show in IE */ - /*width: 268px;*/ -} - -#AddDlgModal .styled-select -{ - width: 240px; -} - -#AddDlgModal .styled-select select -{ - width: 268px; + width: 268px; } - - +#AddDlgModal .styled-select { width: 240px; } +#AddDlgModal .styled-select select { width: 268px; } #manual_upload .styled-select { - background: url(../images/15xvbd5.png) no-repeat 96% 0; - background-color: #3b8ec2; height: 29px; - overflow: hidden; - /*width: 240px;*/ width: 400px; - - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; } #manual_upload .styled-select select { - background: transparent; - border: none; - color: #fff; - font-size: 14px; height: 29px; - padding: 5px; /* If you add too much padding here, the options won't show in IE */ - /*width: 268px;*/ - width: 428px; } - - - -#iedl .custom_box_import_csv div.col-md-9 { +.custom_box_import div.col-md-9 { display: table; } -#iedl .custom_box_import_csv div.col-md-9 span { +.custom_box_import div.col-md-9 span { display: table-cell; margin: 0px; padding: 0px 0px 0px 10px; @@ -131,16 +103,75 @@ -#manual_upload .custom_box_import div.col-md-9 { - display: table; + + + + +.pull-xs-right +{ + float: right; } -#manual_upload .custom_box_import div.col-md-9 span { - display: table-cell; - margin: 0px; - padding: 0px 0px 0px 10px; + +#poce .dropdown-menu { + width: 100%; + background-color: #d7ebf9; } +#poce .dropdown-item +{ + display: block; + width: 100%; + padding-top: 3px; + padding-right: 20px; + padding-bottom: 3px; + padding-left: 20px; + clear: both; + font-weight: 400; + line-height: 1.5; + color: #373a3c; + text-align: inherit; + white-space: nowrap; + + background-color: transparent; + background-image: none; + background-repeat: repeat; + background-attachment: scroll; + background-position: 0px 0px; + background-clip: border-box; + background-origin: padding-box; + background-size: auto auto; + + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width: 0px; + + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + + border-image-source: none; + border-image-slice: 100% 100% 100% 100%; + border-image-width: 1 1 1 1; + border-image-outset: 0 0 0 0; + border-image-repeat: stretch stretch; +} +#poce .dropdown-item:focus, #poce .dropdown-item:hover +{ + color: #2b2d2f; + text-decoration-line: none; + text-decoration-style: solid; + background-color: #f5f5f5; +} +#poce .dropdown-item:focus, #poce .dropdown-item:hover +{ + color: #2b2d2f; + text-decoration-line: none; + text-decoration-style: solid; + background-color: #f5f5f5; +} diff --git a/assets/js/epm_advanced.js b/assets/js/epm_advanced.js index a1054c9c..c14540b5 100644 --- a/assets/js/epm_advanced.js +++ b/assets/js/epm_advanced.js @@ -22,16 +22,18 @@ $(document).ready(function() { //TAB POCE - //Demo: http://files.aw20.net/jquery-linedtextarea/jquery-linedtextarea.html - //http://alan.blog-city.com/jquerylinedtextarea.htm //$("#config_textarea").linedtextarea(); - //activar al serleccionar archivo, si se pone en el general javascript entra en bucle y no termina. - //TAB IEDL //TAB MANUAL_UPLOAD + $('#manual_upload a.collapse-item').on("click", function(){ + epm_global_html_css_name(this,"auto","active"); + $(this).blur(); + }); + + }); @@ -211,7 +213,279 @@ function epm_config_tab_iedl_bt_import() + + + + + + + + + + + + + + + + + + + + + + + + + /**** INI: FUNCTION TAB POCE ****/ + + + + +function epm_advanced_tab_poce_select_product(idsel) +{ + if ($.isNumeric(idsel) == false) { return; } + $("div.list-group>a.active").removeClass("active"); + $("#list_product_"+idsel).addClass("active").blur(); + + $.ajax({ + type: 'POST', + url: "ajax.php", + data: { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "poce", + command: "poce_select", + product_select: idsel + }, + dataType: 'json', + timeout: 60000, + error: function(xhr, ajaxOptions, thrownError) { + fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); + return false; + }, + success: function(data) { + + $("#poce_file_name_path").text("No Selected"); + $("#config_textarea").text(""); + $('#config_textarea').prop('readonly', true); + + $("#box_bt_save").hide("slow"); + $("#box_bt_share").hide("slow"); + $("#box_bt_save_as").hide("slow"); + $("#save_as_name").val(""); + + if (data.status == true) { + epm_advanced_tab_poce_create_file_list("#select_product_list_files_config", data.file_list, data.product_select, "file"); + epm_advanced_tab_poce_create_file_list("#select_product_list_files_template_custom", data.template_file_list, data.product_select, "tfile"); + epm_advanced_tab_poce_create_file_list("#select_product_list_files_user_config", data.sql_file_list, data.product_select, "sql"); + + $("#poce_NameProductSelect").text(data.product_select_info.long_name); + fpbxToast('Load date Done!', '', 'success'); + return true; + } + else { + epm_advanced_tab_poce_create_file_list("#select_product_list_files_config", "Error"); + epm_advanced_tab_poce_create_file_list("#select_product_list_files_template_custom", "Error"); + epm_advanced_tab_poce_create_file_list("#select_product_list_files_user_config", "Error"); + + $("#poce_NameProductSelect").text("Error get data!"); + + fpbxToast(data.message, data.txt.error, 'error'); + return false; + } + }, + }); +} + + +function epm_advanced_tab_poce_create_file_list(idname, data = "", product_select = "", typefile="") +{ + $(idname + " div.dropdown-menu").empty(); + + if (Array.isArray(data) == false) + { + $(idname + " span.label").text(0); + if (data == null) { data = "Emtry"; } + $(idname + " div.dropdown-menu") + .append( + $('', { 'href' : '#', 'class' : 'dropdown-item disable' }).text(data) + ) + return; + } + + $(idname + " span.label").text(data.length); + $(data).each(function(index, itemData) + { + $(idname + " div.dropdown-menu") + .append( + $('', { + 'href' : 'javascript:epm_advanced_tab_poce_select_file_edit("'+ product_select +'", "'+ itemData.text +'", "'+ itemData.value +'", "'+ typefile +'");', + 'class' : 'dropdown-item bt' + }) + .text(itemData.text) + ) + }); + return; +} + + +function epm_advanced_tab_poce_select_file_edit (idpro_select, txtnamefile, idnamefile, typefile) +{ + $.ajax({ + type: 'POST', + url: "ajax.php", + data: { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "poce", + command: "poce_select_file", + product_select: idpro_select, + file_id : idnamefile, + file_name : txtnamefile, + type_file : typefile + }, + dataType: 'json', + timeout: 60000, + error: function(xhr, ajaxOptions, thrownError) { + fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); + $("#poce_file_name_path").text("Error ajax!"); + $("#config_textarea").text(""); + $('#config_textarea').prop('readonly', true); + $("#box_bt_save").hide("slow"); + $("#box_bt_share").hide("slow"); + $("#box_bt_save_as").hide("slow"); + $("#save_as_name").val(""); + return false; + }, + success: function(data) { + if (data.status == true) { + $("#poce_file_name_path").text(data.location); + $('#config_textarea').prop('readonly', false); + $("#config_textarea").text(data.config_data); + + if (data.type == "file") { + $("#box_bt_save").show("slow"); + $("#box_bt_share").show("slow"); + $("#box_bt_save_as").hide("slow"); + $("#save_as_name").val(""); + } + else if (data.type == "tfile") { + $("#box_bt_save").show("slow"); + $("#box_bt_save_as").show("slow"); + $("#save_as_name").val(data.save_as_name_value); + $("#box_bt_share").show("slow"); + } + else if (data.type == "sql") { + $("#box_bt_save").show("slow"); + $("#box_bt_share").show("slow"); + $("#box_bt_save_as").show("slow"); + $("#save_as_name").val(data.save_as_name_value); + } + + //$("#config_textarea").linedtextarea(); + + fpbxToast('File Load date Done!', '', 'success'); + return true; + } + else { + $("#poce_file_name_path").text("Error obteniendo datos!"); + $("#config_textarea").text(""); + $('#config_textarea').prop('readonly', true); + $("#box_bt_save").hide("slow"); + $("#box_bt_share").hide("slow"); + $("#box_bt_save_as").hide("slow"); + $("#save_as_name").val(""); + + fpbxToast(data.message, data.txt.error, 'error'); + return false; + } + }, + }); + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +function epm_advanced_tab_poce_create_sql_file_list(data = "", product_select = "") +{ + $("#select_product_list_files_user_config div.dropdown-menu").empty(); + + if (Array.isArray(data) == true) + { + $("#select_product_list_files_user_config span.label").text(data.length); + $(data).each(function(index, itemData) + { + $("#select_product_list_files_user_config div.dropdown-menu") + .append( + $('', { 'href' : 'config.php?display=epm_advanced&subpage=poce&product_select='+product_select+'&sql='+itemData.value }) + .append( + $('', { 'style' : 'font-size: 0.8em' }).text(itemData.text) + ) + ) + .append( + $('', { 'href' : 'config.php?display=epm_advanced&subpage=poce&product_select='+product_select+'&sql='+itemData.value+'&delete=yes' }) + .append( + $('', { 'class' : 'fa fa-trash-o', 'alt' : 'Delete' }) + ) + ) + .append( $('
      ', {}) ) + .append( + $('', { 'style' : 'font-size:0.8em' }) + .text("ref:") + .append( + $('', { }) + .text(itemData.ref) + ) + ) + .append( $('
      ', {}) ); + }); + } + else + { + $("#select_product_list_files_user_config span.label").text(0); + if (data == null) { data = "Emtry"; } + $("#select_product_list_files_user_config div.dropdown-menu") + .append( + $('', { 'style' : 'font-size: 0.8em' }).text(data) + ) + .append( $('
      ', {}) ); + } +} + + + + + + + /**** END: FUNCTION TAB POCE ****/ diff --git a/assets/js/epm_global.js b/assets/js/epm_global.js index 995811a9..8523caf1 100644 --- a/assets/js/epm_global.js +++ b/assets/js/epm_global.js @@ -22,6 +22,18 @@ function epm_global_html_find_show_hide(name, bShow, tDelay = 1, slow = false) } } +function epm_global_html_css_name(name, bStatus, classname) +{ + if ($(name).length > 0) { + if (bStatus == true) { $(name).addClass(classname); } + else if (bStatus == false) { $(name).removeClass(classname); } + else if (bStatus == "auto") { + if($(name).hasClass(classname)) { $(name).removeClass(classname); } + else { $(name).addClass(classname); } + } + } +} + function epm_global_get_tab_actual() { var sTab = ""; diff --git a/module.xml b/module.xml index 6344325c..239e771f 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman unsupported OSS PBX End Point Manager - 13.0.5 + 13.0.5.1 setup Connectivity GPLv2+ @@ -21,6 +21,7 @@ Pull Requests can be made to either of these and are encouraged. + *13.0.5.1* More Fix OOS Advanced Setting *13.0.5* Missing updated file *13.0.4* Fixes online check, Updates from Community member Javier Pastor Garcia *13.0.3* Fixes check online diff --git a/views/epm_advanced/poce.views.bootnav.php b/views/epm_advanced/poce.views.bootnav.php index 7d51f226..7ac2ea06 100644 --- a/views/epm_advanced/poce.views.bootnav.php +++ b/views/epm_advanced/poce.views.bootnav.php @@ -1,9 +1,16 @@   '.substr($srow['long_name'], 0, 40).(strlen($srow['long_name']) > 40 ? "..." : "").'
      '; + + + + + /* if ((isset($request['product_select'])) AND ($request['product_select'] == $srow['id'])) { $srow['tselected'] = 1; - } + } echo '  '.substr($srow['long_name'], 0, 40).(strlen($srow['long_name']) > 40 ? "..." : "").''; + */ } ?> \ No newline at end of file diff --git a/views/epm_advanced/poce.views.file_list.php b/views/epm_advanced/poce.views.file_list.php deleted file mode 100644 index ca4976de..00000000 --- a/views/epm_advanced/poce.views.file_list.php +++ /dev/null @@ -1,7 +0,0 @@ -"._("Local File Configs")."

      "; - foreach ($file_list as $row) { - echo ''.$row['text'].'
      '; - } - echo "


      "; -?> \ No newline at end of file diff --git a/views/epm_advanced/poce.views.file_list_sql.php b/views/epm_advanced/poce.views.file_list_sql.php deleted file mode 100644 index 26e5cccf..00000000 --- a/views/epm_advanced/poce.views.file_list_sql.php +++ /dev/null @@ -1,9 +0,0 @@ -"._("User File Configs").""; - foreach ($sql_file_list as $row) { - echo ''.$row['text'].''; - echo ''; - echo '
      '; - echo ' [ref: '.$row['ref'].']
      '; - } -?> \ No newline at end of file diff --git a/views/epm_advanced/poce.views.file_list_template.php b/views/epm_advanced/poce.views.file_list_template.php deleted file mode 100644 index 84b75aca..00000000 --- a/views/epm_advanced/poce.views.file_list_template.php +++ /dev/null @@ -1,7 +0,0 @@ -"._("Custom Template Files").""; - foreach ($template_file_list as $row) { - echo ''.$row['text'].'
      '; - } - echo "


      "; -?> \ No newline at end of file diff --git a/views/epm_advanced_iedl.page.php b/views/epm_advanced_iedl.page.php index d3006304..6822b2f9 100644 --- a/views/epm_advanced_iedl.page.php +++ b/views/epm_advanced_iedl.page.php @@ -34,7 +34,7 @@

      -
      +
      @@ -43,7 +43,7 @@
      -
      +
      diff --git a/views/epm_advanced_manual_upload.page.php b/views/epm_advanced_manual_upload.page.php index c97d1fea..429470db 100644 --- a/views/epm_advanced_manual_upload.page.php +++ b/views/epm_advanced_manual_upload.page.php @@ -25,14 +25,12 @@
      - -
      @@ -77,11 +75,9 @@
      - - brands_available("",false); - $path_tmp_dir = FreePBX::Endpointman()->PHONE_MODULES_PATH."/temp/export/"; + $path_tmp_dir = FreePBX::Endpointman()->PHONE_MODULES_PATH."temp/export/"; $array_list_files = array(); $array_list_exception= array(".", "..", ".htaccess"); @@ -89,39 +85,42 @@ { if(is_dir($path_tmp_dir)) { - if($dir = opendir($path_tmp_dir)) - { - while(($archivo = readdir($dir)) !== false) - { - if (in_array($archivo, $array_list_exception)) { continue; } - $pathandfile = $path_tmp_dir.$archivo; - $array_list_files[] = array("pathall" => $pathandfile, - "path" => $path_tmp_dir, - "file" => $archivo, - "filename" => pathinfo($archivo, PATHINFO_FILENAME), - "extension" => pathinfo($archivo, PATHINFO_EXTENSION), - "mime_type" => mime_content_type($pathandfile), - "is_dir" => is_dir($pathandfile), - "is_file" => is_file($pathandfile), - "is_link" => is_link($pathandfile), - "readlink" => (is_link($pathandfile) == true ? readlink ($pathandfile) : NULL)); - } - closedir($dir); + $l_files = scandir($path_tmp_dir, 1); + foreach ($l_files as $archivo) { + if (in_array($archivo, $array_list_exception)) { continue; } + $pathandfile = $path_tmp_dir.$archivo; + $brand = substr(pathinfo($archivo, PATHINFO_FILENAME), 0, -11); + $ftime = substr(pathinfo($archivo, PATHINFO_FILENAME), -10); + + $array_list_files[$brand][] = array("brand" => $brand, + "pathall" => $pathandfile, + "path" => $path_tmp_dir, + "file" => $archivo, + "filename" => pathinfo($archivo, PATHINFO_FILENAME), + "extension" => pathinfo($archivo, PATHINFO_EXTENSION), + "timer" => $ftime, + "mime_type" => mime_content_type($pathandfile), + "is_dir" => is_dir($pathandfile), + "is_file" => is_file($pathandfile), + "is_link" => is_link($pathandfile), + "readlink" => (is_link($pathandfile) == true ? readlink ($pathandfile) : NULL)); } + unset ($l_files); } } + natsort($array_list_files); ?>

      -
      +
      -
      +
      @@ -170,19 +169,36 @@
      -
      -   '._("Empty list.").'
      '; - } - else { - foreach ($array_list_files as $itemlist) { - echo '  '.$itemlist['pathall'].''; +
      +
      @@ -200,66 +216,4 @@ unset ($brand_ava); unset ($path_tmp_dir); unset ($array_list_files); -?> - - - - - - - - - - - - - - - - - - - - \ No newline at end of file +?> \ No newline at end of file diff --git a/views/epm_advanced_poce.page.php b/views/epm_advanced_poce.page.php index 42db521c..ab3d77ff 100644 --- a/views/epm_advanced_poce.page.php +++ b/views/epm_advanced_poce.page.php @@ -3,180 +3,6 @@ $request = $_REQUEST; - if (isset($_REQUEST['product_select'])) { - $product_select = $_REQUEST['product_select']; - - $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id ='" . $product_select . "'"; - $row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - $config_files = explode(",", $row['config_files']); - $i = 0; - foreach ($config_files as $config_files_data) { - $file_list[$i]['value'] = $i; - $file_list[$i]['text'] = $config_files_data; - $i++; - } - - $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $product_select . "'"; - $res = sql($sql,'getAll', DB_FETCHMODE_ASSOC); - $i = 0; - if (count($res)) { - $data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - foreach ($data as $row2) { - $sql_file_list[$i]['value'] = $row2['id']; - $sql_file_list[$i]['text'] = $row2['name']; - $sql_file_list[$i]['ref'] = $row2['original_name']; - $i++; - } - } else { - $sql_file_list = NULL; - } - require_once(FreePBX::Endpointman()->PHONE_MODULES_PATH . 'setup.php'); - - $class = "endpoint_" . $row['directory'] . "_" . $row['cfg_dir'] . '_phone'; - $base_class = "endpoint_" . $row['directory'] . '_base'; - $master_class = "endpoint_base"; - - /********************************************************************************* - *** Quick Fix for FreePBX Distro - *** I seriously want to figure out why ONLY the FreePBX Distro can't do autoloads. - **********************************************************************************/ - if (!class_exists($master_class)) { - ProvisionerConfig::endpointsAutoload($master_class); - } - if (!class_exists($base_class)) { - ProvisionerConfig::endpointsAutoload($base_class); - } - if (!class_exists($class)) { - ProvisionerConfig::endpointsAutoload($class); - } - //end quick fix - - $phone_config = new $class(); - - //TODO: remove - $template_file_list[0]['value'] = "template_data_custom.xml"; - $template_file_list[0]['text'] = "template_data_custom.xml"; - - $sql = "SELECT model FROM `endpointman_model_list` WHERE `product_id` LIKE '1-2' AND `enabled` = 1 AND `hidden` = 0"; - $data = sql($sql, 'getall', DB_FETCHMODE_ASSOC); - $i = 1; - foreach ($data as $list) { - $template_file_list[$i]['value'] = "template_data_" . $list['model'] . "_custom.xml"; - $template_file_list[$i]['text'] = "template_data_" . $list['model'] . "_custom.xml"; - } - - if (isset($_REQUEST['temp_file'])) { - $temp_file_tpl = 1; - } else { - $temp_file_tpl = NULL; - } - } - - - - - - - if (isset($_REQUEST['file'])) { - $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $_REQUEST['product_select'] . "'"; - $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $config_files = explode(",", $row['config_files']); - $file = FreePBX::Endpointman()->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $config_files[$_REQUEST['file']]; - if (isset($_REQUEST['config_text'])) { - if (isset($_REQUEST['button_save'])) { - $wfh = fopen($file, 'w'); - fwrite($wfh, $_REQUEST['config_text']); - fclose($wfh); - //$endpoint->message['poce'] = "Saved to Hard Drive!"; -echo "Saved to Hard Drive!"; - } elseif (isset($_REQUEST['button_save_as'])) { - $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ("' . addslashes($_REQUEST['save_as_name']) . '","' . addslashes($config_files[$_REQUEST['file']]) . '","' . $_REQUEST['product_select'] . '","' . addslashes($_REQUEST['config_text']) . '")'; - sql($sql); - //$endpoint->message['poce'] = "Saved to Database!"; -echo "Saved to Database!"; - } - } - - $handle = fopen($file, "rb"); - $contents = fread($handle, filesize($file)); - fclose($handle); - - if (isset($_REQUEST['sendid'])) { - $error = FreePBX::Endpointman()->submit_config($row['directory'], $row['cfg_dir'], $config_files[$_REQUEST['file']], $contents); - //$endpoint->message['poce'] = 'Sent! Thanks :-)'; -echo 'Sent! Thanks :-)'; - } - - $contents = FreePBX::Endpointman()->display_htmlspecialchars($contents); - $config_data = $contents; - //$endpoint->tpl->assign("config_data", $contents); - - $save_as_name_value = $config_files[$_REQUEST['file']]; - //$endpoint->tpl->assign("save_as_name_value", $config_files[$_REQUEST['file']]); - - $filename = $config_files[$_REQUEST['file']]; - //$endpoint->tpl->assign("filename", $config_files[$_REQUEST['file']]); - - $sendidt = $_REQUEST['file']; - //$endpoint->tpl->assign('sendid', $_REQUEST['file']); - - $type = 'file'; - //$endpoint->tpl->assign("type", 'file'); - - $location = $file; - //$endpoint->tpl->assign("location", $file); - - - - - } elseif (isset($_REQUEST['sql'])) { - if (isset($_REQUEST['config_text'])) { - if (isset($_REQUEST['button_save'])) { - $sql = "UPDATE endpointman_custom_configs SET data = '" . addslashes($_REQUEST['config_text']) . "' WHERE id = " . $_REQUEST['sql']; - sql($sql); - //$endpoint->message['poce'] = "Saved to Database!"; -echo "Saved to Database!"; - } elseif (isset($_REQUEST['button_save_as'])) { - $sql = 'SELECT original_name FROM endpointman_custom_configs WHERE id = ' . $_REQUEST['sql']; - $file_name = sql($sql, 'getOne'); - - $sql = "INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES ('" . addslashes($_REQUEST['save_as_name']) . "','" . addslashes($file_name) . "','" . $_REQUEST['product_select'] . "','" . addslashes($_REQUEST['config_text']) . "')"; - sql($sql); - //$endpoint->message['poce'] = "Saved to Database!"; -echo "Saved to Database!"; - } - } - $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $_REQUEST['sql']; - $row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - - if (isset($_REQUEST['sendid'])) { - $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $_REQUEST['product_select'] . "'"; - $row22 = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - FreePBX::Endpointman()->submit_config($row22['directory'], $row22['cfg_dir'], $row['original_name'], $row['data']); - //$endpoint->message['poce'] = 'Sent! Thanks! :-)'; -echo 'Sent! Thanks! :-)'; - } - - $row['data'] = FreePBX::Endpointman()->display_htmlspecialchars($row['data']); - $config_data = $row['data']; - //$endpoint->tpl->assign("config_data", $row['data']); - - $save_as_name_value = $row['name']; - //$endpoint->tpl->assign("save_as_name_value", $row['name']); - - $filename = $row['original_name']; - //$endpoint->tpl->assign("filename", $row['original_name']); - - $sendidt = $_REQUEST['sql']; - //$endpoint->tpl->assign('sendid', $_REQUEST['sql']); - - $type = 'sql'; - //$endpoint->tpl->assign("type", 'sql'); - } - - - if (isset($_REQUEST['delete'])) { $sql = "DELETE FROM endpointman_custom_configs WHERE id =" . $_REQUEST['sql']; sql($sql); @@ -185,50 +11,92 @@ ?> - +
      -
      -

      Product:

      -

      File:

      -
      +
      +
      +
      + + +
      +


      +
      -
      -
      -
      -
      -

      -

      -

      - - NOTE: File may be over-written during next package update. We suggest also using the Share button below to improve the next release. +

      +
      + + +
      +


      +
      +
      +
      + + +
      +


      +
      +
      + +
      +

      Product:

      +

      File:

      +

      +
      +
      +
      + + + + +

      + - -

      - - "> - NOTE: File is permanently saved and not over-written during next package update. +

      - - -

      +

      - -
      +
      - +
      +
      -
      0'; + $sql = 'SELECT * FROM `endpointman_product_list` WHERE (`hidden` = 0 AND `id` > 0) ORDER BY long_name ASC'; $product_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $content = load_view(__DIR__.'/epm_advanced/poce.views.bootnav.php', array('request' => $request, 'product_list' => $product_list)); @@ -238,33 +106,11 @@ unset ($sql); ?>
      - - 0) or (count($template_file_list) > 0) or (count($sql_file_list) > 0)) { echo "

      "; } - if (count($file_list) > 0) { - echo load_view(__DIR__.'/epm_advanced/poce.views.file_list.php', array('request' => $request, 'file_list' => $file_list)); - } - if (count($template_file_list) > 0) { - echo load_view(__DIR__.'/epm_advanced/poce.views.file_list_template.php', array('request' => $request, 'template_file_list' => $template_file_list)); - } - if (count($sql_file_list) > 0) { - echo load_view(__DIR__.'/epm_advanced/poce.views.file_list_sql.php', array('request' => $request, 'sql_file_list' => $sql_file_list)); - } - ?>
      - - - - - - - - - ")); + } else if (stream.match("DOCTYPE", true, true)) { + stream.eatWhile(/[\w\._\-]/); + return chain(doctype(1)); + } else { + return null; + } + } else if (stream.eat("?")) { + stream.eatWhile(/[\w\._\-]/); + state.tokenize = inBlock("meta", "?>"); + return "meta"; + } else { + type = stream.eat("/") ? "closeTag" : "openTag"; + state.tokenize = inTag; + return "tag bracket"; + } + } else if (ch == "&") { + var ok; + if (stream.eat("#")) { + if (stream.eat("x")) { + ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); + } else { + ok = stream.eatWhile(/[\d]/) && stream.eat(";"); + } + } else { + ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); + } + return ok ? "atom" : "error"; + } else { + stream.eatWhile(/[^&<]/); + return null; + } + } + inText.isInText = true; + + function inTag(stream, state) { + var ch = stream.next(); + if (ch == ">" || (ch == "/" && stream.eat(">"))) { + state.tokenize = inText; + type = ch == ">" ? "endTag" : "selfcloseTag"; + return "tag bracket"; + } else if (ch == "=") { + type = "equals"; + return null; + } else if (ch == "<") { + state.tokenize = inText; + state.state = baseState; + state.tagName = state.tagStart = null; + var next = state.tokenize(stream, state); + return next ? next + " tag error" : "tag error"; + } else if (/[\'\"]/.test(ch)) { + state.tokenize = inAttribute(ch); + state.stringStartCol = stream.column(); + return state.tokenize(stream, state); + } else { + stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/); + return "word"; + } + } + + function inAttribute(quote) { + var closure = function(stream, state) { + while (!stream.eol()) { + if (stream.next() == quote) { + state.tokenize = inTag; + break; + } + } + return "string"; + }; + closure.isInAttribute = true; + return closure; + } + + function inBlock(style, terminator) { + return function(stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + state.tokenize = inText; + break; + } + stream.next(); + } + return style; + }; + } + function doctype(depth) { + return function(stream, state) { + var ch; + while ((ch = stream.next()) != null) { + if (ch == "<") { + state.tokenize = doctype(depth + 1); + return state.tokenize(stream, state); + } else if (ch == ">") { + if (depth == 1) { + state.tokenize = inText; + break; + } else { + state.tokenize = doctype(depth - 1); + return state.tokenize(stream, state); + } + } + } + return "meta"; + }; + } + + function Context(state, tagName, startOfLine) { + this.prev = state.context; + this.tagName = tagName; + this.indent = state.indented; + this.startOfLine = startOfLine; + if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent)) + this.noIndent = true; + } + function popContext(state) { + if (state.context) state.context = state.context.prev; + } + function maybePopContext(state, nextTagName) { + var parentTagName; + while (true) { + if (!state.context) { + return; + } + parentTagName = state.context.tagName; + if (!config.contextGrabbers.hasOwnProperty(parentTagName) || + !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { + return; + } + popContext(state); + } + } + + function baseState(type, stream, state) { + if (type == "openTag") { + state.tagStart = stream.column(); + return tagNameState; + } else if (type == "closeTag") { + return closeTagNameState; + } else { + return baseState; + } + } + function tagNameState(type, stream, state) { + if (type == "word") { + state.tagName = stream.current(); + setStyle = "tag"; + return attrState; + } else { + setStyle = "error"; + return tagNameState; + } + } + function closeTagNameState(type, stream, state) { + if (type == "word") { + var tagName = stream.current(); + if (state.context && state.context.tagName != tagName && + config.implicitlyClosed.hasOwnProperty(state.context.tagName)) + popContext(state); + if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) { + setStyle = "tag"; + return closeState; + } else { + setStyle = "tag error"; + return closeStateErr; + } + } else { + setStyle = "error"; + return closeStateErr; + } + } + + function closeState(type, _stream, state) { + if (type != "endTag") { + setStyle = "error"; + return closeState; + } + popContext(state); + return baseState; + } + function closeStateErr(type, stream, state) { + setStyle = "error"; + return closeState(type, stream, state); + } + + function attrState(type, _stream, state) { + if (type == "word") { + setStyle = "attribute"; + return attrEqState; + } else if (type == "endTag" || type == "selfcloseTag") { + var tagName = state.tagName, tagStart = state.tagStart; + state.tagName = state.tagStart = null; + if (type == "selfcloseTag" || + config.autoSelfClosers.hasOwnProperty(tagName)) { + maybePopContext(state, tagName); + } else { + maybePopContext(state, tagName); + state.context = new Context(state, tagName, tagStart == state.indented); + } + return baseState; + } + setStyle = "error"; + return attrState; + } + function attrEqState(type, stream, state) { + if (type == "equals") return attrValueState; + if (!config.allowMissing) setStyle = "error"; + return attrState(type, stream, state); + } + function attrValueState(type, stream, state) { + if (type == "string") return attrContinuedState; + if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;} + setStyle = "error"; + return attrState(type, stream, state); + } + function attrContinuedState(type, stream, state) { + if (type == "string") return attrContinuedState; + return attrState(type, stream, state); + } + + return { + startState: function(baseIndent) { + var state = {tokenize: inText, + state: baseState, + indented: baseIndent || 0, + tagName: null, tagStart: null, + context: null} + if (baseIndent != null) state.baseIndent = baseIndent + return state + }, + + token: function(stream, state) { + if (!state.tagName && stream.sol()) + state.indented = stream.indentation(); + + if (stream.eatSpace()) return null; + type = null; + var style = state.tokenize(stream, state); + if ((style || type) && style != "comment") { + setStyle = null; + state.state = state.state(type || style, stream, state); + if (setStyle) + style = setStyle == "error" ? style + " error" : setStyle; + } + return style; + }, + + indent: function(state, textAfter, fullLine) { + var context = state.context; + // Indent multi-line strings (e.g. css). + if (state.tokenize.isInAttribute) { + if (state.tagStart == state.indented) + return state.stringStartCol + 1; + else + return state.indented + indentUnit; + } + if (context && context.noIndent) return CodeMirror.Pass; + if (state.tokenize != inTag && state.tokenize != inText) + return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0; + // Indent the starts of attribute names. + if (state.tagName) { + if (config.multilineTagIndentPastTag !== false) + return state.tagStart + state.tagName.length + 2; + else + return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1); + } + if (config.alignCDATA && /$/, + blockCommentStart: "", + + configuration: config.htmlMode ? "html" : "xml", + helperType: config.htmlMode ? "html" : "xml", + + skipAttribute: function(state) { + if (state.state == attrValueState) + state.state = attrState + } + }; +}); + +CodeMirror.defineMIME("text/xml", "xml"); +CodeMirror.defineMIME("application/xml", "xml"); +if (!CodeMirror.mimeModes.hasOwnProperty("text/html")) + CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true}); + +}); diff --git a/i18n/endpointman.pot b/i18n/endpointman.pot index 3ffa2ee9..db8c9112 100644 --- a/i18n/endpointman.pot +++ b/i18n/endpointman.pot @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-17 22:47+0100\n" +"POT-Creation-Date: 2016-02-21 21:47+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -24,42 +24,42 @@ msgstr "" "X-Poedit-SearchPathExcluded-0: i18n\n" "X-Poedit-SearchPathExcluded-1: _old\n" -#: assets/js/epm_advanced.js:145 assets/js/epm_advanced.js:218 +#: assets/js/epm_advanced.js:162 assets/js/epm_advanced.js:218 #: assets/js/epm_config.js:312 assets/js/epm_config.js:361 msgid "Loading.." msgstr "" -#: Endpointman.class.php:107 +#: Endpointman.class.php:108 msgid "Configuration Directory is not writable!" msgstr "" -#: Endpointman.class.php:108 +#: Endpointman.class.php:109 msgid "Please change the location:" msgstr "" -#: Endpointman.class.php:108 Endpointman.class.php:115 -#: Endpointman.class.php:788 +#: Endpointman.class.php:109 Endpointman.class.php:116 +#: Endpointman.class.php:1317 msgid "Here" msgstr "" -#: Endpointman.class.php:109 +#: Endpointman.class.php:110 msgid "Or run this command on SSH:" msgstr "" -#: Endpointman.class.php:115 +#: Endpointman.class.php:116 msgid "" "Configuration Directory is not a directory or does not exist! Please " "change the location here:" msgstr "" -#: Endpointman.class.php:180 +#: Endpointman.class.php:190 msgid "" "If we can activate the model set terminals of the models.
      If this " "model is disabled will not appear in the list of models that can be " "configured for PBX." msgstr "" -#: Endpointman.class.php:181 +#: Endpointman.class.php:191 msgid "" "The button \"Install Firmware\" installs the necessary files to the " "server for the terminal alone are updated via TFTP or HTTP.
      The " @@ -69,7 +69,7 @@ msgid "" "appears when a new version of this model pack is detected." msgstr "" -#: Endpointman.class.php:182 +#: Endpointman.class.php:192 msgid "" "The \"Install\" button installs the configuration package brand models " "we selected.
      The \"Uninstall\" button removes the package " @@ -78,669 +78,780 @@ msgid "" "upgrade to the latest version is detected." msgstr "" -#: Endpointman.class.php:183 +#: Endpointman.class.php:193 msgid "New Package Modified" msgstr "" -#: Endpointman.class.php:184 +#: Endpointman.class.php:194 msgid "Package Last Modified" msgstr "" -#: Endpointman.class.php:185 +#: Endpointman.class.php:195 msgid "Check for Update " msgstr "" -#: Endpointman.class.php:186 +#: Endpointman.class.php:196 msgid "Check Online " msgstr "" -#: Endpointman.class.php:187 +#: Endpointman.class.php:197 msgid "Install" msgstr "" -#: Endpointman.class.php:188 +#: Endpointman.class.php:198 msgid "Uninstall" msgstr "" -#: Endpointman.class.php:189 +#: Endpointman.class.php:199 msgid "Update" msgstr "" -#: Endpointman.class.php:190 +#: Endpointman.class.php:200 msgid "Install Firmware" msgstr "" -#: Endpointman.class.php:191 +#: Endpointman.class.php:201 msgid "Remove Firmware" msgstr "" -#: Endpointman.class.php:192 +#: Endpointman.class.php:202 msgid "Update Firmware" msgstr "" -#: Endpointman.class.php:193 +#: Endpointman.class.php:203 msgid "Enable" msgstr "" -#: Endpointman.class.php:194 +#: Endpointman.class.php:204 msgid "Disable" msgstr "" -#: Endpointman.class.php:195 Endpointman.class.php:212 -#: Endpointman.class.php:216 +#: Endpointman.class.php:205 Endpointman.class.php:222 +#: Endpointman.class.php:226 msgid "Ready!" msgstr "" -#: Endpointman.class.php:196 Endpointman.class.php:213 -#: Endpointman.class.php:265 +#: Endpointman.class.php:206 Endpointman.class.php:223 +#: Endpointman.class.php:275 Endpointman.class.php:1148 +#: Endpointman.class.php:1226 msgid "Error!" msgstr "" -#: Endpointman.class.php:197 +#: Endpointman.class.php:207 msgid "Update!" msgstr "" -#: Endpointman.class.php:198 Endpointman.class.php:214 -#: Endpointman.class.php:266 +#: Endpointman.class.php:208 Endpointman.class.php:224 +#: Endpointman.class.php:276 msgid "Saving Changes..." msgstr "" -#: Endpointman.class.php:199 Endpointman.class.php:215 -#: Endpointman.class.php:267 +#: Endpointman.class.php:209 Endpointman.class.php:225 +#: Endpointman.class.php:277 msgid "Saving Changes... Ok!" msgstr "" -#: Endpointman.class.php:200 Endpointman.class.php:217 +#: Endpointman.class.php:210 Endpointman.class.php:227 msgid "Upload Content!" msgstr "" -#: Endpointman.class.php:201 +#: Endpointman.class.php:211 msgid "Check for Updates..." msgstr "" -#: Endpointman.class.php:202 +#: Endpointman.class.php:212 msgid "Check for Updates... Ok!" msgstr "" -#: Endpointman.class.php:203 +#: Endpointman.class.php:213 msgid "Update Content..." msgstr "" -#: Endpointman.class.php:204 Endpointman.class.php:218 -#: Endpointman.class.php:268 +#: Endpointman.class.php:214 Endpointman.class.php:228 +#: Endpointman.class.php:278 msgid "Invalid Option!" msgstr "" -#: Endpointman.class.php:207 +#: Endpointman.class.php:217 msgid "" "If you select Hide this brand will disappear and all products and models " "on the list of Install/Uninstall." msgstr "" -#: Endpointman.class.php:208 +#: Endpointman.class.php:218 msgid "" "If you select Hide disappear all models of the product selected from the " "Install/Uninstall list." msgstr "" -#: Endpointman.class.php:209 +#: Endpointman.class.php:219 msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" -#: Endpointman.class.php:210 +#: Endpointman.class.php:220 msgid "Show" msgstr "" -#: Endpointman.class.php:211 +#: Endpointman.class.php:221 msgid "Hide" msgstr "" -#: Endpointman.class.php:234 Endpointman.class.php:252 -#: Endpointman.class.php:280 Endpointman.class.php:308 -#: Endpointman.class.php:317 +#: Endpointman.class.php:244 Endpointman.class.php:262 +#: Endpointman.class.php:290 Endpointman.class.php:318 +#: Endpointman.class.php:327 Endpointman.class.php:357 msgid "Command not found!" msgstr "" -#: Endpointman.class.php:258 Endpointman.class.php:323 +#: Endpointman.class.php:268 Endpointman.class.php:363 msgid "Tab is not valid!" msgstr "" -#: Endpointman.class.php:442 +#: Endpointman.class.php:495 msgid "Install/Unistall" msgstr "" -#: Endpointman.class.php:446 +#: Endpointman.class.php:499 msgid "Show/Hide" msgstr "" -#: Endpointman.class.php:456 +#: Endpointman.class.php:509 msgid "Settings" msgstr "" -#: Endpointman.class.php:460 +#: Endpointman.class.php:513 msgid "OUI Manager" msgstr "" -#: Endpointman.class.php:464 +#: Endpointman.class.php:517 msgid "Product Configuration Editor" msgstr "" -#: Endpointman.class.php:468 +#: Endpointman.class.php:521 msgid "Import/Export My Devices List" msgstr "" -#: Endpointman.class.php:472 +#: Endpointman.class.php:525 msgid "Package Import/Export" msgstr "" -#: Endpointman.class.php:506 +#: Endpointman.class.php:559 msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:511 +#: Endpointman.class.php:564 msgid "Dropping all relevant tables" msgstr "" -#: Endpointman.class.php:526 +#: Endpointman.class.php:579 msgid "Removing symlink to web provisioner" msgstr "" -#: Endpointman.class.php:562 +#: Endpointman.class.php:615 msgid "ID Producto not is number" msgstr "" -#: Endpointman.class.php:577 +#: Endpointman.class.php:630 msgid "ID Brand not is numbre" msgstr "" -#: Endpointman.class.php:761 -msgid "No package set!" +#: Endpointman.class.php:754 Endpointman.class.php:838 +#: Endpointman.class.php:931 Endpointman.class.php:973 +msgid "No send Product Select!" msgstr "" -#: Endpointman.class.php:764 -msgid "Package not valid!" +#: Endpointman.class.php:757 Endpointman.class.php:841 +msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:773 -msgid "ID Package send not valid, brand not exist!" +#: Endpointman.class.php:760 Endpointman.class.php:844 +msgid "Product Select send is number not valid!" msgstr "" -#: Endpointman.class.php:776 -msgid "Exporting %_NAME_%" +#: Endpointman.class.php:847 +msgid "No send File ID!" msgstr "" -#: Endpointman.class.php:785 Endpointman.class.php:890 -#: Endpointman.class.php:1967 Endpointman.class.php:1979 -#: Endpointman.class.php:2020 Endpointman.class.php:2052 -#: Endpointman.class.php:2106 Endpointman.class.php:2134 -#: Endpointman.class.php:2141 Endpointman.class.php:2148 -#: Endpointman.class.php:2152 Endpointman.class.php:2223 -#: Endpointman.class.php:2301 Endpointman.class.php:2337 -#: Endpointman.class.php:2366 Endpointman.class.php:2408 -#: Endpointman.class.php:2419 Endpointman.class.php:2429 -msgid "Done!" +#: Endpointman.class.php:850 +msgid "No send File Name!" msgstr "" -#: Endpointman.class.php:786 -msgid "Click this link to download:" +#: Endpointman.class.php:853 Endpointman.class.php:934 +#: Endpointman.class.php:976 Endpointman.class.php:1070 +msgid "No send Type File!" +msgstr "" + +#: Endpointman.class.php:900 +msgid "File not readable, check the permission! " +msgstr "" + +#: Endpointman.class.php:937 +msgid "No send SendID!" +msgstr "" + +#: Endpointman.class.php:979 +msgid "No send Text File!" msgstr "" -#: Endpointman.class.php:837 +#: Endpointman.class.php:982 +msgid "No send Save Name!" +msgstr "" + +#: Endpointman.class.php:985 +msgid "No send Name File!" +msgstr "" + +#: Endpointman.class.php:1067 +msgid "No send SQL Select!" +msgstr "" + +#: Endpointman.class.php:1085 +msgid "Type File not valid!" +msgstr "" + +#: Endpointman.class.php:1117 Endpointman.class.php:1194 +#: Endpointman.class.php:1353 msgid "Can Not Find Uploaded Files!" msgstr "" -#: Endpointman.class.php:844 -msgid "Importing file %_FILE_%..." +#: Endpointman.class.php:1122 +msgid "Importing brand file %_FILE_%..." msgstr "" -#: Endpointman.class.php:849 -msgid "We support only CVS and TXT files, type file %_FILE_% no support!" +#: Endpointman.class.php:1143 +msgid "Creating EPM temp directory..." msgstr "" -#: Endpointman.class.php:852 -msgid "File %_FILE_% size is 0!" +#: Endpointman.class.php:1145 Endpointman.class.php:1159 +#: Endpointman.class.php:1218 Endpointman.class.php:1223 +#: Endpointman.class.php:1238 Endpointman.class.php:1314 +#: Endpointman.class.php:1409 Endpointman.class.php:2447 +#: Endpointman.class.php:2459 Endpointman.class.php:2500 +#: Endpointman.class.php:2532 Endpointman.class.php:2586 +#: Endpointman.class.php:2614 Endpointman.class.php:2621 +#: Endpointman.class.php:2628 Endpointman.class.php:2632 +#: Endpointman.class.php:2703 Endpointman.class.php:2781 +#: Endpointman.class.php:2817 Endpointman.class.php:2846 +#: Endpointman.class.php:2888 Endpointman.class.php:2899 +#: Endpointman.class.php:2909 +msgid "Done!" msgstr "" -#: Endpointman.class.php:892 -msgid "Invalid Extension Specified on line %_LINE_%!" +#: Endpointman.class.php:1154 +msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" msgstr "" -#: Endpointman.class.php:895 -msgid "Invalid Model Specified on line %_LINE_%!" +#: Endpointman.class.php:1156 +msgid "Extracting Tarball........ " msgstr "" -#: Endpointman.class.php:898 -msgid "Invalid Brand Specified on line %_LINE_%!" +#: Endpointman.class.php:1165 +msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." msgstr "" -#: Endpointman.class.php:901 -msgid "Invalid Mac on line %_LINE_%!" +#: Endpointman.class.php:1167 +msgid "Looking file and update brand's...." msgstr "" -#: Endpointman.class.php:908 -msgid "Please reboot & rebuild all imported phones" +#: Endpointman.class.php:1174 +msgid "Please name the Package the same name as your brand!" msgstr "" -#: Endpointman.class.php:910 -msgid "Possible file upload attack!" +#: Endpointman.class.php:1179 +msgid "No File Provided!" msgstr "" -#: Endpointman.class.php:916 -msgid "" -"The uploaded file exceeds the upload_max_filesize directive in php.ini" +#: Endpointman.class.php:1184 Endpointman.class.php:1245 +msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:919 -msgid "" -"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified " -"in the HTML form" +#: Endpointman.class.php:1199 +msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:922 -msgid "The uploaded file was only partially uploaded" +#: Endpointman.class.php:1216 +msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:925 -msgid "No file was uploaded" +#: Endpointman.class.php:1221 +msgid "Creating Provisioner Directory..." msgstr "" -#: Endpointman.class.php:928 -msgid "Missing a temporary folder" +#: Endpointman.class.php:1235 +msgid "Updating Last Modified..." msgstr "" -#: Endpointman.class.php:931 -msgid "Failed to write file to disk" +#: Endpointman.class.php:1242 +msgid "File Temp no Exists!" +msgstr "" + +#: Endpointman.class.php:1290 +msgid "No package set!" +msgstr "" + +#: Endpointman.class.php:1293 +msgid "Package not valid!" +msgstr "" + +#: Endpointman.class.php:1302 +msgid "ID Package send not valid, brand not exist!" +msgstr "" + +#: Endpointman.class.php:1305 +msgid "Exporting %_NAME_%" +msgstr "" + +#: Endpointman.class.php:1315 +msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:934 -msgid "A PHP extension stopped the file upload" +#: Endpointman.class.php:1360 +msgid "Importing CVS file %_FILE_%..." +msgstr "" + +#: Endpointman.class.php:1368 +msgid "We support only CVS and TXT files, type file %_FILE_% no support!" +msgstr "" + +#: Endpointman.class.php:1371 +msgid "File %_FILE_% size is 0!" +msgstr "" + +#: Endpointman.class.php:1411 +msgid "Invalid Extension Specified on line %_LINE_%!" +msgstr "" + +#: Endpointman.class.php:1414 +msgid "Invalid Model Specified on line %_LINE_%!" +msgstr "" + +#: Endpointman.class.php:1417 +msgid "Invalid Brand Specified on line %_LINE_%!" +msgstr "" + +#: Endpointman.class.php:1420 +msgid "Invalid Mac on line %_LINE_%!" +msgstr "" + +#: Endpointman.class.php:1427 +msgid "Please reboot & rebuild all imported phones" msgstr "" -#: Endpointman.class.php:955 +#: Endpointman.class.php:1429 +msgid "Possible file upload attack!" +msgstr "" + +#: Endpointman.class.php:1451 msgid "No ID set!" msgstr "" -#: Endpointman.class.php:958 +#: Endpointman.class.php:1454 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:977 +#: Endpointman.class.php:1473 msgid "No OUI set!" msgstr "" -#: Endpointman.class.php:980 +#: Endpointman.class.php:1476 msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:1025 Endpointman.class.php:1263 -#: Endpointman.class.php:1401 +#: Endpointman.class.php:1518 Endpointman.class.php:1751 +#: Endpointman.class.php:1881 msgid "No send name!" msgstr "" -#: Endpointman.class.php:1028 Endpointman.class.php:1266 -#: Endpointman.class.php:1404 +#: Endpointman.class.php:1521 Endpointman.class.php:1754 +#: Endpointman.class.php:1884 msgid "No send value!" msgstr "" -#: Endpointman.class.php:1073 views/epm_advanced_settings.page.php:28 +#: Endpointman.class.php:1566 views/epm_advanced_settings.page.php:23 msgid "Git not installed!" msgstr "" -#: Endpointman.class.php:1091 +#: Endpointman.class.php:1584 msgid "Directory Not Writable!" msgstr "" -#: Endpointman.class.php:1094 +#: Endpointman.class.php:1587 msgid "Not a Vaild Directory.
      Try to run 'mkdir " msgstr "" -#: Endpointman.class.php:1097 +#: Endpointman.class.php:1590 msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:1137 +#: Endpointman.class.php:1630 msgid "Your permissions are wrong on " msgstr "" -#: Endpointman.class.php:1153 +#: Endpointman.class.php:1646 msgid "Name invalid: " msgstr "" -#: Endpointman.class.php:1217 Endpointman.class.php:1254 +#: Endpointman.class.php:1705 Endpointman.class.php:1742 msgid "Error: Command not found!" msgstr "" -#: Endpointman.class.php:1269 Endpointman.class.php:1411 +#: Endpointman.class.php:1757 Endpointman.class.php:1891 msgid "No send id!" msgstr "" -#: Endpointman.class.php:1272 Endpointman.class.php:1414 +#: Endpointman.class.php:1760 Endpointman.class.php:1894 msgid "No send idtype!" msgstr "" -#: Endpointman.class.php:1275 Endpointman.class.php:1417 +#: Endpointman.class.php:1763 Endpointman.class.php:1897 msgid "ID send is not number!" msgstr "" -#: Endpointman.class.php:1294 Endpointman.class.php:1440 +#: Endpointman.class.php:1782 Endpointman.class.php:1920 msgid "IDType invalid: " msgstr "" -#: Endpointman.class.php:1408 +#: Endpointman.class.php:1888 msgid "Invalid Value!" msgstr "" -#: Endpointman.class.php:1592 +#: Endpointman.class.php:2072 msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:1595 +#: Endpointman.class.php:2075 msgid "Underflow or the modes mismatch" msgstr "" -#: Endpointman.class.php:1598 +#: Endpointman.class.php:2078 msgid "Unexpected control character found" msgstr "" -#: Endpointman.class.php:1601 +#: Endpointman.class.php:2081 msgid "Syntax error, malformed JSON" msgstr "" -#: Endpointman.class.php:1604 +#: Endpointman.class.php:2084 msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "" -#: Endpointman.class.php:1607 +#: Endpointman.class.php:2087 msgid "Unknown error" msgstr "" -#: Endpointman.class.php:1616 +#: Endpointman.class.php:2096 msgid "Cant find file:" msgstr "" -#: Endpointman.class.php:1633 +#: Endpointman.class.php:2113 msgid "Not able to connect to repository. Using local master file instead." msgstr "" -#: Endpointman.class.php:1648 +#: Endpointman.class.php:2128 msgid "" "Not able to connect to repository. Using local Provisioner.net Package." msgstr "" -#: Endpointman.class.php:1678 +#: Endpointman.class.php:2158 msgid "" "Not able to connect to repository. Using local brand [%_brandname_%] " "file instead." msgstr "" -#: Endpointman.class.php:1709 +#: Endpointman.class.php:2189 msgid "Error: No Local File for %_name_% !" msgstr "" -#: Endpointman.class.php:1710 +#: Endpointman.class.php:2190 msgid "Learn how to manually upload packages here (it's easy!):" msgstr "" -#: Endpointman.class.php:1711 Endpointman.class.php:1737 +#: Endpointman.class.php:2191 Endpointman.class.php:2217 msgid "" "Click Here!" msgstr "" -#: Endpointman.class.php:1735 Endpointman.class.php:1736 +#: Endpointman.class.php:2215 Endpointman.class.php:2216 msgid "" "Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" msgstr "" -#: Endpointman.class.php:1744 +#: Endpointman.class.php:2224 msgid "" "The Remote Server Is Currently Syncing With the Master Server, Please " "try again later" msgstr "" -#: Endpointman.class.php:1820 +#: Endpointman.class.php:2300 msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" msgstr "" -#: Endpointman.class.php:1957 +#: Endpointman.class.php:2437 msgid "Skipping download..." msgstr "" -#: Endpointman.class.php:1961 Endpointman.class.php:1973 +#: Endpointman.class.php:2441 Endpointman.class.php:2453 msgid "Downloading firmware..." msgstr "" -#: Endpointman.class.php:1964 Endpointman.class.php:1976 +#: Endpointman.class.php:2444 Endpointman.class.php:2456 msgid "Error download frimware package!" msgstr "" -#: Endpointman.class.php:1983 +#: Endpointman.class.php:2463 msgid "Checking MD5sum of Package..." msgstr "" -#: Endpointman.class.php:1985 +#: Endpointman.class.php:2465 msgid "Matches!" msgstr "" -#: Endpointman.class.php:1992 +#: Endpointman.class.php:2472 msgid "Installing Firmware..." msgstr "" -#: Endpointman.class.php:1999 +#: Endpointman.class.php:2479 msgid "- Failed To Copy %_FILE_%!" msgstr "" -#: Endpointman.class.php:2003 +#: Endpointman.class.php:2483 msgid "- Copied %_FILE_% to %_FILETO_%." msgstr "" -#: Endpointman.class.php:2015 +#: Endpointman.class.php:2495 msgid "Copy Error Detected! Aborting Install!" msgstr "" -#: Endpointman.class.php:2017 Endpointman.class.php:2125 +#: Endpointman.class.php:2497 Endpointman.class.php:2605 msgid "Please Check Directory/Permissions!" msgstr "" -#: Endpointman.class.php:2024 +#: Endpointman.class.php:2504 msgid "Firmware MD5 didn't match!" msgstr "" -#: Endpointman.class.php:2028 +#: Endpointman.class.php:2508 msgid "Your Firmware is already up to date" msgstr "" -#: Endpointman.class.php:2037 +#: Endpointman.class.php:2517 msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:2060 +#: Endpointman.class.php:2540 msgid "Uninstalla Brand..." msgstr "" -#: Endpointman.class.php:2088 +#: Endpointman.class.php:2568 msgid "All Done!" msgstr "" -#: Endpointman.class.php:2109 +#: Endpointman.class.php:2589 msgid "Not allowed in repo mode!!" msgstr "" -#: Endpointman.class.php:2122 +#: Endpointman.class.php:2602 msgid "Creating EPM temp directory" msgstr "" -#: Endpointman.class.php:2124 +#: Endpointman.class.php:2604 msgid "Error creating directory: %_DIR_%" msgstr "" -#: Endpointman.class.php:2130 +#: Endpointman.class.php:2610 msgid "Downloading Brand JSON....." msgstr "" -#: Endpointman.class.php:2139 +#: Endpointman.class.php:2619 msgid "Downloading Brand Package..." msgstr "" -#: Endpointman.class.php:2146 +#: Endpointman.class.php:2626 msgid "Checking MD5sum of Package...." msgstr "" -#: Endpointman.class.php:2150 +#: Endpointman.class.php:2630 msgid "Extracting Tarball........" msgstr "" -#: Endpointman.class.php:2158 +#: Endpointman.class.php:2638 msgid "MD5 Did not match!" msgstr "" -#: Endpointman.class.php:2161 +#: Endpointman.class.php:2641 msgid "Can't Find Downloaded File!" msgstr "" -#: Endpointman.class.php:2164 +#: Endpointman.class.php:2644 msgid "Error download Brand package!" msgstr "" -#: Endpointman.class.php:2167 +#: Endpointman.class.php:2647 msgid "" "Error Connecting to the Package Repository. Module not installed. Please " "Try again later." msgstr "" -#: Endpointman.class.php:2168 +#: Endpointman.class.php:2648 msgid "" "You Can Also Manually Update The Repository By Downloading Files here: " "%_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:2169 +#: Endpointman.class.php:2649 msgid "Then Use Manual Upload in Advanced Settings." msgstr "" -#: Endpointman.class.php:2172 +#: Endpointman.class.php:2652 msgid "Installing brands is disabled while in repo mode!" msgstr "" -#: Endpointman.class.php:2181 +#: Endpointman.class.php:2661 msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" msgstr "" -#: Endpointman.class.php:2184 +#: Endpointman.class.php:2664 msgid "Processing %_PATH_%/brand_data.json..." msgstr "" -#: Endpointman.class.php:2189 +#: Endpointman.class.php:2669 msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" msgstr "" -#: Endpointman.class.php:2197 +#: Endpointman.class.php:2677 msgid "" "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." msgstr "" -#: Endpointman.class.php:2216 +#: Endpointman.class.php:2696 msgid "- Error Moving %_FILENAME_%!" msgstr "" -#: Endpointman.class.php:2233 +#: Endpointman.class.php:2713 msgid "Updating %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:2237 +#: Endpointman.class.php:2717 msgid "Inserting %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:2244 +#: Endpointman.class.php:2724 msgid "Updating Family Lines................." msgstr "" -#: Endpointman.class.php:2253 +#: Endpointman.class.php:2733 msgid "Firmware Requirment Detected!.........." msgstr "" -#: Endpointman.class.php:2270 +#: Endpointman.class.php:2750 msgid "-- Updating Model Lines................" msgstr "" -#: Endpointman.class.php:2281 +#: Endpointman.class.php:2761 msgid "----Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:2321 Endpointman.class.php:2346 +#: Endpointman.class.php:2801 Endpointman.class.php:2826 msgid "Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:2372 +#: Endpointman.class.php:2852 msgid "---Updating Model %_NAMEMOD_%" msgstr "" -#: Endpointman.class.php:2376 +#: Endpointman.class.php:2856 msgid "---Inserting Model %_NAMEMOD_%" msgstr "" -#: Endpointman.class.php:2382 +#: Endpointman.class.php:2862 msgid "System Error in Sync Model Function, Load Failure!" msgstr "" -#: Endpointman.class.php:2391 +#: Endpointman.class.php:2871 msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" msgstr "" -#: Endpointman.class.php:2409 +#: Endpointman.class.php:2889 msgid "Updating OUI list in DB" msgstr "" -#: Endpointman.class.php:2421 +#: Endpointman.class.php:2901 msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:2424 +#: Endpointman.class.php:2904 msgid "No 'brand_data.xml' file exists!" msgstr "" -#: Endpointman.class.php:2427 +#: Endpointman.class.php:2907 msgid "Removing Temporary Files.............." msgstr "" -#: Endpointman.class.php:2623 +#: Endpointman.class.php:3103 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:2626 +#: Endpointman.class.php:3106 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:2686 +#: Endpointman.class.php:3166 msgid "Invalid Model Selected, Can't Sync System" msgstr "" -#: Endpointman.class.php:2691 +#: Endpointman.class.php:3171 msgid "Invalid MAC Address" msgstr "" -#: Endpointman.class.php:2724 Endpointman.class.php:2742 +#: Endpointman.class.php:3204 Endpointman.class.php:3222 msgid "No Devices/Extensions Left to Add" msgstr "" -#: Endpointman.class.php:2728 Endpointman.class.php:2746 +#: Endpointman.class.php:3208 Endpointman.class.php:3226 msgid "No Lines Left to Add" msgstr "" -#: Endpointman.class.php:3454 -msgid "Unknown" +#: Endpointman.class.php:3375 +msgid "" +"The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3539 -msgid "You can't remove the only line left" +#: Endpointman.class.php:3377 +msgid "" +"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified " +"in the HTML form" +msgstr "" + +#: Endpointman.class.php:3379 +msgid "The uploaded file was only partially uploaded" +msgstr "" + +#: Endpointman.class.php:3381 +msgid "No file was uploaded" +msgstr "" + +#: Endpointman.class.php:3383 +msgid "Missing a temporary folder" msgstr "" -#: functions.inc.php:234 -msgid "End Point Manager" +#: Endpointman.class.php:3385 +msgid "Failed to write file to disk" +msgstr "" + +#: Endpointman.class.php:3387 +msgid "File upload stopped by extension" msgstr "" -#: functions.inc.php:343 -msgid "Failed to install " +#: Endpointman.class.php:3389 +msgid "Unknown upload error" +msgstr "" + +#: Endpointman.class.php:3521 +msgid "Unknown" +msgstr "" + +#: Endpointman.class.php:4496 +msgid "You can't remove the only line left" msgstr "" #: page.epm_advanced.php:18 page.epm_config.php:18 @@ -755,6 +866,30 @@ msgstr "" msgid "Package Manager" msgstr "" +#: provisioning/p.php:33 provisioning/p.php:129 +msgid "Error 403 Forbidden" +msgstr "" + +#: provisioning/p.php:34 provisioning/p.php:130 +msgid "Access denied!" +msgstr "" + +#: provisioning/p.php:98 +msgid "Error 500 Internal Server Error" +msgstr "" + +#: provisioning/p.php:99 +msgid "System Failure!" +msgstr "" + +#: provisioning/p.php:107 provisioning/p.php:121 +msgid "Error 404 Not Found" +msgstr "" + +#: provisioning/p.php:108 provisioning/p.php:122 +msgid "File not Found!" +msgstr "" + #: views/epm_advanced/oui_manager.views.grid.php:6 #: views/epm_advanced/oui_manager.views.grid.php:8 msgid "Add Custom OUI" @@ -795,22 +930,6 @@ msgstr "" msgid "Add New" msgstr "" -#: views/epm_advanced/poce.views.file_list.php:2 -msgid "Local File Configs" -msgstr "" - -#: views/epm_advanced/poce.views.file_list_sql.php:2 -msgid "User File Configs" -msgstr "" - -#: views/epm_advanced/poce.views.file_list_sql.php:5 -msgid "Delete" -msgstr "" - -#: views/epm_advanced/poce.views.file_list_template.php:2 -msgid "Custom Template Files" -msgstr "" - #: views/epm_advanced_iedl.page.php:6 msgid "Export CSV" msgstr "" @@ -820,7 +939,7 @@ msgid "Export CSV file of devices" msgstr "" #: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:115 +#: views/epm_advanced_manual_upload.page.php:146 msgid "Export" msgstr "" @@ -837,8 +956,8 @@ msgid "Import CSV file of devices" msgstr "" #: views/epm_advanced_iedl.page.php:52 views/epm_advanced_iedl.page.php:60 -#: views/epm_advanced_manual_upload.page.php:33 -#: views/epm_advanced_manual_upload.page.php:64 +#: views/epm_advanced_manual_upload.page.php:32 +#: views/epm_advanced_manual_upload.page.php:62 msgid "Import" msgstr "" @@ -896,193 +1015,256 @@ msgstr "" msgid "Provisioner Package" msgstr "" -#: views/epm_advanced_manual_upload.page.php:43 +#: views/epm_advanced_manual_upload.page.php:41 msgid "Import a package Provisioner in manual mode." msgstr "" -#: views/epm_advanced_manual_upload.page.php:56 +#: views/epm_advanced_manual_upload.page.php:54 msgid "Brand Package" msgstr "" -#: views/epm_advanced_manual_upload.page.php:73 +#: views/epm_advanced_manual_upload.page.php:71 msgid "Import a package brand in manual mode." msgstr "" -#: views/epm_advanced_manual_upload.page.php:88 +#: views/epm_advanced_manual_upload.page.php:114 msgid "Export Brand Packages" msgstr "" -#: views/epm_advanced_manual_upload.page.php:91 +#: views/epm_advanced_manual_upload.page.php:117 msgid "Learn how to create your own brand package at " msgstr "" -#: views/epm_advanced_manual_upload.page.php:99 +#: views/epm_advanced_manual_upload.page.php:125 msgid "Brand's Available" msgstr "" -#: views/epm_advanced_manual_upload.page.php:124 -msgid "Explor a package brand's availables." +#: views/epm_advanced_manual_upload.page.php:131 +msgid "Heads up!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:135 -msgid "List of other exports" +#: views/epm_advanced_manual_upload.page.php:131 +msgid "List Bran's Availables empty." msgstr "" -#: views/epm_advanced_manual_upload.page.php:143 -msgid "It has not created any package." +#: views/epm_advanced_manual_upload.page.php:137 +msgid "Select Brand:" +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:157 +msgid "Explor a package brand's availables." msgstr "" -#: views/epm_advanced_manual_upload.page.php:158 +#: views/epm_advanced_manual_upload.page.php:168 +msgid "List of other exports" +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:177 msgid "Empty list." msgstr "" -#: views/epm_advanced_manual_upload.page.php:175 +#: views/epm_advanced_manual_upload.page.php:209 msgid "List packages generated in other exports." msgstr "" -#: views/epm_advanced_poce.page.php:203 +#: views/epm_advanced_poce.page.php:16 +msgid "Local File Configs" +msgstr "" + +#: views/epm_advanced_poce.page.php:28 +msgid "Custom Template Files" +msgstr "" + +#: views/epm_advanced_poce.page.php:39 +msgid "User File Configs" +msgstr "" + +#: views/epm_advanced_poce.page.php:53 views/epm_advanced_poce.page.php:72 +msgid "No Selected" +msgstr "" + +#: views/epm_advanced_poce.page.php:71 +msgid "Full Screen F11" +msgstr "" + +#: views/epm_advanced_poce.page.php:74 +msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." +msgstr "" + +#: views/epm_advanced_poce.page.php:80 +msgid "" +"NOTE: File may be over-written during next package update. We suggest " +"also using the Share button below to improve the next release." +msgstr "" + +#: views/epm_advanced_poce.page.php:83 msgid "Save" msgstr "" -#: views/epm_advanced_poce.page.php:208 +#: views/epm_advanced_poce.page.php:84 +msgid "Delete" +msgstr "" + +#: views/epm_advanced_poce.page.php:90 +msgid "" +"NOTE: File is permanently saved and not over-written during next package " +"update." +msgstr "" + +#: views/epm_advanced_poce.page.php:96 msgid "Save As..." msgstr "" -#: views/epm_advanced_poce.page.php:216 +#: views/epm_advanced_poce.page.php:104 +msgid "" +"Upload this configuration file to the Provisioner.net Team. Files " +"shared are confidential and help improve the quality of releases." +msgstr "" + +#: views/epm_advanced_poce.page.php:107 msgid "Share" msgstr "" -#: views/epm_advanced_settings.page.php:43 +#: views/epm_advanced_settings.page.php:38 msgid "Setting Provision" msgstr "" -#: views/epm_advanced_settings.page.php:54 +#: views/epm_advanced_settings.page.php:49 msgid "IP address of phone server" msgstr "" -#: views/epm_advanced_settings.page.php:59 +#: views/epm_advanced_settings.page.php:56 +#: views/epm_advanced_settings.page.php:191 msgid "Determine for Me" msgstr "" -#: views/epm_advanced_settings.page.php:88 +#: views/epm_advanced_settings.page.php:81 msgid "Configuration Type" msgstr "" -#: views/epm_advanced_settings.page.php:93 +#: views/epm_advanced_settings.page.php:86 msgid "File (TFTP/FTP)" msgstr "" -#: views/epm_advanced_settings.page.php:94 +#: views/epm_advanced_settings.page.php:87 msgid "Web (HTTP)" msgstr "" -#: views/epm_advanced_settings.page.php:119 +#: views/epm_advanced_settings.page.php:90 +msgid "Updated!" +msgstr "" + +#: views/epm_advanced_settings.page.php:90 +msgid " - Point your phones to: " +msgstr "" + +#: views/epm_advanced_settings.page.php:114 msgid "Global Final Config & Firmware Directory" msgstr "" -#: views/epm_advanced_settings.page.php:139 +#: views/epm_advanced_settings.page.php:134 msgid "Time" msgstr "" -#: views/epm_advanced_settings.page.php:157 +#: views/epm_advanced_settings.page.php:152 msgid "Time Zone" msgstr "" -#: views/epm_advanced_settings.page.php:164 +#: views/epm_advanced_settings.page.php:161 msgid "TimeZone by PBX Setting" msgstr "" -#: views/epm_advanced_settings.page.php:185 +#: views/epm_advanced_settings.page.php:184 msgid "Time Server (NTP Server)" msgstr "" -#: views/epm_advanced_settings.page.php:205 +#: views/epm_advanced_settings.page.php:210 msgid "Local Paths" msgstr "" -#: views/epm_advanced_settings.page.php:215 +#: views/epm_advanced_settings.page.php:220 msgid "NMAP Executable Path" msgstr "" -#: views/epm_advanced_settings.page.php:239 +#: views/epm_advanced_settings.page.php:244 msgid "ARP Executable Path" msgstr "" -#: views/epm_advanced_settings.page.php:263 +#: views/epm_advanced_settings.page.php:268 msgid "Asterisk Executable Path" msgstr "" -#: views/epm_advanced_settings.page.php:283 +#: views/epm_advanced_settings.page.php:288 msgid "Web Directories" msgstr "" -#: views/epm_advanced_settings.page.php:293 +#: views/epm_advanced_settings.page.php:298 msgid "Package Server" msgstr "" -#: views/epm_advanced_settings.page.php:298 +#: views/epm_advanced_settings.page.php:305 msgid "Default Mirror FreePBX" msgstr "" -#: views/epm_advanced_settings.page.php:314 +#: views/epm_advanced_settings.page.php:323 msgid "Experimental" msgstr "" -#: views/epm_advanced_settings.page.php:325 +#: views/epm_advanced_settings.page.php:334 msgid "Enable FreePBX ARI Module" msgstr "" -#: views/epm_advanced_settings.page.php:330 -#: views/epm_advanced_settings.page.php:366 -#: views/epm_advanced_settings.page.php:395 -#: views/epm_advanced_settings.page.php:424 -#: views/epm_advanced_settings.page.php:453 -#: views/epm_advanced_settings.page.php:482 -#: views/epm_advanced_settings.page.php:511 -#: views/epm_advanced_settings.page.php:540 +#: views/epm_advanced_settings.page.php:339 +#: views/epm_advanced_settings.page.php:375 +#: views/epm_advanced_settings.page.php:404 +#: views/epm_advanced_settings.page.php:433 +#: views/epm_advanced_settings.page.php:462 +#: views/epm_advanced_settings.page.php:491 +#: views/epm_advanced_settings.page.php:520 +#: views/epm_advanced_settings.page.php:549 msgid "Yes" msgstr "" -#: views/epm_advanced_settings.page.php:332 -#: views/epm_advanced_settings.page.php:368 -#: views/epm_advanced_settings.page.php:397 -#: views/epm_advanced_settings.page.php:426 -#: views/epm_advanced_settings.page.php:455 -#: views/epm_advanced_settings.page.php:484 -#: views/epm_advanced_settings.page.php:513 -#: views/epm_advanced_settings.page.php:542 +#: views/epm_advanced_settings.page.php:341 +#: views/epm_advanced_settings.page.php:377 +#: views/epm_advanced_settings.page.php:406 +#: views/epm_advanced_settings.page.php:435 +#: views/epm_advanced_settings.page.php:464 +#: views/epm_advanced_settings.page.php:493 +#: views/epm_advanced_settings.page.php:522 +#: views/epm_advanced_settings.page.php:551 msgid "No" msgstr "" -#: views/epm_advanced_settings.page.php:361 +#: views/epm_advanced_settings.page.php:370 msgid "Enable Debug Mode" msgstr "" -#: views/epm_advanced_settings.page.php:390 +#: views/epm_advanced_settings.page.php:399 msgid "Disable Tooltips" msgstr "" -#: views/epm_advanced_settings.page.php:419 +#: views/epm_advanced_settings.page.php:428 msgid "Allow Duplicate Extensions" msgstr "" -#: views/epm_advanced_settings.page.php:448 +#: views/epm_advanced_settings.page.php:457 msgid "Allow Saving Over Default Configuration Files" msgstr "" -#: views/epm_advanced_settings.page.php:477 +#: views/epm_advanced_settings.page.php:486 msgid "Disable TFTP Server Check" msgstr "" -#: views/epm_advanced_settings.page.php:506 +#: views/epm_advanced_settings.page.php:515 msgid "Disable Configuration File Backups" msgstr "" -#: views/epm_advanced_settings.page.php:535 +#: views/epm_advanced_settings.page.php:544 msgid "Use GITHUB Live Repo" msgstr "" -#: views/epm_advanced_settings.page.php:597 +#: views/epm_advanced_settings.page.php:606 msgid "GIT Branch" msgstr "" diff --git a/i18n/es_ES/LC_MESSAGES/endpointman.mo b/i18n/es_ES/LC_MESSAGES/endpointman.mo index 08931a888b3ab13a02866d6f7f0bbcf873d2cb53..07090f52aec5a2dca1efa302565764b51c340f56 100644 GIT binary patch delta 6597 zcmZve3v^Z0na6h$Btf3xWk>{eg1jUILU;>kfTVytVu^~*SU9=&kX*UBC!Bi|h}7Ov zuu^Mv^eDC}MXXcNX?5UgE$wI(?TD?GJ{YTO3ai#GXJM62mu*28wEg|>Il+zZR# z33vfK4Q1OosPFm@4;L5>2h*;G6>tG$FJ@iTzaHv44-SDh!%~wq<_;?S%tJi1(9=*m z_zBdG-h*t)^dDi&XW$q(3Em9V|4k?l9D)t-*H8vb7-v+f@56XZpSj_t7 zRw`BSPB;o4j0U_4wd3P(EPNYk;-ZVfqZkYMnFT!h!)B-jHb8l%6>7e2Xkh?xnt3YX z5t!A)zoK#-JPRw~HMl_@*a|J&4K?vIP!m1}OW+%D0DKEx0#8AW8^$2*yc}K#r$Zg- zWl$Tv2I{E0N8x{+*$z6yAR71$sNi}o>VF4nqCZ2qzJS>@!KJVdoEdQ*#7SlmWT?41 zYI{&F|03jP?&Gl+9xTWI8>oC5zb=6}cq2RwwUZV?UJECnKFmNFdMB)gd*KB5DwM}Q zi26%uDB2f6E!-IKS||hCU@gpMsm!2q0P1Xh3n#-fPzzNNfl8klum;vc?YILn#B@Tr zI*9lf)b~GtTKFWCr#^xT);^rKV&$TU*>P0#Vj7$a7ek%xHpphoPN*Q<2N%OfAqipL zg-!6Ua2jl~;f_BK^?nyDgnJ-A^AL|p_yUwi--e9Knp0F{Q4w#&!B9J|fXde?P#%~E zbp*>`5sX2NZ-ok~G*ou%hVsb4h)1C2I{`J%DL4+EgB8mEO1{<^E`-`~9O@{xL&d8FEQDp@nk`cn7}(H;oVH`x91@k>(?)d54iwWVjg(wcae4 z#aJ_+iU!;Owewb}DBT8&;oVR>xgW}~{ZO8H7HUT?K^gQqEQaqu?eG+w0#8GEY#g~O z16DwdZ<&PuHK9+3Cb|_agI|Mk>2IJ0z7LDwIk*WHOeXhXJDd%_3UP`#8u0_Di|HZ; zDMl`V%AVu5g!*TSQa z_%h>gk6gVB>H zK`0MA1r<~;z@hLJs677_lp$xJ((Pibl}l$p1>2QS8}lIvVSWj zq2+uv|2UTs(NVYnz6IyOF+9i=vkqdL*#R}dA*k_(;c$2ij)W&6YjL53 zoC|f79dHTU1@+ylP#!!nAOCZF=J#}H$5oewX*LO3+E>DSkU`?l+y*tl_o4FoHK??D z6ApwQMl5C*LurqI4R8|d2UAcR-U=18dlumTwNxIVLpwPGH^YGo`F9Ftp*}nY%isyf z{b5c+1=&ZCpQ&6Fe!m`);wA$J!-u2(gHYeU9P!ssp7}6KrGiT7<>3uC6>5jIP-(LS zj)Cn^mfs$=55RKTKZP>|LmN{s`rXvryj+SRCFDV_}u@|57R| zd9e!0!uz2nd;+!H0K$1M&2YJI?gj^+Iss3_dA2l;`T9Vq{bFehVB$ z`;Mr8KOCz3e~OA+`7+ea^&6FOL zEL;uCmxc2upgfX+MXYajQrQJ}!8%yF+!&72G(fd)f!gsQsC(c|sGa{F67c3M#6kIT zb3|b$a-+6lK*x7))Ye9GD4XW-EV>UZM3v|&q;d_qHedVr@gmj7&^^eHy1U`OBe_>a z-gz`%`}>EEV+uMHbtiTHchUG+)X{^BsKld&T>J!*E5CwfAeBw%Tlre}hejURi~bee ziR7{WLMl}u%#S1LxKzHT^ZzN8uOg1=e36^iq7tN=>lO5$NadR$%nk4}Xc!uZ_M>U2 z6wO6fBMxHLD!WnNe2v= zqwhq0PeSgo^QD8@_t73S75xX=fsUZ;4|p6yDy<>R;}KWFr_q&BTgDzhL(q3o4O)d7 zQ6Z{E%A}t19F@ta330=lFQ6}@rAX!HI{yc#+=1>#>(G~w%IhJ_KKKjN6}2b9p=cLM zpcpDfz00LhV{`9L>JOpMqd{mn`n1l!jLLPW4_c4Dh;Bk{Naba8D|!LxZ^BVD8!baW zMB9<_JwPgNpl8r$(d}p?x)G`L3z2_*PfxjYQNC%61D}uTJ=jQP7J4M==!8E(*P~Za z9r_#^jJBW*QkjXip?^^$DhJ`jsJ)~xt{Q`IyN=5C%@M82- z)cyvXjx4$bZAITk!-HD}|D`$>bJJ-XcT)*BUTNxMnS_^0oBDX%F6m5Xymq_h>gD<7 zYIjSpeaK_|C#G$Emy<|3Ey-Y9=@msWHsdbVKrMyE5Gv8xik@Aw!+M#&%_!X>>7T$GRfkO?Qmk7oL1Mi_)aR0#ZF|go307A zjc8oa;rSUGcQTHRd8v(w)=uAvv2py+mB1l2reSNwO{M8FjftddCpEK)X=rlTPW6~n z8T@X<(!q_LNi2!6=ag-%tqp2M&M9`{Y1`RRnQIy87q04MQj_m>B{VbcNTh7Llj>v} z?OxoiG0WTYhJC{RPY%nyR<^64Y%yEwbrx>gy7FmFu%^6h5q`DaM(btTSjF9{S<_~v zdLz%IZL5m~PR5OE`o9}klXJ_<3bJdO8|K^m?h|R-;rdwWrZUNHn|8YR3ddTx!Q)(~ zZt)Wt9A@L4ej?RsQ|{LDE8zqj&E{6;C%n?_mWymJmsQ(_wM%Tn)&$3lBSSydlo%pT z(HCs1$QG}4lWr{I27ju!F1O<1xdr_<`fj?-HWP(zkR83HuiO!zADkN9R^<3@uy#zg z@7nHk#%<3X8B<(T(VS>^ugB-MrP~shgiR)crKY*NBY3TH^T5=ml(!{?tx3;`2eYdd z7P|3Vvg$x#$&6Y%qjrAXykPuz8#QLm$*mgy?ZW!Q`|6cGp3=u{b>f~9NO5H9Up(N% z6TZy1O|GBz2-U<*j5z;hb*J0q1s_g)aRAwuNOyRtgtqeZq^3bjoD@mr_-3_d({6Bl zQblh3P?4)=iNm8DHjy!=$-5^I|~-HaAh1DvA8BVQ<3SgA1CAK7W#*D41JSMWD;FoPgVwBsVOVN z_kOI6UV^ZfftA4{HH{;hoK(h1CLOy3ha_D#tgJj)GpB^l$Ud(!H+I_Vh0D(SsWa8v z*xo5hP_r@8(~DBICrdwea%U>oTUR#t6T@=v*Z!=aDs=Zhb%5>CA=CuV)>W-OKg`3; zWO6=Zc}>J}8HH~nZ}wzv9EV}tKl>neqOQ3h>t&qzwjpWpeBMuK*S2;#ew^E-Cz;)L zGTOD>@?qL*A*EtI0l;~1A?i&MW71rY360|#jb*s32;{uu=wM?#W|83e6`Pnvb~okI zyuGQ5RAcrS)+o1vtvbM zS&;w6#!ZmD+mbRI05lrwWI*wgtCVMG;QFznMFy_MZIbbKjl!-o5vK z@0|mu8$F+{^Z5S~({{I^oF;k`mm`h2h5I`5LD|yX7zZ0r-#6o3cmY%KDh|L-QO5Me z4D5r27>izv#`V|{8&S{i$MMGa%}=QGqTwdew~6NNt{9KqFa_zuWZ~VIXRqg@?puaD zYStisW;-7}@DS>~ub>8W5jDUY7=vB-m`DGnAC-YLtU-Oz#D`||Q=EcVP#vc-ot`)u z+hH-P2C~6k??+{<71iJCapeC1l`AyN$93_f7q8-C z9KZrL}5giF9EmV+KBmnYb;1{Id+^EDeM3 z66(dbQJb$Ty`^Js)C^}JNic<|4k}O?TY<{hI@G~wv>vqWEjXI?v#2GxiP{4mKRZI3 zq%TgwWMo;*LhCAw;Cd%I*oa#DR#Zm*fV%%Gs^c$F6KKQRbvj~E6G=q+G{aE$%|LBd z{~RhjV;)1zY>%}C^`i5r7rc%A@e1nxNb)`a6Okq}6_v?y)RL`4J--%p-wsp;PoW0> zDze%A<^mOU{2orjk3(OWY!0hZH3Riv5h~Tis2P{q>w44x)}z++0O}OIjiWuB5^TUe zPUt;Nq>pW4TCk(e|7%o~ii^PpV?IO8CvlW++7(80sV*vv0c8TlJ(CSRlW zL=1<&A0}cR=Au%&3AL#YpfYp>HLz2tjQ$FB+WtI{{F7x9$(4>%D(Z&O=-@2mB${RR zdaL!A^-a{VyMbk>^yrwCqxRH(9F8yJZ2S;Of*Hs9kVI25nEY!kH`1UNZNpA@04HKI z>e&1XJ7PP2WgLt`wP)Dt0#s&}Vtd?(df$_%({d2i;j5?&eSjM9SAHrfROXR)jcfyw zUGpMpV826U;E&h=Kf^9~%U*Y2f%SYeDubht?3$^l0oR~1@i=M;ccPa32&y0dc`ADG zKasJRf1}pU85)|&0MrZ8Q6tZ@K8#x1<*4Vj;7M%7T3k5HnEUZhScgN{VCv@(Y68v3 zg#G3em1r6+BgifB@e{&rs2g?_+2D6t$~wV^{2x6>>1faGi})umF|fU8tqohg!08I2(VBJ+L>k zQRXs`Q)s3mC(z8q9QrptD!TC{WLeDxd;K};!A=}@*&j8-ai~pIgc|rVb--gEJNja31Of$8dqin4jZCbjF5$ z%Rdxq%s& zGCp+N=AiChjeT(s_Q6)X4=m1yIxybf1zwuMy&)l&M<0pn@REs@n z--Q~;QDoAl6-j`ZL8xPXmxAT{e5Mf-i6(-C1d9gKYU^PfDmo$Qguj{(FA*+Ezcx#_ zJWE9b(7LHiB90PDEBh)~4)Cd2sc4q{gSF8ADITSsNN69OBDC=yAQloN)o)&=5-xkG z=#0K-8}^~n`ZO_+&~a=_a4>?)qGP7=qY%M=Gp@1qSy)VTBPwj$R%>r8B|7Q+yS8x^ zmJ<)!Yq6Rrv)6}_Wi^$=Zel($lUPZpln@(;=ZG3YbBTPS$hLLH7l;$Yb|RU`CWaC}CSD@KrNvfy;^TxS9z?skJJC^> z6#W7&Ajar|axnP${~z~%>+%QGhY`DoR6@rzTpFp&A&%RIdohwYNqmQ>4G&`@7fXmo zi1oxYB9G`m#1qqr6~rDw<*5*62WAm>6HAFfM7TUmWjL{o*hK6kRO*TS#8l#lQWj09 zM1?Q`oJ$lE-&LEN6LZI{jBRq0dSnL{^tkD9YvQK6@5HTjOX7>Vd&``{>PoNAnOWj3 zSy=9V9si{pmoO>KSMIH=toEAxlFF*`GRIf#RC?=tB~?|9$*08`Sd?E>IFuOV9!|(} zzepGv7pW3~C8bMvS)F}pZQ#Scy*zG%v)YYGED9`6%<{M`Nj^8d|9rQx z|EhqKd^^G&lUnVbNgWaRCbc=DL&hj4GjmMVDECB~6TTQ7csK2Mg!|f%^X}gCX@TqM zYa`sP88vQ7=63g7=0m-5%a&GpE9-o` z518EA(nXcatLwf!wfYhH?(av848)FnCnE4j_8T5|#@NKb&&JO7xbNq@?zWDv4`fVO l<8gm6afe%)yV?Cu?hAnvlUB5GbMrU3SM%=+\n" "Language-Team: \n" "Language: es_ES\n" @@ -25,29 +25,29 @@ msgstr "" "X-Poedit-SearchPathExcluded-0: _old\n" "X-Poedit-SearchPathExcluded-1: i18n\n" -#: assets/js/epm_advanced.js:145 assets/js/epm_advanced.js:218 +#: assets/js/epm_advanced.js:162 assets/js/epm_advanced.js:218 #: assets/js/epm_config.js:312 assets/js/epm_config.js:361 msgid "Loading.." msgstr "Cargando..." -#: Endpointman.class.php:107 +#: Endpointman.class.php:108 msgid "Configuration Directory is not writable!" msgstr "En el directorio de configuración no se puede escribir!" -#: Endpointman.class.php:108 +#: Endpointman.class.php:109 msgid "Please change the location:" msgstr "Por favor, cambia la ubicación:" -#: Endpointman.class.php:108 Endpointman.class.php:115 -#: Endpointman.class.php:788 +#: Endpointman.class.php:109 Endpointman.class.php:116 +#: Endpointman.class.php:1317 msgid "Here" msgstr "Aquí" -#: Endpointman.class.php:109 +#: Endpointman.class.php:110 msgid "Or run this command on SSH:" msgstr "O ejecute este comando en SSH:" -#: Endpointman.class.php:115 +#: Endpointman.class.php:116 msgid "" "Configuration Directory is not a directory or does not exist! Please change " "the location here:" @@ -55,7 +55,7 @@ msgstr "" "Directorio de configuración no es un directorio o no existe! Por favor, " "cambia la ubicación aquí:" -#: Endpointman.class.php:180 +#: Endpointman.class.php:190 msgid "" "If we can activate the model set terminals of the models.
      If this " "model is disabled will not appear in the list of models that can be " @@ -65,7 +65,7 @@ msgstr "" "esta desactivado este modelo no aparecera en la lista de modelos que se " "pueden configurar para la PBX." -#: Endpointman.class.php:181 +#: Endpointman.class.php:191 msgid "" "The button \"Install Firmware\" installs the necessary files to the server " "for the terminal alone are updated via TFTP or HTTP.
      The button " @@ -82,7 +82,7 @@ msgstr "" "
      El boton \"Actualizar\" aparece cuando se detecta una nueva version " "de Paquete de este modelo." -#: Endpointman.class.php:182 +#: Endpointman.class.php:192 msgid "" "The \"Install\" button installs the configuration package brand models we " "selected.
      The \"Uninstall\" button removes the package configuration " @@ -96,100 +96,101 @@ msgstr "" "El boton \"Actualizacion\" aparece si se detecta una nueva version del " "paquete que esta ya instalado para actualizar a la ultima version." -#: Endpointman.class.php:183 +#: Endpointman.class.php:193 msgid "New Package Modified" msgstr "Nuevo paquete Modificado" -#: Endpointman.class.php:184 +#: Endpointman.class.php:194 msgid "Package Last Modified" msgstr "Paquete última actualización" -#: Endpointman.class.php:185 +#: Endpointman.class.php:195 msgid "Check for Update " msgstr "Comprobar se hay actualizaciones" -#: Endpointman.class.php:186 +#: Endpointman.class.php:196 msgid "Check Online " msgstr "Revise en línea" -#: Endpointman.class.php:187 +#: Endpointman.class.php:197 msgid "Install" msgstr "Instalar" -#: Endpointman.class.php:188 +#: Endpointman.class.php:198 msgid "Uninstall" msgstr "Desisntalar" -#: Endpointman.class.php:189 +#: Endpointman.class.php:199 msgid "Update" msgstr "Actualizar" -#: Endpointman.class.php:190 +#: Endpointman.class.php:200 msgid "Install Firmware" msgstr "Instalar Firmware" -#: Endpointman.class.php:191 +#: Endpointman.class.php:201 msgid "Remove Firmware" msgstr "Eliminar Firmware" -#: Endpointman.class.php:192 +#: Endpointman.class.php:202 msgid "Update Firmware" msgstr "Actualizar Firmware" -#: Endpointman.class.php:193 +#: Endpointman.class.php:203 msgid "Enable" msgstr "Activar" -#: Endpointman.class.php:194 +#: Endpointman.class.php:204 msgid "Disable" msgstr "Desactivar" -#: Endpointman.class.php:195 Endpointman.class.php:212 -#: Endpointman.class.php:216 +#: Endpointman.class.php:205 Endpointman.class.php:222 +#: Endpointman.class.php:226 msgid "Ready!" msgstr "Listo!" -#: Endpointman.class.php:196 Endpointman.class.php:213 -#: Endpointman.class.php:265 +#: Endpointman.class.php:206 Endpointman.class.php:223 +#: Endpointman.class.php:275 Endpointman.class.php:1148 +#: Endpointman.class.php:1226 msgid "Error!" msgstr "Error!" -#: Endpointman.class.php:197 +#: Endpointman.class.php:207 msgid "Update!" msgstr "Actualizado!" -#: Endpointman.class.php:198 Endpointman.class.php:214 -#: Endpointman.class.php:266 +#: Endpointman.class.php:208 Endpointman.class.php:224 +#: Endpointman.class.php:276 msgid "Saving Changes..." msgstr "Guardando cambios…" -#: Endpointman.class.php:199 Endpointman.class.php:215 -#: Endpointman.class.php:267 +#: Endpointman.class.php:209 Endpointman.class.php:225 +#: Endpointman.class.php:277 msgid "Saving Changes... Ok!" msgstr "Guardando cambios… Listo!" -#: Endpointman.class.php:200 Endpointman.class.php:217 +#: Endpointman.class.php:210 Endpointman.class.php:227 msgid "Upload Content!" msgstr "Actualizar contenido...." -#: Endpointman.class.php:201 +#: Endpointman.class.php:211 msgid "Check for Updates..." msgstr "Buscar actualizaciones..." -#: Endpointman.class.php:202 +#: Endpointman.class.php:212 msgid "Check for Updates... Ok!" msgstr "Buscar actualizaciones... Listo!" -#: Endpointman.class.php:203 +#: Endpointman.class.php:213 msgid "Update Content..." msgstr "Actualizar contenido...." -#: Endpointman.class.php:204 Endpointman.class.php:218 -#: Endpointman.class.php:268 +#: Endpointman.class.php:214 Endpointman.class.php:228 +#: Endpointman.class.php:278 msgid "Invalid Option!" msgstr "Opcion no valida!" -#: Endpointman.class.php:207 +#: Endpointman.class.php:217 msgid "" "If you select Hide this brand will disappear and all products and models on " "the list of Install/Uninstall." @@ -197,7 +198,7 @@ msgstr "" "Si selecciona Ocultar desaparecerá esta marca y todos sus productos y " "modelos en la lista de Instalar/Desinstalar." -#: Endpointman.class.php:208 +#: Endpointman.class.php:218 msgid "" "If you select Hide disappear all models of the product selected from the " "Install/Uninstall list." @@ -205,426 +206,510 @@ msgstr "" "Si selecciona Ocultar desaparecieran todos los modelos del producto " "seleccionado de la lista Instalar/Desinstalar." -#: Endpointman.class.php:209 +#: Endpointman.class.php:219 msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" "Si selecciona Ocultar desaparecieran este modelo de la lista Instalar/" "Desinstalar." -#: Endpointman.class.php:210 +#: Endpointman.class.php:220 msgid "Show" msgstr "Mostrar" -#: Endpointman.class.php:211 +#: Endpointman.class.php:221 msgid "Hide" msgstr "Ocultar" -#: Endpointman.class.php:234 Endpointman.class.php:252 -#: Endpointman.class.php:280 Endpointman.class.php:308 -#: Endpointman.class.php:317 +#: Endpointman.class.php:244 Endpointman.class.php:262 +#: Endpointman.class.php:290 Endpointman.class.php:318 +#: Endpointman.class.php:327 Endpointman.class.php:357 msgid "Command not found!" msgstr "Comando no valido!" -#: Endpointman.class.php:258 Endpointman.class.php:323 +#: Endpointman.class.php:268 Endpointman.class.php:363 msgid "Tab is not valid!" msgstr "Tab no es valida!" -#: Endpointman.class.php:442 +#: Endpointman.class.php:495 msgid "Install/Unistall" msgstr "Instalar/Desisntalar" -#: Endpointman.class.php:446 +#: Endpointman.class.php:499 msgid "Show/Hide" msgstr "Mostrar/Ocultar" -#: Endpointman.class.php:456 +#: Endpointman.class.php:509 msgid "Settings" msgstr "Configuración" -#: Endpointman.class.php:460 +#: Endpointman.class.php:513 msgid "OUI Manager" msgstr "Administrador OUI" -#: Endpointman.class.php:464 +#: Endpointman.class.php:517 msgid "Product Configuration Editor" msgstr "Editor de configuración de producto" -#: Endpointman.class.php:468 +#: Endpointman.class.php:521 msgid "Import/Export My Devices List" msgstr "Importar/exportar mi lista de dispositivos" -#: Endpointman.class.php:472 +#: Endpointman.class.php:525 msgid "Package Import/Export" msgstr "Paquete de importación/exportación" -#: Endpointman.class.php:506 +#: Endpointman.class.php:559 msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:511 +#: Endpointman.class.php:564 msgid "Dropping all relevant tables" msgstr "" -#: Endpointman.class.php:526 +#: Endpointman.class.php:579 msgid "Removing symlink to web provisioner" msgstr "" -#: Endpointman.class.php:562 +#: Endpointman.class.php:615 msgid "ID Producto not is number" msgstr "ID Producto no es numero" -#: Endpointman.class.php:577 +#: Endpointman.class.php:630 msgid "ID Brand not is numbre" msgstr "ID Marca no es numero" -#: Endpointman.class.php:761 -msgid "No package set!" +#: Endpointman.class.php:754 Endpointman.class.php:838 +#: Endpointman.class.php:931 Endpointman.class.php:973 +msgid "No send Product Select!" msgstr "" -#: Endpointman.class.php:764 -msgid "Package not valid!" +#: Endpointman.class.php:757 Endpointman.class.php:841 +msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:773 -msgid "ID Package send not valid, brand not exist!" +#: Endpointman.class.php:760 Endpointman.class.php:844 +msgid "Product Select send is number not valid!" msgstr "" -#: Endpointman.class.php:776 -msgid "Exporting %_NAME_%" +#: Endpointman.class.php:847 +msgid "No send File ID!" +msgstr "" + +#: Endpointman.class.php:850 +msgid "No send File Name!" +msgstr "" + +#: Endpointman.class.php:853 Endpointman.class.php:934 +#: Endpointman.class.php:976 Endpointman.class.php:1070 +msgid "No send Type File!" +msgstr "" + +#: Endpointman.class.php:900 +msgid "File not readable, check the permission! " +msgstr "" + +#: Endpointman.class.php:937 +msgid "No send SendID!" +msgstr "" + +#: Endpointman.class.php:979 +msgid "No send Text File!" +msgstr "" + +#: Endpointman.class.php:982 +msgid "No send Save Name!" +msgstr "" + +#: Endpointman.class.php:985 +msgid "No send Name File!" +msgstr "" + +#: Endpointman.class.php:1067 +msgid "No send SQL Select!" +msgstr "" + +#: Endpointman.class.php:1085 +msgid "Type File not valid!" +msgstr "" + +#: Endpointman.class.php:1117 Endpointman.class.php:1194 +#: Endpointman.class.php:1353 +msgid "Can Not Find Uploaded Files!" +msgstr "" + +#: Endpointman.class.php:1122 +msgid "Importing brand file %_FILE_%..." +msgstr "" + +#: Endpointman.class.php:1143 +msgid "Creating EPM temp directory..." msgstr "" -#: Endpointman.class.php:785 Endpointman.class.php:890 -#: Endpointman.class.php:1967 Endpointman.class.php:1979 -#: Endpointman.class.php:2020 Endpointman.class.php:2052 -#: Endpointman.class.php:2106 Endpointman.class.php:2134 -#: Endpointman.class.php:2141 Endpointman.class.php:2148 -#: Endpointman.class.php:2152 Endpointman.class.php:2223 -#: Endpointman.class.php:2301 Endpointman.class.php:2337 -#: Endpointman.class.php:2366 Endpointman.class.php:2408 -#: Endpointman.class.php:2419 Endpointman.class.php:2429 +#: Endpointman.class.php:1145 Endpointman.class.php:1159 +#: Endpointman.class.php:1218 Endpointman.class.php:1223 +#: Endpointman.class.php:1238 Endpointman.class.php:1314 +#: Endpointman.class.php:1409 Endpointman.class.php:2447 +#: Endpointman.class.php:2459 Endpointman.class.php:2500 +#: Endpointman.class.php:2532 Endpointman.class.php:2586 +#: Endpointman.class.php:2614 Endpointman.class.php:2621 +#: Endpointman.class.php:2628 Endpointman.class.php:2632 +#: Endpointman.class.php:2703 Endpointman.class.php:2781 +#: Endpointman.class.php:2817 Endpointman.class.php:2846 +#: Endpointman.class.php:2888 Endpointman.class.php:2899 +#: Endpointman.class.php:2909 msgid "Done!" msgstr "Correcto!" -#: Endpointman.class.php:786 -msgid "Click this link to download:" +#: Endpointman.class.php:1154 +msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" msgstr "" -#: Endpointman.class.php:837 -msgid "Can Not Find Uploaded Files!" +#: Endpointman.class.php:1156 +msgid "Extracting Tarball........ " msgstr "" -#: Endpointman.class.php:844 -msgid "Importing file %_FILE_%..." +#: Endpointman.class.php:1165 +msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." msgstr "" -#: Endpointman.class.php:849 -msgid "We support only CVS and TXT files, type file %_FILE_% no support!" +#: Endpointman.class.php:1167 +msgid "Looking file and update brand's...." msgstr "" -#: Endpointman.class.php:852 -msgid "File %_FILE_% size is 0!" +#: Endpointman.class.php:1174 +msgid "Please name the Package the same name as your brand!" msgstr "" -#: Endpointman.class.php:892 -msgid "Invalid Extension Specified on line %_LINE_%!" +#: Endpointman.class.php:1179 +msgid "No File Provided!" msgstr "" -#: Endpointman.class.php:895 -msgid "Invalid Model Specified on line %_LINE_%!" +#: Endpointman.class.php:1184 Endpointman.class.php:1245 +msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:898 -msgid "Invalid Brand Specified on line %_LINE_%!" +#: Endpointman.class.php:1199 +msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:901 -msgid "Invalid Mac on line %_LINE_%!" +#: Endpointman.class.php:1216 +msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:908 -msgid "Please reboot & rebuild all imported phones" +#: Endpointman.class.php:1221 +msgid "Creating Provisioner Directory..." msgstr "" -#: Endpointman.class.php:910 -msgid "Possible file upload attack!" +#: Endpointman.class.php:1235 +msgid "Updating Last Modified..." msgstr "" -#: Endpointman.class.php:916 -msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" +#: Endpointman.class.php:1242 +msgid "File Temp no Exists!" msgstr "" -#: Endpointman.class.php:919 -msgid "" -"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " -"the HTML form" +#: Endpointman.class.php:1290 +msgid "No package set!" msgstr "" -#: Endpointman.class.php:922 -msgid "The uploaded file was only partially uploaded" +#: Endpointman.class.php:1293 +msgid "Package not valid!" msgstr "" -#: Endpointman.class.php:925 -msgid "No file was uploaded" +#: Endpointman.class.php:1302 +msgid "ID Package send not valid, brand not exist!" msgstr "" -#: Endpointman.class.php:928 -msgid "Missing a temporary folder" +#: Endpointman.class.php:1305 +msgid "Exporting %_NAME_%" msgstr "" -#: Endpointman.class.php:931 -msgid "Failed to write file to disk" +#: Endpointman.class.php:1315 +msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:934 -msgid "A PHP extension stopped the file upload" +#: Endpointman.class.php:1360 +msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:955 +#: Endpointman.class.php:1368 +msgid "We support only CVS and TXT files, type file %_FILE_% no support!" +msgstr "" + +#: Endpointman.class.php:1371 +msgid "File %_FILE_% size is 0!" +msgstr "" + +#: Endpointman.class.php:1411 +msgid "Invalid Extension Specified on line %_LINE_%!" +msgstr "" + +#: Endpointman.class.php:1414 +msgid "Invalid Model Specified on line %_LINE_%!" +msgstr "" + +#: Endpointman.class.php:1417 +msgid "Invalid Brand Specified on line %_LINE_%!" +msgstr "" + +#: Endpointman.class.php:1420 +msgid "Invalid Mac on line %_LINE_%!" +msgstr "" + +#: Endpointman.class.php:1427 +msgid "Please reboot & rebuild all imported phones" +msgstr "" + +#: Endpointman.class.php:1429 +msgid "Possible file upload attack!" +msgstr "" + +#: Endpointman.class.php:1451 msgid "No ID set!" msgstr "No se ha enviado ID!" -#: Endpointman.class.php:958 +#: Endpointman.class.php:1454 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:977 +#: Endpointman.class.php:1473 msgid "No OUI set!" msgstr "" -#: Endpointman.class.php:980 +#: Endpointman.class.php:1476 msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:1025 Endpointman.class.php:1263 -#: Endpointman.class.php:1401 +#: Endpointman.class.php:1518 Endpointman.class.php:1751 +#: Endpointman.class.php:1881 msgid "No send name!" msgstr "No se ha enviado NOMBRE!" -#: Endpointman.class.php:1028 Endpointman.class.php:1266 -#: Endpointman.class.php:1404 +#: Endpointman.class.php:1521 Endpointman.class.php:1754 +#: Endpointman.class.php:1884 msgid "No send value!" msgstr "No se ha enviado VALOR!" -#: Endpointman.class.php:1073 views/epm_advanced_settings.page.php:28 +#: Endpointman.class.php:1566 views/epm_advanced_settings.page.php:23 msgid "Git not installed!" msgstr "" -#: Endpointman.class.php:1091 +#: Endpointman.class.php:1584 msgid "Directory Not Writable!" msgstr "" -#: Endpointman.class.php:1094 +#: Endpointman.class.php:1587 msgid "Not a Vaild Directory.
      Try to run 'mkdir " msgstr "" -#: Endpointman.class.php:1097 +#: Endpointman.class.php:1590 msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:1137 +#: Endpointman.class.php:1630 msgid "Your permissions are wrong on " msgstr "" -#: Endpointman.class.php:1153 +#: Endpointman.class.php:1646 msgid "Name invalid: " msgstr "" -#: Endpointman.class.php:1217 Endpointman.class.php:1254 +#: Endpointman.class.php:1705 Endpointman.class.php:1742 msgid "Error: Command not found!" msgstr "Error: Comando no valido!" -#: Endpointman.class.php:1269 Endpointman.class.php:1411 +#: Endpointman.class.php:1757 Endpointman.class.php:1891 msgid "No send id!" msgstr "No se ha enviado ID!" -#: Endpointman.class.php:1272 Endpointman.class.php:1414 +#: Endpointman.class.php:1760 Endpointman.class.php:1894 msgid "No send idtype!" msgstr "No se ha enviado IDType!" -#: Endpointman.class.php:1275 Endpointman.class.php:1417 +#: Endpointman.class.php:1763 Endpointman.class.php:1897 msgid "ID send is not number!" msgstr "ID enviado no es numero!" -#: Endpointman.class.php:1294 Endpointman.class.php:1440 +#: Endpointman.class.php:1782 Endpointman.class.php:1920 msgid "IDType invalid: " msgstr "IDType no valido:" -#: Endpointman.class.php:1408 +#: Endpointman.class.php:1888 msgid "Invalid Value!" msgstr "Valor no valido!" -#: Endpointman.class.php:1592 +#: Endpointman.class.php:2072 msgid "Maximum stack depth exceeded" msgstr "Superó capacidad de la pila máximo" -#: Endpointman.class.php:1595 +#: Endpointman.class.php:2075 msgid "Underflow or the modes mismatch" msgstr "" -#: Endpointman.class.php:1598 +#: Endpointman.class.php:2078 msgid "Unexpected control character found" msgstr "Carácter de control inesperado encontró" -#: Endpointman.class.php:1601 +#: Endpointman.class.php:2081 msgid "Syntax error, malformed JSON" msgstr "Error de sintaxis, JSON malformada" -#: Endpointman.class.php:1604 +#: Endpointman.class.php:2084 msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "Malformados caracteres UTF-8, posiblemente incorrectamente codificada" -#: Endpointman.class.php:1607 +#: Endpointman.class.php:2087 msgid "Unknown error" msgstr "Error desconocido." -#: Endpointman.class.php:1616 +#: Endpointman.class.php:2096 msgid "Cant find file:" msgstr "No se puede encontrar el archivo:" -#: Endpointman.class.php:1633 +#: Endpointman.class.php:2113 msgid "Not able to connect to repository. Using local master file instead." msgstr "" -#: Endpointman.class.php:1648 +#: Endpointman.class.php:2128 msgid "Not able to connect to repository. Using local Provisioner.net Package." msgstr "" -#: Endpointman.class.php:1678 +#: Endpointman.class.php:2158 msgid "" "Not able to connect to repository. Using local brand [%_brandname_%] file " "instead." msgstr "" -#: Endpointman.class.php:1709 +#: Endpointman.class.php:2189 msgid "Error: No Local File for %_name_% !" msgstr "" -#: Endpointman.class.php:1710 +#: Endpointman.class.php:2190 msgid "Learn how to manually upload packages here (it's easy!):" msgstr "" -#: Endpointman.class.php:1711 Endpointman.class.php:1737 +#: Endpointman.class.php:2191 Endpointman.class.php:2217 msgid "" "Click Here!" msgstr "" -#: Endpointman.class.php:1735 Endpointman.class.php:1736 +#: Endpointman.class.php:2215 Endpointman.class.php:2216 msgid "" "Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" msgstr "" -#: Endpointman.class.php:1744 +#: Endpointman.class.php:2224 msgid "" "The Remote Server Is Currently Syncing With the Master Server, Please try " "again later" msgstr "" -#: Endpointman.class.php:1820 +#: Endpointman.class.php:2300 msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" msgstr "" -#: Endpointman.class.php:1957 +#: Endpointman.class.php:2437 msgid "Skipping download..." msgstr "Omitir descarga..." -#: Endpointman.class.php:1961 Endpointman.class.php:1973 +#: Endpointman.class.php:2441 Endpointman.class.php:2453 msgid "Downloading firmware..." msgstr "Descargando Frimware..." -#: Endpointman.class.php:1964 Endpointman.class.php:1976 +#: Endpointman.class.php:2444 Endpointman.class.php:2456 msgid "Error download frimware package!" msgstr "Error al descarga paquete del firmware!" -#: Endpointman.class.php:1983 +#: Endpointman.class.php:2463 msgid "Checking MD5sum of Package..." msgstr "Comprobando MD5sum en Paquete..." -#: Endpointman.class.php:1985 +#: Endpointman.class.php:2465 msgid "Matches!" msgstr "Correcto!" -#: Endpointman.class.php:1992 +#: Endpointman.class.php:2472 msgid "Installing Firmware..." msgstr "Instalando Frimware..." -#: Endpointman.class.php:1999 +#: Endpointman.class.php:2479 msgid "- Failed To Copy %_FILE_%!" msgstr "- Error al copiar %_FILE_%!" -#: Endpointman.class.php:2003 +#: Endpointman.class.php:2483 msgid "- Copied %_FILE_% to %_FILETO_%." msgstr "- Copiado %_FILE_% a %_FILETO_%." -#: Endpointman.class.php:2015 +#: Endpointman.class.php:2495 msgid "Copy Error Detected! Aborting Install!" msgstr "Detectado error al copiar! Abortada la Instalacion!" -#: Endpointman.class.php:2017 Endpointman.class.php:2125 +#: Endpointman.class.php:2497 Endpointman.class.php:2605 msgid "Please Check Directory/Permissions!" msgstr "Compruebe los permisos del directorio!" -#: Endpointman.class.php:2024 +#: Endpointman.class.php:2504 msgid "Firmware MD5 didn't match!" msgstr "MD5 de Frimware no coincide!" -#: Endpointman.class.php:2028 +#: Endpointman.class.php:2508 msgid "Your Firmware is already up to date" msgstr "Tu Frimware ya esta actualizado" -#: Endpointman.class.php:2037 +#: Endpointman.class.php:2517 msgid "Uninstalla frimware..." msgstr "Desisntalando Frimware..." -#: Endpointman.class.php:2060 +#: Endpointman.class.php:2540 msgid "Uninstalla Brand..." msgstr "Desisntalando Marca..." -#: Endpointman.class.php:2088 +#: Endpointman.class.php:2568 msgid "All Done!" msgstr "Todo Correcto!" -#: Endpointman.class.php:2109 +#: Endpointman.class.php:2589 msgid "Not allowed in repo mode!!" msgstr "No permite en modo de repo!" -#: Endpointman.class.php:2122 +#: Endpointman.class.php:2602 msgid "Creating EPM temp directory" msgstr "Creando directorio temporal para EPM" -#: Endpointman.class.php:2124 +#: Endpointman.class.php:2604 msgid "Error creating directory: %_DIR_%" msgstr "Error al crear el directorio: %_DIR_%" -#: Endpointman.class.php:2130 +#: Endpointman.class.php:2610 msgid "Downloading Brand JSON....." msgstr "Descargando JSON Marca...." -#: Endpointman.class.php:2139 +#: Endpointman.class.php:2619 msgid "Downloading Brand Package..." msgstr "Descargando paquete de Marca...." -#: Endpointman.class.php:2146 +#: Endpointman.class.php:2626 msgid "Checking MD5sum of Package...." msgstr "Comprobando MD5sum de paquete..." -#: Endpointman.class.php:2150 +#: Endpointman.class.php:2630 msgid "Extracting Tarball........" msgstr "" -#: Endpointman.class.php:2158 +#: Endpointman.class.php:2638 msgid "MD5 Did not match!" msgstr "- MD5 no coincide!" -#: Endpointman.class.php:2161 +#: Endpointman.class.php:2641 msgid "Can't Find Downloaded File!" msgstr "No puede encontrar el archivo descargado." -#: Endpointman.class.php:2164 +#: Endpointman.class.php:2644 msgid "Error download Brand package!" msgstr "Error de descarga paquete de marcas!" -#: Endpointman.class.php:2167 +#: Endpointman.class.php:2647 msgid "" "Error Connecting to the Package Repository. Module not installed. Please Try " "again later." @@ -632,7 +717,7 @@ msgstr "" "Error al conectar al repositorio de paquetes. Módulo no instalado. Por favor " "Inténtalo más tarde." -#: Endpointman.class.php:2168 +#: Endpointman.class.php:2648 msgid "" "You Can Also Manually Update The Repository By Downloading Files here: " "%_URL_INI_% Release Repo %_URL_END_%" @@ -640,139 +725,165 @@ msgstr "" "También puede actualizar manualmente el repositorio mediante la descarga de " "archivos aquí: %_URL_INI_% de lanzamiento Repo %_URL_END_%" -#: Endpointman.class.php:2169 +#: Endpointman.class.php:2649 msgid "Then Use Manual Upload in Advanced Settings." msgstr "" -#: Endpointman.class.php:2172 +#: Endpointman.class.php:2652 msgid "Installing brands is disabled while in repo mode!" msgstr "Instalación de marcas se desactiva en el modo de Repo!" -#: Endpointman.class.php:2181 +#: Endpointman.class.php:2661 msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" msgstr "update_brand (): depuración se establece en %_DEBUG_MODE_%" -#: Endpointman.class.php:2184 +#: Endpointman.class.php:2664 msgid "Processing %_PATH_%/brand_data.json..." msgstr "Procesando %_PATH_%/brand_data.json..." -#: Endpointman.class.php:2189 +#: Endpointman.class.php:2669 msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" msgstr "Parece ser un archivo JSON válido Provisioner.net ..... Continuando" -#: Endpointman.class.php:2197 +#: Endpointman.class.php:2677 msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." msgstr "" "Creando estructura de directorios para la Marca '% _NAME_%' y moviendo " "archivos..." -#: Endpointman.class.php:2216 +#: Endpointman.class.php:2696 msgid "- Error Moving %_FILENAME_%!" msgstr "- Error Moviendo %_FILENAME_%!" -#: Endpointman.class.php:2233 +#: Endpointman.class.php:2713 msgid "Updating %_BRANDNAME_% brand data.........." msgstr "Actualizando datos de la marca % _BRANDNAME_%.........." -#: Endpointman.class.php:2237 +#: Endpointman.class.php:2717 msgid "Inserting %_BRANDNAME_% brand data.........." msgstr "Insertando datos de la marca % _BRANDNAME_%.........." -#: Endpointman.class.php:2244 +#: Endpointman.class.php:2724 msgid "Updating Family Lines................." msgstr "Actualizando líneas de familia ................." -#: Endpointman.class.php:2253 +#: Endpointman.class.php:2733 msgid "Firmware Requirment Detected!.........." msgstr "Requisito firmware detectado .........." -#: Endpointman.class.php:2270 +#: Endpointman.class.php:2750 msgid "-- Updating Model Lines................" msgstr "-- Actualizando Lineas de Modelos................" -#: Endpointman.class.php:2281 +#: Endpointman.class.php:2761 msgid "----Old Data Detected! Migrating......" msgstr "----Antiguos datos detectados! Migrando......" -#: Endpointman.class.php:2321 Endpointman.class.php:2346 +#: Endpointman.class.php:2801 Endpointman.class.php:2826 msgid "Old Data Detected! Migrating......" msgstr "Antiguos datos detectados! Migrando......" -#: Endpointman.class.php:2372 +#: Endpointman.class.php:2852 msgid "---Updating Model %_NAMEMOD_%" msgstr "--Actualizando Modelo %_NAMEMOD_%" -#: Endpointman.class.php:2376 +#: Endpointman.class.php:2856 msgid "---Inserting Model %_NAMEMOD_%" msgstr "---Insertando Modelo %_NAMEMOD_%" -#: Endpointman.class.php:2382 +#: Endpointman.class.php:2862 msgid "System Error in Sync Model Function, Load Failure!" msgstr "" "Error del sistema en función de sincronización de modelos, Error de carga!" -#: Endpointman.class.php:2391 +#: Endpointman.class.php:2871 msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" msgstr "" "Mover/Eliminar Modelo '% _NAMEMOD_%' que no está presente en el archivo " "JSON......" -#: Endpointman.class.php:2409 +#: Endpointman.class.php:2889 msgid "Updating OUI list in DB" msgstr "Actualizando la lista de OUI en la DB" -#: Endpointman.class.php:2421 +#: Endpointman.class.php:2901 msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "Inválida estructura JSON en %_PATCH _%/brand_data.json" -#: Endpointman.class.php:2424 +#: Endpointman.class.php:2904 msgid "No 'brand_data.xml' file exists!" msgstr "No existe un archivo 'brand_data.xml'!" -#: Endpointman.class.php:2427 +#: Endpointman.class.php:2907 msgid "Removing Temporary Files.............." msgstr "Eliminando Archivos Temporales.............." -#: Endpointman.class.php:2623 +#: Endpointman.class.php:3103 msgid "You Must Select A Model From the Drop Down" msgstr "Usted debe seleccionar un modelo de la gota de Down" -#: Endpointman.class.php:2626 +#: Endpointman.class.php:3106 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "Tu deves seleeciona una Extension/Disposito de listado de abajo" -#: Endpointman.class.php:2686 +#: Endpointman.class.php:3166 msgid "Invalid Model Selected, Can't Sync System" msgstr "Seleccionada Modelo no válido, no puede Sistema de sincronización" -#: Endpointman.class.php:2691 +#: Endpointman.class.php:3171 msgid "Invalid MAC Address" msgstr "Direccion MAC no valida" -#: Endpointman.class.php:2724 Endpointman.class.php:2742 +#: Endpointman.class.php:3204 Endpointman.class.php:3222 msgid "No Devices/Extensions Left to Add" msgstr "No hay dispositivos / Extensiones a la izquierdo para Añadir" -#: Endpointman.class.php:2728 Endpointman.class.php:2746 +#: Endpointman.class.php:3208 Endpointman.class.php:3226 msgid "No Lines Left to Add" msgstr "No hay líneas de a la izquierdo para Añadir" -#: Endpointman.class.php:3454 +#: Endpointman.class.php:3375 +msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" +msgstr "" + +#: Endpointman.class.php:3377 +msgid "" +"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " +"the HTML form" +msgstr "" + +#: Endpointman.class.php:3379 +msgid "The uploaded file was only partially uploaded" +msgstr "" + +#: Endpointman.class.php:3381 +msgid "No file was uploaded" +msgstr "" + +#: Endpointman.class.php:3383 +msgid "Missing a temporary folder" +msgstr "" + +#: Endpointman.class.php:3385 +msgid "Failed to write file to disk" +msgstr "" + +#: Endpointman.class.php:3387 +msgid "File upload stopped by extension" +msgstr "" + +#: Endpointman.class.php:3389 +msgid "Unknown upload error" +msgstr "Error al subir Desconocido" + +#: Endpointman.class.php:3521 msgid "Unknown" msgstr "Desconocido" -#: Endpointman.class.php:3539 +#: Endpointman.class.php:4496 msgid "You can't remove the only line left" msgstr "No se puede quitar la única línea de la izquierda" -#: functions.inc.php:234 -msgid "End Point Manager" -msgstr "Administracion End Point" - -#: functions.inc.php:343 -msgid "Failed to install " -msgstr "Fallo de installacion" - #: page.epm_advanced.php:18 page.epm_config.php:18 msgid "End Point Configuraction Manager" msgstr "Configurar Administracion End Point" @@ -785,19 +896,43 @@ msgstr "Configuración Avanzada" msgid "Package Manager" msgstr "Administracion de Paquetes" +#: provisioning/p.php:33 provisioning/p.php:129 +msgid "Error 403 Forbidden" +msgstr "Error 403 - Prohibido" + +#: provisioning/p.php:34 provisioning/p.php:130 +msgid "Access denied!" +msgstr "¡Acceso denegado!" + +#: provisioning/p.php:98 +msgid "Error 500 Internal Server Error" +msgstr "Error 500 - Error Interno del Servidor" + +#: provisioning/p.php:99 +msgid "System Failure!" +msgstr "¡Fallo de sistema!" + +#: provisioning/p.php:107 provisioning/p.php:121 +msgid "Error 404 Not Found" +msgstr "Error 404, No encontrado" + +#: provisioning/p.php:108 provisioning/p.php:122 +msgid "File not Found!" +msgstr "¡Archivo no encontrado!" + #: views/epm_advanced/oui_manager.views.grid.php:6 #: views/epm_advanced/oui_manager.views.grid.php:8 msgid "Add Custom OUI" -msgstr "" +msgstr "Añadir OUI Personalizado" #: views/epm_advanced/oui_manager.views.grid.php:13 msgid "Refresh Table" -msgstr "" +msgstr "Actualizar Tabla" #: views/epm_advanced/oui_manager.views.grid.php:30 #: views/epm_advanced/oui_manager.views.grid.php:53 msgid "OUI" -msgstr "" +msgstr "OUI" #: views/epm_advanced/oui_manager.views.grid.php:31 #: views/epm_advanced/oui_manager.views.grid.php:56 @@ -807,39 +942,23 @@ msgstr "Marca" #: views/epm_advanced/oui_manager.views.grid.php:32 msgid "Type" -msgstr "" +msgstr "Tipo" #: views/epm_advanced/oui_manager.views.grid.php:33 msgid "Actions" -msgstr "" +msgstr "Accion" #: views/epm_advanced/oui_manager.views.grid.php:61 msgid "New OUI" -msgstr "" +msgstr "Nuevo OUI" #: views/epm_advanced/oui_manager.views.grid.php:80 msgid "Cancel" -msgstr "" +msgstr "Cancelar" #: views/epm_advanced/oui_manager.views.grid.php:81 msgid "Add New" -msgstr "" - -#: views/epm_advanced/poce.views.file_list.php:2 -msgid "Local File Configs" -msgstr "Cargar Archivo de Configuracion" - -#: views/epm_advanced/poce.views.file_list_sql.php:2 -msgid "User File Configs" -msgstr "Usar Archivo de Configuracion" - -#: views/epm_advanced/poce.views.file_list_sql.php:5 -msgid "Delete" -msgstr "Borrar" - -#: views/epm_advanced/poce.views.file_list_template.php:2 -msgid "Custom Template Files" -msgstr "Archivos de plantilla personalizada" +msgstr "Añadir Nuevo" #: views/epm_advanced_iedl.page.php:6 msgid "Export CSV" @@ -850,13 +969,13 @@ msgid "Export CSV file of devices" msgstr "Archivo CSV exportación de dispositivos" #: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:115 +#: views/epm_advanced_manual_upload.page.php:146 msgid "Export" msgstr "Exportar" #: views/epm_advanced_iedl.page.php:26 msgid "Export data configuracion devices." -msgstr "" +msgstr "Exportar datos de configuracion de dispositivo." #: views/epm_advanced_iedl.page.php:35 msgid "Import CSV" @@ -867,8 +986,8 @@ msgid "Import CSV file of devices" msgstr "Importar archivo CSV de dispositivos" #: views/epm_advanced_iedl.page.php:52 views/epm_advanced_iedl.page.php:60 -#: views/epm_advanced_manual_upload.page.php:33 -#: views/epm_advanced_manual_upload.page.php:64 +#: views/epm_advanced_manual_upload.page.php:32 +#: views/epm_advanced_manual_upload.page.php:62 msgid "Import" msgstr "Importar" @@ -928,193 +1047,260 @@ msgstr "Descarga actualizada liberado de" msgid "Provisioner Package" msgstr "Provisioner Paquete" -#: views/epm_advanced_manual_upload.page.php:43 +#: views/epm_advanced_manual_upload.page.php:41 msgid "Import a package Provisioner in manual mode." -msgstr "" +msgstr "Importación de un paquete de Provisioner en el modo manual." -#: views/epm_advanced_manual_upload.page.php:56 +#: views/epm_advanced_manual_upload.page.php:54 msgid "Brand Package" msgstr "Paquete de marcas" -#: views/epm_advanced_manual_upload.page.php:73 +#: views/epm_advanced_manual_upload.page.php:71 msgid "Import a package brand in manual mode." -msgstr "" +msgstr "Importación de un paquete de la marca en el modo manual." -#: views/epm_advanced_manual_upload.page.php:88 +#: views/epm_advanced_manual_upload.page.php:114 msgid "Export Brand Packages" msgstr "Paquetes de exportación de la marcas" -#: views/epm_advanced_manual_upload.page.php:91 +#: views/epm_advanced_manual_upload.page.php:117 msgid "Learn how to create your own brand package at " msgstr "Aprender a crear su propio paquete de la marca en " -#: views/epm_advanced_manual_upload.page.php:99 +#: views/epm_advanced_manual_upload.page.php:125 msgid "Brand's Available" -msgstr "" +msgstr "Marcas disponibles" -#: views/epm_advanced_manual_upload.page.php:124 +#: views/epm_advanced_manual_upload.page.php:131 +msgid "Heads up!" +msgstr "¡Aviso!" + +#: views/epm_advanced_manual_upload.page.php:131 +msgid "List Bran's Availables empty." +msgstr "Lista de Marcas disponibles vacia." + +#: views/epm_advanced_manual_upload.page.php:137 +msgid "Select Brand:" +msgstr "Seleccionar Marca:" + +#: views/epm_advanced_manual_upload.page.php:157 msgid "Explor a package brand's availables." -msgstr "" +msgstr "Exportar paquete de Marcas disponibles." -#: views/epm_advanced_manual_upload.page.php:135 +#: views/epm_advanced_manual_upload.page.php:168 msgid "List of other exports" -msgstr "" - -#: views/epm_advanced_manual_upload.page.php:143 -msgid "It has not created any package." -msgstr "" +msgstr "Lista de otras exportaciones." -#: views/epm_advanced_manual_upload.page.php:158 +#: views/epm_advanced_manual_upload.page.php:177 msgid "Empty list." -msgstr "" +msgstr "Lista Vacia." -#: views/epm_advanced_manual_upload.page.php:175 +#: views/epm_advanced_manual_upload.page.php:209 msgid "List packages generated in other exports." +msgstr "Lista paquetes generados en otras exportaciones." + +#: views/epm_advanced_poce.page.php:16 +msgid "Local File Configs" +msgstr "Cargar Archivo de Configuracion" + +#: views/epm_advanced_poce.page.php:28 +msgid "Custom Template Files" +msgstr "Archivos de plantilla personalizada" + +#: views/epm_advanced_poce.page.php:39 +msgid "User File Configs" +msgstr "Usar Archivo de Configuracion" + +#: views/epm_advanced_poce.page.php:53 views/epm_advanced_poce.page.php:72 +msgid "No Selected" +msgstr "No Seleccionado" + +#: views/epm_advanced_poce.page.php:71 +msgid "Full Screen F11" +msgstr "Pantalla Completa F11" + +#: views/epm_advanced_poce.page.php:74 +msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." +msgstr "" +"Nota: Presione F11 para modo pantalla completa, ESC para salir de Pantalla " +"Completa." + +#: views/epm_advanced_poce.page.php:80 +msgid "" +"NOTE: File may be over-written during next package update. We suggest also " +"using the Share button below to improve the next release." msgstr "" -#: views/epm_advanced_poce.page.php:203 +#: views/epm_advanced_poce.page.php:83 msgid "Save" msgstr "Guardar" -#: views/epm_advanced_poce.page.php:208 +#: views/epm_advanced_poce.page.php:84 +msgid "Delete" +msgstr "Borrar" + +#: views/epm_advanced_poce.page.php:90 +msgid "" +"NOTE: File is permanently saved and not over-written during next package " +"update." +msgstr "" +"Nota: El archivo se guarda permanentemente y no sobrescribir durante las " +"siguientes actualizaciónes de paquetes." + +#: views/epm_advanced_poce.page.php:96 msgid "Save As..." msgstr "Gardar Como..." -#: views/epm_advanced_poce.page.php:216 -msgid "Share" +#: views/epm_advanced_poce.page.php:104 +msgid "" +"Upload this configuration file to the Provisioner.net Team. Files " +"shared are confidential and help improve the quality of releases." msgstr "" -#: views/epm_advanced_settings.page.php:43 +#: views/epm_advanced_poce.page.php:107 +msgid "Share" +msgstr "Compartir" + +#: views/epm_advanced_settings.page.php:38 msgid "Setting Provision" msgstr "Ajustes Provision" -#: views/epm_advanced_settings.page.php:54 +#: views/epm_advanced_settings.page.php:49 msgid "IP address of phone server" msgstr "Dirección IP del servidor telefónico (PBX)" -#: views/epm_advanced_settings.page.php:59 +#: views/epm_advanced_settings.page.php:56 +#: views/epm_advanced_settings.page.php:191 msgid "Determine for Me" msgstr "Determinar por mí" -#: views/epm_advanced_settings.page.php:88 +#: views/epm_advanced_settings.page.php:81 msgid "Configuration Type" msgstr "Tipo de Configuracion" -#: views/epm_advanced_settings.page.php:93 +#: views/epm_advanced_settings.page.php:86 msgid "File (TFTP/FTP)" msgstr "Archivos (TFTP/FTP)" -#: views/epm_advanced_settings.page.php:94 +#: views/epm_advanced_settings.page.php:87 msgid "Web (HTTP)" msgstr "Web (HTTP)" -#: views/epm_advanced_settings.page.php:119 +#: views/epm_advanced_settings.page.php:90 +msgid "Updated!" +msgstr "Actualizado!" + +#: views/epm_advanced_settings.page.php:90 +msgid " - Point your phones to: " +msgstr "" + +#: views/epm_advanced_settings.page.php:114 msgid "Global Final Config & Firmware Directory" msgstr "Directorio final de configuracion y firmware" -#: views/epm_advanced_settings.page.php:139 +#: views/epm_advanced_settings.page.php:134 msgid "Time" msgstr "Hora" -#: views/epm_advanced_settings.page.php:157 +#: views/epm_advanced_settings.page.php:152 msgid "Time Zone" msgstr "Zona Horaria" -#: views/epm_advanced_settings.page.php:164 +#: views/epm_advanced_settings.page.php:161 msgid "TimeZone by PBX Setting" -msgstr "" +msgstr "Zona Horaria de la PBX" -#: views/epm_advanced_settings.page.php:185 +#: views/epm_advanced_settings.page.php:184 msgid "Time Server (NTP Server)" msgstr "Servidor de Tiempo (NTP Server)" -#: views/epm_advanced_settings.page.php:205 +#: views/epm_advanced_settings.page.php:210 msgid "Local Paths" msgstr "Rutas Locales" -#: views/epm_advanced_settings.page.php:215 +#: views/epm_advanced_settings.page.php:220 msgid "NMAP Executable Path" msgstr "Ruta Ejecutable NMAP" -#: views/epm_advanced_settings.page.php:239 +#: views/epm_advanced_settings.page.php:244 msgid "ARP Executable Path" msgstr "Ruta Ejecutable ARP" -#: views/epm_advanced_settings.page.php:263 +#: views/epm_advanced_settings.page.php:268 msgid "Asterisk Executable Path" msgstr "Ruta Ejecutable Asterisk" -#: views/epm_advanced_settings.page.php:283 +#: views/epm_advanced_settings.page.php:288 msgid "Web Directories" msgstr "Directorios Web" -#: views/epm_advanced_settings.page.php:293 +#: views/epm_advanced_settings.page.php:298 msgid "Package Server" msgstr "Servidor de Paquetes" -#: views/epm_advanced_settings.page.php:298 +#: views/epm_advanced_settings.page.php:305 msgid "Default Mirror FreePBX" -msgstr "" +msgstr "Mirror por defecto de FreePBX" -#: views/epm_advanced_settings.page.php:314 +#: views/epm_advanced_settings.page.php:323 msgid "Experimental" msgstr "Experimental" -#: views/epm_advanced_settings.page.php:325 +#: views/epm_advanced_settings.page.php:334 msgid "Enable FreePBX ARI Module" msgstr "Activar FreePBX Modulo ARI " -#: views/epm_advanced_settings.page.php:330 -#: views/epm_advanced_settings.page.php:366 -#: views/epm_advanced_settings.page.php:395 -#: views/epm_advanced_settings.page.php:424 -#: views/epm_advanced_settings.page.php:453 -#: views/epm_advanced_settings.page.php:482 -#: views/epm_advanced_settings.page.php:511 -#: views/epm_advanced_settings.page.php:540 +#: views/epm_advanced_settings.page.php:339 +#: views/epm_advanced_settings.page.php:375 +#: views/epm_advanced_settings.page.php:404 +#: views/epm_advanced_settings.page.php:433 +#: views/epm_advanced_settings.page.php:462 +#: views/epm_advanced_settings.page.php:491 +#: views/epm_advanced_settings.page.php:520 +#: views/epm_advanced_settings.page.php:549 msgid "Yes" msgstr "Yes" -#: views/epm_advanced_settings.page.php:332 -#: views/epm_advanced_settings.page.php:368 -#: views/epm_advanced_settings.page.php:397 -#: views/epm_advanced_settings.page.php:426 -#: views/epm_advanced_settings.page.php:455 -#: views/epm_advanced_settings.page.php:484 -#: views/epm_advanced_settings.page.php:513 -#: views/epm_advanced_settings.page.php:542 +#: views/epm_advanced_settings.page.php:341 +#: views/epm_advanced_settings.page.php:377 +#: views/epm_advanced_settings.page.php:406 +#: views/epm_advanced_settings.page.php:435 +#: views/epm_advanced_settings.page.php:464 +#: views/epm_advanced_settings.page.php:493 +#: views/epm_advanced_settings.page.php:522 +#: views/epm_advanced_settings.page.php:551 msgid "No" msgstr "No" -#: views/epm_advanced_settings.page.php:361 +#: views/epm_advanced_settings.page.php:370 msgid "Enable Debug Mode" msgstr "Activar Debug Mode" -#: views/epm_advanced_settings.page.php:390 +#: views/epm_advanced_settings.page.php:399 msgid "Disable Tooltips" msgstr "Desactivar las sugerencias" -#: views/epm_advanced_settings.page.php:419 +#: views/epm_advanced_settings.page.php:428 msgid "Allow Duplicate Extensions" msgstr "Permitir extensiones duplicadas" -#: views/epm_advanced_settings.page.php:448 +#: views/epm_advanced_settings.page.php:457 msgid "Allow Saving Over Default Configuration Files" msgstr "" -#: views/epm_advanced_settings.page.php:477 +#: views/epm_advanced_settings.page.php:486 msgid "Disable TFTP Server Check" -msgstr "" +msgstr "Desactivar comprobación de servidor TFTP" -#: views/epm_advanced_settings.page.php:506 +#: views/epm_advanced_settings.page.php:515 msgid "Disable Configuration File Backups" msgstr "Desactivar las copias de seguridad del archivo de configuración" -#: views/epm_advanced_settings.page.php:535 +#: views/epm_advanced_settings.page.php:544 msgid "Use GITHUB Live Repo" msgstr "Utilice GitHub en directo Repo" -#: views/epm_advanced_settings.page.php:597 +#: views/epm_advanced_settings.page.php:606 msgid "GIT Branch" msgstr "GIT Rama" @@ -1141,6 +1327,15 @@ msgstr "Buscar actualizaciones" msgid "List Packages Manager" msgstr "Administracion Lista de Paquetes" +#~ msgid "List Bran's Availables emtry." +#~ msgstr "Lista de Marcas disponibles vacia." + +#~ msgid "End Point Manager" +#~ msgstr "Administracion End Point" + +#~ msgid "Failed to install " +#~ msgstr "Fallo de installacion" + #~ msgid "Add" #~ msgstr "Añadir" diff --git a/views/epm_advanced/poce.views.bootnav.php b/views/epm_advanced/poce.views.bootnav.php index 7ac2ea06..48b72244 100644 --- a/views/epm_advanced/poce.views.bootnav.php +++ b/views/epm_advanced/poce.views.bootnav.php @@ -1,16 +1,8 @@ +
        '.substr($srow['long_name'], 0, 40).(strlen($srow['long_name']) > 40 ? "..." : "").''; - - - - - /* - if ((isset($request['product_select'])) AND ($request['product_select'] == $srow['id'])) { - $srow['tselected'] = 1; - } - echo '  '.substr($srow['long_name'], 0, 40).(strlen($srow['long_name']) > 40 ? "..." : "").''; - */ } -?> \ No newline at end of file +?> +
      \ No newline at end of file diff --git a/views/epm_advanced_manual_upload.page.php b/views/epm_advanced_manual_upload.page.php index 429470db..c64b97f6 100644 --- a/views/epm_advanced_manual_upload.page.php +++ b/views/epm_advanced_manual_upload.page.php @@ -128,7 +128,7 @@
      - +
      diff --git a/views/epm_advanced_poce.page.php b/views/epm_advanced_poce.page.php index ab3d77ff..f31781c2 100644 --- a/views/epm_advanced_poce.page.php +++ b/views/epm_advanced_poce.page.php @@ -1,117 +1,151 @@ - - -
      +
      -
      -
      -
      - - + + +
      +
      +
      +
      + + +
      -


      -
      - -
      -
      - - + +
      +
      + + +
      -


      -
      -
      -
      - - +
      +
      + + +
      -


      -
      -

      Product:

      -

      File:

      -

      -
      -
      -
      -
      - - - -

      - - - -
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      + + + + + + + + +
      +
      + + + + +
      +
      + +
      +
      + Share button below to improve the next release.")?> +
      +
      + + +
      +
      + +
      +
      + +
      +
      +
      + + + + +
      +
      +
      + +
      +
      + Provisioner.net Team. Files shared are confidential and help improve the quality of releases.")?> +
      +
      + +
      +
      +
      +
      - - -
      +
      -
      0) ORDER BY long_name ASC'; $product_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - - $content = load_view(__DIR__.'/epm_advanced/poce.views.bootnav.php', array('request' => $request, 'product_list' => $product_list)); - - echo $content; + echo load_view(__DIR__.'/epm_advanced/poce.views.bootnav.php', array('request' => $_REQUEST, 'product_list' => $product_list)); unset ($product_list); unset ($sql); ?> -
      + + + + + + + +&filename=&product_select=&"> + * */ +?> + + - - - -
      - - + + From b1736b4ae871c68b1a66ae7e8bb014d67df8d9f7 Mon Sep 17 00:00:00 2001 From: vsc55 Date: Thu, 25 Feb 2016 16:28:06 +0100 Subject: [PATCH 429/623] CSS: Remove styles that are not needed. New: Generate file list export brands through AJAX. Fix: Rename wrong named JS functions. --- Endpointman.class.php | 125 +++++++++++++----- assets/css/epm_advanced.css | 86 +------------ assets/css/epm_config.css | 4 +- assets/css/epm_global.css | 26 ---- assets/js/epm_advanced.js | 149 +++++++++++++++++++++- page.epm_advanced.php | 2 +- page.epm_config.php | 2 +- views/epm_advanced_iedl.page.php | 2 +- views/epm_advanced_manual_upload.page.php | 105 +++++---------- 9 files changed, 289 insertions(+), 212 deletions(-) diff --git a/Endpointman.class.php b/Endpointman.class.php index 3d42d5fc..81f8fa25 100644 --- a/Endpointman.class.php +++ b/Endpointman.class.php @@ -43,6 +43,7 @@ function generate_xml_from_array ($array, $node_name, &$tab = -1) return $xml; } + class Endpointman implements \BMO { //public $eda; //endpoint data abstraction layer @@ -166,9 +167,12 @@ public function chownFreepbx() { } public function ajaxRequest($req, &$setting) { - $setting['authenticate'] = true; - $setting['allowremote'] = true; - return true; + +//AVISO!!!!!!!!!!!!!!!!!!!!!!!!!! +//PERMITE TODO!!!!!!!!!!!!!!!!!!! +//$setting['authenticate'] = true; +//$setting['allowremote'] = true; +//return true; switch ($_REQUEST['module_sec']) { @@ -208,6 +212,7 @@ public function ajaxRequest($req, &$setting) { case "poce_save_as_file": case "poce_sendid": case "poce_delete_config_custom": + case "list_files_brands_export": case "saveconfig": $setting['authenticate'] = true; $setting['allowremote'] = false; @@ -419,6 +424,18 @@ public function ajaxHandler() { } //$retarr['txt'] = $txt['settings']; } + elseif ($module_tab == "manual_upload") { + switch ($command) + { + case "list_files_brands_export": + $retarr = $this->epm_advanced_manual_upload_list_files_brans_export(); + break; + + default: + $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); + break; + } + } else { $retarr = array("status" => false, "message" => _("Tab is not valid!") . " [" .$module_tab. "]"); } @@ -632,6 +649,10 @@ public function uninstall() { $provisioning_path = $this->config->get('AMPWEBROOT')."/provisioning"; if(is_link($provisioning_path)) { unlink($provisioning_path); } + if(!is_link($this->config->get('AMPWEBROOT').'/admin/assets/endpointman')) { + $this->system->rmrf($this->config->get('AMPWEBROOT').'/admin/assets/endpointman'); + } + out(_("Dropping all relevant tables")); $sql = "DROP TABLE `endpointman_brand_list`"; $sth = $this->db->prepare($sql); @@ -664,11 +685,6 @@ public function uninstall() { $sth = $this->db->prepare($sql); $sth->execute(); return true; - - //show exception!!!!!! - //if(!is_link($this->config->get('AMPWEBROOT').'/admin/assets/endpointman')) { - // $this->system->rmrf($this->config->get('AMPWEBROOT').'/admin/assets/endpointman'); - //} } public function backup() { @@ -1019,7 +1035,7 @@ public function epm_advanced_poce_select_file() $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $config_files = explode(",", $row['config_files']); - //TODO: Aadir validacion para ver si $dget['file_name'] esta en el array $config_files + //TODO: Añadir validacion para ver si $dget['file_name'] esta en el array $config_files $filename = $dget['file_name']; $pathfile = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $filename; @@ -1096,16 +1112,7 @@ public function epm_advanced_poce_select_file() - - - - - - - - - - + //TODO: PENDIENTE REVISAR function epm_advanced_poce_sendid() { if (! isset($_REQUEST['product_select'])) { @@ -1148,6 +1155,12 @@ function epm_advanced_poce_sendid() return $retarr; } + + + + + + function epm_advanced_poce_save_file() { if (! isset($_REQUEST['product_select'])) { @@ -1281,18 +1294,72 @@ function epm_advanced_poce_delete_config_custom() - - - - - - - - /************************************************************ **** FUNCIONES SEC MODULO "epm_advanced\manual_upload". **** ***********************************************************/ + public function epm_advanced_manual_upload_list_files_brans_export() + { + $path_tmp_dir = $this->PHONE_MODULES_PATH."temp/export/"; + $array_list_files = array(); + $array_count_brand = array(); + + + $array_list_exception= array(".", "..", ".htaccess"); + if(file_exists($path_tmp_dir)) + { + if(is_dir($path_tmp_dir)) + { + $l_files = scandir($path_tmp_dir, 1); + $i = 0; + foreach ($l_files as $archivo) { + if (in_array($archivo, $array_list_exception)) { continue; } + + $pathandfile = $path_tmp_dir.$archivo; + $brand = substr(pathinfo($archivo, PATHINFO_FILENAME), 0, -11); + $ftime = substr(pathinfo($archivo, PATHINFO_FILENAME), -10); + + $array_count_brand[] = $brand; + $array_list_files[$i] = array("brand" => $brand, + "pathall" => $pathandfile, + "path" => $path_tmp_dir, + "file" => $archivo, + "filename" => pathinfo($archivo, PATHINFO_FILENAME), + "extension" => pathinfo($archivo, PATHINFO_EXTENSION), + "timer" => $ftime, + "timestamp" => strftime("[%Y-%m-%d %H:%M:%S]", $ftime), + "mime_type" => mime_content_type($pathandfile), + "is_dir" => is_dir($pathandfile), + "is_file" => is_file($pathandfile), + "is_link" => is_link($pathandfile), + "readlink" => (is_link($pathandfile) == true ? readlink ($pathandfile) : NULL)); + + $i++; + } + unset ($l_files); + + $array_count_brand = array_count_values($array_count_brand); + ksort ($array_count_brand); + $array_count_brand_end = array(); + + foreach($array_count_brand as $key => $value) { + $array_count_brand_end[] = array('name' => $key , 'num' => $value); + } + + $retarr = array("status" => true, "message" => _("List Done!"), "countlist" => count($array_list_files), "list_files" => $array_list_files, "list_brands" => $array_count_brand_end ); + unset ($array_count_brand_end); + unset ($array_count_brand); + unset ($array_list_files); + } + else { + $retarr = array("status" => false, "message" => _("Not is directory: ") . $path_tmp_dir); + } + } else { + $retarr = array("status" => false, "message" => _("Directory no exists: ") . $path_tmp_dir); + } + return $retarr; + } + public function epm_advanced_manual_upload_brand() { if (count($_FILES["files"]["error"]) == 0) { @@ -1628,7 +1695,7 @@ public function epm_advanced_iedl_import() private function epm_advanced_oui_remove() { - //TODO: Aadir validacion de si es custom o no + //TODO: Añadir validacion de si es custom o no if ((! isset($_REQUEST['id_del'])) OR ($_REQUEST['id_del'] == "")) { $retarr = array("status" => false, "message" => _("No ID set!")); } @@ -1650,7 +1717,7 @@ private function epm_advanced_oui_remove() private function epm_advanced_oui_add() { - //TODO: Pendiente aadir isExiste datos. + //TODO: Pendiente añadir isExiste datos. if ((! isset($_REQUEST['number_new_oui'])) OR ($_REQUEST['number_new_oui'] == "")) { $retarr = array("status" => false, "message" => _("No OUI set!")); } diff --git a/assets/css/epm_advanced.css b/assets/css/epm_advanced.css index a3286238..557bd78a 100644 --- a/assets/css/epm_advanced.css +++ b/assets/css/epm_advanced.css @@ -1,11 +1,6 @@ -@import "epm_global.css"; +@CHARSET "ISO-8859-1"; -@import "codemirror.css"; -@import "codemirror_simplescrollbars.css"; -@import "codemirror_fullscreen.css"; - - -.linedwrap { +#epm_advanced .linedwrap { border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; @@ -33,77 +28,11 @@ -moz-box-shadow: 4px 4px 2px #00dddd; } - - -#AddDlgModal .styled-select { width: 240px; } -#AddDlgModal .styled-select select { width: 268px; } - - -#oui_manager div.sortable { - border: 0px; - margin-top: 0px; - margin-right: 0px; - margin-bottom: 0px; - margin-left: 0px; - font-family: inherit; - font-style: inherit; - font-weight: inherit; - font-size: inherit; - line-height: inherit; - font-size-adjust: inherit; - font-stretch: inherit; - font-feature-settings: inherit; - font-language-override: inherit; - font-kerning: inherit; - font-synthesis: inherit; - font-variant-alternates: inherit; - font-variant-caps: inherit; - font-variant-east-asian: inherit; - font-variant-ligatures: inherit; - font-variant-numeric: inherit; - font-variant-position: inherit; - color: inherit; - - box-shadow: inherit; - -webkit-box-shadow: inherit; - -moz-box-shadow: inherit; - - box-sizing: border-box; - - padding-top: 8px; - padding-right: 8px; - padding-bottom: 8px; - padding-left: 8px; - line-height: 24px; - vertical-align: top; - overflow-x: hidden; - overflow-y: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - - - - - -#manual_upload .styled-select -{ - height: 29px; - width: 400px; -} - -#manual_upload .styled-select select -{ - height: 29px; - width: 428px; -} - - -.custom_box_import div.col-md-9 { +#epm_advanced .custom_box_import div.col-md-9 { display: table; } -.custom_box_import div.col-md-9 span { +#epm_advanced .custom_box_import div.col-md-9 span { display: table-cell; margin: 0px; padding: 0px 0px 0px 10px; @@ -186,8 +115,7 @@ } - -div.CodeMirror +#epm_advanced div.CodeMirror { /* transition-property: border, box-shadow; @@ -229,7 +157,7 @@ div.CodeMirror font-family: Courier, "dejavu sans mono","monaco","lucida console","courier new",monospace; } -div.CodeMirror:hover +#epm_advanced div.CodeMirror:hover { border-top-color: rgba(171, 213, 242, 0.9); border-right-color: rgba(171, 213, 242, 0.9); @@ -239,7 +167,7 @@ div.CodeMirror:hover } /* -div.CodeMirror:hover +#epm_advanced div.CodeMirror:hover { border-top-color: rgba(82, 168, 236, 0.8); border-right-color: rgba(82, 168, 236, 0.8); diff --git a/assets/css/epm_config.css b/assets/css/epm_config.css index aa25f1cb..9ef3afcd 100644 --- a/assets/css/epm_config.css +++ b/assets/css/epm_config.css @@ -1,6 +1,6 @@ -@import "epm_global.css"; +@CHARSET "ISO-8859-1"; -div.sortable +#epm_config div.sortable { background: transparent; diff --git a/assets/css/epm_global.css b/assets/css/epm_global.css index 111daa47..66c056d5 100644 --- a/assets/css/epm_global.css +++ b/assets/css/epm_global.css @@ -10,32 +10,6 @@ margin-bottom: 10px; } -/* -------------------- Select Box Styles: bavotasan.com Method (with special adaptations by ericrasch.com) */ -/* -------------------- Source: http://bavotasan.com/2011/style-select-box-using-only-css/ */ -.styled-select -{ - background: url(../images/15xvbd5.png) no-repeat 96% 0; - background-color: #3b8ec2; - height: 35px; - overflow: hidden; - width: 240px; - - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; -} - -.styled-select select -{ - background: transparent; - border: none; - color: #fff; - font-size: 14px; - height: 35px; - padding: 5px; /* If you add too much padding here, the options won't show in IE */ - width: 268px; -} - .pull-xs-right { float: right; diff --git a/assets/js/epm_advanced.js b/assets/js/epm_advanced.js index 8c256984..bce4d6f4 100644 --- a/assets/js/epm_advanced.js +++ b/assets/js/epm_advanced.js @@ -74,13 +74,24 @@ function epm_advanced_select_tab_ajax(idtab) }); } } + else if (idtab == "manual_upload") { + epm_advanced_tab_manual_upload_list_files_brand_expor(); + } return true; } + function close_module_actions_epm_advanced(goback, acctionname = "") { } + +function end_module_actions_epm_advanced(acctionname = "") +{ + if (acctionname == "manual_upload_bt_export_brand") { + epm_advanced_tab_manual_upload_list_files_brand_expor(); + } +} /**** END: FUNCTION GLOBAL SEC ****/ @@ -91,7 +102,7 @@ function close_module_actions_epm_advanced(goback, acctionname = "") /**** INI: FUNCTION TAB UPLOAD_MANUAL ****/ -function epm_config_tab_manual_upload_bt_explor_brand() +function epm_advanced_tab_manual_upload_bt_explor_brand() { var packageid = $('#brand_export_pack_selected').val(); if (packageid == "") { @@ -106,12 +117,144 @@ function epm_config_tab_manual_upload_bt_explor_brand() } } -function epm_config_tab_manual_upload_bt_upload(command, formname) +function epm_advanced_tab_manual_upload_bt_upload(command, formname) { if ((command == "") || (formname == "")) { return; } var urlStr = "config.php?display=epm_advanced&subpage=manual_upload&command="+command; epm_global_dialog_action("manual_upload_bt_upload", urlStr, formname); } + +function epm_advanced_tab_manual_upload_list_files_brand_expor() +{ + epm_global_html_find_show_hide("#list-brands-export-item-loading", true, 1, true); + epm_global_html_find_hide_and_remove("#list-brands-export > li.item-list-brand-export", 1, true); + + $.ajax({ + type: 'POST', + url: "ajax.php", + data: { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "manual_upload", + command: "list_files_brands_export" + }, + dataType: 'json', + timeout: 60000, + error: function(xhr, ajaxOptions, thrownError) { + fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); + return false; + }, + success: function(data) + { + if (data.status == true) + { + if (data.countlist == 0) + { + $("#list-brands-export").append( + $('
    • ', { 'class' : 'list-group-item item-list-brand-export' }) + .text("Empty list") + .append( + $('', { 'class' : 'label label-default label-pill pull-xs-right' }) + .text("0") + ) + ); + } + else + { + $(data.list_brands).each(function(index, itemData) + { + $("#list-brands-export").append( + $('
    • ', { 'class' : 'list-group-item item-list-brand-export', 'id' : 'item-list-brans-export-' + itemData.name }) + .append( + $('', { + 'data-toggle' : 'collapse', + 'href' : '#box_list_files_brand_' + itemData.name, + 'aria-expanded' : 'false', + 'aria-controls' : 'box_list_files_brand_' + itemData.name, + 'class' : 'collapse-item list-group-item', + 'onclick' : 'epm_global_html_css_name(this,"auto","active"); $(this).blur();' + }) + .append( + $('', { 'class' : 'label label-default label-pill pull-xs-right' }).text(itemData.num), + $('', { 'class' : 'fa fa-expand' }) + ) + .append( + $("", {}).text(" " + itemData.name) + ) + ) + ); + if (itemData.num > 0) { + $('#item-list-brans-export-' + itemData.name).append( + $('
    • '; + echo ' '; + + foreach ($v as $itemlist) { + echo ''; + echo ' '.strftime("[%Y-%m-%d %H:%M:%S]", $itemlist['timer']).''; + echo '   '.$itemlist['pathall']; + echo ''; + } + echo ''; + echo '
    • '; + } + + */ + } + + fpbxToast(data.message, '', 'success'); + return true; + } + else + { + $("#list-brands-export").append( + $('
    • ', { 'class' : 'list-group-item item-list-brand-export text-center bg-warning' }).text(data.message) + ); + fpbxToast(data.message, data.txt.error, 'error'); + return false; + } + }, + }); + + epm_global_html_find_show_hide("#list-brands-export-item-loading", false, 1, true); +} /**** END: FUNCTION TAB UPLOAD_MANUAL ****/ @@ -122,7 +265,7 @@ function epm_config_tab_manual_upload_bt_upload(command, formname) /**** INI: FUNCTION TAB IEDL ****/ -function epm_config_tab_iedl_bt_import() +function epm_advanced_tab_iedl_bt_import() { var urlStr = "config.php?display=epm_advanced&subpage=iedl&command=import"; var formname = "iedl_form_import_cvs"; diff --git a/page.epm_advanced.php b/page.epm_advanced.php index a30b2541..d1b1210f 100644 --- a/page.epm_advanced.php +++ b/page.epm_advanced.php @@ -14,7 +14,7 @@ ?> -
      +

      diff --git a/page.epm_config.php b/page.epm_config.php index 577c6224..eda79a48 100644 --- a/page.epm_config.php +++ b/page.epm_config.php @@ -14,7 +14,7 @@ ?> -
      +

      diff --git a/views/epm_advanced_iedl.page.php b/views/epm_advanced_iedl.page.php index 6822b2f9..8b4772c2 100644 --- a/views/epm_advanced_iedl.page.php +++ b/views/epm_advanced_iedl.page.php @@ -57,7 +57,7 @@ - +
      diff --git a/views/epm_advanced_manual_upload.page.php b/views/epm_advanced_manual_upload.page.php index c64b97f6..7a9693b5 100644 --- a/views/epm_advanced_manual_upload.page.php +++ b/views/epm_advanced_manual_upload.page.php @@ -29,7 +29,7 @@ - +
      @@ -59,7 +59,7 @@ - +
      @@ -75,41 +75,6 @@ -brands_available("",false); - $path_tmp_dir = FreePBX::Endpointman()->PHONE_MODULES_PATH."temp/export/"; - - $array_list_files = array(); - $array_list_exception= array(".", "..", ".htaccess"); - if(file_exists($path_tmp_dir)) - { - if(is_dir($path_tmp_dir)) - { - $l_files = scandir($path_tmp_dir, 1); - foreach ($l_files as $archivo) { - if (in_array($archivo, $array_list_exception)) { continue; } - $pathandfile = $path_tmp_dir.$archivo; - $brand = substr(pathinfo($archivo, PATHINFO_FILENAME), 0, -11); - $ftime = substr(pathinfo($archivo, PATHINFO_FILENAME), -10); - - $array_list_files[$brand][] = array("brand" => $brand, - "pathall" => $pathandfile, - "path" => $path_tmp_dir, - "file" => $archivo, - "filename" => pathinfo($archivo, PATHINFO_FILENAME), - "extension" => pathinfo($archivo, PATHINFO_EXTENSION), - "timer" => $ftime, - "mime_type" => mime_content_type($pathandfile), - "is_dir" => is_dir($pathandfile), - "is_file" => is_file($pathandfile), - "is_link" => is_link($pathandfile), - "readlink" => (is_link($pathandfile) == true ? readlink ($pathandfile) : NULL)); - } - unset ($l_files); - } - } - natsort($array_list_files); -?>

      @@ -120,33 +85,33 @@
      -
      +
      -
      - - +
      + brands_available("",false); + if ($brand_ava == "") : ?> - -
      - + + '.$row['text'].''; } - ?> + ?> -
      -
      - - - - - + + + +
      +
      @@ -169,15 +134,18 @@
      -
        - '; - echo '0'; - echo '  '._("Empty list."); - echo ''; - } - else { + +
          +
        • +   +
        • +
        +
          + $v) { echo '
        • '; @@ -196,7 +164,9 @@ echo '
      '; echo '
    • '; } - } + + */ + ?> @@ -211,9 +181,4 @@ - - \ No newline at end of file + \ No newline at end of file From 87d2d6ecb49f9a8bf9176d3d3dff7cc8844bc22a Mon Sep 17 00:00:00 2001 From: vsc55 Date: Fri, 26 Feb 2016 14:06:47 +0100 Subject: [PATCH 430/623] Brands List files exported finished. Segmenting pages into separate files. Some retouching graphic design. --- assets/css/epm_global.css | 6 + assets/js/epm_advanced.js | 216 ++++++++---------- views/epm_advanced/oui_manager.views.grid.php | 48 +--- .../oui_manager.views.new.modal.php | 66 ++++++ .../poce.views.button.up.files.php | 39 ++++ .../epm_advanced/poce.views.textarea.file.php | 66 ++++++ views/epm_advanced_manual_upload.page.php | 27 --- views/epm_advanced_oui_manager.page.php | 8 +- views/epm_advanced_poce.page.php | 115 +--------- 9 files changed, 282 insertions(+), 309 deletions(-) create mode 100644 views/epm_advanced/oui_manager.views.new.modal.php create mode 100644 views/epm_advanced/poce.views.button.up.files.php create mode 100644 views/epm_advanced/poce.views.textarea.file.php diff --git a/assets/css/epm_global.css b/assets/css/epm_global.css index 66c056d5..69f71746 100644 --- a/assets/css/epm_global.css +++ b/assets/css/epm_global.css @@ -1,5 +1,11 @@ @CHARSET "ISO-8859-1"; + +#epm_templates option[value=""], #epm_advanced option[value=""], #epm_config option[value=""] { + background-color: #E5FFCC; +} + + .section-title { margin: 10px 10px 0px 10px; } diff --git a/assets/js/epm_advanced.js b/assets/js/epm_advanced.js index bce4d6f4..384fd376 100644 --- a/assets/js/epm_advanced.js +++ b/assets/js/epm_advanced.js @@ -30,10 +30,7 @@ function epm_advanced_document_ready () { //TAB MANUAL_UPLOAD - $('#manual_upload a.collapse-item').on("click", function(){ - epm_global_html_css_name(this,"auto","active"); - $(this).blur(); - }); + } @@ -126,134 +123,107 @@ function epm_advanced_tab_manual_upload_bt_upload(command, formname) function epm_advanced_tab_manual_upload_list_files_brand_expor() { - epm_global_html_find_show_hide("#list-brands-export-item-loading", true, 1, true); - epm_global_html_find_hide_and_remove("#list-brands-export > li.item-list-brand-export", 1, true); - - $.ajax({ - type: 'POST', - url: "ajax.php", - data: { - module: "endpointman", - module_sec: "epm_advanced", - module_tab: "manual_upload", - command: "list_files_brands_export" - }, - dataType: 'json', - timeout: 60000, - error: function(xhr, ajaxOptions, thrownError) { - fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); - return false; - }, - success: function(data) - { - if (data.status == true) - { - if (data.countlist == 0) - { - $("#list-brands-export").append( - $('
    • ', { 'class' : 'list-group-item item-list-brand-export' }) - .text("Empty list") - .append( - $('', { 'class' : 'label label-default label-pill pull-xs-right' }) - .text("0") - ) - ); - } - else - { - $(data.list_brands).each(function(index, itemData) - { - $("#list-brands-export").append( - $('
    • ', { 'class' : 'list-group-item item-list-brand-export', 'id' : 'item-list-brans-export-' + itemData.name }) - .append( - $('', { - 'data-toggle' : 'collapse', - 'href' : '#box_list_files_brand_' + itemData.name, - 'aria-expanded' : 'false', - 'aria-controls' : 'box_list_files_brand_' + itemData.name, - 'class' : 'collapse-item list-group-item', - 'onclick' : 'epm_global_html_css_name(this,"auto","active"); $(this).blur();' - }) + epm_global_html_find_show_hide("#list-brands-export-item-loading", true, 0, true); + if ($("#list-brands-export li.item-list-brand-export").length > 0) { + $("#list-brands-export li.item-list-brand-export").hide("slow" , function () { + $(this).remove(); + epm_advanced_tab_manual_upload_list_files_brand_expor(); + }); + } + else { + $.ajax({ + type: 'POST', + url: "ajax.php", + data: { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "manual_upload", + command: "list_files_brands_export" + }, + dataType: 'json', + timeout: 60000, + error: function(xhr, ajaxOptions, thrownError) { + fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); + $("#list-brands-export").append($('
    • ', { 'class' : 'list-group-item item-list-brand-export text-center bg-warning' }).text('ERROR AJAX:' + thrownError)); + return false; + }, + beforeSend: function(){ + epm_global_html_find_show_hide("#list-brands-export-item-loading", true, 0, true); + }, + complete: function(){ + epm_global_html_find_show_hide("#list-brands-export-item-loading", false, 1000, true); + }, + success: function(data) { + if (data.status == true) { + if (data.countlist == 0) { + $("#list-brands-export").append($('
    • ', { 'class' : 'list-group-item item-list-brand-export' }).text("Empty list").append($('', { 'class' : 'label label-default label-pill pull-xs-right' }).text("0"))); + } + else { + $(data.list_brands).each(function(index, itemData) + { + $("#list-brands-export").append( + $('
    • ', { 'class' : 'list-group-item item-list-brand-export', 'id' : 'item-list-brans-export-' + itemData.name }) .append( - $('', { 'class' : 'label label-default label-pill pull-xs-right' }).text(itemData.num), - $('', { 'class' : 'fa fa-expand' }) + $('', { + 'data-toggle' : 'collapse', + 'href' : '#box_list_files_brand_' + itemData.name, + 'aria-expanded' : 'false', + 'aria-controls' : 'box_list_files_brand_' + itemData.name, + 'class' : 'collapse-item list-group-item' + }) + .append( + $('', { 'class' : 'label label-default label-pill pull-xs-right' }).text(itemData.num), + $('', { 'class' : 'fa fa-expand' }) + ) + .append( + $("", {}).text(" " + itemData.name) + ) ) + ); + if (itemData.num > 0) { + $('#item-list-brans-export-' + itemData.name).append( + $('
      ', { + 'class' : 'list-group collapse', + 'id' : 'box_list_files_brand_'+ itemData.name + }) + ); + } + }); + + $(data.list_files).each(function(index, itemData) + { + $('#box_list_files_brand_' + itemData.brand).append( + $('', { + 'href' : 'config.php?display=epm_advanced&subpage=manual_upload&command=export_brands_availables_file&file_package=' + itemData.file, + 'target': '_blank', + 'class' : 'list-group-item' + }) .append( - $("", {}).text(" " + itemData.name) + $('', {'class' : 'label label-default label-pill pull-xs-right'}).text(itemData.timestamp), + $('', {'class' : 'fa fa-file-archive-o' }) ) - ) - ); - if (itemData.num > 0) { - $('#item-list-brans-export-' + itemData.name).append( - $('
      ', { - 'class' : 'list-group collapse', - 'id' : 'box_list_files_brand_'+ itemData.name - }) + .append($("", {}).text(" " + itemData.pathall)) ); - } - }); + }); + } - $(data.list_files).each(function(index, itemData) - { - //alert (moment.unix(itemData.timer).format("HH/mm/ss")); - - $('#box_list_files_brand_' + itemData.brand).append( - $('', { - 'href' : 'config.php?display=epm_advanced&subpage=manual_upload&command=export_brands_availables_file&file_package=' + itemData.file, - 'target': '_blank', - 'class' : 'list-group-item' - }) - .append( - $('', {'class' : 'label label-default label-pill pull-xs-right'}).text(itemData.timestamp), - $('', {'class' : 'fa fa-file-archive-o' }) - ) - .append( - $("", {}).text(" " + itemData.pathall) - ) - ); + //$('#manual_upload a.collapse-item').removeattr('onclick'); + $('#manual_upload a.collapse-item').on("click", function(){ + epm_global_html_css_name(this,"auto","active"); + $(this).blur(); }); - - - - /* - foreach ($array_list_files as $k => $v) - { - - echo '
    • '; - echo ' '; - - foreach ($v as $itemlist) { - echo ''; - echo ' '.strftime("[%Y-%m-%d %H:%M:%S]", $itemlist['timer']).''; - echo '   '.$itemlist['pathall']; - echo ''; - } - echo ''; - echo '
    • '; - } - - */ + fpbxToast(data.message, '', 'success'); + return true; + } + else { + $("#list-brands-export").append( $('
    • ', { 'class' : 'list-group-item item-list-brand-export text-center bg-warning' }).text(data.message)); + fpbxToast(data.message, data.txt.error, 'error'); + return false; } - - fpbxToast(data.message, '', 'success'); - return true; - } - else - { - $("#list-brands-export").append( - $('
    • ', { 'class' : 'list-group-item item-list-brand-export text-center bg-warning' }).text(data.message) - ); - fpbxToast(data.message, data.txt.error, 'error'); - return false; - } - }, - }); - - epm_global_html_find_show_hide("#list-brands-export-item-loading", false, 1, true); + }, + }); + } } /**** END: FUNCTION TAB UPLOAD_MANUAL ****/ diff --git a/views/epm_advanced/oui_manager.views.grid.php b/views/epm_advanced/oui_manager.views.grid.php index f58306fb..93a35ed3 100644 --- a/views/epm_advanced/oui_manager.views.grid.php +++ b/views/epm_advanced/oui_manager.views.grid.php @@ -30,50 +30,4 @@ class="table table-striped">
    • -
      - - - \ No newline at end of file +
      \ No newline at end of file diff --git a/views/epm_advanced/oui_manager.views.new.modal.php b/views/epm_advanced/oui_manager.views.new.modal.php new file mode 100644 index 00000000..9a4bf8d6 --- /dev/null +++ b/views/epm_advanced/oui_manager.views.new.modal.php @@ -0,0 +1,66 @@ + \ No newline at end of file diff --git a/views/epm_advanced/poce.views.button.up.files.php b/views/epm_advanced/poce.views.button.up.files.php new file mode 100644 index 00000000..d3a642fe --- /dev/null +++ b/views/epm_advanced/poce.views.button.up.files.php @@ -0,0 +1,39 @@ +
      +
      +
      +
      + + +
      +
      + +
      +
      + + +
      +
      + +
      +
      + + +
      +
      +
      +
      \ No newline at end of file diff --git a/views/epm_advanced/poce.views.textarea.file.php b/views/epm_advanced/poce.views.textarea.file.php new file mode 100644 index 00000000..cc364a1f --- /dev/null +++ b/views/epm_advanced/poce.views.textarea.file.php @@ -0,0 +1,66 @@ +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      + + + + + + + + +
      +
      + + + + +
      +
      + +
      +
      + Share button below to improve the next release.")?> +
      +
      + + +
      +
      + +
      +
      + +
      +
      +
      + + + + +
      +
      +
      + +
      +
      + Provisioner.net Team. Files shared are confidential and help improve the quality of releases.")?> +
      +
      + +
      +
      +
      +
      +
      +
      +
      \ No newline at end of file diff --git a/views/epm_advanced_manual_upload.page.php b/views/epm_advanced_manual_upload.page.php index 7a9693b5..011ff298 100644 --- a/views/epm_advanced_manual_upload.page.php +++ b/views/epm_advanced_manual_upload.page.php @@ -141,33 +141,6 @@
      diff --git a/views/epm_advanced_oui_manager.page.php b/views/epm_advanced_oui_manager.page.php index 5afb7dbd..df3a9bbf 100644 --- a/views/epm_advanced_oui_manager.page.php +++ b/views/epm_advanced_oui_manager.page.php @@ -3,9 +3,11 @@ $sql = 'SELECT * from endpointman_brand_list WHERE id > 0 ORDER BY name ASC'; $brands = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + unset ($sql); - $request = $_REQUEST; - $content = load_view(__DIR__.'/epm_advanced/oui_manager.views.grid.php', array('request' => $request, 'brands' => $brands)); - echo $content; + echo load_view(__DIR__.'/epm_advanced/oui_manager.views.grid.php', array('request' => $_REQUEST)); + echo load_view(__DIR__.'/epm_advanced/oui_manager.views.new.modal.php', array('request' => $_REQUEST, 'brands' => $brands)); + + unset ($brands); return; ?> \ No newline at end of file diff --git a/views/epm_advanced_poce.page.php b/views/epm_advanced_poce.page.php index 35d95655..99c79027 100644 --- a/views/epm_advanced_poce.page.php +++ b/views/epm_advanced_poce.page.php @@ -5,124 +5,21 @@
      - - -
      -
      -
      -
      - - -
      -
      - -
      -
      - - -
      -
      -
      -
      - - -
      -
      -
      -
      - -
      -
      -
      -
      - -
      -
      -
      -
      -
      -
      -
      - - - - - - - - -
      -
      - - - - -
      -
      - -
      -
      - Share button below to improve the next release.")?> -
      -
      - - -
      -
      - -
      -
      - -
      -
      -
      - - - - -
      -
      -
      - -
      -
      - Provisioner.net Team. Files shared are confidential and help improve the quality of releases.")?> -
      -
      - -
      -
      -
      -
      -
      -
      -
      + $_REQUEST)); + echo load_view(__DIR__.'/epm_advanced/poce.views.textarea.file.php', array('request' => $_REQUEST)); + ?>
      -
      0 ORDER BY long_name ASC'; //$sql = 'SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id > 0 AND brand IN (SELECT id FROM asterisk.endpointman_brand_list where hidden = 0) ORDER BY long_name ASC'; $sql = 'SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id IN (SELECT DISTINCT product_id FROM asterisk.endpointman_model_list where enabled = 1) AND brand IN (SELECT id FROM asterisk.endpointman_brand_list where hidden = 0) ORDER BY long_name ASC'; $product_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + unset ($sql); + echo load_view(__DIR__.'/epm_advanced/poce.views.bootnav.php', array('request' => $_REQUEST, 'product_list' => $product_list)); unset ($product_list); - unset ($sql); ?>
      From 011956932594d50db029109f55df3bf7a66f9d5e Mon Sep 17 00:00:00 2001 From: vsc55 Date: Fri, 26 Feb 2016 14:09:43 +0100 Subject: [PATCH 431/623] Update version 13.0.6.4 --- module.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module.xml b/module.xml index 0ab8a5b1..680a69c9 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman unsupported OSS PBX End Point Manager - 13.0.6.3 + 13.0.6.4 setup Connectivity GPLv2+ @@ -21,6 +21,7 @@ Pull Requests can be made to either of these and are encouraged. + *13.0.6.4* Fix bug, generate file list export brands through AJAX, delete code not required, organize files. *13.0.6.3* Fix bug, optimize code. *13.0.6.2* Bring back in better check onlines *13.0.6.1* Fix Package Manager Enable/Disable inverter value, some fix bug more. From 28d1de0c1cf571a791d0325c42de1746aa6467d0 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Fri, 26 Feb 2016 12:36:56 -0800 Subject: [PATCH 432/623] vb --- module.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/module.xml b/module.xml index fe184cd2..63c15a0f 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman unsupported OSS PBX End Point Manager - 13.0.6.2 + 13.0.6.4 setup Connectivity GPLv2+ @@ -20,7 +20,9 @@ The backend configurator is hosted at: https://github.com/provisioner/Provisioner Pull Requests can be made to either of these and are encouraged. - + + *13.0.6.4* Fix bug, generate file list export brands through AJAX, delete code not required, organize files. + *13.0.6.3* Fix bug, optimize code. *13.0.6.2* Bring back in better check onlines *13.0.6.1* Fix Package Manager Enable/Disable inverter value, some fix bug more. *13.0.6* End Fix OOS Advanced Setting From 0fc32e0cef90334f80f873df1708f3ccea14643f Mon Sep 17 00:00:00 2001 From: vsc55 Date: Sun, 28 Feb 2016 02:57:09 +0100 Subject: [PATCH 433/623] Fix Bug, continue to migrate... --- Endpointman.class.php | 228 ++++++++++++++++-- assets/js/epm_advanced.js | 28 ++- assets/js/epm_config.js | 13 +- assets/js/epm_global.js | 4 +- lib/epm_data_abstraction.class.php | 12 +- templates/freepbx/advanced_settings_poce.html | 77 ------ 6 files changed, 237 insertions(+), 125 deletions(-) delete mode 100644 templates/freepbx/advanced_settings_poce.html diff --git a/Endpointman.class.php b/Endpointman.class.php index f0637c83..3f56bb3f 100644 --- a/Endpointman.class.php +++ b/Endpointman.class.php @@ -70,8 +70,8 @@ public function __construct($freepbx = null) { require_once('lib/epm_data_abstraction.class.php'); - $this->freepbx = $freepbx; - $this->db = $freepbx->Database; + $this->freepbx =& $freepbx; + $this->db =& $freepbx->Database; $this->config = $freepbx->Config; $this->configmod = new Endpointman\Config(); $this->system = new epm_system(); @@ -170,9 +170,9 @@ public function ajaxRequest($req, &$setting) { //AVISO!!!!!!!!!!!!!!!!!!!!!!!!!! //PERMITE TODO!!!!!!!!!!!!!!!!!!! -//$setting['authenticate'] = true; -//$setting['allowremote'] = true; -//return true; +$setting['authenticate'] = true; +$setting['allowremote'] = true; +return true; switch ($_REQUEST['module_sec']) { @@ -180,7 +180,10 @@ public function ajaxRequest($req, &$setting) { case "epm_templates": switch ($req) { - case "list_current_template": + case "model_clone": + case "list_current_template": + case "add_template": + case "del_template": $setting['authenticate'] = true; $setting['allowremote'] = false; return true; @@ -234,15 +237,30 @@ public function ajaxHandler() { { case "epm_devices": break; case "epm_templates": - if ($module_tab == "main") + if ($module_tab == "manager") { switch ($command) { case "list_current_template": - $retarr = $this->epm_template_list_current_templates(); + $retarr = $this->epm_templates_list_current_templates(); return $retarr; break; - + + case "model_clone": + $retarr = $this->epm_templates_model_clone(); + return $retarr; + break; + + case "add_template": + $retarr = $this->epm_templates_add_template(); + return $retarr; + break; + + case "del_template": + $retarr = $this->epm_templates_del_template(); + return $retarr; + break; + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -302,7 +320,7 @@ public function ajaxHandler() { break; case "list_all_brand": - $retarr = array("status" => true, "message" => "OK", "datlist" => $this->epm_config_manager_hardware_get_list_all(true)); + $retarr = array("status" => true, "message" => "OK", "datlist" => $this->epm_config_manager_hardware_get_list_all(false)); break; default: @@ -563,16 +581,30 @@ public function myShowPage() { switch ($_REQUEST['display']) { - case "epm_devices": break; - case "epm_templates": + case "epm_devices": if(empty($this->pagedata)) { $this->pagedata['main'] = array( + "name" => _("Devices"), + "page" => 'views/epm_devices_main.page.php' + ); + } + break; + + case "epm_templates": + if(empty($this->pagedata)) + { + $this->pagedata['manager'] = array( "name" => _("Current Templates"), - "page" => 'views/epm_templates_main.page.php' + "page" => 'views/epm_templates_manager.page.php' + ); + $this->pagedata['editor'] = array( + "name" => _("Template Editor"), + "page" => 'views/epm_templates_editor.page.php' ); } break; + case "epm_config": if(empty($this->pagedata)) { @@ -831,11 +863,111 @@ private function epm_config_manual_install($install_type = "", $package ="") - /*************************************************** - **** FUNCIONES SEC MODULO "epm_template\main". **** - **************************************************/ + /****************************************************** + **** FUNCIONES SEC MODULO "epm_template\manager". **** + *****************************************************/ - public function epm_template_list_current_templates () + public function epm_templates_del_template() + { + if (! isset($_REQUEST['idsel'])) { + $retarr = array("status" => false, "message" => _("No send ID!")); + } + elseif (! is_numeric($_REQUEST['idsel'])) { + $retarr = array("status" => false, "message" => _("ID is not number!")); + } + elseif ($_REQUEST['idsel'] <= 0) { + $retarr = array("status" => false, "message" => _("ID send is negative!")); + } + else { + $dget['idsel'] = $_REQUEST['idsel']; + + $sql = "DELETE FROM endpointman_template_list WHERE id = ". $dget['idsel']; + sql($sql); + $sql = "UPDATE endpointman_mac_list SET template_id = 0 WHERE template_id = ".$dget['idsel']; + sql($sql); + + $retarr = array("status" => true, "message" => _("Delete Template OK!")); + unset($dget); + } + return $retarr; + } + + public function epm_templates_add_template () + { + if (! isset($_REQUEST['newnametemplate'])) { + $retarr = array("status" => false, "message" => _("No send Name!")); + } + elseif (empty($_REQUEST['newnametemplate'])) { + $retarr = array("status" => false, "message" => _("Name is null!")); + } + elseif (! isset($_REQUEST['newproductselec'])) { + $retarr = array("status" => false, "message" => _("No send Product!")); + } + elseif (! is_numeric($_REQUEST['newproductselec'])) { + $retarr = array("status" => false, "message" => _("Product is not number!")); + } + elseif ($_REQUEST['newproductselec'] <= 0) { + $retarr = array("status" => false, "message" => _("Product send is negative!")); + } + elseif (! isset($_REQUEST['newclonemodel'])) { + $retarr = array("status" => false, "message" => _("No send Clone Model!")); + } + elseif (! is_numeric($_REQUEST['newclonemodel'])) { + $retarr = array("status" => false, "message" => _("Clone Model is not number!")); + } + elseif ($_REQUEST['newclonemodel'] <= 0) { + $retarr = array("status" => false, "message" => _("Clone Model send is negative!")); + } + else { + $dget['newnametemplate'] = $_REQUEST['newnametemplate']; + $dget['newproductselec'] = $_REQUEST['newproductselec']; + $dget['newclonemodel'] = $_REQUEST['newclonemodel']; + + $db = $this->db; + $sql = "INSERT INTO endpointman_template_list (product_id, name, model_id) VALUES (?,?,?)"; + $q = $db->prepare($sql); + $ob = $q->execute(array($dget['newproductselec'], addslashes($dget['newnametemplate']), $dget['newclonemodel'])); + $newid = $db->lastInsertId(); + //$endpoint->edit_template_display($id,0); + + $retarr = array("status" => true, "message" => _("Add New Template OK!"), "newid" => $newid); + unset($dget); + } + return $retarr; + } + + public function epm_templates_model_clone () + { + if (! isset($_REQUEST['id'])) { + $retarr = array("status" => false, "message" => _("No send ID!")); + } + elseif (! is_numeric($_REQUEST['id'])) { + $retarr = array("status" => false, "message" => _("ID send is not number!")); + } + elseif ($_REQUEST['id'] <= 0) { + $retarr = array("status" => false, "message" => _("ID send is number not valid!")); + } + else + { + $dget['id'] = $_REQUEST['id']; + + $i=0; + $out = array(); + $sql = "SELECT endpointman_model_list.id, endpointman_model_list.model as model FROM endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND product_id = '". $dget['id']."'"; + $result = sql($sql,'getAll', DB_FETCHMODE_ASSOC); + foreach($result as $row) { + $out[$i]['optionValue'] = $row['id']; + $out[$i]['optionDisplay'] = $row['model']; + $i++; + } + $retarr = array("status" => true, "message" => _("Generate list Ok!"), "listopt" => $out); + + unset($dget); + } + return $retarr; + } + + public function epm_templates_list_current_templates () { $sql = 'SELECT endpointman_template_list.*, endpointman_product_list.short_name as model_class, endpointman_model_list.model as model_clone, endpointman_model_list.enabled FROM endpointman_template_list, endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.hidden = 0 AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.product_id = endpointman_product_list.id'; @@ -1035,7 +1167,7 @@ public function epm_advanced_poce_select_file() $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $config_files = explode(",", $row['config_files']); - //TODO: Añadir validacion para ver si $dget['file_name'] esta en el array $config_files + //TODO: Aadir validacion para ver si $dget['file_name'] esta en el array $config_files $filename = $dget['file_name']; $pathfile = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $filename; @@ -1695,7 +1827,7 @@ public function epm_advanced_iedl_import() private function epm_advanced_oui_remove() { - //TODO: Añadir validacion de si es custom o no + //TODO: Aadir validacion de si es custom o no if ((! isset($_REQUEST['id_del'])) OR ($_REQUEST['id_del'] == "")) { $retarr = array("status" => false, "message" => _("No ID set!")); } @@ -1717,7 +1849,7 @@ private function epm_advanced_oui_remove() private function epm_advanced_oui_add() { - //TODO: Pendiente añadir isExiste datos. + //TODO: Pendiente aadir isExiste datos. if ((! isset($_REQUEST['number_new_oui'])) OR ($_REQUEST['number_new_oui'] == "")) { $retarr = array("status" => false, "message" => _("No OUI set!")); } @@ -2429,6 +2561,7 @@ function update_check($echotxt = false) { if (!($this->system->arraysearchrecursive($brand_name, $row, 'directory'))) { //insert row $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('" . $temp['brand_id'] . "', '" . $temp['name'] . "', '" . $temp['directory'] . "', '" . $version[$brand_name] . "')"; + $_SESSION["sqlerr"] = $sql; sql($sql); } else { //in database already! @@ -4193,6 +4326,59 @@ function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $ret + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5346,4 +5532,4 @@ function display_configs() { } -?> +?> \ No newline at end of file diff --git a/assets/js/epm_advanced.js b/assets/js/epm_advanced.js index 384fd376..6ffe525b 100644 --- a/assets/js/epm_advanced.js +++ b/assets/js/epm_advanced.js @@ -43,7 +43,8 @@ function epm_advanced_change_tab (nTab = "") { } -/**** INI: FUNCTION GLOBAL SEC ****/ +// INI: FUNCTION GLOBAL SEC + function epm_advanced_select_tab_ajax(idtab) { if (idtab == "") { @@ -89,7 +90,8 @@ function end_module_actions_epm_advanced(acctionname = "") epm_advanced_tab_manual_upload_list_files_brand_expor(); } } -/**** END: FUNCTION GLOBAL SEC ****/ + +// END: FUNCTION GLOBAL SEC @@ -98,7 +100,8 @@ function end_module_actions_epm_advanced(acctionname = "") -/**** INI: FUNCTION TAB UPLOAD_MANUAL ****/ +// INI: FUNCTION TAB UPLOAD_MANUAL + function epm_advanced_tab_manual_upload_bt_explor_brand() { var packageid = $('#brand_export_pack_selected').val(); @@ -225,7 +228,8 @@ function epm_advanced_tab_manual_upload_list_files_brand_expor() }); } } -/**** END: FUNCTION TAB UPLOAD_MANUAL ****/ + +// END: FUNCTION TAB UPLOAD_MANUAL @@ -234,14 +238,14 @@ function epm_advanced_tab_manual_upload_list_files_brand_expor() -/**** INI: FUNCTION TAB IEDL ****/ +// INI: FUNCTION TAB IEDL function epm_advanced_tab_iedl_bt_import() { var urlStr = "config.php?display=epm_advanced&subpage=iedl&command=import"; var formname = "iedl_form_import_cvs"; epm_global_dialog_action("iedlimport", urlStr, formname); } -/**** END: FUNCTION TAB IEDL ****/ +// END: FUNCTION TAB IEDL @@ -250,7 +254,7 @@ function epm_advanced_tab_iedl_bt_import() -/**** INI: FUNCTION TAB POCE ****/ +// INI: FUNCTION TAB POCE function epm_advanced_tab_poce_select_product(idsel, bclear = true) { if ($.isNumeric(idsel) == false) { return; } @@ -591,7 +595,7 @@ function epm_advanced_tab_poce_bt_acction (command) }); } -/**** END: FUNCTION TAB POCE ****/ +// END: FUNCTION TAB POCE @@ -600,7 +604,7 @@ function epm_advanced_tab_poce_bt_acction (command) -/**** INI: FUNCTION TAB OUI MANAGER ****/ +// INI: FUNCTION TAB OUI MANAGER function epm_advanced_tab_oui_manager_grid_actionFormatter(value, row, index){ var html = ''; if (row.custom == 1) { @@ -698,12 +702,12 @@ function epm_advanced_tab_oui_manager_ajax (data_ajax = ""){ } return response; } -/**** END: FUNCTION TAB OUI MANAGER ****/ +// END: FUNCTION TAB OUI MANAGER -/**** INI: FUNCTION TAB SETTING ****/ +// INI: FUNCTION TAB SETTING function epm_advanced_tab_setting_input_value_change_bt(sNameID, sValue = "", bSaveChange = true, bSetFocus = false) { $(sNameID).val(sValue); @@ -768,4 +772,4 @@ function epm_advanced_tab_setting_input_change(obt) }, }); } -/**** END: FUNCTION TAB SETTING ****/ \ No newline at end of file +// END: FUNCTION TAB SETTING \ No newline at end of file diff --git a/assets/js/epm_config.js b/assets/js/epm_config.js index e96435bb..0ef6d37e 100644 --- a/assets/js/epm_config.js +++ b/assets/js/epm_config.js @@ -21,8 +21,7 @@ function epm_config_change_tab (nTab = "") { } -/**** INI: FUNCTION GLOBAL SEC ****/ - +//**** INI: FUNCTION GLOBAL SEC **** function epm_config_select_tab_ajax(idtab) { clearTimeout(v_sTimerUpdateAjax); @@ -284,7 +283,7 @@ function CrearSubListItem(iL0) $('#' + iL0.boxappend).append( $('
      ', { 'class' : 'sortable', 'id' : iL0.boxsubite }) ) } } -/**** END: FUNCTION GLOBAL SEC ****/ +//**** END: FUNCTION GLOBAL SEC **** @@ -294,7 +293,7 @@ function CrearSubListItem(iL0) -/**** INI: TAB/MANAGER ****/ +//**** INI: TAB/MANAGER **** function epm_config_tab_manager_ajax_get_add_data(data, idtab) { if ($('#button_check_for_updates').is(':disabled') == true) { @@ -673,7 +672,7 @@ function epm_config_tab_manager_html_L3(data, prefijo, prefijoid, name, value_di }); }); } -/**** END: TAB/MANAGER ****/ +//**** END: TAB/MANAGER **** @@ -690,7 +689,7 @@ function epm_config_tab_manager_html_L3(data, prefijo, prefijoid, name, value_di -/**** INI: TAB/EDITOR ****/ +//**** INI: TAB/EDITOR **** function epm_config_tab_editor_ajax_get_add_data (data, idtab) { if (data.status == true) @@ -957,4 +956,4 @@ function epm_config_tab_editor_html_L2(data, iL0, name, value_yes, txt_bt_yes, v }); } -/**** END: TAB/EDITOR ****/ \ No newline at end of file +//**** END: TAB/EDITOR **** \ No newline at end of file diff --git a/assets/js/epm_global.js b/assets/js/epm_global.js index c3d302bd..dd7198bf 100644 --- a/assets/js/epm_global.js +++ b/assets/js/epm_global.js @@ -207,7 +207,7 @@ function epm_global_refresh_table(snametable, showmsg = true) -// **** INI: CODIGO DE FREEPBX **** +// INI: CODIGO DE FREEPBX function epm_global_update_jquery_msg_help() { if($(".fpbx-container").length>0){ @@ -232,4 +232,4 @@ function epm_global_update_jquery_msg_help() }); } } -// **** END: CODIGO DE FREEPBX **** \ No newline at end of file +// END: CODIGO DE FREEPBX \ No newline at end of file diff --git a/lib/epm_data_abstraction.class.php b/lib/epm_data_abstraction.class.php index b37bf613..f99d4f9a 100644 --- a/lib/epm_data_abstraction.class.php +++ b/lib/epm_data_abstraction.class.php @@ -10,8 +10,8 @@ class epm_data_abstraction { function __construct($config, $configmod) { - $this->config = $config; - $this->configmod = $configmod; + $this->config =& $config; + $this->configmod =& $configmod; } function all_products() { @@ -80,7 +80,7 @@ function all_models() { */ function all_active_brands() { $sql="SELECT DISTINCT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_brand_list,endpointman_model_list WHERE endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND endpointman_brand_list.installed = 1 AND endpointman_brand_list.hidden = 0"; - $data = sql($sql,'getAll', DB_FETCHMODE_ASSOC); + $data =& sql($sql,'getAll', DB_FETCHMODE_ASSOC); return($data); } @@ -98,7 +98,7 @@ function all_models_by_brand($brand_id) { function all_unknown_devices() { $sql = 'SELECT * FROM endpointman_mac_list WHERE model = 0'; - $unknown_list =& $this->sql($sql,'getAll',DB_FETCHMODE_ASSOC); + $unknown_list =& sql($sql,'getAll',DB_FETCHMODE_ASSOC); return($unknown_list); } @@ -108,7 +108,7 @@ function all_unused_registrations() { } else { $not_added="SELECT devices.id, devices.description FROM devices WHERE tech in('sip','pjsip') AND devices.id not in (SELECT devices.id FROM devices, endpointman_line_list WHERE tech in ('sip','pjsip') AND devices.id = endpointman_line_list.ext ) ORDER BY devices.id"; } - $result = sql($not_added,'getAll', DB_FETCHMODE_ASSOC); + $result =& sql($not_added,'getAll', DB_FETCHMODE_ASSOC); return($result); } @@ -120,7 +120,7 @@ function all_used_registrations() { function get_lines_from_device($device_id) { $sql = 'SELECT * FROM endpointman_line_list WHERE mac_id = '.$device_id. ' ORDER BY endpointman_line_list.line ASC'; - $line_list =& $this->sql($sql,'getAll',DB_FETCHMODE_ASSOC); + $line_list =& sql($sql,'getAll',DB_FETCHMODE_ASSOC); return($line_list); } diff --git a/templates/freepbx/advanced_settings_poce.html b/templates/freepbx/advanced_settings_poce.html deleted file mode 100644 index 2844bdf8..00000000 --- a/templates/freepbx/advanced_settings_poce.html +++ /dev/null @@ -1,77 +0,0 @@ -{if condition="isset($show_error_box)"} - {include="message_box"} -{/if} -

      -
      - - -
      -
      -{if condition="isset($options)"} -{$options} -{/if} -
      - - - - - - - - - -
      {if condition="isset($location)"}File:{/if}{if condition="isset($location)"}{$location}{/if}
      - -
      - {loop name="file_list"} - {$value.text}
      - {/loop} -
      - {if condition="isset($sql_file_list)"} - {loop name="sql_file_list"} - {$value.text} '> -
      [ref: {$value.ref}] -
      - {/loop} - {/if} -
      -
      - -

      - -

      - {if condition="!isset($temp_file)"} - - NOTE: File is permanently saved and not over-written during next package update. - {/if} - {if condition="isset($type)"} -

      - - Upload this configuration file to the Provisioner.net Team. Files shared are confidential and help improve the quality of releases. - {/if} -

      -
      -
      - From 5f2affedab90ce09f25e01e8699ed83d9caf4199 Mon Sep 17 00:00:00 2001 From: vsc55 Date: Wed, 2 Mar 2016 22:04:26 +0100 Subject: [PATCH 434/623] Fix: This breaks PHP 5.6 --- Endpointman.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Endpointman.class.php b/Endpointman.class.php index 3f56bb3f..b4bf9c81 100644 --- a/Endpointman.class.php +++ b/Endpointman.class.php @@ -70,8 +70,8 @@ public function __construct($freepbx = null) { require_once('lib/epm_data_abstraction.class.php'); - $this->freepbx =& $freepbx; - $this->db =& $freepbx->Database; + $this->freepbx = $freepbx; + $this->db = $freepbx->Database; $this->config = $freepbx->Config; $this->configmod = new Endpointman\Config(); $this->system = new epm_system(); From bb4ea332b386e320651db1f6e24e20a5d939ea82 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 3 Mar 2016 10:44:50 -0800 Subject: [PATCH 435/623] [Module Tag script: endpointman 13.0.6.5] --- i18n/bg/LC_MESSAGES/endpointman.mo | Bin 603 -> 603 bytes i18n/bg/LC_MESSAGES/endpointman.po | 629 +++++++++++++--------- i18n/de_DE/LC_MESSAGES/endpointman.mo | Bin 1001 -> 1001 bytes i18n/de_DE/LC_MESSAGES/endpointman.po | 629 +++++++++++++--------- i18n/endpointman.pot | 726 +++++++++++++++----------- i18n/es_ES/LC_MESSAGES/endpointman.mo | Bin 19348 -> 19217 bytes i18n/es_ES/LC_MESSAGES/endpointman.po | 637 +++++++++++++--------- i18n/he_IL/LC_MESSAGES/endpointman.mo | Bin 367 -> 367 bytes i18n/he_IL/LC_MESSAGES/endpointman.po | 629 +++++++++++++--------- i18n/ja_JP/LC_MESSAGES/endpointman.mo | Bin 3438 -> 3438 bytes i18n/ja_JP/LC_MESSAGES/endpointman.po | 629 +++++++++++++--------- i18n/ru_RU/LC_MESSAGES/endpointman.mo | Bin 496 -> 496 bytes i18n/ru_RU/LC_MESSAGES/endpointman.po | 629 +++++++++++++--------- i18n/zh_CN/LC_MESSAGES/endpointman.mo | Bin 420 -> 420 bytes i18n/zh_CN/LC_MESSAGES/endpointman.po | 629 +++++++++++++--------- module.xml | 3 +- 16 files changed, 3010 insertions(+), 2130 deletions(-) diff --git a/i18n/bg/LC_MESSAGES/endpointman.mo b/i18n/bg/LC_MESSAGES/endpointman.mo index dd5da512598dcdd5ee58d114c10c28d3e661e37e..c3ba3f079c0228c08f19c8b681dd4f69b9d48b4f 100644 GIT binary patch delta 21 dcmcc3a+_tsdM;yK17ih411l4gjXM`H0sv3`2KxX2 delta 21 dcmcc3a+_tsdM+bfBVz?aV=H5ejXM`H0sv4h2Lb>9 diff --git a/i18n/bg/LC_MESSAGES/endpointman.po b/i18n/bg/LC_MESSAGES/endpointman.po index 76f8d1fd..85c39c3a 100644 --- a/i18n/bg/LC_MESSAGES/endpointman.po +++ b/i18n/bg/LC_MESSAGES/endpointman.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: FreePBX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-23 13:38-0800\n" +"POT-Creation-Date: 2016-03-03 10:44-0800\n" "PO-Revision-Date: 2014-07-22 15:41+0200\n" "Last-Translator: Chavdar \n" "Language-Team: Bulgarian Click Here!" @@ -74,7 +74,7 @@ msgstr "" msgid "ARP Executable Path" msgstr "" -#: Endpointman.class.php:2294 Endpointman.class.php:2295 +#: Endpointman.class.php:2598 Endpointman.class.php:2599 msgid "" "Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" msgstr "" @@ -83,24 +83,27 @@ msgstr "" msgid "Access denied!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:33 +#: views/epm_advanced/oui_manager.views.grid.php:27 msgid "Actions" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:6 -#: views/epm_advanced/oui_manager.views.grid.php:8 +#: views/epm_advanced/oui_manager.views.grid.php:5 msgid "Add Custom OUI" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:81 +#: views/epm_advanced/oui_manager.views.new.modal.php:62 msgid "Add New" msgstr "" +#: Endpointman.class.php:933 +msgid "Add New Template OK!" +msgstr "" + #: page.epm_advanced.php:19 msgid "Advanced Settings" msgstr "" -#: Endpointman.class.php:2647 +#: Endpointman.class.php:2955 msgid "All Done!" msgstr "" @@ -112,7 +115,7 @@ msgstr "" msgid "Allow Saving Over Default Configuration Files" msgstr "" -#: Endpointman.class.php:2748 +#: Endpointman.class.php:3058 msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" msgstr "" @@ -120,8 +123,8 @@ msgstr "" msgid "Asterisk Executable Path" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:31 -#: views/epm_advanced/oui_manager.views.grid.php:56 +#: views/epm_advanced/oui_manager.views.grid.php:25 +#: views/epm_advanced/oui_manager.views.new.modal.php:36 #: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 msgid "Brand" msgstr "" @@ -130,7 +133,7 @@ msgstr "" msgid "Brand Package" msgstr "" -#: views/epm_advanced_manual_upload.page.php:125 +#: views/epm_advanced_manual_upload.page.php:90 msgid "Brand's Available" msgstr "" @@ -142,24 +145,24 @@ msgstr "" msgid "CSV File Format" msgstr "" -#: Endpointman.class.php:1196 Endpointman.class.php:1273 -#: Endpointman.class.php:1432 +#: Endpointman.class.php:1498 Endpointman.class.php:1575 +#: Endpointman.class.php:1734 msgid "Can Not Find Uploaded Files!" msgstr "" -#: Endpointman.class.php:2720 +#: Endpointman.class.php:3030 msgid "Can't Find Downloaded File!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:80 +#: views/epm_advanced/oui_manager.views.new.modal.php:61 msgid "Cancel" msgstr "" -#: Endpointman.class.php:2175 +#: Endpointman.class.php:2478 msgid "Cant find file:" msgstr "" -#: Endpointman.class.php:226 +#: Endpointman.class.php:279 msgid "Check Online " msgstr "" @@ -167,43 +170,52 @@ msgstr "" msgid "Check for Update" msgstr "" -#: Endpointman.class.php:225 +#: Endpointman.class.php:278 msgid "Check for Update " msgstr "" -#: Endpointman.class.php:241 +#: Endpointman.class.php:294 msgid "Check for Updates..." msgstr "" -#: Endpointman.class.php:242 +#: Endpointman.class.php:295 msgid "Check for Updates... Ok!" msgstr "" -#: Endpointman.class.php:2542 +#: Endpointman.class.php:2850 msgid "Checking MD5sum of Package..." msgstr "" -#: Endpointman.class.php:2705 +#: Endpointman.class.php:3013 msgid "Checking MD5sum of Package...." msgstr "" -#: Endpointman.class.php:1394 +#: Endpointman.class.php:1696 msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:274 Endpointman.class.php:292 -#: Endpointman.class.php:320 Endpointman.class.php:348 -#: Endpointman.class.php:357 Endpointman.class.php:387 +#: Endpointman.class.php:916 +msgid "Clone Model is not number!" +msgstr "" + +#: Endpointman.class.php:919 +msgid "Clone Model send is negative!" +msgstr "" + +#: Endpointman.class.php:265 Endpointman.class.php:327 +#: Endpointman.class.php:345 Endpointman.class.php:373 +#: Endpointman.class.php:401 Endpointman.class.php:410 +#: Endpointman.class.php:440 Endpointman.class.php:453 msgid "Command not found!" msgstr "" -#: Endpointman.class.php:146 +#: Endpointman.class.php:147 msgid "" "Configuration Directory is not a directory or does not exist! Please change " "the location here:" msgstr "" -#: Endpointman.class.php:138 +#: Endpointman.class.php:139 msgid "Configuration Directory is not writable!" msgstr "" @@ -215,27 +227,31 @@ msgstr "" msgid "Connectivity" msgstr "" -#: Endpointman.class.php:2574 +#: Endpointman.class.php:2882 msgid "Copy Error Detected! Aborting Install!" msgstr "" -#: Endpointman.class.php:2756 +#: Endpointman.class.php:3066 msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." msgstr "" -#: Endpointman.class.php:2681 +#: Endpointman.class.php:2989 msgid "Creating EPM temp directory" msgstr "" -#: Endpointman.class.php:1222 +#: Endpointman.class.php:1524 msgid "Creating EPM temp directory..." msgstr "" -#: Endpointman.class.php:1300 +#: Endpointman.class.php:1602 msgid "Creating Provisioner Directory..." msgstr "" -#: views/epm_advanced_poce.page.php:28 +#: Endpointman.class.php:598 +msgid "Current Templates" +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:19 msgid "Custom Template Files" msgstr "" @@ -243,20 +259,32 @@ msgstr "" msgid "Default Mirror FreePBX" msgstr "" -#: views/epm_advanced_poce.page.php:84 +#: views/epm_advanced/poce.views.textarea.file.php:36 msgid "Delete" msgstr "" +#: Endpointman.class.php:889 +msgid "Delete Template OK!" +msgstr "" + #: views/epm_advanced_settings.page.php:56 #: views/epm_advanced_settings.page.php:191 msgid "Determine for Me" msgstr "" -#: Endpointman.class.php:1663 +#: Endpointman.class.php:588 +msgid "Devices" +msgstr "" + +#: Endpointman.class.php:1965 msgid "Directory Not Writable!" msgstr "" -#: Endpointman.class.php:234 +#: Endpointman.class.php:1490 +msgid "Directory no exists: " +msgstr "" + +#: Endpointman.class.php:287 msgid "Disable" msgstr "" @@ -272,18 +300,18 @@ msgstr "" msgid "Disable Tooltips" msgstr "" -#: Endpointman.class.php:1224 Endpointman.class.php:1238 -#: Endpointman.class.php:1297 Endpointman.class.php:1302 -#: Endpointman.class.php:1317 Endpointman.class.php:1393 -#: Endpointman.class.php:1488 Endpointman.class.php:2526 -#: Endpointman.class.php:2538 Endpointman.class.php:2579 -#: Endpointman.class.php:2611 Endpointman.class.php:2665 -#: Endpointman.class.php:2693 Endpointman.class.php:2700 -#: Endpointman.class.php:2707 Endpointman.class.php:2711 -#: Endpointman.class.php:2782 Endpointman.class.php:2860 -#: Endpointman.class.php:2896 Endpointman.class.php:2925 -#: Endpointman.class.php:2967 Endpointman.class.php:2978 -#: Endpointman.class.php:2988 +#: Endpointman.class.php:1526 Endpointman.class.php:1540 +#: Endpointman.class.php:1599 Endpointman.class.php:1604 +#: Endpointman.class.php:1619 Endpointman.class.php:1695 +#: Endpointman.class.php:1790 Endpointman.class.php:2834 +#: Endpointman.class.php:2846 Endpointman.class.php:2887 +#: Endpointman.class.php:2919 Endpointman.class.php:2973 +#: Endpointman.class.php:3001 Endpointman.class.php:3008 +#: Endpointman.class.php:3015 Endpointman.class.php:3019 +#: Endpointman.class.php:3092 Endpointman.class.php:3172 +#: Endpointman.class.php:3208 Endpointman.class.php:3237 +#: Endpointman.class.php:3284 Endpointman.class.php:3295 +#: Endpointman.class.php:3305 msgid "Done!" msgstr "" @@ -291,27 +319,23 @@ msgstr "" msgid "Download updated releases from " msgstr "" -#: Endpointman.class.php:2689 +#: Endpointman.class.php:2997 msgid "Downloading Brand JSON....." msgstr "" -#: Endpointman.class.php:2698 +#: Endpointman.class.php:3006 msgid "Downloading Brand Package..." msgstr "" -#: Endpointman.class.php:2520 Endpointman.class.php:2532 +#: Endpointman.class.php:2828 Endpointman.class.php:2840 msgid "Downloading firmware..." msgstr "" -#: Endpointman.class.php:594 +#: Endpointman.class.php:688 msgid "Dropping all relevant tables" msgstr "" -#: views/epm_advanced_manual_upload.page.php:177 -msgid "Empty list." -msgstr "" - -#: Endpointman.class.php:233 +#: Endpointman.class.php:286 msgid "Enable" msgstr "" @@ -343,35 +367,35 @@ msgstr "" msgid "Error 500 Internal Server Error" msgstr "" -#: Endpointman.class.php:2726 +#: Endpointman.class.php:3036 msgid "" "Error Connecting to the Package Repository. Module not installed. Please Try " "again later." msgstr "" -#: Endpointman.class.php:2683 +#: Endpointman.class.php:2991 msgid "Error creating directory: %_DIR_%" msgstr "" -#: Endpointman.class.php:2723 +#: Endpointman.class.php:3033 msgid "Error download Brand package!" msgstr "" -#: Endpointman.class.php:2523 Endpointman.class.php:2535 +#: Endpointman.class.php:2831 Endpointman.class.php:2843 msgid "Error download frimware package!" msgstr "" -#: Endpointman.class.php:236 Endpointman.class.php:253 -#: Endpointman.class.php:305 Endpointman.class.php:1227 -#: Endpointman.class.php:1305 +#: Endpointman.class.php:289 Endpointman.class.php:306 +#: Endpointman.class.php:358 Endpointman.class.php:1529 +#: Endpointman.class.php:1607 msgid "Error!" msgstr "" -#: Endpointman.class.php:1784 Endpointman.class.php:1821 +#: Endpointman.class.php:2086 Endpointman.class.php:2123 msgid "Error: Command not found!" msgstr "" -#: Endpointman.class.php:2268 +#: Endpointman.class.php:2572 msgid "Error: No Local File for %_name_% !" msgstr "" @@ -383,16 +407,16 @@ msgstr "" msgid "Experimental" msgstr "" -#: views/epm_advanced_manual_upload.page.php:157 +#: views/epm_advanced_manual_upload.page.php:122 msgid "Explor a package brand's availables." msgstr "" #: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:146 +#: views/epm_advanced_manual_upload.page.php:109 msgid "Export" msgstr "" -#: views/epm_advanced_manual_upload.page.php:114 +#: views/epm_advanced_manual_upload.page.php:79 msgid "Export Brand Packages" msgstr "" @@ -408,7 +432,7 @@ msgstr "" msgid "Export data configuracion devices." msgstr "" -#: Endpointman.class.php:1384 +#: Endpointman.class.php:1686 msgid "Exporting %_NAME_%" msgstr "" @@ -416,19 +440,19 @@ msgstr "" msgid "Extension" msgstr "" -#: Endpointman.class.php:1295 +#: Endpointman.class.php:1597 msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:1233 +#: Endpointman.class.php:1535 msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" msgstr "" -#: Endpointman.class.php:2709 +#: Endpointman.class.php:3017 msgid "Extracting Tarball........" msgstr "" -#: Endpointman.class.php:1235 +#: Endpointman.class.php:1537 msgid "Extracting Tarball........ " msgstr "" @@ -436,11 +460,11 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3464 +#: Endpointman.class.php:3781 msgid "Failed to write file to disk" msgstr "" -#: Endpointman.class.php:1450 +#: Endpointman.class.php:1752 msgid "File %_FILE_% size is 0!" msgstr "" @@ -448,7 +472,7 @@ msgstr "" msgid "File (TFTP/FTP)" msgstr "" -#: Endpointman.class.php:1321 +#: Endpointman.class.php:1623 msgid "File Temp no Exists!" msgstr "" @@ -456,23 +480,23 @@ msgstr "" msgid "File not Found!" msgstr "" -#: Endpointman.class.php:946 +#: Endpointman.class.php:1197 msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3466 +#: Endpointman.class.php:3783 msgid "File upload stopped by extension" msgstr "" -#: Endpointman.class.php:2583 +#: Endpointman.class.php:2891 msgid "Firmware MD5 didn't match!" msgstr "" -#: Endpointman.class.php:2812 +#: Endpointman.class.php:3122 msgid "Firmware Requirment Detected!.........." msgstr "" -#: views/epm_advanced_poce.page.php:71 +#: views/epm_advanced/poce.views.textarea.file.php:23 msgid "Full Screen F11" msgstr "" @@ -480,7 +504,11 @@ msgstr "" msgid "GIT Branch" msgstr "" -#: Endpointman.class.php:1645 views/epm_advanced_settings.page.php:23 +#: Endpointman.class.php:963 +msgid "Generate list Ok!" +msgstr "" + +#: Endpointman.class.php:1947 views/epm_advanced_settings.page.php:23 msgid "Git not installed!" msgstr "" @@ -488,40 +516,53 @@ msgstr "" msgid "Global Final Config & Firmware Directory" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "Heads up!" msgstr "" -#: Endpointman.class.php:139 Endpointman.class.php:146 -#: Endpointman.class.php:1396 +#: Endpointman.class.php:140 Endpointman.class.php:147 +#: Endpointman.class.php:1698 msgid "Here" msgstr "" -#: Endpointman.class.php:251 +#: Endpointman.class.php:304 msgid "Hide" msgstr "" -#: Endpointman.class.php:1533 +#: Endpointman.class.php:1835 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:660 +#: Endpointman.class.php:763 msgid "ID Brand not is numbre" msgstr "" -#: Endpointman.class.php:1381 +#: Endpointman.class.php:1683 msgid "ID Package send not valid, brand not exist!" msgstr "" -#: Endpointman.class.php:645 +#: Endpointman.class.php:748 msgid "ID Producto not is number" msgstr "" -#: Endpointman.class.php:1842 Endpointman.class.php:1976 +#: Endpointman.class.php:876 +msgid "ID is not number!" +msgstr "" + +#: Endpointman.class.php:879 +msgid "ID send is negative!" +msgstr "" + +#: Endpointman.class.php:945 Endpointman.class.php:2144 +#: Endpointman.class.php:2279 msgid "ID send is not number!" msgstr "" -#: Endpointman.class.php:1861 Endpointman.class.php:1999 +#: Endpointman.class.php:948 +msgid "ID send is number not valid!" +msgstr "" + +#: Endpointman.class.php:2163 Endpointman.class.php:2302 msgid "IDType invalid: " msgstr "" @@ -529,24 +570,24 @@ msgstr "" msgid "IP address of phone server" msgstr "" -#: Endpointman.class.php:220 +#: Endpointman.class.php:273 msgid "" "If we can activate the model set terminals of the models.
      If this " "model is disabled will not appear in the list of models that can be " "configured for PBX." msgstr "" -#: Endpointman.class.php:248 +#: Endpointman.class.php:301 msgid "" "If you select Hide disappear all models of the product selected from the " "Install/Uninstall list." msgstr "" -#: Endpointman.class.php:249 +#: Endpointman.class.php:302 msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" -#: Endpointman.class.php:247 +#: Endpointman.class.php:300 msgid "" "If you select Hide this brand will disappear and all products and models on " "the list of Install/Uninstall." @@ -578,92 +619,96 @@ msgstr "" msgid "Import a package brand in manual mode." msgstr "" -#: Endpointman.class.php:551 +#: Endpointman.class.php:638 msgid "Import/Export My Devices List" msgstr "" -#: Endpointman.class.php:1439 +#: Endpointman.class.php:1741 msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1278 +#: Endpointman.class.php:1580 msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1201 +#: Endpointman.class.php:1503 msgid "Importing brand file %_FILE_%..." msgstr "" -#: Endpointman.class.php:2796 +#: Endpointman.class.php:3106 msgid "Inserting %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:227 +#: Endpointman.class.php:280 msgid "Install" msgstr "" -#: Endpointman.class.php:230 +#: Endpointman.class.php:283 msgid "Install Firmware" msgstr "" -#: Endpointman.class.php:525 +#: Endpointman.class.php:612 msgid "Install/Unistall" msgstr "" -#: Endpointman.class.php:2551 +#: Endpointman.class.php:2859 msgid "Installing Firmware..." msgstr "" -#: Endpointman.class.php:2731 +#: Endpointman.class.php:3041 msgid "Installing brands is disabled while in repo mode!" msgstr "" -#: Endpointman.class.php:1496 +#: Endpointman.class.php:1798 msgid "Invalid Brand Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1490 +#: Endpointman.class.php:1792 msgid "Invalid Extension Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1263 Endpointman.class.php:1324 +#: Endpointman.class.php:1565 Endpointman.class.php:1626 msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:2980 +#: Endpointman.class.php:3297 msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3250 +#: Endpointman.class.php:3567 msgid "Invalid MAC Address" msgstr "" -#: Endpointman.class.php:1499 +#: Endpointman.class.php:1801 msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3245 +#: Endpointman.class.php:3562 msgid "Invalid Model Selected, Can't Sync System" msgstr "" -#: Endpointman.class.php:1493 +#: Endpointman.class.php:1795 msgid "Invalid Model Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:244 Endpointman.class.php:258 -#: Endpointman.class.php:308 +#: Endpointman.class.php:297 Endpointman.class.php:311 +#: Endpointman.class.php:361 msgid "Invalid Option!" msgstr "" -#: Endpointman.class.php:1967 +#: Endpointman.class.php:2270 msgid "Invalid Value!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:117 +#: views/epm_advanced/oui_manager.views.new.modal.php:55 +msgid "It is the brand of OUI we specified." +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:82 msgid "Learn how to create your own brand package at " msgstr "" -#: Endpointman.class.php:2269 +#: Endpointman.class.php:2573 msgid "Learn how to manually upload packages here (it's easy!):" msgstr "" @@ -671,19 +716,27 @@ msgstr "" msgid "Line" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "List Bran's Availables empty." msgstr "" +#: Endpointman.class.php:1481 +msgid "List Done!" +msgstr "" + #: views/epm_config_manager.page.php:19 msgid "List Packages Manager" msgstr "" -#: views/epm_advanced_manual_upload.page.php:168 +#: views/epm_advanced/poce.views.bootnav.php:5 +msgid "List Product's Empty" +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:133 msgid "List of other exports" msgstr "" -#: views/epm_advanced_manual_upload.page.php:209 +#: views/epm_advanced_manual_upload.page.php:152 msgid "List packages generated in other exports." msgstr "" @@ -691,11 +744,15 @@ msgstr "" msgid "Loading data...." msgstr "" -#: assets/js/epm_global.js:86 +#: assets/js/epm_global.js:117 msgid "Loading.." msgstr "" -#: views/epm_advanced_poce.page.php:16 +#: views/epm_advanced_manual_upload.page.php:140 +msgid "Loading..." +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:7 msgid "Local File Configs" msgstr "" @@ -703,11 +760,11 @@ msgstr "" msgid "Local Paths" msgstr "" -#: Endpointman.class.php:1246 +#: Endpointman.class.php:1548 msgid "Looking file and update brand's...." msgstr "" -#: Endpointman.class.php:1244 +#: Endpointman.class.php:1546 msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." msgstr "" @@ -715,23 +772,31 @@ msgstr "" msgid "MAC Address" msgstr "" -#: Endpointman.class.php:2717 +#: Endpointman.class.php:3025 msgid "MD5 Did not match!" msgstr "" -#: Endpointman.class.php:2163 +#: Endpointman.class.php:3027 +msgid "MD5 PKG: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:3026 +msgid "MD5 XML: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:2466 msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "" -#: Endpointman.class.php:2544 +#: Endpointman.class.php:2852 msgid "Matches!" msgstr "" -#: Endpointman.class.php:2151 +#: Endpointman.class.php:2454 msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3462 +#: Endpointman.class.php:3779 msgid "Missing a temporary folder" msgstr "" @@ -739,7 +804,7 @@ msgstr "" msgid "Model" msgstr "" -#: Endpointman.class.php:2950 +#: Endpointman.class.php:3267 msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" msgstr "" @@ -747,31 +812,31 @@ msgstr "" msgid "NMAP Executable Path" msgstr "" -#: views/epm_advanced_poce.page.php:90 +#: views/epm_advanced/poce.views.textarea.file.php:42 msgid "" "NOTE: File is permanently saved and not over-written during next package " "update." msgstr "" -#: views/epm_advanced_poce.page.php:80 +#: views/epm_advanced/poce.views.textarea.file.php:32 msgid "" "NOTE: File may be over-written during next package update. We suggest also " "using the Share button below to improve the next release." msgstr "" -#: views/epm_advanced_poce.page.php:74 +#: views/epm_advanced/poce.views.textarea.file.php:26 msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." msgstr "" -#: Endpointman.class.php:1725 +#: Endpointman.class.php:2027 msgid "Name invalid: " msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:61 -msgid "New OUI" +#: Endpointman.class.php:901 +msgid "Name is null!" msgstr "" -#: Endpointman.class.php:223 +#: Endpointman.class.php:276 msgid "New Package Modified" msgstr "" @@ -786,133 +851,154 @@ msgstr "" msgid "No" msgstr "" -#: Endpointman.class.php:2983 +#: Endpointman.class.php:3300 msgid "No 'brand_data.xml' file exists!" msgstr "" -#: Endpointman.class.php:1555 +#: Endpointman.class.php:1857 msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:1669 +#: Endpointman.class.php:1971 msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3283 Endpointman.class.php:3301 +#: Endpointman.class.php:3600 Endpointman.class.php:3618 msgid "No Devices/Extensions Left to Add" msgstr "" -#: Endpointman.class.php:1258 +#: Endpointman.class.php:1560 msgid "No File Provided!" msgstr "" -#: Endpointman.class.php:1530 +#: Endpointman.class.php:1832 msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3287 Endpointman.class.php:3305 +#: Endpointman.class.php:3604 Endpointman.class.php:3622 msgid "No Lines Left to Add" msgstr "" -#: Endpointman.class.php:1552 +#: Endpointman.class.php:1854 msgid "No OUI set!" msgstr "" -#: views/epm_advanced_poce.page.php:53 views/epm_advanced_poce.page.php:72 +#: views/epm_advanced/poce.views.textarea.file.php:5 +#: views/epm_advanced/poce.views.textarea.file.php:24 msgid "No Selected" msgstr "" -#: Endpointman.class.php:3460 +#: Endpointman.class.php:3777 msgid "No file was uploaded" msgstr "" -#: Endpointman.class.php:1369 +#: Endpointman.class.php:1671 msgid "No package set!" msgstr "" -#: Endpointman.class.php:884 +#: Endpointman.class.php:913 +msgid "No send Clone Model!" +msgstr "" + +#: Endpointman.class.php:1135 msgid "No send File ID!" msgstr "" -#: Endpointman.class.php:887 +#: Endpointman.class.php:1138 msgid "No send File Name!" msgstr "" -#: Endpointman.class.php:1066 +#: Endpointman.class.php:873 Endpointman.class.php:942 +msgid "No send ID!" +msgstr "" + +#: Endpointman.class.php:1314 msgid "No send Name File!" msgstr "" -#: Endpointman.class.php:1069 +#: Endpointman.class.php:898 +msgid "No send Name!" +msgstr "" + +#: Endpointman.class.php:1317 msgid "No send Origianl Name File!" msgstr "" -#: Endpointman.class.php:784 Endpointman.class.php:875 -#: Endpointman.class.php:1009 Endpointman.class.php:1051 -#: Endpointman.class.php:1145 +#: Endpointman.class.php:1035 Endpointman.class.php:1126 +#: Endpointman.class.php:1251 Endpointman.class.php:1299 +#: Endpointman.class.php:1393 msgid "No send Product Select!" msgstr "" -#: Endpointman.class.php:1151 +#: Endpointman.class.php:904 +msgid "No send Product!" +msgstr "" + +#: Endpointman.class.php:1399 msgid "No send SQL Select!" msgstr "" -#: Endpointman.class.php:1063 +#: Endpointman.class.php:1311 msgid "No send Save Name!" msgstr "" -#: Endpointman.class.php:1015 Endpointman.class.php:1054 +#: Endpointman.class.php:1257 Endpointman.class.php:1302 msgid "No send SendID!" msgstr "" -#: Endpointman.class.php:1060 +#: Endpointman.class.php:1308 msgid "No send Text File!" msgstr "" -#: Endpointman.class.php:890 Endpointman.class.php:1012 -#: Endpointman.class.php:1057 Endpointman.class.php:1148 +#: Endpointman.class.php:1141 Endpointman.class.php:1254 +#: Endpointman.class.php:1305 Endpointman.class.php:1396 msgid "No send Type File!" msgstr "" -#: Endpointman.class.php:1836 Endpointman.class.php:1970 +#: Endpointman.class.php:2138 Endpointman.class.php:2273 msgid "No send id!" msgstr "" -#: Endpointman.class.php:1839 Endpointman.class.php:1973 +#: Endpointman.class.php:2141 Endpointman.class.php:2276 msgid "No send idtype!" msgstr "" -#: Endpointman.class.php:1597 Endpointman.class.php:1830 -#: Endpointman.class.php:1960 +#: Endpointman.class.php:1899 Endpointman.class.php:2132 +#: Endpointman.class.php:2263 msgid "No send name!" msgstr "" -#: Endpointman.class.php:1600 Endpointman.class.php:1833 -#: Endpointman.class.php:1963 +#: Endpointman.class.php:1902 Endpointman.class.php:2135 +#: Endpointman.class.php:2266 msgid "No send value!" msgstr "" -#: Endpointman.class.php:1666 +#: Endpointman.class.php:1968 msgid "Not a Vaild Directory.
      Try to run 'mkdir " msgstr "" -#: Endpointman.class.php:2207 +#: Endpointman.class.php:2510 msgid "Not able to connect to repository. Using local Provisioner.net Package." msgstr "" -#: Endpointman.class.php:2237 +#: Endpointman.class.php:2540 msgid "" "Not able to connect to repository. Using local brand [%_brandname_%] file " "instead." msgstr "" -#: Endpointman.class.php:2192 +#: Endpointman.class.php:2495 msgid "Not able to connect to repository. Using local master file instead." msgstr "" -#: Endpointman.class.php:2668 +#: Endpointman.class.php:2976 msgid "Not allowed in repo mode!!" msgstr "" +#: Endpointman.class.php:1487 +msgid "Not is directory: " +msgstr "" + #: endpointman.i18n.php:18 msgid "OSS Endpoint Advanced Settings" msgstr "" @@ -944,28 +1030,32 @@ msgid "" "either of these and are encouraged." msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:30 -#: views/epm_advanced/oui_manager.views.grid.php:53 +#: views/epm_advanced/oui_manager.views.grid.php:24 +#: views/epm_advanced/oui_manager.views.new.modal.php:14 msgid "OUI" msgstr "" -#: Endpointman.class.php:543 +#: views/epm_advanced/oui_manager.views.new.modal.php:18 +msgid "OUI Brand" +msgstr "" + +#: Endpointman.class.php:630 msgid "OUI Manager" msgstr "" -#: Endpointman.class.php:2880 Endpointman.class.php:2905 +#: Endpointman.class.php:3192 Endpointman.class.php:3217 msgid "Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:140 +#: Endpointman.class.php:141 msgid "Or run this command on SSH:" msgstr "" -#: Endpointman.class.php:555 +#: Endpointman.class.php:642 msgid "Package Import/Export" msgstr "" -#: Endpointman.class.php:224 +#: Endpointman.class.php:277 msgid "Package Last Modified" msgstr "" @@ -977,94 +1067,103 @@ msgstr "" msgid "Package Server" msgstr "" -#: Endpointman.class.php:1372 +#: Endpointman.class.php:1674 msgid "Package not valid!" msgstr "" -#: Endpointman.class.php:2576 Endpointman.class.php:2684 +#: Endpointman.class.php:2884 Endpointman.class.php:2992 msgid "Please Check Directory/Permissions!" msgstr "" -#: Endpointman.class.php:139 +#: Endpointman.class.php:140 msgid "Please change the location:" msgstr "" -#: Endpointman.class.php:1253 +#: Endpointman.class.php:1555 msgid "Please name the Package the same name as your brand!" msgstr "" -#: Endpointman.class.php:1506 +#: Endpointman.class.php:1808 msgid "Please reboot & rebuild all imported phones" msgstr "" -#: Endpointman.class.php:1508 +#: Endpointman.class.php:1810 msgid "Possible file upload attack!" msgstr "" -#: Endpointman.class.php:2743 +#: Endpointman.class.php:3053 msgid "Processing %_PATH_%/brand_data.json..." msgstr "" -#: Endpointman.class.php:547 +#: Endpointman.class.php:634 msgid "Product Configuration Editor" msgstr "" -#: Endpointman.class.php:787 Endpointman.class.php:878 +#: Endpointman.class.php:1038 Endpointman.class.php:1129 msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:790 Endpointman.class.php:881 +#: Endpointman.class.php:1041 Endpointman.class.php:1132 msgid "Product Select send is number not valid!" msgstr "" +#: Endpointman.class.php:907 +msgid "Product is not number!" +msgstr "" + +#: Endpointman.class.php:910 +msgid "Product send is negative!" +msgstr "" + #: views/epm_advanced_manual_upload.page.php:24 msgid "Provisioner Package" msgstr "" -#: Endpointman.class.php:235 Endpointman.class.php:252 -#: Endpointman.class.php:256 +#: Endpointman.class.php:288 Endpointman.class.php:305 +#: Endpointman.class.php:309 msgid "Ready!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:13 +#: views/epm_advanced/oui_manager.views.grid.php:6 msgid "Refresh Table" msgstr "" -#: Endpointman.class.php:231 +#: Endpointman.class.php:284 msgid "Remove Firmware" msgstr "" -#: Endpointman.class.php:589 +#: Endpointman.class.php:676 msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:2986 +#: Endpointman.class.php:3303 msgid "Removing Temporary Files.............." msgstr "" -#: Endpointman.class.php:609 +#: Endpointman.class.php:680 msgid "Removing symlink to web provisioner" msgstr "" -#: views/epm_advanced_poce.page.php:83 +#: views/epm_advanced/poce.views.textarea.file.php:35 msgid "Save" msgstr "" -#: views/epm_advanced_poce.page.php:96 +#: views/epm_advanced/poce.views.textarea.file.php:48 msgid "Save As..." msgstr "" -#: Endpointman.class.php:238 Endpointman.class.php:254 -#: Endpointman.class.php:306 +#: Endpointman.class.php:291 Endpointman.class.php:307 +#: Endpointman.class.php:359 msgid "Saving Changes..." msgstr "" -#: Endpointman.class.php:239 Endpointman.class.php:255 -#: Endpointman.class.php:307 +#: Endpointman.class.php:292 Endpointman.class.php:308 +#: Endpointman.class.php:360 msgid "Saving Changes... Ok!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:137 +#: views/epm_advanced/oui_manager.views.new.modal.php:41 +#: views/epm_advanced_manual_upload.page.php:101 msgid "Select Brand:" msgstr "" @@ -1077,23 +1176,23 @@ msgstr "" msgid "Setting Provision" msgstr "" -#: Endpointman.class.php:539 +#: Endpointman.class.php:626 msgid "Settings" msgstr "" -#: views/epm_advanced_poce.page.php:107 +#: views/epm_advanced/poce.views.textarea.file.php:59 msgid "Share" msgstr "" -#: Endpointman.class.php:250 +#: Endpointman.class.php:303 msgid "Show" msgstr "" -#: Endpointman.class.php:529 +#: Endpointman.class.php:616 msgid "Show/Hide" msgstr "" -#: Endpointman.class.php:2516 +#: Endpointman.class.php:2824 msgid "Skipping download..." msgstr "" @@ -1101,15 +1200,15 @@ msgstr "" msgid "Structure" msgstr "" -#: Endpointman.class.php:2160 +#: Endpointman.class.php:2463 msgid "Syntax error, malformed JSON" msgstr "" -#: Endpointman.class.php:2941 +#: Endpointman.class.php:3253 msgid "System Error in Sync Model Function, Load Failure!" msgstr "" -#: Endpointman.class.php:2379 +#: Endpointman.class.php:2683 msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" msgstr "" @@ -1117,11 +1216,15 @@ msgstr "" msgid "System Failure!" msgstr "" -#: Endpointman.class.php:298 Endpointman.class.php:393 +#: Endpointman.class.php:351 Endpointman.class.php:458 msgid "Tab is not valid!" msgstr "" -#: Endpointman.class.php:222 +#: Endpointman.class.php:602 +msgid "Template Editor" +msgstr "" + +#: Endpointman.class.php:275 msgid "" "The \"Install\" button installs the configuration package brand models we " "selected.
      The \"Uninstall\" button removes the package configuration " @@ -1130,13 +1233,13 @@ msgid "" "version is detected." msgstr "" -#: Endpointman.class.php:2303 +#: Endpointman.class.php:2607 msgid "" "The Remote Server Is Currently Syncing With the Master Server, Please try " "again later" msgstr "" -#: Endpointman.class.php:221 +#: Endpointman.class.php:274 msgid "" "The button \"Install Firmware\" installs the necessary files to the server " "for the terminal alone are updated via TFTP or HTTP.
      The button " @@ -1146,24 +1249,30 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3456 +#: Endpointman.class.php:3773 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3454 +#: Endpointman.class.php:3771 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3458 +#: Endpointman.class.php:3775 msgid "The uploaded file was only partially uploaded" msgstr "" -#: Endpointman.class.php:2728 +#: Endpointman.class.php:3038 msgid "Then Use Manual Upload in Advanced Settings." msgstr "" +#: views/epm_advanced/oui_manager.views.new.modal.php:26 +msgid "" +"They are the first 6 characters of the MAC device that identifies the brand " +"(manufacturer)." +msgstr "" + #: views/epm_advanced_settings.page.php:134 msgid "Time" msgstr "" @@ -1180,59 +1289,59 @@ msgstr "" msgid "TimeZone by PBX Setting" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:32 +#: views/epm_advanced/oui_manager.views.grid.php:26 msgid "Type" msgstr "" -#: Endpointman.class.php:1164 +#: Endpointman.class.php:1412 msgid "Type File not valid!" msgstr "" -#: Endpointman.class.php:2154 +#: Endpointman.class.php:2457 msgid "Underflow or the modes mismatch" msgstr "" -#: Endpointman.class.php:2157 +#: Endpointman.class.php:2460 msgid "Unexpected control character found" msgstr "" -#: Endpointman.class.php:228 +#: Endpointman.class.php:281 msgid "Uninstall" msgstr "" -#: Endpointman.class.php:2619 +#: Endpointman.class.php:2927 msgid "Uninstalla Brand..." msgstr "" -#: Endpointman.class.php:2596 +#: Endpointman.class.php:2904 msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3600 +#: Endpointman.class.php:3917 msgid "Unknown" msgstr "" -#: Endpointman.class.php:2166 +#: Endpointman.class.php:2469 msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3468 +#: Endpointman.class.php:3785 msgid "Unknown upload error" msgstr "" -#: Endpointman.class.php:229 +#: Endpointman.class.php:282 msgid "Update" msgstr "" -#: Endpointman.class.php:243 +#: Endpointman.class.php:296 msgid "Update Content..." msgstr "" -#: Endpointman.class.php:232 +#: Endpointman.class.php:285 msgid "Update Firmware" msgstr "" -#: Endpointman.class.php:237 +#: Endpointman.class.php:290 msgid "Update!" msgstr "" @@ -1240,27 +1349,27 @@ msgstr "" msgid "Updated!" msgstr "" -#: Endpointman.class.php:2792 +#: Endpointman.class.php:3102 msgid "Updating %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:2803 +#: Endpointman.class.php:3113 msgid "Updating Family Lines................." msgstr "" -#: Endpointman.class.php:1314 +#: Endpointman.class.php:1616 msgid "Updating Last Modified..." msgstr "" -#: Endpointman.class.php:2968 +#: Endpointman.class.php:3285 msgid "Updating OUI list in DB" msgstr "" -#: Endpointman.class.php:240 Endpointman.class.php:257 +#: Endpointman.class.php:293 Endpointman.class.php:310 msgid "Upload Content!" msgstr "" -#: views/epm_advanced_poce.page.php:104 +#: views/epm_advanced/poce.views.textarea.file.php:56 msgid "" "Upload this configuration file to the Provisioner.net Team. Files " "shared are confidential and help improve the quality of releases." @@ -1270,7 +1379,7 @@ msgstr "" msgid "Use GITHUB Live Repo" msgstr "" -#: views/epm_advanced_poce.page.php:39 +#: views/epm_advanced/poce.views.button.up.files.php:31 msgid "User File Configs" msgstr "" @@ -1279,7 +1388,7 @@ msgid "" "Warning: The extensions need to be added into FreePBX before you import." msgstr "" -#: Endpointman.class.php:1447 +#: Endpointman.class.php:1749 msgid "We support only CVS and TXT files, type file %_FILE_% no support!" msgstr "" @@ -1302,29 +1411,29 @@ msgstr "" msgid "Yes" msgstr "" -#: Endpointman.class.php:2727 +#: Endpointman.class.php:3037 msgid "" "You Can Also Manually Update The Repository By Downloading Files here: %" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3182 +#: Endpointman.class.php:3499 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3185 +#: Endpointman.class.php:3502 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4575 +#: Endpointman.class.php:4945 msgid "You can't remove the only line left" msgstr "" -#: Endpointman.class.php:2587 +#: Endpointman.class.php:2895 msgid "Your Firmware is already up to date" msgstr "" -#: Endpointman.class.php:1709 +#: Endpointman.class.php:2011 msgid "Your permissions are wrong on " msgstr "" @@ -1337,7 +1446,7 @@ msgstr "" msgid "is required" msgstr "" -#: Endpointman.class.php:2740 +#: Endpointman.class.php:3050 msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" msgstr "" diff --git a/i18n/de_DE/LC_MESSAGES/endpointman.mo b/i18n/de_DE/LC_MESSAGES/endpointman.mo index a70fc0086421642f4372207174fff18e35d460e7..913ff64d5e62e9be15d00671c3a5080192820166 100644 GIT binary patch delta 23 ecmaFK{*ryeNk%SXT?1nULjx-llg*bI#h3tJ-3ICa delta 23 ecmaFK{*ryeNk%RsT_a-!Lt`sri_MoA#h3tK6bA7C diff --git a/i18n/de_DE/LC_MESSAGES/endpointman.po b/i18n/de_DE/LC_MESSAGES/endpointman.po index 832a2165..c0b1bf3b 100644 --- a/i18n/de_DE/LC_MESSAGES/endpointman.po +++ b/i18n/de_DE/LC_MESSAGES/endpointman.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-23 13:38-0800\n" +"POT-Creation-Date: 2016-03-03 10:44-0800\n" "PO-Revision-Date: 2015-11-12 14:01+0200\n" "Last-Translator: Matthias \n" "Language-Team: German Click Here!" @@ -63,7 +63,7 @@ msgstr "" msgid "ARP Executable Path" msgstr "" -#: Endpointman.class.php:2294 Endpointman.class.php:2295 +#: Endpointman.class.php:2598 Endpointman.class.php:2599 msgid "" "Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" msgstr "" @@ -72,24 +72,27 @@ msgstr "" msgid "Access denied!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:33 +#: views/epm_advanced/oui_manager.views.grid.php:27 msgid "Actions" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:6 -#: views/epm_advanced/oui_manager.views.grid.php:8 +#: views/epm_advanced/oui_manager.views.grid.php:5 msgid "Add Custom OUI" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:81 +#: views/epm_advanced/oui_manager.views.new.modal.php:62 msgid "Add New" msgstr "" +#: Endpointman.class.php:933 +msgid "Add New Template OK!" +msgstr "" + #: page.epm_advanced.php:19 msgid "Advanced Settings" msgstr "" -#: Endpointman.class.php:2647 +#: Endpointman.class.php:2955 msgid "All Done!" msgstr "" @@ -101,7 +104,7 @@ msgstr "" msgid "Allow Saving Over Default Configuration Files" msgstr "" -#: Endpointman.class.php:2748 +#: Endpointman.class.php:3058 msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" msgstr "" @@ -109,8 +112,8 @@ msgstr "" msgid "Asterisk Executable Path" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:31 -#: views/epm_advanced/oui_manager.views.grid.php:56 +#: views/epm_advanced/oui_manager.views.grid.php:25 +#: views/epm_advanced/oui_manager.views.new.modal.php:36 #: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 msgid "Brand" msgstr "" @@ -119,7 +122,7 @@ msgstr "" msgid "Brand Package" msgstr "" -#: views/epm_advanced_manual_upload.page.php:125 +#: views/epm_advanced_manual_upload.page.php:90 msgid "Brand's Available" msgstr "" @@ -131,24 +134,24 @@ msgstr "" msgid "CSV File Format" msgstr "" -#: Endpointman.class.php:1196 Endpointman.class.php:1273 -#: Endpointman.class.php:1432 +#: Endpointman.class.php:1498 Endpointman.class.php:1575 +#: Endpointman.class.php:1734 msgid "Can Not Find Uploaded Files!" msgstr "" -#: Endpointman.class.php:2720 +#: Endpointman.class.php:3030 msgid "Can't Find Downloaded File!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:80 +#: views/epm_advanced/oui_manager.views.new.modal.php:61 msgid "Cancel" msgstr "" -#: Endpointman.class.php:2175 +#: Endpointman.class.php:2478 msgid "Cant find file:" msgstr "" -#: Endpointman.class.php:226 +#: Endpointman.class.php:279 msgid "Check Online " msgstr "" @@ -156,43 +159,52 @@ msgstr "" msgid "Check for Update" msgstr "" -#: Endpointman.class.php:225 +#: Endpointman.class.php:278 msgid "Check for Update " msgstr "" -#: Endpointman.class.php:241 +#: Endpointman.class.php:294 msgid "Check for Updates..." msgstr "" -#: Endpointman.class.php:242 +#: Endpointman.class.php:295 msgid "Check for Updates... Ok!" msgstr "" -#: Endpointman.class.php:2542 +#: Endpointman.class.php:2850 msgid "Checking MD5sum of Package..." msgstr "" -#: Endpointman.class.php:2705 +#: Endpointman.class.php:3013 msgid "Checking MD5sum of Package...." msgstr "" -#: Endpointman.class.php:1394 +#: Endpointman.class.php:1696 msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:274 Endpointman.class.php:292 -#: Endpointman.class.php:320 Endpointman.class.php:348 -#: Endpointman.class.php:357 Endpointman.class.php:387 +#: Endpointman.class.php:916 +msgid "Clone Model is not number!" +msgstr "" + +#: Endpointman.class.php:919 +msgid "Clone Model send is negative!" +msgstr "" + +#: Endpointman.class.php:265 Endpointman.class.php:327 +#: Endpointman.class.php:345 Endpointman.class.php:373 +#: Endpointman.class.php:401 Endpointman.class.php:410 +#: Endpointman.class.php:440 Endpointman.class.php:453 msgid "Command not found!" msgstr "" -#: Endpointman.class.php:146 +#: Endpointman.class.php:147 msgid "" "Configuration Directory is not a directory or does not exist! Please change " "the location here:" msgstr "" -#: Endpointman.class.php:138 +#: Endpointman.class.php:139 msgid "Configuration Directory is not writable!" msgstr "" @@ -204,27 +216,31 @@ msgstr "" msgid "Connectivity" msgstr "Verbindung" -#: Endpointman.class.php:2574 +#: Endpointman.class.php:2882 msgid "Copy Error Detected! Aborting Install!" msgstr "" -#: Endpointman.class.php:2756 +#: Endpointman.class.php:3066 msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." msgstr "" -#: Endpointman.class.php:2681 +#: Endpointman.class.php:2989 msgid "Creating EPM temp directory" msgstr "" -#: Endpointman.class.php:1222 +#: Endpointman.class.php:1524 msgid "Creating EPM temp directory..." msgstr "" -#: Endpointman.class.php:1300 +#: Endpointman.class.php:1602 msgid "Creating Provisioner Directory..." msgstr "" -#: views/epm_advanced_poce.page.php:28 +#: Endpointman.class.php:598 +msgid "Current Templates" +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:19 msgid "Custom Template Files" msgstr "" @@ -232,20 +248,32 @@ msgstr "" msgid "Default Mirror FreePBX" msgstr "" -#: views/epm_advanced_poce.page.php:84 +#: views/epm_advanced/poce.views.textarea.file.php:36 msgid "Delete" msgstr "" +#: Endpointman.class.php:889 +msgid "Delete Template OK!" +msgstr "" + #: views/epm_advanced_settings.page.php:56 #: views/epm_advanced_settings.page.php:191 msgid "Determine for Me" msgstr "" -#: Endpointman.class.php:1663 +#: Endpointman.class.php:588 +msgid "Devices" +msgstr "" + +#: Endpointman.class.php:1965 msgid "Directory Not Writable!" msgstr "" -#: Endpointman.class.php:234 +#: Endpointman.class.php:1490 +msgid "Directory no exists: " +msgstr "" + +#: Endpointman.class.php:287 msgid "Disable" msgstr "" @@ -261,18 +289,18 @@ msgstr "" msgid "Disable Tooltips" msgstr "" -#: Endpointman.class.php:1224 Endpointman.class.php:1238 -#: Endpointman.class.php:1297 Endpointman.class.php:1302 -#: Endpointman.class.php:1317 Endpointman.class.php:1393 -#: Endpointman.class.php:1488 Endpointman.class.php:2526 -#: Endpointman.class.php:2538 Endpointman.class.php:2579 -#: Endpointman.class.php:2611 Endpointman.class.php:2665 -#: Endpointman.class.php:2693 Endpointman.class.php:2700 -#: Endpointman.class.php:2707 Endpointman.class.php:2711 -#: Endpointman.class.php:2782 Endpointman.class.php:2860 -#: Endpointman.class.php:2896 Endpointman.class.php:2925 -#: Endpointman.class.php:2967 Endpointman.class.php:2978 -#: Endpointman.class.php:2988 +#: Endpointman.class.php:1526 Endpointman.class.php:1540 +#: Endpointman.class.php:1599 Endpointman.class.php:1604 +#: Endpointman.class.php:1619 Endpointman.class.php:1695 +#: Endpointman.class.php:1790 Endpointman.class.php:2834 +#: Endpointman.class.php:2846 Endpointman.class.php:2887 +#: Endpointman.class.php:2919 Endpointman.class.php:2973 +#: Endpointman.class.php:3001 Endpointman.class.php:3008 +#: Endpointman.class.php:3015 Endpointman.class.php:3019 +#: Endpointman.class.php:3092 Endpointman.class.php:3172 +#: Endpointman.class.php:3208 Endpointman.class.php:3237 +#: Endpointman.class.php:3284 Endpointman.class.php:3295 +#: Endpointman.class.php:3305 msgid "Done!" msgstr "" @@ -280,27 +308,23 @@ msgstr "" msgid "Download updated releases from " msgstr "" -#: Endpointman.class.php:2689 +#: Endpointman.class.php:2997 msgid "Downloading Brand JSON....." msgstr "" -#: Endpointman.class.php:2698 +#: Endpointman.class.php:3006 msgid "Downloading Brand Package..." msgstr "" -#: Endpointman.class.php:2520 Endpointman.class.php:2532 +#: Endpointman.class.php:2828 Endpointman.class.php:2840 msgid "Downloading firmware..." msgstr "" -#: Endpointman.class.php:594 +#: Endpointman.class.php:688 msgid "Dropping all relevant tables" msgstr "" -#: views/epm_advanced_manual_upload.page.php:177 -msgid "Empty list." -msgstr "" - -#: Endpointman.class.php:233 +#: Endpointman.class.php:286 msgid "Enable" msgstr "" @@ -332,35 +356,35 @@ msgstr "" msgid "Error 500 Internal Server Error" msgstr "" -#: Endpointman.class.php:2726 +#: Endpointman.class.php:3036 msgid "" "Error Connecting to the Package Repository. Module not installed. Please Try " "again later." msgstr "" -#: Endpointman.class.php:2683 +#: Endpointman.class.php:2991 msgid "Error creating directory: %_DIR_%" msgstr "" -#: Endpointman.class.php:2723 +#: Endpointman.class.php:3033 msgid "Error download Brand package!" msgstr "" -#: Endpointman.class.php:2523 Endpointman.class.php:2535 +#: Endpointman.class.php:2831 Endpointman.class.php:2843 msgid "Error download frimware package!" msgstr "" -#: Endpointman.class.php:236 Endpointman.class.php:253 -#: Endpointman.class.php:305 Endpointman.class.php:1227 -#: Endpointman.class.php:1305 +#: Endpointman.class.php:289 Endpointman.class.php:306 +#: Endpointman.class.php:358 Endpointman.class.php:1529 +#: Endpointman.class.php:1607 msgid "Error!" msgstr "" -#: Endpointman.class.php:1784 Endpointman.class.php:1821 +#: Endpointman.class.php:2086 Endpointman.class.php:2123 msgid "Error: Command not found!" msgstr "" -#: Endpointman.class.php:2268 +#: Endpointman.class.php:2572 msgid "Error: No Local File for %_name_% !" msgstr "" @@ -372,16 +396,16 @@ msgstr "" msgid "Experimental" msgstr "" -#: views/epm_advanced_manual_upload.page.php:157 +#: views/epm_advanced_manual_upload.page.php:122 msgid "Explor a package brand's availables." msgstr "" #: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:146 +#: views/epm_advanced_manual_upload.page.php:109 msgid "Export" msgstr "" -#: views/epm_advanced_manual_upload.page.php:114 +#: views/epm_advanced_manual_upload.page.php:79 msgid "Export Brand Packages" msgstr "" @@ -397,7 +421,7 @@ msgstr "" msgid "Export data configuracion devices." msgstr "" -#: Endpointman.class.php:1384 +#: Endpointman.class.php:1686 msgid "Exporting %_NAME_%" msgstr "" @@ -405,19 +429,19 @@ msgstr "" msgid "Extension" msgstr "" -#: Endpointman.class.php:1295 +#: Endpointman.class.php:1597 msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:1233 +#: Endpointman.class.php:1535 msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" msgstr "" -#: Endpointman.class.php:2709 +#: Endpointman.class.php:3017 msgid "Extracting Tarball........" msgstr "" -#: Endpointman.class.php:1235 +#: Endpointman.class.php:1537 msgid "Extracting Tarball........ " msgstr "" @@ -425,11 +449,11 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3464 +#: Endpointman.class.php:3781 msgid "Failed to write file to disk" msgstr "" -#: Endpointman.class.php:1450 +#: Endpointman.class.php:1752 msgid "File %_FILE_% size is 0!" msgstr "" @@ -437,7 +461,7 @@ msgstr "" msgid "File (TFTP/FTP)" msgstr "" -#: Endpointman.class.php:1321 +#: Endpointman.class.php:1623 msgid "File Temp no Exists!" msgstr "" @@ -445,23 +469,23 @@ msgstr "" msgid "File not Found!" msgstr "" -#: Endpointman.class.php:946 +#: Endpointman.class.php:1197 msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3466 +#: Endpointman.class.php:3783 msgid "File upload stopped by extension" msgstr "" -#: Endpointman.class.php:2583 +#: Endpointman.class.php:2891 msgid "Firmware MD5 didn't match!" msgstr "" -#: Endpointman.class.php:2812 +#: Endpointman.class.php:3122 msgid "Firmware Requirment Detected!.........." msgstr "" -#: views/epm_advanced_poce.page.php:71 +#: views/epm_advanced/poce.views.textarea.file.php:23 msgid "Full Screen F11" msgstr "" @@ -469,7 +493,11 @@ msgstr "" msgid "GIT Branch" msgstr "" -#: Endpointman.class.php:1645 views/epm_advanced_settings.page.php:23 +#: Endpointman.class.php:963 +msgid "Generate list Ok!" +msgstr "" + +#: Endpointman.class.php:1947 views/epm_advanced_settings.page.php:23 msgid "Git not installed!" msgstr "" @@ -477,40 +505,53 @@ msgstr "" msgid "Global Final Config & Firmware Directory" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "Heads up!" msgstr "" -#: Endpointman.class.php:139 Endpointman.class.php:146 -#: Endpointman.class.php:1396 +#: Endpointman.class.php:140 Endpointman.class.php:147 +#: Endpointman.class.php:1698 msgid "Here" msgstr "" -#: Endpointman.class.php:251 +#: Endpointman.class.php:304 msgid "Hide" msgstr "" -#: Endpointman.class.php:1533 +#: Endpointman.class.php:1835 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:660 +#: Endpointman.class.php:763 msgid "ID Brand not is numbre" msgstr "" -#: Endpointman.class.php:1381 +#: Endpointman.class.php:1683 msgid "ID Package send not valid, brand not exist!" msgstr "" -#: Endpointman.class.php:645 +#: Endpointman.class.php:748 msgid "ID Producto not is number" msgstr "" -#: Endpointman.class.php:1842 Endpointman.class.php:1976 +#: Endpointman.class.php:876 +msgid "ID is not number!" +msgstr "" + +#: Endpointman.class.php:879 +msgid "ID send is negative!" +msgstr "" + +#: Endpointman.class.php:945 Endpointman.class.php:2144 +#: Endpointman.class.php:2279 msgid "ID send is not number!" msgstr "" -#: Endpointman.class.php:1861 Endpointman.class.php:1999 +#: Endpointman.class.php:948 +msgid "ID send is number not valid!" +msgstr "" + +#: Endpointman.class.php:2163 Endpointman.class.php:2302 msgid "IDType invalid: " msgstr "" @@ -518,24 +559,24 @@ msgstr "" msgid "IP address of phone server" msgstr "" -#: Endpointman.class.php:220 +#: Endpointman.class.php:273 msgid "" "If we can activate the model set terminals of the models.
      If this " "model is disabled will not appear in the list of models that can be " "configured for PBX." msgstr "" -#: Endpointman.class.php:248 +#: Endpointman.class.php:301 msgid "" "If you select Hide disappear all models of the product selected from the " "Install/Uninstall list." msgstr "" -#: Endpointman.class.php:249 +#: Endpointman.class.php:302 msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" -#: Endpointman.class.php:247 +#: Endpointman.class.php:300 msgid "" "If you select Hide this brand will disappear and all products and models on " "the list of Install/Uninstall." @@ -567,92 +608,96 @@ msgstr "" msgid "Import a package brand in manual mode." msgstr "" -#: Endpointman.class.php:551 +#: Endpointman.class.php:638 msgid "Import/Export My Devices List" msgstr "" -#: Endpointman.class.php:1439 +#: Endpointman.class.php:1741 msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1278 +#: Endpointman.class.php:1580 msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1201 +#: Endpointman.class.php:1503 msgid "Importing brand file %_FILE_%..." msgstr "" -#: Endpointman.class.php:2796 +#: Endpointman.class.php:3106 msgid "Inserting %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:227 +#: Endpointman.class.php:280 msgid "Install" msgstr "" -#: Endpointman.class.php:230 +#: Endpointman.class.php:283 msgid "Install Firmware" msgstr "" -#: Endpointman.class.php:525 +#: Endpointman.class.php:612 msgid "Install/Unistall" msgstr "" -#: Endpointman.class.php:2551 +#: Endpointman.class.php:2859 msgid "Installing Firmware..." msgstr "" -#: Endpointman.class.php:2731 +#: Endpointman.class.php:3041 msgid "Installing brands is disabled while in repo mode!" msgstr "" -#: Endpointman.class.php:1496 +#: Endpointman.class.php:1798 msgid "Invalid Brand Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1490 +#: Endpointman.class.php:1792 msgid "Invalid Extension Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1263 Endpointman.class.php:1324 +#: Endpointman.class.php:1565 Endpointman.class.php:1626 msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:2980 +#: Endpointman.class.php:3297 msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3250 +#: Endpointman.class.php:3567 msgid "Invalid MAC Address" msgstr "" -#: Endpointman.class.php:1499 +#: Endpointman.class.php:1801 msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3245 +#: Endpointman.class.php:3562 msgid "Invalid Model Selected, Can't Sync System" msgstr "" -#: Endpointman.class.php:1493 +#: Endpointman.class.php:1795 msgid "Invalid Model Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:244 Endpointman.class.php:258 -#: Endpointman.class.php:308 +#: Endpointman.class.php:297 Endpointman.class.php:311 +#: Endpointman.class.php:361 msgid "Invalid Option!" msgstr "" -#: Endpointman.class.php:1967 +#: Endpointman.class.php:2270 msgid "Invalid Value!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:117 +#: views/epm_advanced/oui_manager.views.new.modal.php:55 +msgid "It is the brand of OUI we specified." +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:82 msgid "Learn how to create your own brand package at " msgstr "" -#: Endpointman.class.php:2269 +#: Endpointman.class.php:2573 msgid "Learn how to manually upload packages here (it's easy!):" msgstr "" @@ -660,19 +705,27 @@ msgstr "" msgid "Line" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "List Bran's Availables empty." msgstr "" +#: Endpointman.class.php:1481 +msgid "List Done!" +msgstr "" + #: views/epm_config_manager.page.php:19 msgid "List Packages Manager" msgstr "" -#: views/epm_advanced_manual_upload.page.php:168 +#: views/epm_advanced/poce.views.bootnav.php:5 +msgid "List Product's Empty" +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:133 msgid "List of other exports" msgstr "" -#: views/epm_advanced_manual_upload.page.php:209 +#: views/epm_advanced_manual_upload.page.php:152 msgid "List packages generated in other exports." msgstr "" @@ -680,11 +733,15 @@ msgstr "" msgid "Loading data...." msgstr "" -#: assets/js/epm_global.js:86 +#: assets/js/epm_global.js:117 msgid "Loading.." msgstr "" -#: views/epm_advanced_poce.page.php:16 +#: views/epm_advanced_manual_upload.page.php:140 +msgid "Loading..." +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:7 msgid "Local File Configs" msgstr "" @@ -692,11 +749,11 @@ msgstr "" msgid "Local Paths" msgstr "" -#: Endpointman.class.php:1246 +#: Endpointman.class.php:1548 msgid "Looking file and update brand's...." msgstr "" -#: Endpointman.class.php:1244 +#: Endpointman.class.php:1546 msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." msgstr "" @@ -704,23 +761,31 @@ msgstr "" msgid "MAC Address" msgstr "" -#: Endpointman.class.php:2717 +#: Endpointman.class.php:3025 msgid "MD5 Did not match!" msgstr "" -#: Endpointman.class.php:2163 +#: Endpointman.class.php:3027 +msgid "MD5 PKG: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:3026 +msgid "MD5 XML: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:2466 msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "" -#: Endpointman.class.php:2544 +#: Endpointman.class.php:2852 msgid "Matches!" msgstr "" -#: Endpointman.class.php:2151 +#: Endpointman.class.php:2454 msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3462 +#: Endpointman.class.php:3779 msgid "Missing a temporary folder" msgstr "" @@ -728,7 +793,7 @@ msgstr "" msgid "Model" msgstr "" -#: Endpointman.class.php:2950 +#: Endpointman.class.php:3267 msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" msgstr "" @@ -736,31 +801,31 @@ msgstr "" msgid "NMAP Executable Path" msgstr "" -#: views/epm_advanced_poce.page.php:90 +#: views/epm_advanced/poce.views.textarea.file.php:42 msgid "" "NOTE: File is permanently saved and not over-written during next package " "update." msgstr "" -#: views/epm_advanced_poce.page.php:80 +#: views/epm_advanced/poce.views.textarea.file.php:32 msgid "" "NOTE: File may be over-written during next package update. We suggest also " "using the Share button below to improve the next release." msgstr "" -#: views/epm_advanced_poce.page.php:74 +#: views/epm_advanced/poce.views.textarea.file.php:26 msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." msgstr "" -#: Endpointman.class.php:1725 +#: Endpointman.class.php:2027 msgid "Name invalid: " msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:61 -msgid "New OUI" +#: Endpointman.class.php:901 +msgid "Name is null!" msgstr "" -#: Endpointman.class.php:223 +#: Endpointman.class.php:276 msgid "New Package Modified" msgstr "" @@ -775,133 +840,154 @@ msgstr "" msgid "No" msgstr "" -#: Endpointman.class.php:2983 +#: Endpointman.class.php:3300 msgid "No 'brand_data.xml' file exists!" msgstr "" -#: Endpointman.class.php:1555 +#: Endpointman.class.php:1857 msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:1669 +#: Endpointman.class.php:1971 msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3283 Endpointman.class.php:3301 +#: Endpointman.class.php:3600 Endpointman.class.php:3618 msgid "No Devices/Extensions Left to Add" msgstr "" -#: Endpointman.class.php:1258 +#: Endpointman.class.php:1560 msgid "No File Provided!" msgstr "" -#: Endpointman.class.php:1530 +#: Endpointman.class.php:1832 msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3287 Endpointman.class.php:3305 +#: Endpointman.class.php:3604 Endpointman.class.php:3622 msgid "No Lines Left to Add" msgstr "" -#: Endpointman.class.php:1552 +#: Endpointman.class.php:1854 msgid "No OUI set!" msgstr "" -#: views/epm_advanced_poce.page.php:53 views/epm_advanced_poce.page.php:72 +#: views/epm_advanced/poce.views.textarea.file.php:5 +#: views/epm_advanced/poce.views.textarea.file.php:24 msgid "No Selected" msgstr "" -#: Endpointman.class.php:3460 +#: Endpointman.class.php:3777 msgid "No file was uploaded" msgstr "" -#: Endpointman.class.php:1369 +#: Endpointman.class.php:1671 msgid "No package set!" msgstr "" -#: Endpointman.class.php:884 +#: Endpointman.class.php:913 +msgid "No send Clone Model!" +msgstr "" + +#: Endpointman.class.php:1135 msgid "No send File ID!" msgstr "" -#: Endpointman.class.php:887 +#: Endpointman.class.php:1138 msgid "No send File Name!" msgstr "" -#: Endpointman.class.php:1066 +#: Endpointman.class.php:873 Endpointman.class.php:942 +msgid "No send ID!" +msgstr "" + +#: Endpointman.class.php:1314 msgid "No send Name File!" msgstr "" -#: Endpointman.class.php:1069 +#: Endpointman.class.php:898 +msgid "No send Name!" +msgstr "" + +#: Endpointman.class.php:1317 msgid "No send Origianl Name File!" msgstr "" -#: Endpointman.class.php:784 Endpointman.class.php:875 -#: Endpointman.class.php:1009 Endpointman.class.php:1051 -#: Endpointman.class.php:1145 +#: Endpointman.class.php:1035 Endpointman.class.php:1126 +#: Endpointman.class.php:1251 Endpointman.class.php:1299 +#: Endpointman.class.php:1393 msgid "No send Product Select!" msgstr "" -#: Endpointman.class.php:1151 +#: Endpointman.class.php:904 +msgid "No send Product!" +msgstr "" + +#: Endpointman.class.php:1399 msgid "No send SQL Select!" msgstr "" -#: Endpointman.class.php:1063 +#: Endpointman.class.php:1311 msgid "No send Save Name!" msgstr "" -#: Endpointman.class.php:1015 Endpointman.class.php:1054 +#: Endpointman.class.php:1257 Endpointman.class.php:1302 msgid "No send SendID!" msgstr "" -#: Endpointman.class.php:1060 +#: Endpointman.class.php:1308 msgid "No send Text File!" msgstr "" -#: Endpointman.class.php:890 Endpointman.class.php:1012 -#: Endpointman.class.php:1057 Endpointman.class.php:1148 +#: Endpointman.class.php:1141 Endpointman.class.php:1254 +#: Endpointman.class.php:1305 Endpointman.class.php:1396 msgid "No send Type File!" msgstr "" -#: Endpointman.class.php:1836 Endpointman.class.php:1970 +#: Endpointman.class.php:2138 Endpointman.class.php:2273 msgid "No send id!" msgstr "" -#: Endpointman.class.php:1839 Endpointman.class.php:1973 +#: Endpointman.class.php:2141 Endpointman.class.php:2276 msgid "No send idtype!" msgstr "" -#: Endpointman.class.php:1597 Endpointman.class.php:1830 -#: Endpointman.class.php:1960 +#: Endpointman.class.php:1899 Endpointman.class.php:2132 +#: Endpointman.class.php:2263 msgid "No send name!" msgstr "" -#: Endpointman.class.php:1600 Endpointman.class.php:1833 -#: Endpointman.class.php:1963 +#: Endpointman.class.php:1902 Endpointman.class.php:2135 +#: Endpointman.class.php:2266 msgid "No send value!" msgstr "" -#: Endpointman.class.php:1666 +#: Endpointman.class.php:1968 msgid "Not a Vaild Directory.
      Try to run 'mkdir " msgstr "" -#: Endpointman.class.php:2207 +#: Endpointman.class.php:2510 msgid "Not able to connect to repository. Using local Provisioner.net Package." msgstr "" -#: Endpointman.class.php:2237 +#: Endpointman.class.php:2540 msgid "" "Not able to connect to repository. Using local brand [%_brandname_%] file " "instead." msgstr "" -#: Endpointman.class.php:2192 +#: Endpointman.class.php:2495 msgid "Not able to connect to repository. Using local master file instead." msgstr "" -#: Endpointman.class.php:2668 +#: Endpointman.class.php:2976 msgid "Not allowed in repo mode!!" msgstr "" +#: Endpointman.class.php:1487 +msgid "Not is directory: " +msgstr "" + #: endpointman.i18n.php:18 msgid "OSS Endpoint Advanced Settings" msgstr "OSS Endpoint Erweiterte Einstellungen" @@ -933,28 +1019,32 @@ msgid "" "either of these and are encouraged." msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:30 -#: views/epm_advanced/oui_manager.views.grid.php:53 +#: views/epm_advanced/oui_manager.views.grid.php:24 +#: views/epm_advanced/oui_manager.views.new.modal.php:14 msgid "OUI" msgstr "" -#: Endpointman.class.php:543 +#: views/epm_advanced/oui_manager.views.new.modal.php:18 +msgid "OUI Brand" +msgstr "" + +#: Endpointman.class.php:630 msgid "OUI Manager" msgstr "" -#: Endpointman.class.php:2880 Endpointman.class.php:2905 +#: Endpointman.class.php:3192 Endpointman.class.php:3217 msgid "Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:140 +#: Endpointman.class.php:141 msgid "Or run this command on SSH:" msgstr "" -#: Endpointman.class.php:555 +#: Endpointman.class.php:642 msgid "Package Import/Export" msgstr "" -#: Endpointman.class.php:224 +#: Endpointman.class.php:277 msgid "Package Last Modified" msgstr "" @@ -966,94 +1056,103 @@ msgstr "" msgid "Package Server" msgstr "" -#: Endpointman.class.php:1372 +#: Endpointman.class.php:1674 msgid "Package not valid!" msgstr "" -#: Endpointman.class.php:2576 Endpointman.class.php:2684 +#: Endpointman.class.php:2884 Endpointman.class.php:2992 msgid "Please Check Directory/Permissions!" msgstr "" -#: Endpointman.class.php:139 +#: Endpointman.class.php:140 msgid "Please change the location:" msgstr "" -#: Endpointman.class.php:1253 +#: Endpointman.class.php:1555 msgid "Please name the Package the same name as your brand!" msgstr "" -#: Endpointman.class.php:1506 +#: Endpointman.class.php:1808 msgid "Please reboot & rebuild all imported phones" msgstr "" -#: Endpointman.class.php:1508 +#: Endpointman.class.php:1810 msgid "Possible file upload attack!" msgstr "" -#: Endpointman.class.php:2743 +#: Endpointman.class.php:3053 msgid "Processing %_PATH_%/brand_data.json..." msgstr "" -#: Endpointman.class.php:547 +#: Endpointman.class.php:634 msgid "Product Configuration Editor" msgstr "" -#: Endpointman.class.php:787 Endpointman.class.php:878 +#: Endpointman.class.php:1038 Endpointman.class.php:1129 msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:790 Endpointman.class.php:881 +#: Endpointman.class.php:1041 Endpointman.class.php:1132 msgid "Product Select send is number not valid!" msgstr "" +#: Endpointman.class.php:907 +msgid "Product is not number!" +msgstr "" + +#: Endpointman.class.php:910 +msgid "Product send is negative!" +msgstr "" + #: views/epm_advanced_manual_upload.page.php:24 msgid "Provisioner Package" msgstr "" -#: Endpointman.class.php:235 Endpointman.class.php:252 -#: Endpointman.class.php:256 +#: Endpointman.class.php:288 Endpointman.class.php:305 +#: Endpointman.class.php:309 msgid "Ready!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:13 +#: views/epm_advanced/oui_manager.views.grid.php:6 msgid "Refresh Table" msgstr "" -#: Endpointman.class.php:231 +#: Endpointman.class.php:284 msgid "Remove Firmware" msgstr "" -#: Endpointman.class.php:589 +#: Endpointman.class.php:676 msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:2986 +#: Endpointman.class.php:3303 msgid "Removing Temporary Files.............." msgstr "" -#: Endpointman.class.php:609 +#: Endpointman.class.php:680 msgid "Removing symlink to web provisioner" msgstr "" -#: views/epm_advanced_poce.page.php:83 +#: views/epm_advanced/poce.views.textarea.file.php:35 msgid "Save" msgstr "" -#: views/epm_advanced_poce.page.php:96 +#: views/epm_advanced/poce.views.textarea.file.php:48 msgid "Save As..." msgstr "" -#: Endpointman.class.php:238 Endpointman.class.php:254 -#: Endpointman.class.php:306 +#: Endpointman.class.php:291 Endpointman.class.php:307 +#: Endpointman.class.php:359 msgid "Saving Changes..." msgstr "" -#: Endpointman.class.php:239 Endpointman.class.php:255 -#: Endpointman.class.php:307 +#: Endpointman.class.php:292 Endpointman.class.php:308 +#: Endpointman.class.php:360 msgid "Saving Changes... Ok!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:137 +#: views/epm_advanced/oui_manager.views.new.modal.php:41 +#: views/epm_advanced_manual_upload.page.php:101 msgid "Select Brand:" msgstr "" @@ -1066,23 +1165,23 @@ msgstr "" msgid "Setting Provision" msgstr "" -#: Endpointman.class.php:539 +#: Endpointman.class.php:626 msgid "Settings" msgstr "" -#: views/epm_advanced_poce.page.php:107 +#: views/epm_advanced/poce.views.textarea.file.php:59 msgid "Share" msgstr "" -#: Endpointman.class.php:250 +#: Endpointman.class.php:303 msgid "Show" msgstr "" -#: Endpointman.class.php:529 +#: Endpointman.class.php:616 msgid "Show/Hide" msgstr "" -#: Endpointman.class.php:2516 +#: Endpointman.class.php:2824 msgid "Skipping download..." msgstr "" @@ -1090,15 +1189,15 @@ msgstr "" msgid "Structure" msgstr "" -#: Endpointman.class.php:2160 +#: Endpointman.class.php:2463 msgid "Syntax error, malformed JSON" msgstr "" -#: Endpointman.class.php:2941 +#: Endpointman.class.php:3253 msgid "System Error in Sync Model Function, Load Failure!" msgstr "" -#: Endpointman.class.php:2379 +#: Endpointman.class.php:2683 msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" msgstr "" @@ -1106,11 +1205,15 @@ msgstr "" msgid "System Failure!" msgstr "" -#: Endpointman.class.php:298 Endpointman.class.php:393 +#: Endpointman.class.php:351 Endpointman.class.php:458 msgid "Tab is not valid!" msgstr "" -#: Endpointman.class.php:222 +#: Endpointman.class.php:602 +msgid "Template Editor" +msgstr "" + +#: Endpointman.class.php:275 msgid "" "The \"Install\" button installs the configuration package brand models we " "selected.
      The \"Uninstall\" button removes the package configuration " @@ -1119,13 +1222,13 @@ msgid "" "version is detected." msgstr "" -#: Endpointman.class.php:2303 +#: Endpointman.class.php:2607 msgid "" "The Remote Server Is Currently Syncing With the Master Server, Please try " "again later" msgstr "" -#: Endpointman.class.php:221 +#: Endpointman.class.php:274 msgid "" "The button \"Install Firmware\" installs the necessary files to the server " "for the terminal alone are updated via TFTP or HTTP.
      The button " @@ -1135,24 +1238,30 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3456 +#: Endpointman.class.php:3773 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3454 +#: Endpointman.class.php:3771 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3458 +#: Endpointman.class.php:3775 msgid "The uploaded file was only partially uploaded" msgstr "" -#: Endpointman.class.php:2728 +#: Endpointman.class.php:3038 msgid "Then Use Manual Upload in Advanced Settings." msgstr "" +#: views/epm_advanced/oui_manager.views.new.modal.php:26 +msgid "" +"They are the first 6 characters of the MAC device that identifies the brand " +"(manufacturer)." +msgstr "" + #: views/epm_advanced_settings.page.php:134 msgid "Time" msgstr "" @@ -1169,59 +1278,59 @@ msgstr "" msgid "TimeZone by PBX Setting" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:32 +#: views/epm_advanced/oui_manager.views.grid.php:26 msgid "Type" msgstr "" -#: Endpointman.class.php:1164 +#: Endpointman.class.php:1412 msgid "Type File not valid!" msgstr "" -#: Endpointman.class.php:2154 +#: Endpointman.class.php:2457 msgid "Underflow or the modes mismatch" msgstr "" -#: Endpointman.class.php:2157 +#: Endpointman.class.php:2460 msgid "Unexpected control character found" msgstr "" -#: Endpointman.class.php:228 +#: Endpointman.class.php:281 msgid "Uninstall" msgstr "" -#: Endpointman.class.php:2619 +#: Endpointman.class.php:2927 msgid "Uninstalla Brand..." msgstr "" -#: Endpointman.class.php:2596 +#: Endpointman.class.php:2904 msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3600 +#: Endpointman.class.php:3917 msgid "Unknown" msgstr "" -#: Endpointman.class.php:2166 +#: Endpointman.class.php:2469 msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3468 +#: Endpointman.class.php:3785 msgid "Unknown upload error" msgstr "" -#: Endpointman.class.php:229 +#: Endpointman.class.php:282 msgid "Update" msgstr "" -#: Endpointman.class.php:243 +#: Endpointman.class.php:296 msgid "Update Content..." msgstr "" -#: Endpointman.class.php:232 +#: Endpointman.class.php:285 msgid "Update Firmware" msgstr "" -#: Endpointman.class.php:237 +#: Endpointman.class.php:290 msgid "Update!" msgstr "" @@ -1229,27 +1338,27 @@ msgstr "" msgid "Updated!" msgstr "" -#: Endpointman.class.php:2792 +#: Endpointman.class.php:3102 msgid "Updating %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:2803 +#: Endpointman.class.php:3113 msgid "Updating Family Lines................." msgstr "" -#: Endpointman.class.php:1314 +#: Endpointman.class.php:1616 msgid "Updating Last Modified..." msgstr "" -#: Endpointman.class.php:2968 +#: Endpointman.class.php:3285 msgid "Updating OUI list in DB" msgstr "" -#: Endpointman.class.php:240 Endpointman.class.php:257 +#: Endpointman.class.php:293 Endpointman.class.php:310 msgid "Upload Content!" msgstr "" -#: views/epm_advanced_poce.page.php:104 +#: views/epm_advanced/poce.views.textarea.file.php:56 msgid "" "Upload this configuration file to the Provisioner.net Team. Files " "shared are confidential and help improve the quality of releases." @@ -1259,7 +1368,7 @@ msgstr "" msgid "Use GITHUB Live Repo" msgstr "" -#: views/epm_advanced_poce.page.php:39 +#: views/epm_advanced/poce.views.button.up.files.php:31 msgid "User File Configs" msgstr "" @@ -1268,7 +1377,7 @@ msgid "" "Warning: The extensions need to be added into FreePBX before you import." msgstr "" -#: Endpointman.class.php:1447 +#: Endpointman.class.php:1749 msgid "We support only CVS and TXT files, type file %_FILE_% no support!" msgstr "" @@ -1291,29 +1400,29 @@ msgstr "" msgid "Yes" msgstr "" -#: Endpointman.class.php:2727 +#: Endpointman.class.php:3037 msgid "" "You Can Also Manually Update The Repository By Downloading Files here: %" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3182 +#: Endpointman.class.php:3499 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3185 +#: Endpointman.class.php:3502 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4575 +#: Endpointman.class.php:4945 msgid "You can't remove the only line left" msgstr "" -#: Endpointman.class.php:2587 +#: Endpointman.class.php:2895 msgid "Your Firmware is already up to date" msgstr "" -#: Endpointman.class.php:1709 +#: Endpointman.class.php:2011 msgid "Your permissions are wrong on " msgstr "" @@ -1326,6 +1435,6 @@ msgstr "" msgid "is required" msgstr "" -#: Endpointman.class.php:2740 +#: Endpointman.class.php:3050 msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" msgstr "" diff --git a/i18n/endpointman.pot b/i18n/endpointman.pot index a9bc9bc9..dd3d7d34 100644 --- a/i18n/endpointman.pot +++ b/i18n/endpointman.pot @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-23 13:38-0800\n" +"POT-Creation-Date: 2016-03-03 10:44-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,36 +21,36 @@ msgstr "" msgid " - Point your phones to: " msgstr "" -#: Endpointman.class.php:2562 +#: Endpointman.class.php:2870 msgid "- Copied %_FILE_% to %_FILETO_%." msgstr "" -#: Endpointman.class.php:2775 +#: Endpointman.class.php:3085 msgid "- Error Moving %_FILENAME_%!" msgstr "" -#: Endpointman.class.php:2558 +#: Endpointman.class.php:2866 msgid "- Failed To Copy %_FILE_%!" msgstr "" -#: Endpointman.class.php:2829 +#: Endpointman.class.php:3141 msgid "-- Updating Model Lines................" msgstr "" -#: Endpointman.class.php:2840 +#: Endpointman.class.php:3152 msgid "----Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:2935 +#: Endpointman.class.php:3247 msgid "---Inserting Model %_NAMEMOD_%" msgstr "" -#: Endpointman.class.php:2931 +#: Endpointman.class.php:3243 msgid "---Updating Model %_NAMEMOD_%" msgstr "" -#: Endpointman.class.php:2270 -#: Endpointman.class.php:2296 +#: Endpointman.class.php:2574 +#: Endpointman.class.php:2600 msgid "" "Click Here!" @@ -60,8 +60,8 @@ msgstr "" msgid "ARP Executable Path" msgstr "" -#: Endpointman.class.php:2294 -#: Endpointman.class.php:2295 +#: Endpointman.class.php:2598 +#: Endpointman.class.php:2599 msgid "" "Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" msgstr "" @@ -71,24 +71,27 @@ msgstr "" msgid "Access denied!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:33 +#: views/epm_advanced/oui_manager.views.grid.php:27 msgid "Actions" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:6 -#: views/epm_advanced/oui_manager.views.grid.php:8 +#: views/epm_advanced/oui_manager.views.grid.php:5 msgid "Add Custom OUI" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:81 +#: views/epm_advanced/oui_manager.views.new.modal.php:62 msgid "Add New" msgstr "" +#: Endpointman.class.php:933 +msgid "Add New Template OK!" +msgstr "" + #: page.epm_advanced.php:19 msgid "Advanced Settings" msgstr "" -#: Endpointman.class.php:2647 +#: Endpointman.class.php:2955 msgid "All Done!" msgstr "" @@ -100,7 +103,7 @@ msgstr "" msgid "Allow Saving Over Default Configuration Files" msgstr "" -#: Endpointman.class.php:2748 +#: Endpointman.class.php:3058 msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" msgstr "" @@ -108,8 +111,8 @@ msgstr "" msgid "Asterisk Executable Path" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:31 -#: views/epm_advanced/oui_manager.views.grid.php:56 +#: views/epm_advanced/oui_manager.views.grid.php:25 +#: views/epm_advanced/oui_manager.views.new.modal.php:36 #: views/epm_advanced_iedl.page.php:90 #: views/epm_advanced_iedl.page.php:93 msgid "Brand" @@ -119,7 +122,7 @@ msgstr "" msgid "Brand Package" msgstr "" -#: views/epm_advanced_manual_upload.page.php:125 +#: views/epm_advanced_manual_upload.page.php:90 msgid "Brand's Available" msgstr "" @@ -131,25 +134,25 @@ msgstr "" msgid "CSV File Format" msgstr "" -#: Endpointman.class.php:1196 -#: Endpointman.class.php:1273 -#: Endpointman.class.php:1432 +#: Endpointman.class.php:1498 +#: Endpointman.class.php:1575 +#: Endpointman.class.php:1734 msgid "Can Not Find Uploaded Files!" msgstr "" -#: Endpointman.class.php:2720 +#: Endpointman.class.php:3030 msgid "Can't Find Downloaded File!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:80 +#: views/epm_advanced/oui_manager.views.new.modal.php:61 msgid "Cancel" msgstr "" -#: Endpointman.class.php:2175 +#: Endpointman.class.php:2478 msgid "Cant find file:" msgstr "" -#: Endpointman.class.php:226 +#: Endpointman.class.php:279 msgid "Check Online " msgstr "" @@ -157,46 +160,56 @@ msgstr "" msgid "Check for Update" msgstr "" -#: Endpointman.class.php:225 +#: Endpointman.class.php:278 msgid "Check for Update " msgstr "" -#: Endpointman.class.php:241 +#: Endpointman.class.php:294 msgid "Check for Updates..." msgstr "" -#: Endpointman.class.php:242 +#: Endpointman.class.php:295 msgid "Check for Updates... Ok!" msgstr "" -#: Endpointman.class.php:2542 +#: Endpointman.class.php:2850 msgid "Checking MD5sum of Package..." msgstr "" -#: Endpointman.class.php:2705 +#: Endpointman.class.php:3013 msgid "Checking MD5sum of Package...." msgstr "" -#: Endpointman.class.php:1394 +#: Endpointman.class.php:1696 msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:274 -#: Endpointman.class.php:292 -#: Endpointman.class.php:320 -#: Endpointman.class.php:348 -#: Endpointman.class.php:357 -#: Endpointman.class.php:387 +#: Endpointman.class.php:916 +msgid "Clone Model is not number!" +msgstr "" + +#: Endpointman.class.php:919 +msgid "Clone Model send is negative!" +msgstr "" + +#: Endpointman.class.php:265 +#: Endpointman.class.php:327 +#: Endpointman.class.php:345 +#: Endpointman.class.php:373 +#: Endpointman.class.php:401 +#: Endpointman.class.php:410 +#: Endpointman.class.php:440 +#: Endpointman.class.php:453 msgid "Command not found!" msgstr "" -#: Endpointman.class.php:146 +#: Endpointman.class.php:147 msgid "" "Configuration Directory is not a directory or does not exist! Please change " "the location here:" msgstr "" -#: Endpointman.class.php:138 +#: Endpointman.class.php:139 msgid "Configuration Directory is not writable!" msgstr "" @@ -209,27 +222,31 @@ msgstr "" msgid "Connectivity" msgstr "" -#: Endpointman.class.php:2574 +#: Endpointman.class.php:2882 msgid "Copy Error Detected! Aborting Install!" msgstr "" -#: Endpointman.class.php:2756 +#: Endpointman.class.php:3066 msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." msgstr "" -#: Endpointman.class.php:2681 +#: Endpointman.class.php:2989 msgid "Creating EPM temp directory" msgstr "" -#: Endpointman.class.php:1222 +#: Endpointman.class.php:1524 msgid "Creating EPM temp directory..." msgstr "" -#: Endpointman.class.php:1300 +#: Endpointman.class.php:1602 msgid "Creating Provisioner Directory..." msgstr "" -#: views/epm_advanced_poce.page.php:28 +#: Endpointman.class.php:598 +msgid "Current Templates" +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:19 msgid "Custom Template Files" msgstr "" @@ -237,20 +254,32 @@ msgstr "" msgid "Default Mirror FreePBX" msgstr "" -#: views/epm_advanced_poce.page.php:84 +#: views/epm_advanced/poce.views.textarea.file.php:36 msgid "Delete" msgstr "" +#: Endpointman.class.php:889 +msgid "Delete Template OK!" +msgstr "" + #: views/epm_advanced_settings.page.php:56 #: views/epm_advanced_settings.page.php:191 msgid "Determine for Me" msgstr "" -#: Endpointman.class.php:1663 +#: Endpointman.class.php:588 +msgid "Devices" +msgstr "" + +#: Endpointman.class.php:1965 msgid "Directory Not Writable!" msgstr "" -#: Endpointman.class.php:234 +#: Endpointman.class.php:1490 +msgid "Directory no exists: " +msgstr "" + +#: Endpointman.class.php:287 msgid "Disable" msgstr "" @@ -266,29 +295,29 @@ msgstr "" msgid "Disable Tooltips" msgstr "" -#: Endpointman.class.php:1224 -#: Endpointman.class.php:1238 -#: Endpointman.class.php:1297 -#: Endpointman.class.php:1302 -#: Endpointman.class.php:1317 -#: Endpointman.class.php:1393 -#: Endpointman.class.php:1488 -#: Endpointman.class.php:2526 -#: Endpointman.class.php:2538 -#: Endpointman.class.php:2579 -#: Endpointman.class.php:2611 -#: Endpointman.class.php:2665 -#: Endpointman.class.php:2693 -#: Endpointman.class.php:2700 -#: Endpointman.class.php:2707 -#: Endpointman.class.php:2711 -#: Endpointman.class.php:2782 -#: Endpointman.class.php:2860 -#: Endpointman.class.php:2896 -#: Endpointman.class.php:2925 -#: Endpointman.class.php:2967 -#: Endpointman.class.php:2978 -#: Endpointman.class.php:2988 +#: Endpointman.class.php:1526 +#: Endpointman.class.php:1540 +#: Endpointman.class.php:1599 +#: Endpointman.class.php:1604 +#: Endpointman.class.php:1619 +#: Endpointman.class.php:1695 +#: Endpointman.class.php:1790 +#: Endpointman.class.php:2834 +#: Endpointman.class.php:2846 +#: Endpointman.class.php:2887 +#: Endpointman.class.php:2919 +#: Endpointman.class.php:2973 +#: Endpointman.class.php:3001 +#: Endpointman.class.php:3008 +#: Endpointman.class.php:3015 +#: Endpointman.class.php:3019 +#: Endpointman.class.php:3092 +#: Endpointman.class.php:3172 +#: Endpointman.class.php:3208 +#: Endpointman.class.php:3237 +#: Endpointman.class.php:3284 +#: Endpointman.class.php:3295 +#: Endpointman.class.php:3305 msgid "Done!" msgstr "" @@ -296,28 +325,24 @@ msgstr "" msgid "Download updated releases from " msgstr "" -#: Endpointman.class.php:2689 +#: Endpointman.class.php:2997 msgid "Downloading Brand JSON....." msgstr "" -#: Endpointman.class.php:2698 +#: Endpointman.class.php:3006 msgid "Downloading Brand Package..." msgstr "" -#: Endpointman.class.php:2520 -#: Endpointman.class.php:2532 +#: Endpointman.class.php:2828 +#: Endpointman.class.php:2840 msgid "Downloading firmware..." msgstr "" -#: Endpointman.class.php:594 +#: Endpointman.class.php:688 msgid "Dropping all relevant tables" msgstr "" -#: views/epm_advanced_manual_upload.page.php:177 -msgid "Empty list." -msgstr "" - -#: Endpointman.class.php:233 +#: Endpointman.class.php:286 msgid "Enable" msgstr "" @@ -352,39 +377,39 @@ msgstr "" msgid "Error 500 Internal Server Error" msgstr "" -#: Endpointman.class.php:2726 +#: Endpointman.class.php:3036 msgid "" "Error Connecting to the Package Repository. Module not installed. Please Try " "again later." msgstr "" -#: Endpointman.class.php:2683 +#: Endpointman.class.php:2991 msgid "Error creating directory: %_DIR_%" msgstr "" -#: Endpointman.class.php:2723 +#: Endpointman.class.php:3033 msgid "Error download Brand package!" msgstr "" -#: Endpointman.class.php:2523 -#: Endpointman.class.php:2535 +#: Endpointman.class.php:2831 +#: Endpointman.class.php:2843 msgid "Error download frimware package!" msgstr "" -#: Endpointman.class.php:236 -#: Endpointman.class.php:253 -#: Endpointman.class.php:305 -#: Endpointman.class.php:1227 -#: Endpointman.class.php:1305 +#: Endpointman.class.php:289 +#: Endpointman.class.php:306 +#: Endpointman.class.php:358 +#: Endpointman.class.php:1529 +#: Endpointman.class.php:1607 msgid "Error!" msgstr "" -#: Endpointman.class.php:1784 -#: Endpointman.class.php:1821 +#: Endpointman.class.php:2086 +#: Endpointman.class.php:2123 msgid "Error: Command not found!" msgstr "" -#: Endpointman.class.php:2268 +#: Endpointman.class.php:2572 msgid "Error: No Local File for %_name_% !" msgstr "" @@ -396,16 +421,16 @@ msgstr "" msgid "Experimental" msgstr "" -#: views/epm_advanced_manual_upload.page.php:157 +#: views/epm_advanced_manual_upload.page.php:122 msgid "Explor a package brand's availables." msgstr "" #: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:146 +#: views/epm_advanced_manual_upload.page.php:109 msgid "Export" msgstr "" -#: views/epm_advanced_manual_upload.page.php:114 +#: views/epm_advanced_manual_upload.page.php:79 msgid "Export Brand Packages" msgstr "" @@ -421,7 +446,7 @@ msgstr "" msgid "Export data configuracion devices." msgstr "" -#: Endpointman.class.php:1384 +#: Endpointman.class.php:1686 msgid "Exporting %_NAME_%" msgstr "" @@ -430,19 +455,19 @@ msgstr "" msgid "Extension" msgstr "" -#: Endpointman.class.php:1295 +#: Endpointman.class.php:1597 msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:1233 +#: Endpointman.class.php:1535 msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" msgstr "" -#: Endpointman.class.php:2709 +#: Endpointman.class.php:3017 msgid "Extracting Tarball........" msgstr "" -#: Endpointman.class.php:1235 +#: Endpointman.class.php:1537 msgid "Extracting Tarball........ " msgstr "" @@ -450,11 +475,11 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3464 +#: Endpointman.class.php:3781 msgid "Failed to write file to disk" msgstr "" -#: Endpointman.class.php:1450 +#: Endpointman.class.php:1752 msgid "File %_FILE_% size is 0!" msgstr "" @@ -462,7 +487,7 @@ msgstr "" msgid "File (TFTP/FTP)" msgstr "" -#: Endpointman.class.php:1321 +#: Endpointman.class.php:1623 msgid "File Temp no Exists!" msgstr "" @@ -471,23 +496,23 @@ msgstr "" msgid "File not Found!" msgstr "" -#: Endpointman.class.php:946 +#: Endpointman.class.php:1197 msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3466 +#: Endpointman.class.php:3783 msgid "File upload stopped by extension" msgstr "" -#: Endpointman.class.php:2583 +#: Endpointman.class.php:2891 msgid "Firmware MD5 didn't match!" msgstr "" -#: Endpointman.class.php:2812 +#: Endpointman.class.php:3122 msgid "Firmware Requirment Detected!.........." msgstr "" -#: views/epm_advanced_poce.page.php:71 +#: views/epm_advanced/poce.views.textarea.file.php:23 msgid "Full Screen F11" msgstr "" @@ -495,7 +520,11 @@ msgstr "" msgid "GIT Branch" msgstr "" -#: Endpointman.class.php:1645 +#: Endpointman.class.php:963 +msgid "Generate list Ok!" +msgstr "" + +#: Endpointman.class.php:1947 #: views/epm_advanced_settings.page.php:23 msgid "Git not installed!" msgstr "" @@ -504,43 +533,56 @@ msgstr "" msgid "Global Final Config & Firmware Directory" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "Heads up!" msgstr "" -#: Endpointman.class.php:139 -#: Endpointman.class.php:146 -#: Endpointman.class.php:1396 +#: Endpointman.class.php:140 +#: Endpointman.class.php:147 +#: Endpointman.class.php:1698 msgid "Here" msgstr "" -#: Endpointman.class.php:251 +#: Endpointman.class.php:304 msgid "Hide" msgstr "" -#: Endpointman.class.php:1533 +#: Endpointman.class.php:1835 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:660 +#: Endpointman.class.php:763 msgid "ID Brand not is numbre" msgstr "" -#: Endpointman.class.php:1381 +#: Endpointman.class.php:1683 msgid "ID Package send not valid, brand not exist!" msgstr "" -#: Endpointman.class.php:645 +#: Endpointman.class.php:748 msgid "ID Producto not is number" msgstr "" -#: Endpointman.class.php:1842 -#: Endpointman.class.php:1976 +#: Endpointman.class.php:876 +msgid "ID is not number!" +msgstr "" + +#: Endpointman.class.php:879 +msgid "ID send is negative!" +msgstr "" + +#: Endpointman.class.php:945 +#: Endpointman.class.php:2144 +#: Endpointman.class.php:2279 msgid "ID send is not number!" msgstr "" -#: Endpointman.class.php:1861 -#: Endpointman.class.php:1999 +#: Endpointman.class.php:948 +msgid "ID send is number not valid!" +msgstr "" + +#: Endpointman.class.php:2163 +#: Endpointman.class.php:2302 msgid "IDType invalid: " msgstr "" @@ -548,24 +590,24 @@ msgstr "" msgid "IP address of phone server" msgstr "" -#: Endpointman.class.php:220 +#: Endpointman.class.php:273 msgid "" "If we can activate the model set terminals of the models.
      If this " "model is disabled will not appear in the list of models that can be " "configured for PBX." msgstr "" -#: Endpointman.class.php:248 +#: Endpointman.class.php:301 msgid "" "If you select Hide disappear all models of the product selected from the " "Install/Uninstall list." msgstr "" -#: Endpointman.class.php:249 +#: Endpointman.class.php:302 msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" -#: Endpointman.class.php:247 +#: Endpointman.class.php:300 msgid "" "If you select Hide this brand will disappear and all products and models on " "the list of Install/Uninstall." @@ -598,94 +640,98 @@ msgstr "" msgid "Import a package brand in manual mode." msgstr "" -#: Endpointman.class.php:551 +#: Endpointman.class.php:638 msgid "Import/Export My Devices List" msgstr "" -#: Endpointman.class.php:1439 +#: Endpointman.class.php:1741 msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1278 +#: Endpointman.class.php:1580 msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1201 +#: Endpointman.class.php:1503 msgid "Importing brand file %_FILE_%..." msgstr "" -#: Endpointman.class.php:2796 +#: Endpointman.class.php:3106 msgid "Inserting %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:227 +#: Endpointman.class.php:280 msgid "Install" msgstr "" -#: Endpointman.class.php:230 +#: Endpointman.class.php:283 msgid "Install Firmware" msgstr "" -#: Endpointman.class.php:525 +#: Endpointman.class.php:612 msgid "Install/Unistall" msgstr "" -#: Endpointman.class.php:2551 +#: Endpointman.class.php:2859 msgid "Installing Firmware..." msgstr "" -#: Endpointman.class.php:2731 +#: Endpointman.class.php:3041 msgid "Installing brands is disabled while in repo mode!" msgstr "" -#: Endpointman.class.php:1496 +#: Endpointman.class.php:1798 msgid "Invalid Brand Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1490 +#: Endpointman.class.php:1792 msgid "Invalid Extension Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1263 -#: Endpointman.class.php:1324 +#: Endpointman.class.php:1565 +#: Endpointman.class.php:1626 msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:2980 +#: Endpointman.class.php:3297 msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3250 +#: Endpointman.class.php:3567 msgid "Invalid MAC Address" msgstr "" -#: Endpointman.class.php:1499 +#: Endpointman.class.php:1801 msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3245 +#: Endpointman.class.php:3562 msgid "Invalid Model Selected, Can't Sync System" msgstr "" -#: Endpointman.class.php:1493 +#: Endpointman.class.php:1795 msgid "Invalid Model Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:244 -#: Endpointman.class.php:258 -#: Endpointman.class.php:308 +#: Endpointman.class.php:297 +#: Endpointman.class.php:311 +#: Endpointman.class.php:361 msgid "Invalid Option!" msgstr "" -#: Endpointman.class.php:1967 +#: Endpointman.class.php:2270 msgid "Invalid Value!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:117 +#: views/epm_advanced/oui_manager.views.new.modal.php:55 +msgid "It is the brand of OUI we specified." +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:82 msgid "Learn how to create your own brand package at " msgstr "" -#: Endpointman.class.php:2269 +#: Endpointman.class.php:2573 msgid "Learn how to manually upload packages here (it's easy!):" msgstr "" @@ -694,19 +740,27 @@ msgstr "" msgid "Line" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "List Bran's Availables empty." msgstr "" +#: Endpointman.class.php:1481 +msgid "List Done!" +msgstr "" + #: views/epm_config_manager.page.php:19 msgid "List Packages Manager" msgstr "" -#: views/epm_advanced_manual_upload.page.php:168 +#: views/epm_advanced/poce.views.bootnav.php:5 +msgid "List Product's Empty" +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:133 msgid "List of other exports" msgstr "" -#: views/epm_advanced_manual_upload.page.php:209 +#: views/epm_advanced_manual_upload.page.php:152 msgid "List packages generated in other exports." msgstr "" @@ -715,11 +769,15 @@ msgstr "" msgid "Loading data...." msgstr "" -#: assets/js/epm_global.js:86 +#: assets/js/epm_global.js:117 msgid "Loading.." msgstr "" -#: views/epm_advanced_poce.page.php:16 +#: views/epm_advanced_manual_upload.page.php:140 +msgid "Loading..." +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:7 msgid "Local File Configs" msgstr "" @@ -727,11 +785,11 @@ msgstr "" msgid "Local Paths" msgstr "" -#: Endpointman.class.php:1246 +#: Endpointman.class.php:1548 msgid "Looking file and update brand's...." msgstr "" -#: Endpointman.class.php:1244 +#: Endpointman.class.php:1546 msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." msgstr "" @@ -740,23 +798,31 @@ msgstr "" msgid "MAC Address" msgstr "" -#: Endpointman.class.php:2717 +#: Endpointman.class.php:3025 msgid "MD5 Did not match!" msgstr "" -#: Endpointman.class.php:2163 +#: Endpointman.class.php:3027 +msgid "MD5 PKG: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:3026 +msgid "MD5 XML: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:2466 msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "" -#: Endpointman.class.php:2544 +#: Endpointman.class.php:2852 msgid "Matches!" msgstr "" -#: Endpointman.class.php:2151 +#: Endpointman.class.php:2454 msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3462 +#: Endpointman.class.php:3779 msgid "Missing a temporary folder" msgstr "" @@ -765,7 +831,7 @@ msgstr "" msgid "Model" msgstr "" -#: Endpointman.class.php:2950 +#: Endpointman.class.php:3267 msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" msgstr "" @@ -773,31 +839,31 @@ msgstr "" msgid "NMAP Executable Path" msgstr "" -#: views/epm_advanced_poce.page.php:90 +#: views/epm_advanced/poce.views.textarea.file.php:42 msgid "" "NOTE: File is permanently saved and not over-written during next package " "update." msgstr "" -#: views/epm_advanced_poce.page.php:80 +#: views/epm_advanced/poce.views.textarea.file.php:32 msgid "" "NOTE: File may be over-written during next package update. We suggest also " "using the Share button below to improve the next release." msgstr "" -#: views/epm_advanced_poce.page.php:74 +#: views/epm_advanced/poce.views.textarea.file.php:26 msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." msgstr "" -#: Endpointman.class.php:1725 +#: Endpointman.class.php:2027 msgid "Name invalid: " msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:61 -msgid "New OUI" +#: Endpointman.class.php:901 +msgid "Name is null!" msgstr "" -#: Endpointman.class.php:223 +#: Endpointman.class.php:276 msgid "New Package Modified" msgstr "" @@ -812,145 +878,166 @@ msgstr "" msgid "No" msgstr "" -#: Endpointman.class.php:2983 +#: Endpointman.class.php:3300 msgid "No 'brand_data.xml' file exists!" msgstr "" -#: Endpointman.class.php:1555 +#: Endpointman.class.php:1857 msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:1669 +#: Endpointman.class.php:1971 msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3283 -#: Endpointman.class.php:3301 +#: Endpointman.class.php:3600 +#: Endpointman.class.php:3618 msgid "No Devices/Extensions Left to Add" msgstr "" -#: Endpointman.class.php:1258 +#: Endpointman.class.php:1560 msgid "No File Provided!" msgstr "" -#: Endpointman.class.php:1530 +#: Endpointman.class.php:1832 msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3287 -#: Endpointman.class.php:3305 +#: Endpointman.class.php:3604 +#: Endpointman.class.php:3622 msgid "No Lines Left to Add" msgstr "" -#: Endpointman.class.php:1552 +#: Endpointman.class.php:1854 msgid "No OUI set!" msgstr "" -#: views/epm_advanced_poce.page.php:53 -#: views/epm_advanced_poce.page.php:72 +#: views/epm_advanced/poce.views.textarea.file.php:5 +#: views/epm_advanced/poce.views.textarea.file.php:24 msgid "No Selected" msgstr "" -#: Endpointman.class.php:3460 +#: Endpointman.class.php:3777 msgid "No file was uploaded" msgstr "" -#: Endpointman.class.php:1369 +#: Endpointman.class.php:1671 msgid "No package set!" msgstr "" -#: Endpointman.class.php:884 +#: Endpointman.class.php:913 +msgid "No send Clone Model!" +msgstr "" + +#: Endpointman.class.php:1135 msgid "No send File ID!" msgstr "" -#: Endpointman.class.php:887 +#: Endpointman.class.php:1138 msgid "No send File Name!" msgstr "" -#: Endpointman.class.php:1066 +#: Endpointman.class.php:873 +#: Endpointman.class.php:942 +msgid "No send ID!" +msgstr "" + +#: Endpointman.class.php:1314 msgid "No send Name File!" msgstr "" -#: Endpointman.class.php:1069 +#: Endpointman.class.php:898 +msgid "No send Name!" +msgstr "" + +#: Endpointman.class.php:1317 msgid "No send Origianl Name File!" msgstr "" -#: Endpointman.class.php:784 -#: Endpointman.class.php:875 -#: Endpointman.class.php:1009 -#: Endpointman.class.php:1051 -#: Endpointman.class.php:1145 +#: Endpointman.class.php:1035 +#: Endpointman.class.php:1126 +#: Endpointman.class.php:1251 +#: Endpointman.class.php:1299 +#: Endpointman.class.php:1393 msgid "No send Product Select!" msgstr "" -#: Endpointman.class.php:1151 +#: Endpointman.class.php:904 +msgid "No send Product!" +msgstr "" + +#: Endpointman.class.php:1399 msgid "No send SQL Select!" msgstr "" -#: Endpointman.class.php:1063 +#: Endpointman.class.php:1311 msgid "No send Save Name!" msgstr "" -#: Endpointman.class.php:1015 -#: Endpointman.class.php:1054 +#: Endpointman.class.php:1257 +#: Endpointman.class.php:1302 msgid "No send SendID!" msgstr "" -#: Endpointman.class.php:1060 +#: Endpointman.class.php:1308 msgid "No send Text File!" msgstr "" -#: Endpointman.class.php:890 -#: Endpointman.class.php:1012 -#: Endpointman.class.php:1057 -#: Endpointman.class.php:1148 +#: Endpointman.class.php:1141 +#: Endpointman.class.php:1254 +#: Endpointman.class.php:1305 +#: Endpointman.class.php:1396 msgid "No send Type File!" msgstr "" -#: Endpointman.class.php:1836 -#: Endpointman.class.php:1970 +#: Endpointman.class.php:2138 +#: Endpointman.class.php:2273 msgid "No send id!" msgstr "" -#: Endpointman.class.php:1839 -#: Endpointman.class.php:1973 +#: Endpointman.class.php:2141 +#: Endpointman.class.php:2276 msgid "No send idtype!" msgstr "" -#: Endpointman.class.php:1597 -#: Endpointman.class.php:1830 -#: Endpointman.class.php:1960 +#: Endpointman.class.php:1899 +#: Endpointman.class.php:2132 +#: Endpointman.class.php:2263 msgid "No send name!" msgstr "" -#: Endpointman.class.php:1600 -#: Endpointman.class.php:1833 -#: Endpointman.class.php:1963 +#: Endpointman.class.php:1902 +#: Endpointman.class.php:2135 +#: Endpointman.class.php:2266 msgid "No send value!" msgstr "" -#: Endpointman.class.php:1666 +#: Endpointman.class.php:1968 msgid "Not a Vaild Directory.
      Try to run 'mkdir " msgstr "" -#: Endpointman.class.php:2207 +#: Endpointman.class.php:2510 msgid "Not able to connect to repository. Using local Provisioner.net Package." msgstr "" -#: Endpointman.class.php:2237 +#: Endpointman.class.php:2540 msgid "" "Not able to connect to repository. Using local brand [%_brandname_%] file " "instead." msgstr "" -#: Endpointman.class.php:2192 +#: Endpointman.class.php:2495 msgid "Not able to connect to repository. Using local master file instead." msgstr "" -#: Endpointman.class.php:2668 +#: Endpointman.class.php:2976 msgid "Not allowed in repo mode!!" msgstr "" +#: Endpointman.class.php:1487 +msgid "Not is directory: " +msgstr "" + #: endpointman.i18n.php:18 msgid "OSS Endpoint Advanced Settings" msgstr "" @@ -982,29 +1069,33 @@ msgid "" "either of these and are encouraged." msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:30 -#: views/epm_advanced/oui_manager.views.grid.php:53 +#: views/epm_advanced/oui_manager.views.grid.php:24 +#: views/epm_advanced/oui_manager.views.new.modal.php:14 msgid "OUI" msgstr "" -#: Endpointman.class.php:543 +#: views/epm_advanced/oui_manager.views.new.modal.php:18 +msgid "OUI Brand" +msgstr "" + +#: Endpointman.class.php:630 msgid "OUI Manager" msgstr "" -#: Endpointman.class.php:2880 -#: Endpointman.class.php:2905 +#: Endpointman.class.php:3192 +#: Endpointman.class.php:3217 msgid "Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:140 +#: Endpointman.class.php:141 msgid "Or run this command on SSH:" msgstr "" -#: Endpointman.class.php:555 +#: Endpointman.class.php:642 msgid "Package Import/Export" msgstr "" -#: Endpointman.class.php:224 +#: Endpointman.class.php:277 msgid "Package Last Modified" msgstr "" @@ -1016,100 +1107,109 @@ msgstr "" msgid "Package Server" msgstr "" -#: Endpointman.class.php:1372 +#: Endpointman.class.php:1674 msgid "Package not valid!" msgstr "" -#: Endpointman.class.php:2576 -#: Endpointman.class.php:2684 +#: Endpointman.class.php:2884 +#: Endpointman.class.php:2992 msgid "Please Check Directory/Permissions!" msgstr "" -#: Endpointman.class.php:139 +#: Endpointman.class.php:140 msgid "Please change the location:" msgstr "" -#: Endpointman.class.php:1253 +#: Endpointman.class.php:1555 msgid "Please name the Package the same name as your brand!" msgstr "" -#: Endpointman.class.php:1506 +#: Endpointman.class.php:1808 msgid "Please reboot & rebuild all imported phones" msgstr "" -#: Endpointman.class.php:1508 +#: Endpointman.class.php:1810 msgid "Possible file upload attack!" msgstr "" -#: Endpointman.class.php:2743 +#: Endpointman.class.php:3053 msgid "Processing %_PATH_%/brand_data.json..." msgstr "" -#: Endpointman.class.php:547 +#: Endpointman.class.php:634 msgid "Product Configuration Editor" msgstr "" -#: Endpointman.class.php:787 -#: Endpointman.class.php:878 +#: Endpointman.class.php:1038 +#: Endpointman.class.php:1129 msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:790 -#: Endpointman.class.php:881 +#: Endpointman.class.php:1041 +#: Endpointman.class.php:1132 msgid "Product Select send is number not valid!" msgstr "" +#: Endpointman.class.php:907 +msgid "Product is not number!" +msgstr "" + +#: Endpointman.class.php:910 +msgid "Product send is negative!" +msgstr "" + #: views/epm_advanced_manual_upload.page.php:24 msgid "Provisioner Package" msgstr "" -#: Endpointman.class.php:235 -#: Endpointman.class.php:252 -#: Endpointman.class.php:256 +#: Endpointman.class.php:288 +#: Endpointman.class.php:305 +#: Endpointman.class.php:309 msgid "Ready!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:13 +#: views/epm_advanced/oui_manager.views.grid.php:6 msgid "Refresh Table" msgstr "" -#: Endpointman.class.php:231 +#: Endpointman.class.php:284 msgid "Remove Firmware" msgstr "" -#: Endpointman.class.php:589 +#: Endpointman.class.php:676 msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:2986 +#: Endpointman.class.php:3303 msgid "Removing Temporary Files.............." msgstr "" -#: Endpointman.class.php:609 +#: Endpointman.class.php:680 msgid "Removing symlink to web provisioner" msgstr "" -#: views/epm_advanced_poce.page.php:83 +#: views/epm_advanced/poce.views.textarea.file.php:35 msgid "Save" msgstr "" -#: views/epm_advanced_poce.page.php:96 +#: views/epm_advanced/poce.views.textarea.file.php:48 msgid "Save As..." msgstr "" -#: Endpointman.class.php:238 -#: Endpointman.class.php:254 -#: Endpointman.class.php:306 +#: Endpointman.class.php:291 +#: Endpointman.class.php:307 +#: Endpointman.class.php:359 msgid "Saving Changes..." msgstr "" -#: Endpointman.class.php:239 -#: Endpointman.class.php:255 -#: Endpointman.class.php:307 +#: Endpointman.class.php:292 +#: Endpointman.class.php:308 +#: Endpointman.class.php:360 msgid "Saving Changes... Ok!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:137 +#: views/epm_advanced/oui_manager.views.new.modal.php:41 +#: views/epm_advanced_manual_upload.page.php:101 msgid "Select Brand:" msgstr "" @@ -1122,23 +1222,23 @@ msgstr "" msgid "Setting Provision" msgstr "" -#: Endpointman.class.php:539 +#: Endpointman.class.php:626 msgid "Settings" msgstr "" -#: views/epm_advanced_poce.page.php:107 +#: views/epm_advanced/poce.views.textarea.file.php:59 msgid "Share" msgstr "" -#: Endpointman.class.php:250 +#: Endpointman.class.php:303 msgid "Show" msgstr "" -#: Endpointman.class.php:529 +#: Endpointman.class.php:616 msgid "Show/Hide" msgstr "" -#: Endpointman.class.php:2516 +#: Endpointman.class.php:2824 msgid "Skipping download..." msgstr "" @@ -1146,15 +1246,15 @@ msgstr "" msgid "Structure" msgstr "" -#: Endpointman.class.php:2160 +#: Endpointman.class.php:2463 msgid "Syntax error, malformed JSON" msgstr "" -#: Endpointman.class.php:2941 +#: Endpointman.class.php:3253 msgid "System Error in Sync Model Function, Load Failure!" msgstr "" -#: Endpointman.class.php:2379 +#: Endpointman.class.php:2683 msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" msgstr "" @@ -1162,12 +1262,16 @@ msgstr "" msgid "System Failure!" msgstr "" -#: Endpointman.class.php:298 -#: Endpointman.class.php:393 +#: Endpointman.class.php:351 +#: Endpointman.class.php:458 msgid "Tab is not valid!" msgstr "" -#: Endpointman.class.php:222 +#: Endpointman.class.php:602 +msgid "Template Editor" +msgstr "" + +#: Endpointman.class.php:275 msgid "" "The \"Install\" button installs the configuration package brand models we " "selected.
      The \"Uninstall\" button removes the package configuration " @@ -1176,13 +1280,13 @@ msgid "" "version is detected." msgstr "" -#: Endpointman.class.php:2303 +#: Endpointman.class.php:2607 msgid "" "The Remote Server Is Currently Syncing With the Master Server, Please try " "again later" msgstr "" -#: Endpointman.class.php:221 +#: Endpointman.class.php:274 msgid "" "The button \"Install Firmware\" installs the necessary files to the server " "for the terminal alone are updated via TFTP or HTTP.
      The button " @@ -1192,24 +1296,30 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3456 +#: Endpointman.class.php:3773 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3454 +#: Endpointman.class.php:3771 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3458 +#: Endpointman.class.php:3775 msgid "The uploaded file was only partially uploaded" msgstr "" -#: Endpointman.class.php:2728 +#: Endpointman.class.php:3038 msgid "Then Use Manual Upload in Advanced Settings." msgstr "" +#: views/epm_advanced/oui_manager.views.new.modal.php:26 +msgid "" +"They are the first 6 characters of the MAC device that identifies the brand " +"(manufacturer)." +msgstr "" + #: views/epm_advanced_settings.page.php:134 msgid "Time" msgstr "" @@ -1226,59 +1336,59 @@ msgstr "" msgid "TimeZone by PBX Setting" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:32 +#: views/epm_advanced/oui_manager.views.grid.php:26 msgid "Type" msgstr "" -#: Endpointman.class.php:1164 +#: Endpointman.class.php:1412 msgid "Type File not valid!" msgstr "" -#: Endpointman.class.php:2154 +#: Endpointman.class.php:2457 msgid "Underflow or the modes mismatch" msgstr "" -#: Endpointman.class.php:2157 +#: Endpointman.class.php:2460 msgid "Unexpected control character found" msgstr "" -#: Endpointman.class.php:228 +#: Endpointman.class.php:281 msgid "Uninstall" msgstr "" -#: Endpointman.class.php:2619 +#: Endpointman.class.php:2927 msgid "Uninstalla Brand..." msgstr "" -#: Endpointman.class.php:2596 +#: Endpointman.class.php:2904 msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3600 +#: Endpointman.class.php:3917 msgid "Unknown" msgstr "" -#: Endpointman.class.php:2166 +#: Endpointman.class.php:2469 msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3468 +#: Endpointman.class.php:3785 msgid "Unknown upload error" msgstr "" -#: Endpointman.class.php:229 +#: Endpointman.class.php:282 msgid "Update" msgstr "" -#: Endpointman.class.php:243 +#: Endpointman.class.php:296 msgid "Update Content..." msgstr "" -#: Endpointman.class.php:232 +#: Endpointman.class.php:285 msgid "Update Firmware" msgstr "" -#: Endpointman.class.php:237 +#: Endpointman.class.php:290 msgid "Update!" msgstr "" @@ -1286,28 +1396,28 @@ msgstr "" msgid "Updated!" msgstr "" -#: Endpointman.class.php:2792 +#: Endpointman.class.php:3102 msgid "Updating %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:2803 +#: Endpointman.class.php:3113 msgid "Updating Family Lines................." msgstr "" -#: Endpointman.class.php:1314 +#: Endpointman.class.php:1616 msgid "Updating Last Modified..." msgstr "" -#: Endpointman.class.php:2968 +#: Endpointman.class.php:3285 msgid "Updating OUI list in DB" msgstr "" -#: Endpointman.class.php:240 -#: Endpointman.class.php:257 +#: Endpointman.class.php:293 +#: Endpointman.class.php:310 msgid "Upload Content!" msgstr "" -#: views/epm_advanced_poce.page.php:104 +#: views/epm_advanced/poce.views.textarea.file.php:56 msgid "" "Upload this configuration file to the Provisioner.net Team. Files " "shared are confidential and help improve the quality of releases." @@ -1317,7 +1427,7 @@ msgstr "" msgid "Use GITHUB Live Repo" msgstr "" -#: views/epm_advanced_poce.page.php:39 +#: views/epm_advanced/poce.views.button.up.files.php:31 msgid "User File Configs" msgstr "" @@ -1326,7 +1436,7 @@ msgid "" "Warning: The extensions need to be added into FreePBX before you import." msgstr "" -#: Endpointman.class.php:1447 +#: Endpointman.class.php:1749 msgid "We support only CVS and TXT files, type file %_FILE_% no support!" msgstr "" @@ -1349,29 +1459,29 @@ msgstr "" msgid "Yes" msgstr "" -#: Endpointman.class.php:2727 +#: Endpointman.class.php:3037 msgid "" "You Can Also Manually Update The Repository By Downloading Files here: %" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3182 +#: Endpointman.class.php:3499 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3185 +#: Endpointman.class.php:3502 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4575 +#: Endpointman.class.php:4945 msgid "You can't remove the only line left" msgstr "" -#: Endpointman.class.php:2587 +#: Endpointman.class.php:2895 msgid "Your Firmware is already up to date" msgstr "" -#: Endpointman.class.php:1709 +#: Endpointman.class.php:2011 msgid "Your permissions are wrong on " msgstr "" @@ -1386,6 +1496,6 @@ msgstr "" msgid "is required" msgstr "" -#: Endpointman.class.php:2740 +#: Endpointman.class.php:3050 msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" msgstr "" diff --git a/i18n/es_ES/LC_MESSAGES/endpointman.mo b/i18n/es_ES/LC_MESSAGES/endpointman.mo index 1e97714ebd53807bd3cd17cee7a35d1b37332622..db5dde6e61d80b2b121b47c11387da6f40a99ab8 100644 GIT binary patch delta 4786 zcmYk<3slzi9mnx6H@OI?gyIc(fK(7nZk0-);w337mWgSmf=)%J^R}>bJw-RI;cbaa zQ@peUmoz1BDWkS#YUI>n^ODP4ot?v)t*ouHv)taF=l`?uKhNiR{eJ)FfBW739A4ZQ zw5}$||L3^S4aRnn^d?_-FzXv+))J$=X4B)$d{~D1y$X9`E%wJZu^(Q+J{WnESt6z( z9~;A0EKbI7tZ?;3Ufpj`Q0T%BD=`u`p>FUB7Gg7Y$Lkn|3GrrnwnWr<8K@f+U?&`h zy>JTB7F*`_`%&ku!Opk^yO`gsfdU_Ui!a@%71e^Ps1`+cHKTEsfm5*%({PL1e+<)m)n0F=|sEWyo!EZIGAQn!W2x#6{sHAiatDwy1^yXg+Ijz zypGWr&d!@L9(CLhRLh5B6qcffv<%hI6{w-E?Lq&mYwOveu{-K)L7ngsYLflS?N4H- zE;tA^1Vd35nt`D>-?WKMbSW)N`49Y5!fQSzn2|vER8C^?=*8Bb&k@%)vI)7$q|E z(lHx#qlZwld>-C{kD*#zkDOu+s4j1DUO}DzE$YT8jI(+w7uDkh*b)6Dt}w;@Fb4;EHEk9_Nl1{A#`*5| zgBZd6?F0pN?OD{AocKF!w35%8$W5ENxu1>~m>V?S17V_o8 zt*D-AM)lAY)Ux^~swX13x?Vh;F$M>q8afzbu>@H_HqB3A6a}fVc?UHYE}?qhFQ^ND zgK9yM1)}s&WQ4e&|)jxIm!?L^s`k`)gC(gvlsP{lK z29^=#QjeuO#$ypO&#VU3)kjb-qK{EM@Ez)Up*h~rCE#%CDX0gZfh=RcRa1y$M;-cb zpZ9}(;ObXVUDt`bYclo6I2?ppwneB1n2PGbD%1mScJ;le$#xReurHB?VWoL$0OP-c z0u$S|qn`W(s;f?;y0#6~_193x*{$CGG}MK%u`^CY=Bv#?de_#W8um7J#rNx& z-(YX8|5&E1E}Vfna6Ib9707(F#jak9nj3Yfo@hWFe*ksC7UyT!h5B{W`JHd)U4R9+ z7{9>#v7GVsFQKrXf^L{T#A|5|YHWw0E;JMGz(>^Y29+KM~`x z0=wbk$USX?^L8@10nN>dGa^u-nt979T_{wJ)&cH?Mlx`Y1L7=;vgEsjCWfgBu~k?*e>+pDOCLn)DZi-jqqk=KC0#Sp@yIob;H@HN%Sac z(!GkY*nql06Y4?FqPq4fF2JB7@BD?RE4} z%Vq=IOx{-ekE4HTDnVN-V=%Y(s|M`rPH!r=nWC9`!!hhkBsn$U?DJq@(Nvd7RwX zo}u8M#E^QTzYChg znjfWPq1u0*%ph7e3{~LIuEzZy@+YG0=VS}HkJOS>qHQDT5Gb)4upc=_THL;ic$^F) z2i?A3BQLiphAQH9MJvlIi3HvYb>9ZSRoh$X+smoFUrAl6OfJ z(RzQ8XuCiTlb@2GssFo?c|=>JN8o#?D;GM;@wcSa)x~UbEBU1=Y>$xBl>^=Uq7r^U050{Sfvh`(6DN%pyMW zEP0ePXj;TK?vLvp)_6W)Y-D44^5m$f+<{rSzU-`_d3lZ1866@Tx8;uQ*!Wf9j_CgZ DT_4_V delta 4904 zcmZYB4OCb49mnw>&jNxC+y48q4yeOrt=t{QcL zE!Y9;u`BMwU~IPA&!LXHiXHJ5b}|k-#TY}|#Gx+K8+8Xos5_d4+^ng_8CZk8@Rr@4 z*x9W>HV$L^WK;*XBfFSG$j3DEr4C(1b>OcU!u8EhH15WbSYzTb4Yfld>W(L3cbtYg z@k-RAs6{?zA7A0vh`PXeRAs(Ko$m+qU^sWD?HNdMO+GqmjH96o%*H9W7L%|QRSAF2 z;z1AU0)vr{8O~QbEXVdZ7w^GksQtE~Do~GMcnI}qkD+e3HJB`n29 z@CFXWG1U1{+>E-TpHLSLrYt(H6RN`*n1KT^1uKw`*D(xD_+;d(<5#Fp%_n5A?@8!- z`8Z|<-zw>9)Q-=fI<&*CzhT#ppek?*HIFZ&Dsc_*C2>c;9& z)9w{i2lk_mJBh_y-(0XeBr|tZ>VD`gG3rExsApD;s?d15J_psYMW`|J9I7KnQ5QUo z{r!yj7N5ohdZ$79DpM&CzeI;AZZ6Q!1#Tkm3UkNq5Y61;=1n~6_kpMi6rl#~R1Cp| zs5@GY-m!qH&{p)`IjUp(QTrdmc6h26^-rg9mJKSMf2!MoRMY{3Q70UWI?-$#j>}M` zJ%ZY=5d-iN&c#+t!;yUD;!>o@W{>qW>V@@>H0rOx5y56A?N#lL&jwi7Yuc01I zR;D`^icu9PMV+_|bq7_bN3jOEX;X(P?NLm^lc;(BJ!-%Ipa)~J+zvUpG_+xib)ofn z)P)*w7JiC)AEa~p-f4t6tgpcFxCa?$#-EX>Qujo?kV;S$sK6*(fMHmT1)BfQ(ooNv zQ1keo7>d!H-Ghm!?f2XDsi@MeL{(rDYEbRKD0~eyecwZMcBkIe#`Clov8Ed!j9OCjBoP|QhgJ~ zh|~?{VT|T~A&t9mDypaRQG;zA>csUJgN>*QU%?E#X4m6>=8lmhR3&<%_RmC}ZiDP8d7H)o8jEla4|p85;Ny7j0QZ6~qwaJ!sxk*rC%TLS@dolS8F}usn~mJ8 z*@)`!an%0J7>!r3Gya%I{kgV@yw7+o!dTXyz@b=!I`AT@l-H5rVg8MJLuPSxO}kw5 z;1txLTY-#MQ-?bK1ZtYMpk~=s)HDnkME%u>8RQP0WE{qNF6tSrLf!FN)F|GK<8d$Q zPJ;7!`(am{fa_7mT|t%pI`TR(LHD~axOT{)CKGjhr9*>vh)2`!E0>MBV8$OvOq}#9Gu19I)#x*oF1ms17(WgWaB`p@$7)?fN3rfiIv2 z=ZB~YoJKv03#bczhZ;A4W+<5S4-j`X8+rI#!OFJxi?Bs6oF0 zv$?+cjD}tqw^0Xrirr^7025fBjH7W0>H^15m1)KRY{g&Wx0r*KBY0clPSpB0s5_1+ zao-F5P#r2khnZw1)1Xq`|8&>kugHGlTVA6v)~+;SDM=;o*lql+G8f33c3tSgnu5$U z@5Phx4KkISCC!AzF|WD}!#lzIviKvWlLzhglU9upEj`I8Qb|+=l~{Mf_%qXqDy4x} zO(qiEU?^EelE_Y?ak8FF()0g>MlYhppM-l`ydLoq*-p0DZ7-poogUL}a*=#MJmf{9 zvip_@8c*33JsvG@yLkVJQF8&;HwOui?*Eo&*-}nc63yk`kmreS(JXj{)Y}c4@k8=^ z@)&uUXwmFBK>k1iiEsIshSQI)eDYgzl)O*o5(c?BO||BSj>I93fg>C#%Q`GJ_@s80RN4_Axu-hx}8Qb>JLgNe>PhvESn_A0Wg(g3ZT;_SD9v}tJaUd? zl5FBz#@NOoOe0NpeS%&G@vH>d4L-_f%<`?YF{DlVN!s&C2KkfS-q|`pHarv+7Zh5# zplZ2iUd7{84U1w+LIX-C7B?L9JRBC*r+1$mPj*gTPXC6a^x$^kBiW_QGpTH5MOj0S OoDt#PJ?G@V-u}Oqspp*l diff --git a/i18n/es_ES/LC_MESSAGES/endpointman.po b/i18n/es_ES/LC_MESSAGES/endpointman.po index e6783573..7ad31818 100644 --- a/i18n/es_ES/LC_MESSAGES/endpointman.po +++ b/i18n/es_ES/LC_MESSAGES/endpointman.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-23 13:38-0800\n" +"POT-Creation-Date: 2016-03-03 10:44-0800\n" "PO-Revision-Date: 2016-02-17 22:48+0100\n" "Last-Translator: Javier Pastor \n" "Language-Team: \n" @@ -29,35 +29,35 @@ msgstr "" msgid " - Point your phones to: " msgstr "" -#: Endpointman.class.php:2562 +#: Endpointman.class.php:2870 msgid "- Copied %_FILE_% to %_FILETO_%." msgstr "- Copiado %_FILE_% a %_FILETO_%." -#: Endpointman.class.php:2775 +#: Endpointman.class.php:3085 msgid "- Error Moving %_FILENAME_%!" msgstr "- Error Moviendo %_FILENAME_%!" -#: Endpointman.class.php:2558 +#: Endpointman.class.php:2866 msgid "- Failed To Copy %_FILE_%!" msgstr "- Error al copiar %_FILE_%!" -#: Endpointman.class.php:2829 +#: Endpointman.class.php:3141 msgid "-- Updating Model Lines................" msgstr "-- Actualizando Lineas de Modelos................" -#: Endpointman.class.php:2840 +#: Endpointman.class.php:3152 msgid "----Old Data Detected! Migrating......" msgstr "----Antiguos datos detectados! Migrando......" -#: Endpointman.class.php:2935 +#: Endpointman.class.php:3247 msgid "---Inserting Model %_NAMEMOD_%" msgstr "---Insertando Modelo %_NAMEMOD_%" -#: Endpointman.class.php:2931 +#: Endpointman.class.php:3243 msgid "---Updating Model %_NAMEMOD_%" msgstr "--Actualizando Modelo %_NAMEMOD_%" -#: Endpointman.class.php:2270 Endpointman.class.php:2296 +#: Endpointman.class.php:2574 Endpointman.class.php:2600 msgid "" "Click Here!" @@ -67,7 +67,7 @@ msgstr "" msgid "ARP Executable Path" msgstr "Ruta Ejecutable ARP" -#: Endpointman.class.php:2294 Endpointman.class.php:2295 +#: Endpointman.class.php:2598 Endpointman.class.php:2599 msgid "" "Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" msgstr "" @@ -76,24 +76,27 @@ msgstr "" msgid "Access denied!" msgstr "¡Acceso denegado!" -#: views/epm_advanced/oui_manager.views.grid.php:33 +#: views/epm_advanced/oui_manager.views.grid.php:27 msgid "Actions" msgstr "Accion" -#: views/epm_advanced/oui_manager.views.grid.php:6 -#: views/epm_advanced/oui_manager.views.grid.php:8 +#: views/epm_advanced/oui_manager.views.grid.php:5 msgid "Add Custom OUI" msgstr "Añadir OUI Personalizado" -#: views/epm_advanced/oui_manager.views.grid.php:81 +#: views/epm_advanced/oui_manager.views.new.modal.php:62 msgid "Add New" msgstr "Añadir Nuevo" +#: Endpointman.class.php:933 +msgid "Add New Template OK!" +msgstr "" + #: page.epm_advanced.php:19 msgid "Advanced Settings" msgstr "Configuración Avanzada" -#: Endpointman.class.php:2647 +#: Endpointman.class.php:2955 msgid "All Done!" msgstr "Todo Correcto!" @@ -105,7 +108,7 @@ msgstr "Permitir extensiones duplicadas" msgid "Allow Saving Over Default Configuration Files" msgstr "" -#: Endpointman.class.php:2748 +#: Endpointman.class.php:3058 msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" msgstr "Parece ser un archivo JSON válido Provisioner.net ..... Continuando" @@ -113,8 +116,8 @@ msgstr "Parece ser un archivo JSON válido Provisioner.net ..... Continuando" msgid "Asterisk Executable Path" msgstr "Ruta Ejecutable Asterisk" -#: views/epm_advanced/oui_manager.views.grid.php:31 -#: views/epm_advanced/oui_manager.views.grid.php:56 +#: views/epm_advanced/oui_manager.views.grid.php:25 +#: views/epm_advanced/oui_manager.views.new.modal.php:36 #: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 msgid "Brand" msgstr "Marca" @@ -123,7 +126,7 @@ msgstr "Marca" msgid "Brand Package" msgstr "Paquete de marcas" -#: views/epm_advanced_manual_upload.page.php:125 +#: views/epm_advanced_manual_upload.page.php:90 msgid "Brand's Available" msgstr "Marcas disponibles" @@ -135,24 +138,24 @@ msgstr "Marca/Modelo" msgid "CSV File Format" msgstr "Formato de archivo CSV" -#: Endpointman.class.php:1196 Endpointman.class.php:1273 -#: Endpointman.class.php:1432 +#: Endpointman.class.php:1498 Endpointman.class.php:1575 +#: Endpointman.class.php:1734 msgid "Can Not Find Uploaded Files!" msgstr "" -#: Endpointman.class.php:2720 +#: Endpointman.class.php:3030 msgid "Can't Find Downloaded File!" msgstr "No puede encontrar el archivo descargado." -#: views/epm_advanced/oui_manager.views.grid.php:80 +#: views/epm_advanced/oui_manager.views.new.modal.php:61 msgid "Cancel" msgstr "Cancelar" -#: Endpointman.class.php:2175 +#: Endpointman.class.php:2478 msgid "Cant find file:" msgstr "No se puede encontrar el archivo:" -#: Endpointman.class.php:226 +#: Endpointman.class.php:279 msgid "Check Online " msgstr "Revise en línea" @@ -160,37 +163,46 @@ msgstr "Revise en línea" msgid "Check for Update" msgstr "Buscar actualizaciones" -#: Endpointman.class.php:225 +#: Endpointman.class.php:278 msgid "Check for Update " msgstr "Comprobar se hay actualizaciones" -#: Endpointman.class.php:241 +#: Endpointman.class.php:294 msgid "Check for Updates..." msgstr "Buscar actualizaciones..." -#: Endpointman.class.php:242 +#: Endpointman.class.php:295 msgid "Check for Updates... Ok!" msgstr "Buscar actualizaciones... Listo!" -#: Endpointman.class.php:2542 +#: Endpointman.class.php:2850 msgid "Checking MD5sum of Package..." msgstr "Comprobando MD5sum en Paquete..." -#: Endpointman.class.php:2705 +#: Endpointman.class.php:3013 msgid "Checking MD5sum of Package...." msgstr "Comprobando MD5sum de paquete..." -#: Endpointman.class.php:1394 +#: Endpointman.class.php:1696 msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:274 Endpointman.class.php:292 -#: Endpointman.class.php:320 Endpointman.class.php:348 -#: Endpointman.class.php:357 Endpointman.class.php:387 +#: Endpointman.class.php:916 +msgid "Clone Model is not number!" +msgstr "" + +#: Endpointman.class.php:919 +msgid "Clone Model send is negative!" +msgstr "" + +#: Endpointman.class.php:265 Endpointman.class.php:327 +#: Endpointman.class.php:345 Endpointman.class.php:373 +#: Endpointman.class.php:401 Endpointman.class.php:410 +#: Endpointman.class.php:440 Endpointman.class.php:453 msgid "Command not found!" msgstr "Comando no valido!" -#: Endpointman.class.php:146 +#: Endpointman.class.php:147 msgid "" "Configuration Directory is not a directory or does not exist! Please change " "the location here:" @@ -198,7 +210,7 @@ msgstr "" "Directorio de configuración no es un directorio o no existe! Por favor, " "cambia la ubicación aquí:" -#: Endpointman.class.php:138 +#: Endpointman.class.php:139 msgid "Configuration Directory is not writable!" msgstr "En el directorio de configuración no se puede escribir!" @@ -210,29 +222,33 @@ msgstr "Tipo de Configuracion" msgid "Connectivity" msgstr "" -#: Endpointman.class.php:2574 +#: Endpointman.class.php:2882 msgid "Copy Error Detected! Aborting Install!" msgstr "Detectado error al copiar! Abortada la Instalacion!" -#: Endpointman.class.php:2756 +#: Endpointman.class.php:3066 msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." msgstr "" "Creando estructura de directorios para la Marca '% _NAME_%' y moviendo " "archivos..." -#: Endpointman.class.php:2681 +#: Endpointman.class.php:2989 msgid "Creating EPM temp directory" msgstr "Creando directorio temporal para EPM" -#: Endpointman.class.php:1222 +#: Endpointman.class.php:1524 msgid "Creating EPM temp directory..." msgstr "" -#: Endpointman.class.php:1300 +#: Endpointman.class.php:1602 msgid "Creating Provisioner Directory..." msgstr "" -#: views/epm_advanced_poce.page.php:28 +#: Endpointman.class.php:598 +msgid "Current Templates" +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:19 msgid "Custom Template Files" msgstr "Archivos de plantilla personalizada" @@ -240,20 +256,32 @@ msgstr "Archivos de plantilla personalizada" msgid "Default Mirror FreePBX" msgstr "Mirror por defecto de FreePBX" -#: views/epm_advanced_poce.page.php:84 +#: views/epm_advanced/poce.views.textarea.file.php:36 msgid "Delete" msgstr "Borrar" +#: Endpointman.class.php:889 +msgid "Delete Template OK!" +msgstr "" + #: views/epm_advanced_settings.page.php:56 #: views/epm_advanced_settings.page.php:191 msgid "Determine for Me" msgstr "Determinar por mí" -#: Endpointman.class.php:1663 +#: Endpointman.class.php:588 +msgid "Devices" +msgstr "" + +#: Endpointman.class.php:1965 msgid "Directory Not Writable!" msgstr "" -#: Endpointman.class.php:234 +#: Endpointman.class.php:1490 +msgid "Directory no exists: " +msgstr "" + +#: Endpointman.class.php:287 msgid "Disable" msgstr "Desactivar" @@ -269,18 +297,18 @@ msgstr "Desactivar comprobación de servidor TFTP" msgid "Disable Tooltips" msgstr "Desactivar las sugerencias" -#: Endpointman.class.php:1224 Endpointman.class.php:1238 -#: Endpointman.class.php:1297 Endpointman.class.php:1302 -#: Endpointman.class.php:1317 Endpointman.class.php:1393 -#: Endpointman.class.php:1488 Endpointman.class.php:2526 -#: Endpointman.class.php:2538 Endpointman.class.php:2579 -#: Endpointman.class.php:2611 Endpointman.class.php:2665 -#: Endpointman.class.php:2693 Endpointman.class.php:2700 -#: Endpointman.class.php:2707 Endpointman.class.php:2711 -#: Endpointman.class.php:2782 Endpointman.class.php:2860 -#: Endpointman.class.php:2896 Endpointman.class.php:2925 -#: Endpointman.class.php:2967 Endpointman.class.php:2978 -#: Endpointman.class.php:2988 +#: Endpointman.class.php:1526 Endpointman.class.php:1540 +#: Endpointman.class.php:1599 Endpointman.class.php:1604 +#: Endpointman.class.php:1619 Endpointman.class.php:1695 +#: Endpointman.class.php:1790 Endpointman.class.php:2834 +#: Endpointman.class.php:2846 Endpointman.class.php:2887 +#: Endpointman.class.php:2919 Endpointman.class.php:2973 +#: Endpointman.class.php:3001 Endpointman.class.php:3008 +#: Endpointman.class.php:3015 Endpointman.class.php:3019 +#: Endpointman.class.php:3092 Endpointman.class.php:3172 +#: Endpointman.class.php:3208 Endpointman.class.php:3237 +#: Endpointman.class.php:3284 Endpointman.class.php:3295 +#: Endpointman.class.php:3305 msgid "Done!" msgstr "Correcto!" @@ -288,27 +316,23 @@ msgstr "Correcto!" msgid "Download updated releases from " msgstr "Descarga actualizada liberado de" -#: Endpointman.class.php:2689 +#: Endpointman.class.php:2997 msgid "Downloading Brand JSON....." msgstr "Descargando JSON Marca...." -#: Endpointman.class.php:2698 +#: Endpointman.class.php:3006 msgid "Downloading Brand Package..." msgstr "Descargando paquete de Marca...." -#: Endpointman.class.php:2520 Endpointman.class.php:2532 +#: Endpointman.class.php:2828 Endpointman.class.php:2840 msgid "Downloading firmware..." msgstr "Descargando Frimware..." -#: Endpointman.class.php:594 +#: Endpointman.class.php:688 msgid "Dropping all relevant tables" msgstr "" -#: views/epm_advanced_manual_upload.page.php:177 -msgid "Empty list." -msgstr "Lista Vacia." - -#: Endpointman.class.php:233 +#: Endpointman.class.php:286 msgid "Enable" msgstr "Activar" @@ -340,7 +364,7 @@ msgstr "Error 404, No encontrado" msgid "Error 500 Internal Server Error" msgstr "Error 500 - Error Interno del Servidor" -#: Endpointman.class.php:2726 +#: Endpointman.class.php:3036 msgid "" "Error Connecting to the Package Repository. Module not installed. Please Try " "again later." @@ -348,29 +372,29 @@ msgstr "" "Error al conectar al repositorio de paquetes. Módulo no instalado. Por favor " "Inténtalo más tarde." -#: Endpointman.class.php:2683 +#: Endpointman.class.php:2991 msgid "Error creating directory: %_DIR_%" msgstr "Error al crear el directorio: %_DIR_%" -#: Endpointman.class.php:2723 +#: Endpointman.class.php:3033 msgid "Error download Brand package!" msgstr "Error de descarga paquete de marcas!" -#: Endpointman.class.php:2523 Endpointman.class.php:2535 +#: Endpointman.class.php:2831 Endpointman.class.php:2843 msgid "Error download frimware package!" msgstr "Error al descarga paquete del firmware!" -#: Endpointman.class.php:236 Endpointman.class.php:253 -#: Endpointman.class.php:305 Endpointman.class.php:1227 -#: Endpointman.class.php:1305 +#: Endpointman.class.php:289 Endpointman.class.php:306 +#: Endpointman.class.php:358 Endpointman.class.php:1529 +#: Endpointman.class.php:1607 msgid "Error!" msgstr "Error!" -#: Endpointman.class.php:1784 Endpointman.class.php:1821 +#: Endpointman.class.php:2086 Endpointman.class.php:2123 msgid "Error: Command not found!" msgstr "Error: Comando no valido!" -#: Endpointman.class.php:2268 +#: Endpointman.class.php:2572 msgid "Error: No Local File for %_name_% !" msgstr "" @@ -382,16 +406,16 @@ msgstr "Ejemplos" msgid "Experimental" msgstr "Experimental" -#: views/epm_advanced_manual_upload.page.php:157 +#: views/epm_advanced_manual_upload.page.php:122 msgid "Explor a package brand's availables." msgstr "Exportar paquete de Marcas disponibles." #: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:146 +#: views/epm_advanced_manual_upload.page.php:109 msgid "Export" msgstr "Exportar" -#: views/epm_advanced_manual_upload.page.php:114 +#: views/epm_advanced_manual_upload.page.php:79 msgid "Export Brand Packages" msgstr "Paquetes de exportación de la marcas" @@ -407,7 +431,7 @@ msgstr "Archivo CSV exportación de dispositivos" msgid "Export data configuracion devices." msgstr "Exportar datos de configuracion de dispositivo." -#: Endpointman.class.php:1384 +#: Endpointman.class.php:1686 msgid "Exporting %_NAME_%" msgstr "" @@ -415,19 +439,19 @@ msgstr "" msgid "Extension" msgstr "Extension" -#: Endpointman.class.php:1295 +#: Endpointman.class.php:1597 msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:1233 +#: Endpointman.class.php:1535 msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" msgstr "" -#: Endpointman.class.php:2709 +#: Endpointman.class.php:3017 msgid "Extracting Tarball........" msgstr "" -#: Endpointman.class.php:1235 +#: Endpointman.class.php:1537 msgid "Extracting Tarball........ " msgstr "" @@ -435,11 +459,11 @@ msgstr "" msgid "Failed to install " msgstr "Fallo de installacion" -#: Endpointman.class.php:3464 +#: Endpointman.class.php:3781 msgid "Failed to write file to disk" msgstr "" -#: Endpointman.class.php:1450 +#: Endpointman.class.php:1752 msgid "File %_FILE_% size is 0!" msgstr "" @@ -447,7 +471,7 @@ msgstr "" msgid "File (TFTP/FTP)" msgstr "Archivos (TFTP/FTP)" -#: Endpointman.class.php:1321 +#: Endpointman.class.php:1623 msgid "File Temp no Exists!" msgstr "" @@ -455,23 +479,23 @@ msgstr "" msgid "File not Found!" msgstr "¡Archivo no encontrado!" -#: Endpointman.class.php:946 +#: Endpointman.class.php:1197 msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3466 +#: Endpointman.class.php:3783 msgid "File upload stopped by extension" msgstr "" -#: Endpointman.class.php:2583 +#: Endpointman.class.php:2891 msgid "Firmware MD5 didn't match!" msgstr "MD5 de Frimware no coincide!" -#: Endpointman.class.php:2812 +#: Endpointman.class.php:3122 msgid "Firmware Requirment Detected!.........." msgstr "Requisito firmware detectado .........." -#: views/epm_advanced_poce.page.php:71 +#: views/epm_advanced/poce.views.textarea.file.php:23 msgid "Full Screen F11" msgstr "Pantalla Completa F11" @@ -479,7 +503,11 @@ msgstr "Pantalla Completa F11" msgid "GIT Branch" msgstr "GIT Rama" -#: Endpointman.class.php:1645 views/epm_advanced_settings.page.php:23 +#: Endpointman.class.php:963 +msgid "Generate list Ok!" +msgstr "" + +#: Endpointman.class.php:1947 views/epm_advanced_settings.page.php:23 msgid "Git not installed!" msgstr "" @@ -487,40 +515,53 @@ msgstr "" msgid "Global Final Config & Firmware Directory" msgstr "Directorio final de configuracion y firmware" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "Heads up!" msgstr "¡Aviso!" -#: Endpointman.class.php:139 Endpointman.class.php:146 -#: Endpointman.class.php:1396 +#: Endpointman.class.php:140 Endpointman.class.php:147 +#: Endpointman.class.php:1698 msgid "Here" msgstr "Aquí" -#: Endpointman.class.php:251 +#: Endpointman.class.php:304 msgid "Hide" msgstr "Ocultar" -#: Endpointman.class.php:1533 +#: Endpointman.class.php:1835 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:660 +#: Endpointman.class.php:763 msgid "ID Brand not is numbre" msgstr "ID Marca no es numero" -#: Endpointman.class.php:1381 +#: Endpointman.class.php:1683 msgid "ID Package send not valid, brand not exist!" msgstr "" -#: Endpointman.class.php:645 +#: Endpointman.class.php:748 msgid "ID Producto not is number" msgstr "ID Producto no es numero" -#: Endpointman.class.php:1842 Endpointman.class.php:1976 +#: Endpointman.class.php:876 +msgid "ID is not number!" +msgstr "" + +#: Endpointman.class.php:879 +msgid "ID send is negative!" +msgstr "" + +#: Endpointman.class.php:945 Endpointman.class.php:2144 +#: Endpointman.class.php:2279 msgid "ID send is not number!" msgstr "ID enviado no es numero!" -#: Endpointman.class.php:1861 Endpointman.class.php:1999 +#: Endpointman.class.php:948 +msgid "ID send is number not valid!" +msgstr "" + +#: Endpointman.class.php:2163 Endpointman.class.php:2302 msgid "IDType invalid: " msgstr "IDType no valido:" @@ -528,7 +569,7 @@ msgstr "IDType no valido:" msgid "IP address of phone server" msgstr "Dirección IP del servidor telefónico (PBX)" -#: Endpointman.class.php:220 +#: Endpointman.class.php:273 msgid "" "If we can activate the model set terminals of the models.
      If this " "model is disabled will not appear in the list of models that can be " @@ -538,7 +579,7 @@ msgstr "" "esta desactivado este modelo no aparecera en la lista de modelos que se " "pueden configurar para la PBX." -#: Endpointman.class.php:248 +#: Endpointman.class.php:301 msgid "" "If you select Hide disappear all models of the product selected from the " "Install/Uninstall list." @@ -546,13 +587,13 @@ msgstr "" "Si selecciona Ocultar desaparecieran todos los modelos del producto " "seleccionado de la lista Instalar/Desinstalar." -#: Endpointman.class.php:249 +#: Endpointman.class.php:302 msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" "Si selecciona Ocultar desaparecieran este modelo de la lista Instalar/" "Desinstalar." -#: Endpointman.class.php:247 +#: Endpointman.class.php:300 msgid "" "If you select Hide this brand will disappear and all products and models on " "the list of Install/Uninstall." @@ -586,92 +627,96 @@ msgstr "Importación de un paquete de Provisioner en el modo manual." msgid "Import a package brand in manual mode." msgstr "Importación de un paquete de la marca en el modo manual." -#: Endpointman.class.php:551 +#: Endpointman.class.php:638 msgid "Import/Export My Devices List" msgstr "Importar/exportar mi lista de dispositivos" -#: Endpointman.class.php:1439 +#: Endpointman.class.php:1741 msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1278 +#: Endpointman.class.php:1580 msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1201 +#: Endpointman.class.php:1503 msgid "Importing brand file %_FILE_%..." msgstr "" -#: Endpointman.class.php:2796 +#: Endpointman.class.php:3106 msgid "Inserting %_BRANDNAME_% brand data.........." msgstr "Insertando datos de la marca % _BRANDNAME_%.........." -#: Endpointman.class.php:227 +#: Endpointman.class.php:280 msgid "Install" msgstr "Instalar" -#: Endpointman.class.php:230 +#: Endpointman.class.php:283 msgid "Install Firmware" msgstr "Instalar Firmware" -#: Endpointman.class.php:525 +#: Endpointman.class.php:612 msgid "Install/Unistall" msgstr "Instalar/Desisntalar" -#: Endpointman.class.php:2551 +#: Endpointman.class.php:2859 msgid "Installing Firmware..." msgstr "Instalando Frimware..." -#: Endpointman.class.php:2731 +#: Endpointman.class.php:3041 msgid "Installing brands is disabled while in repo mode!" msgstr "Instalación de marcas se desactiva en el modo de Repo!" -#: Endpointman.class.php:1496 +#: Endpointman.class.php:1798 msgid "Invalid Brand Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1490 +#: Endpointman.class.php:1792 msgid "Invalid Extension Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1263 Endpointman.class.php:1324 +#: Endpointman.class.php:1565 Endpointman.class.php:1626 msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:2980 +#: Endpointman.class.php:3297 msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "Inválida estructura JSON en %_PATCH _%/brand_data.json" -#: Endpointman.class.php:3250 +#: Endpointman.class.php:3567 msgid "Invalid MAC Address" msgstr "Direccion MAC no valida" -#: Endpointman.class.php:1499 +#: Endpointman.class.php:1801 msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3245 +#: Endpointman.class.php:3562 msgid "Invalid Model Selected, Can't Sync System" msgstr "Seleccionada Modelo no válido, no puede Sistema de sincronización" -#: Endpointman.class.php:1493 +#: Endpointman.class.php:1795 msgid "Invalid Model Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:244 Endpointman.class.php:258 -#: Endpointman.class.php:308 +#: Endpointman.class.php:297 Endpointman.class.php:311 +#: Endpointman.class.php:361 msgid "Invalid Option!" msgstr "Opcion no valida!" -#: Endpointman.class.php:1967 +#: Endpointman.class.php:2270 msgid "Invalid Value!" msgstr "Valor no valido!" -#: views/epm_advanced_manual_upload.page.php:117 +#: views/epm_advanced/oui_manager.views.new.modal.php:55 +msgid "It is the brand of OUI we specified." +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:82 msgid "Learn how to create your own brand package at " msgstr "Aprender a crear su propio paquete de la marca en " -#: Endpointman.class.php:2269 +#: Endpointman.class.php:2573 msgid "Learn how to manually upload packages here (it's easy!):" msgstr "" @@ -679,19 +724,27 @@ msgstr "" msgid "Line" msgstr "Linea" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "List Bran's Availables empty." msgstr "Lista de Marcas disponibles vacia." +#: Endpointman.class.php:1481 +msgid "List Done!" +msgstr "" + #: views/epm_config_manager.page.php:19 msgid "List Packages Manager" msgstr "Administracion Lista de Paquetes" -#: views/epm_advanced_manual_upload.page.php:168 +#: views/epm_advanced/poce.views.bootnav.php:5 +msgid "List Product's Empty" +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:133 msgid "List of other exports" msgstr "Lista de otras exportaciones." -#: views/epm_advanced_manual_upload.page.php:209 +#: views/epm_advanced_manual_upload.page.php:152 msgid "List packages generated in other exports." msgstr "Lista paquetes generados en otras exportaciones." @@ -699,11 +752,15 @@ msgstr "Lista paquetes generados en otras exportaciones." msgid "Loading data...." msgstr "Cargando datos..." -#: assets/js/epm_global.js:86 +#: assets/js/epm_global.js:117 msgid "Loading.." msgstr "Cargando..." -#: views/epm_advanced_poce.page.php:16 +#: views/epm_advanced_manual_upload.page.php:140 +msgid "Loading..." +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:7 msgid "Local File Configs" msgstr "Cargar Archivo de Configuracion" @@ -711,11 +768,11 @@ msgstr "Cargar Archivo de Configuracion" msgid "Local Paths" msgstr "Rutas Locales" -#: Endpointman.class.php:1246 +#: Endpointman.class.php:1548 msgid "Looking file and update brand's...." msgstr "" -#: Endpointman.class.php:1244 +#: Endpointman.class.php:1546 msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." msgstr "" @@ -723,23 +780,31 @@ msgstr "" msgid "MAC Address" msgstr "Direccion MAC" -#: Endpointman.class.php:2717 +#: Endpointman.class.php:3025 msgid "MD5 Did not match!" msgstr "- MD5 no coincide!" -#: Endpointman.class.php:2163 +#: Endpointman.class.php:3027 +msgid "MD5 PKG: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:3026 +msgid "MD5 XML: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:2466 msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "Malformados caracteres UTF-8, posiblemente incorrectamente codificada" -#: Endpointman.class.php:2544 +#: Endpointman.class.php:2852 msgid "Matches!" msgstr "Correcto!" -#: Endpointman.class.php:2151 +#: Endpointman.class.php:2454 msgid "Maximum stack depth exceeded" msgstr "Superó capacidad de la pila máximo" -#: Endpointman.class.php:3462 +#: Endpointman.class.php:3779 msgid "Missing a temporary folder" msgstr "" @@ -747,7 +812,7 @@ msgstr "" msgid "Model" msgstr "Modelo" -#: Endpointman.class.php:2950 +#: Endpointman.class.php:3267 msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" msgstr "" "Mover/Eliminar Modelo '% _NAMEMOD_%' que no está presente en el archivo " @@ -757,7 +822,7 @@ msgstr "" msgid "NMAP Executable Path" msgstr "Ruta Ejecutable NMAP" -#: views/epm_advanced_poce.page.php:90 +#: views/epm_advanced/poce.views.textarea.file.php:42 msgid "" "NOTE: File is permanently saved and not over-written during next package " "update." @@ -765,27 +830,27 @@ msgstr "" "Nota: El archivo se guarda permanentemente y no sobrescribir durante las " "siguientes actualizaciónes de paquetes." -#: views/epm_advanced_poce.page.php:80 +#: views/epm_advanced/poce.views.textarea.file.php:32 msgid "" "NOTE: File may be over-written during next package update. We suggest also " "using the Share button below to improve the next release." msgstr "" -#: views/epm_advanced_poce.page.php:74 +#: views/epm_advanced/poce.views.textarea.file.php:26 msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." msgstr "" "Nota: Presione F11 para modo pantalla completa, ESC para salir de Pantalla " "Completa." -#: Endpointman.class.php:1725 +#: Endpointman.class.php:2027 msgid "Name invalid: " msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:61 -msgid "New OUI" -msgstr "Nuevo OUI" +#: Endpointman.class.php:901 +msgid "Name is null!" +msgstr "" -#: Endpointman.class.php:223 +#: Endpointman.class.php:276 msgid "New Package Modified" msgstr "Nuevo paquete Modificado" @@ -800,133 +865,154 @@ msgstr "Nuevo paquete Modificado" msgid "No" msgstr "No" -#: Endpointman.class.php:2983 +#: Endpointman.class.php:3300 msgid "No 'brand_data.xml' file exists!" msgstr "No existe un archivo 'brand_data.xml'!" -#: Endpointman.class.php:1555 +#: Endpointman.class.php:1857 msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:1669 +#: Endpointman.class.php:1971 msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3283 Endpointman.class.php:3301 +#: Endpointman.class.php:3600 Endpointman.class.php:3618 msgid "No Devices/Extensions Left to Add" msgstr "No hay dispositivos / Extensiones a la izquierdo para Añadir" -#: Endpointman.class.php:1258 +#: Endpointman.class.php:1560 msgid "No File Provided!" msgstr "" -#: Endpointman.class.php:1530 +#: Endpointman.class.php:1832 msgid "No ID set!" msgstr "No se ha enviado ID!" -#: Endpointman.class.php:3287 Endpointman.class.php:3305 +#: Endpointman.class.php:3604 Endpointman.class.php:3622 msgid "No Lines Left to Add" msgstr "No hay líneas de a la izquierdo para Añadir" -#: Endpointman.class.php:1552 +#: Endpointman.class.php:1854 msgid "No OUI set!" msgstr "" -#: views/epm_advanced_poce.page.php:53 views/epm_advanced_poce.page.php:72 +#: views/epm_advanced/poce.views.textarea.file.php:5 +#: views/epm_advanced/poce.views.textarea.file.php:24 msgid "No Selected" msgstr "No Seleccionado" -#: Endpointman.class.php:3460 +#: Endpointman.class.php:3777 msgid "No file was uploaded" msgstr "No se ha cargado el fichero" -#: Endpointman.class.php:1369 +#: Endpointman.class.php:1671 msgid "No package set!" msgstr "" -#: Endpointman.class.php:884 +#: Endpointman.class.php:913 +msgid "No send Clone Model!" +msgstr "" + +#: Endpointman.class.php:1135 msgid "No send File ID!" msgstr "" -#: Endpointman.class.php:887 +#: Endpointman.class.php:1138 msgid "No send File Name!" msgstr "" -#: Endpointman.class.php:1066 +#: Endpointman.class.php:873 Endpointman.class.php:942 +msgid "No send ID!" +msgstr "" + +#: Endpointman.class.php:1314 msgid "No send Name File!" msgstr "" -#: Endpointman.class.php:1069 +#: Endpointman.class.php:898 +msgid "No send Name!" +msgstr "" + +#: Endpointman.class.php:1317 msgid "No send Origianl Name File!" msgstr "" -#: Endpointman.class.php:784 Endpointman.class.php:875 -#: Endpointman.class.php:1009 Endpointman.class.php:1051 -#: Endpointman.class.php:1145 +#: Endpointman.class.php:1035 Endpointman.class.php:1126 +#: Endpointman.class.php:1251 Endpointman.class.php:1299 +#: Endpointman.class.php:1393 msgid "No send Product Select!" msgstr "" -#: Endpointman.class.php:1151 +#: Endpointman.class.php:904 +msgid "No send Product!" +msgstr "" + +#: Endpointman.class.php:1399 msgid "No send SQL Select!" msgstr "" -#: Endpointman.class.php:1063 +#: Endpointman.class.php:1311 msgid "No send Save Name!" msgstr "" -#: Endpointman.class.php:1015 Endpointman.class.php:1054 +#: Endpointman.class.php:1257 Endpointman.class.php:1302 msgid "No send SendID!" msgstr "" -#: Endpointman.class.php:1060 +#: Endpointman.class.php:1308 msgid "No send Text File!" msgstr "" -#: Endpointman.class.php:890 Endpointman.class.php:1012 -#: Endpointman.class.php:1057 Endpointman.class.php:1148 +#: Endpointman.class.php:1141 Endpointman.class.php:1254 +#: Endpointman.class.php:1305 Endpointman.class.php:1396 msgid "No send Type File!" msgstr "" -#: Endpointman.class.php:1836 Endpointman.class.php:1970 +#: Endpointman.class.php:2138 Endpointman.class.php:2273 msgid "No send id!" msgstr "No se ha enviado ID!" -#: Endpointman.class.php:1839 Endpointman.class.php:1973 +#: Endpointman.class.php:2141 Endpointman.class.php:2276 msgid "No send idtype!" msgstr "No se ha enviado IDType!" -#: Endpointman.class.php:1597 Endpointman.class.php:1830 -#: Endpointman.class.php:1960 +#: Endpointman.class.php:1899 Endpointman.class.php:2132 +#: Endpointman.class.php:2263 msgid "No send name!" msgstr "No se ha enviado NOMBRE!" -#: Endpointman.class.php:1600 Endpointman.class.php:1833 -#: Endpointman.class.php:1963 +#: Endpointman.class.php:1902 Endpointman.class.php:2135 +#: Endpointman.class.php:2266 msgid "No send value!" msgstr "No se ha enviado VALOR!" -#: Endpointman.class.php:1666 +#: Endpointman.class.php:1968 msgid "Not a Vaild Directory.
      Try to run 'mkdir " msgstr "" -#: Endpointman.class.php:2207 +#: Endpointman.class.php:2510 msgid "Not able to connect to repository. Using local Provisioner.net Package." msgstr "" -#: Endpointman.class.php:2237 +#: Endpointman.class.php:2540 msgid "" "Not able to connect to repository. Using local brand [%_brandname_%] file " "instead." msgstr "" -#: Endpointman.class.php:2192 +#: Endpointman.class.php:2495 msgid "Not able to connect to repository. Using local master file instead." msgstr "" -#: Endpointman.class.php:2668 +#: Endpointman.class.php:2976 msgid "Not allowed in repo mode!!" msgstr "No permite en modo de repo!" +#: Endpointman.class.php:1487 +msgid "Not is directory: " +msgstr "" + #: endpointman.i18n.php:18 msgid "OSS Endpoint Advanced Settings" msgstr "" @@ -958,28 +1044,32 @@ msgid "" "either of these and are encouraged." msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:30 -#: views/epm_advanced/oui_manager.views.grid.php:53 +#: views/epm_advanced/oui_manager.views.grid.php:24 +#: views/epm_advanced/oui_manager.views.new.modal.php:14 msgid "OUI" msgstr "OUI" -#: Endpointman.class.php:543 +#: views/epm_advanced/oui_manager.views.new.modal.php:18 +msgid "OUI Brand" +msgstr "" + +#: Endpointman.class.php:630 msgid "OUI Manager" msgstr "Administrador OUI" -#: Endpointman.class.php:2880 Endpointman.class.php:2905 +#: Endpointman.class.php:3192 Endpointman.class.php:3217 msgid "Old Data Detected! Migrating......" msgstr "Antiguos datos detectados! Migrando......" -#: Endpointman.class.php:140 +#: Endpointman.class.php:141 msgid "Or run this command on SSH:" msgstr "O ejecute este comando en SSH:" -#: Endpointman.class.php:555 +#: Endpointman.class.php:642 msgid "Package Import/Export" msgstr "Paquete de importación/exportación" -#: Endpointman.class.php:224 +#: Endpointman.class.php:277 msgid "Package Last Modified" msgstr "Paquete última actualización" @@ -991,94 +1081,103 @@ msgstr "Administracion de Paquetes" msgid "Package Server" msgstr "Servidor de Paquetes" -#: Endpointman.class.php:1372 +#: Endpointman.class.php:1674 msgid "Package not valid!" msgstr "" -#: Endpointman.class.php:2576 Endpointman.class.php:2684 +#: Endpointman.class.php:2884 Endpointman.class.php:2992 msgid "Please Check Directory/Permissions!" msgstr "Compruebe los permisos del directorio!" -#: Endpointman.class.php:139 +#: Endpointman.class.php:140 msgid "Please change the location:" msgstr "Por favor, cambia la ubicación:" -#: Endpointman.class.php:1253 +#: Endpointman.class.php:1555 msgid "Please name the Package the same name as your brand!" msgstr "" -#: Endpointman.class.php:1506 +#: Endpointman.class.php:1808 msgid "Please reboot & rebuild all imported phones" msgstr "" -#: Endpointman.class.php:1508 +#: Endpointman.class.php:1810 msgid "Possible file upload attack!" msgstr "" -#: Endpointman.class.php:2743 +#: Endpointman.class.php:3053 msgid "Processing %_PATH_%/brand_data.json..." msgstr "Procesando %_PATH_%/brand_data.json..." -#: Endpointman.class.php:547 +#: Endpointman.class.php:634 msgid "Product Configuration Editor" msgstr "Editor de configuración de producto" -#: Endpointman.class.php:787 Endpointman.class.php:878 +#: Endpointman.class.php:1038 Endpointman.class.php:1129 msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:790 Endpointman.class.php:881 +#: Endpointman.class.php:1041 Endpointman.class.php:1132 msgid "Product Select send is number not valid!" msgstr "" +#: Endpointman.class.php:907 +msgid "Product is not number!" +msgstr "" + +#: Endpointman.class.php:910 +msgid "Product send is negative!" +msgstr "" + #: views/epm_advanced_manual_upload.page.php:24 msgid "Provisioner Package" msgstr "Provisioner Paquete" -#: Endpointman.class.php:235 Endpointman.class.php:252 -#: Endpointman.class.php:256 +#: Endpointman.class.php:288 Endpointman.class.php:305 +#: Endpointman.class.php:309 msgid "Ready!" msgstr "Listo!" -#: views/epm_advanced/oui_manager.views.grid.php:13 +#: views/epm_advanced/oui_manager.views.grid.php:6 msgid "Refresh Table" msgstr "Actualizar Tabla" -#: Endpointman.class.php:231 +#: Endpointman.class.php:284 msgid "Remove Firmware" msgstr "Eliminar Firmware" -#: Endpointman.class.php:589 +#: Endpointman.class.php:676 msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:2986 +#: Endpointman.class.php:3303 msgid "Removing Temporary Files.............." msgstr "Eliminando Archivos Temporales.............." -#: Endpointman.class.php:609 +#: Endpointman.class.php:680 msgid "Removing symlink to web provisioner" msgstr "" -#: views/epm_advanced_poce.page.php:83 +#: views/epm_advanced/poce.views.textarea.file.php:35 msgid "Save" msgstr "Guardar" -#: views/epm_advanced_poce.page.php:96 +#: views/epm_advanced/poce.views.textarea.file.php:48 msgid "Save As..." msgstr "Gardar Como..." -#: Endpointman.class.php:238 Endpointman.class.php:254 -#: Endpointman.class.php:306 +#: Endpointman.class.php:291 Endpointman.class.php:307 +#: Endpointman.class.php:359 msgid "Saving Changes..." msgstr "Guardando cambios…" -#: Endpointman.class.php:239 Endpointman.class.php:255 -#: Endpointman.class.php:307 +#: Endpointman.class.php:292 Endpointman.class.php:308 +#: Endpointman.class.php:360 msgid "Saving Changes... Ok!" msgstr "Guardando cambios… Listo!" -#: views/epm_advanced_manual_upload.page.php:137 +#: views/epm_advanced/oui_manager.views.new.modal.php:41 +#: views/epm_advanced_manual_upload.page.php:101 msgid "Select Brand:" msgstr "Seleccionar Marca:" @@ -1093,23 +1192,23 @@ msgstr "" msgid "Setting Provision" msgstr "Ajustes Provision" -#: Endpointman.class.php:539 +#: Endpointman.class.php:626 msgid "Settings" msgstr "Configuración" -#: views/epm_advanced_poce.page.php:107 +#: views/epm_advanced/poce.views.textarea.file.php:59 msgid "Share" msgstr "Compartir" -#: Endpointman.class.php:250 +#: Endpointman.class.php:303 msgid "Show" msgstr "Mostrar" -#: Endpointman.class.php:529 +#: Endpointman.class.php:616 msgid "Show/Hide" msgstr "Mostrar/Ocultar" -#: Endpointman.class.php:2516 +#: Endpointman.class.php:2824 msgid "Skipping download..." msgstr "Omitir descarga..." @@ -1117,16 +1216,16 @@ msgstr "Omitir descarga..." msgid "Structure" msgstr "Estructura" -#: Endpointman.class.php:2160 +#: Endpointman.class.php:2463 msgid "Syntax error, malformed JSON" msgstr "Error de sintaxis, JSON malformada" -#: Endpointman.class.php:2941 +#: Endpointman.class.php:3253 msgid "System Error in Sync Model Function, Load Failure!" msgstr "" "Error del sistema en función de sincronización de modelos, Error de carga!" -#: Endpointman.class.php:2379 +#: Endpointman.class.php:2683 msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" msgstr "" @@ -1134,11 +1233,15 @@ msgstr "" msgid "System Failure!" msgstr "¡Fallo de sistema!" -#: Endpointman.class.php:298 Endpointman.class.php:393 +#: Endpointman.class.php:351 Endpointman.class.php:458 msgid "Tab is not valid!" msgstr "Tab no es valida!" -#: Endpointman.class.php:222 +#: Endpointman.class.php:602 +msgid "Template Editor" +msgstr "" + +#: Endpointman.class.php:275 msgid "" "The \"Install\" button installs the configuration package brand models we " "selected.
      The \"Uninstall\" button removes the package configuration " @@ -1152,13 +1255,13 @@ msgstr "" "El boton \"Actualizacion\" aparece si se detecta una nueva version del " "paquete que esta ya instalado para actualizar a la ultima version." -#: Endpointman.class.php:2303 +#: Endpointman.class.php:2607 msgid "" "The Remote Server Is Currently Syncing With the Master Server, Please try " "again later" msgstr "" -#: Endpointman.class.php:221 +#: Endpointman.class.php:274 msgid "" "The button \"Install Firmware\" installs the necessary files to the server " "for the terminal alone are updated via TFTP or HTTP.
      The button " @@ -1175,24 +1278,30 @@ msgstr "" "
      El boton \"Actualizar\" aparece cuando se detecta una nueva version " "de Paquete de este modelo." -#: Endpointman.class.php:3456 +#: Endpointman.class.php:3773 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3454 +#: Endpointman.class.php:3771 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3458 +#: Endpointman.class.php:3775 msgid "The uploaded file was only partially uploaded" msgstr "" -#: Endpointman.class.php:2728 +#: Endpointman.class.php:3038 msgid "Then Use Manual Upload in Advanced Settings." msgstr "Utilizar carga Manual en configuración avanzada." +#: views/epm_advanced/oui_manager.views.new.modal.php:26 +msgid "" +"They are the first 6 characters of the MAC device that identifies the brand " +"(manufacturer)." +msgstr "" + #: views/epm_advanced_settings.page.php:134 msgid "Time" msgstr "Hora" @@ -1209,59 +1318,59 @@ msgstr "Zona Horaria" msgid "TimeZone by PBX Setting" msgstr "Zona Horaria de la PBX" -#: views/epm_advanced/oui_manager.views.grid.php:32 +#: views/epm_advanced/oui_manager.views.grid.php:26 msgid "Type" msgstr "Tipo" -#: Endpointman.class.php:1164 +#: Endpointman.class.php:1412 msgid "Type File not valid!" msgstr "" -#: Endpointman.class.php:2154 +#: Endpointman.class.php:2457 msgid "Underflow or the modes mismatch" msgstr "" -#: Endpointman.class.php:2157 +#: Endpointman.class.php:2460 msgid "Unexpected control character found" msgstr "Carácter de control inesperado encontró" -#: Endpointman.class.php:228 +#: Endpointman.class.php:281 msgid "Uninstall" msgstr "Desisntalar" -#: Endpointman.class.php:2619 +#: Endpointman.class.php:2927 msgid "Uninstalla Brand..." msgstr "Desisntalando Marca..." -#: Endpointman.class.php:2596 +#: Endpointman.class.php:2904 msgid "Uninstalla frimware..." msgstr "Desisntalando Frimware..." -#: Endpointman.class.php:3600 +#: Endpointman.class.php:3917 msgid "Unknown" msgstr "Desconocido" -#: Endpointman.class.php:2166 +#: Endpointman.class.php:2469 msgid "Unknown error" msgstr "Error desconocido." -#: Endpointman.class.php:3468 +#: Endpointman.class.php:3785 msgid "Unknown upload error" msgstr "Error al subir Desconocido" -#: Endpointman.class.php:229 +#: Endpointman.class.php:282 msgid "Update" msgstr "Actualizar" -#: Endpointman.class.php:243 +#: Endpointman.class.php:296 msgid "Update Content..." msgstr "Actualizar contenido...." -#: Endpointman.class.php:232 +#: Endpointman.class.php:285 msgid "Update Firmware" msgstr "Actualizar Firmware" -#: Endpointman.class.php:237 +#: Endpointman.class.php:290 msgid "Update!" msgstr "Actualizado!" @@ -1269,27 +1378,27 @@ msgstr "Actualizado!" msgid "Updated!" msgstr "Actualizado!" -#: Endpointman.class.php:2792 +#: Endpointman.class.php:3102 msgid "Updating %_BRANDNAME_% brand data.........." msgstr "Actualizando datos de la marca % _BRANDNAME_%.........." -#: Endpointman.class.php:2803 +#: Endpointman.class.php:3113 msgid "Updating Family Lines................." msgstr "Actualizando líneas de familia ................." -#: Endpointman.class.php:1314 +#: Endpointman.class.php:1616 msgid "Updating Last Modified..." msgstr "" -#: Endpointman.class.php:2968 +#: Endpointman.class.php:3285 msgid "Updating OUI list in DB" msgstr "Actualizando la lista de OUI en la DB" -#: Endpointman.class.php:240 Endpointman.class.php:257 +#: Endpointman.class.php:293 Endpointman.class.php:310 msgid "Upload Content!" msgstr "Actualizar contenido...." -#: views/epm_advanced_poce.page.php:104 +#: views/epm_advanced/poce.views.textarea.file.php:56 msgid "" "Upload this configuration file to the Provisioner.net Team. Files " "shared are confidential and help improve the quality of releases." @@ -1299,7 +1408,7 @@ msgstr "" msgid "Use GITHUB Live Repo" msgstr "Utilice GitHub en directo Repo" -#: views/epm_advanced_poce.page.php:39 +#: views/epm_advanced/poce.views.button.up.files.php:31 msgid "User File Configs" msgstr "Usar Archivo de Configuracion" @@ -1310,7 +1419,7 @@ msgstr "" "Advertencia: Las extensiones deben ser agregados en FreePBX antes de " "importar." -#: Endpointman.class.php:1447 +#: Endpointman.class.php:1749 msgid "We support only CVS and TXT files, type file %_FILE_% no support!" msgstr "" @@ -1333,7 +1442,7 @@ msgstr "Directorios Web" msgid "Yes" msgstr "Yes" -#: Endpointman.class.php:2727 +#: Endpointman.class.php:3037 msgid "" "You Can Also Manually Update The Repository By Downloading Files here: %" "_URL_INI_% Release Repo %_URL_END_%" @@ -1341,23 +1450,23 @@ msgstr "" "También puede actualizar manualmente el repositorio mediante la descarga de " "archivos aquí: %_URL_INI_% de lanzamiento Repo %_URL_END_%" -#: Endpointman.class.php:3182 +#: Endpointman.class.php:3499 msgid "You Must Select A Model From the Drop Down" msgstr "Usted debe seleccionar un modelo de la gota de Down" -#: Endpointman.class.php:3185 +#: Endpointman.class.php:3502 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "Tu deves seleeciona una Extension/Disposito de listado de abajo" -#: Endpointman.class.php:4575 +#: Endpointman.class.php:4945 msgid "You can't remove the only line left" msgstr "No se puede quitar la única línea de la izquierda" -#: Endpointman.class.php:2587 +#: Endpointman.class.php:2895 msgid "Your Firmware is already up to date" msgstr "Tu Frimware ya esta actualizado" -#: Endpointman.class.php:1709 +#: Endpointman.class.php:2011 msgid "Your permissions are wrong on " msgstr "" @@ -1370,10 +1479,16 @@ msgstr "puede estar en blanco" msgid "is required" msgstr "es requerido" -#: Endpointman.class.php:2740 +#: Endpointman.class.php:3050 msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" msgstr "update_brand (): depuración se establece en %_DEBUG_MODE_%" +#~ msgid "Empty list." +#~ msgstr "Lista Vacia." + +#~ msgid "New OUI" +#~ msgstr "Nuevo OUI" + #~ msgid "' then 'chmod g+w " #~ msgstr "' luego 'chmod g+w " diff --git a/i18n/he_IL/LC_MESSAGES/endpointman.mo b/i18n/he_IL/LC_MESSAGES/endpointman.mo index 74c0b4f4048c4776523948691fed15e3dda37557..20d6dd77e15697e533596b8602535b69fb5e809a 100644 GIT binary patch delta 20 bcmaFQ^qy%#FPE{dfw6+2ft88L#OXHxNk<0o delta 20 bcmaFQ^qy%#FPD+7k+FiIv6ZpK#OXHxNpJ@D diff --git a/i18n/he_IL/LC_MESSAGES/endpointman.po b/i18n/he_IL/LC_MESSAGES/endpointman.po index 6e3b52c3..709eebae 100644 --- a/i18n/he_IL/LC_MESSAGES/endpointman.po +++ b/i18n/he_IL/LC_MESSAGES/endpointman.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-23 13:38-0800\n" +"POT-Creation-Date: 2016-03-03 10:44-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -32,35 +32,35 @@ msgstr "" msgid " - Point your phones to: " msgstr "" -#: Endpointman.class.php:2562 +#: Endpointman.class.php:2870 msgid "- Copied %_FILE_% to %_FILETO_%." msgstr "" -#: Endpointman.class.php:2775 +#: Endpointman.class.php:3085 msgid "- Error Moving %_FILENAME_%!" msgstr "" -#: Endpointman.class.php:2558 +#: Endpointman.class.php:2866 msgid "- Failed To Copy %_FILE_%!" msgstr "" -#: Endpointman.class.php:2829 +#: Endpointman.class.php:3141 msgid "-- Updating Model Lines................" msgstr "" -#: Endpointman.class.php:2840 +#: Endpointman.class.php:3152 msgid "----Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:2935 +#: Endpointman.class.php:3247 msgid "---Inserting Model %_NAMEMOD_%" msgstr "" -#: Endpointman.class.php:2931 +#: Endpointman.class.php:3243 msgid "---Updating Model %_NAMEMOD_%" msgstr "" -#: Endpointman.class.php:2270 Endpointman.class.php:2296 +#: Endpointman.class.php:2574 Endpointman.class.php:2600 msgid "" "Click Here!" @@ -70,7 +70,7 @@ msgstr "" msgid "ARP Executable Path" msgstr "" -#: Endpointman.class.php:2294 Endpointman.class.php:2295 +#: Endpointman.class.php:2598 Endpointman.class.php:2599 msgid "" "Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" msgstr "" @@ -79,24 +79,27 @@ msgstr "" msgid "Access denied!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:33 +#: views/epm_advanced/oui_manager.views.grid.php:27 msgid "Actions" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:6 -#: views/epm_advanced/oui_manager.views.grid.php:8 +#: views/epm_advanced/oui_manager.views.grid.php:5 msgid "Add Custom OUI" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:81 +#: views/epm_advanced/oui_manager.views.new.modal.php:62 msgid "Add New" msgstr "" +#: Endpointman.class.php:933 +msgid "Add New Template OK!" +msgstr "" + #: page.epm_advanced.php:19 msgid "Advanced Settings" msgstr "" -#: Endpointman.class.php:2647 +#: Endpointman.class.php:2955 msgid "All Done!" msgstr "" @@ -108,7 +111,7 @@ msgstr "" msgid "Allow Saving Over Default Configuration Files" msgstr "" -#: Endpointman.class.php:2748 +#: Endpointman.class.php:3058 msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" msgstr "" @@ -116,8 +119,8 @@ msgstr "" msgid "Asterisk Executable Path" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:31 -#: views/epm_advanced/oui_manager.views.grid.php:56 +#: views/epm_advanced/oui_manager.views.grid.php:25 +#: views/epm_advanced/oui_manager.views.new.modal.php:36 #: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 msgid "Brand" msgstr "" @@ -126,7 +129,7 @@ msgstr "" msgid "Brand Package" msgstr "" -#: views/epm_advanced_manual_upload.page.php:125 +#: views/epm_advanced_manual_upload.page.php:90 msgid "Brand's Available" msgstr "" @@ -138,24 +141,24 @@ msgstr "" msgid "CSV File Format" msgstr "" -#: Endpointman.class.php:1196 Endpointman.class.php:1273 -#: Endpointman.class.php:1432 +#: Endpointman.class.php:1498 Endpointman.class.php:1575 +#: Endpointman.class.php:1734 msgid "Can Not Find Uploaded Files!" msgstr "" -#: Endpointman.class.php:2720 +#: Endpointman.class.php:3030 msgid "Can't Find Downloaded File!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:80 +#: views/epm_advanced/oui_manager.views.new.modal.php:61 msgid "Cancel" msgstr "" -#: Endpointman.class.php:2175 +#: Endpointman.class.php:2478 msgid "Cant find file:" msgstr "" -#: Endpointman.class.php:226 +#: Endpointman.class.php:279 msgid "Check Online " msgstr "" @@ -163,43 +166,52 @@ msgstr "" msgid "Check for Update" msgstr "" -#: Endpointman.class.php:225 +#: Endpointman.class.php:278 msgid "Check for Update " msgstr "" -#: Endpointman.class.php:241 +#: Endpointman.class.php:294 msgid "Check for Updates..." msgstr "" -#: Endpointman.class.php:242 +#: Endpointman.class.php:295 msgid "Check for Updates... Ok!" msgstr "" -#: Endpointman.class.php:2542 +#: Endpointman.class.php:2850 msgid "Checking MD5sum of Package..." msgstr "" -#: Endpointman.class.php:2705 +#: Endpointman.class.php:3013 msgid "Checking MD5sum of Package...." msgstr "" -#: Endpointman.class.php:1394 +#: Endpointman.class.php:1696 msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:274 Endpointman.class.php:292 -#: Endpointman.class.php:320 Endpointman.class.php:348 -#: Endpointman.class.php:357 Endpointman.class.php:387 +#: Endpointman.class.php:916 +msgid "Clone Model is not number!" +msgstr "" + +#: Endpointman.class.php:919 +msgid "Clone Model send is negative!" +msgstr "" + +#: Endpointman.class.php:265 Endpointman.class.php:327 +#: Endpointman.class.php:345 Endpointman.class.php:373 +#: Endpointman.class.php:401 Endpointman.class.php:410 +#: Endpointman.class.php:440 Endpointman.class.php:453 msgid "Command not found!" msgstr "" -#: Endpointman.class.php:146 +#: Endpointman.class.php:147 msgid "" "Configuration Directory is not a directory or does not exist! Please change " "the location here:" msgstr "" -#: Endpointman.class.php:138 +#: Endpointman.class.php:139 msgid "Configuration Directory is not writable!" msgstr "" @@ -211,27 +223,31 @@ msgstr "" msgid "Connectivity" msgstr "" -#: Endpointman.class.php:2574 +#: Endpointman.class.php:2882 msgid "Copy Error Detected! Aborting Install!" msgstr "" -#: Endpointman.class.php:2756 +#: Endpointman.class.php:3066 msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." msgstr "" -#: Endpointman.class.php:2681 +#: Endpointman.class.php:2989 msgid "Creating EPM temp directory" msgstr "" -#: Endpointman.class.php:1222 +#: Endpointman.class.php:1524 msgid "Creating EPM temp directory..." msgstr "" -#: Endpointman.class.php:1300 +#: Endpointman.class.php:1602 msgid "Creating Provisioner Directory..." msgstr "" -#: views/epm_advanced_poce.page.php:28 +#: Endpointman.class.php:598 +msgid "Current Templates" +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:19 msgid "Custom Template Files" msgstr "" @@ -239,20 +255,32 @@ msgstr "" msgid "Default Mirror FreePBX" msgstr "" -#: views/epm_advanced_poce.page.php:84 +#: views/epm_advanced/poce.views.textarea.file.php:36 msgid "Delete" msgstr "" +#: Endpointman.class.php:889 +msgid "Delete Template OK!" +msgstr "" + #: views/epm_advanced_settings.page.php:56 #: views/epm_advanced_settings.page.php:191 msgid "Determine for Me" msgstr "" -#: Endpointman.class.php:1663 +#: Endpointman.class.php:588 +msgid "Devices" +msgstr "" + +#: Endpointman.class.php:1965 msgid "Directory Not Writable!" msgstr "" -#: Endpointman.class.php:234 +#: Endpointman.class.php:1490 +msgid "Directory no exists: " +msgstr "" + +#: Endpointman.class.php:287 msgid "Disable" msgstr "" @@ -268,18 +296,18 @@ msgstr "" msgid "Disable Tooltips" msgstr "" -#: Endpointman.class.php:1224 Endpointman.class.php:1238 -#: Endpointman.class.php:1297 Endpointman.class.php:1302 -#: Endpointman.class.php:1317 Endpointman.class.php:1393 -#: Endpointman.class.php:1488 Endpointman.class.php:2526 -#: Endpointman.class.php:2538 Endpointman.class.php:2579 -#: Endpointman.class.php:2611 Endpointman.class.php:2665 -#: Endpointman.class.php:2693 Endpointman.class.php:2700 -#: Endpointman.class.php:2707 Endpointman.class.php:2711 -#: Endpointman.class.php:2782 Endpointman.class.php:2860 -#: Endpointman.class.php:2896 Endpointman.class.php:2925 -#: Endpointman.class.php:2967 Endpointman.class.php:2978 -#: Endpointman.class.php:2988 +#: Endpointman.class.php:1526 Endpointman.class.php:1540 +#: Endpointman.class.php:1599 Endpointman.class.php:1604 +#: Endpointman.class.php:1619 Endpointman.class.php:1695 +#: Endpointman.class.php:1790 Endpointman.class.php:2834 +#: Endpointman.class.php:2846 Endpointman.class.php:2887 +#: Endpointman.class.php:2919 Endpointman.class.php:2973 +#: Endpointman.class.php:3001 Endpointman.class.php:3008 +#: Endpointman.class.php:3015 Endpointman.class.php:3019 +#: Endpointman.class.php:3092 Endpointman.class.php:3172 +#: Endpointman.class.php:3208 Endpointman.class.php:3237 +#: Endpointman.class.php:3284 Endpointman.class.php:3295 +#: Endpointman.class.php:3305 msgid "Done!" msgstr "" @@ -287,27 +315,23 @@ msgstr "" msgid "Download updated releases from " msgstr "" -#: Endpointman.class.php:2689 +#: Endpointman.class.php:2997 msgid "Downloading Brand JSON....." msgstr "" -#: Endpointman.class.php:2698 +#: Endpointman.class.php:3006 msgid "Downloading Brand Package..." msgstr "" -#: Endpointman.class.php:2520 Endpointman.class.php:2532 +#: Endpointman.class.php:2828 Endpointman.class.php:2840 msgid "Downloading firmware..." msgstr "" -#: Endpointman.class.php:594 +#: Endpointman.class.php:688 msgid "Dropping all relevant tables" msgstr "" -#: views/epm_advanced_manual_upload.page.php:177 -msgid "Empty list." -msgstr "" - -#: Endpointman.class.php:233 +#: Endpointman.class.php:286 msgid "Enable" msgstr "" @@ -339,35 +363,35 @@ msgstr "" msgid "Error 500 Internal Server Error" msgstr "" -#: Endpointman.class.php:2726 +#: Endpointman.class.php:3036 msgid "" "Error Connecting to the Package Repository. Module not installed. Please Try " "again later." msgstr "" -#: Endpointman.class.php:2683 +#: Endpointman.class.php:2991 msgid "Error creating directory: %_DIR_%" msgstr "" -#: Endpointman.class.php:2723 +#: Endpointman.class.php:3033 msgid "Error download Brand package!" msgstr "" -#: Endpointman.class.php:2523 Endpointman.class.php:2535 +#: Endpointman.class.php:2831 Endpointman.class.php:2843 msgid "Error download frimware package!" msgstr "" -#: Endpointman.class.php:236 Endpointman.class.php:253 -#: Endpointman.class.php:305 Endpointman.class.php:1227 -#: Endpointman.class.php:1305 +#: Endpointman.class.php:289 Endpointman.class.php:306 +#: Endpointman.class.php:358 Endpointman.class.php:1529 +#: Endpointman.class.php:1607 msgid "Error!" msgstr "" -#: Endpointman.class.php:1784 Endpointman.class.php:1821 +#: Endpointman.class.php:2086 Endpointman.class.php:2123 msgid "Error: Command not found!" msgstr "" -#: Endpointman.class.php:2268 +#: Endpointman.class.php:2572 msgid "Error: No Local File for %_name_% !" msgstr "" @@ -379,16 +403,16 @@ msgstr "" msgid "Experimental" msgstr "" -#: views/epm_advanced_manual_upload.page.php:157 +#: views/epm_advanced_manual_upload.page.php:122 msgid "Explor a package brand's availables." msgstr "" #: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:146 +#: views/epm_advanced_manual_upload.page.php:109 msgid "Export" msgstr "" -#: views/epm_advanced_manual_upload.page.php:114 +#: views/epm_advanced_manual_upload.page.php:79 msgid "Export Brand Packages" msgstr "" @@ -404,7 +428,7 @@ msgstr "" msgid "Export data configuracion devices." msgstr "" -#: Endpointman.class.php:1384 +#: Endpointman.class.php:1686 msgid "Exporting %_NAME_%" msgstr "" @@ -412,19 +436,19 @@ msgstr "" msgid "Extension" msgstr "" -#: Endpointman.class.php:1295 +#: Endpointman.class.php:1597 msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:1233 +#: Endpointman.class.php:1535 msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" msgstr "" -#: Endpointman.class.php:2709 +#: Endpointman.class.php:3017 msgid "Extracting Tarball........" msgstr "" -#: Endpointman.class.php:1235 +#: Endpointman.class.php:1537 msgid "Extracting Tarball........ " msgstr "" @@ -432,11 +456,11 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3464 +#: Endpointman.class.php:3781 msgid "Failed to write file to disk" msgstr "" -#: Endpointman.class.php:1450 +#: Endpointman.class.php:1752 msgid "File %_FILE_% size is 0!" msgstr "" @@ -444,7 +468,7 @@ msgstr "" msgid "File (TFTP/FTP)" msgstr "" -#: Endpointman.class.php:1321 +#: Endpointman.class.php:1623 msgid "File Temp no Exists!" msgstr "" @@ -452,23 +476,23 @@ msgstr "" msgid "File not Found!" msgstr "" -#: Endpointman.class.php:946 +#: Endpointman.class.php:1197 msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3466 +#: Endpointman.class.php:3783 msgid "File upload stopped by extension" msgstr "" -#: Endpointman.class.php:2583 +#: Endpointman.class.php:2891 msgid "Firmware MD5 didn't match!" msgstr "" -#: Endpointman.class.php:2812 +#: Endpointman.class.php:3122 msgid "Firmware Requirment Detected!.........." msgstr "" -#: views/epm_advanced_poce.page.php:71 +#: views/epm_advanced/poce.views.textarea.file.php:23 msgid "Full Screen F11" msgstr "" @@ -476,7 +500,11 @@ msgstr "" msgid "GIT Branch" msgstr "" -#: Endpointman.class.php:1645 views/epm_advanced_settings.page.php:23 +#: Endpointman.class.php:963 +msgid "Generate list Ok!" +msgstr "" + +#: Endpointman.class.php:1947 views/epm_advanced_settings.page.php:23 msgid "Git not installed!" msgstr "" @@ -484,40 +512,53 @@ msgstr "" msgid "Global Final Config & Firmware Directory" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "Heads up!" msgstr "" -#: Endpointman.class.php:139 Endpointman.class.php:146 -#: Endpointman.class.php:1396 +#: Endpointman.class.php:140 Endpointman.class.php:147 +#: Endpointman.class.php:1698 msgid "Here" msgstr "" -#: Endpointman.class.php:251 +#: Endpointman.class.php:304 msgid "Hide" msgstr "" -#: Endpointman.class.php:1533 +#: Endpointman.class.php:1835 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:660 +#: Endpointman.class.php:763 msgid "ID Brand not is numbre" msgstr "" -#: Endpointman.class.php:1381 +#: Endpointman.class.php:1683 msgid "ID Package send not valid, brand not exist!" msgstr "" -#: Endpointman.class.php:645 +#: Endpointman.class.php:748 msgid "ID Producto not is number" msgstr "" -#: Endpointman.class.php:1842 Endpointman.class.php:1976 +#: Endpointman.class.php:876 +msgid "ID is not number!" +msgstr "" + +#: Endpointman.class.php:879 +msgid "ID send is negative!" +msgstr "" + +#: Endpointman.class.php:945 Endpointman.class.php:2144 +#: Endpointman.class.php:2279 msgid "ID send is not number!" msgstr "" -#: Endpointman.class.php:1861 Endpointman.class.php:1999 +#: Endpointman.class.php:948 +msgid "ID send is number not valid!" +msgstr "" + +#: Endpointman.class.php:2163 Endpointman.class.php:2302 msgid "IDType invalid: " msgstr "" @@ -525,24 +566,24 @@ msgstr "" msgid "IP address of phone server" msgstr "" -#: Endpointman.class.php:220 +#: Endpointman.class.php:273 msgid "" "If we can activate the model set terminals of the models.
      If this " "model is disabled will not appear in the list of models that can be " "configured for PBX." msgstr "" -#: Endpointman.class.php:248 +#: Endpointman.class.php:301 msgid "" "If you select Hide disappear all models of the product selected from the " "Install/Uninstall list." msgstr "" -#: Endpointman.class.php:249 +#: Endpointman.class.php:302 msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" -#: Endpointman.class.php:247 +#: Endpointman.class.php:300 msgid "" "If you select Hide this brand will disappear and all products and models on " "the list of Install/Uninstall." @@ -574,92 +615,96 @@ msgstr "" msgid "Import a package brand in manual mode." msgstr "" -#: Endpointman.class.php:551 +#: Endpointman.class.php:638 msgid "Import/Export My Devices List" msgstr "" -#: Endpointman.class.php:1439 +#: Endpointman.class.php:1741 msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1278 +#: Endpointman.class.php:1580 msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1201 +#: Endpointman.class.php:1503 msgid "Importing brand file %_FILE_%..." msgstr "" -#: Endpointman.class.php:2796 +#: Endpointman.class.php:3106 msgid "Inserting %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:227 +#: Endpointman.class.php:280 msgid "Install" msgstr "" -#: Endpointman.class.php:230 +#: Endpointman.class.php:283 msgid "Install Firmware" msgstr "" -#: Endpointman.class.php:525 +#: Endpointman.class.php:612 msgid "Install/Unistall" msgstr "" -#: Endpointman.class.php:2551 +#: Endpointman.class.php:2859 msgid "Installing Firmware..." msgstr "" -#: Endpointman.class.php:2731 +#: Endpointman.class.php:3041 msgid "Installing brands is disabled while in repo mode!" msgstr "" -#: Endpointman.class.php:1496 +#: Endpointman.class.php:1798 msgid "Invalid Brand Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1490 +#: Endpointman.class.php:1792 msgid "Invalid Extension Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1263 Endpointman.class.php:1324 +#: Endpointman.class.php:1565 Endpointman.class.php:1626 msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:2980 +#: Endpointman.class.php:3297 msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3250 +#: Endpointman.class.php:3567 msgid "Invalid MAC Address" msgstr "" -#: Endpointman.class.php:1499 +#: Endpointman.class.php:1801 msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3245 +#: Endpointman.class.php:3562 msgid "Invalid Model Selected, Can't Sync System" msgstr "" -#: Endpointman.class.php:1493 +#: Endpointman.class.php:1795 msgid "Invalid Model Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:244 Endpointman.class.php:258 -#: Endpointman.class.php:308 +#: Endpointman.class.php:297 Endpointman.class.php:311 +#: Endpointman.class.php:361 msgid "Invalid Option!" msgstr "" -#: Endpointman.class.php:1967 +#: Endpointman.class.php:2270 msgid "Invalid Value!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:117 +#: views/epm_advanced/oui_manager.views.new.modal.php:55 +msgid "It is the brand of OUI we specified." +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:82 msgid "Learn how to create your own brand package at " msgstr "" -#: Endpointman.class.php:2269 +#: Endpointman.class.php:2573 msgid "Learn how to manually upload packages here (it's easy!):" msgstr "" @@ -667,19 +712,27 @@ msgstr "" msgid "Line" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "List Bran's Availables empty." msgstr "" +#: Endpointman.class.php:1481 +msgid "List Done!" +msgstr "" + #: views/epm_config_manager.page.php:19 msgid "List Packages Manager" msgstr "" -#: views/epm_advanced_manual_upload.page.php:168 +#: views/epm_advanced/poce.views.bootnav.php:5 +msgid "List Product's Empty" +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:133 msgid "List of other exports" msgstr "" -#: views/epm_advanced_manual_upload.page.php:209 +#: views/epm_advanced_manual_upload.page.php:152 msgid "List packages generated in other exports." msgstr "" @@ -687,11 +740,15 @@ msgstr "" msgid "Loading data...." msgstr "" -#: assets/js/epm_global.js:86 +#: assets/js/epm_global.js:117 msgid "Loading.." msgstr "" -#: views/epm_advanced_poce.page.php:16 +#: views/epm_advanced_manual_upload.page.php:140 +msgid "Loading..." +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:7 msgid "Local File Configs" msgstr "" @@ -699,11 +756,11 @@ msgstr "" msgid "Local Paths" msgstr "" -#: Endpointman.class.php:1246 +#: Endpointman.class.php:1548 msgid "Looking file and update brand's...." msgstr "" -#: Endpointman.class.php:1244 +#: Endpointman.class.php:1546 msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." msgstr "" @@ -711,23 +768,31 @@ msgstr "" msgid "MAC Address" msgstr "" -#: Endpointman.class.php:2717 +#: Endpointman.class.php:3025 msgid "MD5 Did not match!" msgstr "" -#: Endpointman.class.php:2163 +#: Endpointman.class.php:3027 +msgid "MD5 PKG: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:3026 +msgid "MD5 XML: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:2466 msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "" -#: Endpointman.class.php:2544 +#: Endpointman.class.php:2852 msgid "Matches!" msgstr "" -#: Endpointman.class.php:2151 +#: Endpointman.class.php:2454 msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3462 +#: Endpointman.class.php:3779 msgid "Missing a temporary folder" msgstr "" @@ -735,7 +800,7 @@ msgstr "" msgid "Model" msgstr "" -#: Endpointman.class.php:2950 +#: Endpointman.class.php:3267 msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" msgstr "" @@ -743,31 +808,31 @@ msgstr "" msgid "NMAP Executable Path" msgstr "" -#: views/epm_advanced_poce.page.php:90 +#: views/epm_advanced/poce.views.textarea.file.php:42 msgid "" "NOTE: File is permanently saved and not over-written during next package " "update." msgstr "" -#: views/epm_advanced_poce.page.php:80 +#: views/epm_advanced/poce.views.textarea.file.php:32 msgid "" "NOTE: File may be over-written during next package update. We suggest also " "using the Share button below to improve the next release." msgstr "" -#: views/epm_advanced_poce.page.php:74 +#: views/epm_advanced/poce.views.textarea.file.php:26 msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." msgstr "" -#: Endpointman.class.php:1725 +#: Endpointman.class.php:2027 msgid "Name invalid: " msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:61 -msgid "New OUI" +#: Endpointman.class.php:901 +msgid "Name is null!" msgstr "" -#: Endpointman.class.php:223 +#: Endpointman.class.php:276 msgid "New Package Modified" msgstr "" @@ -782,133 +847,154 @@ msgstr "" msgid "No" msgstr "" -#: Endpointman.class.php:2983 +#: Endpointman.class.php:3300 msgid "No 'brand_data.xml' file exists!" msgstr "" -#: Endpointman.class.php:1555 +#: Endpointman.class.php:1857 msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:1669 +#: Endpointman.class.php:1971 msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3283 Endpointman.class.php:3301 +#: Endpointman.class.php:3600 Endpointman.class.php:3618 msgid "No Devices/Extensions Left to Add" msgstr "" -#: Endpointman.class.php:1258 +#: Endpointman.class.php:1560 msgid "No File Provided!" msgstr "" -#: Endpointman.class.php:1530 +#: Endpointman.class.php:1832 msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3287 Endpointman.class.php:3305 +#: Endpointman.class.php:3604 Endpointman.class.php:3622 msgid "No Lines Left to Add" msgstr "" -#: Endpointman.class.php:1552 +#: Endpointman.class.php:1854 msgid "No OUI set!" msgstr "" -#: views/epm_advanced_poce.page.php:53 views/epm_advanced_poce.page.php:72 +#: views/epm_advanced/poce.views.textarea.file.php:5 +#: views/epm_advanced/poce.views.textarea.file.php:24 msgid "No Selected" msgstr "" -#: Endpointman.class.php:3460 +#: Endpointman.class.php:3777 msgid "No file was uploaded" msgstr "" -#: Endpointman.class.php:1369 +#: Endpointman.class.php:1671 msgid "No package set!" msgstr "" -#: Endpointman.class.php:884 +#: Endpointman.class.php:913 +msgid "No send Clone Model!" +msgstr "" + +#: Endpointman.class.php:1135 msgid "No send File ID!" msgstr "" -#: Endpointman.class.php:887 +#: Endpointman.class.php:1138 msgid "No send File Name!" msgstr "" -#: Endpointman.class.php:1066 +#: Endpointman.class.php:873 Endpointman.class.php:942 +msgid "No send ID!" +msgstr "" + +#: Endpointman.class.php:1314 msgid "No send Name File!" msgstr "" -#: Endpointman.class.php:1069 +#: Endpointman.class.php:898 +msgid "No send Name!" +msgstr "" + +#: Endpointman.class.php:1317 msgid "No send Origianl Name File!" msgstr "" -#: Endpointman.class.php:784 Endpointman.class.php:875 -#: Endpointman.class.php:1009 Endpointman.class.php:1051 -#: Endpointman.class.php:1145 +#: Endpointman.class.php:1035 Endpointman.class.php:1126 +#: Endpointman.class.php:1251 Endpointman.class.php:1299 +#: Endpointman.class.php:1393 msgid "No send Product Select!" msgstr "" -#: Endpointman.class.php:1151 +#: Endpointman.class.php:904 +msgid "No send Product!" +msgstr "" + +#: Endpointman.class.php:1399 msgid "No send SQL Select!" msgstr "" -#: Endpointman.class.php:1063 +#: Endpointman.class.php:1311 msgid "No send Save Name!" msgstr "" -#: Endpointman.class.php:1015 Endpointman.class.php:1054 +#: Endpointman.class.php:1257 Endpointman.class.php:1302 msgid "No send SendID!" msgstr "" -#: Endpointman.class.php:1060 +#: Endpointman.class.php:1308 msgid "No send Text File!" msgstr "" -#: Endpointman.class.php:890 Endpointman.class.php:1012 -#: Endpointman.class.php:1057 Endpointman.class.php:1148 +#: Endpointman.class.php:1141 Endpointman.class.php:1254 +#: Endpointman.class.php:1305 Endpointman.class.php:1396 msgid "No send Type File!" msgstr "" -#: Endpointman.class.php:1836 Endpointman.class.php:1970 +#: Endpointman.class.php:2138 Endpointman.class.php:2273 msgid "No send id!" msgstr "" -#: Endpointman.class.php:1839 Endpointman.class.php:1973 +#: Endpointman.class.php:2141 Endpointman.class.php:2276 msgid "No send idtype!" msgstr "" -#: Endpointman.class.php:1597 Endpointman.class.php:1830 -#: Endpointman.class.php:1960 +#: Endpointman.class.php:1899 Endpointman.class.php:2132 +#: Endpointman.class.php:2263 msgid "No send name!" msgstr "" -#: Endpointman.class.php:1600 Endpointman.class.php:1833 -#: Endpointman.class.php:1963 +#: Endpointman.class.php:1902 Endpointman.class.php:2135 +#: Endpointman.class.php:2266 msgid "No send value!" msgstr "" -#: Endpointman.class.php:1666 +#: Endpointman.class.php:1968 msgid "Not a Vaild Directory.
      Try to run 'mkdir " msgstr "" -#: Endpointman.class.php:2207 +#: Endpointman.class.php:2510 msgid "Not able to connect to repository. Using local Provisioner.net Package." msgstr "" -#: Endpointman.class.php:2237 +#: Endpointman.class.php:2540 msgid "" "Not able to connect to repository. Using local brand [%_brandname_%] file " "instead." msgstr "" -#: Endpointman.class.php:2192 +#: Endpointman.class.php:2495 msgid "Not able to connect to repository. Using local master file instead." msgstr "" -#: Endpointman.class.php:2668 +#: Endpointman.class.php:2976 msgid "Not allowed in repo mode!!" msgstr "" +#: Endpointman.class.php:1487 +msgid "Not is directory: " +msgstr "" + #: endpointman.i18n.php:18 msgid "OSS Endpoint Advanced Settings" msgstr "" @@ -940,28 +1026,32 @@ msgid "" "either of these and are encouraged." msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:30 -#: views/epm_advanced/oui_manager.views.grid.php:53 +#: views/epm_advanced/oui_manager.views.grid.php:24 +#: views/epm_advanced/oui_manager.views.new.modal.php:14 msgid "OUI" msgstr "" -#: Endpointman.class.php:543 +#: views/epm_advanced/oui_manager.views.new.modal.php:18 +msgid "OUI Brand" +msgstr "" + +#: Endpointman.class.php:630 msgid "OUI Manager" msgstr "" -#: Endpointman.class.php:2880 Endpointman.class.php:2905 +#: Endpointman.class.php:3192 Endpointman.class.php:3217 msgid "Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:140 +#: Endpointman.class.php:141 msgid "Or run this command on SSH:" msgstr "" -#: Endpointman.class.php:555 +#: Endpointman.class.php:642 msgid "Package Import/Export" msgstr "" -#: Endpointman.class.php:224 +#: Endpointman.class.php:277 msgid "Package Last Modified" msgstr "" @@ -973,94 +1063,103 @@ msgstr "" msgid "Package Server" msgstr "" -#: Endpointman.class.php:1372 +#: Endpointman.class.php:1674 msgid "Package not valid!" msgstr "" -#: Endpointman.class.php:2576 Endpointman.class.php:2684 +#: Endpointman.class.php:2884 Endpointman.class.php:2992 msgid "Please Check Directory/Permissions!" msgstr "" -#: Endpointman.class.php:139 +#: Endpointman.class.php:140 msgid "Please change the location:" msgstr "" -#: Endpointman.class.php:1253 +#: Endpointman.class.php:1555 msgid "Please name the Package the same name as your brand!" msgstr "" -#: Endpointman.class.php:1506 +#: Endpointman.class.php:1808 msgid "Please reboot & rebuild all imported phones" msgstr "" -#: Endpointman.class.php:1508 +#: Endpointman.class.php:1810 msgid "Possible file upload attack!" msgstr "" -#: Endpointman.class.php:2743 +#: Endpointman.class.php:3053 msgid "Processing %_PATH_%/brand_data.json..." msgstr "" -#: Endpointman.class.php:547 +#: Endpointman.class.php:634 msgid "Product Configuration Editor" msgstr "" -#: Endpointman.class.php:787 Endpointman.class.php:878 +#: Endpointman.class.php:1038 Endpointman.class.php:1129 msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:790 Endpointman.class.php:881 +#: Endpointman.class.php:1041 Endpointman.class.php:1132 msgid "Product Select send is number not valid!" msgstr "" +#: Endpointman.class.php:907 +msgid "Product is not number!" +msgstr "" + +#: Endpointman.class.php:910 +msgid "Product send is negative!" +msgstr "" + #: views/epm_advanced_manual_upload.page.php:24 msgid "Provisioner Package" msgstr "" -#: Endpointman.class.php:235 Endpointman.class.php:252 -#: Endpointman.class.php:256 +#: Endpointman.class.php:288 Endpointman.class.php:305 +#: Endpointman.class.php:309 msgid "Ready!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:13 +#: views/epm_advanced/oui_manager.views.grid.php:6 msgid "Refresh Table" msgstr "" -#: Endpointman.class.php:231 +#: Endpointman.class.php:284 msgid "Remove Firmware" msgstr "" -#: Endpointman.class.php:589 +#: Endpointman.class.php:676 msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:2986 +#: Endpointman.class.php:3303 msgid "Removing Temporary Files.............." msgstr "" -#: Endpointman.class.php:609 +#: Endpointman.class.php:680 msgid "Removing symlink to web provisioner" msgstr "" -#: views/epm_advanced_poce.page.php:83 +#: views/epm_advanced/poce.views.textarea.file.php:35 msgid "Save" msgstr "" -#: views/epm_advanced_poce.page.php:96 +#: views/epm_advanced/poce.views.textarea.file.php:48 msgid "Save As..." msgstr "" -#: Endpointman.class.php:238 Endpointman.class.php:254 -#: Endpointman.class.php:306 +#: Endpointman.class.php:291 Endpointman.class.php:307 +#: Endpointman.class.php:359 msgid "Saving Changes..." msgstr "" -#: Endpointman.class.php:239 Endpointman.class.php:255 -#: Endpointman.class.php:307 +#: Endpointman.class.php:292 Endpointman.class.php:308 +#: Endpointman.class.php:360 msgid "Saving Changes... Ok!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:137 +#: views/epm_advanced/oui_manager.views.new.modal.php:41 +#: views/epm_advanced_manual_upload.page.php:101 msgid "Select Brand:" msgstr "" @@ -1073,23 +1172,23 @@ msgstr "" msgid "Setting Provision" msgstr "" -#: Endpointman.class.php:539 +#: Endpointman.class.php:626 msgid "Settings" msgstr "" -#: views/epm_advanced_poce.page.php:107 +#: views/epm_advanced/poce.views.textarea.file.php:59 msgid "Share" msgstr "" -#: Endpointman.class.php:250 +#: Endpointman.class.php:303 msgid "Show" msgstr "" -#: Endpointman.class.php:529 +#: Endpointman.class.php:616 msgid "Show/Hide" msgstr "" -#: Endpointman.class.php:2516 +#: Endpointman.class.php:2824 msgid "Skipping download..." msgstr "" @@ -1097,15 +1196,15 @@ msgstr "" msgid "Structure" msgstr "" -#: Endpointman.class.php:2160 +#: Endpointman.class.php:2463 msgid "Syntax error, malformed JSON" msgstr "" -#: Endpointman.class.php:2941 +#: Endpointman.class.php:3253 msgid "System Error in Sync Model Function, Load Failure!" msgstr "" -#: Endpointman.class.php:2379 +#: Endpointman.class.php:2683 msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" msgstr "" @@ -1113,11 +1212,15 @@ msgstr "" msgid "System Failure!" msgstr "" -#: Endpointman.class.php:298 Endpointman.class.php:393 +#: Endpointman.class.php:351 Endpointman.class.php:458 msgid "Tab is not valid!" msgstr "" -#: Endpointman.class.php:222 +#: Endpointman.class.php:602 +msgid "Template Editor" +msgstr "" + +#: Endpointman.class.php:275 msgid "" "The \"Install\" button installs the configuration package brand models we " "selected.
      The \"Uninstall\" button removes the package configuration " @@ -1126,13 +1229,13 @@ msgid "" "version is detected." msgstr "" -#: Endpointman.class.php:2303 +#: Endpointman.class.php:2607 msgid "" "The Remote Server Is Currently Syncing With the Master Server, Please try " "again later" msgstr "" -#: Endpointman.class.php:221 +#: Endpointman.class.php:274 msgid "" "The button \"Install Firmware\" installs the necessary files to the server " "for the terminal alone are updated via TFTP or HTTP.
      The button " @@ -1142,24 +1245,30 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3456 +#: Endpointman.class.php:3773 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3454 +#: Endpointman.class.php:3771 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3458 +#: Endpointman.class.php:3775 msgid "The uploaded file was only partially uploaded" msgstr "" -#: Endpointman.class.php:2728 +#: Endpointman.class.php:3038 msgid "Then Use Manual Upload in Advanced Settings." msgstr "" +#: views/epm_advanced/oui_manager.views.new.modal.php:26 +msgid "" +"They are the first 6 characters of the MAC device that identifies the brand " +"(manufacturer)." +msgstr "" + #: views/epm_advanced_settings.page.php:134 msgid "Time" msgstr "" @@ -1176,59 +1285,59 @@ msgstr "" msgid "TimeZone by PBX Setting" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:32 +#: views/epm_advanced/oui_manager.views.grid.php:26 msgid "Type" msgstr "" -#: Endpointman.class.php:1164 +#: Endpointman.class.php:1412 msgid "Type File not valid!" msgstr "" -#: Endpointman.class.php:2154 +#: Endpointman.class.php:2457 msgid "Underflow or the modes mismatch" msgstr "" -#: Endpointman.class.php:2157 +#: Endpointman.class.php:2460 msgid "Unexpected control character found" msgstr "" -#: Endpointman.class.php:228 +#: Endpointman.class.php:281 msgid "Uninstall" msgstr "" -#: Endpointman.class.php:2619 +#: Endpointman.class.php:2927 msgid "Uninstalla Brand..." msgstr "" -#: Endpointman.class.php:2596 +#: Endpointman.class.php:2904 msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3600 +#: Endpointman.class.php:3917 msgid "Unknown" msgstr "" -#: Endpointman.class.php:2166 +#: Endpointman.class.php:2469 msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3468 +#: Endpointman.class.php:3785 msgid "Unknown upload error" msgstr "" -#: Endpointman.class.php:229 +#: Endpointman.class.php:282 msgid "Update" msgstr "" -#: Endpointman.class.php:243 +#: Endpointman.class.php:296 msgid "Update Content..." msgstr "" -#: Endpointman.class.php:232 +#: Endpointman.class.php:285 msgid "Update Firmware" msgstr "" -#: Endpointman.class.php:237 +#: Endpointman.class.php:290 msgid "Update!" msgstr "" @@ -1236,27 +1345,27 @@ msgstr "" msgid "Updated!" msgstr "" -#: Endpointman.class.php:2792 +#: Endpointman.class.php:3102 msgid "Updating %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:2803 +#: Endpointman.class.php:3113 msgid "Updating Family Lines................." msgstr "" -#: Endpointman.class.php:1314 +#: Endpointman.class.php:1616 msgid "Updating Last Modified..." msgstr "" -#: Endpointman.class.php:2968 +#: Endpointman.class.php:3285 msgid "Updating OUI list in DB" msgstr "" -#: Endpointman.class.php:240 Endpointman.class.php:257 +#: Endpointman.class.php:293 Endpointman.class.php:310 msgid "Upload Content!" msgstr "" -#: views/epm_advanced_poce.page.php:104 +#: views/epm_advanced/poce.views.textarea.file.php:56 msgid "" "Upload this configuration file to the Provisioner.net Team. Files " "shared are confidential and help improve the quality of releases." @@ -1266,7 +1375,7 @@ msgstr "" msgid "Use GITHUB Live Repo" msgstr "" -#: views/epm_advanced_poce.page.php:39 +#: views/epm_advanced/poce.views.button.up.files.php:31 msgid "User File Configs" msgstr "" @@ -1275,7 +1384,7 @@ msgid "" "Warning: The extensions need to be added into FreePBX before you import." msgstr "" -#: Endpointman.class.php:1447 +#: Endpointman.class.php:1749 msgid "We support only CVS and TXT files, type file %_FILE_% no support!" msgstr "" @@ -1298,29 +1407,29 @@ msgstr "" msgid "Yes" msgstr "" -#: Endpointman.class.php:2727 +#: Endpointman.class.php:3037 msgid "" "You Can Also Manually Update The Repository By Downloading Files here: %" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3182 +#: Endpointman.class.php:3499 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3185 +#: Endpointman.class.php:3502 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4575 +#: Endpointman.class.php:4945 msgid "You can't remove the only line left" msgstr "" -#: Endpointman.class.php:2587 +#: Endpointman.class.php:2895 msgid "Your Firmware is already up to date" msgstr "" -#: Endpointman.class.php:1709 +#: Endpointman.class.php:2011 msgid "Your permissions are wrong on " msgstr "" @@ -1333,6 +1442,6 @@ msgstr "" msgid "is required" msgstr "" -#: Endpointman.class.php:2740 +#: Endpointman.class.php:3050 msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" msgstr "" diff --git a/i18n/ja_JP/LC_MESSAGES/endpointman.mo b/i18n/ja_JP/LC_MESSAGES/endpointman.mo index ff0172d99e3c8b91664fa2d5069c58e1f5978a66..6a49d452e4cc25c575a5052d26f1f774e4a78f46 100644 GIT binary patch delta 23 ecmaDS^-gL-HanNGu7Rvh_pR5301P4$6 delta 23 ecmaDS^-gL-HanM*u92~Vp|O>*#pY7>pR530I|o+) diff --git a/i18n/ja_JP/LC_MESSAGES/endpointman.po b/i18n/ja_JP/LC_MESSAGES/endpointman.po index 586bd19b..a5209b76 100644 --- a/i18n/ja_JP/LC_MESSAGES/endpointman.po +++ b/i18n/ja_JP/LC_MESSAGES/endpointman.po @@ -37,7 +37,7 @@ msgid "" msgstr "" "Project-Id-Version: FreePBX endpointman\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-23 13:38-0800\n" +"POT-Creation-Date: 2016-03-03 10:44-0800\n" "PO-Revision-Date: 2014-02-24 06:17+0200\n" "Last-Translator: Kenichi Fukaumi \n" "Language-Team: Japanese Click Here!" @@ -91,7 +91,7 @@ msgstr "" msgid "ARP Executable Path" msgstr "" -#: Endpointman.class.php:2294 Endpointman.class.php:2295 +#: Endpointman.class.php:2598 Endpointman.class.php:2599 msgid "" "Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" msgstr "" @@ -100,24 +100,27 @@ msgstr "" msgid "Access denied!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:33 +#: views/epm_advanced/oui_manager.views.grid.php:27 msgid "Actions" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:6 -#: views/epm_advanced/oui_manager.views.grid.php:8 +#: views/epm_advanced/oui_manager.views.grid.php:5 msgid "Add Custom OUI" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:81 +#: views/epm_advanced/oui_manager.views.new.modal.php:62 msgid "Add New" msgstr "" +#: Endpointman.class.php:933 +msgid "Add New Template OK!" +msgstr "" + #: page.epm_advanced.php:19 msgid "Advanced Settings" msgstr "" -#: Endpointman.class.php:2647 +#: Endpointman.class.php:2955 msgid "All Done!" msgstr "" @@ -129,7 +132,7 @@ msgstr "内線の複製許可" msgid "Allow Saving Over Default Configuration Files" msgstr "標準設定ファイルの上書き許可" -#: Endpointman.class.php:2748 +#: Endpointman.class.php:3058 msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" msgstr "" @@ -137,8 +140,8 @@ msgstr "" msgid "Asterisk Executable Path" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:31 -#: views/epm_advanced/oui_manager.views.grid.php:56 +#: views/epm_advanced/oui_manager.views.grid.php:25 +#: views/epm_advanced/oui_manager.views.new.modal.php:36 #: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 msgid "Brand" msgstr "ブランド" @@ -147,7 +150,7 @@ msgstr "ブランド" msgid "Brand Package" msgstr "" -#: views/epm_advanced_manual_upload.page.php:125 +#: views/epm_advanced_manual_upload.page.php:90 msgid "Brand's Available" msgstr "" @@ -159,24 +162,24 @@ msgstr "" msgid "CSV File Format" msgstr "" -#: Endpointman.class.php:1196 Endpointman.class.php:1273 -#: Endpointman.class.php:1432 +#: Endpointman.class.php:1498 Endpointman.class.php:1575 +#: Endpointman.class.php:1734 msgid "Can Not Find Uploaded Files!" msgstr "" -#: Endpointman.class.php:2720 +#: Endpointman.class.php:3030 msgid "Can't Find Downloaded File!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:80 +#: views/epm_advanced/oui_manager.views.new.modal.php:61 msgid "Cancel" msgstr "" -#: Endpointman.class.php:2175 +#: Endpointman.class.php:2478 msgid "Cant find file:" msgstr "" -#: Endpointman.class.php:226 +#: Endpointman.class.php:279 msgid "Check Online " msgstr "" @@ -184,43 +187,52 @@ msgstr "" msgid "Check for Update" msgstr "" -#: Endpointman.class.php:225 +#: Endpointman.class.php:278 msgid "Check for Update " msgstr "" -#: Endpointman.class.php:241 +#: Endpointman.class.php:294 msgid "Check for Updates..." msgstr "" -#: Endpointman.class.php:242 +#: Endpointman.class.php:295 msgid "Check for Updates... Ok!" msgstr "" -#: Endpointman.class.php:2542 +#: Endpointman.class.php:2850 msgid "Checking MD5sum of Package..." msgstr "" -#: Endpointman.class.php:2705 +#: Endpointman.class.php:3013 msgid "Checking MD5sum of Package...." msgstr "" -#: Endpointman.class.php:1394 +#: Endpointman.class.php:1696 msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:274 Endpointman.class.php:292 -#: Endpointman.class.php:320 Endpointman.class.php:348 -#: Endpointman.class.php:357 Endpointman.class.php:387 +#: Endpointman.class.php:916 +msgid "Clone Model is not number!" +msgstr "" + +#: Endpointman.class.php:919 +msgid "Clone Model send is negative!" +msgstr "" + +#: Endpointman.class.php:265 Endpointman.class.php:327 +#: Endpointman.class.php:345 Endpointman.class.php:373 +#: Endpointman.class.php:401 Endpointman.class.php:410 +#: Endpointman.class.php:440 Endpointman.class.php:453 msgid "Command not found!" msgstr "" -#: Endpointman.class.php:146 +#: Endpointman.class.php:147 msgid "" "Configuration Directory is not a directory or does not exist! Please change " "the location here:" msgstr "" -#: Endpointman.class.php:138 +#: Endpointman.class.php:139 msgid "Configuration Directory is not writable!" msgstr "" @@ -232,27 +244,31 @@ msgstr "設定タイプ" msgid "Connectivity" msgstr "接続" -#: Endpointman.class.php:2574 +#: Endpointman.class.php:2882 msgid "Copy Error Detected! Aborting Install!" msgstr "" -#: Endpointman.class.php:2756 +#: Endpointman.class.php:3066 msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." msgstr "" -#: Endpointman.class.php:2681 +#: Endpointman.class.php:2989 msgid "Creating EPM temp directory" msgstr "" -#: Endpointman.class.php:1222 +#: Endpointman.class.php:1524 msgid "Creating EPM temp directory..." msgstr "" -#: Endpointman.class.php:1300 +#: Endpointman.class.php:1602 msgid "Creating Provisioner Directory..." msgstr "" -#: views/epm_advanced_poce.page.php:28 +#: Endpointman.class.php:598 +msgid "Current Templates" +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:19 msgid "Custom Template Files" msgstr "カスタムテンプレートファイル" @@ -260,20 +276,32 @@ msgstr "カスタムテンプレートファイル" msgid "Default Mirror FreePBX" msgstr "" -#: views/epm_advanced_poce.page.php:84 +#: views/epm_advanced/poce.views.textarea.file.php:36 msgid "Delete" msgstr "削除" +#: Endpointman.class.php:889 +msgid "Delete Template OK!" +msgstr "" + #: views/epm_advanced_settings.page.php:56 #: views/epm_advanced_settings.page.php:191 msgid "Determine for Me" msgstr "" -#: Endpointman.class.php:1663 +#: Endpointman.class.php:588 +msgid "Devices" +msgstr "" + +#: Endpointman.class.php:1965 msgid "Directory Not Writable!" msgstr "" -#: Endpointman.class.php:234 +#: Endpointman.class.php:1490 +msgid "Directory no exists: " +msgstr "" + +#: Endpointman.class.php:287 msgid "Disable" msgstr "無効" @@ -289,18 +317,18 @@ msgstr "TFTPサーバーのチェックを無効" msgid "Disable Tooltips" msgstr "ヒントを無効にする。" -#: Endpointman.class.php:1224 Endpointman.class.php:1238 -#: Endpointman.class.php:1297 Endpointman.class.php:1302 -#: Endpointman.class.php:1317 Endpointman.class.php:1393 -#: Endpointman.class.php:1488 Endpointman.class.php:2526 -#: Endpointman.class.php:2538 Endpointman.class.php:2579 -#: Endpointman.class.php:2611 Endpointman.class.php:2665 -#: Endpointman.class.php:2693 Endpointman.class.php:2700 -#: Endpointman.class.php:2707 Endpointman.class.php:2711 -#: Endpointman.class.php:2782 Endpointman.class.php:2860 -#: Endpointman.class.php:2896 Endpointman.class.php:2925 -#: Endpointman.class.php:2967 Endpointman.class.php:2978 -#: Endpointman.class.php:2988 +#: Endpointman.class.php:1526 Endpointman.class.php:1540 +#: Endpointman.class.php:1599 Endpointman.class.php:1604 +#: Endpointman.class.php:1619 Endpointman.class.php:1695 +#: Endpointman.class.php:1790 Endpointman.class.php:2834 +#: Endpointman.class.php:2846 Endpointman.class.php:2887 +#: Endpointman.class.php:2919 Endpointman.class.php:2973 +#: Endpointman.class.php:3001 Endpointman.class.php:3008 +#: Endpointman.class.php:3015 Endpointman.class.php:3019 +#: Endpointman.class.php:3092 Endpointman.class.php:3172 +#: Endpointman.class.php:3208 Endpointman.class.php:3237 +#: Endpointman.class.php:3284 Endpointman.class.php:3295 +#: Endpointman.class.php:3305 msgid "Done!" msgstr "" @@ -308,27 +336,23 @@ msgstr "" msgid "Download updated releases from " msgstr "" -#: Endpointman.class.php:2689 +#: Endpointman.class.php:2997 msgid "Downloading Brand JSON....." msgstr "" -#: Endpointman.class.php:2698 +#: Endpointman.class.php:3006 msgid "Downloading Brand Package..." msgstr "" -#: Endpointman.class.php:2520 Endpointman.class.php:2532 +#: Endpointman.class.php:2828 Endpointman.class.php:2840 msgid "Downloading firmware..." msgstr "" -#: Endpointman.class.php:594 +#: Endpointman.class.php:688 msgid "Dropping all relevant tables" msgstr "" -#: views/epm_advanced_manual_upload.page.php:177 -msgid "Empty list." -msgstr "" - -#: Endpointman.class.php:233 +#: Endpointman.class.php:286 msgid "Enable" msgstr "有効" @@ -360,35 +384,35 @@ msgstr "" msgid "Error 500 Internal Server Error" msgstr "" -#: Endpointman.class.php:2726 +#: Endpointman.class.php:3036 msgid "" "Error Connecting to the Package Repository. Module not installed. Please Try " "again later." msgstr "" -#: Endpointman.class.php:2683 +#: Endpointman.class.php:2991 msgid "Error creating directory: %_DIR_%" msgstr "" -#: Endpointman.class.php:2723 +#: Endpointman.class.php:3033 msgid "Error download Brand package!" msgstr "" -#: Endpointman.class.php:2523 Endpointman.class.php:2535 +#: Endpointman.class.php:2831 Endpointman.class.php:2843 msgid "Error download frimware package!" msgstr "" -#: Endpointman.class.php:236 Endpointman.class.php:253 -#: Endpointman.class.php:305 Endpointman.class.php:1227 -#: Endpointman.class.php:1305 +#: Endpointman.class.php:289 Endpointman.class.php:306 +#: Endpointman.class.php:358 Endpointman.class.php:1529 +#: Endpointman.class.php:1607 msgid "Error!" msgstr "" -#: Endpointman.class.php:1784 Endpointman.class.php:1821 +#: Endpointman.class.php:2086 Endpointman.class.php:2123 msgid "Error: Command not found!" msgstr "" -#: Endpointman.class.php:2268 +#: Endpointman.class.php:2572 msgid "Error: No Local File for %_name_% !" msgstr "" @@ -400,16 +424,16 @@ msgstr "" msgid "Experimental" msgstr "" -#: views/epm_advanced_manual_upload.page.php:157 +#: views/epm_advanced_manual_upload.page.php:122 msgid "Explor a package brand's availables." msgstr "" #: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:146 +#: views/epm_advanced_manual_upload.page.php:109 msgid "Export" msgstr "" -#: views/epm_advanced_manual_upload.page.php:114 +#: views/epm_advanced_manual_upload.page.php:79 msgid "Export Brand Packages" msgstr "" @@ -425,7 +449,7 @@ msgstr "端末のCSVファイルをエクスポートします" msgid "Export data configuracion devices." msgstr "" -#: Endpointman.class.php:1384 +#: Endpointman.class.php:1686 msgid "Exporting %_NAME_%" msgstr "" @@ -433,19 +457,19 @@ msgstr "" msgid "Extension" msgstr "内線" -#: Endpointman.class.php:1295 +#: Endpointman.class.php:1597 msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:1233 +#: Endpointman.class.php:1535 msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" msgstr "" -#: Endpointman.class.php:2709 +#: Endpointman.class.php:3017 msgid "Extracting Tarball........" msgstr "" -#: Endpointman.class.php:1235 +#: Endpointman.class.php:1537 msgid "Extracting Tarball........ " msgstr "" @@ -453,11 +477,11 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3464 +#: Endpointman.class.php:3781 msgid "Failed to write file to disk" msgstr "" -#: Endpointman.class.php:1450 +#: Endpointman.class.php:1752 msgid "File %_FILE_% size is 0!" msgstr "" @@ -465,7 +489,7 @@ msgstr "" msgid "File (TFTP/FTP)" msgstr "" -#: Endpointman.class.php:1321 +#: Endpointman.class.php:1623 msgid "File Temp no Exists!" msgstr "" @@ -473,23 +497,23 @@ msgstr "" msgid "File not Found!" msgstr "" -#: Endpointman.class.php:946 +#: Endpointman.class.php:1197 msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3466 +#: Endpointman.class.php:3783 msgid "File upload stopped by extension" msgstr "" -#: Endpointman.class.php:2583 +#: Endpointman.class.php:2891 msgid "Firmware MD5 didn't match!" msgstr "" -#: Endpointman.class.php:2812 +#: Endpointman.class.php:3122 msgid "Firmware Requirment Detected!.........." msgstr "" -#: views/epm_advanced_poce.page.php:71 +#: views/epm_advanced/poce.views.textarea.file.php:23 msgid "Full Screen F11" msgstr "" @@ -497,7 +521,11 @@ msgstr "" msgid "GIT Branch" msgstr "" -#: Endpointman.class.php:1645 views/epm_advanced_settings.page.php:23 +#: Endpointman.class.php:963 +msgid "Generate list Ok!" +msgstr "" + +#: Endpointman.class.php:1947 views/epm_advanced_settings.page.php:23 msgid "Git not installed!" msgstr "" @@ -505,40 +533,53 @@ msgstr "" msgid "Global Final Config & Firmware Directory" msgstr "グローバル•最終設定とファームウェアのディレクトリ" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "Heads up!" msgstr "" -#: Endpointman.class.php:139 Endpointman.class.php:146 -#: Endpointman.class.php:1396 +#: Endpointman.class.php:140 Endpointman.class.php:147 +#: Endpointman.class.php:1698 msgid "Here" msgstr "" -#: Endpointman.class.php:251 +#: Endpointman.class.php:304 msgid "Hide" msgstr "隠す" -#: Endpointman.class.php:1533 +#: Endpointman.class.php:1835 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:660 +#: Endpointman.class.php:763 msgid "ID Brand not is numbre" msgstr "" -#: Endpointman.class.php:1381 +#: Endpointman.class.php:1683 msgid "ID Package send not valid, brand not exist!" msgstr "" -#: Endpointman.class.php:645 +#: Endpointman.class.php:748 msgid "ID Producto not is number" msgstr "" -#: Endpointman.class.php:1842 Endpointman.class.php:1976 +#: Endpointman.class.php:876 +msgid "ID is not number!" +msgstr "" + +#: Endpointman.class.php:879 +msgid "ID send is negative!" +msgstr "" + +#: Endpointman.class.php:945 Endpointman.class.php:2144 +#: Endpointman.class.php:2279 msgid "ID send is not number!" msgstr "" -#: Endpointman.class.php:1861 Endpointman.class.php:1999 +#: Endpointman.class.php:948 +msgid "ID send is number not valid!" +msgstr "" + +#: Endpointman.class.php:2163 Endpointman.class.php:2302 msgid "IDType invalid: " msgstr "" @@ -546,24 +587,24 @@ msgstr "" msgid "IP address of phone server" msgstr "電話サーバーのIPアドレス" -#: Endpointman.class.php:220 +#: Endpointman.class.php:273 msgid "" "If we can activate the model set terminals of the models.
      If this " "model is disabled will not appear in the list of models that can be " "configured for PBX." msgstr "" -#: Endpointman.class.php:248 +#: Endpointman.class.php:301 msgid "" "If you select Hide disappear all models of the product selected from the " "Install/Uninstall list." msgstr "" -#: Endpointman.class.php:249 +#: Endpointman.class.php:302 msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" -#: Endpointman.class.php:247 +#: Endpointman.class.php:300 msgid "" "If you select Hide this brand will disappear and all products and models on " "the list of Install/Uninstall." @@ -595,92 +636,96 @@ msgstr "" msgid "Import a package brand in manual mode." msgstr "" -#: Endpointman.class.php:551 +#: Endpointman.class.php:638 msgid "Import/Export My Devices List" msgstr "デバイスリストのインポート/エクスポート" -#: Endpointman.class.php:1439 +#: Endpointman.class.php:1741 msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1278 +#: Endpointman.class.php:1580 msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1201 +#: Endpointman.class.php:1503 msgid "Importing brand file %_FILE_%..." msgstr "" -#: Endpointman.class.php:2796 +#: Endpointman.class.php:3106 msgid "Inserting %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:227 +#: Endpointman.class.php:280 msgid "Install" msgstr "インストール" -#: Endpointman.class.php:230 +#: Endpointman.class.php:283 msgid "Install Firmware" msgstr "ファームウェアをインストール" -#: Endpointman.class.php:525 +#: Endpointman.class.php:612 msgid "Install/Unistall" msgstr "" -#: Endpointman.class.php:2551 +#: Endpointman.class.php:2859 msgid "Installing Firmware..." msgstr "" -#: Endpointman.class.php:2731 +#: Endpointman.class.php:3041 msgid "Installing brands is disabled while in repo mode!" msgstr "" -#: Endpointman.class.php:1496 +#: Endpointman.class.php:1798 msgid "Invalid Brand Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1490 +#: Endpointman.class.php:1792 msgid "Invalid Extension Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1263 Endpointman.class.php:1324 +#: Endpointman.class.php:1565 Endpointman.class.php:1626 msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:2980 +#: Endpointman.class.php:3297 msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3250 +#: Endpointman.class.php:3567 msgid "Invalid MAC Address" msgstr "" -#: Endpointman.class.php:1499 +#: Endpointman.class.php:1801 msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3245 +#: Endpointman.class.php:3562 msgid "Invalid Model Selected, Can't Sync System" msgstr "" -#: Endpointman.class.php:1493 +#: Endpointman.class.php:1795 msgid "Invalid Model Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:244 Endpointman.class.php:258 -#: Endpointman.class.php:308 +#: Endpointman.class.php:297 Endpointman.class.php:311 +#: Endpointman.class.php:361 msgid "Invalid Option!" msgstr "" -#: Endpointman.class.php:1967 +#: Endpointman.class.php:2270 msgid "Invalid Value!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:117 +#: views/epm_advanced/oui_manager.views.new.modal.php:55 +msgid "It is the brand of OUI we specified." +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:82 msgid "Learn how to create your own brand package at " msgstr "" -#: Endpointman.class.php:2269 +#: Endpointman.class.php:2573 msgid "Learn how to manually upload packages here (it's easy!):" msgstr "" @@ -688,19 +733,27 @@ msgstr "" msgid "Line" msgstr "ライン" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "List Bran's Availables empty." msgstr "" +#: Endpointman.class.php:1481 +msgid "List Done!" +msgstr "" + #: views/epm_config_manager.page.php:19 msgid "List Packages Manager" msgstr "" -#: views/epm_advanced_manual_upload.page.php:168 +#: views/epm_advanced/poce.views.bootnav.php:5 +msgid "List Product's Empty" +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:133 msgid "List of other exports" msgstr "" -#: views/epm_advanced_manual_upload.page.php:209 +#: views/epm_advanced_manual_upload.page.php:152 msgid "List packages generated in other exports." msgstr "" @@ -708,11 +761,15 @@ msgstr "" msgid "Loading data...." msgstr "" -#: assets/js/epm_global.js:86 +#: assets/js/epm_global.js:117 msgid "Loading.." msgstr "" -#: views/epm_advanced_poce.page.php:16 +#: views/epm_advanced_manual_upload.page.php:140 +msgid "Loading..." +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:7 msgid "Local File Configs" msgstr "ローカルファイル設定" @@ -720,11 +777,11 @@ msgstr "ローカルファイル設定" msgid "Local Paths" msgstr "" -#: Endpointman.class.php:1246 +#: Endpointman.class.php:1548 msgid "Looking file and update brand's...." msgstr "" -#: Endpointman.class.php:1244 +#: Endpointman.class.php:1546 msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." msgstr "" @@ -732,23 +789,31 @@ msgstr "" msgid "MAC Address" msgstr "" -#: Endpointman.class.php:2717 +#: Endpointman.class.php:3025 msgid "MD5 Did not match!" msgstr "" -#: Endpointman.class.php:2163 +#: Endpointman.class.php:3027 +msgid "MD5 PKG: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:3026 +msgid "MD5 XML: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:2466 msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "" -#: Endpointman.class.php:2544 +#: Endpointman.class.php:2852 msgid "Matches!" msgstr "" -#: Endpointman.class.php:2151 +#: Endpointman.class.php:2454 msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3462 +#: Endpointman.class.php:3779 msgid "Missing a temporary folder" msgstr "" @@ -756,7 +821,7 @@ msgstr "" msgid "Model" msgstr "モデル" -#: Endpointman.class.php:2950 +#: Endpointman.class.php:3267 msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" msgstr "" @@ -764,31 +829,31 @@ msgstr "" msgid "NMAP Executable Path" msgstr "" -#: views/epm_advanced_poce.page.php:90 +#: views/epm_advanced/poce.views.textarea.file.php:42 msgid "" "NOTE: File is permanently saved and not over-written during next package " "update." msgstr "" -#: views/epm_advanced_poce.page.php:80 +#: views/epm_advanced/poce.views.textarea.file.php:32 msgid "" "NOTE: File may be over-written during next package update. We suggest also " "using the Share button below to improve the next release." msgstr "" -#: views/epm_advanced_poce.page.php:74 +#: views/epm_advanced/poce.views.textarea.file.php:26 msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." msgstr "" -#: Endpointman.class.php:1725 +#: Endpointman.class.php:2027 msgid "Name invalid: " msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:61 -msgid "New OUI" +#: Endpointman.class.php:901 +msgid "Name is null!" msgstr "" -#: Endpointman.class.php:223 +#: Endpointman.class.php:276 msgid "New Package Modified" msgstr "" @@ -803,133 +868,154 @@ msgstr "" msgid "No" msgstr "" -#: Endpointman.class.php:2983 +#: Endpointman.class.php:3300 msgid "No 'brand_data.xml' file exists!" msgstr "" -#: Endpointman.class.php:1555 +#: Endpointman.class.php:1857 msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:1669 +#: Endpointman.class.php:1971 msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3283 Endpointman.class.php:3301 +#: Endpointman.class.php:3600 Endpointman.class.php:3618 msgid "No Devices/Extensions Left to Add" msgstr "" -#: Endpointman.class.php:1258 +#: Endpointman.class.php:1560 msgid "No File Provided!" msgstr "" -#: Endpointman.class.php:1530 +#: Endpointman.class.php:1832 msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3287 Endpointman.class.php:3305 +#: Endpointman.class.php:3604 Endpointman.class.php:3622 msgid "No Lines Left to Add" msgstr "" -#: Endpointman.class.php:1552 +#: Endpointman.class.php:1854 msgid "No OUI set!" msgstr "" -#: views/epm_advanced_poce.page.php:53 views/epm_advanced_poce.page.php:72 +#: views/epm_advanced/poce.views.textarea.file.php:5 +#: views/epm_advanced/poce.views.textarea.file.php:24 msgid "No Selected" msgstr "" -#: Endpointman.class.php:3460 +#: Endpointman.class.php:3777 msgid "No file was uploaded" msgstr "" -#: Endpointman.class.php:1369 +#: Endpointman.class.php:1671 msgid "No package set!" msgstr "" -#: Endpointman.class.php:884 +#: Endpointman.class.php:913 +msgid "No send Clone Model!" +msgstr "" + +#: Endpointman.class.php:1135 msgid "No send File ID!" msgstr "" -#: Endpointman.class.php:887 +#: Endpointman.class.php:1138 msgid "No send File Name!" msgstr "" -#: Endpointman.class.php:1066 +#: Endpointman.class.php:873 Endpointman.class.php:942 +msgid "No send ID!" +msgstr "" + +#: Endpointman.class.php:1314 msgid "No send Name File!" msgstr "" -#: Endpointman.class.php:1069 +#: Endpointman.class.php:898 +msgid "No send Name!" +msgstr "" + +#: Endpointman.class.php:1317 msgid "No send Origianl Name File!" msgstr "" -#: Endpointman.class.php:784 Endpointman.class.php:875 -#: Endpointman.class.php:1009 Endpointman.class.php:1051 -#: Endpointman.class.php:1145 +#: Endpointman.class.php:1035 Endpointman.class.php:1126 +#: Endpointman.class.php:1251 Endpointman.class.php:1299 +#: Endpointman.class.php:1393 msgid "No send Product Select!" msgstr "" -#: Endpointman.class.php:1151 +#: Endpointman.class.php:904 +msgid "No send Product!" +msgstr "" + +#: Endpointman.class.php:1399 msgid "No send SQL Select!" msgstr "" -#: Endpointman.class.php:1063 +#: Endpointman.class.php:1311 msgid "No send Save Name!" msgstr "" -#: Endpointman.class.php:1015 Endpointman.class.php:1054 +#: Endpointman.class.php:1257 Endpointman.class.php:1302 msgid "No send SendID!" msgstr "" -#: Endpointman.class.php:1060 +#: Endpointman.class.php:1308 msgid "No send Text File!" msgstr "" -#: Endpointman.class.php:890 Endpointman.class.php:1012 -#: Endpointman.class.php:1057 Endpointman.class.php:1148 +#: Endpointman.class.php:1141 Endpointman.class.php:1254 +#: Endpointman.class.php:1305 Endpointman.class.php:1396 msgid "No send Type File!" msgstr "" -#: Endpointman.class.php:1836 Endpointman.class.php:1970 +#: Endpointman.class.php:2138 Endpointman.class.php:2273 msgid "No send id!" msgstr "" -#: Endpointman.class.php:1839 Endpointman.class.php:1973 +#: Endpointman.class.php:2141 Endpointman.class.php:2276 msgid "No send idtype!" msgstr "" -#: Endpointman.class.php:1597 Endpointman.class.php:1830 -#: Endpointman.class.php:1960 +#: Endpointman.class.php:1899 Endpointman.class.php:2132 +#: Endpointman.class.php:2263 msgid "No send name!" msgstr "" -#: Endpointman.class.php:1600 Endpointman.class.php:1833 -#: Endpointman.class.php:1963 +#: Endpointman.class.php:1902 Endpointman.class.php:2135 +#: Endpointman.class.php:2266 msgid "No send value!" msgstr "" -#: Endpointman.class.php:1666 +#: Endpointman.class.php:1968 msgid "Not a Vaild Directory.
      Try to run 'mkdir " msgstr "" -#: Endpointman.class.php:2207 +#: Endpointman.class.php:2510 msgid "Not able to connect to repository. Using local Provisioner.net Package." msgstr "" -#: Endpointman.class.php:2237 +#: Endpointman.class.php:2540 msgid "" "Not able to connect to repository. Using local brand [%_brandname_%] file " "instead." msgstr "" -#: Endpointman.class.php:2192 +#: Endpointman.class.php:2495 msgid "Not able to connect to repository. Using local master file instead." msgstr "" -#: Endpointman.class.php:2668 +#: Endpointman.class.php:2976 msgid "Not allowed in repo mode!!" msgstr "" +#: Endpointman.class.php:1487 +msgid "Not is directory: " +msgstr "" + #: endpointman.i18n.php:18 msgid "OSS Endpoint Advanced Settings" msgstr "OSS端末の詳細設定" @@ -961,28 +1047,32 @@ msgid "" "either of these and are encouraged." msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:30 -#: views/epm_advanced/oui_manager.views.grid.php:53 +#: views/epm_advanced/oui_manager.views.grid.php:24 +#: views/epm_advanced/oui_manager.views.new.modal.php:14 msgid "OUI" msgstr "" -#: Endpointman.class.php:543 +#: views/epm_advanced/oui_manager.views.new.modal.php:18 +msgid "OUI Brand" +msgstr "" + +#: Endpointman.class.php:630 msgid "OUI Manager" msgstr "OUIマネージャー" -#: Endpointman.class.php:2880 Endpointman.class.php:2905 +#: Endpointman.class.php:3192 Endpointman.class.php:3217 msgid "Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:140 +#: Endpointman.class.php:141 msgid "Or run this command on SSH:" msgstr "" -#: Endpointman.class.php:555 +#: Endpointman.class.php:642 msgid "Package Import/Export" msgstr "" -#: Endpointman.class.php:224 +#: Endpointman.class.php:277 msgid "Package Last Modified" msgstr "最終修正パッケージ" @@ -994,94 +1084,103 @@ msgstr "" msgid "Package Server" msgstr "" -#: Endpointman.class.php:1372 +#: Endpointman.class.php:1674 msgid "Package not valid!" msgstr "" -#: Endpointman.class.php:2576 Endpointman.class.php:2684 +#: Endpointman.class.php:2884 Endpointman.class.php:2992 msgid "Please Check Directory/Permissions!" msgstr "" -#: Endpointman.class.php:139 +#: Endpointman.class.php:140 msgid "Please change the location:" msgstr "" -#: Endpointman.class.php:1253 +#: Endpointman.class.php:1555 msgid "Please name the Package the same name as your brand!" msgstr "" -#: Endpointman.class.php:1506 +#: Endpointman.class.php:1808 msgid "Please reboot & rebuild all imported phones" msgstr "" -#: Endpointman.class.php:1508 +#: Endpointman.class.php:1810 msgid "Possible file upload attack!" msgstr "" -#: Endpointman.class.php:2743 +#: Endpointman.class.php:3053 msgid "Processing %_PATH_%/brand_data.json..." msgstr "" -#: Endpointman.class.php:547 +#: Endpointman.class.php:634 msgid "Product Configuration Editor" msgstr "" -#: Endpointman.class.php:787 Endpointman.class.php:878 +#: Endpointman.class.php:1038 Endpointman.class.php:1129 msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:790 Endpointman.class.php:881 +#: Endpointman.class.php:1041 Endpointman.class.php:1132 msgid "Product Select send is number not valid!" msgstr "" +#: Endpointman.class.php:907 +msgid "Product is not number!" +msgstr "" + +#: Endpointman.class.php:910 +msgid "Product send is negative!" +msgstr "" + #: views/epm_advanced_manual_upload.page.php:24 msgid "Provisioner Package" msgstr "" -#: Endpointman.class.php:235 Endpointman.class.php:252 -#: Endpointman.class.php:256 +#: Endpointman.class.php:288 Endpointman.class.php:305 +#: Endpointman.class.php:309 msgid "Ready!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:13 +#: views/epm_advanced/oui_manager.views.grid.php:6 msgid "Refresh Table" msgstr "" -#: Endpointman.class.php:231 +#: Endpointman.class.php:284 msgid "Remove Firmware" msgstr "ファームウェアを削除" -#: Endpointman.class.php:589 +#: Endpointman.class.php:676 msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:2986 +#: Endpointman.class.php:3303 msgid "Removing Temporary Files.............." msgstr "" -#: Endpointman.class.php:609 +#: Endpointman.class.php:680 msgid "Removing symlink to web provisioner" msgstr "" -#: views/epm_advanced_poce.page.php:83 +#: views/epm_advanced/poce.views.textarea.file.php:35 msgid "Save" msgstr "保存" -#: views/epm_advanced_poce.page.php:96 +#: views/epm_advanced/poce.views.textarea.file.php:48 msgid "Save As..." msgstr "" -#: Endpointman.class.php:238 Endpointman.class.php:254 -#: Endpointman.class.php:306 +#: Endpointman.class.php:291 Endpointman.class.php:307 +#: Endpointman.class.php:359 msgid "Saving Changes..." msgstr "" -#: Endpointman.class.php:239 Endpointman.class.php:255 -#: Endpointman.class.php:307 +#: Endpointman.class.php:292 Endpointman.class.php:308 +#: Endpointman.class.php:360 msgid "Saving Changes... Ok!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:137 +#: views/epm_advanced/oui_manager.views.new.modal.php:41 +#: views/epm_advanced_manual_upload.page.php:101 msgid "Select Brand:" msgstr "" @@ -1094,23 +1193,23 @@ msgstr "" msgid "Setting Provision" msgstr "" -#: Endpointman.class.php:539 +#: Endpointman.class.php:626 msgid "Settings" msgstr "設定" -#: views/epm_advanced_poce.page.php:107 +#: views/epm_advanced/poce.views.textarea.file.php:59 msgid "Share" msgstr "" -#: Endpointman.class.php:250 +#: Endpointman.class.php:303 msgid "Show" msgstr "表示" -#: Endpointman.class.php:529 +#: Endpointman.class.php:616 msgid "Show/Hide" msgstr "" -#: Endpointman.class.php:2516 +#: Endpointman.class.php:2824 msgid "Skipping download..." msgstr "" @@ -1118,15 +1217,15 @@ msgstr "" msgid "Structure" msgstr "" -#: Endpointman.class.php:2160 +#: Endpointman.class.php:2463 msgid "Syntax error, malformed JSON" msgstr "" -#: Endpointman.class.php:2941 +#: Endpointman.class.php:3253 msgid "System Error in Sync Model Function, Load Failure!" msgstr "" -#: Endpointman.class.php:2379 +#: Endpointman.class.php:2683 msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" msgstr "" @@ -1134,11 +1233,15 @@ msgstr "" msgid "System Failure!" msgstr "" -#: Endpointman.class.php:298 Endpointman.class.php:393 +#: Endpointman.class.php:351 Endpointman.class.php:458 msgid "Tab is not valid!" msgstr "" -#: Endpointman.class.php:222 +#: Endpointman.class.php:602 +msgid "Template Editor" +msgstr "" + +#: Endpointman.class.php:275 msgid "" "The \"Install\" button installs the configuration package brand models we " "selected.
      The \"Uninstall\" button removes the package configuration " @@ -1147,13 +1250,13 @@ msgid "" "version is detected." msgstr "" -#: Endpointman.class.php:2303 +#: Endpointman.class.php:2607 msgid "" "The Remote Server Is Currently Syncing With the Master Server, Please try " "again later" msgstr "" -#: Endpointman.class.php:221 +#: Endpointman.class.php:274 msgid "" "The button \"Install Firmware\" installs the necessary files to the server " "for the terminal alone are updated via TFTP or HTTP.
      The button " @@ -1163,24 +1266,30 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3456 +#: Endpointman.class.php:3773 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3454 +#: Endpointman.class.php:3771 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3458 +#: Endpointman.class.php:3775 msgid "The uploaded file was only partially uploaded" msgstr "" -#: Endpointman.class.php:2728 +#: Endpointman.class.php:3038 msgid "Then Use Manual Upload in Advanced Settings." msgstr "" +#: views/epm_advanced/oui_manager.views.new.modal.php:26 +msgid "" +"They are the first 6 characters of the MAC device that identifies the brand " +"(manufacturer)." +msgstr "" + #: views/epm_advanced_settings.page.php:134 msgid "Time" msgstr "" @@ -1197,59 +1306,59 @@ msgstr "時間帯" msgid "TimeZone by PBX Setting" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:32 +#: views/epm_advanced/oui_manager.views.grid.php:26 msgid "Type" msgstr "" -#: Endpointman.class.php:1164 +#: Endpointman.class.php:1412 msgid "Type File not valid!" msgstr "" -#: Endpointman.class.php:2154 +#: Endpointman.class.php:2457 msgid "Underflow or the modes mismatch" msgstr "" -#: Endpointman.class.php:2157 +#: Endpointman.class.php:2460 msgid "Unexpected control character found" msgstr "" -#: Endpointman.class.php:228 +#: Endpointman.class.php:281 msgid "Uninstall" msgstr "アンインストール" -#: Endpointman.class.php:2619 +#: Endpointman.class.php:2927 msgid "Uninstalla Brand..." msgstr "" -#: Endpointman.class.php:2596 +#: Endpointman.class.php:2904 msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3600 +#: Endpointman.class.php:3917 msgid "Unknown" msgstr "" -#: Endpointman.class.php:2166 +#: Endpointman.class.php:2469 msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3468 +#: Endpointman.class.php:3785 msgid "Unknown upload error" msgstr "" -#: Endpointman.class.php:229 +#: Endpointman.class.php:282 msgid "Update" msgstr "アップデート" -#: Endpointman.class.php:243 +#: Endpointman.class.php:296 msgid "Update Content..." msgstr "" -#: Endpointman.class.php:232 +#: Endpointman.class.php:285 msgid "Update Firmware" msgstr "ファームウェアをアップデート" -#: Endpointman.class.php:237 +#: Endpointman.class.php:290 msgid "Update!" msgstr "" @@ -1257,27 +1366,27 @@ msgstr "" msgid "Updated!" msgstr "" -#: Endpointman.class.php:2792 +#: Endpointman.class.php:3102 msgid "Updating %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:2803 +#: Endpointman.class.php:3113 msgid "Updating Family Lines................." msgstr "" -#: Endpointman.class.php:1314 +#: Endpointman.class.php:1616 msgid "Updating Last Modified..." msgstr "" -#: Endpointman.class.php:2968 +#: Endpointman.class.php:3285 msgid "Updating OUI list in DB" msgstr "" -#: Endpointman.class.php:240 Endpointman.class.php:257 +#: Endpointman.class.php:293 Endpointman.class.php:310 msgid "Upload Content!" msgstr "" -#: views/epm_advanced_poce.page.php:104 +#: views/epm_advanced/poce.views.textarea.file.php:56 msgid "" "Upload this configuration file to the Provisioner.net Team. Files " "shared are confidential and help improve the quality of releases." @@ -1287,7 +1396,7 @@ msgstr "" msgid "Use GITHUB Live Repo" msgstr "" -#: views/epm_advanced_poce.page.php:39 +#: views/epm_advanced/poce.views.button.up.files.php:31 msgid "User File Configs" msgstr "ユーザーファイル設定" @@ -1296,7 +1405,7 @@ msgid "" "Warning: The extensions need to be added into FreePBX before you import." msgstr "" -#: Endpointman.class.php:1447 +#: Endpointman.class.php:1749 msgid "We support only CVS and TXT files, type file %_FILE_% no support!" msgstr "" @@ -1319,29 +1428,29 @@ msgstr "" msgid "Yes" msgstr "" -#: Endpointman.class.php:2727 +#: Endpointman.class.php:3037 msgid "" "You Can Also Manually Update The Repository By Downloading Files here: %" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3182 +#: Endpointman.class.php:3499 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3185 +#: Endpointman.class.php:3502 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4575 +#: Endpointman.class.php:4945 msgid "You can't remove the only line left" msgstr "" -#: Endpointman.class.php:2587 +#: Endpointman.class.php:2895 msgid "Your Firmware is already up to date" msgstr "" -#: Endpointman.class.php:1709 +#: Endpointman.class.php:2011 msgid "Your permissions are wrong on " msgstr "" @@ -1354,7 +1463,7 @@ msgstr "" msgid "is required" msgstr "" -#: Endpointman.class.php:2740 +#: Endpointman.class.php:3050 msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" msgstr "" diff --git a/i18n/ru_RU/LC_MESSAGES/endpointman.mo b/i18n/ru_RU/LC_MESSAGES/endpointman.mo index f56b07f086fb6529464a5fc6b5d9c65f95830d0f..a6530f176e31c37a26ef3ded627cb9543a385c59 100644 GIT binary patch delta 21 ccmeys{DFDGNiJhu17ih411l4gjhAH^0aOGA(f|Me delta 21 ccmeys{DFDGNiHK@BVz?aV=H5ejhAH^0aP>w*#H0l diff --git a/i18n/ru_RU/LC_MESSAGES/endpointman.po b/i18n/ru_RU/LC_MESSAGES/endpointman.po index 8fd22c63..fdd70dac 100644 --- a/i18n/ru_RU/LC_MESSAGES/endpointman.po +++ b/i18n/ru_RU/LC_MESSAGES/endpointman.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: 2.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-23 13:38-0800\n" +"POT-Creation-Date: 2016-03-03 10:44-0800\n" "PO-Revision-Date: 2012-11-01 22:35+0400\n" "Last-Translator: PostMet \n" "Language-Team: Russian\n" @@ -32,35 +32,35 @@ msgstr "" msgid " - Point your phones to: " msgstr "" -#: Endpointman.class.php:2562 +#: Endpointman.class.php:2870 msgid "- Copied %_FILE_% to %_FILETO_%." msgstr "" -#: Endpointman.class.php:2775 +#: Endpointman.class.php:3085 msgid "- Error Moving %_FILENAME_%!" msgstr "" -#: Endpointman.class.php:2558 +#: Endpointman.class.php:2866 msgid "- Failed To Copy %_FILE_%!" msgstr "" -#: Endpointman.class.php:2829 +#: Endpointman.class.php:3141 msgid "-- Updating Model Lines................" msgstr "" -#: Endpointman.class.php:2840 +#: Endpointman.class.php:3152 msgid "----Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:2935 +#: Endpointman.class.php:3247 msgid "---Inserting Model %_NAMEMOD_%" msgstr "" -#: Endpointman.class.php:2931 +#: Endpointman.class.php:3243 msgid "---Updating Model %_NAMEMOD_%" msgstr "" -#: Endpointman.class.php:2270 Endpointman.class.php:2296 +#: Endpointman.class.php:2574 Endpointman.class.php:2600 msgid "" "Click Here!" @@ -70,7 +70,7 @@ msgstr "" msgid "ARP Executable Path" msgstr "" -#: Endpointman.class.php:2294 Endpointman.class.php:2295 +#: Endpointman.class.php:2598 Endpointman.class.php:2599 msgid "" "Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" msgstr "" @@ -79,24 +79,27 @@ msgstr "" msgid "Access denied!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:33 +#: views/epm_advanced/oui_manager.views.grid.php:27 msgid "Actions" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:6 -#: views/epm_advanced/oui_manager.views.grid.php:8 +#: views/epm_advanced/oui_manager.views.grid.php:5 msgid "Add Custom OUI" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:81 +#: views/epm_advanced/oui_manager.views.new.modal.php:62 msgid "Add New" msgstr "" +#: Endpointman.class.php:933 +msgid "Add New Template OK!" +msgstr "" + #: page.epm_advanced.php:19 msgid "Advanced Settings" msgstr "" -#: Endpointman.class.php:2647 +#: Endpointman.class.php:2955 msgid "All Done!" msgstr "" @@ -108,7 +111,7 @@ msgstr "" msgid "Allow Saving Over Default Configuration Files" msgstr "" -#: Endpointman.class.php:2748 +#: Endpointman.class.php:3058 msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" msgstr "" @@ -116,8 +119,8 @@ msgstr "" msgid "Asterisk Executable Path" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:31 -#: views/epm_advanced/oui_manager.views.grid.php:56 +#: views/epm_advanced/oui_manager.views.grid.php:25 +#: views/epm_advanced/oui_manager.views.new.modal.php:36 #: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 msgid "Brand" msgstr "" @@ -126,7 +129,7 @@ msgstr "" msgid "Brand Package" msgstr "" -#: views/epm_advanced_manual_upload.page.php:125 +#: views/epm_advanced_manual_upload.page.php:90 msgid "Brand's Available" msgstr "" @@ -138,24 +141,24 @@ msgstr "" msgid "CSV File Format" msgstr "" -#: Endpointman.class.php:1196 Endpointman.class.php:1273 -#: Endpointman.class.php:1432 +#: Endpointman.class.php:1498 Endpointman.class.php:1575 +#: Endpointman.class.php:1734 msgid "Can Not Find Uploaded Files!" msgstr "" -#: Endpointman.class.php:2720 +#: Endpointman.class.php:3030 msgid "Can't Find Downloaded File!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:80 +#: views/epm_advanced/oui_manager.views.new.modal.php:61 msgid "Cancel" msgstr "" -#: Endpointman.class.php:2175 +#: Endpointman.class.php:2478 msgid "Cant find file:" msgstr "" -#: Endpointman.class.php:226 +#: Endpointman.class.php:279 msgid "Check Online " msgstr "" @@ -163,43 +166,52 @@ msgstr "" msgid "Check for Update" msgstr "" -#: Endpointman.class.php:225 +#: Endpointman.class.php:278 msgid "Check for Update " msgstr "" -#: Endpointman.class.php:241 +#: Endpointman.class.php:294 msgid "Check for Updates..." msgstr "" -#: Endpointman.class.php:242 +#: Endpointman.class.php:295 msgid "Check for Updates... Ok!" msgstr "" -#: Endpointman.class.php:2542 +#: Endpointman.class.php:2850 msgid "Checking MD5sum of Package..." msgstr "" -#: Endpointman.class.php:2705 +#: Endpointman.class.php:3013 msgid "Checking MD5sum of Package...." msgstr "" -#: Endpointman.class.php:1394 +#: Endpointman.class.php:1696 msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:274 Endpointman.class.php:292 -#: Endpointman.class.php:320 Endpointman.class.php:348 -#: Endpointman.class.php:357 Endpointman.class.php:387 +#: Endpointman.class.php:916 +msgid "Clone Model is not number!" +msgstr "" + +#: Endpointman.class.php:919 +msgid "Clone Model send is negative!" +msgstr "" + +#: Endpointman.class.php:265 Endpointman.class.php:327 +#: Endpointman.class.php:345 Endpointman.class.php:373 +#: Endpointman.class.php:401 Endpointman.class.php:410 +#: Endpointman.class.php:440 Endpointman.class.php:453 msgid "Command not found!" msgstr "" -#: Endpointman.class.php:146 +#: Endpointman.class.php:147 msgid "" "Configuration Directory is not a directory or does not exist! Please change " "the location here:" msgstr "" -#: Endpointman.class.php:138 +#: Endpointman.class.php:139 msgid "Configuration Directory is not writable!" msgstr "" @@ -211,27 +223,31 @@ msgstr "" msgid "Connectivity" msgstr "Подключения" -#: Endpointman.class.php:2574 +#: Endpointman.class.php:2882 msgid "Copy Error Detected! Aborting Install!" msgstr "" -#: Endpointman.class.php:2756 +#: Endpointman.class.php:3066 msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." msgstr "" -#: Endpointman.class.php:2681 +#: Endpointman.class.php:2989 msgid "Creating EPM temp directory" msgstr "" -#: Endpointman.class.php:1222 +#: Endpointman.class.php:1524 msgid "Creating EPM temp directory..." msgstr "" -#: Endpointman.class.php:1300 +#: Endpointman.class.php:1602 msgid "Creating Provisioner Directory..." msgstr "" -#: views/epm_advanced_poce.page.php:28 +#: Endpointman.class.php:598 +msgid "Current Templates" +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:19 msgid "Custom Template Files" msgstr "" @@ -239,20 +255,32 @@ msgstr "" msgid "Default Mirror FreePBX" msgstr "" -#: views/epm_advanced_poce.page.php:84 +#: views/epm_advanced/poce.views.textarea.file.php:36 msgid "Delete" msgstr "" +#: Endpointman.class.php:889 +msgid "Delete Template OK!" +msgstr "" + #: views/epm_advanced_settings.page.php:56 #: views/epm_advanced_settings.page.php:191 msgid "Determine for Me" msgstr "" -#: Endpointman.class.php:1663 +#: Endpointman.class.php:588 +msgid "Devices" +msgstr "" + +#: Endpointman.class.php:1965 msgid "Directory Not Writable!" msgstr "" -#: Endpointman.class.php:234 +#: Endpointman.class.php:1490 +msgid "Directory no exists: " +msgstr "" + +#: Endpointman.class.php:287 msgid "Disable" msgstr "" @@ -268,18 +296,18 @@ msgstr "" msgid "Disable Tooltips" msgstr "" -#: Endpointman.class.php:1224 Endpointman.class.php:1238 -#: Endpointman.class.php:1297 Endpointman.class.php:1302 -#: Endpointman.class.php:1317 Endpointman.class.php:1393 -#: Endpointman.class.php:1488 Endpointman.class.php:2526 -#: Endpointman.class.php:2538 Endpointman.class.php:2579 -#: Endpointman.class.php:2611 Endpointman.class.php:2665 -#: Endpointman.class.php:2693 Endpointman.class.php:2700 -#: Endpointman.class.php:2707 Endpointman.class.php:2711 -#: Endpointman.class.php:2782 Endpointman.class.php:2860 -#: Endpointman.class.php:2896 Endpointman.class.php:2925 -#: Endpointman.class.php:2967 Endpointman.class.php:2978 -#: Endpointman.class.php:2988 +#: Endpointman.class.php:1526 Endpointman.class.php:1540 +#: Endpointman.class.php:1599 Endpointman.class.php:1604 +#: Endpointman.class.php:1619 Endpointman.class.php:1695 +#: Endpointman.class.php:1790 Endpointman.class.php:2834 +#: Endpointman.class.php:2846 Endpointman.class.php:2887 +#: Endpointman.class.php:2919 Endpointman.class.php:2973 +#: Endpointman.class.php:3001 Endpointman.class.php:3008 +#: Endpointman.class.php:3015 Endpointman.class.php:3019 +#: Endpointman.class.php:3092 Endpointman.class.php:3172 +#: Endpointman.class.php:3208 Endpointman.class.php:3237 +#: Endpointman.class.php:3284 Endpointman.class.php:3295 +#: Endpointman.class.php:3305 msgid "Done!" msgstr "" @@ -287,27 +315,23 @@ msgstr "" msgid "Download updated releases from " msgstr "" -#: Endpointman.class.php:2689 +#: Endpointman.class.php:2997 msgid "Downloading Brand JSON....." msgstr "" -#: Endpointman.class.php:2698 +#: Endpointman.class.php:3006 msgid "Downloading Brand Package..." msgstr "" -#: Endpointman.class.php:2520 Endpointman.class.php:2532 +#: Endpointman.class.php:2828 Endpointman.class.php:2840 msgid "Downloading firmware..." msgstr "" -#: Endpointman.class.php:594 +#: Endpointman.class.php:688 msgid "Dropping all relevant tables" msgstr "" -#: views/epm_advanced_manual_upload.page.php:177 -msgid "Empty list." -msgstr "" - -#: Endpointman.class.php:233 +#: Endpointman.class.php:286 msgid "Enable" msgstr "" @@ -339,35 +363,35 @@ msgstr "" msgid "Error 500 Internal Server Error" msgstr "" -#: Endpointman.class.php:2726 +#: Endpointman.class.php:3036 msgid "" "Error Connecting to the Package Repository. Module not installed. Please Try " "again later." msgstr "" -#: Endpointman.class.php:2683 +#: Endpointman.class.php:2991 msgid "Error creating directory: %_DIR_%" msgstr "" -#: Endpointman.class.php:2723 +#: Endpointman.class.php:3033 msgid "Error download Brand package!" msgstr "" -#: Endpointman.class.php:2523 Endpointman.class.php:2535 +#: Endpointman.class.php:2831 Endpointman.class.php:2843 msgid "Error download frimware package!" msgstr "" -#: Endpointman.class.php:236 Endpointman.class.php:253 -#: Endpointman.class.php:305 Endpointman.class.php:1227 -#: Endpointman.class.php:1305 +#: Endpointman.class.php:289 Endpointman.class.php:306 +#: Endpointman.class.php:358 Endpointman.class.php:1529 +#: Endpointman.class.php:1607 msgid "Error!" msgstr "" -#: Endpointman.class.php:1784 Endpointman.class.php:1821 +#: Endpointman.class.php:2086 Endpointman.class.php:2123 msgid "Error: Command not found!" msgstr "" -#: Endpointman.class.php:2268 +#: Endpointman.class.php:2572 msgid "Error: No Local File for %_name_% !" msgstr "" @@ -379,16 +403,16 @@ msgstr "" msgid "Experimental" msgstr "" -#: views/epm_advanced_manual_upload.page.php:157 +#: views/epm_advanced_manual_upload.page.php:122 msgid "Explor a package brand's availables." msgstr "" #: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:146 +#: views/epm_advanced_manual_upload.page.php:109 msgid "Export" msgstr "" -#: views/epm_advanced_manual_upload.page.php:114 +#: views/epm_advanced_manual_upload.page.php:79 msgid "Export Brand Packages" msgstr "" @@ -404,7 +428,7 @@ msgstr "" msgid "Export data configuracion devices." msgstr "" -#: Endpointman.class.php:1384 +#: Endpointman.class.php:1686 msgid "Exporting %_NAME_%" msgstr "" @@ -412,19 +436,19 @@ msgstr "" msgid "Extension" msgstr "" -#: Endpointman.class.php:1295 +#: Endpointman.class.php:1597 msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:1233 +#: Endpointman.class.php:1535 msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" msgstr "" -#: Endpointman.class.php:2709 +#: Endpointman.class.php:3017 msgid "Extracting Tarball........" msgstr "" -#: Endpointman.class.php:1235 +#: Endpointman.class.php:1537 msgid "Extracting Tarball........ " msgstr "" @@ -432,11 +456,11 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3464 +#: Endpointman.class.php:3781 msgid "Failed to write file to disk" msgstr "" -#: Endpointman.class.php:1450 +#: Endpointman.class.php:1752 msgid "File %_FILE_% size is 0!" msgstr "" @@ -444,7 +468,7 @@ msgstr "" msgid "File (TFTP/FTP)" msgstr "" -#: Endpointman.class.php:1321 +#: Endpointman.class.php:1623 msgid "File Temp no Exists!" msgstr "" @@ -452,23 +476,23 @@ msgstr "" msgid "File not Found!" msgstr "" -#: Endpointman.class.php:946 +#: Endpointman.class.php:1197 msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3466 +#: Endpointman.class.php:3783 msgid "File upload stopped by extension" msgstr "" -#: Endpointman.class.php:2583 +#: Endpointman.class.php:2891 msgid "Firmware MD5 didn't match!" msgstr "" -#: Endpointman.class.php:2812 +#: Endpointman.class.php:3122 msgid "Firmware Requirment Detected!.........." msgstr "" -#: views/epm_advanced_poce.page.php:71 +#: views/epm_advanced/poce.views.textarea.file.php:23 msgid "Full Screen F11" msgstr "" @@ -476,7 +500,11 @@ msgstr "" msgid "GIT Branch" msgstr "" -#: Endpointman.class.php:1645 views/epm_advanced_settings.page.php:23 +#: Endpointman.class.php:963 +msgid "Generate list Ok!" +msgstr "" + +#: Endpointman.class.php:1947 views/epm_advanced_settings.page.php:23 msgid "Git not installed!" msgstr "" @@ -484,40 +512,53 @@ msgstr "" msgid "Global Final Config & Firmware Directory" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "Heads up!" msgstr "" -#: Endpointman.class.php:139 Endpointman.class.php:146 -#: Endpointman.class.php:1396 +#: Endpointman.class.php:140 Endpointman.class.php:147 +#: Endpointman.class.php:1698 msgid "Here" msgstr "" -#: Endpointman.class.php:251 +#: Endpointman.class.php:304 msgid "Hide" msgstr "" -#: Endpointman.class.php:1533 +#: Endpointman.class.php:1835 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:660 +#: Endpointman.class.php:763 msgid "ID Brand not is numbre" msgstr "" -#: Endpointman.class.php:1381 +#: Endpointman.class.php:1683 msgid "ID Package send not valid, brand not exist!" msgstr "" -#: Endpointman.class.php:645 +#: Endpointman.class.php:748 msgid "ID Producto not is number" msgstr "" -#: Endpointman.class.php:1842 Endpointman.class.php:1976 +#: Endpointman.class.php:876 +msgid "ID is not number!" +msgstr "" + +#: Endpointman.class.php:879 +msgid "ID send is negative!" +msgstr "" + +#: Endpointman.class.php:945 Endpointman.class.php:2144 +#: Endpointman.class.php:2279 msgid "ID send is not number!" msgstr "" -#: Endpointman.class.php:1861 Endpointman.class.php:1999 +#: Endpointman.class.php:948 +msgid "ID send is number not valid!" +msgstr "" + +#: Endpointman.class.php:2163 Endpointman.class.php:2302 msgid "IDType invalid: " msgstr "" @@ -525,24 +566,24 @@ msgstr "" msgid "IP address of phone server" msgstr "" -#: Endpointman.class.php:220 +#: Endpointman.class.php:273 msgid "" "If we can activate the model set terminals of the models.
      If this " "model is disabled will not appear in the list of models that can be " "configured for PBX." msgstr "" -#: Endpointman.class.php:248 +#: Endpointman.class.php:301 msgid "" "If you select Hide disappear all models of the product selected from the " "Install/Uninstall list." msgstr "" -#: Endpointman.class.php:249 +#: Endpointman.class.php:302 msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" -#: Endpointman.class.php:247 +#: Endpointman.class.php:300 msgid "" "If you select Hide this brand will disappear and all products and models on " "the list of Install/Uninstall." @@ -574,92 +615,96 @@ msgstr "" msgid "Import a package brand in manual mode." msgstr "" -#: Endpointman.class.php:551 +#: Endpointman.class.php:638 msgid "Import/Export My Devices List" msgstr "" -#: Endpointman.class.php:1439 +#: Endpointman.class.php:1741 msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1278 +#: Endpointman.class.php:1580 msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1201 +#: Endpointman.class.php:1503 msgid "Importing brand file %_FILE_%..." msgstr "" -#: Endpointman.class.php:2796 +#: Endpointman.class.php:3106 msgid "Inserting %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:227 +#: Endpointman.class.php:280 msgid "Install" msgstr "" -#: Endpointman.class.php:230 +#: Endpointman.class.php:283 msgid "Install Firmware" msgstr "" -#: Endpointman.class.php:525 +#: Endpointman.class.php:612 msgid "Install/Unistall" msgstr "" -#: Endpointman.class.php:2551 +#: Endpointman.class.php:2859 msgid "Installing Firmware..." msgstr "" -#: Endpointman.class.php:2731 +#: Endpointman.class.php:3041 msgid "Installing brands is disabled while in repo mode!" msgstr "" -#: Endpointman.class.php:1496 +#: Endpointman.class.php:1798 msgid "Invalid Brand Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1490 +#: Endpointman.class.php:1792 msgid "Invalid Extension Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1263 Endpointman.class.php:1324 +#: Endpointman.class.php:1565 Endpointman.class.php:1626 msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:2980 +#: Endpointman.class.php:3297 msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3250 +#: Endpointman.class.php:3567 msgid "Invalid MAC Address" msgstr "" -#: Endpointman.class.php:1499 +#: Endpointman.class.php:1801 msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3245 +#: Endpointman.class.php:3562 msgid "Invalid Model Selected, Can't Sync System" msgstr "" -#: Endpointman.class.php:1493 +#: Endpointman.class.php:1795 msgid "Invalid Model Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:244 Endpointman.class.php:258 -#: Endpointman.class.php:308 +#: Endpointman.class.php:297 Endpointman.class.php:311 +#: Endpointman.class.php:361 msgid "Invalid Option!" msgstr "" -#: Endpointman.class.php:1967 +#: Endpointman.class.php:2270 msgid "Invalid Value!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:117 +#: views/epm_advanced/oui_manager.views.new.modal.php:55 +msgid "It is the brand of OUI we specified." +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:82 msgid "Learn how to create your own brand package at " msgstr "" -#: Endpointman.class.php:2269 +#: Endpointman.class.php:2573 msgid "Learn how to manually upload packages here (it's easy!):" msgstr "" @@ -667,19 +712,27 @@ msgstr "" msgid "Line" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "List Bran's Availables empty." msgstr "" +#: Endpointman.class.php:1481 +msgid "List Done!" +msgstr "" + #: views/epm_config_manager.page.php:19 msgid "List Packages Manager" msgstr "" -#: views/epm_advanced_manual_upload.page.php:168 +#: views/epm_advanced/poce.views.bootnav.php:5 +msgid "List Product's Empty" +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:133 msgid "List of other exports" msgstr "" -#: views/epm_advanced_manual_upload.page.php:209 +#: views/epm_advanced_manual_upload.page.php:152 msgid "List packages generated in other exports." msgstr "" @@ -687,11 +740,15 @@ msgstr "" msgid "Loading data...." msgstr "" -#: assets/js/epm_global.js:86 +#: assets/js/epm_global.js:117 msgid "Loading.." msgstr "" -#: views/epm_advanced_poce.page.php:16 +#: views/epm_advanced_manual_upload.page.php:140 +msgid "Loading..." +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:7 msgid "Local File Configs" msgstr "" @@ -699,11 +756,11 @@ msgstr "" msgid "Local Paths" msgstr "" -#: Endpointman.class.php:1246 +#: Endpointman.class.php:1548 msgid "Looking file and update brand's...." msgstr "" -#: Endpointman.class.php:1244 +#: Endpointman.class.php:1546 msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." msgstr "" @@ -711,23 +768,31 @@ msgstr "" msgid "MAC Address" msgstr "" -#: Endpointman.class.php:2717 +#: Endpointman.class.php:3025 msgid "MD5 Did not match!" msgstr "" -#: Endpointman.class.php:2163 +#: Endpointman.class.php:3027 +msgid "MD5 PKG: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:3026 +msgid "MD5 XML: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:2466 msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "" -#: Endpointman.class.php:2544 +#: Endpointman.class.php:2852 msgid "Matches!" msgstr "" -#: Endpointman.class.php:2151 +#: Endpointman.class.php:2454 msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3462 +#: Endpointman.class.php:3779 msgid "Missing a temporary folder" msgstr "" @@ -735,7 +800,7 @@ msgstr "" msgid "Model" msgstr "" -#: Endpointman.class.php:2950 +#: Endpointman.class.php:3267 msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" msgstr "" @@ -743,31 +808,31 @@ msgstr "" msgid "NMAP Executable Path" msgstr "" -#: views/epm_advanced_poce.page.php:90 +#: views/epm_advanced/poce.views.textarea.file.php:42 msgid "" "NOTE: File is permanently saved and not over-written during next package " "update." msgstr "" -#: views/epm_advanced_poce.page.php:80 +#: views/epm_advanced/poce.views.textarea.file.php:32 msgid "" "NOTE: File may be over-written during next package update. We suggest also " "using the Share button below to improve the next release." msgstr "" -#: views/epm_advanced_poce.page.php:74 +#: views/epm_advanced/poce.views.textarea.file.php:26 msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." msgstr "" -#: Endpointman.class.php:1725 +#: Endpointman.class.php:2027 msgid "Name invalid: " msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:61 -msgid "New OUI" +#: Endpointman.class.php:901 +msgid "Name is null!" msgstr "" -#: Endpointman.class.php:223 +#: Endpointman.class.php:276 msgid "New Package Modified" msgstr "" @@ -782,133 +847,154 @@ msgstr "" msgid "No" msgstr "" -#: Endpointman.class.php:2983 +#: Endpointman.class.php:3300 msgid "No 'brand_data.xml' file exists!" msgstr "" -#: Endpointman.class.php:1555 +#: Endpointman.class.php:1857 msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:1669 +#: Endpointman.class.php:1971 msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3283 Endpointman.class.php:3301 +#: Endpointman.class.php:3600 Endpointman.class.php:3618 msgid "No Devices/Extensions Left to Add" msgstr "" -#: Endpointman.class.php:1258 +#: Endpointman.class.php:1560 msgid "No File Provided!" msgstr "" -#: Endpointman.class.php:1530 +#: Endpointman.class.php:1832 msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3287 Endpointman.class.php:3305 +#: Endpointman.class.php:3604 Endpointman.class.php:3622 msgid "No Lines Left to Add" msgstr "" -#: Endpointman.class.php:1552 +#: Endpointman.class.php:1854 msgid "No OUI set!" msgstr "" -#: views/epm_advanced_poce.page.php:53 views/epm_advanced_poce.page.php:72 +#: views/epm_advanced/poce.views.textarea.file.php:5 +#: views/epm_advanced/poce.views.textarea.file.php:24 msgid "No Selected" msgstr "" -#: Endpointman.class.php:3460 +#: Endpointman.class.php:3777 msgid "No file was uploaded" msgstr "" -#: Endpointman.class.php:1369 +#: Endpointman.class.php:1671 msgid "No package set!" msgstr "" -#: Endpointman.class.php:884 +#: Endpointman.class.php:913 +msgid "No send Clone Model!" +msgstr "" + +#: Endpointman.class.php:1135 msgid "No send File ID!" msgstr "" -#: Endpointman.class.php:887 +#: Endpointman.class.php:1138 msgid "No send File Name!" msgstr "" -#: Endpointman.class.php:1066 +#: Endpointman.class.php:873 Endpointman.class.php:942 +msgid "No send ID!" +msgstr "" + +#: Endpointman.class.php:1314 msgid "No send Name File!" msgstr "" -#: Endpointman.class.php:1069 +#: Endpointman.class.php:898 +msgid "No send Name!" +msgstr "" + +#: Endpointman.class.php:1317 msgid "No send Origianl Name File!" msgstr "" -#: Endpointman.class.php:784 Endpointman.class.php:875 -#: Endpointman.class.php:1009 Endpointman.class.php:1051 -#: Endpointman.class.php:1145 +#: Endpointman.class.php:1035 Endpointman.class.php:1126 +#: Endpointman.class.php:1251 Endpointman.class.php:1299 +#: Endpointman.class.php:1393 msgid "No send Product Select!" msgstr "" -#: Endpointman.class.php:1151 +#: Endpointman.class.php:904 +msgid "No send Product!" +msgstr "" + +#: Endpointman.class.php:1399 msgid "No send SQL Select!" msgstr "" -#: Endpointman.class.php:1063 +#: Endpointman.class.php:1311 msgid "No send Save Name!" msgstr "" -#: Endpointman.class.php:1015 Endpointman.class.php:1054 +#: Endpointman.class.php:1257 Endpointman.class.php:1302 msgid "No send SendID!" msgstr "" -#: Endpointman.class.php:1060 +#: Endpointman.class.php:1308 msgid "No send Text File!" msgstr "" -#: Endpointman.class.php:890 Endpointman.class.php:1012 -#: Endpointman.class.php:1057 Endpointman.class.php:1148 +#: Endpointman.class.php:1141 Endpointman.class.php:1254 +#: Endpointman.class.php:1305 Endpointman.class.php:1396 msgid "No send Type File!" msgstr "" -#: Endpointman.class.php:1836 Endpointman.class.php:1970 +#: Endpointman.class.php:2138 Endpointman.class.php:2273 msgid "No send id!" msgstr "" -#: Endpointman.class.php:1839 Endpointman.class.php:1973 +#: Endpointman.class.php:2141 Endpointman.class.php:2276 msgid "No send idtype!" msgstr "" -#: Endpointman.class.php:1597 Endpointman.class.php:1830 -#: Endpointman.class.php:1960 +#: Endpointman.class.php:1899 Endpointman.class.php:2132 +#: Endpointman.class.php:2263 msgid "No send name!" msgstr "" -#: Endpointman.class.php:1600 Endpointman.class.php:1833 -#: Endpointman.class.php:1963 +#: Endpointman.class.php:1902 Endpointman.class.php:2135 +#: Endpointman.class.php:2266 msgid "No send value!" msgstr "" -#: Endpointman.class.php:1666 +#: Endpointman.class.php:1968 msgid "Not a Vaild Directory.
      Try to run 'mkdir " msgstr "" -#: Endpointman.class.php:2207 +#: Endpointman.class.php:2510 msgid "Not able to connect to repository. Using local Provisioner.net Package." msgstr "" -#: Endpointman.class.php:2237 +#: Endpointman.class.php:2540 msgid "" "Not able to connect to repository. Using local brand [%_brandname_%] file " "instead." msgstr "" -#: Endpointman.class.php:2192 +#: Endpointman.class.php:2495 msgid "Not able to connect to repository. Using local master file instead." msgstr "" -#: Endpointman.class.php:2668 +#: Endpointman.class.php:2976 msgid "Not allowed in repo mode!!" msgstr "" +#: Endpointman.class.php:1487 +msgid "Not is directory: " +msgstr "" + #: endpointman.i18n.php:18 msgid "OSS Endpoint Advanced Settings" msgstr "" @@ -940,28 +1026,32 @@ msgid "" "either of these and are encouraged." msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:30 -#: views/epm_advanced/oui_manager.views.grid.php:53 +#: views/epm_advanced/oui_manager.views.grid.php:24 +#: views/epm_advanced/oui_manager.views.new.modal.php:14 msgid "OUI" msgstr "" -#: Endpointman.class.php:543 +#: views/epm_advanced/oui_manager.views.new.modal.php:18 +msgid "OUI Brand" +msgstr "" + +#: Endpointman.class.php:630 msgid "OUI Manager" msgstr "" -#: Endpointman.class.php:2880 Endpointman.class.php:2905 +#: Endpointman.class.php:3192 Endpointman.class.php:3217 msgid "Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:140 +#: Endpointman.class.php:141 msgid "Or run this command on SSH:" msgstr "" -#: Endpointman.class.php:555 +#: Endpointman.class.php:642 msgid "Package Import/Export" msgstr "" -#: Endpointman.class.php:224 +#: Endpointman.class.php:277 msgid "Package Last Modified" msgstr "" @@ -973,94 +1063,103 @@ msgstr "" msgid "Package Server" msgstr "" -#: Endpointman.class.php:1372 +#: Endpointman.class.php:1674 msgid "Package not valid!" msgstr "" -#: Endpointman.class.php:2576 Endpointman.class.php:2684 +#: Endpointman.class.php:2884 Endpointman.class.php:2992 msgid "Please Check Directory/Permissions!" msgstr "" -#: Endpointman.class.php:139 +#: Endpointman.class.php:140 msgid "Please change the location:" msgstr "" -#: Endpointman.class.php:1253 +#: Endpointman.class.php:1555 msgid "Please name the Package the same name as your brand!" msgstr "" -#: Endpointman.class.php:1506 +#: Endpointman.class.php:1808 msgid "Please reboot & rebuild all imported phones" msgstr "" -#: Endpointman.class.php:1508 +#: Endpointman.class.php:1810 msgid "Possible file upload attack!" msgstr "" -#: Endpointman.class.php:2743 +#: Endpointman.class.php:3053 msgid "Processing %_PATH_%/brand_data.json..." msgstr "" -#: Endpointman.class.php:547 +#: Endpointman.class.php:634 msgid "Product Configuration Editor" msgstr "" -#: Endpointman.class.php:787 Endpointman.class.php:878 +#: Endpointman.class.php:1038 Endpointman.class.php:1129 msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:790 Endpointman.class.php:881 +#: Endpointman.class.php:1041 Endpointman.class.php:1132 msgid "Product Select send is number not valid!" msgstr "" +#: Endpointman.class.php:907 +msgid "Product is not number!" +msgstr "" + +#: Endpointman.class.php:910 +msgid "Product send is negative!" +msgstr "" + #: views/epm_advanced_manual_upload.page.php:24 msgid "Provisioner Package" msgstr "" -#: Endpointman.class.php:235 Endpointman.class.php:252 -#: Endpointman.class.php:256 +#: Endpointman.class.php:288 Endpointman.class.php:305 +#: Endpointman.class.php:309 msgid "Ready!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:13 +#: views/epm_advanced/oui_manager.views.grid.php:6 msgid "Refresh Table" msgstr "" -#: Endpointman.class.php:231 +#: Endpointman.class.php:284 msgid "Remove Firmware" msgstr "" -#: Endpointman.class.php:589 +#: Endpointman.class.php:676 msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:2986 +#: Endpointman.class.php:3303 msgid "Removing Temporary Files.............." msgstr "" -#: Endpointman.class.php:609 +#: Endpointman.class.php:680 msgid "Removing symlink to web provisioner" msgstr "" -#: views/epm_advanced_poce.page.php:83 +#: views/epm_advanced/poce.views.textarea.file.php:35 msgid "Save" msgstr "" -#: views/epm_advanced_poce.page.php:96 +#: views/epm_advanced/poce.views.textarea.file.php:48 msgid "Save As..." msgstr "" -#: Endpointman.class.php:238 Endpointman.class.php:254 -#: Endpointman.class.php:306 +#: Endpointman.class.php:291 Endpointman.class.php:307 +#: Endpointman.class.php:359 msgid "Saving Changes..." msgstr "" -#: Endpointman.class.php:239 Endpointman.class.php:255 -#: Endpointman.class.php:307 +#: Endpointman.class.php:292 Endpointman.class.php:308 +#: Endpointman.class.php:360 msgid "Saving Changes... Ok!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:137 +#: views/epm_advanced/oui_manager.views.new.modal.php:41 +#: views/epm_advanced_manual_upload.page.php:101 msgid "Select Brand:" msgstr "" @@ -1073,23 +1172,23 @@ msgstr "" msgid "Setting Provision" msgstr "" -#: Endpointman.class.php:539 +#: Endpointman.class.php:626 msgid "Settings" msgstr "" -#: views/epm_advanced_poce.page.php:107 +#: views/epm_advanced/poce.views.textarea.file.php:59 msgid "Share" msgstr "" -#: Endpointman.class.php:250 +#: Endpointman.class.php:303 msgid "Show" msgstr "" -#: Endpointman.class.php:529 +#: Endpointman.class.php:616 msgid "Show/Hide" msgstr "" -#: Endpointman.class.php:2516 +#: Endpointman.class.php:2824 msgid "Skipping download..." msgstr "" @@ -1097,15 +1196,15 @@ msgstr "" msgid "Structure" msgstr "" -#: Endpointman.class.php:2160 +#: Endpointman.class.php:2463 msgid "Syntax error, malformed JSON" msgstr "" -#: Endpointman.class.php:2941 +#: Endpointman.class.php:3253 msgid "System Error in Sync Model Function, Load Failure!" msgstr "" -#: Endpointman.class.php:2379 +#: Endpointman.class.php:2683 msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" msgstr "" @@ -1113,11 +1212,15 @@ msgstr "" msgid "System Failure!" msgstr "" -#: Endpointman.class.php:298 Endpointman.class.php:393 +#: Endpointman.class.php:351 Endpointman.class.php:458 msgid "Tab is not valid!" msgstr "" -#: Endpointman.class.php:222 +#: Endpointman.class.php:602 +msgid "Template Editor" +msgstr "" + +#: Endpointman.class.php:275 msgid "" "The \"Install\" button installs the configuration package brand models we " "selected.
      The \"Uninstall\" button removes the package configuration " @@ -1126,13 +1229,13 @@ msgid "" "version is detected." msgstr "" -#: Endpointman.class.php:2303 +#: Endpointman.class.php:2607 msgid "" "The Remote Server Is Currently Syncing With the Master Server, Please try " "again later" msgstr "" -#: Endpointman.class.php:221 +#: Endpointman.class.php:274 msgid "" "The button \"Install Firmware\" installs the necessary files to the server " "for the terminal alone are updated via TFTP or HTTP.
      The button " @@ -1142,24 +1245,30 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3456 +#: Endpointman.class.php:3773 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3454 +#: Endpointman.class.php:3771 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3458 +#: Endpointman.class.php:3775 msgid "The uploaded file was only partially uploaded" msgstr "" -#: Endpointman.class.php:2728 +#: Endpointman.class.php:3038 msgid "Then Use Manual Upload in Advanced Settings." msgstr "" +#: views/epm_advanced/oui_manager.views.new.modal.php:26 +msgid "" +"They are the first 6 characters of the MAC device that identifies the brand " +"(manufacturer)." +msgstr "" + #: views/epm_advanced_settings.page.php:134 msgid "Time" msgstr "" @@ -1176,59 +1285,59 @@ msgstr "" msgid "TimeZone by PBX Setting" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:32 +#: views/epm_advanced/oui_manager.views.grid.php:26 msgid "Type" msgstr "" -#: Endpointman.class.php:1164 +#: Endpointman.class.php:1412 msgid "Type File not valid!" msgstr "" -#: Endpointman.class.php:2154 +#: Endpointman.class.php:2457 msgid "Underflow or the modes mismatch" msgstr "" -#: Endpointman.class.php:2157 +#: Endpointman.class.php:2460 msgid "Unexpected control character found" msgstr "" -#: Endpointman.class.php:228 +#: Endpointman.class.php:281 msgid "Uninstall" msgstr "" -#: Endpointman.class.php:2619 +#: Endpointman.class.php:2927 msgid "Uninstalla Brand..." msgstr "" -#: Endpointman.class.php:2596 +#: Endpointman.class.php:2904 msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3600 +#: Endpointman.class.php:3917 msgid "Unknown" msgstr "" -#: Endpointman.class.php:2166 +#: Endpointman.class.php:2469 msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3468 +#: Endpointman.class.php:3785 msgid "Unknown upload error" msgstr "" -#: Endpointman.class.php:229 +#: Endpointman.class.php:282 msgid "Update" msgstr "" -#: Endpointman.class.php:243 +#: Endpointman.class.php:296 msgid "Update Content..." msgstr "" -#: Endpointman.class.php:232 +#: Endpointman.class.php:285 msgid "Update Firmware" msgstr "" -#: Endpointman.class.php:237 +#: Endpointman.class.php:290 msgid "Update!" msgstr "" @@ -1236,27 +1345,27 @@ msgstr "" msgid "Updated!" msgstr "" -#: Endpointman.class.php:2792 +#: Endpointman.class.php:3102 msgid "Updating %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:2803 +#: Endpointman.class.php:3113 msgid "Updating Family Lines................." msgstr "" -#: Endpointman.class.php:1314 +#: Endpointman.class.php:1616 msgid "Updating Last Modified..." msgstr "" -#: Endpointman.class.php:2968 +#: Endpointman.class.php:3285 msgid "Updating OUI list in DB" msgstr "" -#: Endpointman.class.php:240 Endpointman.class.php:257 +#: Endpointman.class.php:293 Endpointman.class.php:310 msgid "Upload Content!" msgstr "" -#: views/epm_advanced_poce.page.php:104 +#: views/epm_advanced/poce.views.textarea.file.php:56 msgid "" "Upload this configuration file to the Provisioner.net Team. Files " "shared are confidential and help improve the quality of releases." @@ -1266,7 +1375,7 @@ msgstr "" msgid "Use GITHUB Live Repo" msgstr "" -#: views/epm_advanced_poce.page.php:39 +#: views/epm_advanced/poce.views.button.up.files.php:31 msgid "User File Configs" msgstr "" @@ -1275,7 +1384,7 @@ msgid "" "Warning: The extensions need to be added into FreePBX before you import." msgstr "" -#: Endpointman.class.php:1447 +#: Endpointman.class.php:1749 msgid "We support only CVS and TXT files, type file %_FILE_% no support!" msgstr "" @@ -1298,29 +1407,29 @@ msgstr "" msgid "Yes" msgstr "" -#: Endpointman.class.php:2727 +#: Endpointman.class.php:3037 msgid "" "You Can Also Manually Update The Repository By Downloading Files here: %" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3182 +#: Endpointman.class.php:3499 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3185 +#: Endpointman.class.php:3502 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4575 +#: Endpointman.class.php:4945 msgid "You can't remove the only line left" msgstr "" -#: Endpointman.class.php:2587 +#: Endpointman.class.php:2895 msgid "Your Firmware is already up to date" msgstr "" -#: Endpointman.class.php:1709 +#: Endpointman.class.php:2011 msgid "Your permissions are wrong on " msgstr "" @@ -1333,7 +1442,7 @@ msgstr "" msgid "is required" msgstr "" -#: Endpointman.class.php:2740 +#: Endpointman.class.php:3050 msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" msgstr "" diff --git a/i18n/zh_CN/LC_MESSAGES/endpointman.mo b/i18n/zh_CN/LC_MESSAGES/endpointman.mo index 7aa26ddcb5ff243c3c2b0a9c3695b0e10ea79c0c..2288cda57d31b405c57c205f739e33f971e68ea5 100644 GIT binary patch delta 20 ccmZ3&yo7neb}nOG17ih411l4gi3cA806`uGy8r+H delta 20 ccmZ3&yo7neb}l1bBVz?aV=H5ei3cA806|9v!TClick Here!" @@ -60,7 +60,7 @@ msgstr "" msgid "ARP Executable Path" msgstr "" -#: Endpointman.class.php:2294 Endpointman.class.php:2295 +#: Endpointman.class.php:2598 Endpointman.class.php:2599 msgid "" "Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" msgstr "" @@ -69,24 +69,27 @@ msgstr "" msgid "Access denied!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:33 +#: views/epm_advanced/oui_manager.views.grid.php:27 msgid "Actions" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:6 -#: views/epm_advanced/oui_manager.views.grid.php:8 +#: views/epm_advanced/oui_manager.views.grid.php:5 msgid "Add Custom OUI" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:81 +#: views/epm_advanced/oui_manager.views.new.modal.php:62 msgid "Add New" msgstr "" +#: Endpointman.class.php:933 +msgid "Add New Template OK!" +msgstr "" + #: page.epm_advanced.php:19 msgid "Advanced Settings" msgstr "" -#: Endpointman.class.php:2647 +#: Endpointman.class.php:2955 msgid "All Done!" msgstr "" @@ -98,7 +101,7 @@ msgstr "" msgid "Allow Saving Over Default Configuration Files" msgstr "" -#: Endpointman.class.php:2748 +#: Endpointman.class.php:3058 msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" msgstr "" @@ -106,8 +109,8 @@ msgstr "" msgid "Asterisk Executable Path" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:31 -#: views/epm_advanced/oui_manager.views.grid.php:56 +#: views/epm_advanced/oui_manager.views.grid.php:25 +#: views/epm_advanced/oui_manager.views.new.modal.php:36 #: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 msgid "Brand" msgstr "" @@ -116,7 +119,7 @@ msgstr "" msgid "Brand Package" msgstr "" -#: views/epm_advanced_manual_upload.page.php:125 +#: views/epm_advanced_manual_upload.page.php:90 msgid "Brand's Available" msgstr "" @@ -128,24 +131,24 @@ msgstr "" msgid "CSV File Format" msgstr "" -#: Endpointman.class.php:1196 Endpointman.class.php:1273 -#: Endpointman.class.php:1432 +#: Endpointman.class.php:1498 Endpointman.class.php:1575 +#: Endpointman.class.php:1734 msgid "Can Not Find Uploaded Files!" msgstr "" -#: Endpointman.class.php:2720 +#: Endpointman.class.php:3030 msgid "Can't Find Downloaded File!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:80 +#: views/epm_advanced/oui_manager.views.new.modal.php:61 msgid "Cancel" msgstr "" -#: Endpointman.class.php:2175 +#: Endpointman.class.php:2478 msgid "Cant find file:" msgstr "" -#: Endpointman.class.php:226 +#: Endpointman.class.php:279 msgid "Check Online " msgstr "" @@ -153,43 +156,52 @@ msgstr "" msgid "Check for Update" msgstr "" -#: Endpointman.class.php:225 +#: Endpointman.class.php:278 msgid "Check for Update " msgstr "" -#: Endpointman.class.php:241 +#: Endpointman.class.php:294 msgid "Check for Updates..." msgstr "" -#: Endpointman.class.php:242 +#: Endpointman.class.php:295 msgid "Check for Updates... Ok!" msgstr "" -#: Endpointman.class.php:2542 +#: Endpointman.class.php:2850 msgid "Checking MD5sum of Package..." msgstr "" -#: Endpointman.class.php:2705 +#: Endpointman.class.php:3013 msgid "Checking MD5sum of Package...." msgstr "" -#: Endpointman.class.php:1394 +#: Endpointman.class.php:1696 msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:274 Endpointman.class.php:292 -#: Endpointman.class.php:320 Endpointman.class.php:348 -#: Endpointman.class.php:357 Endpointman.class.php:387 +#: Endpointman.class.php:916 +msgid "Clone Model is not number!" +msgstr "" + +#: Endpointman.class.php:919 +msgid "Clone Model send is negative!" +msgstr "" + +#: Endpointman.class.php:265 Endpointman.class.php:327 +#: Endpointman.class.php:345 Endpointman.class.php:373 +#: Endpointman.class.php:401 Endpointman.class.php:410 +#: Endpointman.class.php:440 Endpointman.class.php:453 msgid "Command not found!" msgstr "" -#: Endpointman.class.php:146 +#: Endpointman.class.php:147 msgid "" "Configuration Directory is not a directory or does not exist! Please change " "the location here:" msgstr "" -#: Endpointman.class.php:138 +#: Endpointman.class.php:139 msgid "Configuration Directory is not writable!" msgstr "" @@ -201,27 +213,31 @@ msgstr "" msgid "Connectivity" msgstr "" -#: Endpointman.class.php:2574 +#: Endpointman.class.php:2882 msgid "Copy Error Detected! Aborting Install!" msgstr "" -#: Endpointman.class.php:2756 +#: Endpointman.class.php:3066 msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." msgstr "" -#: Endpointman.class.php:2681 +#: Endpointman.class.php:2989 msgid "Creating EPM temp directory" msgstr "" -#: Endpointman.class.php:1222 +#: Endpointman.class.php:1524 msgid "Creating EPM temp directory..." msgstr "" -#: Endpointman.class.php:1300 +#: Endpointman.class.php:1602 msgid "Creating Provisioner Directory..." msgstr "" -#: views/epm_advanced_poce.page.php:28 +#: Endpointman.class.php:598 +msgid "Current Templates" +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:19 msgid "Custom Template Files" msgstr "" @@ -229,20 +245,32 @@ msgstr "" msgid "Default Mirror FreePBX" msgstr "" -#: views/epm_advanced_poce.page.php:84 +#: views/epm_advanced/poce.views.textarea.file.php:36 msgid "Delete" msgstr "" +#: Endpointman.class.php:889 +msgid "Delete Template OK!" +msgstr "" + #: views/epm_advanced_settings.page.php:56 #: views/epm_advanced_settings.page.php:191 msgid "Determine for Me" msgstr "" -#: Endpointman.class.php:1663 +#: Endpointman.class.php:588 +msgid "Devices" +msgstr "" + +#: Endpointman.class.php:1965 msgid "Directory Not Writable!" msgstr "" -#: Endpointman.class.php:234 +#: Endpointman.class.php:1490 +msgid "Directory no exists: " +msgstr "" + +#: Endpointman.class.php:287 msgid "Disable" msgstr "" @@ -258,18 +286,18 @@ msgstr "" msgid "Disable Tooltips" msgstr "" -#: Endpointman.class.php:1224 Endpointman.class.php:1238 -#: Endpointman.class.php:1297 Endpointman.class.php:1302 -#: Endpointman.class.php:1317 Endpointman.class.php:1393 -#: Endpointman.class.php:1488 Endpointman.class.php:2526 -#: Endpointman.class.php:2538 Endpointman.class.php:2579 -#: Endpointman.class.php:2611 Endpointman.class.php:2665 -#: Endpointman.class.php:2693 Endpointman.class.php:2700 -#: Endpointman.class.php:2707 Endpointman.class.php:2711 -#: Endpointman.class.php:2782 Endpointman.class.php:2860 -#: Endpointman.class.php:2896 Endpointman.class.php:2925 -#: Endpointman.class.php:2967 Endpointman.class.php:2978 -#: Endpointman.class.php:2988 +#: Endpointman.class.php:1526 Endpointman.class.php:1540 +#: Endpointman.class.php:1599 Endpointman.class.php:1604 +#: Endpointman.class.php:1619 Endpointman.class.php:1695 +#: Endpointman.class.php:1790 Endpointman.class.php:2834 +#: Endpointman.class.php:2846 Endpointman.class.php:2887 +#: Endpointman.class.php:2919 Endpointman.class.php:2973 +#: Endpointman.class.php:3001 Endpointman.class.php:3008 +#: Endpointman.class.php:3015 Endpointman.class.php:3019 +#: Endpointman.class.php:3092 Endpointman.class.php:3172 +#: Endpointman.class.php:3208 Endpointman.class.php:3237 +#: Endpointman.class.php:3284 Endpointman.class.php:3295 +#: Endpointman.class.php:3305 msgid "Done!" msgstr "" @@ -277,27 +305,23 @@ msgstr "" msgid "Download updated releases from " msgstr "" -#: Endpointman.class.php:2689 +#: Endpointman.class.php:2997 msgid "Downloading Brand JSON....." msgstr "" -#: Endpointman.class.php:2698 +#: Endpointman.class.php:3006 msgid "Downloading Brand Package..." msgstr "" -#: Endpointman.class.php:2520 Endpointman.class.php:2532 +#: Endpointman.class.php:2828 Endpointman.class.php:2840 msgid "Downloading firmware..." msgstr "" -#: Endpointman.class.php:594 +#: Endpointman.class.php:688 msgid "Dropping all relevant tables" msgstr "" -#: views/epm_advanced_manual_upload.page.php:177 -msgid "Empty list." -msgstr "" - -#: Endpointman.class.php:233 +#: Endpointman.class.php:286 msgid "Enable" msgstr "" @@ -329,35 +353,35 @@ msgstr "" msgid "Error 500 Internal Server Error" msgstr "" -#: Endpointman.class.php:2726 +#: Endpointman.class.php:3036 msgid "" "Error Connecting to the Package Repository. Module not installed. Please Try " "again later." msgstr "" -#: Endpointman.class.php:2683 +#: Endpointman.class.php:2991 msgid "Error creating directory: %_DIR_%" msgstr "" -#: Endpointman.class.php:2723 +#: Endpointman.class.php:3033 msgid "Error download Brand package!" msgstr "" -#: Endpointman.class.php:2523 Endpointman.class.php:2535 +#: Endpointman.class.php:2831 Endpointman.class.php:2843 msgid "Error download frimware package!" msgstr "" -#: Endpointman.class.php:236 Endpointman.class.php:253 -#: Endpointman.class.php:305 Endpointman.class.php:1227 -#: Endpointman.class.php:1305 +#: Endpointman.class.php:289 Endpointman.class.php:306 +#: Endpointman.class.php:358 Endpointman.class.php:1529 +#: Endpointman.class.php:1607 msgid "Error!" msgstr "" -#: Endpointman.class.php:1784 Endpointman.class.php:1821 +#: Endpointman.class.php:2086 Endpointman.class.php:2123 msgid "Error: Command not found!" msgstr "" -#: Endpointman.class.php:2268 +#: Endpointman.class.php:2572 msgid "Error: No Local File for %_name_% !" msgstr "" @@ -369,16 +393,16 @@ msgstr "" msgid "Experimental" msgstr "" -#: views/epm_advanced_manual_upload.page.php:157 +#: views/epm_advanced_manual_upload.page.php:122 msgid "Explor a package brand's availables." msgstr "" #: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:146 +#: views/epm_advanced_manual_upload.page.php:109 msgid "Export" msgstr "" -#: views/epm_advanced_manual_upload.page.php:114 +#: views/epm_advanced_manual_upload.page.php:79 msgid "Export Brand Packages" msgstr "" @@ -394,7 +418,7 @@ msgstr "" msgid "Export data configuracion devices." msgstr "" -#: Endpointman.class.php:1384 +#: Endpointman.class.php:1686 msgid "Exporting %_NAME_%" msgstr "" @@ -402,19 +426,19 @@ msgstr "" msgid "Extension" msgstr "" -#: Endpointman.class.php:1295 +#: Endpointman.class.php:1597 msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:1233 +#: Endpointman.class.php:1535 msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" msgstr "" -#: Endpointman.class.php:2709 +#: Endpointman.class.php:3017 msgid "Extracting Tarball........" msgstr "" -#: Endpointman.class.php:1235 +#: Endpointman.class.php:1537 msgid "Extracting Tarball........ " msgstr "" @@ -422,11 +446,11 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3464 +#: Endpointman.class.php:3781 msgid "Failed to write file to disk" msgstr "" -#: Endpointman.class.php:1450 +#: Endpointman.class.php:1752 msgid "File %_FILE_% size is 0!" msgstr "" @@ -434,7 +458,7 @@ msgstr "" msgid "File (TFTP/FTP)" msgstr "" -#: Endpointman.class.php:1321 +#: Endpointman.class.php:1623 msgid "File Temp no Exists!" msgstr "" @@ -442,23 +466,23 @@ msgstr "" msgid "File not Found!" msgstr "" -#: Endpointman.class.php:946 +#: Endpointman.class.php:1197 msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3466 +#: Endpointman.class.php:3783 msgid "File upload stopped by extension" msgstr "" -#: Endpointman.class.php:2583 +#: Endpointman.class.php:2891 msgid "Firmware MD5 didn't match!" msgstr "" -#: Endpointman.class.php:2812 +#: Endpointman.class.php:3122 msgid "Firmware Requirment Detected!.........." msgstr "" -#: views/epm_advanced_poce.page.php:71 +#: views/epm_advanced/poce.views.textarea.file.php:23 msgid "Full Screen F11" msgstr "" @@ -466,7 +490,11 @@ msgstr "" msgid "GIT Branch" msgstr "" -#: Endpointman.class.php:1645 views/epm_advanced_settings.page.php:23 +#: Endpointman.class.php:963 +msgid "Generate list Ok!" +msgstr "" + +#: Endpointman.class.php:1947 views/epm_advanced_settings.page.php:23 msgid "Git not installed!" msgstr "" @@ -474,40 +502,53 @@ msgstr "" msgid "Global Final Config & Firmware Directory" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "Heads up!" msgstr "" -#: Endpointman.class.php:139 Endpointman.class.php:146 -#: Endpointman.class.php:1396 +#: Endpointman.class.php:140 Endpointman.class.php:147 +#: Endpointman.class.php:1698 msgid "Here" msgstr "" -#: Endpointman.class.php:251 +#: Endpointman.class.php:304 msgid "Hide" msgstr "" -#: Endpointman.class.php:1533 +#: Endpointman.class.php:1835 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:660 +#: Endpointman.class.php:763 msgid "ID Brand not is numbre" msgstr "" -#: Endpointman.class.php:1381 +#: Endpointman.class.php:1683 msgid "ID Package send not valid, brand not exist!" msgstr "" -#: Endpointman.class.php:645 +#: Endpointman.class.php:748 msgid "ID Producto not is number" msgstr "" -#: Endpointman.class.php:1842 Endpointman.class.php:1976 +#: Endpointman.class.php:876 +msgid "ID is not number!" +msgstr "" + +#: Endpointman.class.php:879 +msgid "ID send is negative!" +msgstr "" + +#: Endpointman.class.php:945 Endpointman.class.php:2144 +#: Endpointman.class.php:2279 msgid "ID send is not number!" msgstr "" -#: Endpointman.class.php:1861 Endpointman.class.php:1999 +#: Endpointman.class.php:948 +msgid "ID send is number not valid!" +msgstr "" + +#: Endpointman.class.php:2163 Endpointman.class.php:2302 msgid "IDType invalid: " msgstr "" @@ -515,24 +556,24 @@ msgstr "" msgid "IP address of phone server" msgstr "" -#: Endpointman.class.php:220 +#: Endpointman.class.php:273 msgid "" "If we can activate the model set terminals of the models.
      If this " "model is disabled will not appear in the list of models that can be " "configured for PBX." msgstr "" -#: Endpointman.class.php:248 +#: Endpointman.class.php:301 msgid "" "If you select Hide disappear all models of the product selected from the " "Install/Uninstall list." msgstr "" -#: Endpointman.class.php:249 +#: Endpointman.class.php:302 msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" -#: Endpointman.class.php:247 +#: Endpointman.class.php:300 msgid "" "If you select Hide this brand will disappear and all products and models on " "the list of Install/Uninstall." @@ -564,92 +605,96 @@ msgstr "" msgid "Import a package brand in manual mode." msgstr "" -#: Endpointman.class.php:551 +#: Endpointman.class.php:638 msgid "Import/Export My Devices List" msgstr "" -#: Endpointman.class.php:1439 +#: Endpointman.class.php:1741 msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1278 +#: Endpointman.class.php:1580 msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:1201 +#: Endpointman.class.php:1503 msgid "Importing brand file %_FILE_%..." msgstr "" -#: Endpointman.class.php:2796 +#: Endpointman.class.php:3106 msgid "Inserting %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:227 +#: Endpointman.class.php:280 msgid "Install" msgstr "" -#: Endpointman.class.php:230 +#: Endpointman.class.php:283 msgid "Install Firmware" msgstr "" -#: Endpointman.class.php:525 +#: Endpointman.class.php:612 msgid "Install/Unistall" msgstr "" -#: Endpointman.class.php:2551 +#: Endpointman.class.php:2859 msgid "Installing Firmware..." msgstr "" -#: Endpointman.class.php:2731 +#: Endpointman.class.php:3041 msgid "Installing brands is disabled while in repo mode!" msgstr "" -#: Endpointman.class.php:1496 +#: Endpointman.class.php:1798 msgid "Invalid Brand Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1490 +#: Endpointman.class.php:1792 msgid "Invalid Extension Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1263 Endpointman.class.php:1324 +#: Endpointman.class.php:1565 Endpointman.class.php:1626 msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:2980 +#: Endpointman.class.php:3297 msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3250 +#: Endpointman.class.php:3567 msgid "Invalid MAC Address" msgstr "" -#: Endpointman.class.php:1499 +#: Endpointman.class.php:1801 msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3245 +#: Endpointman.class.php:3562 msgid "Invalid Model Selected, Can't Sync System" msgstr "" -#: Endpointman.class.php:1493 +#: Endpointman.class.php:1795 msgid "Invalid Model Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:244 Endpointman.class.php:258 -#: Endpointman.class.php:308 +#: Endpointman.class.php:297 Endpointman.class.php:311 +#: Endpointman.class.php:361 msgid "Invalid Option!" msgstr "" -#: Endpointman.class.php:1967 +#: Endpointman.class.php:2270 msgid "Invalid Value!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:117 +#: views/epm_advanced/oui_manager.views.new.modal.php:55 +msgid "It is the brand of OUI we specified." +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:82 msgid "Learn how to create your own brand package at " msgstr "" -#: Endpointman.class.php:2269 +#: Endpointman.class.php:2573 msgid "Learn how to manually upload packages here (it's easy!):" msgstr "" @@ -657,19 +702,27 @@ msgstr "" msgid "Line" msgstr "" -#: views/epm_advanced_manual_upload.page.php:131 +#: views/epm_advanced_manual_upload.page.php:97 msgid "List Bran's Availables empty." msgstr "" +#: Endpointman.class.php:1481 +msgid "List Done!" +msgstr "" + #: views/epm_config_manager.page.php:19 msgid "List Packages Manager" msgstr "" -#: views/epm_advanced_manual_upload.page.php:168 +#: views/epm_advanced/poce.views.bootnav.php:5 +msgid "List Product's Empty" +msgstr "" + +#: views/epm_advanced_manual_upload.page.php:133 msgid "List of other exports" msgstr "" -#: views/epm_advanced_manual_upload.page.php:209 +#: views/epm_advanced_manual_upload.page.php:152 msgid "List packages generated in other exports." msgstr "" @@ -677,11 +730,15 @@ msgstr "" msgid "Loading data...." msgstr "" -#: assets/js/epm_global.js:86 +#: assets/js/epm_global.js:117 msgid "Loading.." msgstr "" -#: views/epm_advanced_poce.page.php:16 +#: views/epm_advanced_manual_upload.page.php:140 +msgid "Loading..." +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:7 msgid "Local File Configs" msgstr "" @@ -689,11 +746,11 @@ msgstr "" msgid "Local Paths" msgstr "" -#: Endpointman.class.php:1246 +#: Endpointman.class.php:1548 msgid "Looking file and update brand's...." msgstr "" -#: Endpointman.class.php:1244 +#: Endpointman.class.php:1546 msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." msgstr "" @@ -701,23 +758,31 @@ msgstr "" msgid "MAC Address" msgstr "" -#: Endpointman.class.php:2717 +#: Endpointman.class.php:3025 msgid "MD5 Did not match!" msgstr "" -#: Endpointman.class.php:2163 +#: Endpointman.class.php:3027 +msgid "MD5 PKG: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:3026 +msgid "MD5 XML: %_MD5_%" +msgstr "" + +#: Endpointman.class.php:2466 msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "" -#: Endpointman.class.php:2544 +#: Endpointman.class.php:2852 msgid "Matches!" msgstr "" -#: Endpointman.class.php:2151 +#: Endpointman.class.php:2454 msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3462 +#: Endpointman.class.php:3779 msgid "Missing a temporary folder" msgstr "" @@ -725,7 +790,7 @@ msgstr "" msgid "Model" msgstr "" -#: Endpointman.class.php:2950 +#: Endpointman.class.php:3267 msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" msgstr "" @@ -733,31 +798,31 @@ msgstr "" msgid "NMAP Executable Path" msgstr "" -#: views/epm_advanced_poce.page.php:90 +#: views/epm_advanced/poce.views.textarea.file.php:42 msgid "" "NOTE: File is permanently saved and not over-written during next package " "update." msgstr "" -#: views/epm_advanced_poce.page.php:80 +#: views/epm_advanced/poce.views.textarea.file.php:32 msgid "" "NOTE: File may be over-written during next package update. We suggest also " "using the Share button below to improve the next release." msgstr "" -#: views/epm_advanced_poce.page.php:74 +#: views/epm_advanced/poce.views.textarea.file.php:26 msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." msgstr "" -#: Endpointman.class.php:1725 +#: Endpointman.class.php:2027 msgid "Name invalid: " msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:61 -msgid "New OUI" +#: Endpointman.class.php:901 +msgid "Name is null!" msgstr "" -#: Endpointman.class.php:223 +#: Endpointman.class.php:276 msgid "New Package Modified" msgstr "" @@ -772,133 +837,154 @@ msgstr "" msgid "No" msgstr "" -#: Endpointman.class.php:2983 +#: Endpointman.class.php:3300 msgid "No 'brand_data.xml' file exists!" msgstr "" -#: Endpointman.class.php:1555 +#: Endpointman.class.php:1857 msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:1669 +#: Endpointman.class.php:1971 msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3283 Endpointman.class.php:3301 +#: Endpointman.class.php:3600 Endpointman.class.php:3618 msgid "No Devices/Extensions Left to Add" msgstr "" -#: Endpointman.class.php:1258 +#: Endpointman.class.php:1560 msgid "No File Provided!" msgstr "" -#: Endpointman.class.php:1530 +#: Endpointman.class.php:1832 msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3287 Endpointman.class.php:3305 +#: Endpointman.class.php:3604 Endpointman.class.php:3622 msgid "No Lines Left to Add" msgstr "" -#: Endpointman.class.php:1552 +#: Endpointman.class.php:1854 msgid "No OUI set!" msgstr "" -#: views/epm_advanced_poce.page.php:53 views/epm_advanced_poce.page.php:72 +#: views/epm_advanced/poce.views.textarea.file.php:5 +#: views/epm_advanced/poce.views.textarea.file.php:24 msgid "No Selected" msgstr "" -#: Endpointman.class.php:3460 +#: Endpointman.class.php:3777 msgid "No file was uploaded" msgstr "" -#: Endpointman.class.php:1369 +#: Endpointman.class.php:1671 msgid "No package set!" msgstr "" -#: Endpointman.class.php:884 +#: Endpointman.class.php:913 +msgid "No send Clone Model!" +msgstr "" + +#: Endpointman.class.php:1135 msgid "No send File ID!" msgstr "" -#: Endpointman.class.php:887 +#: Endpointman.class.php:1138 msgid "No send File Name!" msgstr "" -#: Endpointman.class.php:1066 +#: Endpointman.class.php:873 Endpointman.class.php:942 +msgid "No send ID!" +msgstr "" + +#: Endpointman.class.php:1314 msgid "No send Name File!" msgstr "" -#: Endpointman.class.php:1069 +#: Endpointman.class.php:898 +msgid "No send Name!" +msgstr "" + +#: Endpointman.class.php:1317 msgid "No send Origianl Name File!" msgstr "" -#: Endpointman.class.php:784 Endpointman.class.php:875 -#: Endpointman.class.php:1009 Endpointman.class.php:1051 -#: Endpointman.class.php:1145 +#: Endpointman.class.php:1035 Endpointman.class.php:1126 +#: Endpointman.class.php:1251 Endpointman.class.php:1299 +#: Endpointman.class.php:1393 msgid "No send Product Select!" msgstr "" -#: Endpointman.class.php:1151 +#: Endpointman.class.php:904 +msgid "No send Product!" +msgstr "" + +#: Endpointman.class.php:1399 msgid "No send SQL Select!" msgstr "" -#: Endpointman.class.php:1063 +#: Endpointman.class.php:1311 msgid "No send Save Name!" msgstr "" -#: Endpointman.class.php:1015 Endpointman.class.php:1054 +#: Endpointman.class.php:1257 Endpointman.class.php:1302 msgid "No send SendID!" msgstr "" -#: Endpointman.class.php:1060 +#: Endpointman.class.php:1308 msgid "No send Text File!" msgstr "" -#: Endpointman.class.php:890 Endpointman.class.php:1012 -#: Endpointman.class.php:1057 Endpointman.class.php:1148 +#: Endpointman.class.php:1141 Endpointman.class.php:1254 +#: Endpointman.class.php:1305 Endpointman.class.php:1396 msgid "No send Type File!" msgstr "" -#: Endpointman.class.php:1836 Endpointman.class.php:1970 +#: Endpointman.class.php:2138 Endpointman.class.php:2273 msgid "No send id!" msgstr "" -#: Endpointman.class.php:1839 Endpointman.class.php:1973 +#: Endpointman.class.php:2141 Endpointman.class.php:2276 msgid "No send idtype!" msgstr "" -#: Endpointman.class.php:1597 Endpointman.class.php:1830 -#: Endpointman.class.php:1960 +#: Endpointman.class.php:1899 Endpointman.class.php:2132 +#: Endpointman.class.php:2263 msgid "No send name!" msgstr "" -#: Endpointman.class.php:1600 Endpointman.class.php:1833 -#: Endpointman.class.php:1963 +#: Endpointman.class.php:1902 Endpointman.class.php:2135 +#: Endpointman.class.php:2266 msgid "No send value!" msgstr "" -#: Endpointman.class.php:1666 +#: Endpointman.class.php:1968 msgid "Not a Vaild Directory.
      Try to run 'mkdir " msgstr "" -#: Endpointman.class.php:2207 +#: Endpointman.class.php:2510 msgid "Not able to connect to repository. Using local Provisioner.net Package." msgstr "" -#: Endpointman.class.php:2237 +#: Endpointman.class.php:2540 msgid "" "Not able to connect to repository. Using local brand [%_brandname_%] file " "instead." msgstr "" -#: Endpointman.class.php:2192 +#: Endpointman.class.php:2495 msgid "Not able to connect to repository. Using local master file instead." msgstr "" -#: Endpointman.class.php:2668 +#: Endpointman.class.php:2976 msgid "Not allowed in repo mode!!" msgstr "" +#: Endpointman.class.php:1487 +msgid "Not is directory: " +msgstr "" + #: endpointman.i18n.php:18 msgid "OSS Endpoint Advanced Settings" msgstr "" @@ -930,28 +1016,32 @@ msgid "" "either of these and are encouraged." msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:30 -#: views/epm_advanced/oui_manager.views.grid.php:53 +#: views/epm_advanced/oui_manager.views.grid.php:24 +#: views/epm_advanced/oui_manager.views.new.modal.php:14 msgid "OUI" msgstr "" -#: Endpointman.class.php:543 +#: views/epm_advanced/oui_manager.views.new.modal.php:18 +msgid "OUI Brand" +msgstr "" + +#: Endpointman.class.php:630 msgid "OUI Manager" msgstr "" -#: Endpointman.class.php:2880 Endpointman.class.php:2905 +#: Endpointman.class.php:3192 Endpointman.class.php:3217 msgid "Old Data Detected! Migrating......" msgstr "" -#: Endpointman.class.php:140 +#: Endpointman.class.php:141 msgid "Or run this command on SSH:" msgstr "" -#: Endpointman.class.php:555 +#: Endpointman.class.php:642 msgid "Package Import/Export" msgstr "" -#: Endpointman.class.php:224 +#: Endpointman.class.php:277 msgid "Package Last Modified" msgstr "" @@ -963,94 +1053,103 @@ msgstr "" msgid "Package Server" msgstr "" -#: Endpointman.class.php:1372 +#: Endpointman.class.php:1674 msgid "Package not valid!" msgstr "" -#: Endpointman.class.php:2576 Endpointman.class.php:2684 +#: Endpointman.class.php:2884 Endpointman.class.php:2992 msgid "Please Check Directory/Permissions!" msgstr "" -#: Endpointman.class.php:139 +#: Endpointman.class.php:140 msgid "Please change the location:" msgstr "" -#: Endpointman.class.php:1253 +#: Endpointman.class.php:1555 msgid "Please name the Package the same name as your brand!" msgstr "" -#: Endpointman.class.php:1506 +#: Endpointman.class.php:1808 msgid "Please reboot & rebuild all imported phones" msgstr "" -#: Endpointman.class.php:1508 +#: Endpointman.class.php:1810 msgid "Possible file upload attack!" msgstr "" -#: Endpointman.class.php:2743 +#: Endpointman.class.php:3053 msgid "Processing %_PATH_%/brand_data.json..." msgstr "" -#: Endpointman.class.php:547 +#: Endpointman.class.php:634 msgid "Product Configuration Editor" msgstr "" -#: Endpointman.class.php:787 Endpointman.class.php:878 +#: Endpointman.class.php:1038 Endpointman.class.php:1129 msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:790 Endpointman.class.php:881 +#: Endpointman.class.php:1041 Endpointman.class.php:1132 msgid "Product Select send is number not valid!" msgstr "" +#: Endpointman.class.php:907 +msgid "Product is not number!" +msgstr "" + +#: Endpointman.class.php:910 +msgid "Product send is negative!" +msgstr "" + #: views/epm_advanced_manual_upload.page.php:24 msgid "Provisioner Package" msgstr "" -#: Endpointman.class.php:235 Endpointman.class.php:252 -#: Endpointman.class.php:256 +#: Endpointman.class.php:288 Endpointman.class.php:305 +#: Endpointman.class.php:309 msgid "Ready!" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:13 +#: views/epm_advanced/oui_manager.views.grid.php:6 msgid "Refresh Table" msgstr "" -#: Endpointman.class.php:231 +#: Endpointman.class.php:284 msgid "Remove Firmware" msgstr "" -#: Endpointman.class.php:589 +#: Endpointman.class.php:676 msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:2986 +#: Endpointman.class.php:3303 msgid "Removing Temporary Files.............." msgstr "" -#: Endpointman.class.php:609 +#: Endpointman.class.php:680 msgid "Removing symlink to web provisioner" msgstr "" -#: views/epm_advanced_poce.page.php:83 +#: views/epm_advanced/poce.views.textarea.file.php:35 msgid "Save" msgstr "" -#: views/epm_advanced_poce.page.php:96 +#: views/epm_advanced/poce.views.textarea.file.php:48 msgid "Save As..." msgstr "" -#: Endpointman.class.php:238 Endpointman.class.php:254 -#: Endpointman.class.php:306 +#: Endpointman.class.php:291 Endpointman.class.php:307 +#: Endpointman.class.php:359 msgid "Saving Changes..." msgstr "" -#: Endpointman.class.php:239 Endpointman.class.php:255 -#: Endpointman.class.php:307 +#: Endpointman.class.php:292 Endpointman.class.php:308 +#: Endpointman.class.php:360 msgid "Saving Changes... Ok!" msgstr "" -#: views/epm_advanced_manual_upload.page.php:137 +#: views/epm_advanced/oui_manager.views.new.modal.php:41 +#: views/epm_advanced_manual_upload.page.php:101 msgid "Select Brand:" msgstr "" @@ -1063,23 +1162,23 @@ msgstr "" msgid "Setting Provision" msgstr "" -#: Endpointman.class.php:539 +#: Endpointman.class.php:626 msgid "Settings" msgstr "" -#: views/epm_advanced_poce.page.php:107 +#: views/epm_advanced/poce.views.textarea.file.php:59 msgid "Share" msgstr "" -#: Endpointman.class.php:250 +#: Endpointman.class.php:303 msgid "Show" msgstr "" -#: Endpointman.class.php:529 +#: Endpointman.class.php:616 msgid "Show/Hide" msgstr "" -#: Endpointman.class.php:2516 +#: Endpointman.class.php:2824 msgid "Skipping download..." msgstr "" @@ -1087,15 +1186,15 @@ msgstr "" msgid "Structure" msgstr "" -#: Endpointman.class.php:2160 +#: Endpointman.class.php:2463 msgid "Syntax error, malformed JSON" msgstr "" -#: Endpointman.class.php:2941 +#: Endpointman.class.php:3253 msgid "System Error in Sync Model Function, Load Failure!" msgstr "" -#: Endpointman.class.php:2379 +#: Endpointman.class.php:2683 msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" msgstr "" @@ -1103,11 +1202,15 @@ msgstr "" msgid "System Failure!" msgstr "" -#: Endpointman.class.php:298 Endpointman.class.php:393 +#: Endpointman.class.php:351 Endpointman.class.php:458 msgid "Tab is not valid!" msgstr "" -#: Endpointman.class.php:222 +#: Endpointman.class.php:602 +msgid "Template Editor" +msgstr "" + +#: Endpointman.class.php:275 msgid "" "The \"Install\" button installs the configuration package brand models we " "selected.
      The \"Uninstall\" button removes the package configuration " @@ -1116,13 +1219,13 @@ msgid "" "version is detected." msgstr "" -#: Endpointman.class.php:2303 +#: Endpointman.class.php:2607 msgid "" "The Remote Server Is Currently Syncing With the Master Server, Please try " "again later" msgstr "" -#: Endpointman.class.php:221 +#: Endpointman.class.php:274 msgid "" "The button \"Install Firmware\" installs the necessary files to the server " "for the terminal alone are updated via TFTP or HTTP.
      The button " @@ -1132,24 +1235,30 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3456 +#: Endpointman.class.php:3773 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3454 +#: Endpointman.class.php:3771 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3458 +#: Endpointman.class.php:3775 msgid "The uploaded file was only partially uploaded" msgstr "" -#: Endpointman.class.php:2728 +#: Endpointman.class.php:3038 msgid "Then Use Manual Upload in Advanced Settings." msgstr "" +#: views/epm_advanced/oui_manager.views.new.modal.php:26 +msgid "" +"They are the first 6 characters of the MAC device that identifies the brand " +"(manufacturer)." +msgstr "" + #: views/epm_advanced_settings.page.php:134 msgid "Time" msgstr "" @@ -1166,59 +1275,59 @@ msgstr "" msgid "TimeZone by PBX Setting" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:32 +#: views/epm_advanced/oui_manager.views.grid.php:26 msgid "Type" msgstr "" -#: Endpointman.class.php:1164 +#: Endpointman.class.php:1412 msgid "Type File not valid!" msgstr "" -#: Endpointman.class.php:2154 +#: Endpointman.class.php:2457 msgid "Underflow or the modes mismatch" msgstr "" -#: Endpointman.class.php:2157 +#: Endpointman.class.php:2460 msgid "Unexpected control character found" msgstr "" -#: Endpointman.class.php:228 +#: Endpointman.class.php:281 msgid "Uninstall" msgstr "" -#: Endpointman.class.php:2619 +#: Endpointman.class.php:2927 msgid "Uninstalla Brand..." msgstr "" -#: Endpointman.class.php:2596 +#: Endpointman.class.php:2904 msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3600 +#: Endpointman.class.php:3917 msgid "Unknown" msgstr "" -#: Endpointman.class.php:2166 +#: Endpointman.class.php:2469 msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3468 +#: Endpointman.class.php:3785 msgid "Unknown upload error" msgstr "" -#: Endpointman.class.php:229 +#: Endpointman.class.php:282 msgid "Update" msgstr "" -#: Endpointman.class.php:243 +#: Endpointman.class.php:296 msgid "Update Content..." msgstr "" -#: Endpointman.class.php:232 +#: Endpointman.class.php:285 msgid "Update Firmware" msgstr "" -#: Endpointman.class.php:237 +#: Endpointman.class.php:290 msgid "Update!" msgstr "" @@ -1226,27 +1335,27 @@ msgstr "" msgid "Updated!" msgstr "" -#: Endpointman.class.php:2792 +#: Endpointman.class.php:3102 msgid "Updating %_BRANDNAME_% brand data.........." msgstr "" -#: Endpointman.class.php:2803 +#: Endpointman.class.php:3113 msgid "Updating Family Lines................." msgstr "" -#: Endpointman.class.php:1314 +#: Endpointman.class.php:1616 msgid "Updating Last Modified..." msgstr "" -#: Endpointman.class.php:2968 +#: Endpointman.class.php:3285 msgid "Updating OUI list in DB" msgstr "" -#: Endpointman.class.php:240 Endpointman.class.php:257 +#: Endpointman.class.php:293 Endpointman.class.php:310 msgid "Upload Content!" msgstr "" -#: views/epm_advanced_poce.page.php:104 +#: views/epm_advanced/poce.views.textarea.file.php:56 msgid "" "Upload this configuration file to the Provisioner.net Team. Files " "shared are confidential and help improve the quality of releases." @@ -1256,7 +1365,7 @@ msgstr "" msgid "Use GITHUB Live Repo" msgstr "" -#: views/epm_advanced_poce.page.php:39 +#: views/epm_advanced/poce.views.button.up.files.php:31 msgid "User File Configs" msgstr "" @@ -1265,7 +1374,7 @@ msgid "" "Warning: The extensions need to be added into FreePBX before you import." msgstr "" -#: Endpointman.class.php:1447 +#: Endpointman.class.php:1749 msgid "We support only CVS and TXT files, type file %_FILE_% no support!" msgstr "" @@ -1288,29 +1397,29 @@ msgstr "" msgid "Yes" msgstr "" -#: Endpointman.class.php:2727 +#: Endpointman.class.php:3037 msgid "" "You Can Also Manually Update The Repository By Downloading Files here: %" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3182 +#: Endpointman.class.php:3499 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3185 +#: Endpointman.class.php:3502 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4575 +#: Endpointman.class.php:4945 msgid "You can't remove the only line left" msgstr "" -#: Endpointman.class.php:2587 +#: Endpointman.class.php:2895 msgid "Your Firmware is already up to date" msgstr "" -#: Endpointman.class.php:1709 +#: Endpointman.class.php:2011 msgid "Your permissions are wrong on " msgstr "" @@ -1323,6 +1432,6 @@ msgstr "" msgid "is required" msgstr "" -#: Endpointman.class.php:2740 +#: Endpointman.class.php:3050 msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" msgstr "" diff --git a/module.xml b/module.xml index 63c15a0f..aeb61701 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman unsupported OSS PBX End Point Manager - 13.0.6.4 + 13.0.6.5 setup Connectivity GPLv2+ @@ -21,6 +21,7 @@ Pull Requests can be made to either of these and are encouraged. + *13.0.6.5* Remove array by reference *13.0.6.4* Fix bug, generate file list export brands through AJAX, delete code not required, organize files. *13.0.6.3* Fix bug, optimize code. *13.0.6.2* Bring back in better check onlines From fbe184d1d50a5cb0579a58b0699bb283db6b98ff Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 3 Mar 2016 11:01:25 -0800 Subject: [PATCH 436/623] minor fixes to make this actually work --- Endpointman.class.php | 11071 +++++++++++++------------- bin/freepbx_engine_hook_endpointman | 0 includes/functions.inc | 12 +- install.php | 9 +- lib/epm_system.class.php | 24 +- 5 files changed, 5561 insertions(+), 5555 deletions(-) mode change 100755 => 100644 bin/freepbx_engine_hook_endpointman diff --git a/Endpointman.class.php b/Endpointman.class.php index b4bf9c81..b497f390 100644 --- a/Endpointman.class.php +++ b/Endpointman.class.php @@ -1,5535 +1,5536 @@ - 0) - { - foreach ($remplace_txt as $clave => $valor) { - $texto = str_replace($clave, $valor, $texto); - } - } - return '

      '.$texto.'

      '; -} - -function generate_xml_from_array ($array, $node_name, &$tab = -1) -{ - $tab++; - $xml =""; - if (is_array($array) || is_object($array)) { - foreach ($array as $key=>$value) { - if (is_numeric($key)) { - $key = $node_name; - } - - $xml .= str_repeat(" ", $tab). '<' . $key . '>' . "\n"; - $xml .= generate_xml_from_array($value, $node_name, $tab); - $xml .= str_repeat(" ", $tab). '' . "\n"; - - } - } else { - $xml = str_repeat(" ", $tab) . htmlspecialchars($array, ENT_QUOTES) . "\n"; - } - $tab--; - return $xml; -} - - -class Endpointman implements \BMO { - - //public $eda; //endpoint data abstraction layer - //public $system; - - public $error; //error construct - public $message; //message construct - - public $UPDATE_PATH; - public $MODULES_PATH; - public $LOCAL_PATH; - public $PHONE_MODULES_PATH; - public $PROVISIONER_BASE; - - - public function __construct($freepbx = null) { - if ($freepbx == null) { - throw new \Exception("Not given a FreePBX Object"); - } - require_once('lib/json.class.php'); - require_once('lib/Config.class.php'); - require_once('lib/epm_system.class.php'); - require_once('lib/datetimezone.class.php'); - require_once('lib/epm_data_abstraction.class.php'); - - - $this->freepbx = $freepbx; - $this->db = $freepbx->Database; - $this->config = $freepbx->Config; - $this->configmod = new Endpointman\Config(); - $this->system = new epm_system(); - $this->eda = new epm_data_abstraction($this->config, $this->configmod); - - - $this->configmod->set('disable_epm', FALSE); - $this->eda->global_cfg = $this->configmod->getall(); - - //Generate empty array - $this->error = array(); - $this->message = array(); - - - $this->configmod->set('tz', $this->config->get('PHPTIMEZONE')); - date_default_timezone_set($this->configmod->get('tz')); - - $this->UPDATE_PATH = $this->configmod->get('update_server'); - $this->MODULES_PATH = $this->config->get('AMPWEBROOT') . '/admin/modules/'; - -define("UPDATE_PATH", $this->UPDATE_PATH); -define("MODULES_PATH", $this->MODULES_PATH); - - - //Determine if local path is correct! - if (file_exists($this->MODULES_PATH . "endpointman/")) { - $this->LOCAL_PATH = $this->MODULES_PATH . "endpointman/"; -define("LOCAL_PATH", $this->LOCAL_PATH); - } else { - die("Can't Load Local Endpoint Manager Directory!"); - } - - //Define the location of phone modules, keeping it outside of the module directory so that when the user updates endpointmanager they don't lose all of their phones - if (file_exists($this->MODULES_PATH . "_ep_phone_modules/")) { - $this->PHONE_MODULES_PATH = $this->MODULES_PATH . "_ep_phone_modules/"; - } else { - $this->PHONE_MODULES_PATH = $this->MODULES_PATH . "_ep_phone_modules/"; - if (!file_exists($this->PHONE_MODULES_PATH)) { - mkdir($this->PHONE_MODULES_PATH, 0775); - } - if (file_exists($this->PHONE_MODULES_PATH . "setup.php")) { - unlink($this->PHONE_MODULES_PATH . "setup.php"); - } - if (!file_exists($this->MODULES_PATH . "_ep_phone_modules/")) { - die('Endpoint Manager can not create the modules folder!'); - } - } -define("PHONE_MODULES_PATH", $this->PHONE_MODULES_PATH); - - //Define error reporting - if (($this->configmod->get('debug')) AND (!isset($_REQUEST['quietmode']))) { - error_reporting(E_ALL); - ini_set('display_errors', 1); - } else { - ini_set('display_errors', 0); - } - - //Check if config location is writable and/or exists! - if ($this->configmod->isExiste('config_location')) { - $config_location = $this->configmod->get('config_location'); - if (is_dir($config_location)) { - if (!is_writeable($config_location)) { - $user = exec('whoami'); - $group = exec("groups"); - $this->error['config_location'] = _("Configuration Directory is not writable!") . "
      " . - _("Please change the location:") . "" . _("Here") . "
      " . - _("Or run this command on SSH:") . "
      " . - "'chown -hR root: " . $group . " " . $config_location . "'
      " . - "'chmod g+w " . $config_location . "'"; - $this->configmod->set('disable_epm', TRUE); - } - } else { - $this->error['config_location'] = _("Configuration Directory is not a directory or does not exist! Please change the location here:") . "" . _("Here") . ""; - $this->configmod->set('disable_epm', TRUE); - } - } - } - - public function chownFreepbx() { - $webroot = $this->config->get('AMPWEBROOT'); - $modulesdir = $webroot . '/admin/modules/'; - $files = array(); - $files[] = array('type' => 'dir', - 'path' => $modulesdir . '/_ep_phone_modules/', - 'perms' => 0755); - $files[] = array('type' => 'file', - 'path' => $modulesdir . '/_ep_phone_modules/setup.php', - 'perms' => 0755); - $files[] = array('type' => 'dir', - 'path' => '/tftpboot', - 'perms' => 0755); - return $files; - } - - public function ajaxRequest($req, &$setting) { - -//AVISO!!!!!!!!!!!!!!!!!!!!!!!!!! -//PERMITE TODO!!!!!!!!!!!!!!!!!!! -$setting['authenticate'] = true; -$setting['allowremote'] = true; -return true; - - switch ($_REQUEST['module_sec']) - { - case "epm_devices": break; - case "epm_templates": - switch ($req) - { - case "model_clone": - case "list_current_template": - case "add_template": - case "del_template": - $setting['authenticate'] = true; - $setting['allowremote'] = false; - return true; - break; - } - break; - - case "epm_config": - switch ($req) - { - case "saveconfig": - case "list_all_brand": - $setting['authenticate'] = true; - $setting['allowremote'] = false; - return true; - break; - } - break; - - case "epm_advanced": - switch ($req) - { - case "oui": - case "oui_add": - case "oui_del": - case "poce_select": - case "poce_select_file": - case "poce_save_file": - case "poce_save_as_file": - case "poce_sendid": - case "poce_delete_config_custom": - case "list_files_brands_export": - case "saveconfig": - $setting['authenticate'] = true; - $setting['allowremote'] = false; - return true; - break; - } - break; - } - return false; - } - - public function ajaxHandler() { - $module_sec = isset($_REQUEST['module_sec'])? trim($_REQUEST['module_sec']) : ''; - $module_tab = isset($_REQUEST['module_tab'])? trim($_REQUEST['module_tab']) : ''; - $command = isset($_REQUEST['command'])? trim($_REQUEST['command']) : ''; - - $txt = ""; - switch ($module_sec) - { - case "epm_devices": break; - case "epm_templates": - if ($module_tab == "manager") - { - switch ($command) - { - case "list_current_template": - $retarr = $this->epm_templates_list_current_templates(); - return $retarr; - break; - - case "model_clone": - $retarr = $this->epm_templates_model_clone(); - return $retarr; - break; - - case "add_template": - $retarr = $this->epm_templates_add_template(); - return $retarr; - break; - - case "del_template": - $retarr = $this->epm_templates_del_template(); - return $retarr; - break; - - default: - $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); - break; - } - } - break; - - case "epm_config": - $txt['manager'] = array( - 'ayuda_model' => _("If we can activate the model set terminals of the models.
      If this model is disabled will not appear in the list of models that can be configured for PBX."), - 'ayuda_producto' => _('The button "Install Firmware" installs the necessary files to the server for the terminal alone are updated via TFTP or HTTP.
      The button "Remove frimware" delete files server products.
      The button "Update frimware" appears if a newer frimware detected on the server and asks if you want to update.
      The "Update" button appears when a new version of this model pack is detected.'), - 'ayuda_marca' => _('The "Install" button installs the configuration package brand models we selected.
      The "Uninstall" button removes the package configuration models of the brand selected.
      The "Update" button appears if a new version of the package that is already installed to upgrade to the latest version is detected.'), - 'new_pack_mod' => _("New Package Modified"), - 'pack_last_mod' => _("Package Last Modified"), - 'check_update' => _("Check for Update "), - 'check_online' => _("Check Online "), - 'install' => _("Install"), - 'uninstall' => _("Uninstall"), - 'update' => _("Update"), - 'fw_install' => _('Install Firmware'), - 'fw_uninstall' => _('Remove Firmware'), - 'fw_update' => _('Update Firmware'), - 'enable' => _('Enable'), - 'disable' => _('Disable'), - 'ready' => _("Ready!"), - 'error' => _("Error!"), - 'title_update' => _("Update!"), - 'save_changes' => _("Saving Changes..."), - 'save_changes_ok' => _("Saving Changes... Ok!"), - 'err_upload_content' => _("Upload Content!"), - 'check' => _("Check for Updates..."), - 'check_ok' => _("Check for Updates... Ok!"), - 'update_content' => _("Update Content..."), - 'opt_invalid' => _("Invalid Option!") - ); - $txt['editor'] = array( - 'ayuda_marca' => _("If you select Hide this brand will disappear and all products and models on the list of Install/Uninstall."), - 'ayuda_producto' => _("If you select Hide disappear all models of the product selected from the Install/Uninstall list."), - 'ayuda_modelo' => _("If you select Hide disappear this model the Install/Uninstall list."), - 'show' => _("Show"), - 'hide' => _("Hide"), - 'ready'=> _("Ready!"), - 'error' => _("Error!"), - 'save_changes' => _("Saving Changes..."), - 'save_changes_ok' => _("Saving Changes... Ok!"), - 'ready' => _("Ready!"), - 'err_upload_content' => _("Upload Content!"), - 'opt_invalid' => _("Invalid Option!") - ); - - if ($module_tab == "manager") - { - switch ($command) - { - case "saveconfig": - $retarr = $this->epm_config_manager_saveconfig(); - break; - - case "list_all_brand": - $retarr = array("status" => true, "message" => "OK", "datlist" => $this->epm_config_manager_hardware_get_list_all(false)); - break; - - default: - $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); - break; - } - $retarr['txt'] = $txt['manager']; - } - elseif ($module_tab == "editor") - { - switch ($command) - { - case "saveconfig": - $retarr = $this->epm_config_editor_saveconfig(); - break; - - case "list_all_brand": - $retarr = array("status" => true, "message" => "OK", "datlist" => $this->epm_config_editor_hardware_get_list_all()); - break; - - default: - $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); - break; - } - $retarr['txt'] = $txt['editor']; - } - else { - $retarr = array("status" => false, "message" => _("Tab is not valid!") . " [" .$module_tab. "]"); - } - return $retarr; - break; - - case "epm_advanced": - $txt['settings'] = array( - 'error' => _("Error!"), - 'save_changes' => _("Saving Changes..."), - 'save_changes_ok' => _("Saving Changes... Ok!"), - 'opt_invalid' => _("Invalid Option!") - ); - - if ($module_tab == "settings") - { - switch ($command) - { - case "saveconfig": - $retarr = $this->epm_advanced_settings_saveconfig(); - break; - - default: - $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); - break; - } - $retarr['txt'] = $txt['settings']; - } - elseif ($module_tab == "oui_manager") { - switch ($command) - { - case "oui": - //$sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name, endpointman_oui_list.custom FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id ORDER BY endpointman_oui_list.oui ASC'; - $sql = 'SELECT T1.id, T1.oui, T2.name, T1.custom FROM endpointman_oui_list as T1 , endpointman_brand_list as T2 WHERE T1.brand = T2.id ORDER BY T1.oui ASC'; - $data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $ret = array(); - foreach ($data as $item) { - $ret[] = array('id' => $item['id'], 'oui' => $item['oui'], 'brand' => $item['name'], 'custom' => $item['custom']); - } - return $ret; - break; - - case "oui_add": - $retarr = $this->epm_advanced_oui_add(); - break; - - case "oui_del": - $retarr = $this->epm_advanced_oui_remove(); - break; - - default: - $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); - break; - } - //$retarr['txt'] = $txt['settings']; - } - elseif ($module_tab == "iedl") { - switch ($command) - { - default: - $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); - break; - } - //$retarr['txt'] = $txt['settings']; - } - elseif ($module_tab == "poce") { - switch ($command) - { - case "poce_select": - $retarr = $this->epm_advanced_poce_select(); - break; - - case "poce_select_file": - $retarr = $this->epm_advanced_poce_select_file(); - break; - - case "poce_save_file": - case "poce_save_as_file": - $retarr = $this->epm_advanced_poce_save_file(); - break; - - case "poce_sendid": - $retarr = $this->epm_advanced_poce_sendid(); - break; - - case "poce_delete_config_custom": - $retarr = $this->epm_advanced_poce_delete_config_custom(); - break; - - default: - $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); - break; - } - //$retarr['txt'] = $txt['settings']; - } - elseif ($module_tab == "manual_upload") { - switch ($command) - { - case "list_files_brands_export": - $retarr = $this->epm_advanced_manual_upload_list_files_brans_export(); - break; - - default: - $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); - break; - } - } - else { - $retarr = array("status" => false, "message" => _("Tab is not valid!") . " [" .$module_tab. "]"); - } - return $retarr; - break; - } - return false; - } - - public static function myDialplanHooks() { - return true; - } - - public function doConfigPageInit($page) { - //TODO: Pendiente revisar y eliminar moule_tab. - $module_tab = isset($_REQUEST['module_tab'])? trim($_REQUEST['module_tab']) : ''; - if ($module_tab == "") { - $module_tab = isset($_REQUEST['subpage'])? trim($_REQUEST['subpage']) : ''; - } - - $command = isset($_REQUEST['command'])? trim($_REQUEST['command']) : ''; - switch ($page) - { - case "epm_devices": break; - case "epm_templates": break; - case "epm_config": - switch ($module_tab) - { - case "manager": - switch ($command) { - case "check_for_updates": - echo format_txt("Update data..."); - $this->update_check(); - echo format_txt("Done!"); - echo "


      "; - exit; - break; - - case "manual_install": - $this->epm_config_manual_install(); - echo "


      "; - exit; - break; - - case "firmware": - $this->epm_config_manager_firmware(); - echo "


      "; - exit; - break; - - case "brand": - $this->epm_config_manager_brand(); - echo "


      "; - exit; - break; - } - break; - - case "editor": - break; - } - break; - - case "epm_advanced": - switch ($module_tab) - { - case "oui_manager": - break; - - case "iedl": - switch ($command) { - case "export": - $this->epm_advanced_iedl_export(); - break; - case "import": - $this->epm_advanced_iedl_import(); - echo "


      "; - exit; - break; - } - break; - - case "manual_upload": - switch ($command) { - case "export_brands_availables": - $this->epm_advanced_manual_upload_export_brans_available(); - echo "


      "; - exit; - break; - - case "export_brands_availables_file": - $this->epm_advanced_manual_upload_export_brans_available_file(); - exit; - break; - - case "upload_brand": - $this->epm_advanced_manual_upload_brand(); - echo "


      "; - exit; - break; - - case "upload_provisioner": - $this->epm_advanced_manual_upload_provisioner(); - echo "


      "; - exit; - break; - } - break; - break; - } - break; - } - } - - public function doGeneralPost() { - if (!isset($_REQUEST['Submit'])) { return; } - if (!isset($_REQUEST['display'])) { return; } - - needreload(); - } - - public function myShowPage() { - if (! isset($_REQUEST['display'])) - return $this->pagedata; - - switch ($_REQUEST['display']) - { - case "epm_devices": - if(empty($this->pagedata)) - { - $this->pagedata['main'] = array( - "name" => _("Devices"), - "page" => 'views/epm_devices_main.page.php' - ); - } - break; - - case "epm_templates": - if(empty($this->pagedata)) - { - $this->pagedata['manager'] = array( - "name" => _("Current Templates"), - "page" => 'views/epm_templates_manager.page.php' - ); - $this->pagedata['editor'] = array( - "name" => _("Template Editor"), - "page" => 'views/epm_templates_editor.page.php' - ); - } - break; - - case "epm_config": - if(empty($this->pagedata)) - { - $this->pagedata['manager'] = array( - "name" => _("Install/Unistall"), - "page" => 'views/epm_config_manager.page.php' - ); - $this->pagedata['editor'] = array( - "name" => _("Show/Hide"), - "page" => 'views/epm_config_editor.page.php' - ); - } - break; - - case "epm_advanced": - if(empty($this->pagedata)) - { - $this->pagedata['settings'] = array( - "name" => _("Settings"), - "page" => 'views/epm_advanced_settings.page.php' - ); - $this->pagedata['oui_manager'] = array( - "name" => _("OUI Manager"), - "page" => 'views/epm_advanced_oui_manager.page.php' - ); - $this->pagedata['poce'] = array( - "name" => _("Product Configuration Editor"), - "page" => 'views/epm_advanced_poce.page.php' - ); - $this->pagedata['iedl'] = array( - "name" => _("Import/Export My Devices List"), - "page" => 'views/epm_advanced_iedl.page.php' - ); - $this->pagedata['manual_upload'] = array( - "name" => _("Package Import/Export"), - "page" => 'views/epm_advanced_manual_upload.page.php' - ); - } - break; - } - - if(! empty($this->pagedata)) { - foreach($this->pagedata as &$page) { - ob_start(); - include($page['page']); - $page['content'] = ob_get_contents(); - ob_end_clean(); - } - return $this->pagedata; - } - } - - public function getActiveModules() { - } - - //http://wiki.freepbx.org/display/FOP/Adding+Floating+Right+Nav+to+Your+Module - public function getRightNav($request) { - } - - //http://wiki.freepbx.org/pages/viewpage.action?pageId=29753755 - public function getActionBar($request) { - } - - public function install() { - - } - - public function uninstall() { - out(_("Removing Phone Modules Directory")); - $this->system->rmrf($this->PHONE_MODULES_PATH); - exec("rm -R ". $this->PHONE_MODULES_PATH); - - out(_('Removing symlink to web provisioner')); - $provisioning_path = $this->config->get('AMPWEBROOT')."/provisioning"; - if(is_link($provisioning_path)) { unlink($provisioning_path); } - - if(!is_link($this->config->get('AMPWEBROOT').'/admin/assets/endpointman')) { - $this->system->rmrf($this->config->get('AMPWEBROOT').'/admin/assets/endpointman'); - } - - out(_("Dropping all relevant tables")); - $sql = "DROP TABLE `endpointman_brand_list`"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $sql = "DROP TABLE `endpointman_global_vars`"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $sql = "DROP TABLE `endpointman_mac_list`"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $sql = "DROP TABLE `endpointman_line_list`"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $sql = "DROP TABLE `endpointman_model_list`"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $sql = "DROP TABLE `endpointman_oui_list`"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $sql = "DROP TABLE `endpointman_product_list`"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $sql = "DROP TABLE `endpointman_template_list`"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $sql = "DROP TABLE `endpointman_time_zones`"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $sql = "DROP TABLE `endpointman_custom_configs`"; - $sth = $this->db->prepare($sql); - $sth->execute(); - return true; - } - - public function backup() { - } - - public function restore($backup) { - } - - - - - - - - - - - - - - /** - * Get info models by product id selected. - * @param int $id_product product ID - * @param bool $show_all True return all, False return hidden = 0 - * @return array - */ - public function epm_config_hardware_get_list_models($id_product=NULL, $show_all = true) - { - if(! is_numeric($id_product)) { throw new \Exception( _("ID Producto not is number")." (".$id_product.")"); } - if($show_all == true) { $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = '.$id_product; } - else { $sql = 'SELECT * FROM endpointman_model_list WHERE hidden = 0 AND product_id = '.$id_product; } - $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - return $result; - } - - /** - * Get info product by brand id selected. - * @param int $id_brand brand ID - * @param bool $show_all True return all, FAlse return hidde = 0 - * @return array - */ - public function epm_config_hardware_get_list_product($id_brand=NULL, $show_all = true) - { - if(! is_numeric($id_brand)) { throw new \Exception(_("ID Brand not is numbre")." (".$id_brand.")"); } - if ($show_all == true) { $sql = 'SELECT * FROM endpointman_product_list WHERE brand = '.$id_brand.' ORDER BY long_name ASC'; } - else { $sql = 'SELECT * FROM endpointman_product_list WHERE hidden = 0 AND brand = '.$id_brand.' ORDER BY long_name ASC'; } - $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - return $result; - } - - /** - * Get info all brands. - * @param bool $show_all True return all, False return hidde = 0 - * @return array - */ - public function epm_config_hardware_get_list_brand($show_all = true) { - if ($show_all == true) { $sql = "SELECT * from endpointman_brand_list WHERE id > 0 ORDER BY id ASC "; } - else { $sql = "SELECT * from endpointman_brand_list WHERE id > 0 AND hidden = 0 ORDER BY id ASC "; } - $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - return $result; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - private function epm_config_manual_install($install_type = "", $package ="") - { - if ($install_type == "") { - throw new \Exception("Not send install_type!"); - } - - switch($install_type) { - case "export_brand": - - break; - - case "upload_master_xml": - if (file_exists($this->PHONE_MODULES_PATH."temp/master.xml")) { - $handle = fopen($this->PHONE_MODULES_PATH."temp/master.xml", "rb"); - $contents = stream_get_contents($handle); - fclose($handle); - @$a = simplexml_load_string($contents); - if($a===FALSE) { - echo "Not a valid xml file"; - break; - } else { - rename($this->PHONE_MODULES_PATH."temp/master.xml", $this->PHONE_MODULES_PATH."master.xml"); - echo "Move Successful
      "; - $this->update_check(); - echo "Updating Brands
      "; - } - } else { - } - break; - - case "upload_provisioner": - - break; - - case "upload_brand": - - break; - } - } - - - - - - - - - - - - - - - - /****************************************************** - **** FUNCIONES SEC MODULO "epm_template\manager". **** - *****************************************************/ - - public function epm_templates_del_template() - { - if (! isset($_REQUEST['idsel'])) { - $retarr = array("status" => false, "message" => _("No send ID!")); - } - elseif (! is_numeric($_REQUEST['idsel'])) { - $retarr = array("status" => false, "message" => _("ID is not number!")); - } - elseif ($_REQUEST['idsel'] <= 0) { - $retarr = array("status" => false, "message" => _("ID send is negative!")); - } - else { - $dget['idsel'] = $_REQUEST['idsel']; - - $sql = "DELETE FROM endpointman_template_list WHERE id = ". $dget['idsel']; - sql($sql); - $sql = "UPDATE endpointman_mac_list SET template_id = 0 WHERE template_id = ".$dget['idsel']; - sql($sql); - - $retarr = array("status" => true, "message" => _("Delete Template OK!")); - unset($dget); - } - return $retarr; - } - - public function epm_templates_add_template () - { - if (! isset($_REQUEST['newnametemplate'])) { - $retarr = array("status" => false, "message" => _("No send Name!")); - } - elseif (empty($_REQUEST['newnametemplate'])) { - $retarr = array("status" => false, "message" => _("Name is null!")); - } - elseif (! isset($_REQUEST['newproductselec'])) { - $retarr = array("status" => false, "message" => _("No send Product!")); - } - elseif (! is_numeric($_REQUEST['newproductselec'])) { - $retarr = array("status" => false, "message" => _("Product is not number!")); - } - elseif ($_REQUEST['newproductselec'] <= 0) { - $retarr = array("status" => false, "message" => _("Product send is negative!")); - } - elseif (! isset($_REQUEST['newclonemodel'])) { - $retarr = array("status" => false, "message" => _("No send Clone Model!")); - } - elseif (! is_numeric($_REQUEST['newclonemodel'])) { - $retarr = array("status" => false, "message" => _("Clone Model is not number!")); - } - elseif ($_REQUEST['newclonemodel'] <= 0) { - $retarr = array("status" => false, "message" => _("Clone Model send is negative!")); - } - else { - $dget['newnametemplate'] = $_REQUEST['newnametemplate']; - $dget['newproductselec'] = $_REQUEST['newproductselec']; - $dget['newclonemodel'] = $_REQUEST['newclonemodel']; - - $db = $this->db; - $sql = "INSERT INTO endpointman_template_list (product_id, name, model_id) VALUES (?,?,?)"; - $q = $db->prepare($sql); - $ob = $q->execute(array($dget['newproductselec'], addslashes($dget['newnametemplate']), $dget['newclonemodel'])); - $newid = $db->lastInsertId(); - //$endpoint->edit_template_display($id,0); - - $retarr = array("status" => true, "message" => _("Add New Template OK!"), "newid" => $newid); - unset($dget); - } - return $retarr; - } - - public function epm_templates_model_clone () - { - if (! isset($_REQUEST['id'])) { - $retarr = array("status" => false, "message" => _("No send ID!")); - } - elseif (! is_numeric($_REQUEST['id'])) { - $retarr = array("status" => false, "message" => _("ID send is not number!")); - } - elseif ($_REQUEST['id'] <= 0) { - $retarr = array("status" => false, "message" => _("ID send is number not valid!")); - } - else - { - $dget['id'] = $_REQUEST['id']; - - $i=0; - $out = array(); - $sql = "SELECT endpointman_model_list.id, endpointman_model_list.model as model FROM endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND product_id = '". $dget['id']."'"; - $result = sql($sql,'getAll', DB_FETCHMODE_ASSOC); - foreach($result as $row) { - $out[$i]['optionValue'] = $row['id']; - $out[$i]['optionDisplay'] = $row['model']; - $i++; - } - $retarr = array("status" => true, "message" => _("Generate list Ok!"), "listopt" => $out); - - unset($dget); - } - return $retarr; - } - - public function epm_templates_list_current_templates () - { - - $sql = 'SELECT endpointman_template_list.*, endpointman_product_list.short_name as model_class, endpointman_model_list.model as model_clone, endpointman_model_list.enabled FROM endpointman_template_list, endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.hidden = 0 AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.product_id = endpointman_product_list.id'; - $template_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $i = 0; - $row_out = array(); - foreach($template_list as $row) { - $row_out[$i] = $row; - $row_out[$i]['custom'] = 0; - if(!$row['enabled']) { - $row_out[$i]['model_clone'] = $row_out[$i]['model_clone']; - } - $i++; - } - - $sql = 'SELECT endpointman_mac_list.mac, endpointman_mac_list.id, endpointman_mac_list.model, endpointman_model_list.model as model_clone, endpointman_product_list.short_name as model_class FROM endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.global_custom_cfg_data IS NOT NULL AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_mac_list.template_id = 0'; - $template_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - foreach($template_list as $row) { - $sql = 'SELECT description , line FROM endpointman_line_list WHERE mac_id ='. $row['id'].' ORDER BY line ASC'; - $line_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $description = ""; - $c = 0; - foreach($line_list as $line_row) { - if($c > 0) { - $description .= ", "; - } - $description .= $line_row['description']; - $c++; - } - $row_out[$i] = $row; - $row_out[$i]['custom'] = 1; - $row_out[$i]['name'] = $row['mac']; - $row_out[$i]['description'] = $description; - $i++; - } - - /* - //$sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name, endpointman_oui_list.custom FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id ORDER BY endpointman_oui_list.oui ASC'; - $sql = 'SELECT T1.id, T1.oui, T2.name, T1.custom FROM endpointman_oui_list as T1 , endpointman_brand_list as T2 WHERE T1.brand = T2.id ORDER BY T1.oui ASC'; - $data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $ret = array(); - foreach ($data as $item) { - $ret[] = array('id' => $item['id'], 'oui' => $item['oui'], 'brand' => $item['name'], 'custom' => $item['custom']); - } - */ - return $row_out; - } - - /******************** - * END SEC FUNCTIONS * - ********************/ - - - - - - - /*************************************************** - **** FUNCIONES SEC MODULO "epm_advanced\poce". **** - ***************************************************/ - - public function epm_advanced_poce_select() - { - if (! isset($_REQUEST['product_select'])) { - $retarr = array("status" => false, "message" => _("No send Product Select!")); - } - elseif (! is_numeric($_REQUEST['product_select'])) { - $retarr = array("status" => false, "message" => _("Product Select send is not number!")); - } - elseif ($_REQUEST['product_select'] < 0) { - $retarr = array("status" => false, "message" => _("Product Select send is number not valid!")); - } - else - { - $dget['product_select'] = $_REQUEST['product_select']; - - $sql = 'SELECT * FROM `endpointman_product_list` WHERE `hidden` = 0 AND `id` = '.$dget['product_select']; - $product_select_info = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id ='" . $dget['product_select'] . "'"; - $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - $config_files = explode(",", $row['config_files']); - $i = 0; - if (count($config_files)) { - foreach ($config_files as $config_files_data) { - //$file_list[$i]['value'] = $i; - $file_list[$i]['value'] = $dget['product_select']; - $file_list[$i]['text'] = $config_files_data; - $i++; - } - } else { $file_list = NULL; } - - $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $dget['product_select'] . "'"; - $data = sql($sql,'getAll', DB_FETCHMODE_ASSOC); - $i = 0; - if (count($data)) { - //$data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - foreach ($data as $row2) { - $sql_file_list[$i]['value'] = $row2['id']; - $sql_file_list[$i]['text'] = $row2['name']; - $sql_file_list[$i]['ref'] = $row2['original_name']; - $i++; - } - } else { $sql_file_list = NULL; } - - - require_once($this->PHONE_MODULES_PATH . 'setup.php'); - $class = "endpoint_" . $row['directory'] . "_" . $row['cfg_dir'] . '_phone'; - $base_class = "endpoint_" . $row['directory'] . '_base'; - $master_class = "endpoint_base"; - - /********************************************************************************* - *** Quick Fix for FreePBX Distro - *** I seriously want to figure out why ONLY the FreePBX Distro can't do autoloads. - **********************************************************************************/ - if (!class_exists($master_class)) { - ProvisionerConfig::endpointsAutoload($master_class); - } - if (!class_exists($base_class)) { - ProvisionerConfig::endpointsAutoload($base_class); - } - if (!class_exists($class)) { - ProvisionerConfig::endpointsAutoload($class); - } - //end quick fix - $phone_config = new $class(); - - //TODO: remove - $template_file_list[0]['value'] = "template_data_custom.xml"; - $template_file_list[0]['text'] = "template_data_custom.xml"; - - $sql = "SELECT id, model FROM endpointman_model_list WHERE product_id = '" . $dget['product_select'] . "' AND enabled = 1 AND hidden = 0"; - $data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $i = 1; - foreach ($data as $list) { - //$template_file_list[$i]['value'] = "template_data_" . $list['model'] . "_custom.xml"; - $template_file_list[$i]['value'] = $list['id']; - $template_file_list[$i]['text'] = "template_data_" . $list['model'] . "_custom.xml"; - } - - $retarr = array("status" => true, - "message" => "OK", - "product_select" => $dget['product_select'], - "product_select_info" => $product_select_info, - "file_list" => $file_list, - "template_file_list" => $template_file_list, - "sql_file_list" => $sql_file_list); - unset($dget); - } - return $retarr; - } - - public function epm_advanced_poce_select_file() - { - if (! isset($_REQUEST['product_select'])) { - $retarr = array("status" => false, "message" => _("No send Product Select!")); - } - elseif (! is_numeric($_REQUEST['product_select'])) { - $retarr = array("status" => false, "message" => _("Product Select send is not number!")); - } - elseif ($_REQUEST['product_select'] < 0) { - $retarr = array("status" => false, "message" => _("Product Select send is number not valid!")); - } - elseif (! isset($_REQUEST['file_id'])) { - $retarr = array("status" => false, "message" => _("No send File ID!")); - } - elseif (! isset($_REQUEST['file_name'])) { - $retarr = array("status" => false, "message" => _("No send File Name!")); - } - elseif (! isset($_REQUEST['type_file'])) { - $retarr = array("status" => false, "message" => _("No send Type File!")); - } - else - { - $dget['product_select'] = $_REQUEST['product_select']; - $dget['file_name'] = $_REQUEST['file_name']; - $dget['file_id'] = $_REQUEST['file_id']; - $dget['type_file'] = $_REQUEST['type_file']; - - - if ($dget['type_file'] == "sql") { - $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $dget['file_id']; - $row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - - $type = $dget['type_file']; - $sendidt = $row['id']; - $product_select = $row['product_id']; - $save_as_name_value = $row['name']; - $original_name = $row['original_name']; - $filename = $row['name']; - $location = "SQL: ". $row['name']; - $config_data = $this->display_htmlspecialchars($row['data']); - - } - elseif ($dget['type_file'] == "file") { - $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; - $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $config_files = explode(",", $row['config_files']); - //TODO: Aadir validacion para ver si $dget['file_name'] esta en el array $config_files - - $filename = $dget['file_name']; - $pathfile = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $filename; - - - if (is_readable($pathfile)) { - if(filesize($pathfile)>0) { - $handle = fopen($pathfile, "rb"); - $contents = fread($handle, filesize($pathfile)); - fclose($handle); - $contents = $this->display_htmlspecialchars($contents); - } - else { - $contents = ""; - } - - $type = $dget['type_file']; - $sendidt = $dget['file_id']; - $product_select = $dget['product_select']; - $save_as_name_value = $filename; - $original_name = $filename; - $filename = $filename; - $location = $pathfile; - $config_data = $contents; - } - else { - $retarr = array("status" => false, "message" => _("File not readable, check the permission! ").$filename); - } - } - elseif ($dget['type_file'] == "tfile") - { - if ($dget['file_id'] == "template_data_custom.xml") - { - $sendidt = ""; - $original_name = $dget['file_name']; - $config_data = ""; - } - else { - - $sql = "SELECT * FROM endpointman_model_list WHERE id = '" . $dget['file_id'] . "'"; - $data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $sendidt = $data['id']; - $original_name = $dget['file_name']; - $config_data = unserialize($data['template_data']); - $config_data = generate_xml_from_array ($config_data, 'node'); - } - - $type = $dget['type_file']; - $product_select = $dget['product_select']; - $save_as_name_value = $dget['file_name']; - $filename = $dget['file_name']; - $location = $dget['file_name']; - } - - $retarr = array("status" => true, - "message" => "OK", - "type" => $type, - "sendidt" => $sendidt, - "product_select" => $product_select, - "save_as_name_value" => $save_as_name_value, - "original_name" => $original_name, - "filename" => $filename, - "location" => $location, - "config_data" => $config_data); - unset($dget); - } - return $retarr; - } - - - - - - - - //TODO: PENDIENTE REVISAR - function epm_advanced_poce_sendid() - { - if (! isset($_REQUEST['product_select'])) { - $retarr = array("status" => false, "message" => _("No send Product Select!")); - } - elseif (! isset($_REQUEST['type_file'])) { - $retarr = array("status" => false, "message" => _("No send Type File!")); - } - elseif (! isset($_REQUEST['sendid'])) { - $retarr = array("status" => false, "message" => _("No send SendID!")); - } - else { - $dget['product_select'] = $_REQUEST['product_select']; - $dget['type_file'] = $_REQUEST['type_file']; - $dget['sendid'] = $_REQUEST['sendid']; - $dget['original_name'] = $_REQUEST['original_name']; - $dget['config_text'] = $_REQUEST['config_text']; - - - - //DEBUGGGGGGGGGGGGG - return; - if ($dget['type_file'] == "sql") { - $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; - $row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - $this->submit_config($row['directory'], $row['cfg_dir'], $dget['original_name'], $dget['config_text']); - $retarr = array("status" => true, "message" => "Sent! Thanks :-)"); - } - elseif ($dget['type_file'] == "file") { - $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; - $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - $error = $this->submit_config($row['directory'], $row['cfg_dir'], $dget['original_name'], $dget['config_text']); - $retarr = array("status" => true, "message" => "Sent! Thanks :-)"); - } - else { - $retarr = array("status" => false, "message" => "Type not valid!"); - } - unset ($dget); - } - return $retarr; - } - - - - - - - - function epm_advanced_poce_save_file() - { - if (! isset($_REQUEST['product_select'])) { - $retarr = array("status" => false, "message" => _("No send Product Select!")); - } - elseif (! isset($_REQUEST['sendid'])) { - $retarr = array("status" => false, "message" => _("No send SendID!")); - } - elseif (! isset($_REQUEST['type_file'])) { - $retarr = array("status" => false, "message" => _("No send Type File!")); - } - elseif (! isset($_REQUEST['config_text'])) { - $retarr = array("status" => false, "message" => _("No send Text File!")); - } - elseif (! isset($_REQUEST['save_as_name'])) { - $retarr = array("status" => false, "message" => _("No send Save Name!")); - } - elseif (! isset($_REQUEST['file_name'])) { - $retarr = array("status" => false, "message" => _("No send Name File!")); - } - elseif (! isset($_REQUEST['original_name'])) { - $retarr = array("status" => false, "message" => _("No send Origianl Name File!")); - } - else - { - $dget['type_file'] = $_REQUEST['type_file']; - $dget['sendid'] = $_REQUEST['sendid']; - $dget['product_select'] = $_REQUEST['product_select']; - $dget['save_as_name'] = $_REQUEST['save_as_name']; - $dget['original_name'] = $_REQUEST['original_name']; - $dget['file_name'] = $_REQUEST['file_name']; - $dget['config_text'] = $_REQUEST['config_text']; - - - if ($dget['type_file'] == "file") - { - $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; - $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - $config_files = explode(",", $row['config_files']); - - if ((is_array($config_files)) AND (in_array($dget['file_name'], $config_files))) - { - $pathdir = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/"; - $pathfile = $pathdir . $dget['file_name']; - if ((! file_exists($pathfile)) AND (! is_writable($pathdir))) { - $retarr = array("status" => false, "message" => "Directory is not Writable (".$pathdir.")!"); - } - elseif (! is_writable($pathfile)) { - $retarr = array("status" => false, "message" => "File is not Writable (".$pathfile.")!"); - } - else - { - $wfh = fopen($pathfile, 'w'); - fwrite($wfh, $dget['config_text']); - fclose($wfh); - $retarr = array("status" => true, "message" => "Saved to Hard Drive!"); - } - } - else { - $retarr = array("status" => false, "message" => "The File no existe in the DataBase!"); - } - } - elseif ($dget['type_file'] == "sql") - { - $sql = "UPDATE endpointman_custom_configs SET data = '" . addslashes($dget['config_text']) . "' WHERE id = " . $dget['sendid']; - sql($sql); - $retarr = array("status" => true, "message" => "Saved to Database!"); - } - elseif ($dget['type_file'] == "tfile") - { - $db = $this->db; - $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES (?,?,?,?)'; - $q = $db->prepare($sql); - $ob = $q->execute(array(addslashes($dget['save_as_name']), addslashes($dget['original_name']), $dget['product_select'], addslashes($dget['config_text']))); - $newidinsert = $db->lastInsertId(); - $retarr = array("status" => true, "message" => "Saved to Database!"); - - $retarr['type_file'] = "sql"; - $retarr['location'] = "SQL: ". $dget['save_as_name']; - $retarr['sendidt'] = $newidinsert; - } - else { - $retarr = array("status" => false, "message" => "Type not valid!"); - } - - - $retarr['original_name'] = $dget['original_name']; - $retarr['file_name'] = $dget['file_name']; - $retarr['save_as_name'] = $dget['save_as_name']; - unset($dget); - } - return $retarr; - } - - function epm_advanced_poce_delete_config_custom() - { - if (! isset($_REQUEST['product_select'])) { - $retarr = array("status" => false, "message" => _("No send Product Select!")); - } - elseif (! isset($_REQUEST['type_file'])) { - $retarr = array("status" => false, "message" => _("No send Type File!")); - } - elseif (! isset($_REQUEST['sql_select'])) { - $retarr = array("status" => false, "message" => _("No send SQL Select!")); - } - else { - $dget['type_file'] = $_REQUEST['type_file']; - $dget['product_select'] = $_REQUEST['product_select']; - $dget['sql_select'] = $_REQUEST['sql_select']; - - if ($dget['type_file'] == "sql") { - $sql = "DELETE FROM endpointman_custom_configs WHERE id =" . $dget['sql_select']; - sql($sql); - unset ($sql); - $retarr = array("status" => true, "message" => "File delete ok!"); - } - else { $retarr = array("status" => false, "message" => _("Type File not valid!")); } - - unset($dget); - } - return $retarr; - } - /******************** - * END SEC FUNCTIONS * - ********************/ - - - - - - - - - /************************************************************ - **** FUNCIONES SEC MODULO "epm_advanced\manual_upload". **** - ***********************************************************/ - - public function epm_advanced_manual_upload_list_files_brans_export() - { - $path_tmp_dir = $this->PHONE_MODULES_PATH."temp/export/"; - $array_list_files = array(); - $array_count_brand = array(); - - - $array_list_exception= array(".", "..", ".htaccess"); - if(file_exists($path_tmp_dir)) - { - if(is_dir($path_tmp_dir)) - { - $l_files = scandir($path_tmp_dir, 1); - $i = 0; - foreach ($l_files as $archivo) { - if (in_array($archivo, $array_list_exception)) { continue; } - - $pathandfile = $path_tmp_dir.$archivo; - $brand = substr(pathinfo($archivo, PATHINFO_FILENAME), 0, -11); - $ftime = substr(pathinfo($archivo, PATHINFO_FILENAME), -10); - - $array_count_brand[] = $brand; - $array_list_files[$i] = array("brand" => $brand, - "pathall" => $pathandfile, - "path" => $path_tmp_dir, - "file" => $archivo, - "filename" => pathinfo($archivo, PATHINFO_FILENAME), - "extension" => pathinfo($archivo, PATHINFO_EXTENSION), - "timer" => $ftime, - "timestamp" => strftime("[%Y-%m-%d %H:%M:%S]", $ftime), - "mime_type" => mime_content_type($pathandfile), - "is_dir" => is_dir($pathandfile), - "is_file" => is_file($pathandfile), - "is_link" => is_link($pathandfile), - "readlink" => (is_link($pathandfile) == true ? readlink ($pathandfile) : NULL)); - - $i++; - } - unset ($l_files); - - $array_count_brand = array_count_values($array_count_brand); - ksort ($array_count_brand); - $array_count_brand_end = array(); - - foreach($array_count_brand as $key => $value) { - $array_count_brand_end[] = array('name' => $key , 'num' => $value); - } - - $retarr = array("status" => true, "message" => _("List Done!"), "countlist" => count($array_list_files), "list_files" => $array_list_files, "list_brands" => $array_count_brand_end ); - unset ($array_count_brand_end); - unset ($array_count_brand); - unset ($array_list_files); - } - else { - $retarr = array("status" => false, "message" => _("Not is directory: ") . $path_tmp_dir); - } - } else { - $retarr = array("status" => false, "message" => _("Directory no exists: ") . $path_tmp_dir); - } - return $retarr; - } - - public function epm_advanced_manual_upload_brand() - { - if (count($_FILES["files"]["error"]) == 0) { - echo format_txt(_("Can Not Find Uploaded Files!"), "error"); - } - else - { - foreach ($_FILES["files"]["error"] as $key => $error) { - echo format_txt(_("Importing brand file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - - if ($error != UPLOAD_ERR_OK) { - echo format_txt($this->file_upload_error_message($error), "error"); - } - else - { - - $uploads_dir = $this->PHONE_MODULES_PATH . "temp"; - $name = $_FILES["files"]["name"][$key]; - $extension = pathinfo($name, PATHINFO_EXTENSION); - if ($extension == "tgz") { - - $tmp_name = $_FILES["files"]["tmp_name"][$key]; - $uploads_dir_file = $uploads_dir."/".$name; - move_uploaded_file($tmp_name, $uploads_dir_file); - - if (file_exists($uploads_dir_file)) - { - $temp_directory = sys_get_temp_dir() . "/epm_temp/"; - if (!file_exists($temp_directory)) { - echo format_txt(_("Creating EPM temp directory...")); - if (mkdir($temp_directory) == true) { - echo format_txt(_("Done!"), "done"); - } - else { - echo format_txt(_("Error!"), "error"); - } - } - if (file_exists($temp_directory)) - { - if ($this->configmod->get('debug')) { - echo format_txt(_("Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........"),"",array("%_FILEPACKAGE_%" => $uploads_dir_file, "%_TEMPDIR_%" => $temp_directory)); - } else { - echo format_txt(_("Extracting Tarball........ ")); - } - exec("tar -xvf ".$uploads_dir_file." -C ".$temp_directory); - echo format_txt(_("Done!"), "done"); - - $package = basename($name, ".tgz"); - $package = explode("-",$package); - - if ($this->configmod->get('debug')) { - echo format_txt(_("Looking for file %_FILEPACKAGE_% to pass on to update_brand()..."),"",array("%_FILEPACKAGE_%" => $temp_directory.$package[0])); - } else { - echo format_txt(_("Looking file and update brand's....")); - } - - if(file_exists($temp_directory.$package[0])) { - $this->update_brand($package[0],FALSE); - // Note: no need to delete/unlink/rmdir as this is handled in update_brand() - } else { - echo format_txt(_("Please name the Package the same name as your brand!")); - } - } - } - else { - echo format_txt(_("No File Provided!"), "error"); - //echo "File ".$this->PHONE_MODULES_PATH."temp/".$_REQUEST['package']." not found.
      "; - } - } - else { - echo format_txt(_("Invalid File Extension!"), "error"); - } - } - } - } - } - - public function epm_advanced_manual_upload_provisioner () - { - if (count($_FILES["files"]["error"]) == 0) { - echo format_txt(_("Can Not Find Uploaded Files!"), "error"); - } - else - { - foreach ($_FILES["files"]["error"] as $key => $error) { - echo format_txt(_("Importing Provisioner file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - - if ($error != UPLOAD_ERR_OK) { - echo format_txt($this->file_upload_error_message($error), "error"); - } - else - { - $uploads_dir = $this->PHONE_MODULES_PATH . "temp"; - $name = $_FILES["files"]["name"][$key]; - $extension = pathinfo($name, PATHINFO_EXTENSION); - if ($extension == "tgz") - { - $tmp_name = $_FILES["files"]["tmp_name"][$key]; - $uploads_dir_file = $uploads_dir."/".$name; - move_uploaded_file($tmp_name, $uploads_dir_file); - - if (file_exists($uploads_dir_file)) { - echo format_txt(_("Extracting Provisioner Package...")); - exec("tar -xvf ".$uploads_dir_file." -C ".$uploads_dir."/"); - echo format_txt(_("Done!"), "done"); - - if(!file_exists($this->PHONE_MODULES_PATH."endpoint")) { - echo format_txt(_("Creating Provisioner Directory...")); - if (mkdir($this->PHONE_MODULES_PATH."endpoint") == true) { - echo format_txt(_("Done!"), "done"); - } - else { - echo format_txt(_("Error!"), "error"); - } - } - - if(file_exists($this->PHONE_MODULES_PATH."endpoint")) - { - $endpoint_last_mod = filemtime($this->PHONE_MODULES_PATH."temp/endpoint/base.php"); - rename($this->PHONE_MODULES_PATH."temp/endpoint/base.php", $this->PHONE_MODULES_PATH."endpoint/base.php"); - - echo format_txt(_("Updating Last Modified...")); - $sql = "UPDATE endpointman_global_vars SET value = '".$endpoint_last_mod."' WHERE var_name = 'endpoint_vers'"; - sql($sql); - echo format_txt(_("Done!"),"done"); - } - - } else { - echo format_txt(_("File Temp no Exists!"), "error"); - } - } else { - echo format_txt(_("Invalid File Extension!"), "error"); - } - } - } - } - } - - public function epm_advanced_manual_upload_export_brans_available_file() - { - if ((! isset($_REQUEST['file_package'])) OR ($_REQUEST['file_package'] == "")) { - header('HTTP/1.0 404 Not Found', true, 404); - echo "

      Error 404 Not Found

      "; - echo "No send name file!"; - die(); - } - else { - $dget['file_package'] = $_REQUEST['file_package']; - $path_tmp_file = $this->PHONE_MODULES_PATH."/temp/export/".$_REQUEST['file_package']; - - if (! file_exists($path_tmp_file)) { - header('HTTP/1.0 404 Not Found', true, 404); - echo "

      Error 404 Not Found

      "; - echo "File no exist!"; - die(); - } - else { - header('Content-Description: File Transfer'); - header('Content-Type: application/octet-stream'); - header('Content-Disposition: attachment; filename="'.basename($dget['file_package']).'"'); - header('Expires: 0'); - header('Cache-Control: must-revalidate'); - header('Pragma: public'); - header('Content-Length: ' . filesize($path_tmp_file)); - readfile($path_tmp_file); - exit; - } - unset ($path_tmp_file); - unset ($dget); - } - exit; - } - - public function epm_advanced_manual_upload_export_brans_available() - { - if ((! isset($_REQUEST['package'])) OR ($_REQUEST['package'] == "")) { - echo format_txt(_("No package set!"), "error"); - } - elseif ((! is_numeric($_REQUEST['package'])) OR ($_REQUEST['package'] < 0)) { - echo format_txt(_("Package not valid!"), "error"); - } - else { - $dget['package'] = $_REQUEST['package']; - - $sql = 'SELECT `name`, `directory` FROM `endpointman_brand_list` WHERE `id` = '.$dget['package'].''; - $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - if ($row == "") { - echo format_txt(_("ID Package send not valid, brand not exist!"), "error"); - } - else { - echo format_txt(_("Exporting %_NAME_%"), "", array("%_NAME_%" => $row['name'])); - - if(!file_exists($this->PHONE_MODULES_PATH."/temp/export/")) { - mkdir($this->PHONE_MODULES_PATH."/temp/export/"); - } - $time = time(); - exec("tar zcf ".$this->PHONE_MODULES_PATH."temp/export/".$row['directory']."-".$time.".tgz --exclude .svn --exclude firmware -C ".$this->PHONE_MODULES_PATH."/endpoint ".$row['directory']); - - - echo format_txt(_("Done!"), "done"); - echo format_txt(_("Click this link to download:")); - echo ""; - echo format_txt(_("Here")); - echo ""; - //echo "Done! Click this link to download:Here"; - } - unset ($dget); - } - } - - /******************** - * END SEC FUNCTIONS * - ********************/ - - - - /*************************************************** - **** FUNCIONES SEC MODULO "epm_advanced\iedl". **** - **************************************************/ - - public function epm_advanced_iedl_export($sFileName = "devices_list.csv") - { - header("Content-type: text/csv"); - header('Content-Disposition: attachment; filename="'.$sFileName.'"'); - $outstream = fopen("php://output",'w'); - $sql = 'SELECT endpointman_mac_list.mac, endpointman_brand_list.name, endpointman_model_list.model, endpointman_line_list.ext,endpointman_line_list.line FROM endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_line_list WHERE endpointman_line_list.mac_id = endpointman_mac_list.id AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_model_list.brand = endpointman_brand_list.id'; - $result = sql($sql,'getAll',DB_FETCHMODE_ASSOC); - foreach($result as $row) { - fputcsv($outstream, $row); - } - fclose($outstream); - exit; - } - - //Dave B's Q&D file upload security code (http://us2.php.net/manual/en/features.file-upload.php) - public function epm_advanced_iedl_import() - { - if (count($_FILES["files"]["error"]) == 0) { - echo format_txt(_("Can Not Find Uploaded Files!"), "error"); - } - else - { - $allowedExtensions = array("application/csv", "text/plain"); - - foreach ($_FILES["files"]["error"] as $key => $error) { - echo format_txt(_("Importing CVS file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - - if ($error != UPLOAD_ERR_OK) { - echo format_txt($this->file_upload_error_message($error), "error"); - } - else - { - if (!in_array($_FILES["files"]["type"][$key], $allowedExtensions)) { - echo format_txt(_("We support only CVS and TXT files, type file %_FILE_% no support!"), "error", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - } - elseif ($_FILES["files"]["size"][$key] == 0) { - echo format_txt(_("File %_FILE_% size is 0!"), "error", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - } - else { - $uploadfile = $this->LOCAL_PATH . basename($_FILES["files"]["name"][$key]); - $uploadtemp = $_FILES["files"]["tmp_name"][$key]; - - if (move_uploaded_file($uploadtemp, $uploadfile)) { - //Parse the uploaded file - $handle = fopen($uploadfile, "r"); - $i = 1; - while (($device = fgetcsv($handle, filesize($uploadfile))) !== FALSE) { - if ($device[0] != "") { - if ($mac = $this->mac_check_clean($device[0])) { - $sql = "SELECT id FROM endpointman_brand_list WHERE name LIKE '%" . $device[1] . "%' LIMIT 1"; - $res = sql($sql); - - if ($res->numRows() > 0) { - $brand_id = sql($sql, 'getOne'); - $brand_id = $brand_id[0]; - - $sql_model = "SELECT id FROM endpointman_model_list WHERE brand = " . $brand_id . " AND model LIKE '%" . $device[2] . "%' LIMIT 1"; - $sql_ext = "SELECT extension, name FROM users WHERE extension LIKE '%" . $device[3] . "%' LIMIT 1"; - - $line_id = isset($device[4]) ? $device[4] : 1; - - $res_model = sql($sql_model); - if ($res_model->numRows()) { - $model_id = sql($sql_model, 'getRow', DB_FETCHMODE_ASSOC); - $model_id = $model_id['id']; - - $res_ext = sql($sql_ext); - if ($res_ext->numRows()) { - $ext = sql($sql_ext, 'getRow', DB_FETCHMODE_ASSOC); - $description = $ext['name']; - $ext = $ext['extension']; - - $this->add_device($mac, $model_id, $ext, 0, $line_id, $description); - - echo format_txt(_("Done!"), "done"); - } else { - echo format_txt(_("Invalid Extension Specified on line %_LINE_%!"), "error", array("%_LINE_%" => $i)); - } - } else { - echo format_txt(_("Invalid Model Specified on line %_LINE_%!"), "error", array("%_LINE_%" => $i)); - } - } else { - echo format_txt(_("Invalid Brand Specified on line %_LINE_%!"), "error", array("%_LINE_%" => $i)); - } - } else { - echo format_txt(_("Invalid Mac on line %_LINE_%!"), "error", array("%_LINE_%" => $i)); - } - } - $i++; - } - fclose($handle); - unlink($uploadfile); - echo format_txt(_("Please reboot & rebuild all imported phones"), "done"); - } else { - echo format_txt(_("Possible file upload attack!"), "error"); - } - } - } - } - } - } - - /******************** - * END SEC FUNCTIONS * - ********************/ - - - - /********************************************************** - **** FUNCIONES SEC MODULO "epm_advanced\oui_manager". **** - *********************************************************/ - - private function epm_advanced_oui_remove() - { - //TODO: Aadir validacion de si es custom o no - if ((! isset($_REQUEST['id_del'])) OR ($_REQUEST['id_del'] == "")) { - $retarr = array("status" => false, "message" => _("No ID set!")); - } - elseif ((! is_numeric($_REQUEST['id_del'])) OR ($_REQUEST['id_del'] < 0)) { - $retarr = array("status" => false, "message" => _("ID not valid!"), "id" => $_REQUEST['id']); - } - else - { - $dget['id'] = $_REQUEST['id_del']; - - $sql = "DELETE FROM endpointman_oui_list WHERE id = " . $dget['id']; - sql($sql); - - $retarr = array("status" => true, "message" => "OK", "id" => $dget['id']); - unset($dget); - } - return $retarr; - } - - private function epm_advanced_oui_add() - { - //TODO: Pendiente aadir isExiste datos. - if ((! isset($_REQUEST['number_new_oui'])) OR ($_REQUEST['number_new_oui'] == "")) { - $retarr = array("status" => false, "message" => _("No OUI set!")); - } - elseif ((! isset($_REQUEST['brand_new_oui'])) OR ($_REQUEST['brand_new_oui'] == "")) { - $retarr = array("status" => false, "message" => _("No Brand set!")); - } - else { - $dget['oui'] = $_REQUEST['number_new_oui']; - $dget['brand'] = $_REQUEST['brand_new_oui']; - - $sql = "INSERT INTO endpointman_oui_list (oui, brand, custom) VALUES ('" . $dget['oui'] . "', '" . $dget['brand'] . "', '1')"; - sql($sql); - - $retarr = array("status" => true, "message" => "OK", "oui" => $dget['oui'], "brand" => $dget['brand']); - unset($dget); - } - return $retarr; - } - - /******************** - * END SEC FUNCTIONS * - ********************/ - - - - /****************************************************** - **** FUNCIONES SEC MODULO "epm_advanced\settings". **** - ******************************************************/ - - public function epm_advanced_config_loc_is_writable() - { - $config_loc = $this->configmod->get("config_loc"); - $tftp_writable = FALSE; - if ((isset($config_loc)) AND ($config_loc != "")) { - if ((file_exists($config_loc)) AND (is_dir($config_loc))) { - if (is_writable($config_loc)) { - $tftp_writable = TRUE; - } - } - } - return $tftp_writable; - } - - private function epm_advanced_settings_saveconfig () - { - if (! isset($_REQUEST['name'])) { - $retarr = array("status" => false, "message" => _("No send name!")); - } - elseif (! isset($_REQUEST['value'])) { - $retarr = array("status" => false, "message" => _("No send value!")); - } - else - { - $dget['name'] = strtolower($_REQUEST['name']); - $dget['value'] = $_REQUEST['value']; - switch($dget['name']) { - case "enable_ari": - $dget['value'] = strtolower($dget['value']); - $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='enable_ari'"; - break; - - case "enable_debug": - $dget['value'] = strtolower($dget['value']); - $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='debug'"; - break; - - case "disable_help": - $dget['value'] = strtolower($dget['value']); - $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='disable_help'"; - break; - - case "allow_dupext": - $dget['value'] = strtolower($dget['value']); - $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='show_all_registrations'"; - break; - - case "allow_hdfiles": - $dget['value'] = strtolower($dget['value']); - $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='allow_hdfiles'"; - break; - - case "tftp_check": - $dget['value'] = strtolower($dget['value']); - $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='tftp_check'"; - break; - - case "backup_check": - $dget['value'] = strtolower($dget['value']); - $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='backup_check'"; - break; - - case "use_repo": - $dget['value'] = strtolower($dget['value']); - if (($dget['value'] == "yes") and (! $this->has_git())) { - $retarr = array("status" => false, "message" => _("Git not installed!")); - } - else { - $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='use_repo'"; - } - break; - - case "config_loc": - $dget['value'] = trim($dget['value']); - //No trailing slash. Help the user out and add one :-) - if ($dget['value'][strlen($dget['value']) - 1] != "/") { - $dget['value'] = $dget['value'] . "/"; - } - if ($dget['value'] != "") { - if ((file_exists($dget['value'] = $dget['value'])) AND (is_dir($dget['value'] = $dget['value']))) { - if (is_writable($dget['value'] = $dget['value'])) { - $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='config_location'"; - } else { - $retarr = array("status" => false, "message" => _("Directory Not Writable!")); - } - } else { - $retarr = array("status" => false, "message" => _("Not a Vaild Directory.
      Try to run 'mkdir " . $_POST['config_loc'] . "' as root.")); - } - } else { - $retarr = array("status" => false, "message" => _("No Configuration Location Defined!")); - } - break; - - case "srvip": - $dget['value'] = trim($dget['value']); - $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='srvip'"; - break; - - case "tz": - $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='tz'"; - break; - - case "ntp_server": - $dget['value'] = trim($dget['value']); - $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='ntp'"; - break; - - case "nmap_loc": - $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='nmap_location'"; - break; - - case "arp_loc": - $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='arp_location'"; - break; - - case "asterisk_loc": - $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='asterisk_location'"; - break; - - case "package_server": - $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='update_server'"; - break; - - case "cfg_type": - if ($dget['value'] == 'http') { - $symlink = $this->config->get('AMPWEBROOT') . "/provisioning"; - $reallink = $this->LOCAL_PATH . "provisioning"; - if ((!is_link($symlink)) OR (!readlink($symlink) == $reallink)) { - if (!symlink($reallink, $symlink)) { - $retarr = array("status" => false, "message" => _("Your permissions are wrong on " . $this->config->get('AMPWEBROOT') . ", web provisioning link not created!")); - //$dget['value'] = 'file'; - break; - } else { - $dget['value'] = 'http'; - } - } else { - $dget['value'] = 'http'; - } - } else { - $dget['value'] = 'file'; - } - $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='server_type'"; - break; - - default: - $retarr = array("status" => false, "message" => _("Name invalid: ") . $dget['name'] ); - } - if (isset($sql)) { - sql($sql); - $retarr = array("status" => true, "message" => "OK", "name" => $dget['name'], "value" => $dget['value']); - unset($sql); - } - unset($dget); - } - return $retarr; - } - - /******************** - * END SEC FUNCTIONS * - ********************/ - - - - /*************************************************** - **** FUNCIONES SEC MODULO "epm_config\manager". **** - ***************************************************/ - - private function epm_config_manager_check_for_updates () - { - $this->update_check(); - $retarr = array("status" => true, "message" => "OK"); - return $retarr; - } - - private function epm_config_manager_brand() - { - if (! isset($_REQUEST['command_sub'])) { - throw new \Exception("Not send command_sub!"); - } - elseif (! isset($_REQUEST['idfw'])) { - throw new \Exception("Not send ID!"); - } - else if (! is_numeric($_REQUEST['idfw'])) { - throw new \Exception("ID not is numbre!"); - } - else - { - $dget['command'] = strtolower($_REQUEST['command_sub']); - $dget['id'] = $_REQUEST['idfw']; - - switch($dget['command']) { - case "brand_install": - $this->download_brand($dget['id']); - break; - - case "brand_update": - $this->download_brand($dget['id']); - break; - - case "brand_uninstall": - $this->remove_brand($dget['id']); - break; - - default: - echo "
      " . _("Error: Command not found!"). " [" . $dget['command'] . "]" . "
      "; - } - $this->update_check(); - unset ($dget); - } - } - - private function epm_config_manager_firmware() - { - if (! isset($_REQUEST['command_sub'])) { - throw new \Exception("Not send command_sub!"); - } - elseif (! isset($_REQUEST['idfw'])) { - throw new \Exception("Not send ID!"); - } - else if (! is_numeric($_REQUEST['idfw'])) { - throw new \Exception("ID not is numbre!"); - } - else - { - $dget['command'] = strtolower($_REQUEST['command_sub']); - $dget['id'] = $_REQUEST['idfw']; - - switch($dget['command']) { - case "fw_install": - $this->install_firmware($dget['id']); - break; - - case "fw_update": - $this->install_firmware($dget['id']); - break; - - case "fw_uninstall": - $this->remove_firmware($dget['id']); - break; - - default: - echo "
      " . _("Error: Command not found!"). " [" . $dget['command'] . "]" . "
      "; - } - unset ($dget); - } - } - - private function epm_config_manager_saveconfig() - { - if (! isset($_REQUEST['name'])) { - $retarr = array("status" => false, "message" => _("No send name!")); - } - elseif (! isset($_REQUEST['value'])) { - $retarr = array("status" => false, "message" => _("No send value!")); - } - elseif (! isset($_REQUEST['idbt'])) { - $retarr = array("status" => false, "message" => _("No send id!")); - } - elseif (! isset($_REQUEST['idtype'])) { - $retarr = array("status" => false, "message" => _("No send idtype!")); - } - elseif (! is_numeric($_REQUEST['idbt'])) { - $retarr = array("status" => false, "message" => _("ID send is not number!")); - } - else - { - $dget['name'] = strtolower($_REQUEST['name']); - $dget['value'] = strtolower($_REQUEST['value']); - $dget['idtype'] = strtolower($_REQUEST['idtype']); - $dget['id'] = $_REQUEST['idbt']; - - switch($dget['idtype']) { - case "marca": - $sql = "UPDATE endpointman_brand_list SET enabled = '" .$dget['value']. "' WHERE id = '".$dget['id']."'"; - break; - - case "modelo": - $sql = "UPDATE endpointman_model_list SET enabled = " .$dget['value']. " WHERE id = '".$dget['id']."'"; - break; - - default: - $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); - } - if (isset($sql)) { - sql($sql); - $retarr = array("status" => true, "message" => "OK", "name" => $dget['name'], "value" => $dget['value'], "idtype" => $dget['idtype'], "id" => $dget['id']); - unset($sql); - } - unset($dget); - } - return $retarr; - } - - public function epm_config_manager_hardware_get_list_all($check_for_updates = true) - { - $row_out = array(); - $i = 0; - $brand_list = $this->epm_config_hardware_get_list_brand(true); - //FIX: https://github.com/FreePBX-ContributedModules/endpointman/commit/2ad929d0b38f05c9da1b847426a4094c3314be3b - if($check_for_updates) $brand_up = $this->update_check(); - foreach ($brand_list as $row) - { - $row_out[$i] = $row; - $row_out[$i]['count'] = $i; - $row_out[$i]['cfg_ver_datetime'] = date("c",$row['cfg_ver']); - - if($check_for_updates) - { - $id = $this->system->arraysearchrecursive($row['name'], $brand_up,'name'); - $id = $id[0]; - if((isset($brand_up[$id]['update'])) AND ($row['installed'] == 1)) { - $row_out[$i]['update'] = $brand_up[$id]['update']; - } else { - $row_out[$i]['update'] = ""; - } - if(isset($brand_up[$id]['update_vers'])) { - //$row_out[$i]['update_vers'] = date("n-j-y",$brand_up[$id]['update_vers']) . " at " . date("g:ia",$brand_up[$id]['update_vers']); - $row_out[$i]['update_vers'] = date("c",$brand_up[$id]['update_vers']); - } else { - $row_out[$i]['update_vers'] = ""; - } - } - else - { - if (! isset($row_out[$i]['update'])) { $row_out[$i]['update'] = ""; } - if (! isset($row_out[$i]['update_vers'])) { $row_out[$i]['update_vers'] = ""; } - } - if ($row['hidden'] == 1) { continue; } - - - $j = 0; - $product_list = $this->epm_config_hardware_get_list_product($row['id'], true); - foreach($product_list as $row2) { - $row_out[$i]['products'][$j] = $row2; - - if($check_for_updates) { - if((array_key_exists('firmware_vers', $row2)) AND ($row2['firmware_vers'] > 0)) { - $temp = $this->firmware_update_check($row2['id']); - $row_out[$i]['products'][$j]['update_fw'] = 1; - $row_out[$i]['products'][$j]['update_vers_fw'] = $temp['data']['version']; - } else { - $row_out[$i]['products'][$j]['update_fw'] = 0; - $row_out[$i]['products'][$j]['update_vers_fw'] = ""; - } - } - else - { - if (! isset($row_out[$i]['products'][$j]['update_fw'])) { $row_out[$i]['products'][$j]['update_fw'] = 0; } - if (! isset($row_out[$i]['products'][$j]['update_vers_fw'])) { $row_out[$i]['products'][$j]['update_vers_fw'] = ""; } - } - $row_out[$i]['products'][$j]['fw_type'] = $this->firmware_local_check($row2['id']); - if ($row2['hidden'] == 1) { continue; } - - $k = 0; - $model_list = $this->epm_config_hardware_get_list_models($row2['id'], true); - foreach($model_list as $row3) - { - $row_out[$i]['products'][$j]['models'][$k] = $row3; - if($row_out[$i]['products'][$j]['models'][$k]['enabled']){ - $row_out[$i]['products'][$j]['models'][$k]['enabled_checked'] = 'checked'; - } - $k++; - } - $j++; - } - $i++; - } - return $row_out; - } - /******************** - * END SEC FUNCTIONS * - ********************/ - - - - /************************************************** - **** FUNCIONES SEC MODULO "epm_config\editor". **** - **************************************************/ - private function epm_config_editor_saveconfig() - { - if (! isset($_REQUEST['name'])) { - $retarr = array("status" => false, "message" => _("No send name!")); - } - elseif (! isset($_REQUEST['value'])) { - $retarr = array("status" => false, "message" => _("No send value!")); - } - elseif (($_REQUEST['value'] > 1 ) and ($_REQUEST['value'] < 0)) - { - $retarr = array("status" => false, "message" => _("Invalid Value!")); - } - elseif (! isset($_REQUEST['idbt'])) { - $retarr = array("status" => false, "message" => _("No send id!")); - } - elseif (! isset($_REQUEST['idtype'])) { - $retarr = array("status" => false, "message" => _("No send idtype!")); - } - elseif (! is_numeric($_REQUEST['idbt'])) { - $retarr = array("status" => false, "message" => _("ID send is not number!")); - } - else - { - $dget['name'] = strtolower($_REQUEST['name']); - $dget['value'] = strtolower($_REQUEST['value']); - $dget['idtype'] = strtolower($_REQUEST['idtype']); - $dget['id'] = $_REQUEST['idbt']; - - switch($dget['idtype']) { - case "marca": - $sql = "UPDATE endpointman_brand_list SET hidden = '".$dget['value'] ."' WHERE id = '".$dget['id']."'"; - break; - - case "producto": - $sql = "UPDATE endpointman_product_list SET hidden = '". $dget['value'] ."' WHERE id = '".$dget['id']."'"; - break; - - case "modelo": - $sql = "UPDATE endpointman_model_list SET hidden = '". $dget['value'] ."' WHERE id = '".$dget['id']."'"; - break; - - default: - $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); - } - if (isset($sql)) { - sql($sql); - $retarr = array("status" => true, "message" => "OK", "name" => $dget['name'], "value" => $dget['value'], "idtype" => $dget['idtype'], "id" => $dget['id']); - unset($sql); - } - unset($dget); - } - return $retarr; - } - - /** - * Get info all brdans, prodics, models. - * @return array - */ - public function epm_config_editor_hardware_get_list_all () - { - $row_out = array(); - $i = 0; - foreach ($this->epm_config_hardware_get_list_brand(true) as $row) - { - $row_out[$i] = $row; - $row_out[$i]['count'] = $i; - if ($row['installed']) - { - $j = 0; - foreach ($this->epm_config_hardware_get_list_product($row['id'], true) as $row2) - { - $row_out[$i]['products'][$j] = $row2; - $k = 0; - foreach ($this->epm_config_hardware_get_list_models($row2['id'], true) as $row3) { - $row_out[$i]['products'][$j]['models'][$k] = $row3; - $k++; - } - $j++; - } - } - $i++; - } - return $row_out; - } - /******************** - * END SEC FUNCTIONS * - ********************/ - - - - - - - - - - - - - - - - - - - - - - - /***************************************** - ****** CODIGO ANTIGUO -- REVISADO ******** - *****************************************/ - - - /** - * Check for new firmware on the servers - * @param int $id Product ID - * @return bool True on yes False on no - */ - function firmware_update_check($id=NULL) { - $sql = "SELECT * FROM endpointman_product_list WHERE id ='" . $id . "'"; - $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $sql = "SELECT directory FROM endpointman_brand_list WHERE id ='" . $row['brand'] . "'"; - $brand_directory = sql($sql, 'getOne'); - - //config drive unknown! - if ($row['cfg_dir'] == "") { - return FALSE; - } else { - $temp = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $brand_directory . "/" . $row['cfg_dir'] . "/family_data.json"); - if ((array_key_exists('data', $temp)) AND (!is_array($temp['data']['firmware_ver']))) { - if ($row['firmware_vers'] < $temp['data']['firmware_ver']) { - return $temp; - } else { - return FALSE; - } - } else { - return FALSE; - } - } - } - - /** - * Check to see the status of the firmware locally (installed or not) - * @param int $id - * @return string - */ - function firmware_local_check($id=NULL) { - $sql = "SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id ='" . $id . "'"; - $res = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - - if (count($res) > 0) { - $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $sql = "SELECT directory FROM endpointman_brand_list WHERE hidden = 0 AND id ='" . $row['brand'] . "'"; - $brand_directory = sql($sql, 'getOne'); - - //config drive unknown! - if ($row['cfg_dir'] == "") { - return("nothing"); - } else { - $temp = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $brand_directory . "/" . $row['cfg_dir'] . "/family_data.json"); - if (isset($temp['data']['firmware_ver'])) { - if ($row['firmware_vers'] == "") { - return("install"); - } else { - return("remove"); - } - } else { - return("nothing"); - } - } - } else { - return("nothing"); - } - } - - /** - * Reads a file. Json decodes it and will report any errors back - * @param string $file location of file - * @return mixed false on error, array on success - * @version 2.11 - */ - function file2json($file) { - if (file_exists($file)) { - $json = file_get_contents($file); - $data = json_decode($json, TRUE); - if(function_exists('json_last_error')) { - switch (json_last_error()) { - case JSON_ERROR_NONE: - return($data); - break; - case JSON_ERROR_DEPTH: - $this->error['file2json'] = _('Maximum stack depth exceeded'); - break; - case JSON_ERROR_STATE_MISMATCH: - $this->error['file2json'] = _('Underflow or the modes mismatch'); - break; - case JSON_ERROR_CTRL_CHAR: - $this->error['file2json'] = _('Unexpected control character found'); - break; - case JSON_ERROR_SYNTAX: - $this->error['file2json'] = _('Syntax error, malformed JSON'); - break; - case JSON_ERROR_UTF8: - $this->error['file2json'] = _('Malformed UTF-8 characters, possibly incorrectly encoded'); - break; - default: - $this->error['file2json'] = _('Unknown error'); - break; - } - return(false); - } else { - //Probably an older version of PHP. That's ok though - return($data); - } - } else { - $this->error['file2json'] = _('Cant find file:').' '.$file ; - return(false); - } - } - - /** - * Check for new packges for brands. These packages will include phone models and such which the user can remove if they want - * This function will alos auto-update the provisioner.net library incase anything has changed - * @return array An array of all the brands/products/models and information about what's enabled, installed or otherwise - */ - function update_check($echotxt = false) { - $temp_location = $this->sys_get_temp_dir() . "/epm_temp/"; - if (!$this->configmod->get('use_repo')) { - $master_result = $this->system->download_file($this->UPDATE_PATH . "master.json", $this->PHONE_MODULES_PATH . "endpoint/master.json"); - - if (!$master_result) { - $this->error['brand_update_check_master'] = "Not able to connect to repository. Using local master file instead."; -if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local master file instead."), "error"); } - } - - $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/master.json'); - $endpoint_package = $temp['data']['package']; - $endpoint_last_mod = $temp['data']['last_modified']; - - $sql = "SELECT value FROM endpointman_global_vars WHERE var_name LIKE 'endpoint_vers'"; - $data = sql($sql, 'getOne'); - - $contents = file_get_contents($this->UPDATE_PATH . "/update_status"); - if ($contents != '1') { - if (($data == "") OR ($data <= $endpoint_last_mod)) { - if ((!$master_result) OR (!$this->system->download_file($this->UPDATE_PATH . '/' . $endpoint_package, $temp_location . $endpoint_package))) { - $this->error['brand_update_check_json'] = "
      Not able to connect to repository. Using local Provisioner.net Package"; -if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local Provisioner.net Package."), "error"); } - } else { - exec("tar -xvf " . $temp_location . $endpoint_package . " -C " . $temp_location); - - if (!file_exists($this->PHONE_MODULES_PATH . "endpoint")) { - mkdir($this->PHONE_MODULES_PATH . "endpoint"); - } - - //TODO: Automate this somehow... - rename($temp_location . "setup.php", $this->PHONE_MODULES_PATH . "autoload.php"); - rename($temp_location . "endpoint/base.php", $this->PHONE_MODULES_PATH . "endpoint/base.php"); - rename($temp_location . "endpoint/global_template_data.json", $this->PHONE_MODULES_PATH . "endpoint/global_template_data.json"); - - $sql = "UPDATE endpointman_global_vars SET value = '" . $endpoint_last_mod . "' WHERE var_name = 'endpoint_vers'"; - sql($sql); - } - } - - $out = $temp['data']['brands']; - //Assume that if we can't connect and find the master.xml file then why should we try to find every other file. - if ($master_result) { - $row = sql('SELECT * FROM endpointman_brand_list WHERE id > 0', 'getAll', DB_FETCHMODE_ASSOC); - foreach ($out as $data) { - - $local = sql("SELECT local FROM endpointman_brand_list WHERE directory = '" . $data['directory'] . "'", 'getOne'); - - if (!$local) { - $result = $this->system->download_file($this->UPDATE_PATH . $data['directory'] . "/" . $data['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json"); - if (!$result) { - $this->error['brand_update_check'] = "
      Not able to connect to repository. Using local brand [" . $data['name'] . "] file instead."; -if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local brand [%_brandname_%] file instead."), "error", array("%_brandname_%" => $data['name'])); } - } - } - - if (file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json")) { - $temp = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json"); - $temp = $temp['data']['brands']; - if (array_key_exists('oui_list', $temp)) { - foreach ($temp['oui_list'] as $oui) { - $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('" . $oui . "', '" . $temp['brand_id'] . "', '0')"; - sql($sql); - } - } - $brand_name = $temp['directory']; - $version[$brand_name] = $temp['last_modified']; - $last_mod = ""; - foreach ($temp['family_list'] as $list) { - $last_mod = max($last_mod, $list['last_modified']); - } - $last_mod = max($last_mod, $version[$brand_name]); - $version[$brand_name] = $last_mod; - if (!($this->system->arraysearchrecursive($brand_name, $row, 'directory'))) { - //insert row - $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('" . $temp['brand_id'] . "', '" . $temp['name'] . "', '" . $temp['directory'] . "', '" . $version[$brand_name] . "')"; - $_SESSION["sqlerr"] = $sql; - sql($sql); - } else { - //in database already! - } - } else { - $this->error['brand_update_check_local_file'] = "
      Error: No Local File for " . $data['name'] . "!

      Learn how to manually upload packages here (it's easy!): Click Here!"; -if ($echotxt) { - echo format_txt(_("Error: No Local File for %_name_% !"), "error", array("%_name_%" => $data['name'])); - echo format_txt(_("Learn how to manually upload packages here (it's easy!):"), "error"); - echo format_txt(_("Click Here!"), "error"); -} - } - } - - foreach ($row as $ava_brands) { - $key = $this->system->arraysearchrecursive($ava_brands['directory'], $out, 'directory'); - if ($key === FALSE) { - $this->remove_brand($ava_brands['id']); - } else { - $key = $key[0]; - $brand_name = $ava_brands['directory']; - //TODO: This seems old - if ($ava_brands['cfg_ver'] < $version[$brand_name]) { - $out[$key]['update'] = 1; - $out[$key]['update_vers'] = $version[$brand_name]; - } else { - $out[$key]['update'] = NULL; - } - } - } - } else { - $this->error['brand_update_check_master_file'] = "
      Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!

      Learn how to manually upload packages here (it's easy!): Click Here!"; -if ($echotxt) { - echo format_txt(_("Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"), "error"); - echo format_txt(_("Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"), "error"); - echo format_txt(_("Click Here!"), "error"); -} - } - - return $out; - } else { - $this->error['remote_server'] = "The Remote Server Is Currently Syncing With the Master Server, Please try again later"; -if ($echotxt) { echo format_txt(_("The Remote Server Is Currently Syncing With the Master Server, Please try again later"), "error"); } - } - } else { - $o = getcwd(); - chdir(dirname($this->PHONE_MODULES_PATH)); - $path = $this->has_git(); - exec($path . ' git pull', $output); - //exec($path . ' git checkout master', $output); //Why am I doing this? - chdir($o); - $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/master.json'); - $endpoint_package = $temp['data']['package']; - $endpoint_last_mod = $temp['data']['last_modified']; - - $sql = "UPDATE endpointman_global_vars SET value = '" . $endpoint_last_mod . "' WHERE var_name = 'endpoint_vers'"; - sql($sql); - - $out = $temp['data']['brands']; - $row = sql('SELECT * FROM endpointman_brand_list WHERE id > 0', 'getAll', DB_FETCHMODE_ASSOC); - - foreach ($out as $data) { - $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/' . $data['directory'] . '/brand_data.json'); - if (key_exists('directory', $temp['data']['brands'])) { - - //Pull in all variables - $directory = $temp['data']['brands']['directory']; - $brand_name = $temp['data']['brands']['name']; - $brand_id = $temp['data']['brands']['brand_id']; - $brand_version = $temp['data']['brands']['last_modified']; - - $b_data = sql("SELECT id FROM endpointman_brand_list WHERE id = '" . $brand_id . "'", 'getOne'); - if ($b_data) { - $sql = "UPDATE endpointman_brand_list SET local = '1', name = '" . $brand_name . "', cfg_ver = '" . $brand_version . "', installed = 1, hidden = 0 WHERE id = " . $brand_id; - sql($sql); - } else { - $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '1', '1')"; - sql($sql); - } - - $last_mod = ""; - foreach ($temp['data']['brands']['family_list'] as $family_list) { - $last_mod = max($last_mod, $family_list['last_modified']); - - $family_line_xml = $this->file2json($this->PHONE_MODULES_PATH . '/endpoint/' . $directory . '/' . $family_list['directory'] . '/family_data.json'); - $family_line_xml['data']['last_modified'] = isset($family_line_xml['data']['last_modified']) ? $family_line_xml['data']['last_modified'] : ''; - - /* DONT DO THIS YET - $require_firmware = NULL; - if ((key_exists('require_firmware', $family_line_xml['data'])) && ($remote) && ($family_line_xml['data']['require_firmware'] == "TRUE")) { - echo "Firmware Requirment Detected!..........
      "; - $this->install_firmware($family_line_xml['data']['id']); - } - * - */ - - $data = sql("SELECT id FROM endpointman_product_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . "'", 'getOne'); - $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); - if ($data) { - $sql = "UPDATE endpointman_product_list SET short_name = '" . $short_name . "', long_name = '" . $family_line_xml['data']['name'] . "', cfg_ver = '" . $family_line_xml['data']['version'] . "', config_files='" . $family_line_xml['data']['configuration_files'] . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . "'"; - } else { - $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . $short_name . "', '" . $family_line_xml['data']['name'] . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['last_modified'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')"; - } - sql($sql); - - foreach ($family_line_xml['data']['model_list'] as $model_list) { - $template_list = implode(",", $model_list['template_data']); - - $m_data = sql("SELECT id FROM endpointman_model_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'", 'getOne'); - if ($m_data) { - $sql = "UPDATE endpointman_model_list SET max_lines = '" . $model_list['lines'] . "', model = '" . $model_list['model'] . "', template_list = '" . $template_list . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'"; - } else { - $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "', '" . $brand_id . "', '" . $model_list['model'] . "', '" . $model_list['lines'] . "', '" . $brand_id . $family_line_xml['data']['id'] . "', '" . $template_list . "', '0', '0')"; - } - sql($sql); - - if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'])) { - echo "System Error in Sync Model Function, Load Failure!" . $model_list['model']; -if ($echotxt) { echo format_txt(_("System Error in Sync Model [%_name_%] Function, Load Failure!"), "error", array("%_name_%" => $model_list['model'])); } - } - } - //Phone Models Move Here - $family_id = $brand_id . $family_line_xml['data']['id']; - $sql = "SELECT * FROM endpointman_model_list WHERE product_id = " . $family_id; - $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); - foreach ($products as $data) { - if (!$this->system->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { - echo "Moving/Removing Model '" . $data['model'] . "' not present in JSON file......
      "; - $model_name = $data['model']; - $sql = 'DELETE FROM endpointman_model_list WHERE id = ' . $data['id']; - sql($sql); - $sql = "SELECT id FROM endpointman_model_list WHERE model LIKE '" . $model_name . "'"; - $new_model_id = sql($sql, 'getOne'); - if ($new_model_id) { - $sql = "UPDATE endpointman_mac_list SET model = '" . $new_model_id . "' WHERE model = '" . $data['id'] . "'"; - } else { - $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '" . $data['id'] . "'"; - } - sql($sql); - } - } - } - foreach ($temp['data']['brands']['oui_list'] as $oui) { - $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('" . $oui . "', '" . $brand_id . "', '0')"; - sql($sql); - } - } - } - } - } - - /** - * Sync the XML files (incuding all template files) from the hard drive with the database - * @param int $model Model ID - * @return boolean True on sync completed. False on sync failed - */ - function sync_model($model, &$error = array()) { - if ((!empty($model)) OR ($model > 0)) { - $sql = "SELECT * FROM endpointman_model_list WHERE id='" . $model . "'"; - $model_row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - - $sql = "SELECT * FROM endpointman_product_list WHERE id='" . $model_row['product_id'] . "'"; - $product_row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $sql = "SELECT * FROM endpointman_brand_list WHERE id=" . $model_row['brand']; - $brand_row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'])) { - $error['sync_model'] = "Brand Directory '" . $brand_row['directory'] . "' Doesn't Exist! (" . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . ")"; - return(FALSE); - } - - if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'])) { - $error['sync_model'] = "Product Directory '" . $product_row['cfg_dir'] . "' Doesn't Exist! (" . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . ")"; - return(FALSE); - } - - if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/family_data.json')) { - - $error['sync_model'] = "File 'family_data.json Doesn't exist in directory: " . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir']; - return(FALSE); - } - - $family_line_json = $this->file2json($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/family_data.json'); - - - - - //TODO: Add local file checks to avoid slow reloading on PHP < 5.3 - $key = $this->system->arraysearchrecursive($model_row['model'], $family_line_json['data']['model_list'], 'model'); - if ($key === FALSE) { - $error['sync_model'] = "Can't locate model in family JSON file"; - return(FALSE); - } else { - $template_list = implode(",", $family_line_json['data']['model_list'][$key[0]]['template_data']); - $template_list_array = $family_line_json['data']['model_list'][$key[0]]['template_data']; - } - $maxlines = $family_line_json['data']['model_list'][$key[0]]['lines']; - - $sql = "UPDATE endpointman_model_list SET max_lines = '" . $maxlines . "', template_list = '" . $template_list . "' WHERE id = '" . $model . "'"; - sql($sql); - - $version = isset($family_line_json['data']['last_modified']) ? $family_line_json['data']['last_modified'] : ''; - $long_name = $family_line_json['data']['name']; - $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_json['data']['name']); - $configuration_files = $family_line_json['data']['configuration_files']; - - $sql = "UPDATE endpointman_product_list SET long_name = '" . str_replace("'", "''", $long_name) . "', short_name = '" . str_replace("'", "''", $short_name) . "' , cfg_ver = '" . $version . "' WHERE id = '" . $product_row['id'] . "'"; - sql($sql); - - $template_data_array = array(); - $template_data_array = $this->merge_data($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/', $template_list_array); - - $sql = "UPDATE endpointman_model_list SET template_data = '" . serialize($template_data_array) . "' WHERE id = '" . $model . "'"; - sql($sql); - return(TRUE); - } else { - return(FALSE); - } - } - - function sys_get_temp_dir() { - if (!empty($_ENV['TMP'])) { - return realpath($_ENV['TMP']); - } - if (!empty($_ENV['TMPDIR'])) { - return realpath($_ENV['TMPDIR']); - } - if (!empty($_ENV['TEMP'])) { - return realpath($_ENV['TEMP']); - } - $tempfile = tempnam(uniqid(rand(), TRUE), ''); - if (file_exists($tempfile)) { - unlink($tempfile); - return realpath(dirname($tempfile)); - } - } - - /** - * Install Firmware for the specified Product Line - * @param $product_id Product ID - */ - function install_firmware($product_id) { - $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; - $sql = 'SELECT endpointman_product_list.*, endpointman_brand_list.directory FROM endpointman_product_list, endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = ' . $product_id; - $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - $json_data = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/family_data.json"); - - if ($json_data['data']['firmware_ver'] > $row['firmware_vers']) { - if (!file_exists($temp_directory)) { - mkdir($temp_directory); - } - $md5_xml = $json_data['data']['firmware_md5sum']; - $firmware_pkg = $json_data['data']['firmware_pkg']; - - if (file_exists($temp_directory . $firmware_pkg)) { - $md5_pkg = md5_file($temp_directory . $firmware_pkg); - - if ($md5_xml == $md5_pkg) { - echo format_txt(_("Skipping download...")); - } - else - { - echo format_txt(_("Downloading firmware...")); - if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) - { - echo format_txt(_("Error download frimware package!"), "error"); - return false; - } - echo format_txt(_("Done!"), "done"); - $md5_pkg = md5_file($temp_directory . $firmware_pkg); - } - } - else - { - echo format_txt(_("Downloading firmware...")); - if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) - { - echo format_txt(_("Error download frimware package!"), "error"); - return false; - } - echo format_txt(_("Done!"), "done"); - $md5_pkg = md5_file($temp_directory . $firmware_pkg); - } - - echo format_txt(_("Checking MD5sum of Package...")); - if ($md5_xml == $md5_pkg) { - echo format_txt(_("Matches!"), "done"); - - if (file_exists($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware")) { - $this->system->rmrf($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware"); - } - mkdir($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware", 0777, TRUE); - - echo format_txt(_("Installing Firmware...")); - exec("tar -xvf " . $temp_directory . $firmware_pkg . " -C " . $temp_directory . $row['directory'] . "/" . $row['cfg_dir']); - $i = 0; - foreach (glob($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware/*") as $filename) { - $file = basename($filename); - $list[$i] = $file; - if (!@copy($filename, $this->configmod->get('config_location') . $file)) { -echo format_txt(_("- Failed To Copy %_FILE_%!"), "error", array("%_FILE_%" => $file)); - - $copy_error = TRUE; - } elseif ($this->configmod->get('debug')) { -echo format_txt(_("- Copied %_FILE_% to %_FILETO_%."), "txt", array("%_FILE_%" => $file, "%_FILETO_%" => $this->configmod->get('config_location'))); - } - $i++; - } - - $this->system->rmrf($temp_directory . $row['directory']); - $list = implode(",", $list); - $sql = "UPDATE endpointman_product_list SET firmware_vers = '" . $json_data['data']['firmware_ver'] . "', firmware_files = '" . $list . "' WHERE id = " . $row['id']; - sql($sql); - - - if (isset($copy_error)) { - echo format_txt(_("Copy Error Detected! Aborting Install!"), "error"); - $this->remove_firmware($product_id); - echo format_txt(_("Please Check Directory/Permissions!"), "error"); - } - else { - echo format_txt(_("Done!"), "done"); - } - } - else { - echo format_txt(_("Firmware MD5 didn't match!"), "error"); - } - } - else { - echo format_txt(_("Your Firmware is already up to date"), "done"); - } - } - - /** - * Remove firmware from the Hard Drive - * @param int $id Product ID - */ - function remove_firmware($id) { - echo format_txt(_("Uninstalla frimware...")); - $sql = "SELECT firmware_files FROM endpointman_product_list WHERE id ='" . $id . "'"; - $files = sql($sql, 'getOne'); - - $file_list = explode(",", $files); - $i = 0; - foreach ($file_list as $file) { - if (trim($file) == "") { continue; } - if (! file_exists($this->configmod->get('config_location') . $file)) { continue; } - if (! is_file($this->configmod->get('config_location') . $file)) { continue; } - unlink($this->configmod->get('config_location') . $file); - } - $sql = "UPDATE endpointman_product_list SET firmware_files = '', firmware_vers = '' WHERE id = '" . $id . "'"; - sql($sql); - - echo format_txt(_("Done!"), "done"); - } - - /** - * Remove the brand - * @param int $id Brand ID - */ - function remove_brand($id=NULL, $remove_configs=FALSE, $force=FALSE) { - echo format_txt(_("Uninstalla Brand...")); - if (!$this->configmod->get('use_repo')) { - $sql = "SELECT id, firmware_vers FROM endpointman_product_list WHERE brand = '" . $id . "'"; - $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); - - foreach ($products as $data) { - if ($data['firmware_vers'] != "") { - $this->remove_firmware($data['id']); - } - } - - $sql = "SELECT directory FROM endpointman_brand_list WHERE id = '" . $id . "'"; - $brand_dir = sql($sql, 'getOne'); - $this->system->rmrf($this->PHONE_MODULES_PATH . "endpoint/" . $brand_dir); - - $sql = "DELETE FROM endpointman_model_list WHERE brand = '" . $id . "'"; - sql($sql); - - $sql = "DELETE FROM endpointman_product_list WHERE brand = '" . $id . "'"; - sql($sql); - - $sql = "DELETE FROM endpointman_oui_list WHERE brand = '" . $id . "'"; - sql($sql); - - $this->system->rmrf($this->PHONE_MODULES_PATH . $brand_dir); - $sql = "DELETE FROM endpointman_brand_list WHERE id = '" . $id . "'"; - sql($sql); - - echo format_txt(_("All Done!"), "done"); - } - elseif ($force) { - $sql = "SELECT directory FROM endpointman_brand_list WHERE id = '" . $id . "'"; - $brand_dir = sql($sql, 'getOne'); - - $sql = "DELETE FROM endpointman_model_list WHERE brand = '" . $id . "'"; - sql($sql); - - $sql = "DELETE FROM endpointman_product_list WHERE brand = '" . $id . "'"; - sql($sql); - - $sql = "DELETE FROM endpointman_oui_list WHERE brand = '" . $id . "'"; - sql($sql); - - $sql = "DELETE FROM endpointman_brand_list WHERE id = '" . $id . "'"; - sql($sql); - - echo format_txt(_("Done!"), "done"); - } - else { - echo format_txt(_("Not allowed in repo mode!!"), "error"); - } - } - - /** - * This will download the xml & brand package remotely - * @param integer $id Brand ID - */ - function download_brand($id) { - if (!$this->configmod->get('use_repo')) { - $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; - - if (!file_exists($temp_directory)) { - echo format_txt(_("Creating EPM temp directory")); - if (! mkdir($temp_directory)) { - echo format_txt(_("Error creating directory: %_DIR_%"), "error", array("%_DIR_%" => $temp_directory)); - echo format_txt(_("Please Check Directory/Permissions!"), "error"); - return false; - } - } - - echo format_txt(_("Downloading Brand JSON.....")); - $row = sql('SELECT * FROM endpointman_brand_list WHERE id =' . $id, 'getAll', DB_FETCHMODE_ASSOC); - $result = $this->system->download_file($this->UPDATE_PATH . $row[0]['directory'] . "/" . $row[0]['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $row[0]['directory'] . "/brand_data.json"); - if ($result) { - echo format_txt(_("Done!"), "done"); - - $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/' . $row[0]['directory'] . '/brand_data.json'); - $package = $temp['data']['brands']['package']; - - echo format_txt(_("Downloading Brand Package...")); - if ($this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row[0]['directory'] . '/' . $package, $temp_directory . $package)) { - echo format_txt(_("Done!"), "done"); - if (file_exists($temp_directory . $package)) { - $md5_xml = $temp['data']['brands']['md5sum']; - $md5_pkg = md5_file($temp_directory . $package); - - echo format_txt(_("Checking MD5sum of Package....")); - if ($md5_xml == $md5_pkg) { - echo format_txt(_("Done!"), "done"); - - echo format_txt(_("Extracting Tarball........")); - exec("tar -xvf " . $temp_directory . $package . " -C " . $temp_directory); - echo format_txt(_("Done!"), "done"); - - //Update File in the temp directory - copy($this->PHONE_MODULES_PATH . 'endpoint/' . $row[0]['directory'] . '/brand_data.json', $temp_directory . $row[0]['directory'] . '/brand_data.json'); - $this->update_brand($row[0]['directory'], TRUE); - } else { - echo format_txt(_("MD5 Did not match!"), "error"); - echo format_txt(_("MD5 XML: %_MD5_%"), "error", array("%_MD5_%" => $md5_xml)); - echo format_txt(_("MD5 PKG: %_MD5_%"), "error", array("%_MD5_%" => $md5_pkg)); - } - } else { - echo format_txt(_("Can't Find Downloaded File!"), "error"); - } - } else { - echo format_txt(_("Error download Brand package!"), "error"); - } - } else { - echo format_txt(_("Error Connecting to the Package Repository. Module not installed. Please Try again later."), "error"); - echo format_txt(_("You Can Also Manually Update The Repository By Downloading Files here: %_URL_INI_% Release Repo %_URL_END_%"), "error", array ( "%_URL_INI_%" => "", "%_URL_END_%" => "")); - echo format_txt(_("Then Use Manual Upload in Advanced Settings."), "error"); - } - } else { - echo format_txt(_("Installing brands is disabled while in repo mode!"), "error"); - } - } - - /** - * This will install or updated a brand package (which is the same thing to this) - * Still needs way to determine when models move...perhaps another function? - */ - function update_brand($package, $remote=TRUE) { -if ($this->configmod->get('debug')) echo format_txt(_("update_brand(): Debug is set to %_DEBUG_MODE_%"), "",array("%_DEBUG_MODE_%" => $this->configmod->get('debug'))); - - $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; -if ($this->configmod->get('debug')) echo format_txt(_("Processing %_PATH_%/brand_data.json..."), "",array("%_PATH_%" => $temp_directory.$package)); - - if (file_exists($temp_directory . $package . '/brand_data.json')) { - $temp = $this->file2json($temp_directory . $package . '/brand_data.json'); - if (key_exists('directory', $temp['data']['brands'])) { - echo format_txt(_("Appears to be a valid Provisioner.net JSON file.....Continuing")); - //Pull in all variables - $directory = $temp['data']['brands']['directory']; - $brand_name = $temp['data']['brands']['name']; - $brand_id = $temp['data']['brands']['brand_id']; - $brand_version = $temp['data']['brands']['last_modified']; - - //create directory structure and move files - echo format_txt(_("Creating Directory Structure for Brand '%_NAME_%' and Moving Files .."), "",array("%_NAME_%" => $brand_name)); - if (!file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $directory)) { - mkdir($this->PHONE_MODULES_PATH . "endpoint/" . $directory); - } - - $dir_iterator = new \RecursiveDirectoryIterator($temp_directory . $directory . "/"); - $iterator = new \RecursiveIteratorIterator($dir_iterator, \RecursiveIteratorIterator::SELF_FIRST); - foreach ($iterator as $file) { - if (is_dir($file)) { - $dir = str_replace($temp_directory . $directory . "/", "", $file); - if (!file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir)) { - mkdir($this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0775, TRUE); -//echo "."; - } - } else { - if ((basename($file) != "brand_data.json") OR (!$remote)) { - $dir = str_replace($temp_directory . $directory . "/", "", $file); - $stats = rename($file, $this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir); - if ($stats === FALSE) { - echo format_txt(_("- Error Moving %_FILENAME_%!"), "error",array("%_FILENAME_%" => basename($file))); - } - chmod($this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0775); -//echo "."; - } - } - } - echo format_txt(_("Done!"), "done"); - - if ($remote) { - $local = 0; - } else { - $local = 1; - } - - $b_data = sql("SELECT id FROM endpointman_brand_list WHERE id = '" . $brand_id . "'", 'getOne'); - if ($b_data) { -echo format_txt(_("Updating %_BRANDNAME_% brand data.........."), "", array("%_BRANDNAME_%" => $brand_name)); - $sql = "UPDATE endpointman_brand_list SET local = '" . $local . "', name = '" . $brand_name . "', cfg_ver = '" . $brand_version . "', installed = 1, hidden = 0 WHERE id = " . $brand_id; - sql($sql); - } else { -echo format_txt(_("Inserting %_BRANDNAME_% brand data.........."), "", array("%_BRANDNAME_%" => $brand_name)); - $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '" . $local . "', '1')"; - sql($sql); - } - - $last_mod = ""; - foreach ($temp['data']['brands']['family_list'] as $family_list) { - echo format_txt(_("Updating Family Lines.................")); - - $last_mod = max($last_mod, $family_list['last_modified']); - - $family_line_xml = $this->file2json($this->PHONE_MODULES_PATH . '/endpoint/' . $directory . '/' . $family_list['directory'] . '/family_data.json'); - $family_line_xml['data']['last_modified'] = isset($family_line_xml['data']['last_modified']) ? $family_line_xml['data']['last_modified'] : ''; - - $require_firmware = NULL; - if ((key_exists('require_firmware', $family_line_xml['data'])) && ($remote) && ($family_line_xml['data']['require_firmware'] == "TRUE")) { - echo format_txt(_("Firmware Requirment Detected!..........")); - $this->install_firmware($family_line_xml['data']['id']); - } - - $data = sql("SELECT id FROM endpointman_product_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . "'", 'getOne'); - $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); - - if ($data) { - if ($this->configmod->get('debug')) echo "-Updating Family ".$short_name."
      "; - $sql = "UPDATE endpointman_product_list SET short_name = '" . str_replace("'", "''", $short_name) . "', long_name = '" . str_replace("'", "''", $family_line_xml['data']['name']) . "', cfg_ver = '" . $family_line_xml['data']['version'] . "', config_files='" . $family_line_xml['data']['configuration_files'] . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . "'"; - } - else { - if ($this->configmod->get('debug')) echo "-Inserting Family ".$short_name."
      "; - $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . str_replace("'", "''", $short_name) . "', '" . str_replace("'", "''", $family_line_xml['data']['name']) . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['last_modified'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')"; - } - sql($sql); - - - if (count($family_line_xml['data']['model_list']) > 0) { - echo format_txt(_("-- Updating Model Lines................")); - foreach ($family_line_xml['data']['model_list'] as $model_list) { - $template_list = implode(",", $model_list['template_data']); - - $model_final_id = $brand_id . $family_line_xml['data']['id'] . $model_list['id']; - $sql = 'SELECT id, global_custom_cfg_data, global_user_cfg_data FROM endpointman_mac_list WHERE model = ' . $model_final_id; - $old_data = NULL; - $old_data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - foreach ($old_data as $data) { - $global_custom_cfg_data = unserialize($data['global_custom_cfg_data']); - if ((is_array($global_custom_cfg_data)) AND (!array_key_exists('data', $global_custom_cfg_data))) { -echo format_txt(_("----Old Data Detected! Migrating......")); - $new_data = array(); - $new_ari = array(); - foreach ($global_custom_cfg_data as $key => $old_keys) { - if (array_key_exists('value', $old_keys)) { - $new_data[$key] = $old_keys['value']; - } else { - $breaks = explode("_", $key); - $new_data["loop|" . $key] = $old_keys[$breaks[2]]; - } - if (array_key_exists('ari', $old_keys)) { - $new_ari[$key] = 1; - } - } - $final_data = array(); - $final_data['data'] = $new_data; - $final_data['ari'] = $new_ari; - $final_data = serialize($final_data); - $sql = "UPDATE endpointman_mac_list SET global_custom_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; - sql($sql); - echo format_txt(_("Done!"), "done"); - } - - $global_user_cfg_data = unserialize($data['global_user_cfg_data']); - $old_check = FALSE; - if (is_array($global_user_cfg_data)) { - foreach ($global_user_cfg_data as $stuff) { - if (is_array($stuff)) { - if (array_key_exists('value', $stuff)) { - $old_check = TRUE; - break; - } else { - break; - } - } else { - break; - } - } - } - if ((is_array($global_user_cfg_data)) AND ($old_check)) { -echo format_txt(_("Old Data Detected! Migrating......")); - $new_data = array(); - foreach ($global_user_cfg_data as $key => $old_keys) { - if (array_key_exists('value', $old_keys)) { - $exploded = explode("_", $key); - $counted = count($exploded); - $counted = $counted - 1; - if (is_numeric($exploded[$counted])) { - $key = "loop|" . $key; - } - $new_data[$key] = $old_keys['value']; - } - } - $final_data = serialize($new_data); - $sql = "UPDATE endpointman_mac_list SET global_user_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; - sql($sql); - echo format_txt(_("Done!"), "done"); - } - } - $old_data = NULL; - $sql = 'SELECT id, global_custom_cfg_data FROM endpointman_template_list WHERE model_id = ' . $model_final_id; - $old_data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - foreach ($old_data as $data) { - $global_custom_cfg_data = unserialize($data['global_custom_cfg_data']); - if ((is_array($global_custom_cfg_data)) AND (!array_key_exists('data', $global_custom_cfg_data))) { -echo format_txt(_("Old Data Detected! Migrating......")); - $new_data = array(); - $new_ari = array(); - foreach ($global_custom_cfg_data as $key => $old_keys) { - if (array_key_exists('value', $old_keys)) { - $new_data[$key] = $old_keys['value']; - } else { - $breaks = explode("_", $key); - $new_data["loop|" . $key] = $old_keys[$breaks[2]]; - } - if (array_key_exists('ari', $old_keys)) { - $new_ari[$key] = 1; - } - } - $final_data = array(); - $final_data['data'] = $new_data; - $final_data['ari'] = $new_ari; - $final_data = serialize($final_data); - $sql = "UPDATE endpointman_template_list SET global_custom_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; - sql($sql); - echo format_txt(_("Done!"), "done"); - } - } - - $m_data = sql("SELECT id FROM endpointman_model_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'", 'getOne'); - if ($m_data) { -if ($this->configmod->get('debug')) echo format_txt(_("---Updating Model %_NAMEMOD_%"), "", array("%_NAMEMOD_%" => $model_list['model'])); - $sql = "UPDATE endpointman_model_list SET max_lines = '" . $model_list['lines'] . "', model = '" . $model_list['model'] . "', template_list = '" . $template_list . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'"; - } - else { -if ($this->configmod->get('debug')) echo format_txt(_("---Inserting Model %_NAMEMOD_%"), "", array("%_NAMEMOD_%" => $model_list['model'])); - $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "', '" . $brand_id . "', '" . $model_list['model'] . "', '" . $model_list['lines'] . "', '" . $brand_id . $family_line_xml['data']['id'] . "', '" . $template_list . "', '0', '0')"; - } - sql($sql); - - if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'], $errlog)) { - echo format_txt(_("System Error in Sync Model Function, Load Failure!"), "error"); - echo format_txt($errlog['sync_model'], "error"); - } - unset ($errlog); - } - } - - - //Phone Models Move Here - $family_id = $brand_id . $family_line_xml['data']['id']; - $sql = "SELECT * FROM endpointman_model_list WHERE product_id = " . $family_id; - $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); - foreach ($products as $data) { - if (!$this->system->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { - echo format_txt(_("Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......"), "", array("%_NAMEMOD_%" => $data['model'])); - $model_name = $data['model']; - $sql = 'DELETE FROM endpointman_model_list WHERE id = ' . $data['id']; - sql($sql); - $sql = "SELECT id FROM endpointman_model_list WHERE model LIKE '" . $model_name . "'"; - $new_model_id = sql($sql, 'getOne'); - if ($new_model_id) { - $sql = "UPDATE endpointman_mac_list SET model = '" . $new_model_id . "' WHERE model = '" . $data['id'] . "'"; - } else { - $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '" . $data['id'] . "'"; - } - sql($sql); - } - } - } - - if ($this->configmod->get('debug')) { - echo format_txt(_("Done!"), "done"); - echo format_txt(_("Updating OUI list in DB")); - } - if ((isset($temp['data']['brands']['oui_list'])) AND (count($temp['data']['brands']['oui_list']) > 0)) - { - foreach ($temp['data']['brands']['oui_list'] as $oui) { - $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('" . $oui . "', '" . $brand_id . "', '0')"; - sql($sql); - } - } - - echo format_txt(_("Done!"), "done"); - } else { - echo format_txt(_("Invalid JSON Structure in %_PATH_%/brand_data.json"), "", array("%_PATH_%" => $temp_directory.$package), "error"); - } - } else { - echo format_txt(_("No 'brand_data.xml' file exists!"), "error"); - } - - echo format_txt(_("Removing Temporary Files..............")); - $this->system->rmrf($temp_directory . $package); - echo format_txt(_("Done!"), "done"); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** - * Returns list of Brands that are installed and not hidden and that have at least one model enabled under them - * @param integer $selected ID Number of the brand that is supposed to be selected in a drop-down list box - * @return array Number array used to generate a select box - */ - function brands_available($selected = NULL, $show_blank=TRUE) { - $data = $this->eda->all_active_brands(); - if ($show_blank) { - $temp[0]['value'] = ""; - $temp[0]['text'] = ""; - $i = 1; - } else { - $i = 0; - } - foreach ($data as $row) { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['name']; - if ($row['id'] == $selected) { - $temp[$i]['selected'] = TRUE; - } else { - $temp[$i]['selected'] = NULL; - } - $i++; - } - return($temp); - } - - function listTZ($selected) { - require_once('lib/datetimezone.class.php'); - $data = \DateTimeZone::listIdentifiers(); - $i = 0; - foreach ($data as $key => $row) { - $temp[$i]['value'] = $row; - $temp[$i]['text'] = $row; - if (strtoupper ($temp[$i]['value']) == strtoupper($selected)) { - $temp[$i]['selected'] = 1; - } else { - $temp[$i]['selected'] = 0; - } - $i++; - } - - return($temp); - } - - function has_git() { - exec('which git', $output); - - $git = file_exists($line = trim(current($output))) ? $line : 'git'; - - unset($output); - - exec($git . ' --version', $output); - - preg_match('#^(git version)#', current($output), $matches); - - return!empty($matches[0]) ? $git : false; - echo!empty($matches[0]) ? 'installed' : 'nope'; - } - - function tftp_check() { - //create a simple block here incase people have strange issues going on as we will kill http - //by running this if the server isn't really running! - $sql = 'SELECT value FROM endpointman_global_vars WHERE var_name = \'tftp_check\''; - if (sql($sql, 'getOne') != 1) { - $sql = 'UPDATE endpointman_global_vars SET value = \'1\' WHERE var_name = \'tftp_check\''; - sql($sql); - $subject = shell_exec("netstat -luan --numeric-ports"); - if (preg_match('/:69\s/i', $subject)) { - $rand = md5(rand(10, 2000)); - if (file_put_contents($this->configmod->get('config_location') . 'TEST', $rand)) { - if ($this->system->tftp_fetch('127.0.0.1', 'TEST') != $rand) { - $this->error['tftp_check'] = 'Local TFTP Server is not correctly configured'; -echo 'Local TFTP Server is not correctly configured'; - } - unlink($this->configmod->get('config_location') . 'TEST'); - } else { - $this->error['tftp_check'] = 'Unable to write to ' . $this->configmod->get('config_location'); -echo 'Unable to write to ' . $this->configmod->get('config_location'); - } - } else { - $dis = FALSE; - if (file_exists('/etc/xinetd.d/tftp')) { - $contents = file_get_contents('/etc/xinetd.d/tftp'); - if (preg_match('/disable.*=.*yes/i', $contents)) { - $this->error['tftp_check'] = 'Disabled is set to "yes" in /etc/xinetd.d/tftp. Please fix
      Then restart your TFTP service'; -echo 'Disabled is set to "yes" in /etc/xinetd.d/tftp. Please fix
      Then restart your TFTP service'; - $dis = TRUE; - } - } - if (!$dis) { - $this->error['tftp_check'] = 'TFTP Server is not running.
      See here for instructions on how to install one: http://wiki.provisioner.net/index.php/Tftp'; -echo 'TFTP Server is not running.
      See here for instructions on how to install one: http://wiki.provisioner.net/index.php/Tftp'; - } - } - $sql = 'UPDATE endpointman_global_vars SET value = \'0\' WHERE var_name = \'tftp_check\''; - sql($sql); - } else { - $this->error['tftp_check'] = 'TFTP Server check failed on last past. Skipping'; -echo 'TFTP Server check failed on last past. Skipping'; - } - } - - - /** - * Used to send sample configurations to provisioner.net - * NOTE: The user has to explicitly click a link that states they are sending the configuration to the project - * We don't take configs on our own accord!! - * @param $brand Brand Directory - * @param $product Product Directory - * @param $orig_name The file's original name we are sending - * @param $data The config file's data - */ - function submit_config($brand, $product, $orig_name, $data) { - $posturl = 'http://www.provisioner.net/submit_config.php'; - - $fp = fopen($this->LOCAL_PATH . 'data.txt', 'w'); - fwrite($fp, $data); - fclose($fp); - $file_name_with_full_path = $this->LOCAL_PATH . "data.txt"; - - $postvars = array('brand' => $brand, 'product' => $product, 'origname' => htmlentities(addslashes($orig_name)), 'file_contents' => '@' . $file_name_with_full_path); - - $ch = curl_init($posturl); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt($ch, CURLOPT_HEADER, 0); // DO NOT RETURN HTTP HEADERS - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // RETURN THE CONTENTS OF THE CALL, probably not needed - $Rec_Data = curl_exec($ch); - - ob_start(); - header("Content-Type: text/html"); - $Final_Out = ob_get_clean(); - curl_close($ch); - unlink($file_name_with_full_path); - - return($Final_Out); - } - - - /** - * Fixes the display are special strings so we can visible see them instead of them being transformed - * @param string $contents a string of course - * @return string fixed string - */ - function display_htmlspecialchars($contents) { - $contents = str_replace("&", "&amp;", $contents); - $contents = str_replace("<", "&lt;", $contents); - $contents = str_replace(">", "&gt;", $contents); - $contents = str_replace(""", "&quot;", $contents); - $contents = str_replace("'", "&#039;", $contents); - return($contents); - } - - - - function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname=NULL) { - $mac = $this->mac_check_clean($mac); - if ($mac) { - if (empty($model)) { -$this->error['add_device'] = _("You Must Select A Model From the Drop Down") . "!"; - return(FALSE); - } elseif (empty($ext)) { -$this->error['add_device'] = _("You Must Select an Extension/Device From the Drop Down") . "!"; - return(FALSE); - } else { - if ($this->sync_model($model)) { - $sql = "SELECT id,template_id FROM endpointman_mac_list WHERE mac = '" . $mac . "'"; - $dup = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - if ($dup) { - if (!isset($template)) { - $template = $dup['template_id']; - } - - $sql = "UPDATE endpointman_mac_list SET model = " . $model . ", template_id = " . $template . " WHERE id = " . $dup['id']; - sql($sql); - $return = $this->add_line($dup['id'], $line, $ext); - if ($return) { - return($return); - } else { - return(FALSE); - } - } else { - if (!isset($template)) { - $template = 0; - } - - $sql = "SELECT mac_id FROM endpointman_line_list WHERE ext = " . $ext; - $used = sql($sql, 'getOne'); - - if (($used) AND (! $this->configmod->get('show_all_registrations'))) { -$this->error['add_device'] = "You can't assign the same user to multiple devices!"; - return(FALSE); - } - - if (!isset($displayname)) { - $sql = 'SELECT description FROM devices WHERE id = ' . $ext; - $name = & sql($sql, 'getOne'); - } else { - $name = $displayname; - } - - $sql = 'SELECT endpointman_product_list. * , endpointman_model_list.template_data, endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id = \'' . $model . '\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id'; - $row = & sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `template_id`) VALUES ('" . $mac . "', '" . $model . "', '" . $template . "')"; - sql($sql); - - $sql = 'SELECT last_insert_id()'; - $ext_id = & sql($sql, 'getOne'); - - if (empty($line)) { - $line = 1; - } - - $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $ext_id . "', '" . $ext . "', '" . $line . "', '" . addslashes($name) . "')"; - sql($sql); - -$this->message['add_device'][] = "Added " . $name . " to line " . $line; - return($ext_id); - } - } else { -$this->error['Sync_Model'] = _("Invalid Model Selected, Can't Sync System") . "!"; - return(FALSE); - } - } - } else { -$this->error['add_device'] = _("Invalid MAC Address") . "!"; - return(FALSE); - } - } - - - function add_line($mac_id, $line=NULL, $ext=NULL, $displayname=NULL) { - if ((!isset($line)) AND (!isset($ext))) { - if ($this->linesAvailable(NULL, $mac_id)) { - if ($this->eda->all_unused_registrations()) { - $sql = 'SELECT * FROM endpointman_line_list WHERE mac_id = ' . $mac_id; - $lines_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - - foreach ($lines_list as $row) { - $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; - $name = sql($sql, 'getOne'); - - $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . $this->eda->escapeSimple($name) . "' WHERE luid = " . $row['luid']; - sql($sql); - } - - $reg = array_values($this->display_registration_list()); - $lines = array_values($this->linesAvailable(NULL, $mac_id)); - - $sql = "SELECT description FROM devices WHERE id = " . $reg[0]['value']; - $name = $this->eda->sql($sql, 'getOne'); - - $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $reg[0]['value'] . "', '" . $lines[0]['value'] . "', '" . addslashes($name) . "')"; - $this->eda->sql($sql); - -$this->message['add_line'] = "Added '" . $name . "' to line '" . $lines[0]['value'] . "' on device '" . $reg[0]['value'] . "'
      Configuration Files will not be Generated until you click Save!"; - return($mac_id); - } else { -$this->error['add_line'] = _("No Devices/Extensions Left to Add") . "!"; - return(FALSE); - } - } else { -$this->error['add_line'] = _("No Lines Left to Add") . "!"; - return(FALSE); - } - } elseif ((!isset($line)) AND (isset($ext))) { - if ($this->linesAvailable(NULL, $mac_id)) { - if ($this->eda->all_unused_registrations()) { - $lines = array_values($this->linesAvailable(NULL, $mac_id)); - - $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $ext . "', '" . $lines[0]['value'] . "', '" . addslashes($displayname) . "')"; - sql($sql); - -$this->message['add_line'] = "Added '" . $name . "' to line '" . $lines[0]['value'] . "' on device '" . $reg[0]['value'] . "'
      Configuration Files will not be Generated until you click Save!"; - return($mac_id); - } else { -$this->error['add_line'] = _("No Devices/Extensions Left to Add") . "!"; - return(FALSE); - } - } else { -$this->error['add_line'] = _("No Lines Left to Add") . "!"; - return(FALSE); - } - } elseif ((isset($line)) AND (isset($ext))) { - $sql = "SELECT luid FROM endpointman_line_list WHERE line = '" . $line . "' AND mac_id = " . $mac_id; - $luid = sql($sql, 'getOne'); - if ($luid) { -$this->error['add_line'] = "This line has already been assigned!"; - return(FALSE); - } else { - if (!isset($displayname)) { - $sql = 'SELECT description FROM devices WHERE id = ' . $ext; - $name = & sql($sql, 'getOne'); - } else { - $name = $displayname; - } - - $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $ext . "', '" . $line . "', '" . addslashes($name) . "')"; - sql($sql); -$this->message['add_line'] .= "Added " . $name . " to line " . $line . "
      "; - return($mac_id); - } - } - } - - - function linesAvailable($lineid=NULL, $macid=NULL) { - if (isset($lineid)) { - $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = (SELECT endpointman_mac_list.model FROM endpointman_mac_list, endpointman_line_list WHERE endpointman_line_list.luid = " . $lineid . " AND endpointman_line_list.mac_id = endpointman_mac_list.id)"; - - $sql_l = "SELECT line, mac_id FROM `endpointman_line_list` WHERE luid = " . $lineid; - $line = sql($sql_l, 'getRow', DB_FETCHMODE_ASSOC); - - $sql_lu = "SELECT line FROM endpointman_line_list WHERE mac_id = " . $line['mac_id']; - } elseif (isset($macid)) { - $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = (SELECT model FROM endpointman_mac_list WHERE id =" . $macid . ")"; - $sql_lu = "SELECT line FROM endpointman_line_list WHERE mac_id = " . $macid; - - $line['line'] = 0; - } - - $max_lines = sql($sql, 'getOne'); - $lines_used = sql($sql_lu, 'getAll'); - - for ($i = 1; $i <= $max_lines; $i++) { - if ($i == $line['line']) { - $temp[$i]['value'] = $i; - $temp[$i]['text'] = $i; - $temp[$i]['selected'] = "selected"; - } else { - if (!$this->in_array_recursive($i, $lines_used)) { - $temp[$i]['value'] = $i; - $temp[$i]['text'] = $i; - } - } - } - if (isset($temp)) { - return($temp); - } else { - return FALSE; - } - } - - - /** - * This function takes a string and tries to determine if it's a valid mac addess, return FALSE if invalid - * @param string $mac The full mac address - * @return mixed The cleaned up MAC is it was a MAC or False if not a mac - */ - function mac_check_clean($mac) { - if ((strlen($mac) == "17") OR (strlen($mac) == "12")) { - //It might be better to use switch here instead of these IF statements... - //Is the mac separated by colons(:) or dashes(-)? - if (preg_match("/[0-9a-f][0-9a-f][:-]" . - "[0-9a-f][0-9a-f][:-]" . - "[0-9a-f][0-9a-f][:-]" . - "[0-9a-f][0-9a-f][:-]" . - "[0-9a-f][0-9a-f][:-]" . - "[0-9a-f][0-9a-f]/i", $mac)) { - return(strtoupper(str_replace(":", "", str_replace("-", "", $mac)))); - //Is the string exactly 12 characters? - } elseif (strlen($mac) == "12") { - //Now is the string a valid HEX mac address? - if (preg_match("/[0-9a-f][0-9a-f]" . - "[0-9a-f][0-9a-f]" . - "[0-9a-f][0-9a-f]" . - "[0-9a-f][0-9a-f]" . - "[0-9a-f][0-9a-f]" . - "[0-9a-f][0-9a-f]/i", $mac)) { - return(strtoupper($mac)); - } else { - return(FALSE); - } - //Is the mac separated by whitespaces? - } elseif (preg_match("/[0-9a-f][0-9a-f][\s]" . - "[0-9a-f][0-9a-f][\s]" . - "[0-9a-f][0-9a-f][\s]" . - "[0-9a-f][0-9a-f][\s]" . - "[0-9a-f][0-9a-f][\s]" . - "[0-9a-f][0-9a-f]/i", $mac)) { - return(strtoupper(str_replace(" ", "", $mac))); - } else { - return(FALSE); - } - } else { - return(FALSE); - } - } - - /** - * Display all unused registrations from whatever manager we are using! - * @return - */ - function display_registration_list($line_id=NULL) { - - if (isset($line_id)) { - $result = $this->eda->all_unused_registrations(); - $line_data = $this->eda->get_line_information($line_id); - } else { - $result = $this->eda->all_unused_registrations(); - $line_data = NULL; - } - - $i = 1; - $temp = array(); - foreach ($result as $row) { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['id'] . " --- " . $row['description']; - $i++; - } - - if (isset($line_data)) { - $temp[$i]['value'] = $line_data['ext']; - $temp[$i]['text'] = $line_data['ext'] . " --- " . $line_data['description']; - $temp[$i]['selected'] = "selected"; - } - - return($temp); - } - - - /** - * Taken from PHP.net. A list of errors returned when uploading files. - * @param $error_code - * @return string - */ - function file_upload_error_message($error_code) { - switch ($error_code) { - case UPLOAD_ERR_INI_SIZE: - return _('The uploaded file exceeds the upload_max_filesize directive in php.ini'); - case UPLOAD_ERR_FORM_SIZE: - return _('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'); - case UPLOAD_ERR_PARTIAL: - return _('The uploaded file was only partially uploaded'); - case UPLOAD_ERR_NO_FILE: - return _('No file was uploaded'); - case UPLOAD_ERR_NO_TMP_DIR: - return _('Missing a temporary folder'); - case UPLOAD_ERR_CANT_WRITE: - return _('Failed to write file to disk'); - case UPLOAD_ERR_EXTENSION: - return _('File upload stopped by extension'); - default: - return _('Unknown upload error'); - } - } - - /** - * Send this function an ID from the mac devices list table and you'll get all the information we have on that particular phone - * @param integer $mac_id ID number reference from the MySQL database referencing the table endpointman_mac_list - * @return array - * @example - * Final Output will look something similar to this - * Array - * ( - * [config_files_override] => - * [global_user_cfg_data] => N; - * [model_id] => 213 - * [brand_id] => 2 - * [name] => Grandstream - * [directory] => grandstream - * [model] => GXP2000 - * [mac] => 000B820D0050 - * [template_id] => 0 - * [global_custom_cfg_data] => Serialized Data (Changed Template Values) - * [long_name] => GXP Enterprise IP series [280,1200,2000,2010,2020] - * [product_id] => 21 - * [cfg_dir] => gxp - * [cfg_ver] => 1.5 - * [template_data] => Serialized Data (The default Template Values) - * [enabled] => 1 - * [line] => Array - * ( - * [1] => Array - * ( - * [luid] => 2 - * [mac_id] => 2 - * [line] => 1 - * [ext] => 1000 - * [description] => Description - * [custom_cfg_data] => - * [user_cfg_data] => - * [secret] => secret - * [id] => 1000 - * [tech] => sip - * [dial] => SIP/1000 - * [devicetype] => fixed - * [user] => 1000 - * [emergency_cid] => - * ) - * ) - * ) - */ - function get_phone_info($mac_id=NULL) { - //You could screw up a phone if the mac_id is blank - if (!isset($mac_id)) { -$this->error['get_phone_info'] = "Mac ID is not set"; - return(FALSE); - } - $sql = "SELECT id FROM endpointman_mac_list WHERE model > 0 AND id =" . $mac_id; - - $res = sql($sql); - if ($res->numRows()) { - //Returns Brand Name, Brand Directory, Model Name, Mac Address, Extension (FreePBX), Custom Configuration Template, Custom Configuration Data, Product Name, Product ID, Product Configuration Directory, Product Configuration Version, Product XML name, - $sql = "SELECT endpointman_mac_list.specific_settings, endpointman_mac_list.config_files_override, endpointman_mac_list.global_user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_mac_list.template_id, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_model_list.template_data, endpointman_model_list.enabled, endpointman_mac_list.global_settings_override FROM endpointman_line_list, endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.id = " . $mac_id; - $phone_info = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - if (!$phone_info) { -$this->error['get_phone_info'] = "Error with SQL Statement"; - } - - //If there is a template associated with this phone then pull that information and put it into the array - if ($phone_info['template_id'] > 0) { - $sql = "SELECT name, global_custom_cfg_data, config_files_override, global_settings_override FROM endpointman_template_list WHERE id = " . $phone_info['template_id']; - $phone_info['template_data_info'] = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - } - - $sql = "SELECT endpointman_line_list.*, sip.data as secret, devices.*, endpointman_line_list.description AS epm_description FROM endpointman_line_list, sip, devices WHERE endpointman_line_list.ext = devices.id AND endpointman_line_list.ext = sip.id AND sip.keyword = 'secret' AND mac_id = " . $mac_id . " ORDER BY endpointman_line_list.line ASC"; - $lines_info = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - foreach ($lines_info as $line) { - $phone_info['line'][$line['line']] = $line; - $phone_info['line'][$line['line']]['description'] = $line['epm_description']; - $phone_info['line'][$line['line']]['user_extension'] = $line['user']; - } - } else { - $sql = "SELECT id, mac FROM endpointman_mac_list WHERE id =" . $mac_id; - //Phone is unknown, we need to display this to the end user so that they can make corrections - $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $brand = $this->get_brand_from_mac($row['mac']); - if ($brand) { - $phone_info['brand_id'] = $brand['id']; - $phone_info['name'] = $brand['name']; - } else { - $phone_info['brand_id'] = 0; - $phone_info['name'] = 'Unknown'; - } - - $phone_info['id'] = $mac_id; - $phone_info['model_id'] = 0; - $phone_info['product_id'] = 0; - $phone_info['custom_cfg_template'] = 0; - $phone_info['mac'] = $row['mac']; - $sql = "SELECT endpointman_line_list.*, sip.data as secret, devices.* FROM endpointman_line_list, sip, devices WHERE endpointman_line_list.ext = devices.id AND endpointman_line_list.ext = sip.id AND sip.keyword = 'secret' AND mac_id = " . $mac_id; - $lines_info = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - foreach ($lines_info as $line) { - $phone_info['line'][$line['line']] = $line; - } - } - return $phone_info; - } - - /** - * Get the brand from any mac sent to this function - * @param string $mac - * @return array - */ - function get_brand_from_mac($mac) { - //Check for valid mac address first - if (!$this->mac_check_clean($mac)) { - return(FALSE); - } - - //Get the OUI only - $oui = substr($this->mac_check_clean($mac), 0, 6); - //Find the matching brand model to the oui - $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%" . $oui . "%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; - $brand = sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); - - $res = sql($oui_sql); - $brand_count = $res->numRows(); - - if (!$brand_count) { - //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. - $phone_info['id'] = 0; - $phone_info['name'] = _("Unknown"); - } else { - $phone_info['id'] = $brand['id']; - $phone_info['name'] = $brand['name']; - } - - return($phone_info); - } - - - - /** - * Prepare and then send the data that Provisioner expects, then take what provisioner gives us and do what it says - * @param array $phone_info Everything from get_phone_info - * @param bool $reboot Reboot the Phone after write - * @param bool $write Write out Directory structure. - */ - function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) - { - $this->PROVISIONER_BASE = $this->PHONE_MODULES_PATH; -//define('PROVISIONER_BASE', $this->PROVISIONER_BASE); - if (file_exists($this->PHONE_MODULES_PATH . 'autoload.php')) { - if (!class_exists('ProvisionerConfig')) { - require($this->PHONE_MODULES_PATH . 'autoload.php'); - } - - //Load Provisioner - $class = "endpoint_" . $phone_info['directory'] . "_" . $phone_info['cfg_dir'] . '_phone'; - $base_class = "endpoint_" . $phone_info['directory'] . '_base'; - $master_class = "endpoint_base"; - if (!class_exists($master_class)) { - ProvisionerConfig::endpointsAutoload($master_class); - } - if (!class_exists($base_class)) { - ProvisionerConfig::endpointsAutoload($base_class); - } - if (!class_exists($class)) { - ProvisionerConfig::endpointsAutoload($class); - } - - if (class_exists($class)) { - $provisioner_lib = new $class(); - - //Determine if global settings have been overridden - if ($phone_info['template_id'] > 0) { - if (isset($phone_info['template_data_info']['global_settings_override'])) { - $settings = unserialize($phone_info['template_data_info']['global_settings_override']); - } else { - $settings['srvip'] = $this->configmod->get('srvip'); - $settings['ntp'] = $this->configmod->get('ntp'); - $settings['config_location'] = $this->configmod->get('config_location'); - $settings['tz'] = $this->configmod->get('tz'); - } - } else { - if (isset($phone_info['global_settings_override'])) { - $settings = unserialize($phone_info['global_settings_override']); - } else { - $settings['srvip'] = $this->configmod->get('srvip'); - $settings['ntp'] = $this->configmod->get('ntp'); - $settings['config_location'] = $this->configmod->get('config_location'); - $settings['tz'] = $this->configmod->get('tz'); - } - } - - - - //Tell the system who we are and were to find the data. - $provisioner_lib->root_dir = $this->PHONE_MODULES_PATH; - $provisioner_lib->engine = 'asterisk'; - $provisioner_lib->engine_location = $this->configmod->get('asterisk_location','asterisk'); - $provisioner_lib->system = 'unix'; - - //have to because of versions less than php5.3 - $provisioner_lib->brand_name = $phone_info['directory']; - $provisioner_lib->family_line = $phone_info['cfg_dir']; - - - - //Phone Model (Please reference family_data.xml in the family directory for a list of recognized models) - //This has to match word for word. I really need to fix this.... - $provisioner_lib->model = $phone_info['model']; - - //Timezone - try { - $provisioner_lib->DateTimeZone = new DateTimeZone($settings['tz']); - } catch (Exception $e) { -$this->error['parse_configs'] = 'Error Returned From Timezone Library: ' . $e->getMessage(); - return(FALSE); - } - - $temp = ""; - $template_data = unserialize($phone_info['template_data']); - $global_user_cfg_data = unserialize($phone_info['global_user_cfg_data']); - if ($phone_info['template_id'] > 0) { - $global_custom_cfg_data = unserialize($phone_info['template_data_info']['global_custom_cfg_data']); - //Provide alternate Configuration file instead of the one from the hard drive - if (!empty($phone_info['template_data_info']['config_files_override'])) { - $temp = unserialize($phone_info['template_data_info']['config_files_override']); - foreach ($temp as $list) { - $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = " . $list; - $res = sql($sql); - if ($res->numRows()) { - $data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; - } - } - } - } else { - $global_custom_cfg_data = unserialize($phone_info['global_custom_cfg_data']); - //Provide alternate Configuration file instead of the one from the hard drive - if (!empty($phone_info['config_files_override'])) { - $temp = unserialize($phone_info['config_files_override']); - foreach ($temp as $list) { - $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = " . $list; - $res = sql($sql); - if ($res->numRows()) { - $data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; - } - } - } - } - - if (!empty($global_custom_cfg_data)) { - if (array_key_exists('data', $global_custom_cfg_data)) { - $global_custom_cfg_ari = $global_custom_cfg_data['ari']; - $global_custom_cfg_data = $global_custom_cfg_data['data']; - } else { - $global_custom_cfg_data = array(); - $global_custom_cfg_ari = array(); - } - } - - $new_template_data = array(); - $line_ops = array(); - if (is_array($global_custom_cfg_data)) { - foreach ($global_custom_cfg_data as $key => $data) { - //TODO: clean up with reg-exp - $full_key = $key; - $key = explode('|', $key); - $count = count($key); - switch ($count) { - case 1: - if (($this->global_cfg['enable_ari'] == 1) AND (isset($global_custom_cfg_ari[$full_key])) AND (isset($global_user_cfg_data[$full_key]))) { - $new_template_data[$full_key] = $global_user_cfg_data[$full_key]; - } else { - $new_template_data[$full_key] = $global_custom_cfg_data[$full_key]; - } - break; - case 2: - $breaks = explode('_', $key[1]); - if (($this->global_cfg['enable_ari'] == 1) AND (isset($global_custom_cfg_ari[$full_key])) AND (isset($global_user_cfg_data[$full_key]))) { - $new_template_data['loops'][$breaks[0]][$breaks[2]][$breaks[1]] = $global_user_cfg_data[$full_key]; - } else { - $new_template_data['loops'][$breaks[0]][$breaks[2]][$breaks[1]] = $global_custom_cfg_data[$full_key]; - } - break; - case 3: - if (($this->global_cfg['enable_ari'] == 1) AND (isset($global_custom_cfg_ari[$full_key])) AND (isset($global_user_cfg_data[$full_key]))) { - $line_ops[$key[1]][$key[2]] = $global_user_cfg_data[$full_key]; - } else { - $line_ops[$key[1]][$key[2]] = $global_custom_cfg_data[$full_key]; - } - break; - } - } - } - - if (!$write) { - $new_template_data['provision']['type'] = 'dynamic'; - $new_template_data['provision']['protocol'] = 'http'; - $new_template_data['provision']['path'] = rtrim($settings['srvip'] . dirname($_SERVER['REQUEST_URI']) . '/', '/'); - $new_template_data['provision']['encryption'] = FALSE; - } else { - $new_template_data['provision']['type'] = 'file'; - $new_template_data['provision']['protocol'] = 'tftp'; - $new_template_data['provision']['path'] = $settings['srvip']; - $new_template_data['provision']['encryption'] = FALSE; - } - - $new_template_data['ntp'] = $settings['ntp']; - - //Overwrite all specific settings variables now - if (!empty($phone_info['specific_settings'])) { - $specific_settings = unserialize($phone_info['specific_settings']); - $specific_settings = is_array($specific_settings) ? $specific_settings : array(); - } else { - $specific_settings = array(); - } - - //Set Variables according to the template_data files included. We can include different template.xml files within family_data.xml also one can create - //template_data_custom.xml which will get included or template_data__custom.xml which will also get included - //line 'global' will set variables that aren't line dependant - - - $provisioner_lib->settings = $new_template_data; - - //Loop through Lines! - $li = 0; - foreach ($phone_info['line'] as $line) { - $line_options = is_array($line_ops[$line['line']]) ? $line_ops[$line['line']] : array(); - $line_statics = array('line' => $line['line'], 'username' => $line['ext'], 'authname' => $line['ext'], 'secret' => $line['secret'], 'displayname' => $line['description'], 'server_host' => $this->global_cfg['srvip'], 'server_port' => '5060', 'user_extension' => $line['user_extension']); - - $provisioner_lib->settings['line'][$li] = array_merge($line_options, $line_statics); - $li++; - } - - if (array_key_exists('data', $specific_settings)) { - foreach ($specific_settings['data'] as $key => $data) { - $default_exp = preg_split("/\|/i", $key); - if (isset($default_exp[2])) { - //lineloop - $var = $default_exp[2]; - $line = $default_exp[1]; - $loc = $this->system->arraysearchrecursive($line, $provisioner_lib->settings['line'], 'line'); - if ($loc !== FALSE) { - $k = $loc[0]; - $provisioner_lib->settings['line'][$k][$var] = $data; - } else { - //Adding a new line-ish type options - if (isset($specific_settings['data']['line|' . $line . '|line_enabled'])) { - $lastkey = array_pop(array_keys($provisioner_lib->settings['line'])); - $lastkey++; - $provisioner_lib->settings['line'][$lastkey]['line'] = $line; - $provisioner_lib->settings['line'][$lastkey][$var] = $data; - } - } - } else { - switch ($key) { - case "connection_type": - $provisioner_lib->settings['network'][$key] = $data; - break; - case "ip4_address": - $provisioner_lib->settings['network']['ipv4'] = $data; - break; - case "ip6_address": - $provisioner_lib->settings['network']['ipv6'] = $data; - break; - case "subnet_mask": - $provisioner_lib->settings['network']['subnet'] = $data; - break; - case "gateway_address": - $provisioner_lib->settings['network']['gateway'] = $data; - break; - case "primary_dns": - $provisioner_lib->settings['network'][$key] = $data; - break; - default: - $provisioner_lib->settings[$key] = $data; - break; - } - } - } - } - - $provisioner_lib->settings['mac'] = $phone_info['mac']; - $provisioner_lib->mac = $phone_info['mac']; - - //Setting a line variable here...these aren't defined in the template_data.xml file yet. however they will still be parsed - //and if they have defaults assigned in a future template_data.xml or in the config file using pipes (|) those will be used, pipes take precedence - $provisioner_lib->processor_info = "EndPoint Manager Version " . $this->global_cfg['version']; - - // Because every brand is an extension (eventually) of endpoint, you know this function will exist regardless of who it is - //Start timer - $time_start = microtime(true); - - $provisioner_lib->debug = TRUE; - - try { - $returned_data = $provisioner_lib->generate_all_files(); - } catch (Exception $e) { -$this->error['prepare_configs'] = 'Error Returned From Provisioner Library: ' . $e->getMessage(); - return(FALSE); - } - //print_r($provisioner_lib->debug_return); - //End timer - $time_end = microtime(true); - $time = $time_end - $time_start; - if ($time > 360) { -$this->error['generate_time'] = "It took an awfully long time to generate configs...(" . round($time, 2) . " seconds)"; - } - if ($write) { - $this->write_configs($provisioner_lib, $reboot, $settings['config_location'], $phone_info, $returned_data); - } else { - return ($returned_data); - } - return(TRUE); - } else { -$this->error['parse_configs'] = "Can't Load \"" . $class . "\" Class!"; - return(FALSE); - } - } else { -$this->error['parse_configs'] = "Can't Load the Autoloader!"; - return(FALSE); - } - } - - function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $returned_data) { - //Create Directory Structure (If needed) - if (isset($provisioner_lib->directory_structure)) { - foreach ($provisioner_lib->directory_structure as $data) { - if (file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { - $dir_iterator = new \RecursiveDirectoryIterator($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data . "/"); - $iterator = new \RecursiveIteratorIterator($dir_iterator, \RecursiveIteratorIterator::SELF_FIRST); - // could use CHILD_FIRST if you so wish - foreach ($iterator as $file) { - $dir = $write_path . str_replace($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/", "", dirname($file)); - if (!file_exists($dir)) { - if (!@mkdir($dir, 0775, TRUE)) { -$this->error['parse_configs'] = "Could Not Create Directory: " . $data; - return(FALSE); - } - } - } - } else { - $dir = $write_path . $data; - if (!file_exists($dir)) { - if (!@mkdir($dir, 0775)) { -$this->error['parse_configs'] = "Could Not Create Directory: " . $data; - return(FALSE); - } - } - } - } - } - - //Copy Files (If needed) - if (isset($provisioner_lib->copy_files)) { - foreach ($provisioner_lib->copy_files as $data) { - if (file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { - $file = $write_path . $data; - $orig = $this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data; - if (!file_exists($file)) { - if (!@copy($orig, $file)) { -$this->error['parse_configs'] = "Could Not Create File: " . $data; - return(FALSE); - } - } else { - if (file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { - if (!file_exists(dirname($write_path . $data))) { - !@mkdir(dirname($write_path . $data), 0775); - } - copy($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data, $write_path . $data); - chmod($write_path . $data, 0775); - } - } - } - } - } - - foreach ($returned_data as $file => $data) { - if (((file_exists($write_path . $file)) AND (is_writable($write_path . $file)) AND (!in_array($file, $provisioner_lib->protected_files))) OR (!file_exists($write_path . $file))) { - //Move old file to backup - if (!$this->global_cfg['backup_check']) { - if (!file_exists($write_path . 'config_bkup')) { - if (!@mkdir($write_path . 'config_bkup', 0775)) { -$this->error['parse_configs'] = "Could Not Create Backup Directory"; - return(FALSE); - } - } - if (file_exists($write_path . $file)) { - copy($write_path . $file, $write_path . 'config_bkup/' . $file . '.' . time()); - } - } - file_put_contents($write_path . $file, $data); - chmod($write_path . $file, 0775); - if (!file_exists($write_path . $file)) { -$this->error['parse_configs'] = "File (" . $file . ") not written to hard drive!"; - return(FALSE); - } - } elseif (!in_array($file, $provisioner_lib->protected_files)) { -$this->error['parse_configs'] = "File not written to hard drive!"; - return(FALSE); - } - } - - if ($reboot) { - $provisioner_lib->reboot(); - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /********************************************* - ****** CODIGO ANTIGUO -- SIN REVISADO ******** - *********************************************/ - - - - - - - - - - - - function download_json($location, $directory=NULL) { - $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; - if (!isset($directory)) { - $destination_file = $this->PHONE_MODULES_PATH . 'endpoint/master.json'; - $directory = "master"; - } else { - if (!file_exists($this->PHONE_MODULES_PATH . '/' . $directory)) { - mkdir($this->PHONE_MODULES_PATH . '/' . $directory, 0775, TRUE); - } - $destination_file = $this->PHONE_MODULES_PATH . '/' . $directory . '/brand_data.json'; - } - $temp_file = $temp_directory . $directory . '.json'; - file_exists(dirname($temp_file)) ? '' : mkdir(dirname($temp_file)); - - if ($this->system->download_file($location, $temp_file)) { - $handle = fopen($temp_file, "rb"); - $contents = fread($handle, filesize($temp_file)); - fclose($handle); - - $a = $this->validate_json($contents); - if ($a === FALSE) { - //Error with the internet....ABORRRTTTT THEEEEE DOWNLOAAAAADDDDDDDD! SCOTTYYYY!; - unlink($temp_file); - return(FALSE); - } else { - rename($temp_file, $destination_file); - chmod($destination_file, 0775); - return(TRUE); - } - } else { - return(FALSE); - } - } - - - - - - - - function merge_data($path, $template_list, $maxlines = 12) { - //TODO: fix - foreach ($template_list as $files_data) { - $full_path = $path . $files_data; - if (file_exists($full_path)) { - $temp_files_data = $this->file2json($full_path); - foreach ($temp_files_data['template_data']['category'] as $category) { - $category_name = $category['name']; - foreach ($category['subcategory'] as $subcategory) { - $subcategory_name = $subcategory['name']; - $items_fin = array(); - $items_loop = array(); - $break_count = 0; - foreach ($subcategory['item'] as $item) { - switch ($item['type']) { - case 'loop_line_options': - for ($i = 1; $i <= $maxlines; $i++) { - $var_nam = "lineloop|line_" . $i; - foreach ($item['data']['item'] as $item_loop) { - if ($item_loop['type'] != 'break') { - $z = str_replace("\$", "", $item_loop['variable']); - $items_loop[$var_nam][$z] = $item_loop; - $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); - $items_loop[$var_nam][$z]['default_value'] = $items_loop[$var_nam][$z]['default_value']; - $items_loop[$var_nam][$z]['default_value'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['default_value']); - $items_loop[$var_nam][$z]['line_loop'] = TRUE; - $items_loop[$var_nam][$z]['line_count'] = $i; - } elseif ($item_loop['type'] == 'break') { - $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; - $break_count++; - } - } - } - $items_fin = array_merge($items_fin, $items_loop); - break; - case 'loop': - for ($i = $item['loop_start']; $i <= $item['loop_end']; $i++) { - $name = explode("_", $item['data']['item'][0]['variable']); - $var_nam = "loop|" . str_replace("\$", "", $name[0]) . "_" . $i; - foreach ($item['data']['item'] as $item_loop) { - if ($item_loop['type'] != 'break') { - $z_tmp = explode("_", $item_loop['variable']); - $z = $z_tmp[1]; - $items_loop[$var_nam][$z] = $item_loop; - $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); - $items_loop[$var_nam][$z]['variable'] = str_replace('_', '_' . $i . '_', $items_loop[$var_nam][$z]['variable']); - $items_loop[$var_nam][$z]['default_value'] = isset($items_loop[$var_nam][$z]['default_value']) ? $items_loop[$var_nam][$z]['default_value'] : ''; - $items_loop[$var_nam][$z]['loop'] = TRUE; - $items_loop[$var_nam][$z]['loop_count'] = $i; - } elseif ($item_loop['type'] == 'break') { - $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; - $break_count++; - } - } - } - $items_fin = array_merge($items_fin, $items_loop); - break; - case 'break': - $items_fin['break|' . $break_count]['type'] = 'break'; - $break_count++; - break; - default: - $var_nam = "option|" . str_replace("\$", "", $item['variable']); - $items_fin[$var_nam] = $item; - break; - } - } - if (isset($data['data'][$category_name][$subcategory_name])) { - $old_sc = $data['data'][$category_name][$subcategory_name]; - $sub_cat_data[$category_name][$subcategory_name] = array(); - $sub_cat_data[$category_name][$subcategory_name] = array_merge($old_sc, $items_fin); - } else { - $sub_cat_data[$category_name][$subcategory_name] = $items_fin; - } - } - if (isset($data['data'][$category_name])) { - $old_c = $data['data'][$category_name]; - $new_c = $sub_cat_data[$category_name]; - $sub_cat_data[$category_name] = array(); - $data['data'][$category_name] = array_merge($old_c, $new_c); - } else { - $data['data'][$category_name] = $sub_cat_data[$category_name]; - } - } - } - } - return($data); - } - - - - - - /** - * Send process to run in background - * @version 2.11 - * @param string $command the command to run - * @param integer $Priority the Priority of the command to run - * @return int $PID process id - * @package epm_system - */ - function run_in_background($Command, $Priority = 0) { - return($Priority ? shell_exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!") : shell_exec("nohup $Command > /dev/null 2> /dev/null & echo $!")); - } - - /** - * Check if process is running in background - * @version 2.11 - * @param string $PID proccess ID - * @return bool true or false - * @package epm_system - */ - function is_process_running($PID) { - exec("ps $PID", $ProcessState); - return(count($ProcessState) >= 2); - } - - - - /** - * Uses which to find executables that asterisk can run/use - * @version 2.11 - * @param string $exec Executable to find - * @package epm_system - */ - function find_exec($exec) { - $o = exec('which '.$exec); - if($o) { - if(file_exists($o) && is_executable($o)) { - return($o); - } else { - return(''); - } - } else { - return(''); - } - } - - - /** - * Only used once in all of Endpoint Manager to determine if a table exists - * @param string $table Table to look for - * @return bool - */ - function table_exists($table) { - $sql = "SHOW TABLES FROM " . $this->config->get('AMPDBNAME'); - $result = $this->eda->sql($sql, 'getAll'); - foreach ($result as $row) { - if ($row[0] == $table) { - return TRUE; - } - } - return FALSE; - } - - - - - - /** - * Check for valid netmast to avoid security issues - * @param string $mask the complete netmask, eg [1.1.1.1/24] - * @return boolean True if valid, False if not - * @version 2.11 - */ - function validate_netmask($mask) { - return preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/", $mask) ? TRUE : FALSE; - } - - /** - * Discover New Device/Hardware - * nmap will actually discover 'unseen' devices that the VoIP server hasn't heard from - * If the user just wishes to use the local arp cache they can tell the function to not use nmap - * This results in a speed increase from 60 seconds to less than one second. - * - * This is the original function that started it all - * http://www.pbxinaflash.com/community/index.php?threads/end-point-configuration-manager-module-for-freepbx-part-1.4514/page-4#post-37671 - * - * @version 2.11 - * @param mixed $netmask The netmask, eg [1.1.1.1/24] - * @param boolean $use_nmap True use nmap, false don't use it - * @return array List of devices found on the network - */ - function discover_new($netmask, $use_nmap=TRUE) { - if (($use_nmap) AND (file_exists($this->global_cfg['nmap_location'])) AND ($this->validate_netmask($netmask))) { - shell_exec($this->global_cfg['nmap_location'] . ' -v -sP ' . $netmask); - } elseif (!$this->validate_netmask($netmask)) { - $this->error['discover_new'] = "Invalid Netmask"; - return(FALSE); - } elseif (!file_exists($this->global_cfg['nmap_location'])) { - $this->error['discover_new'] = "Could Not Find NMAP, Using ARP Only"; - //return(FALSE); - } - //Get arp list - $arp_list = shell_exec($this->global_cfg['arp_location'] . " -an"); - - //Throw arp list into an array, break by new lines - $arp_array = explode("\n", $arp_list); - - //Find all references to active computers by searching out mac addresses. - $temp = array_values(array_unique(preg_grep("/[0-9a-f][0-9a-f][:-]" . - "[0-9a-f][0-9a-f][:-]" . - "[0-9a-f][0-9a-f][:-]" . - "[0-9a-f][0-9a-f][:-]" . - "[0-9a-f][0-9a-f][:-]" . - "[0-9a-f][0-9a-f]/i", $arp_array))); - - //Go through each row of valid arp entries and pull out the information and add it into a nice array! - $z = 0; - foreach ($temp as $key => &$value) { - - //Pull out the IP address from row. It's always the first entry in the row and it can only be a max of 15 characters with the delimiters - preg_match_all("/\((.*?)\)/", $value, $matches); - $ip = $matches[1]; - $ip = $ip[0]; - - //Pull out the mac address by looking for the delimiter - $mac = substr($value, (strpos($value, ":") - 2), 17); - - //Get rid of the delimiter - $mac_strip = strtoupper(str_replace(":", "", $mac)); - - //arp -n will return a MAC address of 000000000000 if no hardware was found, so we need to ignore it - if ($mac_strip != "000000000000") { - //only use the first 6 characters for the oui: http://en.wikipedia.org/wiki/Organizationally_Unique_Identifier - $oui = substr($mac_strip, 0, 6); - - //Find the matching brand model to the oui - $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%" . $oui . "%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; - - $brand = $this->eda->sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); - - $res = $this->eda->sql($oui_sql); - $brand_count = $res->numRows(); - - if (!$brand_count) { - //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. - $brand['name'] = FALSE; - $brand['id'] = NULL; - } - - //Find out if endpoint has already been configured for this mac address - $epm_sql = "SELECT * FROM endpointman_mac_list WHERE mac LIKE '%" . $mac_strip . "%'"; - $epm_row = $this->eda->sql($epm_sql, 'getRow', DB_FETCHMODE_ASSOC); - - $res = $this->eda->sql($epm_sql); - - $epm = $res->numRows() ? TRUE : FALSE; - - //Add into a final array - $final[$z] = array("ip" => $ip, "mac" => $mac, "mac_strip" => $mac_strip, "oui" => $oui, "brand" => $brand['name'], "brand_id" => $brand['id'], "endpoint_managed" => $epm); - $z++; - } - } - return !is_array($final) ? FALSE : $final; - } - - function areaAvailable($model, $area=NULL) { - $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = '" . $model . "'"; - $count = $this->eda->sql($sql, 'getOne'); - - for ($z = 0; $z < $count; $z++) { - $result[$z]['id'] = $z + 1; - $result[$z]['model'] = $z + 1; - } - - $i = 1; - foreach ($result as $row) { - if ($row['id'] == $area) { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 'selected'; - } else { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 0; - } - $i++; - } - - return($temp); - } - - /** - * - * @param integer $model model ID - * @param integer $brand brand ID - * @param integer $product product ID - * @return array - */ - function models_available($model=NULL, $brand=NULL, $product=NULL) { - - if ((!isset($oui)) && (!isset($brand)) && (!isset($model))) { - $result1 = $this->eda->all_models(); - } elseif ((isset($brand)) && ($brand != 0)) { - $result1 = $this->eda->all_models_by_brand($brand); - } elseif ((isset($product)) && ($product != 0)) { - $result1 = $this->eda->all_models_by_product($product); - } else { - $result1 = $this->eda->all_models(); - } - - $i = 1; - foreach ($result1 as $row) { - if ($row['id'] == $model) { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 'selected'; - } else { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 0; - } - $i++; - } - - if (!isset($temp)) { - if (!isset($this->global_cfg['new'])) { - $this->error['modelsAvailable'] = "You need to enable at least ONE model"; - } - return(FALSE); - } else { - return($temp); - } - } - - function in_array_recursive($needle, $haystack) { - - $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($haystack)); - - foreach ($it AS $element) { - if ($element == $needle) { - return TRUE; - } - } - return FALSE; - } - - - - - - - function display_templates($product_id, $temp_select = NULL) { - $i = 0; - $sql = "SELECT id FROM endpointman_product_list WHERE endpointman_product_list.id ='" . $product_id . "'"; - - $id = $this->eda->sql($sql, 'getOne'); - - $sql = "SELECT * FROM endpointman_template_list WHERE product_id = '" . $id . "'"; - - $data = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - foreach ($data as $row) { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['name']; - if ($row['id'] == $temp_select) { - $temp[$i]['selected'] = "selected"; - } - $i++; - } - $temp[$i]['value'] = 0; - if ($temp_select == 0) { - $temp[$i]['text'] = "Custom..."; - $temp[$i]['selected'] = "selected"; - } else { - $temp[$i]['text'] = "Custom..."; - } - - return($temp); - } - - function validate_json($json) { - return(TRUE); - } - - - - - - - - - - - function prepare_message_box() { - $error_message = NULL; - foreach ($this->error as $key => $error) { - $error_message .= $error; - if ($this->global_cfg['debug']) { - $error_message .= " Function: [" . $key . "]"; - } - $error_message .= "
      "; - } - $message = NULL; - foreach ($this->message as $key => $error) { - if (is_array($error)) { - foreach ($error as $sub_error) { - $message .= $sub_error; - if ($this->global_cfg['debug']) { - $message .= " Function: [" . $key . "]"; - } - $message .= "
      "; - } - } else { - $message .= $error; - if ($this->global_cfg['debug']) { - $message .= " Function: [" . $key . "]"; - } - $message .= "
      "; - } - } - - if (isset($message)) { - $this->display_message_box($message, 0); - } - - if (isset($error_message)) { - $this->display_message_box($error_message, 1); - } - } - - - - - - - - - - - function update_device($macid, $model, $template, $luid=NULL, $name=NULL, $line=NULL, $update_lines=TRUE) { - $sql = "UPDATE endpointman_mac_list SET model = " . $model . ", template_id = " . $template . " WHERE id = " . $macid; - $this->eda->sql($sql); - - if ($update_lines) { - if (isset($luid)) { - $this->update_line($luid, NULL, $name, $line); - return(TRUE); - } else { - $this->update_line(NULL, $macid); - return(TRUE); - } - } - } - - function update_line($luid=NULL, $macid=NULL, $name=NULL, $line=NULL) { - if (isset($luid)) { - $sql = "SELECT * FROM endpointman_line_list WHERE luid = " . $luid; - $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - if (!isset($name)) { - $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; - $name = $this->eda->sql($sql, 'getOne'); - } - - if (!isset($line)) { - $line = $row['line']; - } - $sql = "UPDATE endpointman_line_list SET line = '" . $line . "', ext = '" . $row['ext'] . "', description = '" . $this->eda->escapeSimple($name) . "' WHERE luid = " . $row['luid']; - $this->eda->sql($sql); - return(TRUE); - } else { - $sql = "SELECT * FROM endpointman_line_list WHERE mac_id = " . $macid; - $lines_info = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - foreach ($lines_info as $row) { - $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; - $name = $this->eda->sql($sql, 'getOne'); - - $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . $this->eda->escapeSimple($name) . "' WHERE luid = " . $row['luid']; - $this->eda->sql($sql); - } - return(TRUE); - } - } - - /** - * This will either a. delete said line or b. delete said device from line - * @param $line - * @return - */ - function delete_line($lineid, $allow_device_remove=FALSE) { - $sql = 'SELECT mac_id FROM endpointman_line_list WHERE luid = ' . $lineid; - $mac_id = $this->eda->sql($sql, 'getOne'); - $row = $this->get_phone_info($mac_id); - - $sql = 'SELECT COUNT(*) FROM endpointman_line_list WHERE mac_id = ' . $mac_id; - $num_lines = $this->eda->sql($sql, 'getOne'); - if ($num_lines > 1) { - $sql = "DELETE FROM endpointman_line_list WHERE luid=" . $lineid; - $this->eda->sql($sql); - $this->message['delete_line'] = "Deleted!"; - return(TRUE); - } else { - if ($allow_device_remove) { - $sql = "DELETE FROM endpointman_line_list WHERE luid=" . $lineid; - $this->eda->sql($sql); - - $sql = "DELETE FROM endpointman_mac_list WHERE id=" . $mac_id; - $this->eda->sql($sql); - $this->message['delete_line'] = "Deleted!"; - return(TRUE); - } else { - $this->error['delete_line'] = _("You can't remove the only line left") . "!"; - return(FALSE); - } - } - } - - function delete_device($mac_id) { - $sql = "DELETE FROM endpointman_mac_list WHERE id=" . $mac_id; - $this->eda->sql($sql); - - $sql = "DELETE FROM endpointman_line_list WHERE mac_id=" . $mac_id; - $this->eda->sql($sql); - $this->message['delete_device'] = "Deleted!"; - return(TRUE); - } - - function get_message($function_name) { - if (isset($this->message[$function_name])) { - return($this->message[$function_name]); - } else { - return("Unknown Message"); - } - } - - - /** - * Custom Means specific to that MAC - * id is either the mac ID (not address) or the template ID - * @param integer $id - * @param integer $custom - */ - function edit_template_display($id, $custom) { - //endpointman_flush_buffers(); - - - $alt_configs = NULL; - - if ($custom == 0) { - $sql = "SELECT model_id FROM endpointman_template_list WHERE id=" . $id; - } else { - $sql = "SELECT model FROM endpointman_mac_list WHERE id=" . $id; - } - - $model_id = $this->eda->sql($sql, 'getOne'); - - //Make sure the model data from the local confg files are stored in the database and vice-versa. Serious errors will occur if the database is not in sync with the local file - if (!$this->sync_model($model_id)) { - die("unable to sync local template files - TYPE:" . $custom); - } - - - //Determine if we are dealing with a general template or a specific [for that phone only] template (custom =0 means general) - if ($custom == 0) { - $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_template_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_product_list.short_name, endpointman_product_list.id as product_id, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = " . $id; - } else { - $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_line_list.*, endpointman_model_list.id as model_id, endpointman_model_list.template_data, endpointman_product_list.id as product_id, endpointman_product_list.short_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list, endpointman_line_list WHERE endpointman_mac_list.id=" . $id . " AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; - } - - $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $this->tpl->assign("template_editor_display", 1); - echo $this->tpl->draw('global_header'); - //Let the template system know if we are working with a general template or a specific [for that phone only] template - $this->tpl->assign("custom", $custom); - if ($custom) { - $this->tpl->assign("ext", $row['ext']); - } else { - $this->tpl->assign("template_name", $row['name']); - } - $this->tpl->assign("product", $row['short_name']); - $this->tpl->assign("model", $row['model_name']); - - if ($ma = $this->models_available($row['model_id'], NULL, $row['product_id'])) { - $this->tpl->assign("models_ava", $ma); - } - - if (isset($_REQUEST['maxlines'])) { - $areas = $this->areaAvailable($row['model_id'], $_REQUEST['maxlines']); - } else { - $areas = $this->areaAvailable($row['model_id'], 1); - } - - $this->tpl->assign("area_ava", $areas); - //Start the display of the html file in the product folder - if ($row['config_files_override'] == "") { - $config_files_saved = ""; - } else { - $config_files_saved = unserialize($row['config_files_override']); - } - $config_files_list = explode(",", $row['config_files']); - $i = 0; - $alt = 0; - - $i = 0; - $b = 0; - $only_configs = array(); - foreach ($config_files_list as $files) { - $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $row['product_id'] . "' AND original_name = '" . $files . "'"; - $alt_configs_list_count = $this->eda->sql($sql); - if ($alt_configs_list_count->numRows() > 0) { - $alt_configs_list = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $alt_configs[$i]['name'] = $files; - $files = str_replace(".", "_", $files); - $h = 0; - foreach ($alt_configs_list as $ccf) { - $alt_configs[$i]['list'][$h]['id'] = $ccf['id']; - $cf_key = $files; - if ((isset($config_files_saved[$cf_key])) AND (is_array($config_files_saved)) AND ($config_files_saved[$cf_key] == $ccf['id'])) { - $alt_configs[$i]['list'][$h]['selected'] = 'selected'; - } - $alt_configs[$i]['list'][$h]['name'] = $ccf['name']; - $h++; - } - $alt = 1; - } else { - $only_configs[$b]['name'] = $files; - $b++; - } - $i++; - } - - $this->tpl->assign("only_configs", $only_configs); - $this->tpl->assign("alt_configs", $alt_configs); - $this->tpl->assign("alt", $alt); - if (!isset($_REQUEST['maxlines'])) { - $maxlines = 1; - } else { - $maxlines = $_REQUEST['maxlines']; - } - if ($row['template_data'] != "") { - $out = $this->generate_gui_html($row['template_data'], $row['global_custom_cfg_data'], TRUE, NULL, $maxlines); - } else { - echo "No Template Data has been defined for this Product
      "; - } - - $this->tpl->assign("template_editor", $out); - $this->tpl->assign("hidden_id", $row['id']); - $this->tpl->assign("hidden_custom", $custom); - echo $this->tpl->draw('template_editor'); - - $this->tpl->assign("debug", ""); - } - - /** - * Generates the Visual Display for the end user - * @param $cfg_data - * @param $custom_cfg_data - * @param $admin - * @param $user_cfg_data - * @return - */ - function generate_gui_html($cfg_data, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $max_lines=3, $ext=NULL) { - //take the data out of the database and turn it back into an array for use - $cfg_data = unserialize($cfg_data); - $template_type = 'GENERAL'; - //Check to see if there is a custom template for this phone already listed in the endpointman_mac_list database - if (!empty($custom_cfg_data)) { - $custom_cfg_data = unserialize($custom_cfg_data); - if (array_key_exists('data', $custom_cfg_data)) { - if (array_key_exists('ari', $custom_cfg_data)) { - $extra_data = $custom_cfg_data['ari']; - } else { - $template_type = 'GLOBAL'; - $extra_data = $custom_cfg_data['freepbx']; - } - $custom_cfg_data = $custom_cfg_data['data']; - } else { - $extra_data = array(); - } - } else { - $custom_cfg_data = array(); - $extra_data = array(); - } - if (isset($user_cfg_data)) { - $user_cfg_data = unserialize($user_cfg_data); - } - - $template_variables_array = array(); - $group_count = 0; - $variables_count = 0; - - foreach ($cfg_data['data'] as $cats_name => $cats) { - if ($admin) { - $group_count++; - $template_variables_array[$group_count]['title'] = $cats_name; - } else { - //Group all ARI stuff into one tab - $template_variables_array[$group_count]['title'] = "Your Phone Settings"; - } - foreach ($cats as $subcat_name => $subcats) { - foreach ($subcats as $item_var => $config_options) { - if (preg_match('/(.*)\|(.*)/i', $item_var, $matches)) { - $type = $matches[1]; - $variable = $matches[2]; - } else { - die('no matches!'); - } - if ($admin) { - //Administration View Only - switch ($type) { - case "lineloop": - //line|1|display_name - foreach ($config_options as $var_name => $var_items) { - $lcount = isset($var_items['line_count']) ? $var_items['line_count'] : $lcount; - $key = "line|" . $lcount . "|" . $var_name; - $items[$variables_count] = $items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; - $variables_count++; - } - - if ($lcount <= $max_lines) { - $template_variables_array[$group_count]['title'] = "Line Options for Line " . $lcount; - $group_count++; - } else { - unset($template_variables_array[$group_count]); - } - - continue 2; - case "loop": - foreach ($config_options as $var_name => $var_items) { - //loop|remotephonebook_url_0 - $tv = explode('_', $variable); - $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; - $items[$variables_count] = $var_items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; - $variables_count++; - } - continue 2; - } - } else { - //ARI View Only - switch ($type) { - case "loop_line_options": - //$a is the line number - $sql = "SELECT line FROM endpointman_line_list WHERE ext = " . $ext; - $a = $this->eda->sql($sql, 'getOne'); - //TODO: fix this area - $template_variables_array[$group_count]['data'][$variables_count]['type'] = "break"; - $variables_count++; - continue 2; - case "loop": - foreach ($config_options as $var_name => $var_items) { - $tv = explode('_', $variable); - $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; - if (isset($extra_data[$key])) { - $items[$variables_count] = $var_items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; - $variables_count++; - } - } - continue 2; - } - } - //Both Views - switch ($config_options['type']) { - case "break": - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $variables_count++; - break; - default: - if (array_key_exists('variable', $config_options)) { - $key = str_replace('$', '', $config_options['variable']); - //TODO: Move this into the sync function - //Checks to see if values are defined in the database, if not then we assume this is a new option and we need a default value here! - if (!isset($custom_cfg_data[$key])) { - //xml2array will take values that have no data and turn them into arrays, we want to avoid the word 'array' as a default value, so we blank it out here if we are an array - if ((array_key_exists('default_value', $config_options)) AND (is_array($config_options['default_value']))) { - $custom_cfg_data[$key] = ""; - } elseif ((array_key_exists('default_value', $config_options)) AND (!is_array($config_options['default_value']))) { - $custom_cfg_data[$key] = $config_options['default_value']; - } - } - if ((!$admin) AND (isset($extra_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $variables_count++; - } elseif ($admin) { - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $variables_count++; - } - } - break; - } - continue; - } - } - } - - return($template_variables_array); - } - - /** - * Generate an array that will get parsed as HTML from an array of values from XML - * @param int $i - * @param array $cfg_data - * @param string $key - * @param array $custom_cfg_data - * @return array - */ - function generate_form_data($i, $cfg_data, $key=NULL, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $extra_data=NULL, $template_type='GENERAL') { - switch ($cfg_data['type']) { - case "input": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $template_variables_array['type'] = "input"; - if (isset($cfg_data['max_chars'])) { - $template_variables_array['max_chars'] = $cfg_data['max_chars']; - } - $template_variables_array['key'] = $key; - $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "radio": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['type'] = "radio"; - $template_variables_array['key'] = $key; - $template_variables_array['description'] = $cfg_data['description']; - $z = 0; - while ($z < count($cfg_data['data'])) { - $template_variables_array['data'][$z]['key'] = $key; - $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; - $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; - if ($cfg_data['data'][$z]['value'] == $num) { - $template_variables_array['data'][$z]['checked'] = 'checked'; - } - $z++; - } - break; - case "list": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['type'] = "list"; - $template_variables_array['key'] = $key; - $template_variables_array['description'] = $cfg_data['description']; - $z = 0; - while ($z < count($cfg_data['data'])) { - $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; - $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; - if (isset($cfg_data['data'][$z]['disable'])) { - $cfg_data['data'][$z]['disable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['disable']); - $template_variables_array['data'][$z]['disables'] = explode(",", $cfg_data['data'][$z]['disable']); - } - if (isset($cfg_data['data'][$z]['enable'])) { - $cfg_data['data'][$z]['enable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['enable']); - $template_variables_array['data'][$z]['enables'] = explode(",", $cfg_data['data'][$z]['enable']); - } - if ($cfg_data['data'][$z]['value'] == $num) { - $template_variables_array['data'][$z]['selected'] = 'selected'; - } - $z++; - } - break; - case "checkbox": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['type'] = "checkbox"; - $template_variables_array['key'] = $key; - $template_variables_array['description'] = $cfg_data['description']; - $template_variables_array['checked'] = $custom_cfg_data[$key] ? TRUE : NULL; - $template_variables_array['value'] = $key; - break; - case "group"; - $template_variables_array['type'] = "group"; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "header"; - $template_variables_array['type'] = "header"; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "textarea": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $template_variables_array['type'] = "textarea"; - if (isset($cfg_data['rows'])) { - $template_variables_array['rows'] = $cfg_data['rows']; - } - if (isset($cfg_data['cols'])) { - $template_variables_array['cols'] = $cfg_data['cols']; - } - $template_variables_array['key'] = $key; - $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "break": - if ($admin) { - $template_variables_array['type'] = "break"; - } else { - $template_variables_array['type'] = "NA"; - } - break; - default: - $template_variables_array['type'] = "NA"; - break; - } - - if (isset($cfg_data['tooltip'])) { - $template_variables_array['tooltip'] = htmlentities($cfg_data['tooltip']); - } - - if (($this->global_cfg['enable_ari']) AND ($admin) AND ($cfg_data['type'] != "break") AND ($cfg_data['type'] != "group") AND ($template_type == 'GENERAL')) { - - $template_variables_array['aried'] = 1; - $template_variables_array['ari']['key'] = $key; - - if (isset($extra_data[$key])) { - $template_variables_array['ari']['checked'] = "checked"; - } - } - - if ($template_type == 'GLOBAL') { - $template_variables_array['freepbxed'] = 1; - $template_variables_array['freepbx']['key'] = $key; - if (empty($extra_data)) { - $template_variables_array['freepbx']['checked'] = TRUE; - } elseif (isset($extra_data[$key])) { - $template_variables_array['freepbx']['checked'] = TRUE; - } - } - return($template_variables_array); - } - - /** - * Save template from the template view pain - * @param int $id Either the MAC ID or Template ID - * @param int $custom Either 0 or 1, it determines if $id is MAC ID or Template ID - * @param array $variables The variables sent from the form. usually everything in $_REQUEST[] - * @return string Location of area to return to in Endpoint Manager - */ - function save_template($id, $custom, $variables) { - //Custom Means specific to that MAC - //This function is reversed. Not sure why - if ($custom != "0") { - $sql = "SELECT endpointman_model_list.max_lines, endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_product_list.id as product_id, endpointman_product_list.long_name, endpointman_model_list.template_data, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_mac_list.id=" . $id . " AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; - } else { - $sql = "SELECT endpointman_model_list.max_lines, endpointman_brand_list.directory, endpointman_product_list.cfg_dir, endpointman_product_list.config_files, endpointman_product_list.long_name, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_brand_list, endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = " . $id; - } - - //Load template data - $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $cfg_data = unserialize($row['template_data']); - $count = count($cfg_data); - - $custom_cfg_data_ari = array(); - - foreach ($cfg_data['data'] as $cats) { - foreach ($cats as $items) { - foreach ($items as $key_name => $config_options) { - if (preg_match('/(.*)\|(.*)/i', $key_name, $matches)) { - $type = $matches[1]; - $key = $matches[2]; - } else { - die('invalid'); - } - switch ($type) { - case "loop": - $stuffing = explode("_", $key); - $key2 = $stuffing[0]; - foreach ($config_options as $item_key => $item_data) { - $lc = isset($item_data['loop_count']) ? $item_data['loop_count'] : ''; - $key = 'loop|' . $key2 . '_' . $item_key . '_' . $lc; - if ((isset($item_data['loop_count'])) AND (isset($_REQUEST[$key]))) { - $custom_cfg_data[$key] = $_REQUEST[$key]; - $ari_key = "ari_" . $key; - if (isset($_REQUEST[$ari_key])) { - if ($_REQUEST[$ari_key] == "on") { - $custom_cfg_data_ari[$key] = 1; - } - } - } - } - break; - case "lineloop": - foreach ($config_options as $item_key => $item_data) { - $lc = isset($item_data['line_count']) ? $item_data['line_count'] : ''; - $key = 'line|' . $lc . '|' . $item_key; - if ((isset($item_data['line_count'])) AND (isset($_REQUEST[$key]))) { - $custom_cfg_data[$key] = $_REQUEST[$key]; - $ari_key = "ari_" . $key; - if (isset($_REQUEST[$ari_key])) { - if ($_REQUEST[$ari_key] == "on") { - $custom_cfg_data_ari[$key] = 1; - } - } - } - } - break; - case "option": - if (isset($_REQUEST[$key])) { - $custom_cfg_data[$key] = $_REQUEST[$key]; - $ari_key = "ari_" . $key; - if (isset($_REQUEST[$ari_key])) { - if ($_REQUEST[$ari_key] == "on") { - $custom_cfg_data_ari[$key] = 1; - } - } - } - break; - default: - break; - } - } - } - } - - $config_files = explode(",", $row['config_files']); - - $i = 0; - while ($i < count($config_files)) { - $config_files[$i] = str_replace(".", "_", $config_files[$i]); - if (isset($_REQUEST[$config_files[$i]])) { - $_REQUEST[$config_files[$i]] = explode("_", $_REQUEST[$config_files[$i]], 2); - $_REQUEST[$config_files[$i]] = $_REQUEST[$config_files[$i]][0]; - if ($_REQUEST[$config_files[$i]] > 0) { - $config_files_selected[$config_files[$i]] = $_REQUEST[$config_files[$i]]; - } - } - $i++; - } - - if (!isset($config_files_selected)) { - $config_files_selected = ""; - } else { - $config_files_selected = serialize($config_files_selected); - } - $custom_cfg_data_temp['data'] = $custom_cfg_data; - $custom_cfg_data_temp['ari'] = $custom_cfg_data_ari; - - $save = serialize($custom_cfg_data_temp); - - if ($custom == "0") { - $sql = 'UPDATE endpointman_template_list SET config_files_override = \'' . addslashes($config_files_selected) . '\', global_custom_cfg_data = \'' . addslashes($save) . '\' WHERE id =' . $id; - $location = "template_manager"; - } else { - $sql = 'UPDATE endpointman_mac_list SET config_files_override = \'' . addslashes($config_files_selected) . '\', template_id = 0, global_custom_cfg_data = \'' . addslashes($save) . '\' WHERE id =' . $id; - $location = "devices_manager"; - } - - $this->eda->sql($sql); - - $phone_info = array(); - - if ($custom != 0) { - $phone_info = $this->get_phone_info($id); - if (isset($_REQUEST['epm_reboot'])) { - $this->prepare_configs($phone_info); - } else { - $this->prepare_configs($phone_info, FALSE); - } - } else { - $sql = 'SELECT id FROM endpointman_mac_list WHERE template_id = ' . $id; - $phones = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - foreach ($phones as $data) { - $phone_info = $this->get_phone_info($data['id']); - if (isset($_REQUEST['epm_reboot'])) { - $this->prepare_configs($phone_info); - } else { - $this->prepare_configs($phone_info, FALSE); - } - } - } - - if (isset($_REQUEST['silent_mode'])) { - echo ''; - } else { - return($location); - } - } - - - - function display_configs() { - - } - - - -} -?> \ No newline at end of file + 0) + { + foreach ($remplace_txt as $clave => $valor) { + $texto = str_replace($clave, $valor, $texto); + } + } + return '

      '.$texto.'

      '; +} + +function generate_xml_from_array ($array, $node_name, &$tab = -1) +{ + $tab++; + $xml =""; + if (is_array($array) || is_object($array)) { + foreach ($array as $key=>$value) { + if (is_numeric($key)) { + $key = $node_name; + } + + $xml .= str_repeat(" ", $tab). '<' . $key . '>' . "\n"; + $xml .= generate_xml_from_array($value, $node_name, $tab); + $xml .= str_repeat(" ", $tab). '' . "\n"; + + } + } else { + $xml = str_repeat(" ", $tab) . htmlspecialchars($array, ENT_QUOTES) . "\n"; + } + $tab--; + return $xml; +} + + +class Endpointman implements \BMO { + + //public $eda; //endpoint data abstraction layer + //public $system; + + public $error; //error construct + public $message; //message construct + + public $UPDATE_PATH; + public $MODULES_PATH; + public $LOCAL_PATH; + public $PHONE_MODULES_PATH; + public $PROVISIONER_BASE; + + + public function __construct($freepbx = null) { + if ($freepbx == null) { + throw new \Exception("Not given a FreePBX Object"); + } + require_once('lib/json.class.php'); + require_once('lib/Config.class.php'); + require_once('lib/epm_system.class.php'); + require_once('lib/datetimezone.class.php'); + require_once('lib/epm_data_abstraction.class.php'); + + + $this->freepbx = $freepbx; + $this->db = $freepbx->Database; + $this->config = $freepbx->Config; + $this->configmod = new Endpointman\Config(); + $this->system = new epm_system(); + $this->eda = new epm_data_abstraction($this->config, $this->configmod); + + + $this->configmod->set('disable_epm', FALSE); + $this->eda->global_cfg = $this->configmod->getall(); + + //Generate empty array + $this->error = array(); + $this->message = array(); + + + $this->configmod->set('tz', $this->config->get('PHPTIMEZONE')); + date_default_timezone_set($this->configmod->get('tz')); + + $this->UPDATE_PATH = $this->configmod->get('update_server'); + $this->MODULES_PATH = $this->config->get('AMPWEBROOT') . '/admin/modules/'; + +define("UPDATE_PATH", $this->UPDATE_PATH); +define("MODULES_PATH", $this->MODULES_PATH); + + + //Determine if local path is correct! + if (file_exists($this->MODULES_PATH . "endpointman/")) { + $this->LOCAL_PATH = $this->MODULES_PATH . "endpointman/"; +define("LOCAL_PATH", $this->LOCAL_PATH); + } else { + die("Can't Load Local Endpoint Manager Directory!"); + } + + //Define the location of phone modules, keeping it outside of the module directory so that when the user updates endpointmanager they don't lose all of their phones + if (file_exists($this->MODULES_PATH . "_ep_phone_modules/")) { + $this->PHONE_MODULES_PATH = $this->MODULES_PATH . "_ep_phone_modules/"; + } else { + $this->PHONE_MODULES_PATH = $this->MODULES_PATH . "_ep_phone_modules/"; + if (!file_exists($this->PHONE_MODULES_PATH)) { + mkdir($this->PHONE_MODULES_PATH, 0775); + } + if (file_exists($this->PHONE_MODULES_PATH . "setup.php")) { + unlink($this->PHONE_MODULES_PATH . "setup.php"); + } + if (!file_exists($this->MODULES_PATH . "_ep_phone_modules/")) { + die('Endpoint Manager can not create the modules folder!'); + } + } +define("PHONE_MODULES_PATH", $this->PHONE_MODULES_PATH); + + //Define error reporting + if (($this->configmod->get('debug')) AND (!isset($_REQUEST['quietmode']))) { + error_reporting(E_ALL); + ini_set('display_errors', 1); + } else { + ini_set('display_errors', 0); + } + + //Check if config location is writable and/or exists! + if ($this->configmod->isExiste('config_location')) { + $config_location = $this->configmod->get('config_location'); + if (is_dir($config_location)) { + if (!is_writeable($config_location)) { + $user = exec('whoami'); + $group = exec("groups"); + $this->error['config_location'] = _("Configuration Directory is not writable!") . "
      " . + _("Please change the location:") . "" . _("Here") . "
      " . + _("Or run this command on SSH:") . "
      " . + "'chown -hR root: " . $group . " " . $config_location . "'
      " . + "'chmod g+w " . $config_location . "'"; + $this->configmod->set('disable_epm', TRUE); + } + } else { + $this->error['config_location'] = _("Configuration Directory is not a directory or does not exist! Please change the location here:") . "" . _("Here") . ""; + $this->configmod->set('disable_epm', TRUE); + } + } + } + + public function chownFreepbx() { + $webroot = $this->config->get('AMPWEBROOT'); + $modulesdir = $webroot . '/admin/modules/'; + $files = array(); + $files[] = array('type' => 'dir', + 'path' => $modulesdir . '/_ep_phone_modules/', + 'perms' => 0755); + $files[] = array('type' => 'file', + 'path' => $modulesdir . '/_ep_phone_modules/setup.php', + 'perms' => 0755); + $files[] = array('type' => 'dir', + 'path' => '/tftpboot', + 'perms' => 0755); + return $files; + } + + public function ajaxRequest($req, &$setting) { + +//AVISO!!!!!!!!!!!!!!!!!!!!!!!!!! +//PERMITE TODO!!!!!!!!!!!!!!!!!!! +$setting['authenticate'] = true; +$setting['allowremote'] = true; +return true; + + switch ($_REQUEST['module_sec']) + { + case "epm_devices": break; + case "epm_templates": + switch ($req) + { + case "model_clone": + case "list_current_template": + case "add_template": + case "del_template": + $setting['authenticate'] = true; + $setting['allowremote'] = false; + return true; + break; + } + break; + + case "epm_config": + switch ($req) + { + case "saveconfig": + case "list_all_brand": + $setting['authenticate'] = true; + $setting['allowremote'] = false; + return true; + break; + } + break; + + case "epm_advanced": + switch ($req) + { + case "oui": + case "oui_add": + case "oui_del": + case "poce_select": + case "poce_select_file": + case "poce_save_file": + case "poce_save_as_file": + case "poce_sendid": + case "poce_delete_config_custom": + case "list_files_brands_export": + case "saveconfig": + $setting['authenticate'] = true; + $setting['allowremote'] = false; + return true; + break; + } + break; + } + return false; + } + + public function ajaxHandler() { + $module_sec = isset($_REQUEST['module_sec'])? trim($_REQUEST['module_sec']) : ''; + $module_tab = isset($_REQUEST['module_tab'])? trim($_REQUEST['module_tab']) : ''; + $command = isset($_REQUEST['command'])? trim($_REQUEST['command']) : ''; + + $txt = ""; + switch ($module_sec) + { + case "epm_devices": break; + case "epm_templates": + if ($module_tab == "manager") + { + switch ($command) + { + case "list_current_template": + $retarr = $this->epm_templates_list_current_templates(); + return $retarr; + break; + + case "model_clone": + $retarr = $this->epm_templates_model_clone(); + return $retarr; + break; + + case "add_template": + $retarr = $this->epm_templates_add_template(); + return $retarr; + break; + + case "del_template": + $retarr = $this->epm_templates_del_template(); + return $retarr; + break; + + default: + $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); + break; + } + } + break; + + case "epm_config": + $txt['manager'] = array( + 'ayuda_model' => _("If we can activate the model set terminals of the models.
      If this model is disabled will not appear in the list of models that can be configured for PBX."), + 'ayuda_producto' => _('The button "Install Firmware" installs the necessary files to the server for the terminal alone are updated via TFTP or HTTP.
      The button "Remove frimware" delete files server products.
      The button "Update frimware" appears if a newer frimware detected on the server and asks if you want to update.
      The "Update" button appears when a new version of this model pack is detected.'), + 'ayuda_marca' => _('The "Install" button installs the configuration package brand models we selected.
      The "Uninstall" button removes the package configuration models of the brand selected.
      The "Update" button appears if a new version of the package that is already installed to upgrade to the latest version is detected.'), + 'new_pack_mod' => _("New Package Modified"), + 'pack_last_mod' => _("Package Last Modified"), + 'check_update' => _("Check for Update "), + 'check_online' => _("Check Online "), + 'install' => _("Install"), + 'uninstall' => _("Uninstall"), + 'update' => _("Update"), + 'fw_install' => _('Install Firmware'), + 'fw_uninstall' => _('Remove Firmware'), + 'fw_update' => _('Update Firmware'), + 'enable' => _('Enable'), + 'disable' => _('Disable'), + 'ready' => _("Ready!"), + 'error' => _("Error!"), + 'title_update' => _("Update!"), + 'save_changes' => _("Saving Changes..."), + 'save_changes_ok' => _("Saving Changes... Ok!"), + 'err_upload_content' => _("Upload Content!"), + 'check' => _("Check for Updates..."), + 'check_ok' => _("Check for Updates... Ok!"), + 'update_content' => _("Update Content..."), + 'opt_invalid' => _("Invalid Option!") + ); + $txt['editor'] = array( + 'ayuda_marca' => _("If you select Hide this brand will disappear and all products and models on the list of Install/Uninstall."), + 'ayuda_producto' => _("If you select Hide disappear all models of the product selected from the Install/Uninstall list."), + 'ayuda_modelo' => _("If you select Hide disappear this model the Install/Uninstall list."), + 'show' => _("Show"), + 'hide' => _("Hide"), + 'ready'=> _("Ready!"), + 'error' => _("Error!"), + 'save_changes' => _("Saving Changes..."), + 'save_changes_ok' => _("Saving Changes... Ok!"), + 'ready' => _("Ready!"), + 'err_upload_content' => _("Upload Content!"), + 'opt_invalid' => _("Invalid Option!") + ); + + if ($module_tab == "manager") + { + switch ($command) + { + case "saveconfig": + $retarr = $this->epm_config_manager_saveconfig(); + break; + + case "list_all_brand": + $retarr = array("status" => true, "message" => "OK", "datlist" => $this->epm_config_manager_hardware_get_list_all(false)); + break; + + default: + $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); + break; + } + $retarr['txt'] = $txt['manager']; + } + elseif ($module_tab == "editor") + { + switch ($command) + { + case "saveconfig": + $retarr = $this->epm_config_editor_saveconfig(); + break; + + case "list_all_brand": + $retarr = array("status" => true, "message" => "OK", "datlist" => $this->epm_config_editor_hardware_get_list_all()); + break; + + default: + $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); + break; + } + $retarr['txt'] = $txt['editor']; + } + else { + $retarr = array("status" => false, "message" => _("Tab is not valid!") . " [" .$module_tab. "]"); + } + return $retarr; + break; + + case "epm_advanced": + $txt['settings'] = array( + 'error' => _("Error!"), + 'save_changes' => _("Saving Changes..."), + 'save_changes_ok' => _("Saving Changes... Ok!"), + 'opt_invalid' => _("Invalid Option!") + ); + + if ($module_tab == "settings") + { + switch ($command) + { + case "saveconfig": + $retarr = $this->epm_advanced_settings_saveconfig(); + break; + + default: + $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); + break; + } + $retarr['txt'] = $txt['settings']; + } + elseif ($module_tab == "oui_manager") { + switch ($command) + { + case "oui": + //$sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name, endpointman_oui_list.custom FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id ORDER BY endpointman_oui_list.oui ASC'; + $sql = 'SELECT T1.id, T1.oui, T2.name, T1.custom FROM endpointman_oui_list as T1 , endpointman_brand_list as T2 WHERE T1.brand = T2.id ORDER BY T1.oui ASC'; + $data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $ret = array(); + foreach ($data as $item) { + $ret[] = array('id' => $item['id'], 'oui' => $item['oui'], 'brand' => $item['name'], 'custom' => $item['custom']); + } + return $ret; + break; + + case "oui_add": + $retarr = $this->epm_advanced_oui_add(); + break; + + case "oui_del": + $retarr = $this->epm_advanced_oui_remove(); + break; + + default: + $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); + break; + } + //$retarr['txt'] = $txt['settings']; + } + elseif ($module_tab == "iedl") { + switch ($command) + { + default: + $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); + break; + } + //$retarr['txt'] = $txt['settings']; + } + elseif ($module_tab == "poce") { + switch ($command) + { + case "poce_select": + $retarr = $this->epm_advanced_poce_select(); + break; + + case "poce_select_file": + $retarr = $this->epm_advanced_poce_select_file(); + break; + + case "poce_save_file": + case "poce_save_as_file": + $retarr = $this->epm_advanced_poce_save_file(); + break; + + case "poce_sendid": + $retarr = $this->epm_advanced_poce_sendid(); + break; + + case "poce_delete_config_custom": + $retarr = $this->epm_advanced_poce_delete_config_custom(); + break; + + default: + $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); + break; + } + //$retarr['txt'] = $txt['settings']; + } + elseif ($module_tab == "manual_upload") { + switch ($command) + { + case "list_files_brands_export": + $retarr = $this->epm_advanced_manual_upload_list_files_brans_export(); + break; + + default: + $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); + break; + } + } + else { + $retarr = array("status" => false, "message" => _("Tab is not valid!") . " [" .$module_tab. "]"); + } + return $retarr; + break; + } + return false; + } + + public static function myDialplanHooks() { + return true; + } + + public function doConfigPageInit($page) { + //TODO: Pendiente revisar y eliminar moule_tab. + $module_tab = isset($_REQUEST['module_tab'])? trim($_REQUEST['module_tab']) : ''; + if ($module_tab == "") { + $module_tab = isset($_REQUEST['subpage'])? trim($_REQUEST['subpage']) : ''; + } + + $command = isset($_REQUEST['command'])? trim($_REQUEST['command']) : ''; + switch ($page) + { + case "epm_devices": break; + case "epm_templates": break; + case "epm_config": + switch ($module_tab) + { + case "manager": + switch ($command) { + case "check_for_updates": + echo format_txt("Update data..."); + $this->update_check(); + echo format_txt("Done!"); + echo "


      "; + exit; + break; + + case "manual_install": + $this->epm_config_manual_install(); + echo "


      "; + exit; + break; + + case "firmware": + $this->epm_config_manager_firmware(); + echo "


      "; + exit; + break; + + case "brand": + $this->epm_config_manager_brand(); + echo "


      "; + exit; + break; + } + break; + + case "editor": + break; + } + break; + + case "epm_advanced": + switch ($module_tab) + { + case "oui_manager": + break; + + case "iedl": + switch ($command) { + case "export": + $this->epm_advanced_iedl_export(); + break; + case "import": + $this->epm_advanced_iedl_import(); + echo "


      "; + exit; + break; + } + break; + + case "manual_upload": + switch ($command) { + case "export_brands_availables": + $this->epm_advanced_manual_upload_export_brans_available(); + echo "


      "; + exit; + break; + + case "export_brands_availables_file": + $this->epm_advanced_manual_upload_export_brans_available_file(); + exit; + break; + + case "upload_brand": + $this->epm_advanced_manual_upload_brand(); + echo "


      "; + exit; + break; + + case "upload_provisioner": + $this->epm_advanced_manual_upload_provisioner(); + echo "


      "; + exit; + break; + } + break; + break; + } + break; + } + } + + public function doGeneralPost() { + if (!isset($_REQUEST['Submit'])) { return; } + if (!isset($_REQUEST['display'])) { return; } + + needreload(); + } + + public function myShowPage() { + if (! isset($_REQUEST['display'])) + return $this->pagedata; + + switch ($_REQUEST['display']) + { + case "epm_devices": + if(empty($this->pagedata)) + { + $this->pagedata['main'] = array( + "name" => _("Devices"), + "page" => 'views/epm_devices_main.page.php' + ); + } + break; + + case "epm_templates": + if(empty($this->pagedata)) + { + $this->pagedata['manager'] = array( + "name" => _("Current Templates"), + "page" => 'views/epm_templates_manager.page.php' + ); + $this->pagedata['editor'] = array( + "name" => _("Template Editor"), + "page" => 'views/epm_templates_editor.page.php' + ); + } + break; + + case "epm_config": + if(empty($this->pagedata)) + { + $this->pagedata['manager'] = array( + "name" => _("Install/Unistall"), + "page" => 'views/epm_config_manager.page.php' + ); + $this->pagedata['editor'] = array( + "name" => _("Show/Hide"), + "page" => 'views/epm_config_editor.page.php' + ); + } + break; + + case "epm_advanced": + if(empty($this->pagedata)) + { + $this->pagedata['settings'] = array( + "name" => _("Settings"), + "page" => 'views/epm_advanced_settings.page.php' + ); + $this->pagedata['oui_manager'] = array( + "name" => _("OUI Manager"), + "page" => 'views/epm_advanced_oui_manager.page.php' + ); + $this->pagedata['poce'] = array( + "name" => _("Product Configuration Editor"), + "page" => 'views/epm_advanced_poce.page.php' + ); + $this->pagedata['iedl'] = array( + "name" => _("Import/Export My Devices List"), + "page" => 'views/epm_advanced_iedl.page.php' + ); + $this->pagedata['manual_upload'] = array( + "name" => _("Package Import/Export"), + "page" => 'views/epm_advanced_manual_upload.page.php' + ); + } + break; + } + + if(! empty($this->pagedata)) { + foreach($this->pagedata as &$page) { + ob_start(); + include($page['page']); + $page['content'] = ob_get_contents(); + ob_end_clean(); + } + return $this->pagedata; + } + } + + public function getActiveModules() { + } + + //http://wiki.freepbx.org/display/FOP/Adding+Floating+Right+Nav+to+Your+Module + public function getRightNav($request) { + } + + //http://wiki.freepbx.org/pages/viewpage.action?pageId=29753755 + public function getActionBar($request) { + } + + public function install() { + + } + + public function uninstall() { + out(_("Removing Phone Modules Directory")); + $this->system->rmrf($this->PHONE_MODULES_PATH); + exec("rm -R ". $this->PHONE_MODULES_PATH); + + out(_('Removing symlink to web provisioner')); + $provisioning_path = $this->config->get('AMPWEBROOT')."/provisioning"; + if(is_link($provisioning_path)) { unlink($provisioning_path); } + + if(!is_link($this->config->get('AMPWEBROOT').'/admin/assets/endpointman')) { + $this->system->rmrf($this->config->get('AMPWEBROOT').'/admin/assets/endpointman'); + } + + out(_("Dropping all relevant tables")); + $sql = "DROP TABLE `endpointman_brand_list`"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $sql = "DROP TABLE `endpointman_global_vars`"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $sql = "DROP TABLE `endpointman_mac_list`"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $sql = "DROP TABLE `endpointman_line_list`"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $sql = "DROP TABLE `endpointman_model_list`"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $sql = "DROP TABLE `endpointman_oui_list`"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $sql = "DROP TABLE `endpointman_product_list`"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $sql = "DROP TABLE `endpointman_template_list`"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $sql = "DROP TABLE `endpointman_time_zones`"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $sql = "DROP TABLE `endpointman_custom_configs`"; + $sth = $this->db->prepare($sql); + $sth->execute(); + return true; + } + + public function backup() { + } + + public function restore($backup) { + } + + + + + + + + + + + + + + /** + * Get info models by product id selected. + * @param int $id_product product ID + * @param bool $show_all True return all, False return hidden = 0 + * @return array + */ + public function epm_config_hardware_get_list_models($id_product=NULL, $show_all = true) + { + if(! is_numeric($id_product)) { throw new \Exception( _("ID Producto not is number")." (".$id_product.")"); } + if($show_all == true) { $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = '.$id_product; } + else { $sql = 'SELECT * FROM endpointman_model_list WHERE hidden = 0 AND product_id = '.$id_product; } + $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + return $result; + } + + /** + * Get info product by brand id selected. + * @param int $id_brand brand ID + * @param bool $show_all True return all, FAlse return hidde = 0 + * @return array + */ + public function epm_config_hardware_get_list_product($id_brand=NULL, $show_all = true) + { + if(! is_numeric($id_brand)) { throw new \Exception(_("ID Brand not is numbre")." (".$id_brand.")"); } + if ($show_all == true) { $sql = 'SELECT * FROM endpointman_product_list WHERE brand = '.$id_brand.' ORDER BY long_name ASC'; } + else { $sql = 'SELECT * FROM endpointman_product_list WHERE hidden = 0 AND brand = '.$id_brand.' ORDER BY long_name ASC'; } + $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + return $result; + } + + /** + * Get info all brands. + * @param bool $show_all True return all, False return hidde = 0 + * @return array + */ + public function epm_config_hardware_get_list_brand($show_all = true) { + if ($show_all == true) { $sql = "SELECT * from endpointman_brand_list WHERE id > 0 ORDER BY id ASC "; } + else { $sql = "SELECT * from endpointman_brand_list WHERE id > 0 AND hidden = 0 ORDER BY id ASC "; } + $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + return $result; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + private function epm_config_manual_install($install_type = "", $package ="") + { + if ($install_type == "") { + throw new \Exception("Not send install_type!"); + } + + switch($install_type) { + case "export_brand": + + break; + + case "upload_master_xml": + if (file_exists($this->PHONE_MODULES_PATH."temp/master.xml")) { + $handle = fopen($this->PHONE_MODULES_PATH."temp/master.xml", "rb"); + $contents = stream_get_contents($handle); + fclose($handle); + @$a = simplexml_load_string($contents); + if($a===FALSE) { + echo "Not a valid xml file"; + break; + } else { + rename($this->PHONE_MODULES_PATH."temp/master.xml", $this->PHONE_MODULES_PATH."master.xml"); + echo "Move Successful
      "; + $this->update_check(); + echo "Updating Brands
      "; + } + } else { + } + break; + + case "upload_provisioner": + + break; + + case "upload_brand": + + break; + } + } + + + + + + + + + + + + + + + + /****************************************************** + **** FUNCIONES SEC MODULO "epm_template\manager". **** + *****************************************************/ + + public function epm_templates_del_template() + { + if (! isset($_REQUEST['idsel'])) { + $retarr = array("status" => false, "message" => _("No send ID!")); + } + elseif (! is_numeric($_REQUEST['idsel'])) { + $retarr = array("status" => false, "message" => _("ID is not number!")); + } + elseif ($_REQUEST['idsel'] <= 0) { + $retarr = array("status" => false, "message" => _("ID send is negative!")); + } + else { + $dget['idsel'] = $_REQUEST['idsel']; + + $sql = "DELETE FROM endpointman_template_list WHERE id = ". $dget['idsel']; + sql($sql); + $sql = "UPDATE endpointman_mac_list SET template_id = 0 WHERE template_id = ".$dget['idsel']; + sql($sql); + + $retarr = array("status" => true, "message" => _("Delete Template OK!")); + unset($dget); + } + return $retarr; + } + + public function epm_templates_add_template () + { + if (! isset($_REQUEST['newnametemplate'])) { + $retarr = array("status" => false, "message" => _("No send Name!")); + } + elseif (empty($_REQUEST['newnametemplate'])) { + $retarr = array("status" => false, "message" => _("Name is null!")); + } + elseif (! isset($_REQUEST['newproductselec'])) { + $retarr = array("status" => false, "message" => _("No send Product!")); + } + elseif (! is_numeric($_REQUEST['newproductselec'])) { + $retarr = array("status" => false, "message" => _("Product is not number!")); + } + elseif ($_REQUEST['newproductselec'] <= 0) { + $retarr = array("status" => false, "message" => _("Product send is negative!")); + } + elseif (! isset($_REQUEST['newclonemodel'])) { + $retarr = array("status" => false, "message" => _("No send Clone Model!")); + } + elseif (! is_numeric($_REQUEST['newclonemodel'])) { + $retarr = array("status" => false, "message" => _("Clone Model is not number!")); + } + elseif ($_REQUEST['newclonemodel'] <= 0) { + $retarr = array("status" => false, "message" => _("Clone Model send is negative!")); + } + else { + $dget['newnametemplate'] = $_REQUEST['newnametemplate']; + $dget['newproductselec'] = $_REQUEST['newproductselec']; + $dget['newclonemodel'] = $_REQUEST['newclonemodel']; + + $db = $this->db; + $sql = "INSERT INTO endpointman_template_list (product_id, name, model_id) VALUES (?,?,?)"; + $q = $db->prepare($sql); + $ob = $q->execute(array($dget['newproductselec'], addslashes($dget['newnametemplate']), $dget['newclonemodel'])); + $newid = $db->lastInsertId(); + //$endpoint->edit_template_display($id,0); + + $retarr = array("status" => true, "message" => _("Add New Template OK!"), "newid" => $newid); + unset($dget); + } + return $retarr; + } + + public function epm_templates_model_clone () + { + if (! isset($_REQUEST['id'])) { + $retarr = array("status" => false, "message" => _("No send ID!")); + } + elseif (! is_numeric($_REQUEST['id'])) { + $retarr = array("status" => false, "message" => _("ID send is not number!")); + } + elseif ($_REQUEST['id'] <= 0) { + $retarr = array("status" => false, "message" => _("ID send is number not valid!")); + } + else + { + $dget['id'] = $_REQUEST['id']; + + $i=0; + $out = array(); + $sql = "SELECT endpointman_model_list.id, endpointman_model_list.model as model FROM endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND product_id = '". $dget['id']."'"; + $result = sql($sql,'getAll', DB_FETCHMODE_ASSOC); + foreach($result as $row) { + $out[$i]['optionValue'] = $row['id']; + $out[$i]['optionDisplay'] = $row['model']; + $i++; + } + $retarr = array("status" => true, "message" => _("Generate list Ok!"), "listopt" => $out); + + unset($dget); + } + return $retarr; + } + + public function epm_templates_list_current_templates () + { + + $sql = 'SELECT endpointman_template_list.*, endpointman_product_list.short_name as model_class, endpointman_model_list.model as model_clone, endpointman_model_list.enabled FROM endpointman_template_list, endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.hidden = 0 AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.product_id = endpointman_product_list.id'; + $template_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $i = 0; + $row_out = array(); + foreach($template_list as $row) { + $row_out[$i] = $row; + $row_out[$i]['custom'] = 0; + if(!$row['enabled']) { + $row_out[$i]['model_clone'] = $row_out[$i]['model_clone']; + } + $i++; + } + + $sql = 'SELECT endpointman_mac_list.mac, endpointman_mac_list.id, endpointman_mac_list.model, endpointman_model_list.model as model_clone, endpointman_product_list.short_name as model_class FROM endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.global_custom_cfg_data IS NOT NULL AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_mac_list.template_id = 0'; + $template_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach($template_list as $row) { + $sql = 'SELECT description , line FROM endpointman_line_list WHERE mac_id ='. $row['id'].' ORDER BY line ASC'; + $line_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $description = ""; + $c = 0; + foreach($line_list as $line_row) { + if($c > 0) { + $description .= ", "; + } + $description .= $line_row['description']; + $c++; + } + $row_out[$i] = $row; + $row_out[$i]['custom'] = 1; + $row_out[$i]['name'] = $row['mac']; + $row_out[$i]['description'] = $description; + $i++; + } + + /* + //$sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name, endpointman_oui_list.custom FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id ORDER BY endpointman_oui_list.oui ASC'; + $sql = 'SELECT T1.id, T1.oui, T2.name, T1.custom FROM endpointman_oui_list as T1 , endpointman_brand_list as T2 WHERE T1.brand = T2.id ORDER BY T1.oui ASC'; + $data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $ret = array(); + foreach ($data as $item) { + $ret[] = array('id' => $item['id'], 'oui' => $item['oui'], 'brand' => $item['name'], 'custom' => $item['custom']); + } + */ + return $row_out; + } + + /******************** + * END SEC FUNCTIONS * + ********************/ + + + + + + + /*************************************************** + **** FUNCIONES SEC MODULO "epm_advanced\poce". **** + ***************************************************/ + + public function epm_advanced_poce_select() + { + if (! isset($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("No send Product Select!")); + } + elseif (! is_numeric($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("Product Select send is not number!")); + } + elseif ($_REQUEST['product_select'] < 0) { + $retarr = array("status" => false, "message" => _("Product Select send is number not valid!")); + } + else + { + $dget['product_select'] = $_REQUEST['product_select']; + + $sql = 'SELECT * FROM `endpointman_product_list` WHERE `hidden` = 0 AND `id` = '.$dget['product_select']; + $product_select_info = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id ='" . $dget['product_select'] . "'"; + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + $config_files = explode(",", $row['config_files']); + $i = 0; + if (count($config_files)) { + foreach ($config_files as $config_files_data) { + //$file_list[$i]['value'] = $i; + $file_list[$i]['value'] = $dget['product_select']; + $file_list[$i]['text'] = $config_files_data; + $i++; + } + } else { $file_list = NULL; } + + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $dget['product_select'] . "'"; + $data = sql($sql,'getAll', DB_FETCHMODE_ASSOC); + $i = 0; + if (count($data)) { + //$data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach ($data as $row2) { + $sql_file_list[$i]['value'] = $row2['id']; + $sql_file_list[$i]['text'] = $row2['name']; + $sql_file_list[$i]['ref'] = $row2['original_name']; + $i++; + } + } else { $sql_file_list = NULL; } + + + require_once($this->PHONE_MODULES_PATH . 'setup.php'); + $class = "endpoint_" . $row['directory'] . "_" . $row['cfg_dir'] . '_phone'; + $base_class = "endpoint_" . $row['directory'] . '_base'; + $master_class = "endpoint_base"; + + /********************************************************************************* + *** Quick Fix for FreePBX Distro + *** I seriously want to figure out why ONLY the FreePBX Distro can't do autoloads. + **********************************************************************************/ + if (!class_exists($master_class)) { + ProvisionerConfig::endpointsAutoload($master_class); + } + if (!class_exists($base_class)) { + ProvisionerConfig::endpointsAutoload($base_class); + } + if (!class_exists($class)) { + ProvisionerConfig::endpointsAutoload($class); + } + //end quick fix + $phone_config = new $class(); + + //TODO: remove + $template_file_list[0]['value'] = "template_data_custom.xml"; + $template_file_list[0]['text'] = "template_data_custom.xml"; + + $sql = "SELECT id, model FROM endpointman_model_list WHERE product_id = '" . $dget['product_select'] . "' AND enabled = 1 AND hidden = 0"; + $data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $i = 1; + foreach ($data as $list) { + //$template_file_list[$i]['value'] = "template_data_" . $list['model'] . "_custom.xml"; + $template_file_list[$i]['value'] = $list['id']; + $template_file_list[$i]['text'] = "template_data_" . $list['model'] . "_custom.xml"; + } + + $retarr = array("status" => true, + "message" => "OK", + "product_select" => $dget['product_select'], + "product_select_info" => $product_select_info, + "file_list" => $file_list, + "template_file_list" => $template_file_list, + "sql_file_list" => $sql_file_list); + unset($dget); + } + return $retarr; + } + + public function epm_advanced_poce_select_file() + { + if (! isset($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("No send Product Select!")); + } + elseif (! is_numeric($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("Product Select send is not number!")); + } + elseif ($_REQUEST['product_select'] < 0) { + $retarr = array("status" => false, "message" => _("Product Select send is number not valid!")); + } + elseif (! isset($_REQUEST['file_id'])) { + $retarr = array("status" => false, "message" => _("No send File ID!")); + } + elseif (! isset($_REQUEST['file_name'])) { + $retarr = array("status" => false, "message" => _("No send File Name!")); + } + elseif (! isset($_REQUEST['type_file'])) { + $retarr = array("status" => false, "message" => _("No send Type File!")); + } + else + { + $dget['product_select'] = $_REQUEST['product_select']; + $dget['file_name'] = $_REQUEST['file_name']; + $dget['file_id'] = $_REQUEST['file_id']; + $dget['type_file'] = $_REQUEST['type_file']; + + + if ($dget['type_file'] == "sql") { + $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $dget['file_id']; + $row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); + + $type = $dget['type_file']; + $sendidt = $row['id']; + $product_select = $row['product_id']; + $save_as_name_value = $row['name']; + $original_name = $row['original_name']; + $filename = $row['name']; + $location = "SQL: ". $row['name']; + $config_data = $this->display_htmlspecialchars($row['data']); + + } + elseif ($dget['type_file'] == "file") { + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $config_files = explode(",", $row['config_files']); + //TODO: A�adir validacion para ver si $dget['file_name'] esta en el array $config_files + + $filename = $dget['file_name']; + $pathfile = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $filename; + + + if (is_readable($pathfile)) { + if(filesize($pathfile)>0) { + $handle = fopen($pathfile, "rb"); + $contents = fread($handle, filesize($pathfile)); + fclose($handle); + $contents = $this->display_htmlspecialchars($contents); + } + else { + $contents = ""; + } + + $type = $dget['type_file']; + $sendidt = $dget['file_id']; + $product_select = $dget['product_select']; + $save_as_name_value = $filename; + $original_name = $filename; + $filename = $filename; + $location = $pathfile; + $config_data = $contents; + } + else { + $retarr = array("status" => false, "message" => _("File not readable, check the permission! ").$filename); + } + } + elseif ($dget['type_file'] == "tfile") + { + if ($dget['file_id'] == "template_data_custom.xml") + { + $sendidt = ""; + $original_name = $dget['file_name']; + $config_data = ""; + } + else { + + $sql = "SELECT * FROM endpointman_model_list WHERE id = '" . $dget['file_id'] . "'"; + $data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $sendidt = $data['id']; + $original_name = $dget['file_name']; + $config_data = unserialize($data['template_data']); + $config_data = generate_xml_from_array ($config_data, 'node'); + } + + $type = $dget['type_file']; + $product_select = $dget['product_select']; + $save_as_name_value = $dget['file_name']; + $filename = $dget['file_name']; + $location = $dget['file_name']; + } + + $retarr = array("status" => true, + "message" => "OK", + "type" => $type, + "sendidt" => $sendidt, + "product_select" => $product_select, + "save_as_name_value" => $save_as_name_value, + "original_name" => $original_name, + "filename" => $filename, + "location" => $location, + "config_data" => $config_data); + unset($dget); + } + return $retarr; + } + + + + + + + + //TODO: PENDIENTE REVISAR + function epm_advanced_poce_sendid() + { + if (! isset($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("No send Product Select!")); + } + elseif (! isset($_REQUEST['type_file'])) { + $retarr = array("status" => false, "message" => _("No send Type File!")); + } + elseif (! isset($_REQUEST['sendid'])) { + $retarr = array("status" => false, "message" => _("No send SendID!")); + } + else { + $dget['product_select'] = $_REQUEST['product_select']; + $dget['type_file'] = $_REQUEST['type_file']; + $dget['sendid'] = $_REQUEST['sendid']; + $dget['original_name'] = $_REQUEST['original_name']; + $dget['config_text'] = $_REQUEST['config_text']; + + + + //DEBUGGGGGGGGGGGGG + return; + if ($dget['type_file'] == "sql") { + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; + $row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); + $this->submit_config($row['directory'], $row['cfg_dir'], $dget['original_name'], $dget['config_text']); + $retarr = array("status" => true, "message" => "Sent! Thanks :-)"); + } + elseif ($dget['type_file'] == "file") { + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + $error = $this->submit_config($row['directory'], $row['cfg_dir'], $dget['original_name'], $dget['config_text']); + $retarr = array("status" => true, "message" => "Sent! Thanks :-)"); + } + else { + $retarr = array("status" => false, "message" => "Type not valid!"); + } + unset ($dget); + } + return $retarr; + } + + + + + + + + function epm_advanced_poce_save_file() + { + if (! isset($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("No send Product Select!")); + } + elseif (! isset($_REQUEST['sendid'])) { + $retarr = array("status" => false, "message" => _("No send SendID!")); + } + elseif (! isset($_REQUEST['type_file'])) { + $retarr = array("status" => false, "message" => _("No send Type File!")); + } + elseif (! isset($_REQUEST['config_text'])) { + $retarr = array("status" => false, "message" => _("No send Text File!")); + } + elseif (! isset($_REQUEST['save_as_name'])) { + $retarr = array("status" => false, "message" => _("No send Save Name!")); + } + elseif (! isset($_REQUEST['file_name'])) { + $retarr = array("status" => false, "message" => _("No send Name File!")); + } + elseif (! isset($_REQUEST['original_name'])) { + $retarr = array("status" => false, "message" => _("No send Origianl Name File!")); + } + else + { + $dget['type_file'] = $_REQUEST['type_file']; + $dget['sendid'] = $_REQUEST['sendid']; + $dget['product_select'] = $_REQUEST['product_select']; + $dget['save_as_name'] = $_REQUEST['save_as_name']; + $dget['original_name'] = $_REQUEST['original_name']; + $dget['file_name'] = $_REQUEST['file_name']; + $dget['config_text'] = $_REQUEST['config_text']; + + + if ($dget['type_file'] == "file") + { + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + $config_files = explode(",", $row['config_files']); + + if ((is_array($config_files)) AND (in_array($dget['file_name'], $config_files))) + { + $pathdir = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/"; + $pathfile = $pathdir . $dget['file_name']; + if ((! file_exists($pathfile)) AND (! is_writable($pathdir))) { + $retarr = array("status" => false, "message" => "Directory is not Writable (".$pathdir.")!"); + } + elseif (! is_writable($pathfile)) { + $retarr = array("status" => false, "message" => "File is not Writable (".$pathfile.")!"); + } + else + { + $wfh = fopen($pathfile, 'w'); + fwrite($wfh, $dget['config_text']); + fclose($wfh); + $retarr = array("status" => true, "message" => "Saved to Hard Drive!"); + } + } + else { + $retarr = array("status" => false, "message" => "The File no existe in the DataBase!"); + } + } + elseif ($dget['type_file'] == "sql") + { + $sql = "UPDATE endpointman_custom_configs SET data = '" . addslashes($dget['config_text']) . "' WHERE id = " . $dget['sendid']; + sql($sql); + $retarr = array("status" => true, "message" => "Saved to Database!"); + } + elseif ($dget['type_file'] == "tfile") + { + $db = $this->db; + $sql = 'INSERT INTO endpointman_custom_configs (name, original_name, product_id, data) VALUES (?,?,?,?)'; + $q = $db->prepare($sql); + $ob = $q->execute(array(addslashes($dget['save_as_name']), addslashes($dget['original_name']), $dget['product_select'], addslashes($dget['config_text']))); + $newidinsert = $db->lastInsertId(); + $retarr = array("status" => true, "message" => "Saved to Database!"); + + $retarr['type_file'] = "sql"; + $retarr['location'] = "SQL: ". $dget['save_as_name']; + $retarr['sendidt'] = $newidinsert; + } + else { + $retarr = array("status" => false, "message" => "Type not valid!"); + } + + + $retarr['original_name'] = $dget['original_name']; + $retarr['file_name'] = $dget['file_name']; + $retarr['save_as_name'] = $dget['save_as_name']; + unset($dget); + } + return $retarr; + } + + function epm_advanced_poce_delete_config_custom() + { + if (! isset($_REQUEST['product_select'])) { + $retarr = array("status" => false, "message" => _("No send Product Select!")); + } + elseif (! isset($_REQUEST['type_file'])) { + $retarr = array("status" => false, "message" => _("No send Type File!")); + } + elseif (! isset($_REQUEST['sql_select'])) { + $retarr = array("status" => false, "message" => _("No send SQL Select!")); + } + else { + $dget['type_file'] = $_REQUEST['type_file']; + $dget['product_select'] = $_REQUEST['product_select']; + $dget['sql_select'] = $_REQUEST['sql_select']; + + if ($dget['type_file'] == "sql") { + $sql = "DELETE FROM endpointman_custom_configs WHERE id =" . $dget['sql_select']; + sql($sql); + unset ($sql); + $retarr = array("status" => true, "message" => "File delete ok!"); + } + else { $retarr = array("status" => false, "message" => _("Type File not valid!")); } + + unset($dget); + } + return $retarr; + } + /******************** + * END SEC FUNCTIONS * + ********************/ + + + + + + + + + /************************************************************ + **** FUNCIONES SEC MODULO "epm_advanced\manual_upload". **** + ***********************************************************/ + + public function epm_advanced_manual_upload_list_files_brans_export() + { + $path_tmp_dir = $this->PHONE_MODULES_PATH."temp/export/"; + $array_list_files = array(); + $array_count_brand = array(); + + + $array_list_exception= array(".", "..", ".htaccess"); + if(file_exists($path_tmp_dir)) + { + if(is_dir($path_tmp_dir)) + { + $l_files = scandir($path_tmp_dir, 1); + $i = 0; + foreach ($l_files as $archivo) { + if (in_array($archivo, $array_list_exception)) { continue; } + + $pathandfile = $path_tmp_dir.$archivo; + $brand = substr(pathinfo($archivo, PATHINFO_FILENAME), 0, -11); + $ftime = substr(pathinfo($archivo, PATHINFO_FILENAME), -10); + + $array_count_brand[] = $brand; + $array_list_files[$i] = array("brand" => $brand, + "pathall" => $pathandfile, + "path" => $path_tmp_dir, + "file" => $archivo, + "filename" => pathinfo($archivo, PATHINFO_FILENAME), + "extension" => pathinfo($archivo, PATHINFO_EXTENSION), + "timer" => $ftime, + "timestamp" => strftime("[%Y-%m-%d %H:%M:%S]", $ftime), + "mime_type" => mime_content_type($pathandfile), + "is_dir" => is_dir($pathandfile), + "is_file" => is_file($pathandfile), + "is_link" => is_link($pathandfile), + "readlink" => (is_link($pathandfile) == true ? readlink ($pathandfile) : NULL)); + + $i++; + } + unset ($l_files); + + $array_count_brand = array_count_values($array_count_brand); + ksort ($array_count_brand); + $array_count_brand_end = array(); + + foreach($array_count_brand as $key => $value) { + $array_count_brand_end[] = array('name' => $key , 'num' => $value); + } + + $retarr = array("status" => true, "message" => _("List Done!"), "countlist" => count($array_list_files), "list_files" => $array_list_files, "list_brands" => $array_count_brand_end ); + unset ($array_count_brand_end); + unset ($array_count_brand); + unset ($array_list_files); + } + else { + $retarr = array("status" => false, "message" => _("Not is directory: ") . $path_tmp_dir); + } + } else { + $retarr = array("status" => false, "message" => _("Directory no exists: ") . $path_tmp_dir); + } + return $retarr; + } + + public function epm_advanced_manual_upload_brand() + { + if (count($_FILES["files"]["error"]) == 0) { + echo format_txt(_("Can Not Find Uploaded Files!"), "error"); + } + else + { + foreach ($_FILES["files"]["error"] as $key => $error) { + echo format_txt(_("Importing brand file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); + + if ($error != UPLOAD_ERR_OK) { + echo format_txt($this->file_upload_error_message($error), "error"); + } + else + { + + $uploads_dir = $this->PHONE_MODULES_PATH . "temp"; + $name = $_FILES["files"]["name"][$key]; + $extension = pathinfo($name, PATHINFO_EXTENSION); + if ($extension == "tgz") { + + $tmp_name = $_FILES["files"]["tmp_name"][$key]; + $uploads_dir_file = $uploads_dir."/".$name; + move_uploaded_file($tmp_name, $uploads_dir_file); + + if (file_exists($uploads_dir_file)) + { + $temp_directory = sys_get_temp_dir() . "/epm_temp/"; + if (!file_exists($temp_directory)) { + echo format_txt(_("Creating EPM temp directory...")); + if (mkdir($temp_directory) == true) { + echo format_txt(_("Done!"), "done"); + } + else { + echo format_txt(_("Error!"), "error"); + } + } + if (file_exists($temp_directory)) + { + if ($this->configmod->get('debug')) { + echo format_txt(_("Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........"),"",array("%_FILEPACKAGE_%" => $uploads_dir_file, "%_TEMPDIR_%" => $temp_directory)); + } else { + echo format_txt(_("Extracting Tarball........ ")); + } + exec("tar -xvf ".$uploads_dir_file." -C ".$temp_directory); + echo format_txt(_("Done!"), "done"); + + $package = basename($name, ".tgz"); + $package = explode("-",$package); + + if ($this->configmod->get('debug')) { + echo format_txt(_("Looking for file %_FILEPACKAGE_% to pass on to update_brand()..."),"",array("%_FILEPACKAGE_%" => $temp_directory.$package[0])); + } else { + echo format_txt(_("Looking file and update brand's....")); + } + + if(file_exists($temp_directory.$package[0])) { + $this->update_brand($package[0],FALSE); + // Note: no need to delete/unlink/rmdir as this is handled in update_brand() + } else { + echo format_txt(_("Please name the Package the same name as your brand!")); + } + } + } + else { + echo format_txt(_("No File Provided!"), "error"); + //echo "File ".$this->PHONE_MODULES_PATH."temp/".$_REQUEST['package']." not found.
      "; + } + } + else { + echo format_txt(_("Invalid File Extension!"), "error"); + } + } + } + } + } + + public function epm_advanced_manual_upload_provisioner () + { + if (count($_FILES["files"]["error"]) == 0) { + echo format_txt(_("Can Not Find Uploaded Files!"), "error"); + } + else + { + foreach ($_FILES["files"]["error"] as $key => $error) { + echo format_txt(_("Importing Provisioner file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); + + if ($error != UPLOAD_ERR_OK) { + echo format_txt($this->file_upload_error_message($error), "error"); + } + else + { + $uploads_dir = $this->PHONE_MODULES_PATH . "temp"; + $name = $_FILES["files"]["name"][$key]; + $extension = pathinfo($name, PATHINFO_EXTENSION); + if ($extension == "tgz") + { + $tmp_name = $_FILES["files"]["tmp_name"][$key]; + $uploads_dir_file = $uploads_dir."/".$name; + move_uploaded_file($tmp_name, $uploads_dir_file); + + if (file_exists($uploads_dir_file)) { + echo format_txt(_("Extracting Provisioner Package...")); + exec("tar -xvf ".$uploads_dir_file." -C ".$uploads_dir."/"); + echo format_txt(_("Done!"), "done"); + + if(!file_exists($this->PHONE_MODULES_PATH."endpoint")) { + echo format_txt(_("Creating Provisioner Directory...")); + if (mkdir($this->PHONE_MODULES_PATH."endpoint") == true) { + echo format_txt(_("Done!"), "done"); + } + else { + echo format_txt(_("Error!"), "error"); + } + } + + if(file_exists($this->PHONE_MODULES_PATH."endpoint")) + { + $endpoint_last_mod = filemtime($this->PHONE_MODULES_PATH."temp/endpoint/base.php"); + rename($this->PHONE_MODULES_PATH."temp/endpoint/base.php", $this->PHONE_MODULES_PATH."endpoint/base.php"); + + echo format_txt(_("Updating Last Modified...")); + $sql = "UPDATE endpointman_global_vars SET value = '".$endpoint_last_mod."' WHERE var_name = 'endpoint_vers'"; + sql($sql); + echo format_txt(_("Done!"),"done"); + } + + } else { + echo format_txt(_("File Temp no Exists!"), "error"); + } + } else { + echo format_txt(_("Invalid File Extension!"), "error"); + } + } + } + } + } + + public function epm_advanced_manual_upload_export_brans_available_file() + { + if ((! isset($_REQUEST['file_package'])) OR ($_REQUEST['file_package'] == "")) { + header('HTTP/1.0 404 Not Found', true, 404); + echo "

      Error 404 Not Found

      "; + echo "No send name file!"; + die(); + } + else { + $dget['file_package'] = $_REQUEST['file_package']; + $path_tmp_file = $this->PHONE_MODULES_PATH."/temp/export/".$_REQUEST['file_package']; + + if (! file_exists($path_tmp_file)) { + header('HTTP/1.0 404 Not Found', true, 404); + echo "

      Error 404 Not Found

      "; + echo "File no exist!"; + die(); + } + else { + header('Content-Description: File Transfer'); + header('Content-Type: application/octet-stream'); + header('Content-Disposition: attachment; filename="'.basename($dget['file_package']).'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length: ' . filesize($path_tmp_file)); + readfile($path_tmp_file); + exit; + } + unset ($path_tmp_file); + unset ($dget); + } + exit; + } + + public function epm_advanced_manual_upload_export_brans_available() + { + if ((! isset($_REQUEST['package'])) OR ($_REQUEST['package'] == "")) { + echo format_txt(_("No package set!"), "error"); + } + elseif ((! is_numeric($_REQUEST['package'])) OR ($_REQUEST['package'] < 0)) { + echo format_txt(_("Package not valid!"), "error"); + } + else { + $dget['package'] = $_REQUEST['package']; + + $sql = 'SELECT `name`, `directory` FROM `endpointman_brand_list` WHERE `id` = '.$dget['package'].''; + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + if ($row == "") { + echo format_txt(_("ID Package send not valid, brand not exist!"), "error"); + } + else { + echo format_txt(_("Exporting %_NAME_%"), "", array("%_NAME_%" => $row['name'])); + + if(!file_exists($this->PHONE_MODULES_PATH."/temp/export/")) { + mkdir($this->PHONE_MODULES_PATH."/temp/export/"); + } + $time = time(); + exec("tar zcf ".$this->PHONE_MODULES_PATH."temp/export/".$row['directory']."-".$time.".tgz --exclude .svn --exclude firmware -C ".$this->PHONE_MODULES_PATH."/endpoint ".$row['directory']); + + + echo format_txt(_("Done!"), "done"); + echo format_txt(_("Click this link to download:")); + echo ""; + echo format_txt(_("Here")); + echo ""; + //echo "Done! Click this link to download:Here"; + } + unset ($dget); + } + } + + /******************** + * END SEC FUNCTIONS * + ********************/ + + + + /*************************************************** + **** FUNCIONES SEC MODULO "epm_advanced\iedl". **** + **************************************************/ + + public function epm_advanced_iedl_export($sFileName = "devices_list.csv") + { + header("Content-type: text/csv"); + header('Content-Disposition: attachment; filename="'.$sFileName.'"'); + $outstream = fopen("php://output",'w'); + $sql = 'SELECT endpointman_mac_list.mac, endpointman_brand_list.name, endpointman_model_list.model, endpointman_line_list.ext,endpointman_line_list.line FROM endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_line_list WHERE endpointman_line_list.mac_id = endpointman_mac_list.id AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_model_list.brand = endpointman_brand_list.id'; + $result = sql($sql,'getAll',DB_FETCHMODE_ASSOC); + foreach($result as $row) { + fputcsv($outstream, $row); + } + fclose($outstream); + exit; + } + + //Dave B's Q&D file upload security code (http://us2.php.net/manual/en/features.file-upload.php) + public function epm_advanced_iedl_import() + { + if (count($_FILES["files"]["error"]) == 0) { + echo format_txt(_("Can Not Find Uploaded Files!"), "error"); + } + else + { + $allowedExtensions = array("application/csv", "text/plain"); + + foreach ($_FILES["files"]["error"] as $key => $error) { + echo format_txt(_("Importing CVS file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); + + if ($error != UPLOAD_ERR_OK) { + echo format_txt($this->file_upload_error_message($error), "error"); + } + else + { + if (!in_array($_FILES["files"]["type"][$key], $allowedExtensions)) { + echo format_txt(_("We support only CVS and TXT files, type file %_FILE_% no support!"), "error", array("%_FILE_%" => $_FILES["files"]["name"][$key])); + } + elseif ($_FILES["files"]["size"][$key] == 0) { + echo format_txt(_("File %_FILE_% size is 0!"), "error", array("%_FILE_%" => $_FILES["files"]["name"][$key])); + } + else { + $uploadfile = $this->LOCAL_PATH . basename($_FILES["files"]["name"][$key]); + $uploadtemp = $_FILES["files"]["tmp_name"][$key]; + + if (move_uploaded_file($uploadtemp, $uploadfile)) { + //Parse the uploaded file + $handle = fopen($uploadfile, "r"); + $i = 1; + while (($device = fgetcsv($handle, filesize($uploadfile))) !== FALSE) { + if ($device[0] != "") { + if ($mac = $this->mac_check_clean($device[0])) { + $sql = "SELECT id FROM endpointman_brand_list WHERE name LIKE '%" . $device[1] . "%' LIMIT 1"; + $res = sql($sql); + + if ($res->numRows() > 0) { + $brand_id = sql($sql, 'getOne'); + $brand_id = $brand_id[0]; + + $sql_model = "SELECT id FROM endpointman_model_list WHERE brand = " . $brand_id . " AND model LIKE '%" . $device[2] . "%' LIMIT 1"; + $sql_ext = "SELECT extension, name FROM users WHERE extension LIKE '%" . $device[3] . "%' LIMIT 1"; + + $line_id = isset($device[4]) ? $device[4] : 1; + + $res_model = sql($sql_model); + if ($res_model->numRows()) { + $model_id = sql($sql_model, 'getRow', DB_FETCHMODE_ASSOC); + $model_id = $model_id['id']; + + $res_ext = sql($sql_ext); + if ($res_ext->numRows()) { + $ext = sql($sql_ext, 'getRow', DB_FETCHMODE_ASSOC); + $description = $ext['name']; + $ext = $ext['extension']; + + $this->add_device($mac, $model_id, $ext, 0, $line_id, $description); + + echo format_txt(_("Done!"), "done"); + } else { + echo format_txt(_("Invalid Extension Specified on line %_LINE_%!"), "error", array("%_LINE_%" => $i)); + } + } else { + echo format_txt(_("Invalid Model Specified on line %_LINE_%!"), "error", array("%_LINE_%" => $i)); + } + } else { + echo format_txt(_("Invalid Brand Specified on line %_LINE_%!"), "error", array("%_LINE_%" => $i)); + } + } else { + echo format_txt(_("Invalid Mac on line %_LINE_%!"), "error", array("%_LINE_%" => $i)); + } + } + $i++; + } + fclose($handle); + unlink($uploadfile); + echo format_txt(_("Please reboot & rebuild all imported phones"), "done"); + } else { + echo format_txt(_("Possible file upload attack!"), "error"); + } + } + } + } + } + } + + /******************** + * END SEC FUNCTIONS * + ********************/ + + + + /********************************************************** + **** FUNCIONES SEC MODULO "epm_advanced\oui_manager". **** + *********************************************************/ + + private function epm_advanced_oui_remove() + { + //TODO: A�adir validacion de si es custom o no + if ((! isset($_REQUEST['id_del'])) OR ($_REQUEST['id_del'] == "")) { + $retarr = array("status" => false, "message" => _("No ID set!")); + } + elseif ((! is_numeric($_REQUEST['id_del'])) OR ($_REQUEST['id_del'] < 0)) { + $retarr = array("status" => false, "message" => _("ID not valid!"), "id" => $_REQUEST['id']); + } + else + { + $dget['id'] = $_REQUEST['id_del']; + + $sql = "DELETE FROM endpointman_oui_list WHERE id = " . $dget['id']; + sql($sql); + + $retarr = array("status" => true, "message" => "OK", "id" => $dget['id']); + unset($dget); + } + return $retarr; + } + + private function epm_advanced_oui_add() + { + //TODO: Pendiente a�adir isExiste datos. + if ((! isset($_REQUEST['number_new_oui'])) OR ($_REQUEST['number_new_oui'] == "")) { + $retarr = array("status" => false, "message" => _("No OUI set!")); + } + elseif ((! isset($_REQUEST['brand_new_oui'])) OR ($_REQUEST['brand_new_oui'] == "")) { + $retarr = array("status" => false, "message" => _("No Brand set!")); + } + else { + $dget['oui'] = $_REQUEST['number_new_oui']; + $dget['brand'] = $_REQUEST['brand_new_oui']; + + $sql = "INSERT INTO endpointman_oui_list (oui, brand, custom) VALUES ('" . $dget['oui'] . "', '" . $dget['brand'] . "', '1')"; + sql($sql); + + $retarr = array("status" => true, "message" => "OK", "oui" => $dget['oui'], "brand" => $dget['brand']); + unset($dget); + } + return $retarr; + } + + /******************** + * END SEC FUNCTIONS * + ********************/ + + + + /****************************************************** + **** FUNCIONES SEC MODULO "epm_advanced\settings". **** + ******************************************************/ + + public function epm_advanced_config_loc_is_writable() + { + $config_loc = $this->configmod->get("config_loc"); + $tftp_writable = FALSE; + if ((isset($config_loc)) AND ($config_loc != "")) { + if ((file_exists($config_loc)) AND (is_dir($config_loc))) { + if (is_writable($config_loc)) { + $tftp_writable = TRUE; + } + } + } + return $tftp_writable; + } + + private function epm_advanced_settings_saveconfig () + { + if (! isset($_REQUEST['name'])) { + $retarr = array("status" => false, "message" => _("No send name!")); + } + elseif (! isset($_REQUEST['value'])) { + $retarr = array("status" => false, "message" => _("No send value!")); + } + else + { + $dget['name'] = strtolower($_REQUEST['name']); + $dget['value'] = $_REQUEST['value']; + switch($dget['name']) { + case "enable_ari": + $dget['value'] = strtolower($dget['value']); + $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='enable_ari'"; + break; + + case "enable_debug": + $dget['value'] = strtolower($dget['value']); + $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='debug'"; + break; + + case "disable_help": + $dget['value'] = strtolower($dget['value']); + $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='disable_help'"; + break; + + case "allow_dupext": + $dget['value'] = strtolower($dget['value']); + $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='show_all_registrations'"; + break; + + case "allow_hdfiles": + $dget['value'] = strtolower($dget['value']); + $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='allow_hdfiles'"; + break; + + case "tftp_check": + $dget['value'] = strtolower($dget['value']); + $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='tftp_check'"; + break; + + case "backup_check": + $dget['value'] = strtolower($dget['value']); + $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='backup_check'"; + break; + + case "use_repo": + $dget['value'] = strtolower($dget['value']); + if (($dget['value'] == "yes") and (! $this->has_git())) { + $retarr = array("status" => false, "message" => _("Git not installed!")); + } + else { + $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='use_repo'"; + } + break; + + case "config_loc": + $dget['value'] = trim($dget['value']); + //No trailing slash. Help the user out and add one :-) + if ($dget['value'][strlen($dget['value']) - 1] != "/") { + $dget['value'] = $dget['value'] . "/"; + } + if ($dget['value'] != "") { + if ((file_exists($dget['value'] = $dget['value'])) AND (is_dir($dget['value'] = $dget['value']))) { + if (is_writable($dget['value'] = $dget['value'])) { + $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='config_location'"; + } else { + $retarr = array("status" => false, "message" => _("Directory Not Writable!")); + } + } else { + $retarr = array("status" => false, "message" => _("Not a Vaild Directory.
      Try to run 'mkdir " . $_POST['config_loc'] . "' as root.")); + } + } else { + $retarr = array("status" => false, "message" => _("No Configuration Location Defined!")); + } + break; + + case "srvip": + $dget['value'] = trim($dget['value']); + $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='srvip'"; + break; + + case "tz": + $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='tz'"; + break; + + case "ntp_server": + $dget['value'] = trim($dget['value']); + $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='ntp'"; + break; + + case "nmap_loc": + $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='nmap_location'"; + break; + + case "arp_loc": + $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='arp_location'"; + break; + + case "asterisk_loc": + $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='asterisk_location'"; + break; + + case "package_server": + $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='update_server'"; + break; + + case "cfg_type": + if ($dget['value'] == 'http') { + $symlink = $this->config->get('AMPWEBROOT') . "/provisioning"; + $reallink = $this->LOCAL_PATH . "provisioning"; + if ((!is_link($symlink)) OR (!readlink($symlink) == $reallink)) { + if (!symlink($reallink, $symlink)) { + $retarr = array("status" => false, "message" => _("Your permissions are wrong on " . $this->config->get('AMPWEBROOT') . ", web provisioning link not created!")); + //$dget['value'] = 'file'; + break; + } else { + $dget['value'] = 'http'; + } + } else { + $dget['value'] = 'http'; + } + } else { + $dget['value'] = 'file'; + } + $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='server_type'"; + break; + + default: + $retarr = array("status" => false, "message" => _("Name invalid: ") . $dget['name'] ); + } + if (isset($sql)) { + sql($sql); + $retarr = array("status" => true, "message" => "OK", "name" => $dget['name'], "value" => $dget['value']); + unset($sql); + } + unset($dget); + } + return $retarr; + } + + /******************** + * END SEC FUNCTIONS * + ********************/ + + + + /*************************************************** + **** FUNCIONES SEC MODULO "epm_config\manager". **** + ***************************************************/ + + private function epm_config_manager_check_for_updates () + { + $this->update_check(); + $retarr = array("status" => true, "message" => "OK"); + return $retarr; + } + + private function epm_config_manager_brand() + { + if (! isset($_REQUEST['command_sub'])) { + throw new \Exception("Not send command_sub!"); + } + elseif (! isset($_REQUEST['idfw'])) { + throw new \Exception("Not send ID!"); + } + else if (! is_numeric($_REQUEST['idfw'])) { + throw new \Exception("ID not is numbre!"); + } + else + { + $dget['command'] = strtolower($_REQUEST['command_sub']); + $dget['id'] = $_REQUEST['idfw']; + + switch($dget['command']) { + case "brand_install": + $this->download_brand($dget['id']); + break; + + case "brand_update": + $this->download_brand($dget['id']); + break; + + case "brand_uninstall": + $this->remove_brand($dget['id']); + break; + + default: + echo "
      " . _("Error: Command not found!"). " [" . $dget['command'] . "]" . "
      "; + } + $this->update_check(); + unset ($dget); + } + } + + private function epm_config_manager_firmware() + { + if (! isset($_REQUEST['command_sub'])) { + throw new \Exception("Not send command_sub!"); + } + elseif (! isset($_REQUEST['idfw'])) { + throw new \Exception("Not send ID!"); + } + else if (! is_numeric($_REQUEST['idfw'])) { + throw new \Exception("ID not is numbre!"); + } + else + { + $dget['command'] = strtolower($_REQUEST['command_sub']); + $dget['id'] = $_REQUEST['idfw']; + + switch($dget['command']) { + case "fw_install": + $this->install_firmware($dget['id']); + break; + + case "fw_update": + $this->install_firmware($dget['id']); + break; + + case "fw_uninstall": + $this->remove_firmware($dget['id']); + break; + + default: + echo "
      " . _("Error: Command not found!"). " [" . $dget['command'] . "]" . "
      "; + } + unset ($dget); + } + } + + private function epm_config_manager_saveconfig() + { + if (! isset($_REQUEST['name'])) { + $retarr = array("status" => false, "message" => _("No send name!")); + } + elseif (! isset($_REQUEST['value'])) { + $retarr = array("status" => false, "message" => _("No send value!")); + } + elseif (! isset($_REQUEST['idbt'])) { + $retarr = array("status" => false, "message" => _("No send id!")); + } + elseif (! isset($_REQUEST['idtype'])) { + $retarr = array("status" => false, "message" => _("No send idtype!")); + } + elseif (! is_numeric($_REQUEST['idbt'])) { + $retarr = array("status" => false, "message" => _("ID send is not number!")); + } + else + { + $dget['name'] = strtolower($_REQUEST['name']); + $dget['value'] = strtolower($_REQUEST['value']); + $dget['idtype'] = strtolower($_REQUEST['idtype']); + $dget['id'] = $_REQUEST['idbt']; + + switch($dget['idtype']) { + case "marca": + $sql = "UPDATE endpointman_brand_list SET enabled = '" .$dget['value']. "' WHERE id = '".$dget['id']."'"; + break; + + case "modelo": + $sql = "UPDATE endpointman_model_list SET enabled = " .$dget['value']. " WHERE id = '".$dget['id']."'"; + break; + + default: + $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); + } + if (isset($sql)) { + sql($sql); + $retarr = array("status" => true, "message" => "OK", "name" => $dget['name'], "value" => $dget['value'], "idtype" => $dget['idtype'], "id" => $dget['id']); + unset($sql); + } + unset($dget); + } + return $retarr; + } + + public function epm_config_manager_hardware_get_list_all($check_for_updates = true) + { + $row_out = array(); + $i = 0; + $brand_list = $this->epm_config_hardware_get_list_brand(true); + //FIX: https://github.com/FreePBX-ContributedModules/endpointman/commit/2ad929d0b38f05c9da1b847426a4094c3314be3b + if($check_for_updates) $brand_up = $this->update_check(); + foreach ($brand_list as $row) + { + $row_out[$i] = $row; + $row_out[$i]['count'] = $i; + $row_out[$i]['cfg_ver_datetime'] = date("c",$row['cfg_ver']); + + if($check_for_updates) + { + $id = $this->system->arraysearchrecursive($row['name'], $brand_up,'name'); + $id = $id[0]; + if((isset($brand_up[$id]['update'])) AND ($row['installed'] == 1)) { + $row_out[$i]['update'] = $brand_up[$id]['update']; + } else { + $row_out[$i]['update'] = ""; + } + if(isset($brand_up[$id]['update_vers'])) { + //$row_out[$i]['update_vers'] = date("n-j-y",$brand_up[$id]['update_vers']) . " at " . date("g:ia",$brand_up[$id]['update_vers']); + $row_out[$i]['update_vers'] = date("c",$brand_up[$id]['update_vers']); + } else { + $row_out[$i]['update_vers'] = ""; + } + } + else + { + if (! isset($row_out[$i]['update'])) { $row_out[$i]['update'] = ""; } + if (! isset($row_out[$i]['update_vers'])) { $row_out[$i]['update_vers'] = ""; } + } + if ($row['hidden'] == 1) { continue; } + + + $j = 0; + $product_list = $this->epm_config_hardware_get_list_product($row['id'], true); + foreach($product_list as $row2) { + $row_out[$i]['products'][$j] = $row2; + + if($check_for_updates) { + if((array_key_exists('firmware_vers', $row2)) AND ($row2['firmware_vers'] > 0)) { + $temp = $this->firmware_update_check($row2['id']); + $row_out[$i]['products'][$j]['update_fw'] = 1; + $row_out[$i]['products'][$j]['update_vers_fw'] = $temp['data']['version']; + } else { + $row_out[$i]['products'][$j]['update_fw'] = 0; + $row_out[$i]['products'][$j]['update_vers_fw'] = ""; + } + } + else + { + if (! isset($row_out[$i]['products'][$j]['update_fw'])) { $row_out[$i]['products'][$j]['update_fw'] = 0; } + if (! isset($row_out[$i]['products'][$j]['update_vers_fw'])) { $row_out[$i]['products'][$j]['update_vers_fw'] = ""; } + } + $row_out[$i]['products'][$j]['fw_type'] = $this->firmware_local_check($row2['id']); + if ($row2['hidden'] == 1) { continue; } + + $k = 0; + $model_list = $this->epm_config_hardware_get_list_models($row2['id'], true); + foreach($model_list as $row3) + { + $row_out[$i]['products'][$j]['models'][$k] = $row3; + if($row_out[$i]['products'][$j]['models'][$k]['enabled']){ + $row_out[$i]['products'][$j]['models'][$k]['enabled_checked'] = 'checked'; + } + $k++; + } + $j++; + } + $i++; + } + return $row_out; + } + /******************** + * END SEC FUNCTIONS * + ********************/ + + + + /************************************************** + **** FUNCIONES SEC MODULO "epm_config\editor". **** + **************************************************/ + private function epm_config_editor_saveconfig() + { + if (! isset($_REQUEST['name'])) { + $retarr = array("status" => false, "message" => _("No send name!")); + } + elseif (! isset($_REQUEST['value'])) { + $retarr = array("status" => false, "message" => _("No send value!")); + } + elseif (($_REQUEST['value'] > 1 ) and ($_REQUEST['value'] < 0)) + { + $retarr = array("status" => false, "message" => _("Invalid Value!")); + } + elseif (! isset($_REQUEST['idbt'])) { + $retarr = array("status" => false, "message" => _("No send id!")); + } + elseif (! isset($_REQUEST['idtype'])) { + $retarr = array("status" => false, "message" => _("No send idtype!")); + } + elseif (! is_numeric($_REQUEST['idbt'])) { + $retarr = array("status" => false, "message" => _("ID send is not number!")); + } + else + { + $dget['name'] = strtolower($_REQUEST['name']); + $dget['value'] = strtolower($_REQUEST['value']); + $dget['idtype'] = strtolower($_REQUEST['idtype']); + $dget['id'] = $_REQUEST['idbt']; + + switch($dget['idtype']) { + case "marca": + $sql = "UPDATE endpointman_brand_list SET hidden = '".$dget['value'] ."' WHERE id = '".$dget['id']."'"; + break; + + case "producto": + $sql = "UPDATE endpointman_product_list SET hidden = '". $dget['value'] ."' WHERE id = '".$dget['id']."'"; + break; + + case "modelo": + $sql = "UPDATE endpointman_model_list SET hidden = '". $dget['value'] ."' WHERE id = '".$dget['id']."'"; + break; + + default: + $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); + } + if (isset($sql)) { + sql($sql); + $retarr = array("status" => true, "message" => "OK", "name" => $dget['name'], "value" => $dget['value'], "idtype" => $dget['idtype'], "id" => $dget['id']); + unset($sql); + } + unset($dget); + } + return $retarr; + } + + /** + * Get info all brdans, prodics, models. + * @return array + */ + public function epm_config_editor_hardware_get_list_all () + { + $row_out = array(); + $i = 0; + foreach ($this->epm_config_hardware_get_list_brand(true) as $row) + { + $row_out[$i] = $row; + $row_out[$i]['count'] = $i; + if ($row['installed']) + { + $j = 0; + foreach ($this->epm_config_hardware_get_list_product($row['id'], true) as $row2) + { + $row_out[$i]['products'][$j] = $row2; + $k = 0; + foreach ($this->epm_config_hardware_get_list_models($row2['id'], true) as $row3) { + $row_out[$i]['products'][$j]['models'][$k] = $row3; + $k++; + } + $j++; + } + } + $i++; + } + return $row_out; + } + /******************** + * END SEC FUNCTIONS * + ********************/ + + + + + + + + + + + + + + + + + + + + + + + /***************************************** + ****** CODIGO ANTIGUO -- REVISADO ******** + *****************************************/ + + + /** + * Check for new firmware on the servers + * @param int $id Product ID + * @return bool True on yes False on no + */ + function firmware_update_check($id=NULL) { + $sql = "SELECT * FROM endpointman_product_list WHERE id ='" . $id . "'"; + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $sql = "SELECT directory FROM endpointman_brand_list WHERE id ='" . $row['brand'] . "'"; + $brand_directory = sql($sql, 'getOne'); + + //config drive unknown! + if ($row['cfg_dir'] == "") { + return FALSE; + } else { + $temp = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $brand_directory . "/" . $row['cfg_dir'] . "/family_data.json"); + if ((array_key_exists('data', $temp)) AND (!is_array($temp['data']['firmware_ver']))) { + if ($row['firmware_vers'] < $temp['data']['firmware_ver']) { + return $temp; + } else { + return FALSE; + } + } else { + return FALSE; + } + } + } + + /** + * Check to see the status of the firmware locally (installed or not) + * @param int $id + * @return string + */ + function firmware_local_check($id=NULL) { + $sql = "SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id ='" . $id . "'"; + $res = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + + if (count($res) > 0) { + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $sql = "SELECT directory FROM endpointman_brand_list WHERE hidden = 0 AND id ='" . $row['brand'] . "'"; + $brand_directory = sql($sql, 'getOne'); + + //config drive unknown! + if ($row['cfg_dir'] == "") { + return("nothing"); + } else { + $temp = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $brand_directory . "/" . $row['cfg_dir'] . "/family_data.json"); + if (isset($temp['data']['firmware_ver'])) { + if ($row['firmware_vers'] == "") { + return("install"); + } else { + return("remove"); + } + } else { + return("nothing"); + } + } + } else { + return("nothing"); + } + } + + /** + * Reads a file. Json decodes it and will report any errors back + * @param string $file location of file + * @return mixed false on error, array on success + * @version 2.11 + */ + function file2json($file) { + if (file_exists($file)) { + $json = file_get_contents($file); + $data = json_decode($json, TRUE); + if(function_exists('json_last_error')) { + switch (json_last_error()) { + case JSON_ERROR_NONE: + return($data); + break; + case JSON_ERROR_DEPTH: + $this->error['file2json'] = _('Maximum stack depth exceeded'); + break; + case JSON_ERROR_STATE_MISMATCH: + $this->error['file2json'] = _('Underflow or the modes mismatch'); + break; + case JSON_ERROR_CTRL_CHAR: + $this->error['file2json'] = _('Unexpected control character found'); + break; + case JSON_ERROR_SYNTAX: + $this->error['file2json'] = _('Syntax error, malformed JSON'); + break; + case JSON_ERROR_UTF8: + $this->error['file2json'] = _('Malformed UTF-8 characters, possibly incorrectly encoded'); + break; + default: + $this->error['file2json'] = _('Unknown error'); + break; + } + return(false); + } else { + //Probably an older version of PHP. That's ok though + return($data); + } + } else { + $this->error['file2json'] = _('Cant find file:').' '.$file ; + return(false); + } + } + + /** + * Check for new packges for brands. These packages will include phone models and such which the user can remove if they want + * This function will alos auto-update the provisioner.net library incase anything has changed + * @return array An array of all the brands/products/models and information about what's enabled, installed or otherwise + */ + function update_check($echotxt = false) { + $temp_location = $this->sys_get_temp_dir() . "/epm_temp/"; + if (!$this->configmod->get('use_repo')) { + $master_result = $this->system->download_file($this->UPDATE_PATH . "master.json", $this->PHONE_MODULES_PATH . "endpoint/master.json"); + + if (!$master_result) { + $this->error['brand_update_check_master'] = "Not able to connect to repository. Using local master file instead."; +if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local master file instead."), "error"); } + } + + $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/master.json'); + $endpoint_package = $temp['data']['package']; + $endpoint_last_mod = $temp['data']['last_modified']; + + $sql = "SELECT value FROM endpointman_global_vars WHERE var_name LIKE 'endpoint_vers'"; + $data = sql($sql, 'getOne'); + + $contents = file_get_contents($this->UPDATE_PATH . "/update_status"); + if ($contents != '1') { + if (($data == "") OR ($data <= $endpoint_last_mod)) { + if ((!$master_result) OR (!$this->system->download_file($this->UPDATE_PATH . '/' . $endpoint_package, $temp_location . $endpoint_package))) { + $this->error['brand_update_check_json'] = "
      Not able to connect to repository. Using local Provisioner.net Package"; +if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local Provisioner.net Package."), "error"); } + } else { + exec("tar -xvf " . $temp_location . $endpoint_package . " -C " . $temp_location); + + if (!file_exists($this->PHONE_MODULES_PATH . "endpoint")) { + mkdir($this->PHONE_MODULES_PATH . "endpoint"); + } + + //TODO: Automate this somehow... + rename($temp_location . "setup.php", $this->PHONE_MODULES_PATH . "autoload.php"); + rename($temp_location . "endpoint/base.php", $this->PHONE_MODULES_PATH . "endpoint/base.php"); + rename($temp_location . "endpoint/global_template_data.json", $this->PHONE_MODULES_PATH . "endpoint/global_template_data.json"); + + $sql = "UPDATE endpointman_global_vars SET value = '" . $endpoint_last_mod . "' WHERE var_name = 'endpoint_vers'"; + sql($sql); + } + } + + $out = $temp['data']['brands']; + //Assume that if we can't connect and find the master.xml file then why should we try to find every other file. + if ($master_result) { + $row = sql('SELECT * FROM endpointman_brand_list WHERE id > 0', 'getAll', DB_FETCHMODE_ASSOC); + foreach ($out as $data) { + + $local = sql("SELECT local FROM endpointman_brand_list WHERE directory = '" . $data['directory'] . "'", 'getOne'); + + if (!$local) { + $result = $this->system->download_file($this->UPDATE_PATH . $data['directory'] . "/" . $data['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json"); + if (!$result) { + $this->error['brand_update_check'] = "
      Not able to connect to repository. Using local brand [" . $data['name'] . "] file instead."; +if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local brand [%_brandname_%] file instead."), "error", array("%_brandname_%" => $data['name'])); } + } + } + + if (file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json")) { + $temp = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json"); + $temp = $temp['data']['brands']; + if (array_key_exists('oui_list', $temp)) { + foreach ($temp['oui_list'] as $oui) { + $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('" . $oui . "', '" . $temp['brand_id'] . "', '0')"; + sql($sql); + } + } + $brand_name = $temp['directory']; + $version[$brand_name] = $temp['last_modified']; + $last_mod = ""; + foreach ($temp['family_list'] as $list) { + $last_mod = max($last_mod, $list['last_modified']); + } + $last_mod = max($last_mod, $version[$brand_name]); + $version[$brand_name] = $last_mod; + if (!($this->system->arraysearchrecursive($brand_name, $row, 'directory'))) { + //insert row + $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('" . $temp['brand_id'] . "', '" . $temp['name'] . "', '" . $temp['directory'] . "', '" . $version[$brand_name] . "')"; + $_SESSION["sqlerr"] = $sql; + sql($sql); + } else { + //in database already! + } + } else { + $this->error['brand_update_check_local_file'] = "
      Error: No Local File for " . $data['name'] . "!

      Learn how to manually upload packages here (it's easy!): Click Here!"; +if ($echotxt) { + echo format_txt(_("Error: No Local File for %_name_% !"), "error", array("%_name_%" => $data['name'])); + echo format_txt(_("Learn how to manually upload packages here (it's easy!):"), "error"); + echo format_txt(_("Click Here!"), "error"); +} + } + } + + foreach ($row as $ava_brands) { + $key = $this->system->arraysearchrecursive($ava_brands['directory'], $out, 'directory'); + if ($key === FALSE) { + $this->remove_brand($ava_brands['id']); + } else { + $key = $key[0]; + $brand_name = $ava_brands['directory']; + //TODO: This seems old + if ($ava_brands['cfg_ver'] < $version[$brand_name]) { + $out[$key]['update'] = 1; + $out[$key]['update_vers'] = $version[$brand_name]; + } else { + $out[$key]['update'] = NULL; + } + } + } + } else { + $this->error['brand_update_check_master_file'] = "
      Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!

      Learn how to manually upload packages here (it's easy!): Click Here!"; +if ($echotxt) { + echo format_txt(_("Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"), "error"); + echo format_txt(_("Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"), "error"); + echo format_txt(_("Click Here!"), "error"); +} + } + + return $out; + } else { + $this->error['remote_server'] = "The Remote Server Is Currently Syncing With the Master Server, Please try again later"; +if ($echotxt) { echo format_txt(_("The Remote Server Is Currently Syncing With the Master Server, Please try again later"), "error"); } + } + } else { + $o = getcwd(); + chdir(dirname($this->PHONE_MODULES_PATH)); + $path = $this->has_git(); + exec($path . ' git pull', $output); + //exec($path . ' git checkout master', $output); //Why am I doing this? + chdir($o); + $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/master.json'); + $endpoint_package = $temp['data']['package']; + $endpoint_last_mod = $temp['data']['last_modified']; + + $sql = "UPDATE endpointman_global_vars SET value = '" . $endpoint_last_mod . "' WHERE var_name = 'endpoint_vers'"; + sql($sql); + + $out = $temp['data']['brands']; + $row = sql('SELECT * FROM endpointman_brand_list WHERE id > 0', 'getAll', DB_FETCHMODE_ASSOC); + + foreach ($out as $data) { + $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/' . $data['directory'] . '/brand_data.json'); + if (key_exists('directory', $temp['data']['brands'])) { + + //Pull in all variables + $directory = $temp['data']['brands']['directory']; + $brand_name = $temp['data']['brands']['name']; + $brand_id = $temp['data']['brands']['brand_id']; + $brand_version = $temp['data']['brands']['last_modified']; + + $b_data = sql("SELECT id FROM endpointman_brand_list WHERE id = '" . $brand_id . "'", 'getOne'); + if ($b_data) { + $sql = "UPDATE endpointman_brand_list SET local = '1', name = '" . $brand_name . "', cfg_ver = '" . $brand_version . "', installed = 1, hidden = 0 WHERE id = " . $brand_id; + sql($sql); + } else { + $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '1', '1')"; + sql($sql); + } + + $last_mod = ""; + foreach ($temp['data']['brands']['family_list'] as $family_list) { + $last_mod = max($last_mod, $family_list['last_modified']); + + $family_line_xml = $this->file2json($this->PHONE_MODULES_PATH . '/endpoint/' . $directory . '/' . $family_list['directory'] . '/family_data.json'); + $family_line_xml['data']['last_modified'] = isset($family_line_xml['data']['last_modified']) ? $family_line_xml['data']['last_modified'] : ''; + + /* DONT DO THIS YET + $require_firmware = NULL; + if ((key_exists('require_firmware', $family_line_xml['data'])) && ($remote) && ($family_line_xml['data']['require_firmware'] == "TRUE")) { + echo "Firmware Requirment Detected!..........
      "; + $this->install_firmware($family_line_xml['data']['id']); + } + * + */ + + $data = sql("SELECT id FROM endpointman_product_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . "'", 'getOne'); + $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); + if ($data) { + $sql = "UPDATE endpointman_product_list SET short_name = '" . $short_name . "', long_name = '" . $family_line_xml['data']['name'] . "', cfg_ver = '" . $family_line_xml['data']['version'] . "', config_files='" . $family_line_xml['data']['configuration_files'] . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . "'"; + } else { + $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . $short_name . "', '" . $family_line_xml['data']['name'] . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['last_modified'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')"; + } + sql($sql); + + foreach ($family_line_xml['data']['model_list'] as $model_list) { + $template_list = implode(",", $model_list['template_data']); + + $m_data = sql("SELECT id FROM endpointman_model_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'", 'getOne'); + if ($m_data) { + $sql = "UPDATE endpointman_model_list SET max_lines = '" . $model_list['lines'] . "', model = '" . $model_list['model'] . "', template_list = '" . $template_list . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'"; + } else { + $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "', '" . $brand_id . "', '" . $model_list['model'] . "', '" . $model_list['lines'] . "', '" . $brand_id . $family_line_xml['data']['id'] . "', '" . $template_list . "', '0', '0')"; + } + sql($sql); + + if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'])) { + echo "System Error in Sync Model Function, Load Failure!" . $model_list['model']; +if ($echotxt) { echo format_txt(_("System Error in Sync Model [%_name_%] Function, Load Failure!"), "error", array("%_name_%" => $model_list['model'])); } + } + } + //Phone Models Move Here + $family_id = $brand_id . $family_line_xml['data']['id']; + $sql = "SELECT * FROM endpointman_model_list WHERE product_id = " . $family_id; + $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); + foreach ($products as $data) { + if (!$this->system->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { + echo "Moving/Removing Model '" . $data['model'] . "' not present in JSON file......
      "; + $model_name = $data['model']; + $sql = 'DELETE FROM endpointman_model_list WHERE id = ' . $data['id']; + sql($sql); + $sql = "SELECT id FROM endpointman_model_list WHERE model LIKE '" . $model_name . "'"; + $new_model_id = sql($sql, 'getOne'); + if ($new_model_id) { + $sql = "UPDATE endpointman_mac_list SET model = '" . $new_model_id . "' WHERE model = '" . $data['id'] . "'"; + } else { + $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '" . $data['id'] . "'"; + } + sql($sql); + } + } + } + foreach ($temp['data']['brands']['oui_list'] as $oui) { + $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('" . $oui . "', '" . $brand_id . "', '0')"; + sql($sql); + } + } + } + } + } + + /** + * Sync the XML files (incuding all template files) from the hard drive with the database + * @param int $model Model ID + * @return boolean True on sync completed. False on sync failed + */ + function sync_model($model, &$error = array()) { + if ((!empty($model)) OR ($model > 0)) { + $sql = "SELECT * FROM endpointman_model_list WHERE id='" . $model . "'"; + $model_row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); + + $sql = "SELECT * FROM endpointman_product_list WHERE id='" . $model_row['product_id'] . "'"; + $product_row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $sql = "SELECT * FROM endpointman_brand_list WHERE id=" . $model_row['brand']; + $brand_row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'])) { + $error['sync_model'] = "Brand Directory '" . $brand_row['directory'] . "' Doesn't Exist! (" . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . ")"; + return(FALSE); + } + + if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'])) { + $error['sync_model'] = "Product Directory '" . $product_row['cfg_dir'] . "' Doesn't Exist! (" . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . ")"; + return(FALSE); + } + + if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/family_data.json')) { + + $error['sync_model'] = "File 'family_data.json Doesn't exist in directory: " . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir']; + return(FALSE); + } + + $family_line_json = $this->file2json($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/family_data.json'); + + + + + //TODO: Add local file checks to avoid slow reloading on PHP < 5.3 + $key = $this->system->arraysearchrecursive($model_row['model'], $family_line_json['data']['model_list'], 'model'); + if ($key === FALSE) { + $error['sync_model'] = "Can't locate model in family JSON file"; + return(FALSE); + } else { + $template_list = implode(",", $family_line_json['data']['model_list'][$key[0]]['template_data']); + $template_list_array = $family_line_json['data']['model_list'][$key[0]]['template_data']; + } + $maxlines = $family_line_json['data']['model_list'][$key[0]]['lines']; + + $sql = "UPDATE endpointman_model_list SET max_lines = '" . $maxlines . "', template_list = '" . $template_list . "' WHERE id = '" . $model . "'"; + sql($sql); + + $version = isset($family_line_json['data']['last_modified']) ? $family_line_json['data']['last_modified'] : ''; + $long_name = $family_line_json['data']['name']; + $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_json['data']['name']); + $configuration_files = $family_line_json['data']['configuration_files']; + + $sql = "UPDATE endpointman_product_list SET long_name = '" . str_replace("'", "''", $long_name) . "', short_name = '" . str_replace("'", "''", $short_name) . "' , cfg_ver = '" . $version . "' WHERE id = '" . $product_row['id'] . "'"; + sql($sql); + + $template_data_array = array(); + $template_data_array = $this->merge_data($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/', $template_list_array); + + $sql = "UPDATE endpointman_model_list SET template_data = '" . serialize($template_data_array) . "' WHERE id = '" . $model . "'"; + sql($sql); + return(TRUE); + } else { + return(FALSE); + } + } + + function sys_get_temp_dir() { + if (!empty($_ENV['TMP'])) { + return realpath($_ENV['TMP']); + } + if (!empty($_ENV['TMPDIR'])) { + return realpath($_ENV['TMPDIR']); + } + if (!empty($_ENV['TEMP'])) { + return realpath($_ENV['TEMP']); + } + $tempfile = tempnam(uniqid(rand(), TRUE), ''); + if (file_exists($tempfile)) { + unlink($tempfile); + return realpath(dirname($tempfile)); + } + } + + /** + * Install Firmware for the specified Product Line + * @param $product_id Product ID + */ + function install_firmware($product_id) { + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + $sql = 'SELECT endpointman_product_list.*, endpointman_brand_list.directory FROM endpointman_product_list, endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = ' . $product_id; + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + $json_data = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/family_data.json"); + + if ($json_data['data']['firmware_ver'] > $row['firmware_vers']) { + if (!file_exists($temp_directory)) { + mkdir($temp_directory); + } + $md5_xml = $json_data['data']['firmware_md5sum']; + $firmware_pkg = $json_data['data']['firmware_pkg']; + + if (file_exists($temp_directory . $firmware_pkg)) { + $md5_pkg = md5_file($temp_directory . $firmware_pkg); + + if ($md5_xml == $md5_pkg) { + echo format_txt(_("Skipping download...")); + } + else + { + echo format_txt(_("Downloading firmware...")); + if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) + { + echo format_txt(_("Error download frimware package!"), "error"); + return false; + } + echo format_txt(_("Done!"), "done"); + $md5_pkg = md5_file($temp_directory . $firmware_pkg); + } + } + else + { + echo format_txt(_("Downloading firmware...")); + if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) + { + echo format_txt(_("Error download frimware package!"), "error"); + return false; + } + echo format_txt(_("Done!"), "done"); + $md5_pkg = md5_file($temp_directory . $firmware_pkg); + } + + echo format_txt(_("Checking MD5sum of Package...")); + if ($md5_xml == $md5_pkg) { + echo format_txt(_("Matches!"), "done"); + + if (file_exists($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware")) { + $this->system->rmrf($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware"); + } + mkdir($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware", 0777, TRUE); + + echo format_txt(_("Installing Firmware...")); + exec("tar -xvf " . $temp_directory . $firmware_pkg . " -C " . $temp_directory . $row['directory'] . "/" . $row['cfg_dir']); + $i = 0; + foreach (glob($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware/*") as $filename) { + $file = basename($filename); + $list[$i] = $file; + if (!@copy($filename, $this->configmod->get('config_location') . $file)) { +echo format_txt(_("- Failed To Copy %_FILE_%!"), "error", array("%_FILE_%" => $file)); + + $copy_error = TRUE; + } elseif ($this->configmod->get('debug')) { +echo format_txt(_("- Copied %_FILE_% to %_FILETO_%."), "txt", array("%_FILE_%" => $file, "%_FILETO_%" => $this->configmod->get('config_location'))); + } + $i++; + } + + $this->system->rmrf($temp_directory . $row['directory']); + $list = implode(",", $list); + $sql = "UPDATE endpointman_product_list SET firmware_vers = '" . $json_data['data']['firmware_ver'] . "', firmware_files = '" . $list . "' WHERE id = " . $row['id']; + sql($sql); + + + if (isset($copy_error)) { + echo format_txt(_("Copy Error Detected! Aborting Install!"), "error"); + $this->remove_firmware($product_id); + echo format_txt(_("Please Check Directory/Permissions!"), "error"); + } + else { + echo format_txt(_("Done!"), "done"); + } + } + else { + echo format_txt(_("Firmware MD5 didn't match!"), "error"); + } + } + else { + echo format_txt(_("Your Firmware is already up to date"), "done"); + } + } + + /** + * Remove firmware from the Hard Drive + * @param int $id Product ID + */ + function remove_firmware($id) { + echo format_txt(_("Uninstalla frimware...")); + $sql = "SELECT firmware_files FROM endpointman_product_list WHERE id ='" . $id . "'"; + $files = sql($sql, 'getOne'); + + $file_list = explode(",", $files); + $i = 0; + foreach ($file_list as $file) { + if (trim($file) == "") { continue; } + if (! file_exists($this->configmod->get('config_location') . $file)) { continue; } + if (! is_file($this->configmod->get('config_location') . $file)) { continue; } + unlink($this->configmod->get('config_location') . $file); + } + $sql = "UPDATE endpointman_product_list SET firmware_files = '', firmware_vers = '' WHERE id = '" . $id . "'"; + sql($sql); + + echo format_txt(_("Done!"), "done"); + } + + /** + * Remove the brand + * @param int $id Brand ID + */ + function remove_brand($id=NULL, $remove_configs=FALSE, $force=FALSE) { + echo format_txt(_("Uninstalla Brand...")); + if (!$this->configmod->get('use_repo')) { + $sql = "SELECT id, firmware_vers FROM endpointman_product_list WHERE brand = '" . $id . "'"; + $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); + + foreach ($products as $data) { + if ($data['firmware_vers'] != "") { + $this->remove_firmware($data['id']); + } + } + + $sql = "SELECT directory FROM endpointman_brand_list WHERE id = '" . $id . "'"; + $brand_dir = sql($sql, 'getOne'); + $this->system->rmrf($this->PHONE_MODULES_PATH . "endpoint/" . $brand_dir); + + $sql = "DELETE FROM endpointman_model_list WHERE brand = '" . $id . "'"; + sql($sql); + + $sql = "DELETE FROM endpointman_product_list WHERE brand = '" . $id . "'"; + sql($sql); + + $sql = "DELETE FROM endpointman_oui_list WHERE brand = '" . $id . "'"; + sql($sql); + + $this->system->rmrf($this->PHONE_MODULES_PATH . $brand_dir); + $sql = "DELETE FROM endpointman_brand_list WHERE id = '" . $id . "'"; + sql($sql); + + echo format_txt(_("All Done!"), "done"); + } + elseif ($force) { + $sql = "SELECT directory FROM endpointman_brand_list WHERE id = '" . $id . "'"; + $brand_dir = sql($sql, 'getOne'); + + $sql = "DELETE FROM endpointman_model_list WHERE brand = '" . $id . "'"; + sql($sql); + + $sql = "DELETE FROM endpointman_product_list WHERE brand = '" . $id . "'"; + sql($sql); + + $sql = "DELETE FROM endpointman_oui_list WHERE brand = '" . $id . "'"; + sql($sql); + + $sql = "DELETE FROM endpointman_brand_list WHERE id = '" . $id . "'"; + sql($sql); + + echo format_txt(_("Done!"), "done"); + } + else { + echo format_txt(_("Not allowed in repo mode!!"), "error"); + } + } + + /** + * This will download the xml & brand package remotely + * @param integer $id Brand ID + */ + function download_brand($id) { + if (!$this->configmod->get('use_repo')) { + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + + if (!file_exists($temp_directory)) { + echo format_txt(_("Creating EPM temp directory")); + if (! mkdir($temp_directory)) { + echo format_txt(_("Error creating directory: %_DIR_%"), "error", array("%_DIR_%" => $temp_directory)); + echo format_txt(_("Please Check Directory/Permissions!"), "error"); + return false; + } + } + + echo format_txt(_("Downloading Brand JSON.....")); + $row = sql('SELECT * FROM endpointman_brand_list WHERE id =' . $id, 'getAll', DB_FETCHMODE_ASSOC); + $result = $this->system->download_file($this->UPDATE_PATH . $row[0]['directory'] . "/" . $row[0]['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $row[0]['directory'] . "/brand_data.json"); + if ($result) { + echo format_txt(_("Done!"), "done"); + + $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/' . $row[0]['directory'] . '/brand_data.json'); + $package = $temp['data']['brands']['package']; + + echo format_txt(_("Downloading Brand Package...")); + if ($this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row[0]['directory'] . '/' . $package, $temp_directory . $package)) { + echo format_txt(_("Done!"), "done"); + if (file_exists($temp_directory . $package)) { + $md5_xml = $temp['data']['brands']['md5sum']; + $md5_pkg = md5_file($temp_directory . $package); + + echo format_txt(_("Checking MD5sum of Package....")); + if ($md5_xml == $md5_pkg) { + echo format_txt(_("Done!"), "done"); + + echo format_txt(_("Extracting Tarball........")); + exec("tar -xvf " . $temp_directory . $package . " -C " . $temp_directory); + echo format_txt(_("Done!"), "done"); + + //Update File in the temp directory + copy($this->PHONE_MODULES_PATH . 'endpoint/' . $row[0]['directory'] . '/brand_data.json', $temp_directory . $row[0]['directory'] . '/brand_data.json'); + $this->update_brand($row[0]['directory'], TRUE); + } else { + echo format_txt(_("MD5 Did not match!"), "error"); + echo format_txt(_("MD5 XML: %_MD5_%"), "error", array("%_MD5_%" => $md5_xml)); + echo format_txt(_("MD5 PKG: %_MD5_%"), "error", array("%_MD5_%" => $md5_pkg)); + } + } else { + echo format_txt(_("Can't Find Downloaded File!"), "error"); + } + } else { + echo format_txt(_("Error download Brand package!"), "error"); + } + } else { + echo format_txt(_("Error Connecting to the Package Repository. Module not installed. Please Try again later."), "error"); + echo format_txt(_("You Can Also Manually Update The Repository By Downloading Files here: %_URL_INI_% Release Repo %_URL_END_%"), "error", array ( "%_URL_INI_%" => "", "%_URL_END_%" => "")); + echo format_txt(_("Then Use Manual Upload in Advanced Settings."), "error"); + } + } else { + echo format_txt(_("Installing brands is disabled while in repo mode!"), "error"); + } + } + + /** + * This will install or updated a brand package (which is the same thing to this) + * Still needs way to determine when models move...perhaps another function? + */ + function update_brand($package, $remote=TRUE) { +if ($this->configmod->get('debug')) echo format_txt(_("update_brand(): Debug is set to %_DEBUG_MODE_%"), "",array("%_DEBUG_MODE_%" => $this->configmod->get('debug'))); + + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; +if ($this->configmod->get('debug')) echo format_txt(_("Processing %_PATH_%/brand_data.json..."), "",array("%_PATH_%" => $temp_directory.$package)); + + if (file_exists($temp_directory . $package . '/brand_data.json')) { + $temp = $this->file2json($temp_directory . $package . '/brand_data.json'); + if (key_exists('directory', $temp['data']['brands'])) { + echo format_txt(_("Appears to be a valid Provisioner.net JSON file.....Continuing")); + //Pull in all variables + $directory = $temp['data']['brands']['directory']; + $brand_name = $temp['data']['brands']['name']; + $brand_id = $temp['data']['brands']['brand_id']; + $brand_version = $temp['data']['brands']['last_modified']; + + //create directory structure and move files + echo format_txt(_("Creating Directory Structure for Brand '%_NAME_%' and Moving Files .."), "",array("%_NAME_%" => $brand_name)); + if (!file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $directory)) { + mkdir($this->PHONE_MODULES_PATH . "endpoint/" . $directory); + } + + $dir_iterator = new \RecursiveDirectoryIterator($temp_directory . $directory . "/"); + $iterator = new \RecursiveIteratorIterator($dir_iterator, \RecursiveIteratorIterator::SELF_FIRST); + foreach ($iterator as $file) { + if (is_dir($file)) { + $dir = str_replace($temp_directory . $directory . "/", "", $file); + if (!file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir)) { + mkdir($this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0775, TRUE); +//echo "."; + } + } else { + if ((basename($file) != "brand_data.json") OR (!$remote)) { + $dir = str_replace($temp_directory . $directory . "/", "", $file); + $stats = rename($file, $this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir); + if ($stats === FALSE) { + echo format_txt(_("- Error Moving %_FILENAME_%!"), "error",array("%_FILENAME_%" => basename($file))); + } + chmod($this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0775); +//echo "."; + } + } + } + echo format_txt(_("Done!"), "done"); + + if ($remote) { + $local = 0; + } else { + $local = 1; + } + + $b_data = sql("SELECT id FROM endpointman_brand_list WHERE id = '" . $brand_id . "'", 'getOne'); + if ($b_data) { +echo format_txt(_("Updating %_BRANDNAME_% brand data.........."), "", array("%_BRANDNAME_%" => $brand_name)); + $sql = "UPDATE endpointman_brand_list SET local = '" . $local . "', name = '" . $brand_name . "', cfg_ver = '" . $brand_version . "', installed = 1, hidden = 0 WHERE id = " . $brand_id; + sql($sql); + } else { +echo format_txt(_("Inserting %_BRANDNAME_% brand data.........."), "", array("%_BRANDNAME_%" => $brand_name)); + $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '" . $local . "', '1')"; + sql($sql); + } + + $last_mod = ""; + foreach ($temp['data']['brands']['family_list'] as $family_list) { + echo format_txt(_("Updating Family Lines.................")); + + $last_mod = max($last_mod, $family_list['last_modified']); + + $family_line_xml = $this->file2json($this->PHONE_MODULES_PATH . '/endpoint/' . $directory . '/' . $family_list['directory'] . '/family_data.json'); + $family_line_xml['data']['last_modified'] = isset($family_line_xml['data']['last_modified']) ? $family_line_xml['data']['last_modified'] : ''; + + $require_firmware = NULL; + if ((key_exists('require_firmware', $family_line_xml['data'])) && ($remote) && ($family_line_xml['data']['require_firmware'] == "TRUE")) { + echo format_txt(_("Firmware Requirment Detected!..........")); + $this->install_firmware($family_line_xml['data']['id']); + } + + $data = sql("SELECT id FROM endpointman_product_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . "'", 'getOne'); + $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); + + if ($data) { + if ($this->configmod->get('debug')) echo "-Updating Family ".$short_name."
      "; + $sql = "UPDATE endpointman_product_list SET short_name = '" . str_replace("'", "''", $short_name) . "', long_name = '" . str_replace("'", "''", $family_line_xml['data']['name']) . "', cfg_ver = '" . $family_line_xml['data']['version'] . "', config_files='" . $family_line_xml['data']['configuration_files'] . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . "'"; + } + else { + if ($this->configmod->get('debug')) echo "-Inserting Family ".$short_name."
      "; + $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . str_replace("'", "''", $short_name) . "', '" . str_replace("'", "''", $family_line_xml['data']['name']) . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['last_modified'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')"; + } + sql($sql); + + + if (count($family_line_xml['data']['model_list']) > 0) { + echo format_txt(_("-- Updating Model Lines................")); + foreach ($family_line_xml['data']['model_list'] as $model_list) { + $template_list = implode(",", $model_list['template_data']); + + $model_final_id = $brand_id . $family_line_xml['data']['id'] . $model_list['id']; + $sql = 'SELECT id, global_custom_cfg_data, global_user_cfg_data FROM endpointman_mac_list WHERE model = ' . $model_final_id; + $old_data = NULL; + $old_data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach ($old_data as $data) { + $global_custom_cfg_data = unserialize($data['global_custom_cfg_data']); + if ((is_array($global_custom_cfg_data)) AND (!array_key_exists('data', $global_custom_cfg_data))) { +echo format_txt(_("----Old Data Detected! Migrating......")); + $new_data = array(); + $new_ari = array(); + foreach ($global_custom_cfg_data as $key => $old_keys) { + if (array_key_exists('value', $old_keys)) { + $new_data[$key] = $old_keys['value']; + } else { + $breaks = explode("_", $key); + $new_data["loop|" . $key] = $old_keys[$breaks[2]]; + } + if (array_key_exists('ari', $old_keys)) { + $new_ari[$key] = 1; + } + } + $final_data = array(); + $final_data['data'] = $new_data; + $final_data['ari'] = $new_ari; + $final_data = serialize($final_data); + $sql = "UPDATE endpointman_mac_list SET global_custom_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; + sql($sql); + echo format_txt(_("Done!"), "done"); + } + + $global_user_cfg_data = unserialize($data['global_user_cfg_data']); + $old_check = FALSE; + if (is_array($global_user_cfg_data)) { + foreach ($global_user_cfg_data as $stuff) { + if (is_array($stuff)) { + if (array_key_exists('value', $stuff)) { + $old_check = TRUE; + break; + } else { + break; + } + } else { + break; + } + } + } + if ((is_array($global_user_cfg_data)) AND ($old_check)) { +echo format_txt(_("Old Data Detected! Migrating......")); + $new_data = array(); + foreach ($global_user_cfg_data as $key => $old_keys) { + if (array_key_exists('value', $old_keys)) { + $exploded = explode("_", $key); + $counted = count($exploded); + $counted = $counted - 1; + if (is_numeric($exploded[$counted])) { + $key = "loop|" . $key; + } + $new_data[$key] = $old_keys['value']; + } + } + $final_data = serialize($new_data); + $sql = "UPDATE endpointman_mac_list SET global_user_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; + sql($sql); + echo format_txt(_("Done!"), "done"); + } + } + $old_data = NULL; + $sql = 'SELECT id, global_custom_cfg_data FROM endpointman_template_list WHERE model_id = ' . $model_final_id; + $old_data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach ($old_data as $data) { + $global_custom_cfg_data = unserialize($data['global_custom_cfg_data']); + if ((is_array($global_custom_cfg_data)) AND (!array_key_exists('data', $global_custom_cfg_data))) { +echo format_txt(_("Old Data Detected! Migrating......")); + $new_data = array(); + $new_ari = array(); + foreach ($global_custom_cfg_data as $key => $old_keys) { + if (array_key_exists('value', $old_keys)) { + $new_data[$key] = $old_keys['value']; + } else { + $breaks = explode("_", $key); + $new_data["loop|" . $key] = $old_keys[$breaks[2]]; + } + if (array_key_exists('ari', $old_keys)) { + $new_ari[$key] = 1; + } + } + $final_data = array(); + $final_data['data'] = $new_data; + $final_data['ari'] = $new_ari; + $final_data = serialize($final_data); + $sql = "UPDATE endpointman_template_list SET global_custom_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; + sql($sql); + echo format_txt(_("Done!"), "done"); + } + } + + $m_data = sql("SELECT id FROM endpointman_model_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'", 'getOne'); + if ($m_data) { +if ($this->configmod->get('debug')) echo format_txt(_("---Updating Model %_NAMEMOD_%"), "", array("%_NAMEMOD_%" => $model_list['model'])); + $sql = "UPDATE endpointman_model_list SET max_lines = '" . $model_list['lines'] . "', model = '" . $model_list['model'] . "', template_list = '" . $template_list . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'"; + } + else { +if ($this->configmod->get('debug')) echo format_txt(_("---Inserting Model %_NAMEMOD_%"), "", array("%_NAMEMOD_%" => $model_list['model'])); + $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "', '" . $brand_id . "', '" . $model_list['model'] . "', '" . $model_list['lines'] . "', '" . $brand_id . $family_line_xml['data']['id'] . "', '" . $template_list . "', '0', '0')"; + } + sql($sql); + + if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'], $errlog)) { + echo format_txt(_("System Error in Sync Model Function, Load Failure!"), "error"); + echo format_txt($errlog['sync_model'], "error"); + } + unset ($errlog); + } + } + + + //Phone Models Move Here + $family_id = $brand_id . $family_line_xml['data']['id']; + $sql = "SELECT * FROM endpointman_model_list WHERE product_id = " . $family_id; + $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); + foreach ($products as $data) { + if (!$this->system->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { + echo format_txt(_("Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......"), "", array("%_NAMEMOD_%" => $data['model'])); + $model_name = $data['model']; + $sql = 'DELETE FROM endpointman_model_list WHERE id = ' . $data['id']; + sql($sql); + $sql = "SELECT id FROM endpointman_model_list WHERE model LIKE '" . $model_name . "'"; + $new_model_id = sql($sql, 'getOne'); + if ($new_model_id) { + $sql = "UPDATE endpointman_mac_list SET model = '" . $new_model_id . "' WHERE model = '" . $data['id'] . "'"; + } else { + $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '" . $data['id'] . "'"; + } + sql($sql); + } + } + } + + if ($this->configmod->get('debug')) { + echo format_txt(_("Done!"), "done"); + echo format_txt(_("Updating OUI list in DB")); + } + if ((isset($temp['data']['brands']['oui_list'])) AND (count($temp['data']['brands']['oui_list']) > 0)) + { + foreach ($temp['data']['brands']['oui_list'] as $oui) { + $sql = "REPLACE INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('" . $oui . "', '" . $brand_id . "', '0')"; + sql($sql); + } + } + + echo format_txt(_("Done!"), "done"); + } else { + echo format_txt(_("Invalid JSON Structure in %_PATH_%/brand_data.json"), "", array("%_PATH_%" => $temp_directory.$package), "error"); + } + } else { + echo format_txt(_("No 'brand_data.xml' file exists!"), "error"); + } + + echo format_txt(_("Removing Temporary Files..............")); + $this->system->rmrf($temp_directory . $package); + echo format_txt(_("Done!"), "done"); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /** + * Returns list of Brands that are installed and not hidden and that have at least one model enabled under them + * @param integer $selected ID Number of the brand that is supposed to be selected in a drop-down list box + * @return array Number array used to generate a select box + */ + function brands_available($selected = NULL, $show_blank=TRUE) { + $data = $this->eda->all_active_brands(); + $temp = array(); + if ($show_blank) { + $temp[0]['value'] = ""; + $temp[0]['text'] = ""; + $i = 1; + } else { + $i = 0; + } + foreach ($data as $row) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['name']; + if ($row['id'] == $selected) { + $temp[$i]['selected'] = TRUE; + } else { + $temp[$i]['selected'] = NULL; + } + $i++; + } + return($temp); + } + + function listTZ($selected) { + require_once('lib/datetimezone.class.php'); + $data = \DateTimeZone::listIdentifiers(); + $i = 0; + foreach ($data as $key => $row) { + $temp[$i]['value'] = $row; + $temp[$i]['text'] = $row; + if (strtoupper ($temp[$i]['value']) == strtoupper($selected)) { + $temp[$i]['selected'] = 1; + } else { + $temp[$i]['selected'] = 0; + } + $i++; + } + + return($temp); + } + + function has_git() { + exec('which git', $output); + + $git = file_exists($line = trim(current($output))) ? $line : 'git'; + + unset($output); + + exec($git . ' --version', $output); + + preg_match('#^(git version)#', current($output), $matches); + + return!empty($matches[0]) ? $git : false; + echo!empty($matches[0]) ? 'installed' : 'nope'; + } + + function tftp_check() { + //create a simple block here incase people have strange issues going on as we will kill http + //by running this if the server isn't really running! + $sql = 'SELECT value FROM endpointman_global_vars WHERE var_name = \'tftp_check\''; + if (sql($sql, 'getOne') != 1) { + $sql = 'UPDATE endpointman_global_vars SET value = \'1\' WHERE var_name = \'tftp_check\''; + sql($sql); + $subject = shell_exec("netstat -luan --numeric-ports"); + if (preg_match('/:69\s/i', $subject)) { + $rand = md5(rand(10, 2000)); + if (file_put_contents($this->configmod->get('config_location') . 'TEST', $rand)) { + if ($this->system->tftp_fetch('127.0.0.1', 'TEST') != $rand) { + $this->error['tftp_check'] = 'Local TFTP Server is not correctly configured'; +echo 'Local TFTP Server is not correctly configured'; + } + unlink($this->configmod->get('config_location') . 'TEST'); + } else { + $this->error['tftp_check'] = 'Unable to write to ' . $this->configmod->get('config_location'); +echo 'Unable to write to ' . $this->configmod->get('config_location'); + } + } else { + $dis = FALSE; + if (file_exists('/etc/xinetd.d/tftp')) { + $contents = file_get_contents('/etc/xinetd.d/tftp'); + if (preg_match('/disable.*=.*yes/i', $contents)) { + $this->error['tftp_check'] = 'Disabled is set to "yes" in /etc/xinetd.d/tftp. Please fix
      Then restart your TFTP service'; +echo 'Disabled is set to "yes" in /etc/xinetd.d/tftp. Please fix
      Then restart your TFTP service'; + $dis = TRUE; + } + } + if (!$dis) { + $this->error['tftp_check'] = 'TFTP Server is not running.
      See here for instructions on how to install one: http://wiki.provisioner.net/index.php/Tftp'; +echo 'TFTP Server is not running.
      See here for instructions on how to install one: http://wiki.provisioner.net/index.php/Tftp'; + } + } + $sql = 'UPDATE endpointman_global_vars SET value = \'0\' WHERE var_name = \'tftp_check\''; + sql($sql); + } else { + $this->error['tftp_check'] = 'TFTP Server check failed on last past. Skipping'; +echo 'TFTP Server check failed on last past. Skipping'; + } + } + + + /** + * Used to send sample configurations to provisioner.net + * NOTE: The user has to explicitly click a link that states they are sending the configuration to the project + * We don't take configs on our own accord!! + * @param $brand Brand Directory + * @param $product Product Directory + * @param $orig_name The file's original name we are sending + * @param $data The config file's data + */ + function submit_config($brand, $product, $orig_name, $data) { + $posturl = 'http://www.provisioner.net/submit_config.php'; + + $fp = fopen($this->LOCAL_PATH . 'data.txt', 'w'); + fwrite($fp, $data); + fclose($fp); + $file_name_with_full_path = $this->LOCAL_PATH . "data.txt"; + + $postvars = array('brand' => $brand, 'product' => $product, 'origname' => htmlentities(addslashes($orig_name)), 'file_contents' => '@' . $file_name_with_full_path); + + $ch = curl_init($posturl); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); // DO NOT RETURN HTTP HEADERS + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // RETURN THE CONTENTS OF THE CALL, probably not needed + $Rec_Data = curl_exec($ch); + + ob_start(); + header("Content-Type: text/html"); + $Final_Out = ob_get_clean(); + curl_close($ch); + unlink($file_name_with_full_path); + + return($Final_Out); + } + + + /** + * Fixes the display are special strings so we can visible see them instead of them being transformed + * @param string $contents a string of course + * @return string fixed string + */ + function display_htmlspecialchars($contents) { + $contents = str_replace("&", "&amp;", $contents); + $contents = str_replace("<", "&lt;", $contents); + $contents = str_replace(">", "&gt;", $contents); + $contents = str_replace(""", "&quot;", $contents); + $contents = str_replace("'", "&#039;", $contents); + return($contents); + } + + + + function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname=NULL) { + $mac = $this->mac_check_clean($mac); + if ($mac) { + if (empty($model)) { +$this->error['add_device'] = _("You Must Select A Model From the Drop Down") . "!"; + return(FALSE); + } elseif (empty($ext)) { +$this->error['add_device'] = _("You Must Select an Extension/Device From the Drop Down") . "!"; + return(FALSE); + } else { + if ($this->sync_model($model)) { + $sql = "SELECT id,template_id FROM endpointman_mac_list WHERE mac = '" . $mac . "'"; + $dup = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + if ($dup) { + if (!isset($template)) { + $template = $dup['template_id']; + } + + $sql = "UPDATE endpointman_mac_list SET model = " . $model . ", template_id = " . $template . " WHERE id = " . $dup['id']; + sql($sql); + $return = $this->add_line($dup['id'], $line, $ext); + if ($return) { + return($return); + } else { + return(FALSE); + } + } else { + if (!isset($template)) { + $template = 0; + } + + $sql = "SELECT mac_id FROM endpointman_line_list WHERE ext = " . $ext; + $used = sql($sql, 'getOne'); + + if (($used) AND (! $this->configmod->get('show_all_registrations'))) { +$this->error['add_device'] = "You can't assign the same user to multiple devices!"; + return(FALSE); + } + + if (!isset($displayname)) { + $sql = 'SELECT description FROM devices WHERE id = ' . $ext; + $name = & sql($sql, 'getOne'); + } else { + $name = $displayname; + } + + $sql = 'SELECT endpointman_product_list. * , endpointman_model_list.template_data, endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id = \'' . $model . '\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id'; + $row = & sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `template_id`) VALUES ('" . $mac . "', '" . $model . "', '" . $template . "')"; + sql($sql); + + $sql = 'SELECT last_insert_id()'; + $ext_id = & sql($sql, 'getOne'); + + if (empty($line)) { + $line = 1; + } + + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $ext_id . "', '" . $ext . "', '" . $line . "', '" . addslashes($name) . "')"; + sql($sql); + +$this->message['add_device'][] = "Added " . $name . " to line " . $line; + return($ext_id); + } + } else { +$this->error['Sync_Model'] = _("Invalid Model Selected, Can't Sync System") . "!"; + return(FALSE); + } + } + } else { +$this->error['add_device'] = _("Invalid MAC Address") . "!"; + return(FALSE); + } + } + + + function add_line($mac_id, $line=NULL, $ext=NULL, $displayname=NULL) { + if ((!isset($line)) AND (!isset($ext))) { + if ($this->linesAvailable(NULL, $mac_id)) { + if ($this->eda->all_unused_registrations()) { + $sql = 'SELECT * FROM endpointman_line_list WHERE mac_id = ' . $mac_id; + $lines_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + + foreach ($lines_list as $row) { + $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; + $name = sql($sql, 'getOne'); + + $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . $this->eda->escapeSimple($name) . "' WHERE luid = " . $row['luid']; + sql($sql); + } + + $reg = array_values($this->display_registration_list()); + $lines = array_values($this->linesAvailable(NULL, $mac_id)); + + $sql = "SELECT description FROM devices WHERE id = " . $reg[0]['value']; + $name = $this->eda->sql($sql, 'getOne'); + + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $reg[0]['value'] . "', '" . $lines[0]['value'] . "', '" . addslashes($name) . "')"; + $this->eda->sql($sql); + +$this->message['add_line'] = "Added '" . $name . "' to line '" . $lines[0]['value'] . "' on device '" . $reg[0]['value'] . "'
      Configuration Files will not be Generated until you click Save!"; + return($mac_id); + } else { +$this->error['add_line'] = _("No Devices/Extensions Left to Add") . "!"; + return(FALSE); + } + } else { +$this->error['add_line'] = _("No Lines Left to Add") . "!"; + return(FALSE); + } + } elseif ((!isset($line)) AND (isset($ext))) { + if ($this->linesAvailable(NULL, $mac_id)) { + if ($this->eda->all_unused_registrations()) { + $lines = array_values($this->linesAvailable(NULL, $mac_id)); + + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $ext . "', '" . $lines[0]['value'] . "', '" . addslashes($displayname) . "')"; + sql($sql); + +$this->message['add_line'] = "Added '" . $name . "' to line '" . $lines[0]['value'] . "' on device '" . $reg[0]['value'] . "'
      Configuration Files will not be Generated until you click Save!"; + return($mac_id); + } else { +$this->error['add_line'] = _("No Devices/Extensions Left to Add") . "!"; + return(FALSE); + } + } else { +$this->error['add_line'] = _("No Lines Left to Add") . "!"; + return(FALSE); + } + } elseif ((isset($line)) AND (isset($ext))) { + $sql = "SELECT luid FROM endpointman_line_list WHERE line = '" . $line . "' AND mac_id = " . $mac_id; + $luid = sql($sql, 'getOne'); + if ($luid) { +$this->error['add_line'] = "This line has already been assigned!"; + return(FALSE); + } else { + if (!isset($displayname)) { + $sql = 'SELECT description FROM devices WHERE id = ' . $ext; + $name = & sql($sql, 'getOne'); + } else { + $name = $displayname; + } + + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $ext . "', '" . $line . "', '" . addslashes($name) . "')"; + sql($sql); +$this->message['add_line'] .= "Added " . $name . " to line " . $line . "
      "; + return($mac_id); + } + } + } + + + function linesAvailable($lineid=NULL, $macid=NULL) { + if (isset($lineid)) { + $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = (SELECT endpointman_mac_list.model FROM endpointman_mac_list, endpointman_line_list WHERE endpointman_line_list.luid = " . $lineid . " AND endpointman_line_list.mac_id = endpointman_mac_list.id)"; + + $sql_l = "SELECT line, mac_id FROM `endpointman_line_list` WHERE luid = " . $lineid; + $line = sql($sql_l, 'getRow', DB_FETCHMODE_ASSOC); + + $sql_lu = "SELECT line FROM endpointman_line_list WHERE mac_id = " . $line['mac_id']; + } elseif (isset($macid)) { + $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = (SELECT model FROM endpointman_mac_list WHERE id =" . $macid . ")"; + $sql_lu = "SELECT line FROM endpointman_line_list WHERE mac_id = " . $macid; + + $line['line'] = 0; + } + + $max_lines = sql($sql, 'getOne'); + $lines_used = sql($sql_lu, 'getAll'); + + for ($i = 1; $i <= $max_lines; $i++) { + if ($i == $line['line']) { + $temp[$i]['value'] = $i; + $temp[$i]['text'] = $i; + $temp[$i]['selected'] = "selected"; + } else { + if (!$this->in_array_recursive($i, $lines_used)) { + $temp[$i]['value'] = $i; + $temp[$i]['text'] = $i; + } + } + } + if (isset($temp)) { + return($temp); + } else { + return FALSE; + } + } + + + /** + * This function takes a string and tries to determine if it's a valid mac addess, return FALSE if invalid + * @param string $mac The full mac address + * @return mixed The cleaned up MAC is it was a MAC or False if not a mac + */ + function mac_check_clean($mac) { + if ((strlen($mac) == "17") OR (strlen($mac) == "12")) { + //It might be better to use switch here instead of these IF statements... + //Is the mac separated by colons(:) or dashes(-)? + if (preg_match("/[0-9a-f][0-9a-f][:-]" . + "[0-9a-f][0-9a-f][:-]" . + "[0-9a-f][0-9a-f][:-]" . + "[0-9a-f][0-9a-f][:-]" . + "[0-9a-f][0-9a-f][:-]" . + "[0-9a-f][0-9a-f]/i", $mac)) { + return(strtoupper(str_replace(":", "", str_replace("-", "", $mac)))); + //Is the string exactly 12 characters? + } elseif (strlen($mac) == "12") { + //Now is the string a valid HEX mac address? + if (preg_match("/[0-9a-f][0-9a-f]" . + "[0-9a-f][0-9a-f]" . + "[0-9a-f][0-9a-f]" . + "[0-9a-f][0-9a-f]" . + "[0-9a-f][0-9a-f]" . + "[0-9a-f][0-9a-f]/i", $mac)) { + return(strtoupper($mac)); + } else { + return(FALSE); + } + //Is the mac separated by whitespaces? + } elseif (preg_match("/[0-9a-f][0-9a-f][\s]" . + "[0-9a-f][0-9a-f][\s]" . + "[0-9a-f][0-9a-f][\s]" . + "[0-9a-f][0-9a-f][\s]" . + "[0-9a-f][0-9a-f][\s]" . + "[0-9a-f][0-9a-f]/i", $mac)) { + return(strtoupper(str_replace(" ", "", $mac))); + } else { + return(FALSE); + } + } else { + return(FALSE); + } + } + + /** + * Display all unused registrations from whatever manager we are using! + * @return + */ + function display_registration_list($line_id=NULL) { + + if (isset($line_id)) { + $result = $this->eda->all_unused_registrations(); + $line_data = $this->eda->get_line_information($line_id); + } else { + $result = $this->eda->all_unused_registrations(); + $line_data = NULL; + } + + $i = 1; + $temp = array(); + foreach ($result as $row) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['id'] . " --- " . $row['description']; + $i++; + } + + if (isset($line_data)) { + $temp[$i]['value'] = $line_data['ext']; + $temp[$i]['text'] = $line_data['ext'] . " --- " . $line_data['description']; + $temp[$i]['selected'] = "selected"; + } + + return($temp); + } + + + /** + * Taken from PHP.net. A list of errors returned when uploading files. + * @param $error_code + * @return string + */ + function file_upload_error_message($error_code) { + switch ($error_code) { + case UPLOAD_ERR_INI_SIZE: + return _('The uploaded file exceeds the upload_max_filesize directive in php.ini'); + case UPLOAD_ERR_FORM_SIZE: + return _('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'); + case UPLOAD_ERR_PARTIAL: + return _('The uploaded file was only partially uploaded'); + case UPLOAD_ERR_NO_FILE: + return _('No file was uploaded'); + case UPLOAD_ERR_NO_TMP_DIR: + return _('Missing a temporary folder'); + case UPLOAD_ERR_CANT_WRITE: + return _('Failed to write file to disk'); + case UPLOAD_ERR_EXTENSION: + return _('File upload stopped by extension'); + default: + return _('Unknown upload error'); + } + } + + /** + * Send this function an ID from the mac devices list table and you'll get all the information we have on that particular phone + * @param integer $mac_id ID number reference from the MySQL database referencing the table endpointman_mac_list + * @return array + * @example + * Final Output will look something similar to this + * Array + * ( + * [config_files_override] => + * [global_user_cfg_data] => N; + * [model_id] => 213 + * [brand_id] => 2 + * [name] => Grandstream + * [directory] => grandstream + * [model] => GXP2000 + * [mac] => 000B820D0050 + * [template_id] => 0 + * [global_custom_cfg_data] => Serialized Data (Changed Template Values) + * [long_name] => GXP Enterprise IP series [280,1200,2000,2010,2020] + * [product_id] => 21 + * [cfg_dir] => gxp + * [cfg_ver] => 1.5 + * [template_data] => Serialized Data (The default Template Values) + * [enabled] => 1 + * [line] => Array + * ( + * [1] => Array + * ( + * [luid] => 2 + * [mac_id] => 2 + * [line] => 1 + * [ext] => 1000 + * [description] => Description + * [custom_cfg_data] => + * [user_cfg_data] => + * [secret] => secret + * [id] => 1000 + * [tech] => sip + * [dial] => SIP/1000 + * [devicetype] => fixed + * [user] => 1000 + * [emergency_cid] => + * ) + * ) + * ) + */ + function get_phone_info($mac_id=NULL) { + //You could screw up a phone if the mac_id is blank + if (!isset($mac_id)) { +$this->error['get_phone_info'] = "Mac ID is not set"; + return(FALSE); + } + $sql = "SELECT id FROM endpointman_mac_list WHERE model > 0 AND id =" . $mac_id; + + $res = sql($sql); + if ($res->numRows()) { + //Returns Brand Name, Brand Directory, Model Name, Mac Address, Extension (FreePBX), Custom Configuration Template, Custom Configuration Data, Product Name, Product ID, Product Configuration Directory, Product Configuration Version, Product XML name, + $sql = "SELECT endpointman_mac_list.specific_settings, endpointman_mac_list.config_files_override, endpointman_mac_list.global_user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_mac_list.template_id, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_model_list.template_data, endpointman_model_list.enabled, endpointman_mac_list.global_settings_override FROM endpointman_line_list, endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.id = " . $mac_id; + $phone_info = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + if (!$phone_info) { +$this->error['get_phone_info'] = "Error with SQL Statement"; + } + + //If there is a template associated with this phone then pull that information and put it into the array + if ($phone_info['template_id'] > 0) { + $sql = "SELECT name, global_custom_cfg_data, config_files_override, global_settings_override FROM endpointman_template_list WHERE id = " . $phone_info['template_id']; + $phone_info['template_data_info'] = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + } + + $sql = "SELECT endpointman_line_list.*, sip.data as secret, devices.*, endpointman_line_list.description AS epm_description FROM endpointman_line_list, sip, devices WHERE endpointman_line_list.ext = devices.id AND endpointman_line_list.ext = sip.id AND sip.keyword = 'secret' AND mac_id = " . $mac_id . " ORDER BY endpointman_line_list.line ASC"; + $lines_info = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach ($lines_info as $line) { + $phone_info['line'][$line['line']] = $line; + $phone_info['line'][$line['line']]['description'] = $line['epm_description']; + $phone_info['line'][$line['line']]['user_extension'] = $line['user']; + } + } else { + $sql = "SELECT id, mac FROM endpointman_mac_list WHERE id =" . $mac_id; + //Phone is unknown, we need to display this to the end user so that they can make corrections + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $brand = $this->get_brand_from_mac($row['mac']); + if ($brand) { + $phone_info['brand_id'] = $brand['id']; + $phone_info['name'] = $brand['name']; + } else { + $phone_info['brand_id'] = 0; + $phone_info['name'] = 'Unknown'; + } + + $phone_info['id'] = $mac_id; + $phone_info['model_id'] = 0; + $phone_info['product_id'] = 0; + $phone_info['custom_cfg_template'] = 0; + $phone_info['mac'] = $row['mac']; + $sql = "SELECT endpointman_line_list.*, sip.data as secret, devices.* FROM endpointman_line_list, sip, devices WHERE endpointman_line_list.ext = devices.id AND endpointman_line_list.ext = sip.id AND sip.keyword = 'secret' AND mac_id = " . $mac_id; + $lines_info = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach ($lines_info as $line) { + $phone_info['line'][$line['line']] = $line; + } + } + return $phone_info; + } + + /** + * Get the brand from any mac sent to this function + * @param string $mac + * @return array + */ + function get_brand_from_mac($mac) { + //Check for valid mac address first + if (!$this->mac_check_clean($mac)) { + return(FALSE); + } + + //Get the OUI only + $oui = substr($this->mac_check_clean($mac), 0, 6); + //Find the matching brand model to the oui + $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%" . $oui . "%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; + $brand = sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); + + $res = sql($oui_sql); + $brand_count = $res->numRows(); + + if (!$brand_count) { + //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. + $phone_info['id'] = 0; + $phone_info['name'] = _("Unknown"); + } else { + $phone_info['id'] = $brand['id']; + $phone_info['name'] = $brand['name']; + } + + return($phone_info); + } + + + + /** + * Prepare and then send the data that Provisioner expects, then take what provisioner gives us and do what it says + * @param array $phone_info Everything from get_phone_info + * @param bool $reboot Reboot the Phone after write + * @param bool $write Write out Directory structure. + */ + function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) + { + $this->PROVISIONER_BASE = $this->PHONE_MODULES_PATH; +//define('PROVISIONER_BASE', $this->PROVISIONER_BASE); + if (file_exists($this->PHONE_MODULES_PATH . 'autoload.php')) { + if (!class_exists('ProvisionerConfig')) { + require($this->PHONE_MODULES_PATH . 'autoload.php'); + } + + //Load Provisioner + $class = "endpoint_" . $phone_info['directory'] . "_" . $phone_info['cfg_dir'] . '_phone'; + $base_class = "endpoint_" . $phone_info['directory'] . '_base'; + $master_class = "endpoint_base"; + if (!class_exists($master_class)) { + ProvisionerConfig::endpointsAutoload($master_class); + } + if (!class_exists($base_class)) { + ProvisionerConfig::endpointsAutoload($base_class); + } + if (!class_exists($class)) { + ProvisionerConfig::endpointsAutoload($class); + } + + if (class_exists($class)) { + $provisioner_lib = new $class(); + + //Determine if global settings have been overridden + if ($phone_info['template_id'] > 0) { + if (isset($phone_info['template_data_info']['global_settings_override'])) { + $settings = unserialize($phone_info['template_data_info']['global_settings_override']); + } else { + $settings['srvip'] = $this->configmod->get('srvip'); + $settings['ntp'] = $this->configmod->get('ntp'); + $settings['config_location'] = $this->configmod->get('config_location'); + $settings['tz'] = $this->configmod->get('tz'); + } + } else { + if (isset($phone_info['global_settings_override'])) { + $settings = unserialize($phone_info['global_settings_override']); + } else { + $settings['srvip'] = $this->configmod->get('srvip'); + $settings['ntp'] = $this->configmod->get('ntp'); + $settings['config_location'] = $this->configmod->get('config_location'); + $settings['tz'] = $this->configmod->get('tz'); + } + } + + + + //Tell the system who we are and were to find the data. + $provisioner_lib->root_dir = $this->PHONE_MODULES_PATH; + $provisioner_lib->engine = 'asterisk'; + $provisioner_lib->engine_location = $this->configmod->get('asterisk_location','asterisk'); + $provisioner_lib->system = 'unix'; + + //have to because of versions less than php5.3 + $provisioner_lib->brand_name = $phone_info['directory']; + $provisioner_lib->family_line = $phone_info['cfg_dir']; + + + + //Phone Model (Please reference family_data.xml in the family directory for a list of recognized models) + //This has to match word for word. I really need to fix this.... + $provisioner_lib->model = $phone_info['model']; + + //Timezone + try { + $provisioner_lib->DateTimeZone = new DateTimeZone($settings['tz']); + } catch (Exception $e) { +$this->error['parse_configs'] = 'Error Returned From Timezone Library: ' . $e->getMessage(); + return(FALSE); + } + + $temp = ""; + $template_data = unserialize($phone_info['template_data']); + $global_user_cfg_data = unserialize($phone_info['global_user_cfg_data']); + if ($phone_info['template_id'] > 0) { + $global_custom_cfg_data = unserialize($phone_info['template_data_info']['global_custom_cfg_data']); + //Provide alternate Configuration file instead of the one from the hard drive + if (!empty($phone_info['template_data_info']['config_files_override'])) { + $temp = unserialize($phone_info['template_data_info']['config_files_override']); + foreach ($temp as $list) { + $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = " . $list; + $res = sql($sql); + if ($res->numRows()) { + $data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; + } + } + } + } else { + $global_custom_cfg_data = unserialize($phone_info['global_custom_cfg_data']); + //Provide alternate Configuration file instead of the one from the hard drive + if (!empty($phone_info['config_files_override'])) { + $temp = unserialize($phone_info['config_files_override']); + foreach ($temp as $list) { + $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = " . $list; + $res = sql($sql); + if ($res->numRows()) { + $data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; + } + } + } + } + + if (!empty($global_custom_cfg_data)) { + if (array_key_exists('data', $global_custom_cfg_data)) { + $global_custom_cfg_ari = $global_custom_cfg_data['ari']; + $global_custom_cfg_data = $global_custom_cfg_data['data']; + } else { + $global_custom_cfg_data = array(); + $global_custom_cfg_ari = array(); + } + } + + $new_template_data = array(); + $line_ops = array(); + if (is_array($global_custom_cfg_data)) { + foreach ($global_custom_cfg_data as $key => $data) { + //TODO: clean up with reg-exp + $full_key = $key; + $key = explode('|', $key); + $count = count($key); + switch ($count) { + case 1: + if (($this->global_cfg['enable_ari'] == 1) AND (isset($global_custom_cfg_ari[$full_key])) AND (isset($global_user_cfg_data[$full_key]))) { + $new_template_data[$full_key] = $global_user_cfg_data[$full_key]; + } else { + $new_template_data[$full_key] = $global_custom_cfg_data[$full_key]; + } + break; + case 2: + $breaks = explode('_', $key[1]); + if (($this->global_cfg['enable_ari'] == 1) AND (isset($global_custom_cfg_ari[$full_key])) AND (isset($global_user_cfg_data[$full_key]))) { + $new_template_data['loops'][$breaks[0]][$breaks[2]][$breaks[1]] = $global_user_cfg_data[$full_key]; + } else { + $new_template_data['loops'][$breaks[0]][$breaks[2]][$breaks[1]] = $global_custom_cfg_data[$full_key]; + } + break; + case 3: + if (($this->global_cfg['enable_ari'] == 1) AND (isset($global_custom_cfg_ari[$full_key])) AND (isset($global_user_cfg_data[$full_key]))) { + $line_ops[$key[1]][$key[2]] = $global_user_cfg_data[$full_key]; + } else { + $line_ops[$key[1]][$key[2]] = $global_custom_cfg_data[$full_key]; + } + break; + } + } + } + + if (!$write) { + $new_template_data['provision']['type'] = 'dynamic'; + $new_template_data['provision']['protocol'] = 'http'; + $new_template_data['provision']['path'] = rtrim($settings['srvip'] . dirname($_SERVER['REQUEST_URI']) . '/', '/'); + $new_template_data['provision']['encryption'] = FALSE; + } else { + $new_template_data['provision']['type'] = 'file'; + $new_template_data['provision']['protocol'] = 'tftp'; + $new_template_data['provision']['path'] = $settings['srvip']; + $new_template_data['provision']['encryption'] = FALSE; + } + + $new_template_data['ntp'] = $settings['ntp']; + + //Overwrite all specific settings variables now + if (!empty($phone_info['specific_settings'])) { + $specific_settings = unserialize($phone_info['specific_settings']); + $specific_settings = is_array($specific_settings) ? $specific_settings : array(); + } else { + $specific_settings = array(); + } + + //Set Variables according to the template_data files included. We can include different template.xml files within family_data.xml also one can create + //template_data_custom.xml which will get included or template_data__custom.xml which will also get included + //line 'global' will set variables that aren't line dependant + + + $provisioner_lib->settings = $new_template_data; + + //Loop through Lines! + $li = 0; + foreach ($phone_info['line'] as $line) { + $line_options = is_array($line_ops[$line['line']]) ? $line_ops[$line['line']] : array(); + $line_statics = array('line' => $line['line'], 'username' => $line['ext'], 'authname' => $line['ext'], 'secret' => $line['secret'], 'displayname' => $line['description'], 'server_host' => $this->global_cfg['srvip'], 'server_port' => '5060', 'user_extension' => $line['user_extension']); + + $provisioner_lib->settings['line'][$li] = array_merge($line_options, $line_statics); + $li++; + } + + if (array_key_exists('data', $specific_settings)) { + foreach ($specific_settings['data'] as $key => $data) { + $default_exp = preg_split("/\|/i", $key); + if (isset($default_exp[2])) { + //lineloop + $var = $default_exp[2]; + $line = $default_exp[1]; + $loc = $this->system->arraysearchrecursive($line, $provisioner_lib->settings['line'], 'line'); + if ($loc !== FALSE) { + $k = $loc[0]; + $provisioner_lib->settings['line'][$k][$var] = $data; + } else { + //Adding a new line-ish type options + if (isset($specific_settings['data']['line|' . $line . '|line_enabled'])) { + $lastkey = array_pop(array_keys($provisioner_lib->settings['line'])); + $lastkey++; + $provisioner_lib->settings['line'][$lastkey]['line'] = $line; + $provisioner_lib->settings['line'][$lastkey][$var] = $data; + } + } + } else { + switch ($key) { + case "connection_type": + $provisioner_lib->settings['network'][$key] = $data; + break; + case "ip4_address": + $provisioner_lib->settings['network']['ipv4'] = $data; + break; + case "ip6_address": + $provisioner_lib->settings['network']['ipv6'] = $data; + break; + case "subnet_mask": + $provisioner_lib->settings['network']['subnet'] = $data; + break; + case "gateway_address": + $provisioner_lib->settings['network']['gateway'] = $data; + break; + case "primary_dns": + $provisioner_lib->settings['network'][$key] = $data; + break; + default: + $provisioner_lib->settings[$key] = $data; + break; + } + } + } + } + + $provisioner_lib->settings['mac'] = $phone_info['mac']; + $provisioner_lib->mac = $phone_info['mac']; + + //Setting a line variable here...these aren't defined in the template_data.xml file yet. however they will still be parsed + //and if they have defaults assigned in a future template_data.xml or in the config file using pipes (|) those will be used, pipes take precedence + $provisioner_lib->processor_info = "EndPoint Manager Version " . $this->global_cfg['version']; + + // Because every brand is an extension (eventually) of endpoint, you know this function will exist regardless of who it is + //Start timer + $time_start = microtime(true); + + $provisioner_lib->debug = TRUE; + + try { + $returned_data = $provisioner_lib->generate_all_files(); + } catch (Exception $e) { +$this->error['prepare_configs'] = 'Error Returned From Provisioner Library: ' . $e->getMessage(); + return(FALSE); + } + //print_r($provisioner_lib->debug_return); + //End timer + $time_end = microtime(true); + $time = $time_end - $time_start; + if ($time > 360) { +$this->error['generate_time'] = "It took an awfully long time to generate configs...(" . round($time, 2) . " seconds)"; + } + if ($write) { + $this->write_configs($provisioner_lib, $reboot, $settings['config_location'], $phone_info, $returned_data); + } else { + return ($returned_data); + } + return(TRUE); + } else { +$this->error['parse_configs'] = "Can't Load \"" . $class . "\" Class!"; + return(FALSE); + } + } else { +$this->error['parse_configs'] = "Can't Load the Autoloader!"; + return(FALSE); + } + } + + function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $returned_data) { + //Create Directory Structure (If needed) + if (isset($provisioner_lib->directory_structure)) { + foreach ($provisioner_lib->directory_structure as $data) { + if (file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { + $dir_iterator = new \RecursiveDirectoryIterator($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data . "/"); + $iterator = new \RecursiveIteratorIterator($dir_iterator, \RecursiveIteratorIterator::SELF_FIRST); + // could use CHILD_FIRST if you so wish + foreach ($iterator as $file) { + $dir = $write_path . str_replace($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/", "", dirname($file)); + if (!file_exists($dir)) { + if (!@mkdir($dir, 0775, TRUE)) { +$this->error['parse_configs'] = "Could Not Create Directory: " . $data; + return(FALSE); + } + } + } + } else { + $dir = $write_path . $data; + if (!file_exists($dir)) { + if (!@mkdir($dir, 0775)) { +$this->error['parse_configs'] = "Could Not Create Directory: " . $data; + return(FALSE); + } + } + } + } + } + + //Copy Files (If needed) + if (isset($provisioner_lib->copy_files)) { + foreach ($provisioner_lib->copy_files as $data) { + if (file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { + $file = $write_path . $data; + $orig = $this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data; + if (!file_exists($file)) { + if (!@copy($orig, $file)) { +$this->error['parse_configs'] = "Could Not Create File: " . $data; + return(FALSE); + } + } else { + if (file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data)) { + if (!file_exists(dirname($write_path . $data))) { + !@mkdir(dirname($write_path . $data), 0775); + } + copy($this->PHONE_MODULES_PATH . "endpoint/" . $phone_info['directory'] . "/" . $phone_info['cfg_dir'] . "/" . $data, $write_path . $data); + chmod($write_path . $data, 0775); + } + } + } + } + } + + foreach ($returned_data as $file => $data) { + if (((file_exists($write_path . $file)) AND (is_writable($write_path . $file)) AND (!in_array($file, $provisioner_lib->protected_files))) OR (!file_exists($write_path . $file))) { + //Move old file to backup + if (!$this->global_cfg['backup_check']) { + if (!file_exists($write_path . 'config_bkup')) { + if (!@mkdir($write_path . 'config_bkup', 0775)) { +$this->error['parse_configs'] = "Could Not Create Backup Directory"; + return(FALSE); + } + } + if (file_exists($write_path . $file)) { + copy($write_path . $file, $write_path . 'config_bkup/' . $file . '.' . time()); + } + } + file_put_contents($write_path . $file, $data); + chmod($write_path . $file, 0775); + if (!file_exists($write_path . $file)) { +$this->error['parse_configs'] = "File (" . $file . ") not written to hard drive!"; + return(FALSE); + } + } elseif (!in_array($file, $provisioner_lib->protected_files)) { +$this->error['parse_configs'] = "File not written to hard drive!"; + return(FALSE); + } + } + + if ($reboot) { + $provisioner_lib->reboot(); + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /********************************************* + ****** CODIGO ANTIGUO -- SIN REVISADO ******** + *********************************************/ + + + + + + + + + + + + function download_json($location, $directory=NULL) { + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; + if (!isset($directory)) { + $destination_file = $this->PHONE_MODULES_PATH . 'endpoint/master.json'; + $directory = "master"; + } else { + if (!file_exists($this->PHONE_MODULES_PATH . '/' . $directory)) { + mkdir($this->PHONE_MODULES_PATH . '/' . $directory, 0775, TRUE); + } + $destination_file = $this->PHONE_MODULES_PATH . '/' . $directory . '/brand_data.json'; + } + $temp_file = $temp_directory . $directory . '.json'; + file_exists(dirname($temp_file)) ? '' : mkdir(dirname($temp_file)); + + if ($this->system->download_file($location, $temp_file)) { + $handle = fopen($temp_file, "rb"); + $contents = fread($handle, filesize($temp_file)); + fclose($handle); + + $a = $this->validate_json($contents); + if ($a === FALSE) { + //Error with the internet....ABORRRTTTT THEEEEE DOWNLOAAAAADDDDDDDD! SCOTTYYYY!; + unlink($temp_file); + return(FALSE); + } else { + rename($temp_file, $destination_file); + chmod($destination_file, 0775); + return(TRUE); + } + } else { + return(FALSE); + } + } + + + + + + + + function merge_data($path, $template_list, $maxlines = 12) { + //TODO: fix + foreach ($template_list as $files_data) { + $full_path = $path . $files_data; + if (file_exists($full_path)) { + $temp_files_data = $this->file2json($full_path); + foreach ($temp_files_data['template_data']['category'] as $category) { + $category_name = $category['name']; + foreach ($category['subcategory'] as $subcategory) { + $subcategory_name = $subcategory['name']; + $items_fin = array(); + $items_loop = array(); + $break_count = 0; + foreach ($subcategory['item'] as $item) { + switch ($item['type']) { + case 'loop_line_options': + for ($i = 1; $i <= $maxlines; $i++) { + $var_nam = "lineloop|line_" . $i; + foreach ($item['data']['item'] as $item_loop) { + if ($item_loop['type'] != 'break') { + $z = str_replace("\$", "", $item_loop['variable']); + $items_loop[$var_nam][$z] = $item_loop; + $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); + $items_loop[$var_nam][$z]['default_value'] = $items_loop[$var_nam][$z]['default_value']; + $items_loop[$var_nam][$z]['default_value'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['default_value']); + $items_loop[$var_nam][$z]['line_loop'] = TRUE; + $items_loop[$var_nam][$z]['line_count'] = $i; + } elseif ($item_loop['type'] == 'break') { + $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; + $break_count++; + } + } + } + $items_fin = array_merge($items_fin, $items_loop); + break; + case 'loop': + for ($i = $item['loop_start']; $i <= $item['loop_end']; $i++) { + $name = explode("_", $item['data']['item'][0]['variable']); + $var_nam = "loop|" . str_replace("\$", "", $name[0]) . "_" . $i; + foreach ($item['data']['item'] as $item_loop) { + if ($item_loop['type'] != 'break') { + $z_tmp = explode("_", $item_loop['variable']); + $z = $z_tmp[1]; + $items_loop[$var_nam][$z] = $item_loop; + $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); + $items_loop[$var_nam][$z]['variable'] = str_replace('_', '_' . $i . '_', $items_loop[$var_nam][$z]['variable']); + $items_loop[$var_nam][$z]['default_value'] = isset($items_loop[$var_nam][$z]['default_value']) ? $items_loop[$var_nam][$z]['default_value'] : ''; + $items_loop[$var_nam][$z]['loop'] = TRUE; + $items_loop[$var_nam][$z]['loop_count'] = $i; + } elseif ($item_loop['type'] == 'break') { + $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; + $break_count++; + } + } + } + $items_fin = array_merge($items_fin, $items_loop); + break; + case 'break': + $items_fin['break|' . $break_count]['type'] = 'break'; + $break_count++; + break; + default: + $var_nam = "option|" . str_replace("\$", "", $item['variable']); + $items_fin[$var_nam] = $item; + break; + } + } + if (isset($data['data'][$category_name][$subcategory_name])) { + $old_sc = $data['data'][$category_name][$subcategory_name]; + $sub_cat_data[$category_name][$subcategory_name] = array(); + $sub_cat_data[$category_name][$subcategory_name] = array_merge($old_sc, $items_fin); + } else { + $sub_cat_data[$category_name][$subcategory_name] = $items_fin; + } + } + if (isset($data['data'][$category_name])) { + $old_c = $data['data'][$category_name]; + $new_c = $sub_cat_data[$category_name]; + $sub_cat_data[$category_name] = array(); + $data['data'][$category_name] = array_merge($old_c, $new_c); + } else { + $data['data'][$category_name] = $sub_cat_data[$category_name]; + } + } + } + } + return($data); + } + + + + + + /** + * Send process to run in background + * @version 2.11 + * @param string $command the command to run + * @param integer $Priority the Priority of the command to run + * @return int $PID process id + * @package epm_system + */ + function run_in_background($Command, $Priority = 0) { + return($Priority ? shell_exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!") : shell_exec("nohup $Command > /dev/null 2> /dev/null & echo $!")); + } + + /** + * Check if process is running in background + * @version 2.11 + * @param string $PID proccess ID + * @return bool true or false + * @package epm_system + */ + function is_process_running($PID) { + exec("ps $PID", $ProcessState); + return(count($ProcessState) >= 2); + } + + + + /** + * Uses which to find executables that asterisk can run/use + * @version 2.11 + * @param string $exec Executable to find + * @package epm_system + */ + function find_exec($exec) { + $o = exec('which '.$exec); + if($o) { + if(file_exists($o) && is_executable($o)) { + return($o); + } else { + return(''); + } + } else { + return(''); + } + } + + + /** + * Only used once in all of Endpoint Manager to determine if a table exists + * @param string $table Table to look for + * @return bool + */ + function table_exists($table) { + $sql = "SHOW TABLES FROM " . $this->config->get('AMPDBNAME'); + $result = $this->eda->sql($sql, 'getAll'); + foreach ($result as $row) { + if ($row[0] == $table) { + return TRUE; + } + } + return FALSE; + } + + + + + + /** + * Check for valid netmast to avoid security issues + * @param string $mask the complete netmask, eg [1.1.1.1/24] + * @return boolean True if valid, False if not + * @version 2.11 + */ + function validate_netmask($mask) { + return preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/", $mask) ? TRUE : FALSE; + } + + /** + * Discover New Device/Hardware + * nmap will actually discover 'unseen' devices that the VoIP server hasn't heard from + * If the user just wishes to use the local arp cache they can tell the function to not use nmap + * This results in a speed increase from 60 seconds to less than one second. + * + * This is the original function that started it all + * http://www.pbxinaflash.com/community/index.php?threads/end-point-configuration-manager-module-for-freepbx-part-1.4514/page-4#post-37671 + * + * @version 2.11 + * @param mixed $netmask The netmask, eg [1.1.1.1/24] + * @param boolean $use_nmap True use nmap, false don't use it + * @return array List of devices found on the network + */ + function discover_new($netmask, $use_nmap=TRUE) { + if (($use_nmap) AND (file_exists($this->global_cfg['nmap_location'])) AND ($this->validate_netmask($netmask))) { + shell_exec($this->global_cfg['nmap_location'] . ' -v -sP ' . $netmask); + } elseif (!$this->validate_netmask($netmask)) { + $this->error['discover_new'] = "Invalid Netmask"; + return(FALSE); + } elseif (!file_exists($this->global_cfg['nmap_location'])) { + $this->error['discover_new'] = "Could Not Find NMAP, Using ARP Only"; + //return(FALSE); + } + //Get arp list + $arp_list = shell_exec($this->global_cfg['arp_location'] . " -an"); + + //Throw arp list into an array, break by new lines + $arp_array = explode("\n", $arp_list); + + //Find all references to active computers by searching out mac addresses. + $temp = array_values(array_unique(preg_grep("/[0-9a-f][0-9a-f][:-]" . + "[0-9a-f][0-9a-f][:-]" . + "[0-9a-f][0-9a-f][:-]" . + "[0-9a-f][0-9a-f][:-]" . + "[0-9a-f][0-9a-f][:-]" . + "[0-9a-f][0-9a-f]/i", $arp_array))); + + //Go through each row of valid arp entries and pull out the information and add it into a nice array! + $z = 0; + foreach ($temp as $key => &$value) { + + //Pull out the IP address from row. It's always the first entry in the row and it can only be a max of 15 characters with the delimiters + preg_match_all("/\((.*?)\)/", $value, $matches); + $ip = $matches[1]; + $ip = $ip[0]; + + //Pull out the mac address by looking for the delimiter + $mac = substr($value, (strpos($value, ":") - 2), 17); + + //Get rid of the delimiter + $mac_strip = strtoupper(str_replace(":", "", $mac)); + + //arp -n will return a MAC address of 000000000000 if no hardware was found, so we need to ignore it + if ($mac_strip != "000000000000") { + //only use the first 6 characters for the oui: http://en.wikipedia.org/wiki/Organizationally_Unique_Identifier + $oui = substr($mac_strip, 0, 6); + + //Find the matching brand model to the oui + $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%" . $oui . "%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; + + $brand = $this->eda->sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); + + $res = $this->eda->sql($oui_sql); + $brand_count = $res->numRows(); + + if (!$brand_count) { + //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. + $brand['name'] = FALSE; + $brand['id'] = NULL; + } + + //Find out if endpoint has already been configured for this mac address + $epm_sql = "SELECT * FROM endpointman_mac_list WHERE mac LIKE '%" . $mac_strip . "%'"; + $epm_row = $this->eda->sql($epm_sql, 'getRow', DB_FETCHMODE_ASSOC); + + $res = $this->eda->sql($epm_sql); + + $epm = $res->numRows() ? TRUE : FALSE; + + //Add into a final array + $final[$z] = array("ip" => $ip, "mac" => $mac, "mac_strip" => $mac_strip, "oui" => $oui, "brand" => $brand['name'], "brand_id" => $brand['id'], "endpoint_managed" => $epm); + $z++; + } + } + return !is_array($final) ? FALSE : $final; + } + + function areaAvailable($model, $area=NULL) { + $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = '" . $model . "'"; + $count = $this->eda->sql($sql, 'getOne'); + + for ($z = 0; $z < $count; $z++) { + $result[$z]['id'] = $z + 1; + $result[$z]['model'] = $z + 1; + } + + $i = 1; + foreach ($result as $row) { + if ($row['id'] == $area) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 'selected'; + } else { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 0; + } + $i++; + } + + return($temp); + } + + /** + * + * @param integer $model model ID + * @param integer $brand brand ID + * @param integer $product product ID + * @return array + */ + function models_available($model=NULL, $brand=NULL, $product=NULL) { + + if ((!isset($oui)) && (!isset($brand)) && (!isset($model))) { + $result1 = $this->eda->all_models(); + } elseif ((isset($brand)) && ($brand != 0)) { + $result1 = $this->eda->all_models_by_brand($brand); + } elseif ((isset($product)) && ($product != 0)) { + $result1 = $this->eda->all_models_by_product($product); + } else { + $result1 = $this->eda->all_models(); + } + + $i = 1; + foreach ($result1 as $row) { + if ($row['id'] == $model) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 'selected'; + } else { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 0; + } + $i++; + } + + if (!isset($temp)) { + if (!isset($this->global_cfg['new'])) { + $this->error['modelsAvailable'] = "You need to enable at least ONE model"; + } + return(FALSE); + } else { + return($temp); + } + } + + function in_array_recursive($needle, $haystack) { + + $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($haystack)); + + foreach ($it AS $element) { + if ($element == $needle) { + return TRUE; + } + } + return FALSE; + } + + + + + + + function display_templates($product_id, $temp_select = NULL) { + $i = 0; + $sql = "SELECT id FROM endpointman_product_list WHERE endpointman_product_list.id ='" . $product_id . "'"; + + $id = $this->eda->sql($sql, 'getOne'); + + $sql = "SELECT * FROM endpointman_template_list WHERE product_id = '" . $id . "'"; + + $data = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach ($data as $row) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['name']; + if ($row['id'] == $temp_select) { + $temp[$i]['selected'] = "selected"; + } + $i++; + } + $temp[$i]['value'] = 0; + if ($temp_select == 0) { + $temp[$i]['text'] = "Custom..."; + $temp[$i]['selected'] = "selected"; + } else { + $temp[$i]['text'] = "Custom..."; + } + + return($temp); + } + + function validate_json($json) { + return(TRUE); + } + + + + + + + + + + + function prepare_message_box() { + $error_message = NULL; + foreach ($this->error as $key => $error) { + $error_message .= $error; + if ($this->global_cfg['debug']) { + $error_message .= " Function: [" . $key . "]"; + } + $error_message .= "
      "; + } + $message = NULL; + foreach ($this->message as $key => $error) { + if (is_array($error)) { + foreach ($error as $sub_error) { + $message .= $sub_error; + if ($this->global_cfg['debug']) { + $message .= " Function: [" . $key . "]"; + } + $message .= "
      "; + } + } else { + $message .= $error; + if ($this->global_cfg['debug']) { + $message .= " Function: [" . $key . "]"; + } + $message .= "
      "; + } + } + + if (isset($message)) { + $this->display_message_box($message, 0); + } + + if (isset($error_message)) { + $this->display_message_box($error_message, 1); + } + } + + + + + + + + + + + function update_device($macid, $model, $template, $luid=NULL, $name=NULL, $line=NULL, $update_lines=TRUE) { + $sql = "UPDATE endpointman_mac_list SET model = " . $model . ", template_id = " . $template . " WHERE id = " . $macid; + $this->eda->sql($sql); + + if ($update_lines) { + if (isset($luid)) { + $this->update_line($luid, NULL, $name, $line); + return(TRUE); + } else { + $this->update_line(NULL, $macid); + return(TRUE); + } + } + } + + function update_line($luid=NULL, $macid=NULL, $name=NULL, $line=NULL) { + if (isset($luid)) { + $sql = "SELECT * FROM endpointman_line_list WHERE luid = " . $luid; + $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + if (!isset($name)) { + $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; + $name = $this->eda->sql($sql, 'getOne'); + } + + if (!isset($line)) { + $line = $row['line']; + } + $sql = "UPDATE endpointman_line_list SET line = '" . $line . "', ext = '" . $row['ext'] . "', description = '" . $this->eda->escapeSimple($name) . "' WHERE luid = " . $row['luid']; + $this->eda->sql($sql); + return(TRUE); + } else { + $sql = "SELECT * FROM endpointman_line_list WHERE mac_id = " . $macid; + $lines_info = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach ($lines_info as $row) { + $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; + $name = $this->eda->sql($sql, 'getOne'); + + $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . $this->eda->escapeSimple($name) . "' WHERE luid = " . $row['luid']; + $this->eda->sql($sql); + } + return(TRUE); + } + } + + /** + * This will either a. delete said line or b. delete said device from line + * @param $line + * @return + */ + function delete_line($lineid, $allow_device_remove=FALSE) { + $sql = 'SELECT mac_id FROM endpointman_line_list WHERE luid = ' . $lineid; + $mac_id = $this->eda->sql($sql, 'getOne'); + $row = $this->get_phone_info($mac_id); + + $sql = 'SELECT COUNT(*) FROM endpointman_line_list WHERE mac_id = ' . $mac_id; + $num_lines = $this->eda->sql($sql, 'getOne'); + if ($num_lines > 1) { + $sql = "DELETE FROM endpointman_line_list WHERE luid=" . $lineid; + $this->eda->sql($sql); + $this->message['delete_line'] = "Deleted!"; + return(TRUE); + } else { + if ($allow_device_remove) { + $sql = "DELETE FROM endpointman_line_list WHERE luid=" . $lineid; + $this->eda->sql($sql); + + $sql = "DELETE FROM endpointman_mac_list WHERE id=" . $mac_id; + $this->eda->sql($sql); + $this->message['delete_line'] = "Deleted!"; + return(TRUE); + } else { + $this->error['delete_line'] = _("You can't remove the only line left") . "!"; + return(FALSE); + } + } + } + + function delete_device($mac_id) { + $sql = "DELETE FROM endpointman_mac_list WHERE id=" . $mac_id; + $this->eda->sql($sql); + + $sql = "DELETE FROM endpointman_line_list WHERE mac_id=" . $mac_id; + $this->eda->sql($sql); + $this->message['delete_device'] = "Deleted!"; + return(TRUE); + } + + function get_message($function_name) { + if (isset($this->message[$function_name])) { + return($this->message[$function_name]); + } else { + return("Unknown Message"); + } + } + + + /** + * Custom Means specific to that MAC + * id is either the mac ID (not address) or the template ID + * @param integer $id + * @param integer $custom + */ + function edit_template_display($id, $custom) { + //endpointman_flush_buffers(); + + + $alt_configs = NULL; + + if ($custom == 0) { + $sql = "SELECT model_id FROM endpointman_template_list WHERE id=" . $id; + } else { + $sql = "SELECT model FROM endpointman_mac_list WHERE id=" . $id; + } + + $model_id = $this->eda->sql($sql, 'getOne'); + + //Make sure the model data from the local confg files are stored in the database and vice-versa. Serious errors will occur if the database is not in sync with the local file + if (!$this->sync_model($model_id)) { + die("unable to sync local template files - TYPE:" . $custom); + } + + + //Determine if we are dealing with a general template or a specific [for that phone only] template (custom =0 means general) + if ($custom == 0) { + $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_template_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_product_list.short_name, endpointman_product_list.id as product_id, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = " . $id; + } else { + $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_line_list.*, endpointman_model_list.id as model_id, endpointman_model_list.template_data, endpointman_product_list.id as product_id, endpointman_product_list.short_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list, endpointman_line_list WHERE endpointman_mac_list.id=" . $id . " AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; + } + + $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $this->tpl->assign("template_editor_display", 1); + echo $this->tpl->draw('global_header'); + //Let the template system know if we are working with a general template or a specific [for that phone only] template + $this->tpl->assign("custom", $custom); + if ($custom) { + $this->tpl->assign("ext", $row['ext']); + } else { + $this->tpl->assign("template_name", $row['name']); + } + $this->tpl->assign("product", $row['short_name']); + $this->tpl->assign("model", $row['model_name']); + + if ($ma = $this->models_available($row['model_id'], NULL, $row['product_id'])) { + $this->tpl->assign("models_ava", $ma); + } + + if (isset($_REQUEST['maxlines'])) { + $areas = $this->areaAvailable($row['model_id'], $_REQUEST['maxlines']); + } else { + $areas = $this->areaAvailable($row['model_id'], 1); + } + + $this->tpl->assign("area_ava", $areas); + //Start the display of the html file in the product folder + if ($row['config_files_override'] == "") { + $config_files_saved = ""; + } else { + $config_files_saved = unserialize($row['config_files_override']); + } + $config_files_list = explode(",", $row['config_files']); + $i = 0; + $alt = 0; + + $i = 0; + $b = 0; + $only_configs = array(); + foreach ($config_files_list as $files) { + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $row['product_id'] . "' AND original_name = '" . $files . "'"; + $alt_configs_list_count = $this->eda->sql($sql); + if ($alt_configs_list_count->numRows() > 0) { + $alt_configs_list = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $alt_configs[$i]['name'] = $files; + $files = str_replace(".", "_", $files); + $h = 0; + foreach ($alt_configs_list as $ccf) { + $alt_configs[$i]['list'][$h]['id'] = $ccf['id']; + $cf_key = $files; + if ((isset($config_files_saved[$cf_key])) AND (is_array($config_files_saved)) AND ($config_files_saved[$cf_key] == $ccf['id'])) { + $alt_configs[$i]['list'][$h]['selected'] = 'selected'; + } + $alt_configs[$i]['list'][$h]['name'] = $ccf['name']; + $h++; + } + $alt = 1; + } else { + $only_configs[$b]['name'] = $files; + $b++; + } + $i++; + } + + $this->tpl->assign("only_configs", $only_configs); + $this->tpl->assign("alt_configs", $alt_configs); + $this->tpl->assign("alt", $alt); + if (!isset($_REQUEST['maxlines'])) { + $maxlines = 1; + } else { + $maxlines = $_REQUEST['maxlines']; + } + if ($row['template_data'] != "") { + $out = $this->generate_gui_html($row['template_data'], $row['global_custom_cfg_data'], TRUE, NULL, $maxlines); + } else { + echo "No Template Data has been defined for this Product
      "; + } + + $this->tpl->assign("template_editor", $out); + $this->tpl->assign("hidden_id", $row['id']); + $this->tpl->assign("hidden_custom", $custom); + echo $this->tpl->draw('template_editor'); + + $this->tpl->assign("debug", ""); + } + + /** + * Generates the Visual Display for the end user + * @param $cfg_data + * @param $custom_cfg_data + * @param $admin + * @param $user_cfg_data + * @return + */ + function generate_gui_html($cfg_data, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $max_lines=3, $ext=NULL) { + //take the data out of the database and turn it back into an array for use + $cfg_data = unserialize($cfg_data); + $template_type = 'GENERAL'; + //Check to see if there is a custom template for this phone already listed in the endpointman_mac_list database + if (!empty($custom_cfg_data)) { + $custom_cfg_data = unserialize($custom_cfg_data); + if (array_key_exists('data', $custom_cfg_data)) { + if (array_key_exists('ari', $custom_cfg_data)) { + $extra_data = $custom_cfg_data['ari']; + } else { + $template_type = 'GLOBAL'; + $extra_data = $custom_cfg_data['freepbx']; + } + $custom_cfg_data = $custom_cfg_data['data']; + } else { + $extra_data = array(); + } + } else { + $custom_cfg_data = array(); + $extra_data = array(); + } + if (isset($user_cfg_data)) { + $user_cfg_data = unserialize($user_cfg_data); + } + + $template_variables_array = array(); + $group_count = 0; + $variables_count = 0; + + foreach ($cfg_data['data'] as $cats_name => $cats) { + if ($admin) { + $group_count++; + $template_variables_array[$group_count]['title'] = $cats_name; + } else { + //Group all ARI stuff into one tab + $template_variables_array[$group_count]['title'] = "Your Phone Settings"; + } + foreach ($cats as $subcat_name => $subcats) { + foreach ($subcats as $item_var => $config_options) { + if (preg_match('/(.*)\|(.*)/i', $item_var, $matches)) { + $type = $matches[1]; + $variable = $matches[2]; + } else { + die('no matches!'); + } + if ($admin) { + //Administration View Only + switch ($type) { + case "lineloop": + //line|1|display_name + foreach ($config_options as $var_name => $var_items) { + $lcount = isset($var_items['line_count']) ? $var_items['line_count'] : $lcount; + $key = "line|" . $lcount . "|" . $var_name; + $items[$variables_count] = $items; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; + $variables_count++; + } + + if ($lcount <= $max_lines) { + $template_variables_array[$group_count]['title'] = "Line Options for Line " . $lcount; + $group_count++; + } else { + unset($template_variables_array[$group_count]); + } + + continue 2; + case "loop": + foreach ($config_options as $var_name => $var_items) { + //loop|remotephonebook_url_0 + $tv = explode('_', $variable); + $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; + $items[$variables_count] = $var_items; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; + $variables_count++; + } + continue 2; + } + } else { + //ARI View Only + switch ($type) { + case "loop_line_options": + //$a is the line number + $sql = "SELECT line FROM endpointman_line_list WHERE ext = " . $ext; + $a = $this->eda->sql($sql, 'getOne'); + //TODO: fix this area + $template_variables_array[$group_count]['data'][$variables_count]['type'] = "break"; + $variables_count++; + continue 2; + case "loop": + foreach ($config_options as $var_name => $var_items) { + $tv = explode('_', $variable); + $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; + if (isset($extra_data[$key])) { + $items[$variables_count] = $var_items; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; + $variables_count++; + } + } + continue 2; + } + } + //Both Views + switch ($config_options['type']) { + case "break": + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $variables_count++; + break; + default: + if (array_key_exists('variable', $config_options)) { + $key = str_replace('$', '', $config_options['variable']); + //TODO: Move this into the sync function + //Checks to see if values are defined in the database, if not then we assume this is a new option and we need a default value here! + if (!isset($custom_cfg_data[$key])) { + //xml2array will take values that have no data and turn them into arrays, we want to avoid the word 'array' as a default value, so we blank it out here if we are an array + if ((array_key_exists('default_value', $config_options)) AND (is_array($config_options['default_value']))) { + $custom_cfg_data[$key] = ""; + } elseif ((array_key_exists('default_value', $config_options)) AND (!is_array($config_options['default_value']))) { + $custom_cfg_data[$key] = $config_options['default_value']; + } + } + if ((!$admin) AND (isset($extra_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $variables_count++; + } elseif ($admin) { + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $variables_count++; + } + } + break; + } + continue; + } + } + } + + return($template_variables_array); + } + + /** + * Generate an array that will get parsed as HTML from an array of values from XML + * @param int $i + * @param array $cfg_data + * @param string $key + * @param array $custom_cfg_data + * @return array + */ + function generate_form_data($i, $cfg_data, $key=NULL, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $extra_data=NULL, $template_type='GENERAL') { + switch ($cfg_data['type']) { + case "input": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $template_variables_array['type'] = "input"; + if (isset($cfg_data['max_chars'])) { + $template_variables_array['max_chars'] = $cfg_data['max_chars']; + } + $template_variables_array['key'] = $key; + $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['description'] = $cfg_data['description']; + break; + case "radio": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['type'] = "radio"; + $template_variables_array['key'] = $key; + $template_variables_array['description'] = $cfg_data['description']; + $z = 0; + while ($z < count($cfg_data['data'])) { + $template_variables_array['data'][$z]['key'] = $key; + $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; + $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; + if ($cfg_data['data'][$z]['value'] == $num) { + $template_variables_array['data'][$z]['checked'] = 'checked'; + } + $z++; + } + break; + case "list": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['type'] = "list"; + $template_variables_array['key'] = $key; + $template_variables_array['description'] = $cfg_data['description']; + $z = 0; + while ($z < count($cfg_data['data'])) { + $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; + $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; + if (isset($cfg_data['data'][$z]['disable'])) { + $cfg_data['data'][$z]['disable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['disable']); + $template_variables_array['data'][$z]['disables'] = explode(",", $cfg_data['data'][$z]['disable']); + } + if (isset($cfg_data['data'][$z]['enable'])) { + $cfg_data['data'][$z]['enable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['enable']); + $template_variables_array['data'][$z]['enables'] = explode(",", $cfg_data['data'][$z]['enable']); + } + if ($cfg_data['data'][$z]['value'] == $num) { + $template_variables_array['data'][$z]['selected'] = 'selected'; + } + $z++; + } + break; + case "checkbox": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['type'] = "checkbox"; + $template_variables_array['key'] = $key; + $template_variables_array['description'] = $cfg_data['description']; + $template_variables_array['checked'] = $custom_cfg_data[$key] ? TRUE : NULL; + $template_variables_array['value'] = $key; + break; + case "group"; + $template_variables_array['type'] = "group"; + $template_variables_array['description'] = $cfg_data['description']; + break; + case "header"; + $template_variables_array['type'] = "header"; + $template_variables_array['description'] = $cfg_data['description']; + break; + case "textarea": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $template_variables_array['type'] = "textarea"; + if (isset($cfg_data['rows'])) { + $template_variables_array['rows'] = $cfg_data['rows']; + } + if (isset($cfg_data['cols'])) { + $template_variables_array['cols'] = $cfg_data['cols']; + } + $template_variables_array['key'] = $key; + $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['description'] = $cfg_data['description']; + break; + case "break": + if ($admin) { + $template_variables_array['type'] = "break"; + } else { + $template_variables_array['type'] = "NA"; + } + break; + default: + $template_variables_array['type'] = "NA"; + break; + } + + if (isset($cfg_data['tooltip'])) { + $template_variables_array['tooltip'] = htmlentities($cfg_data['tooltip']); + } + + if (($this->global_cfg['enable_ari']) AND ($admin) AND ($cfg_data['type'] != "break") AND ($cfg_data['type'] != "group") AND ($template_type == 'GENERAL')) { + + $template_variables_array['aried'] = 1; + $template_variables_array['ari']['key'] = $key; + + if (isset($extra_data[$key])) { + $template_variables_array['ari']['checked'] = "checked"; + } + } + + if ($template_type == 'GLOBAL') { + $template_variables_array['freepbxed'] = 1; + $template_variables_array['freepbx']['key'] = $key; + if (empty($extra_data)) { + $template_variables_array['freepbx']['checked'] = TRUE; + } elseif (isset($extra_data[$key])) { + $template_variables_array['freepbx']['checked'] = TRUE; + } + } + return($template_variables_array); + } + + /** + * Save template from the template view pain + * @param int $id Either the MAC ID or Template ID + * @param int $custom Either 0 or 1, it determines if $id is MAC ID or Template ID + * @param array $variables The variables sent from the form. usually everything in $_REQUEST[] + * @return string Location of area to return to in Endpoint Manager + */ + function save_template($id, $custom, $variables) { + //Custom Means specific to that MAC + //This function is reversed. Not sure why + if ($custom != "0") { + $sql = "SELECT endpointman_model_list.max_lines, endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_product_list.id as product_id, endpointman_product_list.long_name, endpointman_model_list.template_data, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_mac_list.id=" . $id . " AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; + } else { + $sql = "SELECT endpointman_model_list.max_lines, endpointman_brand_list.directory, endpointman_product_list.cfg_dir, endpointman_product_list.config_files, endpointman_product_list.long_name, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_brand_list, endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_brand_list.id = endpointman_product_list.brand AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = " . $id; + } + + //Load template data + $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + $cfg_data = unserialize($row['template_data']); + $count = count($cfg_data); + + $custom_cfg_data_ari = array(); + + foreach ($cfg_data['data'] as $cats) { + foreach ($cats as $items) { + foreach ($items as $key_name => $config_options) { + if (preg_match('/(.*)\|(.*)/i', $key_name, $matches)) { + $type = $matches[1]; + $key = $matches[2]; + } else { + die('invalid'); + } + switch ($type) { + case "loop": + $stuffing = explode("_", $key); + $key2 = $stuffing[0]; + foreach ($config_options as $item_key => $item_data) { + $lc = isset($item_data['loop_count']) ? $item_data['loop_count'] : ''; + $key = 'loop|' . $key2 . '_' . $item_key . '_' . $lc; + if ((isset($item_data['loop_count'])) AND (isset($_REQUEST[$key]))) { + $custom_cfg_data[$key] = $_REQUEST[$key]; + $ari_key = "ari_" . $key; + if (isset($_REQUEST[$ari_key])) { + if ($_REQUEST[$ari_key] == "on") { + $custom_cfg_data_ari[$key] = 1; + } + } + } + } + break; + case "lineloop": + foreach ($config_options as $item_key => $item_data) { + $lc = isset($item_data['line_count']) ? $item_data['line_count'] : ''; + $key = 'line|' . $lc . '|' . $item_key; + if ((isset($item_data['line_count'])) AND (isset($_REQUEST[$key]))) { + $custom_cfg_data[$key] = $_REQUEST[$key]; + $ari_key = "ari_" . $key; + if (isset($_REQUEST[$ari_key])) { + if ($_REQUEST[$ari_key] == "on") { + $custom_cfg_data_ari[$key] = 1; + } + } + } + } + break; + case "option": + if (isset($_REQUEST[$key])) { + $custom_cfg_data[$key] = $_REQUEST[$key]; + $ari_key = "ari_" . $key; + if (isset($_REQUEST[$ari_key])) { + if ($_REQUEST[$ari_key] == "on") { + $custom_cfg_data_ari[$key] = 1; + } + } + } + break; + default: + break; + } + } + } + } + + $config_files = explode(",", $row['config_files']); + + $i = 0; + while ($i < count($config_files)) { + $config_files[$i] = str_replace(".", "_", $config_files[$i]); + if (isset($_REQUEST[$config_files[$i]])) { + $_REQUEST[$config_files[$i]] = explode("_", $_REQUEST[$config_files[$i]], 2); + $_REQUEST[$config_files[$i]] = $_REQUEST[$config_files[$i]][0]; + if ($_REQUEST[$config_files[$i]] > 0) { + $config_files_selected[$config_files[$i]] = $_REQUEST[$config_files[$i]]; + } + } + $i++; + } + + if (!isset($config_files_selected)) { + $config_files_selected = ""; + } else { + $config_files_selected = serialize($config_files_selected); + } + $custom_cfg_data_temp['data'] = $custom_cfg_data; + $custom_cfg_data_temp['ari'] = $custom_cfg_data_ari; + + $save = serialize($custom_cfg_data_temp); + + if ($custom == "0") { + $sql = 'UPDATE endpointman_template_list SET config_files_override = \'' . addslashes($config_files_selected) . '\', global_custom_cfg_data = \'' . addslashes($save) . '\' WHERE id =' . $id; + $location = "template_manager"; + } else { + $sql = 'UPDATE endpointman_mac_list SET config_files_override = \'' . addslashes($config_files_selected) . '\', template_id = 0, global_custom_cfg_data = \'' . addslashes($save) . '\' WHERE id =' . $id; + $location = "devices_manager"; + } + + $this->eda->sql($sql); + + $phone_info = array(); + + if ($custom != 0) { + $phone_info = $this->get_phone_info($id); + if (isset($_REQUEST['epm_reboot'])) { + $this->prepare_configs($phone_info); + } else { + $this->prepare_configs($phone_info, FALSE); + } + } else { + $sql = 'SELECT id FROM endpointman_mac_list WHERE template_id = ' . $id; + $phones = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + foreach ($phones as $data) { + $phone_info = $this->get_phone_info($data['id']); + if (isset($_REQUEST['epm_reboot'])) { + $this->prepare_configs($phone_info); + } else { + $this->prepare_configs($phone_info, FALSE); + } + } + } + + if (isset($_REQUEST['silent_mode'])) { + echo ''; + } else { + return($location); + } + } + + + + function display_configs() { + + } + + + +} +?> diff --git a/bin/freepbx_engine_hook_endpointman b/bin/freepbx_engine_hook_endpointman old mode 100755 new mode 100644 diff --git a/includes/functions.inc b/includes/functions.inc index ea27a905..bee8c5b0 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -40,7 +40,7 @@ class endpointmanager { $this->global_cfg['disable_epm'] = FALSE; $this->global_cfg['tz'] = !empty($this->global_cfg['tz']) ? $this->global_cfg['tz'] : 'America/Los_Angeles'; - date_default_timezone_set($this->global_cfg['tz']); + //date_default_timezone_set($this->global_cfg['tz']); //Generate empty array $this->error = array(); @@ -54,21 +54,21 @@ class endpointmanager { $this->global_cfg['disable_epm'] = TRUE; } - define("UPDATE_PATH", $this->global_cfg['update_server']); - define("MODULES_PATH", dirname(dirname(dirname(__FILE__))) . '/'); + //define("UPDATE_PATH", $this->global_cfg['update_server']); + //define("MODULES_PATH", dirname(dirname(dirname(__FILE__))) . '/'); //Determine if local path is correct! if (file_exists(MODULES_PATH . "endpointman/")) { - define("LOCAL_PATH", MODULES_PATH . "endpointman/"); + //define("LOCAL_PATH", MODULES_PATH . "endpointman/"); } else { die("Can't Load Local Endpoint Manager Directory!"); } //Define the location of phone modules, keeping it outside of the module directory so that when the user updates endpointmanager they don't lose all of their phones if (file_exists(MODULES_PATH . "_ep_phone_modules/")) { - define("PHONE_MODULES_PATH", MODULES_PATH . "_ep_phone_modules/"); + //define("PHONE_MODULES_PATH", MODULES_PATH . "_ep_phone_modules/"); } else { - define("PHONE_MODULES_PATH", MODULES_PATH . "_ep_phone_modules/"); + //define("PHONE_MODULES_PATH", MODULES_PATH . "_ep_phone_modules/"); if (!file_exists(PHONE_MODULES_PATH)) { mkdir(PHONE_MODULES_PATH, 0775); } diff --git a/install.php b/install.php index 15f0eac8..e83bba78 100644 --- a/install.php +++ b/install.php @@ -1038,9 +1038,12 @@ function find_exec($exec) { $db->query($sql); out('Creating symlink to web provisioner'); - if (!symlink(LOCAL_PATH . "provisioning", $amp_conf['AMPWEBROOT'] . "/provisioning")) { - //out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); - } + if(!file_exists($amp_conf['AMPWEBROOT'] . "/provisioning")) { + if (!symlink(LOCAL_PATH . "provisioning", $amp_conf['AMPWEBROOT'] . "/provisioning")) { + //out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); + } + } + } out("Update Version Number to " . $epmxmlversion); diff --git a/lib/epm_system.class.php b/lib/epm_system.class.php index 4873ce8a..6dea508a 100644 --- a/lib/epm_system.class.php +++ b/lib/epm_system.class.php @@ -20,7 +20,7 @@ function display_htmlspecialchars($contents) { * @author http://www.php.net/manual/en/function.socket-create.php#43057 * @param string $host * @param string $filename - * @return mixed file contents + * @return mixed file contents */ function tftp_fetch($host, $filename) { //first off let's check if this is installed or disabled @@ -55,7 +55,7 @@ function tftp_fetch($host, $filename) { } while (strlen($buffer) == 516); // the first non-full packet is the last. return $ret; } - + /** * The RecursiveIteratorIterator must be told to provide children (files and subdirectories) before parents with its CHILD_FIRST constant. * Using RecursiveIteratorIterator is the only way PHP is able to see hidden files. @@ -77,7 +77,7 @@ function rmrf($dir) { @rmdir($dir); } } - + /** * Uses which to find executables that asterisk can run/use * @version 2.11 @@ -96,7 +96,7 @@ function find_exec($exec) { return(''); } } - + /** * Downloads a file and places it in the destination defined * @version 2.11 @@ -138,7 +138,7 @@ function download_file($url_file, $destination_file) { return false; } } - + /** * Downloads a file and places it in the destination defined with progress * @version 2.11 @@ -156,24 +156,26 @@ function download_file_with_progress_bar($url_file, $destination_file) { while ($this->is_process_running($pid)) { - $out = 100 * round(filesize($destination_file) / $size, 2); - echo ''; + if(file_exists($destination_file)) { + $out = 100 * round(filesize($destination_file) / $size, 2); + echo ''; + } usleep('500'); ob_end_flush(); //ob_flush(); flush(); ob_start(); - - clearstatcache(); // make sure PHP actually checks dest. file size + + clearstatcache(); // make sure PHP actually checks dest. file size } return true; } else { return false; } } - + /** * Taken from http://www.php.net/manual/en/function.array-search.php#69232 * search haystack for needle and return an array of the key path, FALSE otherwise. @@ -229,4 +231,4 @@ function is_process_running($PID) { exec("ps $PID", $ProcessState); return(count($ProcessState) >= 2); } -} \ No newline at end of file +} From 4a0af6e063649ada3c9cc5048bcf546e4fd9a716 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 3 Mar 2016 11:02:29 -0800 Subject: [PATCH 437/623] [Module Tag script: endpointman 13.0.6.6] --- i18n/bg/LC_MESSAGES/endpointman.mo | Bin 603 -> 603 bytes i18n/bg/LC_MESSAGES/endpointman.po | 34 +++++++++++------------ i18n/de_DE/LC_MESSAGES/endpointman.mo | Bin 1001 -> 1001 bytes i18n/de_DE/LC_MESSAGES/endpointman.po | 34 +++++++++++------------ i18n/endpointman.pot | 38 +++++++++++++------------- i18n/es_ES/LC_MESSAGES/endpointman.mo | Bin 19217 -> 19217 bytes i18n/es_ES/LC_MESSAGES/endpointman.po | 34 +++++++++++------------ i18n/he_IL/LC_MESSAGES/endpointman.mo | Bin 367 -> 367 bytes i18n/he_IL/LC_MESSAGES/endpointman.po | 34 +++++++++++------------ i18n/ja_JP/LC_MESSAGES/endpointman.mo | Bin 3438 -> 3438 bytes i18n/ja_JP/LC_MESSAGES/endpointman.po | 34 +++++++++++------------ i18n/ru_RU/LC_MESSAGES/endpointman.mo | Bin 496 -> 496 bytes i18n/ru_RU/LC_MESSAGES/endpointman.po | 34 +++++++++++------------ i18n/zh_CN/LC_MESSAGES/endpointman.mo | Bin 420 -> 420 bytes i18n/zh_CN/LC_MESSAGES/endpointman.po | 34 +++++++++++------------ module.xml | 3 +- 16 files changed, 140 insertions(+), 139 deletions(-) diff --git a/i18n/bg/LC_MESSAGES/endpointman.mo b/i18n/bg/LC_MESSAGES/endpointman.mo index c3ba3f079c0228c08f19c8b681dd4f69b9d48b4f..0d32020aee323a36c5b278c6732d41fec1378765 100644 GIT binary patch delta 15 Xcmcc3a+_tsRu)4m1H+9w7cl|=F*pU` delta 15 Xcmcc3a+_tsRu%&*6O)ZQ7cl|=F;@lW diff --git a/i18n/bg/LC_MESSAGES/endpointman.po b/i18n/bg/LC_MESSAGES/endpointman.po index 85c39c3a..ce1eb539 100644 --- a/i18n/bg/LC_MESSAGES/endpointman.po +++ b/i18n/bg/LC_MESSAGES/endpointman.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: FreePBX\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-03-03 10:44-0800\n" +"POT-Creation-Date: 2016-03-03 11:01-0800\n" "PO-Revision-Date: 2014-07-22 15:41+0200\n" "Last-Translator: Chavdar \n" "Language-Team: Bulgarian \n" "Language-Team: German \n" "Language-Team: LANGUAGE \n" @@ -475,7 +475,7 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3781 +#: Endpointman.class.php:3782 msgid "Failed to write file to disk" msgstr "" @@ -500,7 +500,7 @@ msgstr "" msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3783 +#: Endpointman.class.php:3784 msgid "File upload stopped by extension" msgstr "" @@ -697,7 +697,7 @@ msgstr "" msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3567 +#: Endpointman.class.php:3568 msgid "Invalid MAC Address" msgstr "" @@ -705,7 +705,7 @@ msgstr "" msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3562 +#: Endpointman.class.php:3563 msgid "Invalid Model Selected, Can't Sync System" msgstr "" @@ -822,7 +822,7 @@ msgstr "" msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3779 +#: Endpointman.class.php:3780 msgid "Missing a temporary folder" msgstr "" @@ -890,8 +890,8 @@ msgstr "" msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3600 -#: Endpointman.class.php:3618 +#: Endpointman.class.php:3601 +#: Endpointman.class.php:3619 msgid "No Devices/Extensions Left to Add" msgstr "" @@ -903,8 +903,8 @@ msgstr "" msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3604 -#: Endpointman.class.php:3622 +#: Endpointman.class.php:3605 +#: Endpointman.class.php:3623 msgid "No Lines Left to Add" msgstr "" @@ -917,7 +917,7 @@ msgstr "" msgid "No Selected" msgstr "" -#: Endpointman.class.php:3777 +#: Endpointman.class.php:3778 msgid "No file was uploaded" msgstr "" @@ -1296,17 +1296,17 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3773 +#: Endpointman.class.php:3774 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3771 +#: Endpointman.class.php:3772 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3775 +#: Endpointman.class.php:3776 msgid "The uploaded file was only partially uploaded" msgstr "" @@ -1364,7 +1364,7 @@ msgstr "" msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3917 +#: Endpointman.class.php:3918 msgid "Unknown" msgstr "" @@ -1372,7 +1372,7 @@ msgstr "" msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3785 +#: Endpointman.class.php:3786 msgid "Unknown upload error" msgstr "" @@ -1465,15 +1465,15 @@ msgid "" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3499 +#: Endpointman.class.php:3500 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3502 +#: Endpointman.class.php:3503 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4945 +#: Endpointman.class.php:4946 msgid "You can't remove the only line left" msgstr "" diff --git a/i18n/es_ES/LC_MESSAGES/endpointman.mo b/i18n/es_ES/LC_MESSAGES/endpointman.mo index db5dde6e61d80b2b121b47c11387da6f40a99ab8..832fdf588483bae6c913daa23b3fe8982a135109 100644 GIT binary patch delta 19 bcmbO@jd9{M#tpLCEQVGFhMN_&Kga_BKq>|& delta 19 bcmbO@jd9{M#tpLCECyC4CYu$tKga_BKu-oO diff --git a/i18n/es_ES/LC_MESSAGES/endpointman.po b/i18n/es_ES/LC_MESSAGES/endpointman.po index 7ad31818..77e3b665 100644 --- a/i18n/es_ES/LC_MESSAGES/endpointman.po +++ b/i18n/es_ES/LC_MESSAGES/endpointman.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-03-03 10:44-0800\n" +"POT-Creation-Date: 2016-03-03 11:01-0800\n" "PO-Revision-Date: 2016-02-17 22:48+0100\n" "Last-Translator: Javier Pastor \n" "Language-Team: \n" @@ -459,7 +459,7 @@ msgstr "" msgid "Failed to install " msgstr "Fallo de installacion" -#: Endpointman.class.php:3781 +#: Endpointman.class.php:3782 msgid "Failed to write file to disk" msgstr "" @@ -483,7 +483,7 @@ msgstr "¡Archivo no encontrado!" msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3783 +#: Endpointman.class.php:3784 msgid "File upload stopped by extension" msgstr "" @@ -683,7 +683,7 @@ msgstr "" msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "Inválida estructura JSON en %_PATCH _%/brand_data.json" -#: Endpointman.class.php:3567 +#: Endpointman.class.php:3568 msgid "Invalid MAC Address" msgstr "Direccion MAC no valida" @@ -691,7 +691,7 @@ msgstr "Direccion MAC no valida" msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3562 +#: Endpointman.class.php:3563 msgid "Invalid Model Selected, Can't Sync System" msgstr "Seleccionada Modelo no válido, no puede Sistema de sincronización" @@ -804,7 +804,7 @@ msgstr "Correcto!" msgid "Maximum stack depth exceeded" msgstr "Superó capacidad de la pila máximo" -#: Endpointman.class.php:3779 +#: Endpointman.class.php:3780 msgid "Missing a temporary folder" msgstr "" @@ -877,7 +877,7 @@ msgstr "" msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3600 Endpointman.class.php:3618 +#: Endpointman.class.php:3601 Endpointman.class.php:3619 msgid "No Devices/Extensions Left to Add" msgstr "No hay dispositivos / Extensiones a la izquierdo para Añadir" @@ -889,7 +889,7 @@ msgstr "" msgid "No ID set!" msgstr "No se ha enviado ID!" -#: Endpointman.class.php:3604 Endpointman.class.php:3622 +#: Endpointman.class.php:3605 Endpointman.class.php:3623 msgid "No Lines Left to Add" msgstr "No hay líneas de a la izquierdo para Añadir" @@ -902,7 +902,7 @@ msgstr "" msgid "No Selected" msgstr "No Seleccionado" -#: Endpointman.class.php:3777 +#: Endpointman.class.php:3778 msgid "No file was uploaded" msgstr "No se ha cargado el fichero" @@ -1278,17 +1278,17 @@ msgstr "" "
      El boton \"Actualizar\" aparece cuando se detecta una nueva version " "de Paquete de este modelo." -#: Endpointman.class.php:3773 +#: Endpointman.class.php:3774 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3771 +#: Endpointman.class.php:3772 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3775 +#: Endpointman.class.php:3776 msgid "The uploaded file was only partially uploaded" msgstr "" @@ -1346,7 +1346,7 @@ msgstr "Desisntalando Marca..." msgid "Uninstalla frimware..." msgstr "Desisntalando Frimware..." -#: Endpointman.class.php:3917 +#: Endpointman.class.php:3918 msgid "Unknown" msgstr "Desconocido" @@ -1354,7 +1354,7 @@ msgstr "Desconocido" msgid "Unknown error" msgstr "Error desconocido." -#: Endpointman.class.php:3785 +#: Endpointman.class.php:3786 msgid "Unknown upload error" msgstr "Error al subir Desconocido" @@ -1450,15 +1450,15 @@ msgstr "" "También puede actualizar manualmente el repositorio mediante la descarga de " "archivos aquí: %_URL_INI_% de lanzamiento Repo %_URL_END_%" -#: Endpointman.class.php:3499 +#: Endpointman.class.php:3500 msgid "You Must Select A Model From the Drop Down" msgstr "Usted debe seleccionar un modelo de la gota de Down" -#: Endpointman.class.php:3502 +#: Endpointman.class.php:3503 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "Tu deves seleeciona una Extension/Disposito de listado de abajo" -#: Endpointman.class.php:4945 +#: Endpointman.class.php:4946 msgid "You can't remove the only line left" msgstr "No se puede quitar la única línea de la izquierda" diff --git a/i18n/he_IL/LC_MESSAGES/endpointman.mo b/i18n/he_IL/LC_MESSAGES/endpointman.mo index 20d6dd77e15697e533596b8602535b69fb5e809a..01a8f362c249d67c54aa55d4e654a18d1230ab30 100644 GIT binary patch delta 14 WcmaFQ^qy(LWEMj!1H*~aZvX%*j|J8M delta 14 WcmaFQ^qy(LWEKM}6O)P4ZvX%*s0G{r diff --git a/i18n/he_IL/LC_MESSAGES/endpointman.po b/i18n/he_IL/LC_MESSAGES/endpointman.po index 709eebae..62952dd5 100644 --- a/i18n/he_IL/LC_MESSAGES/endpointman.po +++ b/i18n/he_IL/LC_MESSAGES/endpointman.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-03-03 10:44-0800\n" +"POT-Creation-Date: 2016-03-03 11:01-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -456,7 +456,7 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3781 +#: Endpointman.class.php:3782 msgid "Failed to write file to disk" msgstr "" @@ -480,7 +480,7 @@ msgstr "" msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3783 +#: Endpointman.class.php:3784 msgid "File upload stopped by extension" msgstr "" @@ -671,7 +671,7 @@ msgstr "" msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3567 +#: Endpointman.class.php:3568 msgid "Invalid MAC Address" msgstr "" @@ -679,7 +679,7 @@ msgstr "" msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3562 +#: Endpointman.class.php:3563 msgid "Invalid Model Selected, Can't Sync System" msgstr "" @@ -792,7 +792,7 @@ msgstr "" msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3779 +#: Endpointman.class.php:3780 msgid "Missing a temporary folder" msgstr "" @@ -859,7 +859,7 @@ msgstr "" msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3600 Endpointman.class.php:3618 +#: Endpointman.class.php:3601 Endpointman.class.php:3619 msgid "No Devices/Extensions Left to Add" msgstr "" @@ -871,7 +871,7 @@ msgstr "" msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3604 Endpointman.class.php:3622 +#: Endpointman.class.php:3605 Endpointman.class.php:3623 msgid "No Lines Left to Add" msgstr "" @@ -884,7 +884,7 @@ msgstr "" msgid "No Selected" msgstr "" -#: Endpointman.class.php:3777 +#: Endpointman.class.php:3778 msgid "No file was uploaded" msgstr "" @@ -1245,17 +1245,17 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3773 +#: Endpointman.class.php:3774 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3771 +#: Endpointman.class.php:3772 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3775 +#: Endpointman.class.php:3776 msgid "The uploaded file was only partially uploaded" msgstr "" @@ -1313,7 +1313,7 @@ msgstr "" msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3917 +#: Endpointman.class.php:3918 msgid "Unknown" msgstr "" @@ -1321,7 +1321,7 @@ msgstr "" msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3785 +#: Endpointman.class.php:3786 msgid "Unknown upload error" msgstr "" @@ -1413,15 +1413,15 @@ msgid "" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3499 +#: Endpointman.class.php:3500 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3502 +#: Endpointman.class.php:3503 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4945 +#: Endpointman.class.php:4946 msgid "You can't remove the only line left" msgstr "" diff --git a/i18n/ja_JP/LC_MESSAGES/endpointman.mo b/i18n/ja_JP/LC_MESSAGES/endpointman.mo index 6a49d452e4cc25c575a5052d26f1f774e4a78f46..ce9730e94f0e8190ab6e5a52eab5888aa16e3468 100644 GIT binary patch delta 17 YcmaDS^-gL-Av=qqm4V^rQud#$06gplHUIzs delta 17 YcmaDS^-gL-Av=qKm5IsbQud#$06h@~JOBUy diff --git a/i18n/ja_JP/LC_MESSAGES/endpointman.po b/i18n/ja_JP/LC_MESSAGES/endpointman.po index a5209b76..c3371078 100644 --- a/i18n/ja_JP/LC_MESSAGES/endpointman.po +++ b/i18n/ja_JP/LC_MESSAGES/endpointman.po @@ -37,7 +37,7 @@ msgid "" msgstr "" "Project-Id-Version: FreePBX endpointman\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-03-03 10:44-0800\n" +"POT-Creation-Date: 2016-03-03 11:01-0800\n" "PO-Revision-Date: 2014-02-24 06:17+0200\n" "Last-Translator: Kenichi Fukaumi \n" "Language-Team: Japanese \n" "Language-Team: Russian\n" @@ -456,7 +456,7 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3781 +#: Endpointman.class.php:3782 msgid "Failed to write file to disk" msgstr "" @@ -480,7 +480,7 @@ msgstr "" msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3783 +#: Endpointman.class.php:3784 msgid "File upload stopped by extension" msgstr "" @@ -671,7 +671,7 @@ msgstr "" msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3567 +#: Endpointman.class.php:3568 msgid "Invalid MAC Address" msgstr "" @@ -679,7 +679,7 @@ msgstr "" msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3562 +#: Endpointman.class.php:3563 msgid "Invalid Model Selected, Can't Sync System" msgstr "" @@ -792,7 +792,7 @@ msgstr "" msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3779 +#: Endpointman.class.php:3780 msgid "Missing a temporary folder" msgstr "" @@ -859,7 +859,7 @@ msgstr "" msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3600 Endpointman.class.php:3618 +#: Endpointman.class.php:3601 Endpointman.class.php:3619 msgid "No Devices/Extensions Left to Add" msgstr "" @@ -871,7 +871,7 @@ msgstr "" msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3604 Endpointman.class.php:3622 +#: Endpointman.class.php:3605 Endpointman.class.php:3623 msgid "No Lines Left to Add" msgstr "" @@ -884,7 +884,7 @@ msgstr "" msgid "No Selected" msgstr "" -#: Endpointman.class.php:3777 +#: Endpointman.class.php:3778 msgid "No file was uploaded" msgstr "" @@ -1245,17 +1245,17 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3773 +#: Endpointman.class.php:3774 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3771 +#: Endpointman.class.php:3772 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3775 +#: Endpointman.class.php:3776 msgid "The uploaded file was only partially uploaded" msgstr "" @@ -1313,7 +1313,7 @@ msgstr "" msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3917 +#: Endpointman.class.php:3918 msgid "Unknown" msgstr "" @@ -1321,7 +1321,7 @@ msgstr "" msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3785 +#: Endpointman.class.php:3786 msgid "Unknown upload error" msgstr "" @@ -1413,15 +1413,15 @@ msgid "" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3499 +#: Endpointman.class.php:3500 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3502 +#: Endpointman.class.php:3503 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4945 +#: Endpointman.class.php:4946 msgid "You can't remove the only line left" msgstr "" diff --git a/i18n/zh_CN/LC_MESSAGES/endpointman.mo b/i18n/zh_CN/LC_MESSAGES/endpointman.mo index 2288cda57d31b405c57c205f739e33f971e68ea5..0a9a1719715a0c8b3990203dfb3f000d1af72fed 100644 GIT binary patch delta 14 WcmZ3&yo7neUKT?u1H*|29|Hg-;sv1q delta 14 WcmZ3&yo7neUKRr@6O)Mt9|Hg-`vs=} diff --git a/i18n/zh_CN/LC_MESSAGES/endpointman.po b/i18n/zh_CN/LC_MESSAGES/endpointman.po index c0766730..c3f18d34 100644 --- a/i18n/zh_CN/LC_MESSAGES/endpointman.po +++ b/i18n/zh_CN/LC_MESSAGES/endpointman.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-03-03 10:44-0800\n" +"POT-Creation-Date: 2016-03-03 11:01-0800\n" "PO-Revision-Date: 2015-02-18 18:42-0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -446,7 +446,7 @@ msgstr "" msgid "Failed to install " msgstr "" -#: Endpointman.class.php:3781 +#: Endpointman.class.php:3782 msgid "Failed to write file to disk" msgstr "" @@ -470,7 +470,7 @@ msgstr "" msgid "File not readable, check the permission! " msgstr "" -#: Endpointman.class.php:3783 +#: Endpointman.class.php:3784 msgid "File upload stopped by extension" msgstr "" @@ -661,7 +661,7 @@ msgstr "" msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" msgstr "" -#: Endpointman.class.php:3567 +#: Endpointman.class.php:3568 msgid "Invalid MAC Address" msgstr "" @@ -669,7 +669,7 @@ msgstr "" msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:3562 +#: Endpointman.class.php:3563 msgid "Invalid Model Selected, Can't Sync System" msgstr "" @@ -782,7 +782,7 @@ msgstr "" msgid "Maximum stack depth exceeded" msgstr "" -#: Endpointman.class.php:3779 +#: Endpointman.class.php:3780 msgid "Missing a temporary folder" msgstr "" @@ -849,7 +849,7 @@ msgstr "" msgid "No Configuration Location Defined!" msgstr "" -#: Endpointman.class.php:3600 Endpointman.class.php:3618 +#: Endpointman.class.php:3601 Endpointman.class.php:3619 msgid "No Devices/Extensions Left to Add" msgstr "" @@ -861,7 +861,7 @@ msgstr "" msgid "No ID set!" msgstr "" -#: Endpointman.class.php:3604 Endpointman.class.php:3622 +#: Endpointman.class.php:3605 Endpointman.class.php:3623 msgid "No Lines Left to Add" msgstr "" @@ -874,7 +874,7 @@ msgstr "" msgid "No Selected" msgstr "" -#: Endpointman.class.php:3777 +#: Endpointman.class.php:3778 msgid "No file was uploaded" msgstr "" @@ -1235,17 +1235,17 @@ msgid "" "of this model pack is detected." msgstr "" -#: Endpointman.class.php:3773 +#: Endpointman.class.php:3774 msgid "" "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " "the HTML form" msgstr "" -#: Endpointman.class.php:3771 +#: Endpointman.class.php:3772 msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgstr "" -#: Endpointman.class.php:3775 +#: Endpointman.class.php:3776 msgid "The uploaded file was only partially uploaded" msgstr "" @@ -1303,7 +1303,7 @@ msgstr "" msgid "Uninstalla frimware..." msgstr "" -#: Endpointman.class.php:3917 +#: Endpointman.class.php:3918 msgid "Unknown" msgstr "" @@ -1311,7 +1311,7 @@ msgstr "" msgid "Unknown error" msgstr "" -#: Endpointman.class.php:3785 +#: Endpointman.class.php:3786 msgid "Unknown upload error" msgstr "" @@ -1403,15 +1403,15 @@ msgid "" "_URL_INI_% Release Repo %_URL_END_%" msgstr "" -#: Endpointman.class.php:3499 +#: Endpointman.class.php:3500 msgid "You Must Select A Model From the Drop Down" msgstr "" -#: Endpointman.class.php:3502 +#: Endpointman.class.php:3503 msgid "You Must Select an Extension/Device From the Drop Down" msgstr "" -#: Endpointman.class.php:4945 +#: Endpointman.class.php:4946 msgid "You can't remove the only line left" msgstr "" diff --git a/module.xml b/module.xml index aeb61701..015957a1 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ endpointman unsupported OSS PBX End Point Manager - 13.0.6.5 + 13.0.6.6 setup Connectivity GPLv2+ @@ -21,6 +21,7 @@ Pull Requests can be made to either of these and are encouraged. + *13.0.6.6* Fix missing files issues *13.0.6.5* Remove array by reference *13.0.6.4* Fix bug, generate file list export brands through AJAX, delete code not required, organize files. *13.0.6.3* Fix bug, optimize code. From cf7a3c0aca9d20b2cf214ebc7db2d2c9983e8e73 Mon Sep 17 00:00:00 2001 From: vsc55 Date: Sat, 5 Mar 2016 23:09:59 +0100 Subject: [PATCH 438/623] More code updated and Fix Bug --- Endpointman.class.php | 3043 ++++++++++----------- assets/css/coda-slider-2.0a.css | 143 +- assets/css/epm_devices.css | 1 + assets/css/epm_templates.css | 1 + assets/js/epm_config.js | 11 +- assets/js/epm_devices.js | 11 + assets/js/epm_global.js | 2 +- assets/js/jquery.coda-slider-3.0.js | 2 +- i18n/es_ES/LC_MESSAGES/endpointman.mo | Bin 19217 -> 22985 bytes i18n/es_ES/LC_MESSAGES/endpointman.po | 2746 +++++++++++-------- install.php | 9 +- lib/Config.class.php | 1 - lib/epm_data_abstraction.class.php | 8 +- lib/epm_system.class.php | 68 +- lib/json.class.php | 4 +- module.xml | 3 +- views/epm_advanced/poce.views.bootnav.php | 5 +- 17 files changed, 3318 insertions(+), 2740 deletions(-) create mode 100644 assets/css/epm_devices.css create mode 100644 assets/css/epm_templates.css create mode 100644 assets/js/epm_devices.js diff --git a/Endpointman.class.php b/Endpointman.class.php index b497f390..98bb9556 100644 --- a/Endpointman.class.php +++ b/Endpointman.class.php @@ -12,16 +12,16 @@ function format_txt($texto = "", $css_class = "", $remplace_txt = array()) { - if (count($remplace_txt) > 0) + if (count($remplace_txt) > 0) { foreach ($remplace_txt as $clave => $valor) { $texto = str_replace($clave, $valor, $texto); } } - return '

      '.$texto.'

      '; + return '

      '.$texto.'

      '; } -function generate_xml_from_array ($array, $node_name, &$tab = -1) +function generate_xml_from_array ($array, $node_name, &$tab = -1) { $tab++; $xml =""; @@ -30,11 +30,11 @@ function generate_xml_from_array ($array, $node_name, &$tab = -1) if (is_numeric($key)) { $key = $node_name; } - + $xml .= str_repeat(" ", $tab). '<' . $key . '>' . "\n"; $xml .= generate_xml_from_array($value, $node_name, $tab); $xml .= str_repeat(" ", $tab). '' . "\n"; - + } } else { $xml = str_repeat(" ", $tab) . htmlspecialchars($array, ENT_QUOTES) . "\n"; @@ -45,20 +45,22 @@ function generate_xml_from_array ($array, $node_name, &$tab = -1) class Endpointman implements \BMO { - - //public $eda; //endpoint data abstraction layer + + public $db; //Database from FreePBX + public $eda; //endpoint data abstraction layer + public $tpl; //Template System Object (RAIN TPL) //public $system; - + public $error; //error construct public $message; //message construct - + public $UPDATE_PATH; public $MODULES_PATH; public $LOCAL_PATH; public $PHONE_MODULES_PATH; public $PROVISIONER_BASE; - - + + public function __construct($freepbx = null) { if ($freepbx == null) { throw new \Exception("Not given a FreePBX Object"); @@ -68,34 +70,34 @@ public function __construct($freepbx = null) { require_once('lib/epm_system.class.php'); require_once('lib/datetimezone.class.php'); require_once('lib/epm_data_abstraction.class.php'); - - + //require_once("lib/RainTPL.class.php"); + $this->freepbx = $freepbx; $this->db = $freepbx->Database; $this->config = $freepbx->Config; $this->configmod = new Endpointman\Config(); $this->system = new epm_system(); $this->eda = new epm_data_abstraction($this->config, $this->configmod); - - + + $this->configmod->set('disable_epm', FALSE); $this->eda->global_cfg = $this->configmod->getall(); - + //Generate empty array $this->error = array(); $this->message = array(); - - + + $this->configmod->set('tz', $this->config->get('PHPTIMEZONE')); date_default_timezone_set($this->configmod->get('tz')); - + $this->UPDATE_PATH = $this->configmod->get('update_server'); $this->MODULES_PATH = $this->config->get('AMPWEBROOT') . '/admin/modules/'; - + define("UPDATE_PATH", $this->UPDATE_PATH); define("MODULES_PATH", $this->MODULES_PATH); - - + + //Determine if local path is correct! if (file_exists($this->MODULES_PATH . "endpointman/")) { $this->LOCAL_PATH = $this->MODULES_PATH . "endpointman/"; @@ -103,7 +105,7 @@ public function __construct($freepbx = null) { } else { die("Can't Load Local Endpoint Manager Directory!"); } - + //Define the location of phone modules, keeping it outside of the module directory so that when the user updates endpointmanager they don't lose all of their phones if (file_exists($this->MODULES_PATH . "_ep_phone_modules/")) { $this->PHONE_MODULES_PATH = $this->MODULES_PATH . "_ep_phone_modules/"; @@ -120,7 +122,7 @@ public function __construct($freepbx = null) { } } define("PHONE_MODULES_PATH", $this->PHONE_MODULES_PATH); - + //Define error reporting if (($this->configmod->get('debug')) AND (!isset($_REQUEST['quietmode']))) { error_reporting(E_ALL); @@ -128,7 +130,7 @@ public function __construct($freepbx = null) { } else { ini_set('display_errors', 0); } - + //Check if config location is writable and/or exists! if ($this->configmod->isExiste('config_location')) { $config_location = $this->configmod->get('config_location'); @@ -148,8 +150,11 @@ public function __construct($freepbx = null) { $this->configmod->set('disable_epm', TRUE); } } + + //$this->tpl = new RainTPL(LOCAL_PATH . '_old/templates/freepbx', LOCAL_PATH . '_old/templates/freepbx/compiled', '/admin/assets/endpointman/images'); + //$this->tpl = new RainTPL('/admin/assets/endpointman/images'); } - + public function chownFreepbx() { $webroot = $this->config->get('AMPWEBROOT'); $modulesdir = $webroot . '/admin/modules/'; @@ -165,75 +170,51 @@ public function chownFreepbx() { 'perms' => 0755); return $files; } - + public function ajaxRequest($req, &$setting) { - -//AVISO!!!!!!!!!!!!!!!!!!!!!!!!!! -//PERMITE TODO!!!!!!!!!!!!!!!!!!! -$setting['authenticate'] = true; -$setting['allowremote'] = true; -return true; - - switch ($_REQUEST['module_sec']) - { - case "epm_devices": break; - case "epm_templates": - switch ($req) - { - case "model_clone": - case "list_current_template": - case "add_template": - case "del_template": - $setting['authenticate'] = true; - $setting['allowremote'] = false; - return true; - break; - } - break; - - case "epm_config": - switch ($req) - { - case "saveconfig": - case "list_all_brand": - $setting['authenticate'] = true; - $setting['allowremote'] = false; - return true; - break; - } - break; - - case "epm_advanced": - switch ($req) - { - case "oui": - case "oui_add": - case "oui_del": - case "poce_select": - case "poce_select_file": - case "poce_save_file": - case "poce_save_as_file": - case "poce_sendid": - case "poce_delete_config_custom": - case "list_files_brands_export": - case "saveconfig": - $setting['authenticate'] = true; - $setting['allowremote'] = false; - return true; - break; - } - break; + $module_sec = isset($_REQUEST['module_sec'])? trim($_REQUEST['module_sec']) : ''; + if ($module_sec == "") { return false; } + + + $arrVal['epm_devices']= array(); + $arrVal['epm_templates']= array("model_clone","list_current_template","add_template","del_template"); + $arrVal['epm_config']= array("saveconfig","list_all_brand"); + $arrVal['epm_advanced']= array("oui", "oui_add", "oui_del", "poce_select", "poce_select_file", "poce_save_file", "poce_save_as_file", "poce_sendid", "poce_delete_config_custom", "list_files_brands_export", "saveconfig"); + if (!isset($arrVal[$module_sec])) { return false; } + + if (in_array($req, $arrVal[$module_sec])) { + $setting['authenticate'] = true; + $setting['allowremote'] = false; + return true; } + + //AVISO!!!!!!!!!!!!!!!!!!!!!!!!!! + //PERMITE TODO!!!!!!!!!!!!!!!!!!! + //$setting['authenticate'] = true; + //$setting['allowremote'] = true; + //return true; + return false; } - + public function ajaxHandler() { $module_sec = isset($_REQUEST['module_sec'])? trim($_REQUEST['module_sec']) : ''; $module_tab = isset($_REQUEST['module_tab'])? trim($_REQUEST['module_tab']) : ''; $command = isset($_REQUEST['command'])? trim($_REQUEST['command']) : ''; - + + if ($command == "") { + $retarr = array("status" => false, "message" => _("No command was sent!")); + return $retarr; + } + + $arrVal['mod_sec'] = array("epm_devices","epm_templates", "epm_config", "epm_advanced"); + if (! in_array($module_sec, $arrVal['mod_sec'])) { + $retarr = array("status" => false, "message" => _("Invalid section module!")); + return $retarr; + } + $txt = ""; - switch ($module_sec) + switch ($module_sec) { case "epm_devices": break; case "epm_templates": @@ -243,31 +224,28 @@ public function ajaxHandler() { { case "list_current_template": $retarr = $this->epm_templates_list_current_templates(); - return $retarr; break; - + case "model_clone": $retarr = $this->epm_templates_model_clone(); - return $retarr; break; - + case "add_template": $retarr = $this->epm_templates_add_template(); - return $retarr; break; - + case "del_template": $retarr = $this->epm_templates_del_template(); - return $retarr; break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; } + return $retarr; } break; - + case "epm_config": $txt['manager'] = array( 'ayuda_model' => _("If we can activate the model set terminals of the models.
      If this model is disabled will not appear in the list of models that can be configured for PBX."), @@ -280,7 +258,7 @@ public function ajaxHandler() { 'install' => _("Install"), 'uninstall' => _("Uninstall"), 'update' => _("Update"), - 'fw_install' => _('Install Firmware'), + 'fw_install' => _('Install Firmware'), 'fw_uninstall' => _('Remove Firmware'), 'fw_update' => _('Update Firmware'), 'enable' => _('Enable'), @@ -310,37 +288,37 @@ public function ajaxHandler() { 'err_upload_content' => _("Upload Content!"), 'opt_invalid' => _("Invalid Option!") ); - - if ($module_tab == "manager") + + if ($module_tab == "manager") { switch ($command) { - case "saveconfig": + case "saveconfig": $retarr = $this->epm_config_manager_saveconfig(); break; - - case "list_all_brand": + + case "list_all_brand": $retarr = array("status" => true, "message" => "OK", "datlist" => $this->epm_config_manager_hardware_get_list_all(false)); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; } $retarr['txt'] = $txt['manager']; } - elseif ($module_tab == "editor") + elseif ($module_tab == "editor") { - switch ($command) + switch ($command) { - case "saveconfig": + case "saveconfig": $retarr = $this->epm_config_editor_saveconfig(); break; - + case "list_all_brand": $retarr = array("status" => true, "message" => "OK", "datlist" => $this->epm_config_editor_hardware_get_list_all()); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -352,7 +330,7 @@ public function ajaxHandler() { } return $retarr; break; - + case "epm_advanced": $txt['settings'] = array( 'error' => _("Error!"), @@ -360,7 +338,7 @@ public function ajaxHandler() { 'save_changes_ok' => _("Saving Changes... Ok!"), 'opt_invalid' => _("Invalid Option!") ); - + if ($module_tab == "settings") { switch ($command) @@ -368,7 +346,7 @@ public function ajaxHandler() { case "saveconfig": $retarr = $this->epm_advanced_settings_saveconfig(); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -388,15 +366,15 @@ public function ajaxHandler() { } return $ret; break; - + case "oui_add": $retarr = $this->epm_advanced_oui_add(); break; - + case "oui_del": $retarr = $this->epm_advanced_oui_remove(); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -418,24 +396,24 @@ public function ajaxHandler() { case "poce_select": $retarr = $this->epm_advanced_poce_select(); break; - + case "poce_select_file": $retarr = $this->epm_advanced_poce_select_file(); break; - + case "poce_save_file": case "poce_save_as_file": $retarr = $this->epm_advanced_poce_save_file(); break; - + case "poce_sendid": $retarr = $this->epm_advanced_poce_sendid(); break; - + case "poce_delete_config_custom": $retarr = $this->epm_advanced_poce_delete_config_custom(); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -448,7 +426,7 @@ public function ajaxHandler() { case "list_files_brands_export": $retarr = $this->epm_advanced_manual_upload_list_files_brans_export(); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -462,48 +440,52 @@ public function ajaxHandler() { } return false; } - + public static function myDialplanHooks() { return true; } - + public function doConfigPageInit($page) { //TODO: Pendiente revisar y eliminar moule_tab. $module_tab = isset($_REQUEST['module_tab'])? trim($_REQUEST['module_tab']) : ''; if ($module_tab == "") { $module_tab = isset($_REQUEST['subpage'])? trim($_REQUEST['subpage']) : ''; } - $command = isset($_REQUEST['command'])? trim($_REQUEST['command']) : ''; - switch ($page) + + + $arrVal['mod_sec'] = array("epm_devices","epm_templates", "epm_config", "epm_advanced"); + if (! in_array($page, $arrVal['mod_sec'])) { + die(_("Invalid section module!")); + } + + switch ($page) { case "epm_devices": break; case "epm_templates": break; case "epm_config": - switch ($module_tab) + switch ($module_tab) { case "manager": switch ($command) { case "check_for_updates": - echo format_txt("Update data..."); - $this->update_check(); - echo format_txt("Done!"); + $this->epm_config_manager_check_for_updates(); echo "


      "; exit; break; - + case "manual_install": $this->epm_config_manual_install(); echo "


      "; exit; break; - + case "firmware": $this->epm_config_manager_firmware(); echo "


      "; exit; break; - + case "brand": $this->epm_config_manager_brand(); echo "


      "; @@ -511,18 +493,18 @@ public function doConfigPageInit($page) { break; } break; - + case "editor": break; } break; - + case "epm_advanced": switch ($module_tab) { case "oui_manager": break; - + case "iedl": switch ($command) { case "export": @@ -535,7 +517,7 @@ public function doConfigPageInit($page) { break; } break; - + case "manual_upload": switch ($command) { case "export_brands_availables": @@ -543,18 +525,18 @@ public function doConfigPageInit($page) { echo "


      "; exit; break; - + case "export_brands_availables_file": $this->epm_advanced_manual_upload_export_brans_available_file(); exit; break; - + case "upload_brand": $this->epm_advanced_manual_upload_brand(); echo "


      "; exit; break; - + case "upload_provisioner": $this->epm_advanced_manual_upload_provisioner(); echo "


      "; @@ -567,19 +549,19 @@ public function doConfigPageInit($page) { break; } } - + public function doGeneralPost() { if (!isset($_REQUEST['Submit'])) { return; } if (!isset($_REQUEST['display'])) { return; } - + needreload(); } - + public function myShowPage() { if (! isset($_REQUEST['display'])) return $this->pagedata; - - switch ($_REQUEST['display']) + + switch ($_REQUEST['display']) { case "epm_devices": if(empty($this->pagedata)) @@ -590,7 +572,7 @@ public function myShowPage() { ); } break; - + case "epm_templates": if(empty($this->pagedata)) { @@ -604,9 +586,9 @@ public function myShowPage() { ); } break; - + case "epm_config": - if(empty($this->pagedata)) + if(empty($this->pagedata)) { $this->pagedata['manager'] = array( "name" => _("Install/Unistall"), @@ -618,9 +600,9 @@ public function myShowPage() { ); } break; - - case "epm_advanced": - if(empty($this->pagedata)) + + case "epm_advanced": + if(empty($this->pagedata)) { $this->pagedata['settings'] = array( "name" => _("Settings"), @@ -645,7 +627,7 @@ public function myShowPage() { } break; } - + if(! empty($this->pagedata)) { foreach($this->pagedata as &$page) { ob_start(); @@ -656,35 +638,41 @@ public function myShowPage() { return $this->pagedata; } } - + public function getActiveModules() { } - + //http://wiki.freepbx.org/display/FOP/Adding+Floating+Right+Nav+to+Your+Module public function getRightNav($request) { + if(isset($request['subpage']) && $request['subpage'] == "editor") { + return load_view(__DIR__."/views/epm_templates/rnav.php",array()); + } else { + return ''; + } + } - + //http://wiki.freepbx.org/pages/viewpage.action?pageId=29753755 public function getActionBar($request) { } - + public function install() { - + } - + public function uninstall() { out(_("Removing Phone Modules Directory")); $this->system->rmrf($this->PHONE_MODULES_PATH); exec("rm -R ". $this->PHONE_MODULES_PATH); - + out(_('Removing symlink to web provisioner')); $provisioning_path = $this->config->get('AMPWEBROOT')."/provisioning"; if(is_link($provisioning_path)) { unlink($provisioning_path); } - + if(!is_link($this->config->get('AMPWEBROOT').'/admin/assets/endpointman')) { $this->system->rmrf($this->config->get('AMPWEBROOT').'/admin/assets/endpointman'); } - + out(_("Dropping all relevant tables")); $sql = "DROP TABLE `endpointman_brand_list`"; $sth = $this->db->prepare($sql); @@ -718,32 +706,32 @@ public function uninstall() { $sth->execute(); return true; } - + public function backup() { } - + public function restore($backup) { } - - - - - - - - - - - - - + + + + + + + + + + + + + /** * Get info models by product id selected. * @param int $id_product product ID * @param bool $show_all True return all, False return hidden = 0 * @return array */ - public function epm_config_hardware_get_list_models($id_product=NULL, $show_all = true) + public function epm_config_hardware_get_list_models($id_product=NULL, $show_all = true) { if(! is_numeric($id_product)) { throw new \Exception( _("ID Producto not is number")." (".$id_product.")"); } if($show_all == true) { $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = '.$id_product; } @@ -751,14 +739,14 @@ public function epm_config_hardware_get_list_models($id_product=NULL, $show_all $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); return $result; } - + /** * Get info product by brand id selected. * @param int $id_brand brand ID * @param bool $show_all True return all, FAlse return hidde = 0 * @return array */ - public function epm_config_hardware_get_list_product($id_brand=NULL, $show_all = true) + public function epm_config_hardware_get_list_product($id_brand=NULL, $show_all = true) { if(! is_numeric($id_brand)) { throw new \Exception(_("ID Brand not is numbre")." (".$id_brand.")"); } if ($show_all == true) { $sql = 'SELECT * FROM endpointman_product_list WHERE brand = '.$id_brand.' ORDER BY long_name ASC'; } @@ -766,7 +754,7 @@ public function epm_config_hardware_get_list_product($id_brand=NULL, $show_all = $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); return $result; } - + /** * Get info all brands. * @param bool $show_all True return all, False return hidde = 0 @@ -778,48 +766,48 @@ public function epm_config_hardware_get_list_brand($show_all = true) { $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); return $result; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + private function epm_config_manual_install($install_type = "", $package ="") { if ($install_type == "") { throw new \Exception("Not send install_type!"); } - + switch($install_type) { case "export_brand": break; - + case "upload_master_xml": if (file_exists($this->PHONE_MODULES_PATH."temp/master.xml")) { $handle = fopen($this->PHONE_MODULES_PATH."temp/master.xml", "rb"); @@ -838,36 +826,36 @@ private function epm_config_manual_install($install_type = "", $package ="") } else { } break; - + case "upload_provisioner": - + break; - + case "upload_brand": - + break; } } - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + /****************************************************** **** FUNCIONES SEC MODULO "epm_template\manager". **** *****************************************************/ - - public function epm_templates_del_template() + + public function epm_templates_del_template() { if (! isset($_REQUEST['idsel'])) { $retarr = array("status" => false, "message" => _("No send ID!")); @@ -880,18 +868,18 @@ public function epm_templates_del_template() } else { $dget['idsel'] = $_REQUEST['idsel']; - + $sql = "DELETE FROM endpointman_template_list WHERE id = ". $dget['idsel']; sql($sql); $sql = "UPDATE endpointman_mac_list SET template_id = 0 WHERE template_id = ".$dget['idsel']; sql($sql); - + $retarr = array("status" => true, "message" => _("Delete Template OK!")); unset($dget); } return $retarr; } - + public function epm_templates_add_template () { if (! isset($_REQUEST['newnametemplate'])) { @@ -928,15 +916,15 @@ public function epm_templates_add_template () $q = $db->prepare($sql); $ob = $q->execute(array($dget['newproductselec'], addslashes($dget['newnametemplate']), $dget['newclonemodel'])); $newid = $db->lastInsertId(); - //$endpoint->edit_template_display($id,0); - + $this->edit_template_display($newid,0); + $retarr = array("status" => true, "message" => _("Add New Template OK!"), "newid" => $newid); unset($dget); } return $retarr; } - - public function epm_templates_model_clone () + + public function epm_templates_model_clone () { if (! isset($_REQUEST['id'])) { $retarr = array("status" => false, "message" => _("No send ID!")); @@ -950,7 +938,7 @@ public function epm_templates_model_clone () else { $dget['id'] = $_REQUEST['id']; - + $i=0; $out = array(); $sql = "SELECT endpointman_model_list.id, endpointman_model_list.model as model FROM endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND product_id = '". $dget['id']."'"; @@ -961,15 +949,15 @@ public function epm_templates_model_clone () $i++; } $retarr = array("status" => true, "message" => _("Generate list Ok!"), "listopt" => $out); - + unset($dget); } return $retarr; } - + public function epm_templates_list_current_templates () { - + $sql = 'SELECT endpointman_template_list.*, endpointman_product_list.short_name as model_class, endpointman_model_list.model as model_clone, endpointman_model_list.enabled FROM endpointman_template_list, endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.hidden = 0 AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.product_id = endpointman_product_list.id'; $template_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 0; @@ -982,7 +970,7 @@ public function epm_templates_list_current_templates () } $i++; } - + $sql = 'SELECT endpointman_mac_list.mac, endpointman_mac_list.id, endpointman_mac_list.model, endpointman_model_list.model as model_clone, endpointman_product_list.short_name as model_class FROM endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.global_custom_cfg_data IS NOT NULL AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_mac_list.template_id = 0'; $template_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); foreach($template_list as $row) { @@ -1003,7 +991,7 @@ public function epm_templates_list_current_templates () $row_out[$i]['description'] = $description; $i++; } - + /* //$sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name, endpointman_oui_list.custom FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id ORDER BY endpointman_oui_list.oui ASC'; $sql = 'SELECT T1.id, T1.oui, T2.name, T1.custom FROM endpointman_oui_list as T1 , endpointman_brand_list as T2 WHERE T1.brand = T2.id ORDER BY T1.oui ASC'; @@ -1015,21 +1003,21 @@ public function epm_templates_list_current_templates () */ return $row_out; } - + /******************** * END SEC FUNCTIONS * ********************/ - - - - - + + + + + /*************************************************** **** FUNCIONES SEC MODULO "epm_advanced\poce". **** ***************************************************/ - - public function epm_advanced_poce_select() + + public function epm_advanced_poce_select() { if (! isset($_REQUEST['product_select'])) { $retarr = array("status" => false, "message" => _("No send Product Select!")); @@ -1043,10 +1031,10 @@ public function epm_advanced_poce_select() else { $dget['product_select'] = $_REQUEST['product_select']; - + $sql = 'SELECT * FROM `endpointman_product_list` WHERE `hidden` = 0 AND `id` = '.$dget['product_select']; $product_select_info = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id ='" . $dget['product_select'] . "'"; $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $config_files = explode(",", $row['config_files']); @@ -1059,7 +1047,7 @@ public function epm_advanced_poce_select() $i++; } } else { $file_list = NULL; } - + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $dget['product_select'] . "'"; $data = sql($sql,'getAll', DB_FETCHMODE_ASSOC); $i = 0; @@ -1072,13 +1060,13 @@ public function epm_advanced_poce_select() $i++; } } else { $sql_file_list = NULL; } - - + + require_once($this->PHONE_MODULES_PATH . 'setup.php'); $class = "endpoint_" . $row['directory'] . "_" . $row['cfg_dir'] . '_phone'; $base_class = "endpoint_" . $row['directory'] . '_base'; $master_class = "endpoint_base"; - + /********************************************************************************* *** Quick Fix for FreePBX Distro *** I seriously want to figure out why ONLY the FreePBX Distro can't do autoloads. @@ -1094,11 +1082,11 @@ public function epm_advanced_poce_select() } //end quick fix $phone_config = new $class(); - + //TODO: remove $template_file_list[0]['value'] = "template_data_custom.xml"; $template_file_list[0]['text'] = "template_data_custom.xml"; - + $sql = "SELECT id, model FROM endpointman_model_list WHERE product_id = '" . $dget['product_select'] . "' AND enabled = 1 AND hidden = 0"; $data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 1; @@ -1107,19 +1095,19 @@ public function epm_advanced_poce_select() $template_file_list[$i]['value'] = $list['id']; $template_file_list[$i]['text'] = "template_data_" . $list['model'] . "_custom.xml"; } - - $retarr = array("status" => true, - "message" => "OK", - "product_select" => $dget['product_select'], - "product_select_info" => $product_select_info, - "file_list" => $file_list, - "template_file_list" => $template_file_list, + + $retarr = array("status" => true, + "message" => "OK", + "product_select" => $dget['product_select'], + "product_select_info" => $product_select_info, + "file_list" => $file_list, + "template_file_list" => $template_file_list, "sql_file_list" => $sql_file_list); unset($dget); } return $retarr; } - + public function epm_advanced_poce_select_file() { if (! isset($_REQUEST['product_select'])) { @@ -1146,12 +1134,12 @@ public function epm_advanced_poce_select_file() $dget['file_name'] = $_REQUEST['file_name']; $dget['file_id'] = $_REQUEST['file_id']; $dget['type_file'] = $_REQUEST['type_file']; - - + + if ($dget['type_file'] == "sql") { $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $dget['file_id']; $row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - + $type = $dget['type_file']; $sendidt = $row['id']; $product_select = $row['product_id']; @@ -1160,19 +1148,19 @@ public function epm_advanced_poce_select_file() $filename = $row['name']; $location = "SQL: ". $row['name']; $config_data = $this->display_htmlspecialchars($row['data']); - + } elseif ($dget['type_file'] == "file") { $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $config_files = explode(",", $row['config_files']); - //TODO: A�adir validacion para ver si $dget['file_name'] esta en el array $config_files - + //TODO: Aadir validacion para ver si $dget['file_name'] esta en el array $config_files + $filename = $dget['file_name']; - $pathfile = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $filename; - - + $pathfile = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $filename; + + if (is_readable($pathfile)) { if(filesize($pathfile)>0) { $handle = fopen($pathfile, "rb"); @@ -1183,7 +1171,7 @@ public function epm_advanced_poce_select_file() else { $contents = ""; } - + $type = $dget['type_file']; $sendidt = $dget['file_id']; $product_select = $dget['product_select']; @@ -1197,7 +1185,7 @@ public function epm_advanced_poce_select_file() $retarr = array("status" => false, "message" => _("File not readable, check the permission! ").$filename); } } - elseif ($dget['type_file'] == "tfile") + elseif ($dget['type_file'] == "tfile") { if ($dget['file_id'] == "template_data_custom.xml") { @@ -1206,24 +1194,24 @@ public function epm_advanced_poce_select_file() $config_data = ""; } else { - + $sql = "SELECT * FROM endpointman_model_list WHERE id = '" . $dget['file_id'] . "'"; $data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $sendidt = $data['id']; $original_name = $dget['file_name']; $config_data = unserialize($data['template_data']); $config_data = generate_xml_from_array ($config_data, 'node'); } - + $type = $dget['type_file']; $product_select = $dget['product_select']; $save_as_name_value = $dget['file_name']; $filename = $dget['file_name']; $location = $dget['file_name']; } - - $retarr = array("status" => true, + + $retarr = array("status" => true, "message" => "OK", "type" => $type, "sendidt" => $sendidt, @@ -1237,13 +1225,13 @@ public function epm_advanced_poce_select_file() } return $retarr; } - - - - - - - + + + + + + + //TODO: PENDIENTE REVISAR function epm_advanced_poce_sendid() { @@ -1262,9 +1250,9 @@ function epm_advanced_poce_sendid() $dget['sendid'] = $_REQUEST['sendid']; $dget['original_name'] = $_REQUEST['original_name']; $dget['config_text'] = $_REQUEST['config_text']; - - - + + + //DEBUGGGGGGGGGGGGG return; if ($dget['type_file'] == "sql") { @@ -1286,13 +1274,13 @@ function epm_advanced_poce_sendid() } return $retarr; } - - - - - - - + + + + + + + function epm_advanced_poce_save_file() { if (! isset($_REQUEST['product_select'])) { @@ -1325,14 +1313,14 @@ function epm_advanced_poce_save_file() $dget['original_name'] = $_REQUEST['original_name']; $dget['file_name'] = $_REQUEST['file_name']; $dget['config_text'] = $_REQUEST['config_text']; - - - if ($dget['type_file'] == "file") + + + if ($dget['type_file'] == "file") { $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $config_files = explode(",", $row['config_files']); - + if ((is_array($config_files)) AND (in_array($dget['file_name'], $config_files))) { $pathdir = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/"; @@ -1343,7 +1331,7 @@ function epm_advanced_poce_save_file() elseif (! is_writable($pathfile)) { $retarr = array("status" => false, "message" => "File is not Writable (".$pathfile.")!"); } - else + else { $wfh = fopen($pathfile, 'w'); fwrite($wfh, $dget['config_text']); @@ -1355,7 +1343,7 @@ function epm_advanced_poce_save_file() $retarr = array("status" => false, "message" => "The File no existe in the DataBase!"); } } - elseif ($dget['type_file'] == "sql") + elseif ($dget['type_file'] == "sql") { $sql = "UPDATE endpointman_custom_configs SET data = '" . addslashes($dget['config_text']) . "' WHERE id = " . $dget['sendid']; sql($sql); @@ -1369,7 +1357,7 @@ function epm_advanced_poce_save_file() $ob = $q->execute(array(addslashes($dget['save_as_name']), addslashes($dget['original_name']), $dget['product_select'], addslashes($dget['config_text']))); $newidinsert = $db->lastInsertId(); $retarr = array("status" => true, "message" => "Saved to Database!"); - + $retarr['type_file'] = "sql"; $retarr['location'] = "SQL: ". $dget['save_as_name']; $retarr['sendidt'] = $newidinsert; @@ -1377,8 +1365,8 @@ function epm_advanced_poce_save_file() else { $retarr = array("status" => false, "message" => "Type not valid!"); } - - + + $retarr['original_name'] = $dget['original_name']; $retarr['file_name'] = $dget['file_name']; $retarr['save_as_name'] = $dget['save_as_name']; @@ -1386,7 +1374,7 @@ function epm_advanced_poce_save_file() } return $retarr; } - + function epm_advanced_poce_delete_config_custom() { if (! isset($_REQUEST['product_select'])) { @@ -1402,7 +1390,7 @@ function epm_advanced_poce_delete_config_custom() $dget['type_file'] = $_REQUEST['type_file']; $dget['product_select'] = $_REQUEST['product_select']; $dget['sql_select'] = $_REQUEST['sql_select']; - + if ($dget['type_file'] == "sql") { $sql = "DELETE FROM endpointman_custom_configs WHERE id =" . $dget['sql_select']; sql($sql); @@ -1410,7 +1398,7 @@ function epm_advanced_poce_delete_config_custom() $retarr = array("status" => true, "message" => "File delete ok!"); } else { $retarr = array("status" => false, "message" => _("Type File not valid!")); } - + unset($dget); } return $retarr; @@ -1418,25 +1406,25 @@ function epm_advanced_poce_delete_config_custom() /******************** * END SEC FUNCTIONS * ********************/ - - - - - - - - + + + + + + + + /************************************************************ **** FUNCIONES SEC MODULO "epm_advanced\manual_upload". **** ***********************************************************/ - + public function epm_advanced_manual_upload_list_files_brans_export() { $path_tmp_dir = $this->PHONE_MODULES_PATH."temp/export/"; $array_list_files = array(); $array_count_brand = array(); - - + + $array_list_exception= array(".", "..", ".htaccess"); if(file_exists($path_tmp_dir)) { @@ -1446,11 +1434,11 @@ public function epm_advanced_manual_upload_list_files_brans_export() $i = 0; foreach ($l_files as $archivo) { if (in_array($archivo, $array_list_exception)) { continue; } - + $pathandfile = $path_tmp_dir.$archivo; $brand = substr(pathinfo($archivo, PATHINFO_FILENAME), 0, -11); $ftime = substr(pathinfo($archivo, PATHINFO_FILENAME), -10); - + $array_count_brand[] = $brand; $array_list_files[$i] = array("brand" => $brand, "pathall" => $pathandfile, @@ -1465,19 +1453,19 @@ public function epm_advanced_manual_upload_list_files_brans_export() "is_file" => is_file($pathandfile), "is_link" => is_link($pathandfile), "readlink" => (is_link($pathandfile) == true ? readlink ($pathandfile) : NULL)); - + $i++; } unset ($l_files); - + $array_count_brand = array_count_values($array_count_brand); ksort ($array_count_brand); $array_count_brand_end = array(); - + foreach($array_count_brand as $key => $value) { $array_count_brand_end[] = array('name' => $key , 'num' => $value); } - + $retarr = array("status" => true, "message" => _("List Done!"), "countlist" => count($array_list_files), "list_files" => $array_list_files, "list_brands" => $array_count_brand_end ); unset ($array_count_brand_end); unset ($array_count_brand); @@ -1491,7 +1479,7 @@ public function epm_advanced_manual_upload_list_files_brans_export() } return $retarr; } - + public function epm_advanced_manual_upload_brand() { if (count($_FILES["files"]["error"]) == 0) { @@ -1501,23 +1489,23 @@ public function epm_advanced_manual_upload_brand() { foreach ($_FILES["files"]["error"] as $key => $error) { echo format_txt(_("Importing brand file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - + if ($error != UPLOAD_ERR_OK) { echo format_txt($this->file_upload_error_message($error), "error"); } - else + else { - + $uploads_dir = $this->PHONE_MODULES_PATH . "temp"; $name = $_FILES["files"]["name"][$key]; $extension = pathinfo($name, PATHINFO_EXTENSION); if ($extension == "tgz") { - + $tmp_name = $_FILES["files"]["tmp_name"][$key]; $uploads_dir_file = $uploads_dir."/".$name; move_uploaded_file($tmp_name, $uploads_dir_file); - - if (file_exists($uploads_dir_file)) + + if (file_exists($uploads_dir_file)) { $temp_directory = sys_get_temp_dir() . "/epm_temp/"; if (!file_exists($temp_directory)) { @@ -1529,7 +1517,7 @@ public function epm_advanced_manual_upload_brand() echo format_txt(_("Error!"), "error"); } } - if (file_exists($temp_directory)) + if (file_exists($temp_directory)) { if ($this->configmod->get('debug')) { echo format_txt(_("Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........"),"",array("%_FILEPACKAGE_%" => $uploads_dir_file, "%_TEMPDIR_%" => $temp_directory)); @@ -1538,16 +1526,16 @@ public function epm_advanced_manual_upload_brand() } exec("tar -xvf ".$uploads_dir_file." -C ".$temp_directory); echo format_txt(_("Done!"), "done"); - + $package = basename($name, ".tgz"); $package = explode("-",$package); - + if ($this->configmod->get('debug')) { echo format_txt(_("Looking for file %_FILEPACKAGE_% to pass on to update_brand()..."),"",array("%_FILEPACKAGE_%" => $temp_directory.$package[0])); } else { echo format_txt(_("Looking file and update brand's....")); } - + if(file_exists($temp_directory.$package[0])) { $this->update_brand($package[0],FALSE); // Note: no need to delete/unlink/rmdir as this is handled in update_brand() @@ -1555,12 +1543,12 @@ public function epm_advanced_manual_upload_brand() echo format_txt(_("Please name the Package the same name as your brand!")); } } - } + } else { echo format_txt(_("No File Provided!"), "error"); //echo "File ".$this->PHONE_MODULES_PATH."temp/".$_REQUEST['package']." not found.
      "; } - } + } else { echo format_txt(_("Invalid File Extension!"), "error"); } @@ -1568,7 +1556,7 @@ public function epm_advanced_manual_upload_brand() } } } - + public function epm_advanced_manual_upload_provisioner () { if (count($_FILES["files"]["error"]) == 0) { @@ -1578,26 +1566,26 @@ public function epm_advanced_manual_upload_provisioner () { foreach ($_FILES["files"]["error"] as $key => $error) { echo format_txt(_("Importing Provisioner file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - + if ($error != UPLOAD_ERR_OK) { echo format_txt($this->file_upload_error_message($error), "error"); } - else + else { $uploads_dir = $this->PHONE_MODULES_PATH . "temp"; $name = $_FILES["files"]["name"][$key]; $extension = pathinfo($name, PATHINFO_EXTENSION); - if ($extension == "tgz") + if ($extension == "tgz") { $tmp_name = $_FILES["files"]["tmp_name"][$key]; $uploads_dir_file = $uploads_dir."/".$name; move_uploaded_file($tmp_name, $uploads_dir_file); - + if (file_exists($uploads_dir_file)) { echo format_txt(_("Extracting Provisioner Package...")); exec("tar -xvf ".$uploads_dir_file." -C ".$uploads_dir."/"); echo format_txt(_("Done!"), "done"); - + if(!file_exists($this->PHONE_MODULES_PATH."endpoint")) { echo format_txt(_("Creating Provisioner Directory...")); if (mkdir($this->PHONE_MODULES_PATH."endpoint") == true) { @@ -1607,19 +1595,19 @@ public function epm_advanced_manual_upload_provisioner () echo format_txt(_("Error!"), "error"); } } - - if(file_exists($this->PHONE_MODULES_PATH."endpoint")) + + if(file_exists($this->PHONE_MODULES_PATH."endpoint")) { $endpoint_last_mod = filemtime($this->PHONE_MODULES_PATH."temp/endpoint/base.php"); rename($this->PHONE_MODULES_PATH."temp/endpoint/base.php", $this->PHONE_MODULES_PATH."endpoint/base.php"); - + echo format_txt(_("Updating Last Modified...")); $sql = "UPDATE endpointman_global_vars SET value = '".$endpoint_last_mod."' WHERE var_name = 'endpoint_vers'"; sql($sql); echo format_txt(_("Done!"),"done"); } - - } else { + + } else { echo format_txt(_("File Temp no Exists!"), "error"); } } else { @@ -1629,7 +1617,7 @@ public function epm_advanced_manual_upload_provisioner () } } } - + public function epm_advanced_manual_upload_export_brans_available_file() { if ((! isset($_REQUEST['file_package'])) OR ($_REQUEST['file_package'] == "")) { @@ -1641,7 +1629,7 @@ public function epm_advanced_manual_upload_export_brans_available_file() else { $dget['file_package'] = $_REQUEST['file_package']; $path_tmp_file = $this->PHONE_MODULES_PATH."/temp/export/".$_REQUEST['file_package']; - + if (! file_exists($path_tmp_file)) { header('HTTP/1.0 404 Not Found', true, 404); echo "

      Error 404 Not Found

      "; @@ -1664,7 +1652,7 @@ public function epm_advanced_manual_upload_export_brans_available_file() } exit; } - + public function epm_advanced_manual_upload_export_brans_available() { if ((! isset($_REQUEST['package'])) OR ($_REQUEST['package'] == "")) { @@ -1675,23 +1663,23 @@ public function epm_advanced_manual_upload_export_brans_available() } else { $dget['package'] = $_REQUEST['package']; - + $sql = 'SELECT `name`, `directory` FROM `endpointman_brand_list` WHERE `id` = '.$dget['package'].''; $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + if ($row == "") { echo format_txt(_("ID Package send not valid, brand not exist!"), "error"); } else { echo format_txt(_("Exporting %_NAME_%"), "", array("%_NAME_%" => $row['name'])); - + if(!file_exists($this->PHONE_MODULES_PATH."/temp/export/")) { mkdir($this->PHONE_MODULES_PATH."/temp/export/"); } $time = time(); exec("tar zcf ".$this->PHONE_MODULES_PATH."temp/export/".$row['directory']."-".$time.".tgz --exclude .svn --exclude firmware -C ".$this->PHONE_MODULES_PATH."/endpoint ".$row['directory']); - - + + echo format_txt(_("Done!"), "done"); echo format_txt(_("Click this link to download:")); echo ""; @@ -1702,17 +1690,17 @@ public function epm_advanced_manual_upload_export_brans_available() unset ($dget); } } - + /******************** * END SEC FUNCTIONS * ********************/ - - - + + + /*************************************************** **** FUNCIONES SEC MODULO "epm_advanced\iedl". **** **************************************************/ - + public function epm_advanced_iedl_export($sFileName = "devices_list.csv") { header("Content-type: text/csv"); @@ -1726,20 +1714,20 @@ public function epm_advanced_iedl_export($sFileName = "devices_list.csv") fclose($outstream); exit; } - + //Dave B's Q&D file upload security code (http://us2.php.net/manual/en/features.file-upload.php) public function epm_advanced_iedl_import() { if (count($_FILES["files"]["error"]) == 0) { echo format_txt(_("Can Not Find Uploaded Files!"), "error"); } - else + else { $allowedExtensions = array("application/csv", "text/plain"); - + foreach ($_FILES["files"]["error"] as $key => $error) { echo format_txt(_("Importing CVS file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - + if ($error != UPLOAD_ERR_OK) { echo format_txt($this->file_upload_error_message($error), "error"); } @@ -1754,7 +1742,7 @@ public function epm_advanced_iedl_import() else { $uploadfile = $this->LOCAL_PATH . basename($_FILES["files"]["name"][$key]); $uploadtemp = $_FILES["files"]["tmp_name"][$key]; - + if (move_uploaded_file($uploadtemp, $uploadfile)) { //Parse the uploaded file $handle = fopen($uploadfile, "r"); @@ -1764,29 +1752,29 @@ public function epm_advanced_iedl_import() if ($mac = $this->mac_check_clean($device[0])) { $sql = "SELECT id FROM endpointman_brand_list WHERE name LIKE '%" . $device[1] . "%' LIMIT 1"; $res = sql($sql); - + if ($res->numRows() > 0) { $brand_id = sql($sql, 'getOne'); $brand_id = $brand_id[0]; - + $sql_model = "SELECT id FROM endpointman_model_list WHERE brand = " . $brand_id . " AND model LIKE '%" . $device[2] . "%' LIMIT 1"; $sql_ext = "SELECT extension, name FROM users WHERE extension LIKE '%" . $device[3] . "%' LIMIT 1"; - + $line_id = isset($device[4]) ? $device[4] : 1; - + $res_model = sql($sql_model); if ($res_model->numRows()) { $model_id = sql($sql_model, 'getRow', DB_FETCHMODE_ASSOC); $model_id = $model_id['id']; - + $res_ext = sql($sql_ext); if ($res_ext->numRows()) { $ext = sql($sql_ext, 'getRow', DB_FETCHMODE_ASSOC); $description = $ext['name']; $ext = $ext['extension']; - + $this->add_device($mac, $model_id, $ext, 0, $line_id, $description); - + echo format_txt(_("Done!"), "done"); } else { echo format_txt(_("Invalid Extension Specified on line %_LINE_%!"), "error", array("%_LINE_%" => $i)); @@ -1814,20 +1802,20 @@ public function epm_advanced_iedl_import() } } } - + /******************** * END SEC FUNCTIONS * ********************/ - - - + + + /********************************************************** **** FUNCIONES SEC MODULO "epm_advanced\oui_manager". **** *********************************************************/ - + private function epm_advanced_oui_remove() { - //TODO: A�adir validacion de si es custom o no + //TODO: Aadir validacion de si es custom o no if ((! isset($_REQUEST['id_del'])) OR ($_REQUEST['id_del'] == "")) { $retarr = array("status" => false, "message" => _("No ID set!")); } @@ -1837,19 +1825,19 @@ private function epm_advanced_oui_remove() else { $dget['id'] = $_REQUEST['id_del']; - + $sql = "DELETE FROM endpointman_oui_list WHERE id = " . $dget['id']; sql($sql); - + $retarr = array("status" => true, "message" => "OK", "id" => $dget['id']); unset($dget); } return $retarr; - } - - private function epm_advanced_oui_add() + } + + private function epm_advanced_oui_add() { - //TODO: Pendiente a�adir isExiste datos. + //TODO: Pendiente aadir isExiste datos. if ((! isset($_REQUEST['number_new_oui'])) OR ($_REQUEST['number_new_oui'] == "")) { $retarr = array("status" => false, "message" => _("No OUI set!")); } @@ -1859,26 +1847,26 @@ private function epm_advanced_oui_add() else { $dget['oui'] = $_REQUEST['number_new_oui']; $dget['brand'] = $_REQUEST['brand_new_oui']; - + $sql = "INSERT INTO endpointman_oui_list (oui, brand, custom) VALUES ('" . $dget['oui'] . "', '" . $dget['brand'] . "', '1')"; sql($sql); - + $retarr = array("status" => true, "message" => "OK", "oui" => $dget['oui'], "brand" => $dget['brand']); unset($dget); } return $retarr; } - + /******************** * END SEC FUNCTIONS * ********************/ - - - + + + /****************************************************** **** FUNCIONES SEC MODULO "epm_advanced\settings". **** ******************************************************/ - + public function epm_advanced_config_loc_is_writable() { $config_loc = $this->configmod->get("config_loc"); @@ -1887,12 +1875,12 @@ public function epm_advanced_config_loc_is_writable() if ((file_exists($config_loc)) AND (is_dir($config_loc))) { if (is_writable($config_loc)) { $tftp_writable = TRUE; - } + } } - } + } return $tftp_writable; } - + private function epm_advanced_settings_saveconfig () { if (! isset($_REQUEST['name'])) { @@ -1901,7 +1889,7 @@ private function epm_advanced_settings_saveconfig () elseif (! isset($_REQUEST['value'])) { $retarr = array("status" => false, "message" => _("No send value!")); } - else + else { $dget['name'] = strtolower($_REQUEST['name']); $dget['value'] = $_REQUEST['value']; @@ -1910,47 +1898,47 @@ private function epm_advanced_settings_saveconfig () $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='enable_ari'"; break; - + case "enable_debug": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='debug'"; break; - + case "disable_help": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='disable_help'"; break; - + case "allow_dupext": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='show_all_registrations'"; break; - + case "allow_hdfiles": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='allow_hdfiles'"; break; - + case "tftp_check": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='tftp_check'"; break; - + case "backup_check": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='backup_check'"; break; - + case "use_repo": $dget['value'] = strtolower($dget['value']); if (($dget['value'] == "yes") and (! $this->has_git())) { - $retarr = array("status" => false, "message" => _("Git not installed!")); + $retarr = array("status" => false, "message" => _("Git not installed!")); } else { $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='use_repo'"; } break; - + case "config_loc": $dget['value'] = trim($dget['value']); //No trailing slash. Help the user out and add one :-) @@ -1962,53 +1950,53 @@ private function epm_advanced_settings_saveconfig () if (is_writable($dget['value'] = $dget['value'])) { $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='config_location'"; } else { - $retarr = array("status" => false, "message" => _("Directory Not Writable!")); + $retarr = array("status" => false, "message" => _("Directory Not Writable!")); } } else { - $retarr = array("status" => false, "message" => _("Not a Vaild Directory.
      Try to run 'mkdir " . $_POST['config_loc'] . "' as root.")); + $retarr = array("status" => false, "message" => _("Not a Vaild Directory.
      Try to run 'mkdir " . $_POST['config_loc'] . "' as root.")); } } else { - $retarr = array("status" => false, "message" => _("No Configuration Location Defined!")); + $retarr = array("status" => false, "message" => _("No Configuration Location Defined!")); } break; - + case "srvip": $dget['value'] = trim($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='srvip'"; break; - + case "tz": $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='tz'"; break; - + case "ntp_server": $dget['value'] = trim($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='ntp'"; break; - + case "nmap_loc": $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='nmap_location'"; break; - + case "arp_loc": $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='arp_location'"; break; - + case "asterisk_loc": $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='asterisk_location'"; break; - + case "package_server": $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='update_server'"; break; - + case "cfg_type": if ($dget['value'] == 'http') { $symlink = $this->config->get('AMPWEBROOT') . "/provisioning"; $reallink = $this->LOCAL_PATH . "provisioning"; if ((!is_link($symlink)) OR (!readlink($symlink) == $reallink)) { if (!symlink($reallink, $symlink)) { - $retarr = array("status" => false, "message" => _("Your permissions are wrong on " . $this->config->get('AMPWEBROOT') . ", web provisioning link not created!")); + $retarr = array("status" => false, "message" => _("Your permissions are wrong on " . $this->config->get('AMPWEBROOT') . ", web provisioning link not created!")); //$dget['value'] = 'file'; break; } else { @@ -2022,9 +2010,9 @@ private function epm_advanced_settings_saveconfig () } $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='server_type'"; break; - + default: - $retarr = array("status" => false, "message" => _("Name invalid: ") . $dget['name'] ); + $retarr = array("status" => false, "message" => _("Name invalid: ") . $dget['name'] ); } if (isset($sql)) { sql($sql); @@ -2035,97 +2023,97 @@ private function epm_advanced_settings_saveconfig () } return $retarr; } - + /******************** * END SEC FUNCTIONS * ********************/ - - - + + + /*************************************************** **** FUNCIONES SEC MODULO "epm_config\manager". **** ***************************************************/ - + private function epm_config_manager_check_for_updates () { - $this->update_check(); - $retarr = array("status" => true, "message" => "OK"); - return $retarr; + out("

      Update data...

      "); + $this->update_check(true); + out ("All Done!"); } - + private function epm_config_manager_brand() { if (! isset($_REQUEST['command_sub'])) { - throw new \Exception("Not send command_sub!"); + out (_("Error: Not send command!")); } - elseif (! isset($_REQUEST['idfw'])) { - throw new \Exception("Not send ID!"); + elseif (! isset($_REQUEST['idfw'])) { + out (_("Error: Not send ID!")); } else if (! is_numeric($_REQUEST['idfw'])) { - throw new \Exception("ID not is numbre!"); + out (_("Error: ID not is number!")); } else { $dget['command'] = strtolower($_REQUEST['command_sub']); $dget['id'] = $_REQUEST['idfw']; - + switch($dget['command']) { case "brand_install": - $this->download_brand($dget['id']); - break; - case "brand_update": $this->download_brand($dget['id']); break; - + case "brand_uninstall": $this->remove_brand($dget['id']); break; - + default: - echo "
      " . _("Error: Command not found!"). " [" . $dget['command'] . "]" . "
      "; + out (_("Error: Command not found!")." [" . $dget['command'] . "]"); } $this->update_check(); unset ($dget); + + return true; } + return false; } - + private function epm_config_manager_firmware() { - if (! isset($_REQUEST['command_sub'])) { - throw new \Exception("Not send command_sub!"); + if (! isset($_REQUEST['command_sub'])) { + out (_("Error: Not send command!")); } - elseif (! isset($_REQUEST['idfw'])) { - throw new \Exception("Not send ID!"); + elseif (! isset($_REQUEST['idfw'])) { + out (_("Error: Not send ID!")); } - else if (! is_numeric($_REQUEST['idfw'])) { - throw new \Exception("ID not is numbre!"); + else if (! is_numeric($_REQUEST['idfw'])) { + out (_("Error: ID not is number!")); } else { $dget['command'] = strtolower($_REQUEST['command_sub']); $dget['id'] = $_REQUEST['idfw']; - + switch($dget['command']) { case "fw_install": - $this->install_firmware($dget['id']); - break; - case "fw_update": $this->install_firmware($dget['id']); break; - + case "fw_uninstall": $this->remove_firmware($dget['id']); break; - + default: - echo "
      " . _("Error: Command not found!"). " [" . $dget['command'] . "]" . "
      "; + out (_("Error: Command not found!")." [" . $dget['command'] . "]"); } unset ($dget); + + return true; } + return false; } - + private function epm_config_manager_saveconfig() { if (! isset($_REQUEST['name'])) { @@ -2143,24 +2131,24 @@ private function epm_config_manager_saveconfig() elseif (! is_numeric($_REQUEST['idbt'])) { $retarr = array("status" => false, "message" => _("ID send is not number!")); } - else + else { $dget['name'] = strtolower($_REQUEST['name']); $dget['value'] = strtolower($_REQUEST['value']); $dget['idtype'] = strtolower($_REQUEST['idtype']); $dget['id'] = $_REQUEST['idbt']; - + switch($dget['idtype']) { case "marca": $sql = "UPDATE endpointman_brand_list SET enabled = '" .$dget['value']. "' WHERE id = '".$dget['id']."'"; break; - + case "modelo": $sql = "UPDATE endpointman_model_list SET enabled = " .$dget['value']. " WHERE id = '".$dget['id']."'"; break; - + default: - $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); + $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); } if (isset($sql)) { sql($sql); @@ -2171,7 +2159,7 @@ private function epm_config_manager_saveconfig() } return $retarr; } - + public function epm_config_manager_hardware_get_list_all($check_for_updates = true) { $row_out = array(); @@ -2179,13 +2167,13 @@ public function epm_config_manager_hardware_get_list_all($check_for_updates = tr $brand_list = $this->epm_config_hardware_get_list_brand(true); //FIX: https://github.com/FreePBX-ContributedModules/endpointman/commit/2ad929d0b38f05c9da1b847426a4094c3314be3b if($check_for_updates) $brand_up = $this->update_check(); - foreach ($brand_list as $row) + foreach ($brand_list as $row) { $row_out[$i] = $row; $row_out[$i]['count'] = $i; $row_out[$i]['cfg_ver_datetime'] = date("c",$row['cfg_ver']); - - if($check_for_updates) + + if($check_for_updates) { $id = $this->system->arraysearchrecursive($row['name'], $brand_up,'name'); $id = $id[0]; @@ -2201,19 +2189,19 @@ public function epm_config_manager_hardware_get_list_all($check_for_updates = tr $row_out[$i]['update_vers'] = ""; } } - else + else { if (! isset($row_out[$i]['update'])) { $row_out[$i]['update'] = ""; } if (! isset($row_out[$i]['update_vers'])) { $row_out[$i]['update_vers'] = ""; } } if ($row['hidden'] == 1) { continue; } - - + + $j = 0; $product_list = $this->epm_config_hardware_get_list_product($row['id'], true); foreach($product_list as $row2) { $row_out[$i]['products'][$j] = $row2; - + if($check_for_updates) { if((array_key_exists('firmware_vers', $row2)) AND ($row2['firmware_vers'] > 0)) { $temp = $this->firmware_update_check($row2['id']); @@ -2224,17 +2212,17 @@ public function epm_config_manager_hardware_get_list_all($check_for_updates = tr $row_out[$i]['products'][$j]['update_vers_fw'] = ""; } } - else + else { if (! isset($row_out[$i]['products'][$j]['update_fw'])) { $row_out[$i]['products'][$j]['update_fw'] = 0; } if (! isset($row_out[$i]['products'][$j]['update_vers_fw'])) { $row_out[$i]['products'][$j]['update_vers_fw'] = ""; } } $row_out[$i]['products'][$j]['fw_type'] = $this->firmware_local_check($row2['id']); if ($row2['hidden'] == 1) { continue; } - + $k = 0; $model_list = $this->epm_config_hardware_get_list_models($row2['id'], true); - foreach($model_list as $row3) + foreach($model_list as $row3) { $row_out[$i]['products'][$j]['models'][$k] = $row3; if($row_out[$i]['products'][$j]['models'][$k]['enabled']){ @@ -2251,9 +2239,9 @@ public function epm_config_manager_hardware_get_list_all($check_for_updates = tr /******************** * END SEC FUNCTIONS * ********************/ - - - + + + /************************************************** **** FUNCIONES SEC MODULO "epm_config\editor". **** **************************************************/ @@ -2278,28 +2266,28 @@ private function epm_config_editor_saveconfig() elseif (! is_numeric($_REQUEST['idbt'])) { $retarr = array("status" => false, "message" => _("ID send is not number!")); } - else + else { $dget['name'] = strtolower($_REQUEST['name']); $dget['value'] = strtolower($_REQUEST['value']); $dget['idtype'] = strtolower($_REQUEST['idtype']); $dget['id'] = $_REQUEST['idbt']; - + switch($dget['idtype']) { case "marca": $sql = "UPDATE endpointman_brand_list SET hidden = '".$dget['value'] ."' WHERE id = '".$dget['id']."'"; break; - + case "producto": $sql = "UPDATE endpointman_product_list SET hidden = '". $dget['value'] ."' WHERE id = '".$dget['id']."'"; break; - + case "modelo": $sql = "UPDATE endpointman_model_list SET hidden = '". $dget['value'] ."' WHERE id = '".$dget['id']."'"; break; - + default: - $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); + $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); } if (isset($sql)) { sql($sql); @@ -2310,23 +2298,23 @@ private function epm_config_editor_saveconfig() } return $retarr; } - + /** * Get info all brdans, prodics, models. * @return array */ - public function epm_config_editor_hardware_get_list_all () + public function epm_config_editor_hardware_get_list_all () { $row_out = array(); $i = 0; - foreach ($this->epm_config_hardware_get_list_brand(true) as $row) + foreach ($this->epm_config_hardware_get_list_brand(true) as $row) { $row_out[$i] = $row; $row_out[$i]['count'] = $i; - if ($row['installed']) + if ($row['installed']) { $j = 0; - foreach ($this->epm_config_hardware_get_list_product($row['id'], true) as $row2) + foreach ($this->epm_config_hardware_get_list_product($row['id'], true) as $row2) { $row_out[$i]['products'][$j] = $row2; $k = 0; @@ -2344,33 +2332,33 @@ public function epm_config_editor_hardware_get_list_all () /******************** * END SEC FUNCTIONS * ********************/ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + /***************************************** ****** CODIGO ANTIGUO -- REVISADO ******** *****************************************/ - - + + /** * Check for new firmware on the servers * @param int $id Product ID @@ -2399,7 +2387,7 @@ function firmware_update_check($id=NULL) { } } } - + /** * Check to see the status of the firmware locally (installed or not) * @param int $id @@ -2408,10 +2396,10 @@ function firmware_update_check($id=NULL) { function firmware_local_check($id=NULL) { $sql = "SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id ='" . $id . "'"; $res = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - + if (count($res) > 0) { $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $sql = "SELECT directory FROM endpointman_brand_list WHERE hidden = 0 AND id ='" . $row['brand'] . "'"; $brand_directory = sql($sql, 'getOne'); @@ -2434,7 +2422,7 @@ function firmware_local_check($id=NULL) { return("nothing"); } } - + /** * Reads a file. Json decodes it and will report any errors back * @param string $file location of file @@ -2479,22 +2467,28 @@ function file2json($file) { return(false); } } - + /** * Check for new packges for brands. These packages will include phone models and such which the user can remove if they want * This function will alos auto-update the provisioner.net library incase anything has changed * @return array An array of all the brands/products/models and information about what's enabled, installed or otherwise */ - function update_check($echotxt = false) { + function update_check($echomsg = false, &$error=array()) { $temp_location = $this->sys_get_temp_dir() . "/epm_temp/"; if (!$this->configmod->get('use_repo')) { - $master_result = $this->system->download_file($this->UPDATE_PATH . "master.json", $this->PHONE_MODULES_PATH . "endpoint/master.json"); + if ($echomsg == true) { + $master_result = $this->system->download_file_with_progress_bar($this->UPDATE_PATH . "master.json", $this->PHONE_MODULES_PATH . "endpoint/master.json"); + } else { + $master_result = $this->system->download_file($this->UPDATE_PATH . "master.json", $this->PHONE_MODULES_PATH . "endpoint/master.json"); + } if (!$master_result) { - $this->error['brand_update_check_master'] = "Not able to connect to repository. Using local master file instead."; -if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local master file instead."), "error"); } + $error['brand_update_check_master'] = _("Error: Not able to connect to repository. Using local master file instead."); + if ($echomsg == true ) { + out($error['brand_update_check_master']); + } } - + $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/master.json'); $endpoint_package = $temp['data']['package']; $endpoint_last_mod = $temp['data']['last_modified']; @@ -2505,12 +2499,14 @@ function update_check($echotxt = false) { $contents = file_get_contents($this->UPDATE_PATH . "/update_status"); if ($contents != '1') { if (($data == "") OR ($data <= $endpoint_last_mod)) { - if ((!$master_result) OR (!$this->system->download_file($this->UPDATE_PATH . '/' . $endpoint_package, $temp_location . $endpoint_package))) { - $this->error['brand_update_check_json'] = "
      Not able to connect to repository. Using local Provisioner.net Package"; -if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local Provisioner.net Package."), "error"); } + if ((!$master_result) OR (!$this->system->download_file($this->UPDATE_PATH . '/' . $endpoint_package, $temp_location . $endpoint_package))) + { + $error['brand_update_check_json'] = _("Not able to connect to repository. Using local Provisioner.net Package"); + if ($echomsg == true ) { + out($error['brand_update_check_json']); + } } else { exec("tar -xvf " . $temp_location . $endpoint_package . " -C " . $temp_location); - if (!file_exists($this->PHONE_MODULES_PATH . "endpoint")) { mkdir($this->PHONE_MODULES_PATH . "endpoint"); } @@ -2519,25 +2515,31 @@ function update_check($echotxt = false) { rename($temp_location . "setup.php", $this->PHONE_MODULES_PATH . "autoload.php"); rename($temp_location . "endpoint/base.php", $this->PHONE_MODULES_PATH . "endpoint/base.php"); rename($temp_location . "endpoint/global_template_data.json", $this->PHONE_MODULES_PATH . "endpoint/global_template_data.json"); - $sql = "UPDATE endpointman_global_vars SET value = '" . $endpoint_last_mod . "' WHERE var_name = 'endpoint_vers'"; sql($sql); } } - + $out = $temp['data']['brands']; //Assume that if we can't connect and find the master.xml file then why should we try to find every other file. if ($master_result) { - $row = sql('SELECT * FROM endpointman_brand_list WHERE id > 0', 'getAll', DB_FETCHMODE_ASSOC); + $sql = 'SELECT * FROM endpointman_brand_list WHERE id > 0'; + $row = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); foreach ($out as $data) { $local = sql("SELECT local FROM endpointman_brand_list WHERE directory = '" . $data['directory'] . "'", 'getOne'); - if (!$local) { - $result = $this->system->download_file($this->UPDATE_PATH . $data['directory'] . "/" . $data['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json"); + if ($echomsg == true) { + out(sprintf(_("Update Brand (%s):"), $data['name'])); + $result = $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $data['directory'] . "/" . $data['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json"); + } else { + $result = $this->system->download_file($this->UPDATE_PATH . $data['directory'] . "/" . $data['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json"); + } if (!$result) { - $this->error['brand_update_check'] = "
      Not able to connect to repository. Using local brand [" . $data['name'] . "] file instead."; -if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local brand [%_brandname_%] file instead."), "error", array("%_brandname_%" => $data['name'])); } + $error['brand_update_check'] = sprintf(_("Not able to connect to repository. Using local brand [%s] file instead."), $data['name']); + if ($echomsg == true ) { + out($error['brand_update_check']); + } } } @@ -2558,21 +2560,29 @@ function update_check($echotxt = false) { } $last_mod = max($last_mod, $version[$brand_name]); $version[$brand_name] = $last_mod; - if (!($this->system->arraysearchrecursive($brand_name, $row, 'directory'))) { - //insert row - $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('" . $temp['brand_id'] . "', '" . $temp['name'] . "', '" . $temp['directory'] . "', '" . $version[$brand_name] . "')"; - $_SESSION["sqlerr"] = $sql; - sql($sql); + + if (!($this->system->arraysearchrecursive($brand_name, $row, 'directory'))) + { + $sql = 'SELECT directory FROM endpointman_brand_list where id = "'.$temp['brand_id'].'"'; + $datoif = sql($sql, 'getOne'); + if ($datoif != "") { + $error['brand_update_id_exist_other_brand'] = sprintf(_("You can not add the mark (%s) as the ID (%d) already exists in the database!"), $temp['name'], $temp['brand_id']); + if ($echomsg == true ) { + out($error['brand_update_id_exist_other_brand']); + } + } + else { + $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('" . $temp['brand_id'] . "', '" . $temp['name'] . "', '" . $temp['directory'] . "', '" . $version[$brand_name] . "')"; + sql($sql); + } } else { //in database already! } } else { - $this->error['brand_update_check_local_file'] = "
      Error: No Local File for " . $data['name'] . "!

      Learn how to manually upload packages here (it's easy!):
      Click Here!"; -if ($echotxt) { - echo format_txt(_("Error: No Local File for %_name_% !"), "error", array("%_name_%" => $data['name'])); - echo format_txt(_("Learn how to manually upload packages here (it's easy!):"), "error"); - echo format_txt(_("Click Here!"), "error"); -} + $error['brand_update_check_local_file'] = sprintf(_("Error: No Local File for %s !"), $data['name'])."
      "._("Learn how to manually upload packages here (it's easy!):").""._("Click Here!").""; + if ($echomsg == true ) { + out($error['brand_update_check_local_file']); + } } } @@ -2593,18 +2603,17 @@ function update_check($echotxt = false) { } } } else { - $this->error['brand_update_check_master_file'] = "
      Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!

      Learn how to manually upload packages here (it's easy!): Click Here!"; -if ($echotxt) { - echo format_txt(_("Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"), "error"); - echo format_txt(_("Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"), "error"); - echo format_txt(_("Click Here!"), "error"); -} + $error['brand_update_check_master_file'] = _("Error: Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!")."
      "._("Learn how to manually upload packages here (it's easy!):").""._("Click Here!").""; + if ($echomsg == true ) { + out($error['brand_update_check_local_file']); + } } - return $out; } else { - $this->error['remote_server'] = "The Remote Server Is Currently Syncing With the Master Server, Please try again later"; -if ($echotxt) { echo format_txt(_("The Remote Server Is Currently Syncing With the Master Server, Please try again later"), "error"); } + $error['remote_server'] = _("Error: The Remote Server Is Currently Syncing With the Master Server, Please try again later"); + if ($echomsg == true ) { + out($error['remote_server']); + } } } else { $o = getcwd(); @@ -2678,10 +2687,16 @@ function update_check($echotxt = false) { } sql($sql); - if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'])) { - echo "System Error in Sync Model Function, Load Failure!" . $model_list['model']; -if ($echotxt) { echo format_txt(_("System Error in Sync Model [%_name_%] Function, Load Failure!"), "error", array("%_name_%" => $model_list['model'])); } + if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'], $errsync_modal)) { + $error['sync_module_error'] = sprintf(_("Error: System Error in Sync Model [%s] Function, Load Failure!"), $model_list['model']); + if ($echomsg == true ) { + out($error['sync_module_error']); + foreach ($errsync_modal as $v) { + out($v); + } + } } + unset($errsync_modal); } //Phone Models Move Here $family_id = $brand_id . $family_line_xml['data']['id']; @@ -2689,7 +2704,10 @@ function update_check($echotxt = false) { $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); foreach ($products as $data) { if (!$this->system->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { - echo "Moving/Removing Model '" . $data['model'] . "' not present in JSON file......
      "; + if ($echomsg == true ) { + outn(sprintf(_("Moving/Removing Model '%s' not present in JSON file......"), $data['model'])); + } + $model_name = $data['model']; $sql = 'DELETE FROM endpointman_model_list WHERE id = ' . $data['id']; sql($sql); @@ -2701,6 +2719,7 @@ function update_check($echotxt = false) { $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '" . $data['id'] . "'"; } sql($sql); + out (_("Done!")); } } } @@ -2712,7 +2731,7 @@ function update_check($echotxt = false) { } } } - + /** * Sync the XML files (incuding all template files) from the hard drive with the database * @param int $model Model ID @@ -2729,27 +2748,26 @@ function sync_model($model, &$error = array()) { $sql = "SELECT * FROM endpointman_brand_list WHERE id=" . $model_row['brand']; $brand_row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'])) { - $error['sync_model'] = "Brand Directory '" . $brand_row['directory'] . "' Doesn't Exist! (" . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . ")"; + + $path_brand_dir = $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory']; + $path_brand_dir_cfg = $path_brand_dir . '/' . $product_row['cfg_dir']; + $path_brand_dir_cfg_json = $path_brand_dir_cfg . '/family_data.json'; + + if (!file_exists($path_brand_dir)) { + $error['sync_model'] = sprintf(_("Brand Directory '%s' Doesn't Exist! (%s)"), $brand_row['directory'], $path_brand_dir); return(FALSE); } - - if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'])) { - $error['sync_model'] = "Product Directory '" . $product_row['cfg_dir'] . "' Doesn't Exist! (" . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . ")"; + if (!file_exists($path_brand_dir_cfg)) { + $error['sync_model'] = sprintf(_("Product Directory '%s' Doesn't Exist! (%s)"), $product_row['cfg_dir'], $path_brand_dir_cfg); return(FALSE); } - - if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/family_data.json')) { - - $error['sync_model'] = "File 'family_data.json Doesn't exist in directory: " . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir']; + if (!file_exists($path_brand_dir_cfg_json)) { + $error['sync_model'] = sprintf(_("File 'family_data.json' Doesn't exist in directory: %s"), $path_brand_dir_cfg); return(FALSE); } - - $family_line_json = $this->file2json($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/family_data.json'); - - - - + $family_line_json = $this->file2json($path_brand_dir_cfg_json); + + //TODO: Add local file checks to avoid slow reloading on PHP < 5.3 $key = $this->system->arraysearchrecursive($model_row['model'], $family_line_json['data']['model_list'], 'model'); if ($key === FALSE) { @@ -2782,7 +2800,7 @@ function sync_model($model, &$error = array()) { return(FALSE); } } - + function sys_get_temp_dir() { if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); @@ -2800,74 +2818,68 @@ function sys_get_temp_dir() { } } + /** * Install Firmware for the specified Product Line * @param $product_id Product ID */ function install_firmware($product_id) { + out(_("Installa frimware... ")); + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; $sql = 'SELECT endpointman_product_list.*, endpointman_brand_list.directory FROM endpointman_product_list, endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = ' . $product_id; $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $json_data = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/family_data.json"); - + if ($json_data['data']['firmware_ver'] > $row['firmware_vers']) { if (!file_exists($temp_directory)) { mkdir($temp_directory); } $md5_xml = $json_data['data']['firmware_md5sum']; $firmware_pkg = $json_data['data']['firmware_pkg']; - + if (file_exists($temp_directory . $firmware_pkg)) { $md5_pkg = md5_file($temp_directory . $firmware_pkg); - if ($md5_xml == $md5_pkg) { - echo format_txt(_("Skipping download...")); - } - else - { - echo format_txt(_("Downloading firmware...")); - if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) - { - echo format_txt(_("Error download frimware package!"), "error"); + out(_("Skipping download, updated local version...")); + } else { + out(_("Downloading firmware...")); + if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) { + out(_("Error download frimware package!")); return false; } - echo format_txt(_("Done!"), "done"); $md5_pkg = md5_file($temp_directory . $firmware_pkg); } - } - else - { - echo format_txt(_("Downloading firmware...")); - if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) - { - echo format_txt(_("Error download frimware package!"), "error"); + } else { + out(_("Downloading firmware...")); + if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) { + out(_("Error download frimware package!")); return false; } - echo format_txt(_("Done!"), "done"); $md5_pkg = md5_file($temp_directory . $firmware_pkg); } - - echo format_txt(_("Checking MD5sum of Package...")); + + outn(_("Checking MD5sum of Package... ")); if ($md5_xml == $md5_pkg) { - echo format_txt(_("Matches!"), "done"); - + out(_("Matches!")); + if (file_exists($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware")) { $this->system->rmrf($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware"); } mkdir($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware", 0777, TRUE); - - echo format_txt(_("Installing Firmware...")); + + out(_("Installing Firmware...")); + //TODO: AADIR VALIDACION EXTRACCION CORRECTA exec("tar -xvf " . $temp_directory . $firmware_pkg . " -C " . $temp_directory . $row['directory'] . "/" . $row['cfg_dir']); $i = 0; foreach (glob($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware/*") as $filename) { $file = basename($filename); $list[$i] = $file; if (!@copy($filename, $this->configmod->get('config_location') . $file)) { -echo format_txt(_("- Failed To Copy %_FILE_%!"), "error", array("%_FILE_%" => $file)); - + out(sprintf(_("- Failed To Copy %s!"), $file)); $copy_error = TRUE; } elseif ($this->configmod->get('debug')) { -echo format_txt(_("- Copied %_FILE_% to %_FILETO_%."), "txt", array("%_FILE_%" => $file, "%_FILETO_%" => $this->configmod->get('config_location'))); + out(sprintf(_("- Copied %s to %s."), $file, $this->configmod->get('config_location'))); } $i++; } @@ -2876,32 +2888,32 @@ function install_firmware($product_id) { $list = implode(",", $list); $sql = "UPDATE endpointman_product_list SET firmware_vers = '" . $json_data['data']['firmware_ver'] . "', firmware_files = '" . $list . "' WHERE id = " . $row['id']; sql($sql); - - + if (isset($copy_error)) { - echo format_txt(_("Copy Error Detected! Aborting Install!"), "error"); + out(_("Copy Error Detected! Aborting Install!")); $this->remove_firmware($product_id); - echo format_txt(_("Please Check Directory/Permissions!"), "error"); - } + out(_("Info: Please Check Directory/Permissions!")); + } else { - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } - } + } else { - echo format_txt(_("Firmware MD5 didn't match!"), "error"); + out(_("Firmware MD5 didn't match!")); } - } + } else { - echo format_txt(_("Your Firmware is already up to date"), "done"); + out(_("Your Firmware is already up to date.")); } } - + /** * Remove firmware from the Hard Drive * @param int $id Product ID */ function remove_firmware($id) { - echo format_txt(_("Uninstalla frimware...")); + outn(_("Uninstalla frimware... ")); + $sql = "SELECT firmware_files FROM endpointman_product_list WHERE id ='" . $id . "'"; $files = sql($sql, 'getOne'); @@ -2915,26 +2927,27 @@ function remove_firmware($id) { } $sql = "UPDATE endpointman_product_list SET firmware_files = '', firmware_vers = '' WHERE id = '" . $id . "'"; sql($sql); - - echo format_txt(_("Done!"), "done"); + + out(_("Done!")); } - + /** * Remove the brand * @param int $id Brand ID */ function remove_brand($id=NULL, $remove_configs=FALSE, $force=FALSE) { - echo format_txt(_("Uninstalla Brand...")); + out(_("Uninstalla Brand...")); + if (!$this->configmod->get('use_repo')) { $sql = "SELECT id, firmware_vers FROM endpointman_product_list WHERE brand = '" . $id . "'"; $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); - + foreach ($products as $data) { if ($data['firmware_vers'] != "") { $this->remove_firmware($data['id']); } } - + $sql = "SELECT directory FROM endpointman_brand_list WHERE id = '" . $id . "'"; $brand_dir = sql($sql, 'getOne'); $this->system->rmrf($this->PHONE_MODULES_PATH . "endpoint/" . $brand_dir); @@ -2951,9 +2964,9 @@ function remove_brand($id=NULL, $remove_configs=FALSE, $force=FALSE) { $this->system->rmrf($this->PHONE_MODULES_PATH . $brand_dir); $sql = "DELETE FROM endpointman_brand_list WHERE id = '" . $id . "'"; sql($sql); - - echo format_txt(_("All Done!"), "done"); - } + + out(_("All Done!")); + } elseif ($force) { $sql = "SELECT directory FROM endpointman_brand_list WHERE id = '" . $id . "'"; $brand_dir = sql($sql, 'getOne'); @@ -2969,76 +2982,78 @@ function remove_brand($id=NULL, $remove_configs=FALSE, $force=FALSE) { $sql = "DELETE FROM endpointman_brand_list WHERE id = '" . $id . "'"; sql($sql); - - echo format_txt(_("Done!"), "done"); - } + + out(_("Done!")); + } else { - echo format_txt(_("Not allowed in repo mode!!"), "error"); + out(_("Error: Not allowed in repo mode!!")); } } - + /** * This will download the xml & brand package remotely * @param integer $id Brand ID */ function download_brand($id) { + out(_("Install/Update Brand...")); if (!$this->configmod->get('use_repo')) { $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; - + if (!file_exists($temp_directory)) { - echo format_txt(_("Creating EPM temp directory")); + out(_("Creating EPM temp directory")); if (! mkdir($temp_directory)) { - echo format_txt(_("Error creating directory: %_DIR_%"), "error", array("%_DIR_%" => $temp_directory)); - echo format_txt(_("Please Check Directory/Permissions!"), "error"); + out(sprintf(_("Error: Failed to create the directory '%s', please Check Permissions!"), $temp_directory)); return false; } } - - echo format_txt(_("Downloading Brand JSON.....")); + + outn(_("Downloading Brand JSON..... ")); $row = sql('SELECT * FROM endpointman_brand_list WHERE id =' . $id, 'getAll', DB_FETCHMODE_ASSOC); $result = $this->system->download_file($this->UPDATE_PATH . $row[0]['directory'] . "/" . $row[0]['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $row[0]['directory'] . "/brand_data.json"); if ($result) { - echo format_txt(_("Done!"), "done"); + out(_("Done!")); $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/' . $row[0]['directory'] . '/brand_data.json'); $package = $temp['data']['brands']['package']; - echo format_txt(_("Downloading Brand Package...")); - if ($this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row[0]['directory'] . '/' . $package, $temp_directory . $package)) { - echo format_txt(_("Done!"), "done"); + out(_("Downloading Brand Package...")); + if ($this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row[0]['directory'] . '/' . $package, $temp_directory . $package)) + { if (file_exists($temp_directory . $package)) { $md5_xml = $temp['data']['brands']['md5sum']; $md5_pkg = md5_file($temp_directory . $package); - - echo format_txt(_("Checking MD5sum of Package....")); + + outn(_("Checking MD5sum of Package.... ")); if ($md5_xml == $md5_pkg) { - echo format_txt(_("Done!"), "done"); - - echo format_txt(_("Extracting Tarball........")); + out(_("Done!")); + + outn(_("Extracting Tarball........ ")); + //TODO: PENDIENTE VALIDAR SI DA ERROR LA DESCOMPRESION exec("tar -xvf " . $temp_directory . $package . " -C " . $temp_directory); - echo format_txt(_("Done!"), "done"); - + out(_("Done!")); + //Update File in the temp directory copy($this->PHONE_MODULES_PATH . 'endpoint/' . $row[0]['directory'] . '/brand_data.json', $temp_directory . $row[0]['directory'] . '/brand_data.json'); $this->update_brand($row[0]['directory'], TRUE); } else { - echo format_txt(_("MD5 Did not match!"), "error"); - echo format_txt(_("MD5 XML: %_MD5_%"), "error", array("%_MD5_%" => $md5_xml)); - echo format_txt(_("MD5 PKG: %_MD5_%"), "error", array("%_MD5_%" => $md5_pkg)); + out(_("MD5 Did not match!")); + out(sprintf(_("MD5 XML: %s"), $md5_xml)); + out(sprintf(_("MD5 PKG: %s"), $md5_pkg)); } } else { - echo format_txt(_("Can't Find Downloaded File!"), "error"); + out(_("Error: Can't Find Downloaded File!")); } } else { - echo format_txt(_("Error download Brand package!"), "error"); + out(_("Error download Brand package!")); } } else { - echo format_txt(_("Error Connecting to the Package Repository. Module not installed. Please Try again later."), "error"); - echo format_txt(_("You Can Also Manually Update The Repository By Downloading Files here: %_URL_INI_% Release Repo %_URL_END_%"), "error", array ( "%_URL_INI_%" => "", "%_URL_END_%" => "")); - echo format_txt(_("Then Use Manual Upload in Advanced Settings."), "error"); + out(_("Error!")); + out(_("Error Connecting to the Package Repository. Module not installed. Please Try again later.")); + out(_("You Can Also Manually Update The Repository By Downloading Files here: Release Repo ")); + out(_("Then Use Manual Upload in Advanced Settings.")); } } else { - echo format_txt(_("Installing brands is disabled while in repo mode!"), "error"); + out(_("Error: Installing brands is disabled while in repo mode!")); } } @@ -3047,15 +3062,15 @@ function download_brand($id) { * Still needs way to determine when models move...perhaps another function? */ function update_brand($package, $remote=TRUE) { -if ($this->configmod->get('debug')) echo format_txt(_("update_brand(): Debug is set to %_DEBUG_MODE_%"), "",array("%_DEBUG_MODE_%" => $this->configmod->get('debug'))); - + out(sprintf(_("Update Brand %s ... "), $package)); + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; if ($this->configmod->get('debug')) echo format_txt(_("Processing %_PATH_%/brand_data.json..."), "",array("%_PATH_%" => $temp_directory.$package)); - + if (file_exists($temp_directory . $package . '/brand_data.json')) { $temp = $this->file2json($temp_directory . $package . '/brand_data.json'); if (key_exists('directory', $temp['data']['brands'])) { - echo format_txt(_("Appears to be a valid Provisioner.net JSON file.....Continuing")); + out(_("Appears to be a valid Provisioner.net JSON file.....Continuing")); //Pull in all variables $directory = $temp['data']['brands']['directory']; $brand_name = $temp['data']['brands']['name']; @@ -3063,7 +3078,8 @@ function update_brand($package, $remote=TRUE) { $brand_version = $temp['data']['brands']['last_modified']; //create directory structure and move files - echo format_txt(_("Creating Directory Structure for Brand '%_NAME_%' and Moving Files .."), "",array("%_NAME_%" => $brand_name)); + out(sprintf(_("Creating Directory Structure for Brand '%s' and Moving Files..."), $brand_name)); + if (!file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $directory)) { mkdir($this->PHONE_MODULES_PATH . "endpoint/" . $directory); } @@ -3082,14 +3098,14 @@ function update_brand($package, $remote=TRUE) { $dir = str_replace($temp_directory . $directory . "/", "", $file); $stats = rename($file, $this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir); if ($stats === FALSE) { - echo format_txt(_("- Error Moving %_FILENAME_%!"), "error",array("%_FILENAME_%" => basename($file))); + out(sprintf(_("- Error Moving %s!"), basename($file))); } chmod($this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0775); //echo "."; } } } - echo format_txt(_("Done!"), "done"); + out(_("All Done!")); if ($remote) { $local = 0; @@ -3099,18 +3115,20 @@ function update_brand($package, $remote=TRUE) { $b_data = sql("SELECT id FROM endpointman_brand_list WHERE id = '" . $brand_id . "'", 'getOne'); if ($b_data) { -echo format_txt(_("Updating %_BRANDNAME_% brand data.........."), "", array("%_BRANDNAME_%" => $brand_name)); + outn(sprintf(_("Updating %s brand data ..."), $brand_name)); $sql = "UPDATE endpointman_brand_list SET local = '" . $local . "', name = '" . $brand_name . "', cfg_ver = '" . $brand_version . "', installed = 1, hidden = 0 WHERE id = " . $brand_id; sql($sql); + out(_("Done!")); } else { -echo format_txt(_("Inserting %_BRANDNAME_% brand data.........."), "", array("%_BRANDNAME_%" => $brand_name)); + outn(sprintf(_("Inserting %s brand data ..."), $brand_name)); $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '" . $local . "', '1')"; sql($sql); + out(_("Done!")); } $last_mod = ""; foreach ($temp['data']['brands']['family_list'] as $family_list) { - echo format_txt(_("Updating Family Lines.................")); + out(_("Updating Family Lines ...")); $last_mod = max($last_mod, $family_list['last_modified']); @@ -3119,29 +3137,29 @@ function update_brand($package, $remote=TRUE) { $require_firmware = NULL; if ((key_exists('require_firmware', $family_line_xml['data'])) && ($remote) && ($family_line_xml['data']['require_firmware'] == "TRUE")) { - echo format_txt(_("Firmware Requirment Detected!..........")); - $this->install_firmware($family_line_xml['data']['id']); + out(_("Firmware Requirment Detected!..........")); + $this->install_firmware($family_line_xml['data']['id']); } $data = sql("SELECT id FROM endpointman_product_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . "'", 'getOne'); $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); - + if ($data) { if ($this->configmod->get('debug')) echo "-Updating Family ".$short_name."
      "; $sql = "UPDATE endpointman_product_list SET short_name = '" . str_replace("'", "''", $short_name) . "', long_name = '" . str_replace("'", "''", $family_line_xml['data']['name']) . "', cfg_ver = '" . $family_line_xml['data']['version'] . "', config_files='" . $family_line_xml['data']['configuration_files'] . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . "'"; - } + } else { if ($this->configmod->get('debug')) echo "-Inserting Family ".$short_name."
      "; $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . str_replace("'", "''", $short_name) . "', '" . str_replace("'", "''", $family_line_xml['data']['name']) . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['last_modified'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')"; } sql($sql); - + if (count($family_line_xml['data']['model_list']) > 0) { - echo format_txt(_("-- Updating Model Lines................")); + out(_("-- Updating Model Lines ... ")); foreach ($family_line_xml['data']['model_list'] as $model_list) { $template_list = implode(",", $model_list['template_data']); - + $model_final_id = $brand_id . $family_line_xml['data']['id'] . $model_list['id']; $sql = 'SELECT id, global_custom_cfg_data, global_user_cfg_data FROM endpointman_mac_list WHERE model = ' . $model_final_id; $old_data = NULL; @@ -3149,7 +3167,7 @@ function update_brand($package, $remote=TRUE) { foreach ($old_data as $data) { $global_custom_cfg_data = unserialize($data['global_custom_cfg_data']); if ((is_array($global_custom_cfg_data)) AND (!array_key_exists('data', $global_custom_cfg_data))) { -echo format_txt(_("----Old Data Detected! Migrating......")); +outn(_("----Old Data Detected! Migrating ... ")); $new_data = array(); $new_ari = array(); foreach ($global_custom_cfg_data as $key => $old_keys) { @@ -3169,9 +3187,9 @@ function update_brand($package, $remote=TRUE) { $final_data = serialize($final_data); $sql = "UPDATE endpointman_mac_list SET global_custom_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; sql($sql); - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } - + $global_user_cfg_data = unserialize($data['global_user_cfg_data']); $old_check = FALSE; if (is_array($global_user_cfg_data)) { @@ -3189,7 +3207,7 @@ function update_brand($package, $remote=TRUE) { } } if ((is_array($global_user_cfg_data)) AND ($old_check)) { -echo format_txt(_("Old Data Detected! Migrating......")); +outn(_("Old Data Detected! Migrating ... ")); $new_data = array(); foreach ($global_user_cfg_data as $key => $old_keys) { if (array_key_exists('value', $old_keys)) { @@ -3205,7 +3223,7 @@ function update_brand($package, $remote=TRUE) { $final_data = serialize($new_data); $sql = "UPDATE endpointman_mac_list SET global_user_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; sql($sql); - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } } $old_data = NULL; @@ -3214,7 +3232,7 @@ function update_brand($package, $remote=TRUE) { foreach ($old_data as $data) { $global_custom_cfg_data = unserialize($data['global_custom_cfg_data']); if ((is_array($global_custom_cfg_data)) AND (!array_key_exists('data', $global_custom_cfg_data))) { -echo format_txt(_("Old Data Detected! Migrating......")); +out(_("Old Data Detected! Migrating ... ")); $new_data = array(); $new_ari = array(); foreach ($global_custom_cfg_data as $key => $old_keys) { @@ -3234,37 +3252,38 @@ function update_brand($package, $remote=TRUE) { $final_data = serialize($final_data); $sql = "UPDATE endpointman_template_list SET global_custom_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; sql($sql); - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } } - + $m_data = sql("SELECT id FROM endpointman_model_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'", 'getOne'); if ($m_data) { if ($this->configmod->get('debug')) echo format_txt(_("---Updating Model %_NAMEMOD_%"), "", array("%_NAMEMOD_%" => $model_list['model'])); $sql = "UPDATE endpointman_model_list SET max_lines = '" . $model_list['lines'] . "', model = '" . $model_list['model'] . "', template_list = '" . $template_list . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'"; - } + } else { if ($this->configmod->get('debug')) echo format_txt(_("---Inserting Model %_NAMEMOD_%"), "", array("%_NAMEMOD_%" => $model_list['model'])); $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "', '" . $brand_id . "', '" . $model_list['model'] . "', '" . $model_list['lines'] . "', '" . $brand_id . $family_line_xml['data']['id'] . "', '" . $template_list . "', '0', '0')"; } sql($sql); - + + //echo "brand_id:".$brand_id. " - family_line_xml:" . $family_line_xml['data']['id'] . "- model_list:" . $model_list['id']."
      "; if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'], $errlog)) { - echo format_txt(_("System Error in Sync Model Function, Load Failure!"), "error"); - echo format_txt($errlog['sync_model'], "error"); + out(_("Error: System Error in Sync Model Function, Load Failure!")); + out(_("Error: ").$errlog['sync_model']); } unset ($errlog); } } - - + //END Updating Model Lines................ + //Phone Models Move Here $family_id = $brand_id . $family_line_xml['data']['id']; $sql = "SELECT * FROM endpointman_model_list WHERE product_id = " . $family_id; $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); foreach ($products as $data) { if (!$this->system->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { - echo format_txt(_("Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......"), "", array("%_NAMEMOD_%" => $data['model'])); + outn(sprintf(_("Moving/Removing Model '%s' not present in JSON file ... "), $data['model'])); $model_name = $data['model']; $sql = 'DELETE FROM endpointman_model_list WHERE id = ' . $data['id']; sql($sql); @@ -3276,14 +3295,14 @@ function update_brand($package, $remote=TRUE) { $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '" . $data['id'] . "'"; } sql($sql); + out(_("Done!")); } } } - - if ($this->configmod->get('debug')) { - echo format_txt(_("Done!"), "done"); - echo format_txt(_("Updating OUI list in DB")); - } + out(_("All Done!")); + //END Updating Family Lines + + outn(_("Updating OUI list in DB ... ")); if ((isset($temp['data']['brands']['oui_list'])) AND (count($temp['data']['brands']['oui_list']) > 0)) { foreach ($temp['data']['brands']['oui_list'] as $oui) { @@ -3291,50 +3310,20 @@ function update_brand($package, $remote=TRUE) { sql($sql); } } - - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } else { - echo format_txt(_("Invalid JSON Structure in %_PATH_%/brand_data.json"), "", array("%_PATH_%" => $temp_directory.$package), "error"); + outn(sprintf(_("Error: Invalid JSON Structure in %s/brand_data.json"), $temp_directory.$package)); } } else { - echo format_txt(_("No 'brand_data.xml' file exists!"), "error"); + out(_("Error: No 'brand_data.xml' file exists!")); } - echo format_txt(_("Removing Temporary Files..............")); + outn(_("Removing Temporary Files... ")); $this->system->rmrf($temp_directory . $package); - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + /** * Returns list of Brands that are installed and not hidden and that have at least one model enabled under them * @param integer $selected ID Number of the brand that is supposed to be selected in a drop-down list box @@ -3342,7 +3331,6 @@ function update_brand($package, $remote=TRUE) { */ function brands_available($selected = NULL, $show_blank=TRUE) { $data = $this->eda->all_active_brands(); - $temp = array(); if ($show_blank) { $temp[0]['value'] = ""; $temp[0]['text'] = ""; @@ -3362,7 +3350,7 @@ function brands_available($selected = NULL, $show_blank=TRUE) { } return($temp); } - + function listTZ($selected) { require_once('lib/datetimezone.class.php'); $data = \DateTimeZone::listIdentifiers(); @@ -3380,7 +3368,7 @@ function listTZ($selected) { return($temp); } - + function has_git() { exec('which git', $output); @@ -3395,7 +3383,7 @@ function has_git() { return!empty($matches[0]) ? $git : false; echo!empty($matches[0]) ? 'installed' : 'nope'; } - + function tftp_check() { //create a simple block here incase people have strange issues going on as we will kill http //by running this if the server isn't really running! @@ -3438,8 +3426,8 @@ function tftp_check() { echo 'TFTP Server check failed on last past. Skipping'; } } - - + + /** * Used to send sample configurations to provisioner.net * NOTE: The user has to explicitly click a link that states they are sending the configuration to the project @@ -3451,14 +3439,14 @@ function tftp_check() { */ function submit_config($brand, $product, $orig_name, $data) { $posturl = 'http://www.provisioner.net/submit_config.php'; - + $fp = fopen($this->LOCAL_PATH . 'data.txt', 'w'); fwrite($fp, $data); fclose($fp); $file_name_with_full_path = $this->LOCAL_PATH . "data.txt"; - + $postvars = array('brand' => $brand, 'product' => $product, 'origname' => htmlentities(addslashes($orig_name)), 'file_contents' => '@' . $file_name_with_full_path); - + $ch = curl_init($posturl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); @@ -3466,17 +3454,17 @@ function submit_config($brand, $product, $orig_name, $data) { curl_setopt($ch, CURLOPT_HEADER, 0); // DO NOT RETURN HTTP HEADERS curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // RETURN THE CONTENTS OF THE CALL, probably not needed $Rec_Data = curl_exec($ch); - + ob_start(); header("Content-Type: text/html"); $Final_Out = ob_get_clean(); curl_close($ch); unlink($file_name_with_full_path); - + return($Final_Out); } - - + + /** * Fixes the display are special strings so we can visible see them instead of them being transformed * @param string $contents a string of course @@ -3490,9 +3478,9 @@ function display_htmlspecialchars($contents) { $contents = str_replace("'", "&#039;", $contents); return($contents); } - - - + + + function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname=NULL) { $mac = $this->mac_check_clean($mac); if ($mac) { @@ -3506,12 +3494,12 @@ function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname if ($this->sync_model($model)) { $sql = "SELECT id,template_id FROM endpointman_mac_list WHERE mac = '" . $mac . "'"; $dup = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + if ($dup) { if (!isset($template)) { $template = $dup['template_id']; } - + $sql = "UPDATE endpointman_mac_list SET model = " . $model . ", template_id = " . $template . " WHERE id = " . $dup['id']; sql($sql); $return = $this->add_line($dup['id'], $line, $ext); @@ -3524,38 +3512,38 @@ function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname if (!isset($template)) { $template = 0; } - + $sql = "SELECT mac_id FROM endpointman_line_list WHERE ext = " . $ext; $used = sql($sql, 'getOne'); - + if (($used) AND (! $this->configmod->get('show_all_registrations'))) { $this->error['add_device'] = "You can't assign the same user to multiple devices!"; return(FALSE); } - + if (!isset($displayname)) { $sql = 'SELECT description FROM devices WHERE id = ' . $ext; $name = & sql($sql, 'getOne'); } else { $name = $displayname; } - + $sql = 'SELECT endpointman_product_list. * , endpointman_model_list.template_data, endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id = \'' . $model . '\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id'; $row = & sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `template_id`) VALUES ('" . $mac . "', '" . $model . "', '" . $template . "')"; sql($sql); - + $sql = 'SELECT last_insert_id()'; $ext_id = & sql($sql, 'getOne'); - + if (empty($line)) { $line = 1; } - + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $ext_id . "', '" . $ext . "', '" . $line . "', '" . addslashes($name) . "')"; sql($sql); - + $this->message['add_device'][] = "Added " . $name . " to line " . $line; return($ext_id); } @@ -3569,32 +3557,32 @@ function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname return(FALSE); } } - - + + function add_line($mac_id, $line=NULL, $ext=NULL, $displayname=NULL) { if ((!isset($line)) AND (!isset($ext))) { if ($this->linesAvailable(NULL, $mac_id)) { if ($this->eda->all_unused_registrations()) { $sql = 'SELECT * FROM endpointman_line_list WHERE mac_id = ' . $mac_id; $lines_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - + foreach ($lines_list as $row) { $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; $name = sql($sql, 'getOne'); - + $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . $this->eda->escapeSimple($name) . "' WHERE luid = " . $row['luid']; sql($sql); } - + $reg = array_values($this->display_registration_list()); $lines = array_values($this->linesAvailable(NULL, $mac_id)); - + $sql = "SELECT description FROM devices WHERE id = " . $reg[0]['value']; $name = $this->eda->sql($sql, 'getOne'); - + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $reg[0]['value'] . "', '" . $lines[0]['value'] . "', '" . addslashes($name) . "')"; $this->eda->sql($sql); - + $this->message['add_line'] = "Added '" . $name . "' to line '" . $lines[0]['value'] . "' on device '" . $reg[0]['value'] . "'
      Configuration Files will not be Generated until you click Save!"; return($mac_id); } else { @@ -3609,10 +3597,10 @@ function add_line($mac_id, $line=NULL, $ext=NULL, $displayname=NULL) { if ($this->linesAvailable(NULL, $mac_id)) { if ($this->eda->all_unused_registrations()) { $lines = array_values($this->linesAvailable(NULL, $mac_id)); - + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $ext . "', '" . $lines[0]['value'] . "', '" . addslashes($displayname) . "')"; sql($sql); - + $this->message['add_line'] = "Added '" . $name . "' to line '" . $lines[0]['value'] . "' on device '" . $reg[0]['value'] . "'
      Configuration Files will not be Generated until you click Save!"; return($mac_id); } else { @@ -3636,7 +3624,7 @@ function add_line($mac_id, $line=NULL, $ext=NULL, $displayname=NULL) { } else { $name = $displayname; } - + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $ext . "', '" . $line . "', '" . addslashes($name) . "')"; sql($sql); $this->message['add_line'] .= "Added " . $name . " to line " . $line . "
      "; @@ -3645,25 +3633,25 @@ function add_line($mac_id, $line=NULL, $ext=NULL, $displayname=NULL) { } } - + function linesAvailable($lineid=NULL, $macid=NULL) { if (isset($lineid)) { $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = (SELECT endpointman_mac_list.model FROM endpointman_mac_list, endpointman_line_list WHERE endpointman_line_list.luid = " . $lineid . " AND endpointman_line_list.mac_id = endpointman_mac_list.id)"; - + $sql_l = "SELECT line, mac_id FROM `endpointman_line_list` WHERE luid = " . $lineid; $line = sql($sql_l, 'getRow', DB_FETCHMODE_ASSOC); - + $sql_lu = "SELECT line FROM endpointman_line_list WHERE mac_id = " . $line['mac_id']; } elseif (isset($macid)) { $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = (SELECT model FROM endpointman_mac_list WHERE id =" . $macid . ")"; $sql_lu = "SELECT line FROM endpointman_line_list WHERE mac_id = " . $macid; - + $line['line'] = 0; } - + $max_lines = sql($sql, 'getOne'); $lines_used = sql($sql_lu, 'getAll'); - + for ($i = 1; $i <= $max_lines; $i++) { if ($i == $line['line']) { $temp[$i]['value'] = $i; @@ -3682,8 +3670,8 @@ function linesAvailable($lineid=NULL, $macid=NULL) { return FALSE; } } - - + + /** * This function takes a string and tries to determine if it's a valid mac addess, return FALSE if invalid * @param string $mac The full mac address @@ -3728,13 +3716,13 @@ function mac_check_clean($mac) { return(FALSE); } } - + /** * Display all unused registrations from whatever manager we are using! * @return */ function display_registration_list($line_id=NULL) { - + if (isset($line_id)) { $result = $this->eda->all_unused_registrations(); $line_data = $this->eda->get_line_information($line_id); @@ -3742,7 +3730,7 @@ function display_registration_list($line_id=NULL) { $result = $this->eda->all_unused_registrations(); $line_data = NULL; } - + $i = 1; $temp = array(); foreach ($result as $row) { @@ -3750,17 +3738,17 @@ function display_registration_list($line_id=NULL) { $temp[$i]['text'] = $row['id'] . " --- " . $row['description']; $i++; } - + if (isset($line_data)) { $temp[$i]['value'] = $line_data['ext']; $temp[$i]['text'] = $line_data['ext'] . " --- " . $line_data['description']; $temp[$i]['selected'] = "selected"; } - + return($temp); } - - + + /** * Taken from PHP.net. A list of errors returned when uploading files. * @param $error_code @@ -3786,7 +3774,7 @@ function file_upload_error_message($error_code) { return _('Unknown upload error'); } } - + /** * Send this function an ID from the mac devices list table and you'll get all the information we have on that particular phone * @param integer $mac_id ID number reference from the MySQL database referencing the table endpointman_mac_list @@ -3840,23 +3828,23 @@ function get_phone_info($mac_id=NULL) { return(FALSE); } $sql = "SELECT id FROM endpointman_mac_list WHERE model > 0 AND id =" . $mac_id; - + $res = sql($sql); if ($res->numRows()) { //Returns Brand Name, Brand Directory, Model Name, Mac Address, Extension (FreePBX), Custom Configuration Template, Custom Configuration Data, Product Name, Product ID, Product Configuration Directory, Product Configuration Version, Product XML name, $sql = "SELECT endpointman_mac_list.specific_settings, endpointman_mac_list.config_files_override, endpointman_mac_list.global_user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_mac_list.template_id, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_model_list.template_data, endpointman_model_list.enabled, endpointman_mac_list.global_settings_override FROM endpointman_line_list, endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.id = " . $mac_id; $phone_info = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + if (!$phone_info) { $this->error['get_phone_info'] = "Error with SQL Statement"; } - + //If there is a template associated with this phone then pull that information and put it into the array if ($phone_info['template_id'] > 0) { $sql = "SELECT name, global_custom_cfg_data, config_files_override, global_settings_override FROM endpointman_template_list WHERE id = " . $phone_info['template_id']; $phone_info['template_data_info'] = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); } - + $sql = "SELECT endpointman_line_list.*, sip.data as secret, devices.*, endpointman_line_list.description AS epm_description FROM endpointman_line_list, sip, devices WHERE endpointman_line_list.ext = devices.id AND endpointman_line_list.ext = sip.id AND sip.keyword = 'secret' AND mac_id = " . $mac_id . " ORDER BY endpointman_line_list.line ASC"; $lines_info = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); foreach ($lines_info as $line) { @@ -3868,7 +3856,7 @@ function get_phone_info($mac_id=NULL) { $sql = "SELECT id, mac FROM endpointman_mac_list WHERE id =" . $mac_id; //Phone is unknown, we need to display this to the end user so that they can make corrections $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $brand = $this->get_brand_from_mac($row['mac']); if ($brand) { $phone_info['brand_id'] = $brand['id']; @@ -3877,7 +3865,7 @@ function get_phone_info($mac_id=NULL) { $phone_info['brand_id'] = 0; $phone_info['name'] = 'Unknown'; } - + $phone_info['id'] = $mac_id; $phone_info['model_id'] = 0; $phone_info['product_id'] = 0; @@ -3891,7 +3879,7 @@ function get_phone_info($mac_id=NULL) { } return $phone_info; } - + /** * Get the brand from any mac sent to this function * @param string $mac @@ -3902,16 +3890,16 @@ function get_brand_from_mac($mac) { if (!$this->mac_check_clean($mac)) { return(FALSE); } - + //Get the OUI only $oui = substr($this->mac_check_clean($mac), 0, 6); //Find the matching brand model to the oui $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%" . $oui . "%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; $brand = sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); - + $res = sql($oui_sql); $brand_count = $res->numRows(); - + if (!$brand_count) { //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. $phone_info['id'] = 0; @@ -3920,19 +3908,19 @@ function get_brand_from_mac($mac) { $phone_info['id'] = $brand['id']; $phone_info['name'] = $brand['name']; } - + return($phone_info); } - - - + + + /** * Prepare and then send the data that Provisioner expects, then take what provisioner gives us and do what it says * @param array $phone_info Everything from get_phone_info * @param bool $reboot Reboot the Phone after write * @param bool $write Write out Directory structure. */ - function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) + function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) { $this->PROVISIONER_BASE = $this->PHONE_MODULES_PATH; //define('PROVISIONER_BASE', $this->PROVISIONER_BASE); @@ -3940,7 +3928,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) if (!class_exists('ProvisionerConfig')) { require($this->PHONE_MODULES_PATH . 'autoload.php'); } - + //Load Provisioner $class = "endpoint_" . $phone_info['directory'] . "_" . $phone_info['cfg_dir'] . '_phone'; $base_class = "endpoint_" . $phone_info['directory'] . '_base'; @@ -3954,10 +3942,10 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) if (!class_exists($class)) { ProvisionerConfig::endpointsAutoload($class); } - + if (class_exists($class)) { $provisioner_lib = new $class(); - + //Determine if global settings have been overridden if ($phone_info['template_id'] > 0) { if (isset($phone_info['template_data_info']['global_settings_override'])) { @@ -3978,25 +3966,25 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) $settings['tz'] = $this->configmod->get('tz'); } } - - - + + + //Tell the system who we are and were to find the data. $provisioner_lib->root_dir = $this->PHONE_MODULES_PATH; $provisioner_lib->engine = 'asterisk'; $provisioner_lib->engine_location = $this->configmod->get('asterisk_location','asterisk'); $provisioner_lib->system = 'unix'; - + //have to because of versions less than php5.3 $provisioner_lib->brand_name = $phone_info['directory']; $provisioner_lib->family_line = $phone_info['cfg_dir']; - - - + + + //Phone Model (Please reference family_data.xml in the family directory for a list of recognized models) //This has to match word for word. I really need to fix this.... $provisioner_lib->model = $phone_info['model']; - + //Timezone try { $provisioner_lib->DateTimeZone = new DateTimeZone($settings['tz']); @@ -4004,7 +3992,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) $this->error['parse_configs'] = 'Error Returned From Timezone Library: ' . $e->getMessage(); return(FALSE); } - + $temp = ""; $template_data = unserialize($phone_info['template_data']); $global_user_cfg_data = unserialize($phone_info['global_user_cfg_data']); @@ -4037,7 +4025,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) } } } - + if (!empty($global_custom_cfg_data)) { if (array_key_exists('data', $global_custom_cfg_data)) { $global_custom_cfg_ari = $global_custom_cfg_data['ari']; @@ -4047,7 +4035,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) $global_custom_cfg_ari = array(); } } - + $new_template_data = array(); $line_ops = array(); if (is_array($global_custom_cfg_data)) { @@ -4082,7 +4070,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) } } } - + if (!$write) { $new_template_data['provision']['type'] = 'dynamic'; $new_template_data['provision']['protocol'] = 'http'; @@ -4094,9 +4082,9 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) $new_template_data['provision']['path'] = $settings['srvip']; $new_template_data['provision']['encryption'] = FALSE; } - + $new_template_data['ntp'] = $settings['ntp']; - + //Overwrite all specific settings variables now if (!empty($phone_info['specific_settings'])) { $specific_settings = unserialize($phone_info['specific_settings']); @@ -4104,24 +4092,24 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) } else { $specific_settings = array(); } - + //Set Variables according to the template_data files included. We can include different template.xml files within family_data.xml also one can create //template_data_custom.xml which will get included or template_data__custom.xml which will also get included //line 'global' will set variables that aren't line dependant - - + + $provisioner_lib->settings = $new_template_data; - + //Loop through Lines! $li = 0; foreach ($phone_info['line'] as $line) { $line_options = is_array($line_ops[$line['line']]) ? $line_ops[$line['line']] : array(); $line_statics = array('line' => $line['line'], 'username' => $line['ext'], 'authname' => $line['ext'], 'secret' => $line['secret'], 'displayname' => $line['description'], 'server_host' => $this->global_cfg['srvip'], 'server_port' => '5060', 'user_extension' => $line['user_extension']); - + $provisioner_lib->settings['line'][$li] = array_merge($line_options, $line_statics); $li++; } - + if (array_key_exists('data', $specific_settings)) { foreach ($specific_settings['data'] as $key => $data) { $default_exp = preg_split("/\|/i", $key); @@ -4169,20 +4157,20 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) } } } - + $provisioner_lib->settings['mac'] = $phone_info['mac']; $provisioner_lib->mac = $phone_info['mac']; - + //Setting a line variable here...these aren't defined in the template_data.xml file yet. however they will still be parsed //and if they have defaults assigned in a future template_data.xml or in the config file using pipes (|) those will be used, pipes take precedence $provisioner_lib->processor_info = "EndPoint Manager Version " . $this->global_cfg['version']; - + // Because every brand is an extension (eventually) of endpoint, you know this function will exist regardless of who it is //Start timer $time_start = microtime(true); - + $provisioner_lib->debug = TRUE; - + try { $returned_data = $provisioner_lib->generate_all_files(); } catch (Exception $e) { @@ -4211,7 +4199,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) return(FALSE); } } - + function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $returned_data) { //Create Directory Structure (If needed) if (isset($provisioner_lib->directory_structure)) { @@ -4240,7 +4228,7 @@ function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $ret } } } - + //Copy Files (If needed) if (isset($provisioner_lib->copy_files)) { foreach ($provisioner_lib->copy_files as $data) { @@ -4264,7 +4252,7 @@ function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $ret } } } - + foreach ($returned_data as $file => $data) { if (((file_exists($write_path . $file)) AND (is_writable($write_path . $file)) AND (!in_array($file, $provisioner_lib->protected_files))) OR (!file_exists($write_path . $file))) { //Move old file to backup @@ -4290,116 +4278,683 @@ function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $ret return(FALSE); } } - + if ($reboot) { $provisioner_lib->reboot(); } } + + /** + * Custom Means specific to that MAC + * id is either the mac ID (not address) or the template ID + * @param integer $id + * @param integer $custom + */ + function edit_template_display($id, $custom) { + //endpointman_flush_buffers(); + + $alt_configs = NULL; + + if ($custom == 0) { + $sql = "SELECT model_id FROM endpointman_template_list WHERE id=" . $id; + } else { + $sql = "SELECT model FROM endpointman_mac_list WHERE id=" . $id; + } + + $model_id = sql($sql, 'getOne'); + + //Make sure the model data from the local confg files are stored in the database and vice-versa. Serious errors will occur if the database is not in sync with the local file + if (!$this->sync_model($model_id)) { + die("unable to sync local template files - TYPE:" . $custom); + } + + + + + + + + + $dReturn = array(); + + + //Determine if we are dealing with a general template or a specific [for that phone only] template (custom =0 means general) + if ($custom == 0) { + $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_template_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_product_list.short_name, endpointman_product_list.id as product_id, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = " . $id; + } else { + $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_line_list.*, endpointman_model_list.id as model_id, endpointman_model_list.template_data, endpointman_product_list.id as product_id, endpointman_product_list.short_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list, endpointman_line_list WHERE endpointman_mac_list.id=" . $id . " AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; + } + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + + $dReturn['template_editor_display'] = 1; + + //Let the template system know if we are working with a general template or a specific [for that phone only] template + $dReturn['custom'] = $custom; + if ($custom) + { + $dReturn['ext'] = $row['ext']; + } + else + { + $dReturn['template_name'] = $row['name']; + } + $dReturn['product'] = $row['short_name']; + $dReturn['model'] = $row['model_name']; + + if ($ma = $this->models_available($row['model_id'], NULL, $row['product_id'])) { + $dReturn['models_ava'] = $ma; + } + + if (isset($_REQUEST['maxlines'])) { + $areas = $this->areaAvailable($row['model_id'], $_REQUEST['maxlines']); + } else { + $areas = $this->areaAvailable($row['model_id'], 1); + } + $dReturn['area_ava'] = $areas; + + + //Start the display of the html file in the product folder + if ($row['config_files_override'] == "") { + $config_files_saved = ""; + } else { + $config_files_saved = unserialize($row['config_files_override']); + } + $config_files_list = explode(",", $row['config_files']); + $i = 0; + $alt = 0; + + $i = 0; + $b = 0; + $only_configs = array(); + foreach ($config_files_list as $files) { + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $row['product_id'] . "' AND original_name = '" . $files . "'"; + $alt_configs_list_count = sql($sql); + if (! empty($alt_configs_list_count)) { + $alt_configs_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $alt_configs[$i]['name'] = $files; + $files = str_replace(".", "_", $files); + $h = 0; + foreach ($alt_configs_list as $ccf) { + $alt_configs[$i]['list'][$h]['id'] = $ccf['id']; + $cf_key = $files; + if ((isset($config_files_saved[$cf_key])) AND (is_array($config_files_saved)) AND ($config_files_saved[$cf_key] == $ccf['id'])) { + $alt_configs[$i]['list'][$h]['selected'] = 'selected'; + } + $alt_configs[$i]['list'][$h]['name'] = $ccf['name']; + $h++; + } + $alt = 1; + } + else { + $only_configs[$b]['name'] = $files; + $b++; + } + $i++; + } + + $dReturn['only_configs'] = $only_configs; + $dReturn['alt_configs'] = $alt_configs; + $dReturn['alt'] = $alt; + + if (!isset($_REQUEST['maxlines'])) { + $maxlines = 1; + } else { + $maxlines = $_REQUEST['maxlines']; + } + if ($row['template_data'] != "") { + $out = $this->generate_gui_html($row['template_data'], $row['global_custom_cfg_data'], TRUE, NULL, $maxlines); + } else { + $out = "No Template Data has been defined for this Product
      "; + } + + $dReturn['template_editor'] = $out; + $dReturn['hidden_id'] = $row['id']; + $dReturn['hidden_custom'] = $custom; + return $dReturn; + } + + function merge_data($path, $template_list, $maxlines = 12) { + //TODO: fix + foreach ($template_list as $files_data) { + $full_path = $path . $files_data; + if (file_exists($full_path)) { + $temp_files_data = $this->file2json($full_path); + foreach ($temp_files_data['template_data']['category'] as $category) { + $category_name = $category['name']; + foreach ($category['subcategory'] as $subcategory) { + $subcategory_name = $subcategory['name']; + $items_fin = array(); + $items_loop = array(); + $break_count = 0; + foreach ($subcategory['item'] as $item) { + switch ($item['type']) { + case 'loop_line_options': + for ($i = 1; $i <= $maxlines; $i++) { + $var_nam = "lineloop|line_" . $i; + foreach ($item['data']['item'] as $item_loop) { + if ($item_loop['type'] != 'break') { + $z = str_replace("\$", "", $item_loop['variable']); + $items_loop[$var_nam][$z] = $item_loop; + $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); + $items_loop[$var_nam][$z]['default_value'] = $items_loop[$var_nam][$z]['default_value']; + $items_loop[$var_nam][$z]['default_value'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['default_value']); + $items_loop[$var_nam][$z]['line_loop'] = TRUE; + $items_loop[$var_nam][$z]['line_count'] = $i; + } elseif ($item_loop['type'] == 'break') { + $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; + $break_count++; + } + } + } + $items_fin = array_merge($items_fin, $items_loop); + break; + case 'loop': + for ($i = $item['loop_start']; $i <= $item['loop_end']; $i++) { + $name = explode("_", $item['data']['item'][0]['variable']); + $var_nam = "loop|" . str_replace("\$", "", $name[0]) . "_" . $i; + foreach ($item['data']['item'] as $item_loop) { + if ($item_loop['type'] != 'break') { + $z_tmp = explode("_", $item_loop['variable']); + $z = $z_tmp[1]; + $items_loop[$var_nam][$z] = $item_loop; + $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); + $items_loop[$var_nam][$z]['variable'] = str_replace('_', '_' . $i . '_', $items_loop[$var_nam][$z]['variable']); + $items_loop[$var_nam][$z]['default_value'] = isset($items_loop[$var_nam][$z]['default_value']) ? $items_loop[$var_nam][$z]['default_value'] : ''; + $items_loop[$var_nam][$z]['loop'] = TRUE; + $items_loop[$var_nam][$z]['loop_count'] = $i; + } elseif ($item_loop['type'] == 'break') { + $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; + $break_count++; + } + } + } + $items_fin = array_merge($items_fin, $items_loop); + break; + case 'break': + $items_fin['break|' . $break_count]['type'] = 'break'; + $break_count++; + break; + default: + $var_nam = "option|" . str_replace("\$", "", (isset($item['variable'])? $item['variable'] : "")); + $items_fin[$var_nam] = $item; + break; + } + } + if (isset($data['data'][$category_name][$subcategory_name])) { + $old_sc = $data['data'][$category_name][$subcategory_name]; + $sub_cat_data[$category_name][$subcategory_name] = array(); + $sub_cat_data[$category_name][$subcategory_name] = array_merge($old_sc, $items_fin); + } else { + $sub_cat_data[$category_name][$subcategory_name] = $items_fin; + } + } + if (isset($data['data'][$category_name])) { + $old_c = $data['data'][$category_name]; + $new_c = $sub_cat_data[$category_name]; + $sub_cat_data[$category_name] = array(); + $data['data'][$category_name] = array_merge($old_c, $new_c); + } else { + $data['data'][$category_name] = $sub_cat_data[$category_name]; + } + } + } + } + return($data); + } + + /** + * + * @param integer $model model ID + * @param integer $brand brand ID + * @param integer $product product ID + * @return array + */ + function models_available($model=NULL, $brand=NULL, $product=NULL) { + + if ((!isset($oui)) && (!isset($brand)) && (!isset($model))) { + $result1 = $this->eda->all_models(); + } elseif ((isset($brand)) && ($brand != 0)) { + $result1 = $this->eda->all_models_by_brand($brand); + } elseif ((isset($product)) && ($product != 0)) { + $result1 = $this->eda->all_models_by_product($product); + } else { + $result1 = $this->eda->all_models(); + } + + $i = 1; + foreach ($result1 as $row) { + if ($row['id'] == $model) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 'selected'; + } else { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 0; + } + $i++; + } + + if (!isset($temp)) { + if (! $this->configmod->isExiste('new')) { + $this->error['modelsAvailable'] = "You need to enable at least ONE model"; + } + return(FALSE); + } else { + return($temp); + } + } + + + function areaAvailable($model, $area=NULL) { + $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = '" . $model . "'"; + $count = sql($sql, 'getOne'); + + for ($z = 0; $z < $count; $z++) { + $result[$z]['id'] = $z + 1; + $result[$z]['model'] = $z + 1; + } + + $i = 1; + foreach ($result as $row) { + if ($row['id'] == $area) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 'selected'; + } else { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 0; + } + $i++; + } + + return($temp); + } + + /** + * Generates the Visual Display for the end user + * @param $cfg_data + * @param $custom_cfg_data + * @param $admin + * @param $user_cfg_data + * @return + */ + function generate_gui_html($cfg_data, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $max_lines=3, $ext=NULL) { + //take the data out of the database and turn it back into an array for use + $cfg_data = unserialize($cfg_data); + $template_type = 'GENERAL'; + //Check to see if there is a custom template for this phone already listed in the endpointman_mac_list database + if (!empty($custom_cfg_data)) { + $custom_cfg_data = unserialize($custom_cfg_data); + if (array_key_exists('data', $custom_cfg_data)) { + if (array_key_exists('ari', $custom_cfg_data)) { + $extra_data = $custom_cfg_data['ari']; + } else { + $template_type = 'GLOBAL'; + $extra_data = $custom_cfg_data['freepbx']; + } + $custom_cfg_data = $custom_cfg_data['data']; + } else { + $extra_data = array(); + } + } else { + $custom_cfg_data = array(); + $extra_data = array(); + } + if (isset($user_cfg_data)) { + $user_cfg_data = unserialize($user_cfg_data); + } + + $template_variables_array = array(); + $group_count = 0; + $variables_count = 0; + + foreach ($cfg_data['data'] as $cats_name => $cats) { + if ($admin) { + $group_count++; + $template_variables_array[$group_count]['title'] = $cats_name; + } else { + //Group all ARI stuff into one tab + $template_variables_array[$group_count]['title'] = "Your Phone Settings"; + } + foreach ($cats as $subcat_name => $subcats) { + foreach ($subcats as $item_var => $config_options) { + if (preg_match('/(.*)\|(.*)/i', $item_var, $matches)) { + $type = $matches[1]; + $variable = $matches[2]; + } else { + die('no matches!'); + } + if ($admin) { + //Administration View Only + switch ($type) { + case "lineloop": + //line|1|display_name + foreach ($config_options as $var_name => $var_items) { + $lcount = isset($var_items['line_count']) ? $var_items['line_count'] : $lcount; + $key = "line|" . $lcount . "|" . $var_name; + $items[$variables_count] = $items; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; + $variables_count++; + } + + if ($lcount <= $max_lines) { + $template_variables_array[$group_count]['title'] = "Line Options for Line " . $lcount; + $group_count++; + } else { + unset($template_variables_array[$group_count]); + } + + continue 2; + case "loop": + foreach ($config_options as $var_name => $var_items) { + //loop|remotephonebook_url_0 + $tv = explode('_', $variable); + $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; + $items[$variables_count] = $var_items; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; + $variables_count++; + } + continue 2; + } + } else { + //ARI View Only + switch ($type) { + case "loop_line_options": + //$a is the line number + $sql = "SELECT line FROM endpointman_line_list WHERE ext = " . $ext; + $a = $this->eda->sql($sql, 'getOne'); + //TODO: fix this area + $template_variables_array[$group_count]['data'][$variables_count]['type'] = "break"; + $variables_count++; + continue 2; + case "loop": + foreach ($config_options as $var_name => $var_items) { + $tv = explode('_', $variable); + $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; + if (isset($extra_data[$key])) { + $items[$variables_count] = $var_items; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; + $variables_count++; + } + } + continue 2; + } + } + //Both Views + switch ($config_options['type']) { + case "break": + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $variables_count++; + break; + default: + if (array_key_exists('variable', $config_options)) { + $key = str_replace('$', '', $config_options['variable']); + //TODO: Move this into the sync function + //Checks to see if values are defined in the database, if not then we assume this is a new option and we need a default value here! + if (!isset($custom_cfg_data[$key])) { + //xml2array will take values that have no data and turn them into arrays, we want to avoid the word 'array' as a default value, so we blank it out here if we are an array + if ((array_key_exists('default_value', $config_options)) AND (is_array($config_options['default_value']))) { + $custom_cfg_data[$key] = ""; + } elseif ((array_key_exists('default_value', $config_options)) AND (!is_array($config_options['default_value']))) { + $custom_cfg_data[$key] = $config_options['default_value']; + } + } + if ((!$admin) AND (isset($extra_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $variables_count++; + } elseif ($admin) { + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $variables_count++; + } + } + break; + } + continue; + } + } + } + + return($template_variables_array); + } + + /** + * Generate an array that will get parsed as HTML from an array of values from XML + * @param int $i + * @param array $cfg_data + * @param string $key + * @param array $custom_cfg_data + * @return array + */ + function generate_form_data($i, $cfg_data, $key=NULL, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $extra_data=NULL, $template_type='GENERAL') { + switch ($cfg_data['type']) { + case "input": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $template_variables_array['type'] = "input"; + if (isset($cfg_data['max_chars'])) { + $template_variables_array['max_chars'] = $cfg_data['max_chars']; + } + $template_variables_array['key'] = $key; + $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['description'] = $cfg_data['description']; + break; + case "radio": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['type'] = "radio"; + $template_variables_array['key'] = $key; + $template_variables_array['description'] = $cfg_data['description']; + $z = 0; + while ($z < count($cfg_data['data'])) { + $template_variables_array['data'][$z]['key'] = $key; + $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; + $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; + if ($cfg_data['data'][$z]['value'] == $num) { + $template_variables_array['data'][$z]['checked'] = 'checked'; + } + $z++; + } + break; + case "list": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['type'] = "list"; + $template_variables_array['key'] = $key; + $template_variables_array['description'] = $cfg_data['description']; + $z = 0; + while ($z < count($cfg_data['data'])) { + $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; + $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; + if (isset($cfg_data['data'][$z]['disable'])) { + $cfg_data['data'][$z]['disable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['disable']); + $template_variables_array['data'][$z]['disables'] = explode(",", $cfg_data['data'][$z]['disable']); + } + if (isset($cfg_data['data'][$z]['enable'])) { + $cfg_data['data'][$z]['enable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['enable']); + $template_variables_array['data'][$z]['enables'] = explode(",", $cfg_data['data'][$z]['enable']); + } + if ($cfg_data['data'][$z]['value'] == $num) { + $template_variables_array['data'][$z]['selected'] = 'selected'; + } + $z++; + } + break; + case "checkbox": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['type'] = "checkbox"; + $template_variables_array['key'] = $key; + $template_variables_array['description'] = $cfg_data['description']; + $template_variables_array['checked'] = $custom_cfg_data[$key] ? TRUE : NULL; + $template_variables_array['value'] = $key; + break; + case "group"; + $template_variables_array['type'] = "group"; + $template_variables_array['description'] = $cfg_data['description']; + break; + case "header"; + $template_variables_array['type'] = "header"; + $template_variables_array['description'] = $cfg_data['description']; + break; + case "textarea": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $template_variables_array['type'] = "textarea"; + if (isset($cfg_data['rows'])) { + $template_variables_array['rows'] = $cfg_data['rows']; + } + if (isset($cfg_data['cols'])) { + $template_variables_array['cols'] = $cfg_data['cols']; + } + $template_variables_array['key'] = $key; + $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['description'] = $cfg_data['description']; + break; + case "break": + if ($admin) { + $template_variables_array['type'] = "break"; + } else { + $template_variables_array['type'] = "NA"; + } + break; + default: + $template_variables_array['type'] = "NA"; + break; + } + + if (isset($cfg_data['tooltip'])) { + $template_variables_array['tooltip'] = htmlentities($cfg_data['tooltip']); + } + + if (($this->global_cfg['enable_ari']) AND ($admin) AND ($cfg_data['type'] != "break") AND ($cfg_data['type'] != "group") AND ($template_type == 'GENERAL')) { + + $template_variables_array['aried'] = 1; + $template_variables_array['ari']['key'] = $key; + + if (isset($extra_data[$key])) { + $template_variables_array['ari']['checked'] = "checked"; + } + } + + if ($template_type == 'GLOBAL') { + $template_variables_array['freepbxed'] = 1; + $template_variables_array['freepbx']['key'] = $key; + if (empty($extra_data)) { + $template_variables_array['freepbx']['checked'] = TRUE; + } elseif (isset($extra_data[$key])) { + $template_variables_array['freepbx']['checked'] = TRUE; + } + } + return($template_variables_array); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /********************************************* + ****** CODIGO ANTIGUO -- SIN REVISADO ******** + *********************************************/ + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /********************************************* - ****** CODIGO ANTIGUO -- SIN REVISADO ******** - *********************************************/ - - - - - - - - - - + function download_json($location, $directory=NULL) { $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; @@ -4435,104 +4990,9 @@ function download_json($location, $directory=NULL) { } } + - - - - - - function merge_data($path, $template_list, $maxlines = 12) { - //TODO: fix - foreach ($template_list as $files_data) { - $full_path = $path . $files_data; - if (file_exists($full_path)) { - $temp_files_data = $this->file2json($full_path); - foreach ($temp_files_data['template_data']['category'] as $category) { - $category_name = $category['name']; - foreach ($category['subcategory'] as $subcategory) { - $subcategory_name = $subcategory['name']; - $items_fin = array(); - $items_loop = array(); - $break_count = 0; - foreach ($subcategory['item'] as $item) { - switch ($item['type']) { - case 'loop_line_options': - for ($i = 1; $i <= $maxlines; $i++) { - $var_nam = "lineloop|line_" . $i; - foreach ($item['data']['item'] as $item_loop) { - if ($item_loop['type'] != 'break') { - $z = str_replace("\$", "", $item_loop['variable']); - $items_loop[$var_nam][$z] = $item_loop; - $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); - $items_loop[$var_nam][$z]['default_value'] = $items_loop[$var_nam][$z]['default_value']; - $items_loop[$var_nam][$z]['default_value'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['default_value']); - $items_loop[$var_nam][$z]['line_loop'] = TRUE; - $items_loop[$var_nam][$z]['line_count'] = $i; - } elseif ($item_loop['type'] == 'break') { - $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; - $break_count++; - } - } - } - $items_fin = array_merge($items_fin, $items_loop); - break; - case 'loop': - for ($i = $item['loop_start']; $i <= $item['loop_end']; $i++) { - $name = explode("_", $item['data']['item'][0]['variable']); - $var_nam = "loop|" . str_replace("\$", "", $name[0]) . "_" . $i; - foreach ($item['data']['item'] as $item_loop) { - if ($item_loop['type'] != 'break') { - $z_tmp = explode("_", $item_loop['variable']); - $z = $z_tmp[1]; - $items_loop[$var_nam][$z] = $item_loop; - $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); - $items_loop[$var_nam][$z]['variable'] = str_replace('_', '_' . $i . '_', $items_loop[$var_nam][$z]['variable']); - $items_loop[$var_nam][$z]['default_value'] = isset($items_loop[$var_nam][$z]['default_value']) ? $items_loop[$var_nam][$z]['default_value'] : ''; - $items_loop[$var_nam][$z]['loop'] = TRUE; - $items_loop[$var_nam][$z]['loop_count'] = $i; - } elseif ($item_loop['type'] == 'break') { - $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; - $break_count++; - } - } - } - $items_fin = array_merge($items_fin, $items_loop); - break; - case 'break': - $items_fin['break|' . $break_count]['type'] = 'break'; - $break_count++; - break; - default: - $var_nam = "option|" . str_replace("\$", "", $item['variable']); - $items_fin[$var_nam] = $item; - break; - } - } - if (isset($data['data'][$category_name][$subcategory_name])) { - $old_sc = $data['data'][$category_name][$subcategory_name]; - $sub_cat_data[$category_name][$subcategory_name] = array(); - $sub_cat_data[$category_name][$subcategory_name] = array_merge($old_sc, $items_fin); - } else { - $sub_cat_data[$category_name][$subcategory_name] = $items_fin; - } - } - if (isset($data['data'][$category_name])) { - $old_c = $data['data'][$category_name]; - $new_c = $sub_cat_data[$category_name]; - $sub_cat_data[$category_name] = array(); - $data['data'][$category_name] = array_merge($old_c, $new_c); - } else { - $data['data'][$category_name] = $sub_cat_data[$category_name]; - } - } - } - } - return($data); - } - - - - + /** * Send process to run in background @@ -4558,7 +5018,7 @@ function is_process_running($PID) { return(count($ProcessState) >= 2); } - + /** * Uses which to find executables that asterisk can run/use @@ -4596,9 +5056,9 @@ function table_exists($table) { return FALSE; } + - - + /** * Check for valid netmast to avoid security issues @@ -4698,74 +5158,7 @@ function discover_new($netmask, $use_nmap=TRUE) { return !is_array($final) ? FALSE : $final; } - function areaAvailable($model, $area=NULL) { - $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = '" . $model . "'"; - $count = $this->eda->sql($sql, 'getOne'); - - for ($z = 0; $z < $count; $z++) { - $result[$z]['id'] = $z + 1; - $result[$z]['model'] = $z + 1; - } - - $i = 1; - foreach ($result as $row) { - if ($row['id'] == $area) { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 'selected'; - } else { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 0; - } - $i++; - } - - return($temp); - } - - /** - * - * @param integer $model model ID - * @param integer $brand brand ID - * @param integer $product product ID - * @return array - */ - function models_available($model=NULL, $brand=NULL, $product=NULL) { - - if ((!isset($oui)) && (!isset($brand)) && (!isset($model))) { - $result1 = $this->eda->all_models(); - } elseif ((isset($brand)) && ($brand != 0)) { - $result1 = $this->eda->all_models_by_brand($brand); - } elseif ((isset($product)) && ($product != 0)) { - $result1 = $this->eda->all_models_by_product($product); - } else { - $result1 = $this->eda->all_models(); - } - - $i = 1; - foreach ($result1 as $row) { - if ($row['id'] == $model) { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 'selected'; - } else { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 0; - } - $i++; - } - - if (!isset($temp)) { - if (!isset($this->global_cfg['new'])) { - $this->error['modelsAvailable'] = "You need to enable at least ONE model"; - } - return(FALSE); - } else { - return($temp); - } - } + function in_array_recursive($needle, $haystack) { @@ -4779,10 +5172,10 @@ function in_array_recursive($needle, $haystack) { return FALSE; } + + - - - + function display_templates($product_id, $temp_select = NULL) { $i = 0; @@ -4816,14 +5209,14 @@ function validate_json($json) { return(TRUE); } + + + + + + - - - - - - - + function prepare_message_box() { $error_message = NULL; @@ -4862,14 +5255,14 @@ function prepare_message_box() { } } + + + - - - - + function update_device($macid, $model, $template, $luid=NULL, $name=NULL, $line=NULL, $update_lines=TRUE) { $sql = "UPDATE endpointman_mac_list SET model = " . $model . ", template_id = " . $template . " WHERE id = " . $macid; @@ -4968,413 +5361,11 @@ function get_message($function_name) { } - /** - * Custom Means specific to that MAC - * id is either the mac ID (not address) or the template ID - * @param integer $id - * @param integer $custom - */ - function edit_template_display($id, $custom) { - //endpointman_flush_buffers(); - - - $alt_configs = NULL; - - if ($custom == 0) { - $sql = "SELECT model_id FROM endpointman_template_list WHERE id=" . $id; - } else { - $sql = "SELECT model FROM endpointman_mac_list WHERE id=" . $id; - } - - $model_id = $this->eda->sql($sql, 'getOne'); - - //Make sure the model data from the local confg files are stored in the database and vice-versa. Serious errors will occur if the database is not in sync with the local file - if (!$this->sync_model($model_id)) { - die("unable to sync local template files - TYPE:" . $custom); - } - - - //Determine if we are dealing with a general template or a specific [for that phone only] template (custom =0 means general) - if ($custom == 0) { - $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_template_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_product_list.short_name, endpointman_product_list.id as product_id, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = " . $id; - } else { - $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_line_list.*, endpointman_model_list.id as model_id, endpointman_model_list.template_data, endpointman_product_list.id as product_id, endpointman_product_list.short_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list, endpointman_line_list WHERE endpointman_mac_list.id=" . $id . " AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; - } - - $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $this->tpl->assign("template_editor_display", 1); - echo $this->tpl->draw('global_header'); - //Let the template system know if we are working with a general template or a specific [for that phone only] template - $this->tpl->assign("custom", $custom); - if ($custom) { - $this->tpl->assign("ext", $row['ext']); - } else { - $this->tpl->assign("template_name", $row['name']); - } - $this->tpl->assign("product", $row['short_name']); - $this->tpl->assign("model", $row['model_name']); + - if ($ma = $this->models_available($row['model_id'], NULL, $row['product_id'])) { - $this->tpl->assign("models_ava", $ma); - } + - if (isset($_REQUEST['maxlines'])) { - $areas = $this->areaAvailable($row['model_id'], $_REQUEST['maxlines']); - } else { - $areas = $this->areaAvailable($row['model_id'], 1); - } - - $this->tpl->assign("area_ava", $areas); - //Start the display of the html file in the product folder - if ($row['config_files_override'] == "") { - $config_files_saved = ""; - } else { - $config_files_saved = unserialize($row['config_files_override']); - } - $config_files_list = explode(",", $row['config_files']); - $i = 0; - $alt = 0; - - $i = 0; - $b = 0; - $only_configs = array(); - foreach ($config_files_list as $files) { - $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $row['product_id'] . "' AND original_name = '" . $files . "'"; - $alt_configs_list_count = $this->eda->sql($sql); - if ($alt_configs_list_count->numRows() > 0) { - $alt_configs_list = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $alt_configs[$i]['name'] = $files; - $files = str_replace(".", "_", $files); - $h = 0; - foreach ($alt_configs_list as $ccf) { - $alt_configs[$i]['list'][$h]['id'] = $ccf['id']; - $cf_key = $files; - if ((isset($config_files_saved[$cf_key])) AND (is_array($config_files_saved)) AND ($config_files_saved[$cf_key] == $ccf['id'])) { - $alt_configs[$i]['list'][$h]['selected'] = 'selected'; - } - $alt_configs[$i]['list'][$h]['name'] = $ccf['name']; - $h++; - } - $alt = 1; - } else { - $only_configs[$b]['name'] = $files; - $b++; - } - $i++; - } - - $this->tpl->assign("only_configs", $only_configs); - $this->tpl->assign("alt_configs", $alt_configs); - $this->tpl->assign("alt", $alt); - if (!isset($_REQUEST['maxlines'])) { - $maxlines = 1; - } else { - $maxlines = $_REQUEST['maxlines']; - } - if ($row['template_data'] != "") { - $out = $this->generate_gui_html($row['template_data'], $row['global_custom_cfg_data'], TRUE, NULL, $maxlines); - } else { - echo "No Template Data has been defined for this Product
      "; - } - - $this->tpl->assign("template_editor", $out); - $this->tpl->assign("hidden_id", $row['id']); - $this->tpl->assign("hidden_custom", $custom); - echo $this->tpl->draw('template_editor'); - - $this->tpl->assign("debug", ""); - } - - /** - * Generates the Visual Display for the end user - * @param $cfg_data - * @param $custom_cfg_data - * @param $admin - * @param $user_cfg_data - * @return - */ - function generate_gui_html($cfg_data, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $max_lines=3, $ext=NULL) { - //take the data out of the database and turn it back into an array for use - $cfg_data = unserialize($cfg_data); - $template_type = 'GENERAL'; - //Check to see if there is a custom template for this phone already listed in the endpointman_mac_list database - if (!empty($custom_cfg_data)) { - $custom_cfg_data = unserialize($custom_cfg_data); - if (array_key_exists('data', $custom_cfg_data)) { - if (array_key_exists('ari', $custom_cfg_data)) { - $extra_data = $custom_cfg_data['ari']; - } else { - $template_type = 'GLOBAL'; - $extra_data = $custom_cfg_data['freepbx']; - } - $custom_cfg_data = $custom_cfg_data['data']; - } else { - $extra_data = array(); - } - } else { - $custom_cfg_data = array(); - $extra_data = array(); - } - if (isset($user_cfg_data)) { - $user_cfg_data = unserialize($user_cfg_data); - } - - $template_variables_array = array(); - $group_count = 0; - $variables_count = 0; - - foreach ($cfg_data['data'] as $cats_name => $cats) { - if ($admin) { - $group_count++; - $template_variables_array[$group_count]['title'] = $cats_name; - } else { - //Group all ARI stuff into one tab - $template_variables_array[$group_count]['title'] = "Your Phone Settings"; - } - foreach ($cats as $subcat_name => $subcats) { - foreach ($subcats as $item_var => $config_options) { - if (preg_match('/(.*)\|(.*)/i', $item_var, $matches)) { - $type = $matches[1]; - $variable = $matches[2]; - } else { - die('no matches!'); - } - if ($admin) { - //Administration View Only - switch ($type) { - case "lineloop": - //line|1|display_name - foreach ($config_options as $var_name => $var_items) { - $lcount = isset($var_items['line_count']) ? $var_items['line_count'] : $lcount; - $key = "line|" . $lcount . "|" . $var_name; - $items[$variables_count] = $items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; - $variables_count++; - } - - if ($lcount <= $max_lines) { - $template_variables_array[$group_count]['title'] = "Line Options for Line " . $lcount; - $group_count++; - } else { - unset($template_variables_array[$group_count]); - } - - continue 2; - case "loop": - foreach ($config_options as $var_name => $var_items) { - //loop|remotephonebook_url_0 - $tv = explode('_', $variable); - $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; - $items[$variables_count] = $var_items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; - $variables_count++; - } - continue 2; - } - } else { - //ARI View Only - switch ($type) { - case "loop_line_options": - //$a is the line number - $sql = "SELECT line FROM endpointman_line_list WHERE ext = " . $ext; - $a = $this->eda->sql($sql, 'getOne'); - //TODO: fix this area - $template_variables_array[$group_count]['data'][$variables_count]['type'] = "break"; - $variables_count++; - continue 2; - case "loop": - foreach ($config_options as $var_name => $var_items) { - $tv = explode('_', $variable); - $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; - if (isset($extra_data[$key])) { - $items[$variables_count] = $var_items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; - $variables_count++; - } - } - continue 2; - } - } - //Both Views - switch ($config_options['type']) { - case "break": - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $variables_count++; - break; - default: - if (array_key_exists('variable', $config_options)) { - $key = str_replace('$', '', $config_options['variable']); - //TODO: Move this into the sync function - //Checks to see if values are defined in the database, if not then we assume this is a new option and we need a default value here! - if (!isset($custom_cfg_data[$key])) { - //xml2array will take values that have no data and turn them into arrays, we want to avoid the word 'array' as a default value, so we blank it out here if we are an array - if ((array_key_exists('default_value', $config_options)) AND (is_array($config_options['default_value']))) { - $custom_cfg_data[$key] = ""; - } elseif ((array_key_exists('default_value', $config_options)) AND (!is_array($config_options['default_value']))) { - $custom_cfg_data[$key] = $config_options['default_value']; - } - } - if ((!$admin) AND (isset($extra_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $variables_count++; - } elseif ($admin) { - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $variables_count++; - } - } - break; - } - continue; - } - } - } - - return($template_variables_array); - } - - /** - * Generate an array that will get parsed as HTML from an array of values from XML - * @param int $i - * @param array $cfg_data - * @param string $key - * @param array $custom_cfg_data - * @return array - */ - function generate_form_data($i, $cfg_data, $key=NULL, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $extra_data=NULL, $template_type='GENERAL') { - switch ($cfg_data['type']) { - case "input": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $template_variables_array['type'] = "input"; - if (isset($cfg_data['max_chars'])) { - $template_variables_array['max_chars'] = $cfg_data['max_chars']; - } - $template_variables_array['key'] = $key; - $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "radio": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['type'] = "radio"; - $template_variables_array['key'] = $key; - $template_variables_array['description'] = $cfg_data['description']; - $z = 0; - while ($z < count($cfg_data['data'])) { - $template_variables_array['data'][$z]['key'] = $key; - $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; - $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; - if ($cfg_data['data'][$z]['value'] == $num) { - $template_variables_array['data'][$z]['checked'] = 'checked'; - } - $z++; - } - break; - case "list": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['type'] = "list"; - $template_variables_array['key'] = $key; - $template_variables_array['description'] = $cfg_data['description']; - $z = 0; - while ($z < count($cfg_data['data'])) { - $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; - $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; - if (isset($cfg_data['data'][$z]['disable'])) { - $cfg_data['data'][$z]['disable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['disable']); - $template_variables_array['data'][$z]['disables'] = explode(",", $cfg_data['data'][$z]['disable']); - } - if (isset($cfg_data['data'][$z]['enable'])) { - $cfg_data['data'][$z]['enable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['enable']); - $template_variables_array['data'][$z]['enables'] = explode(",", $cfg_data['data'][$z]['enable']); - } - if ($cfg_data['data'][$z]['value'] == $num) { - $template_variables_array['data'][$z]['selected'] = 'selected'; - } - $z++; - } - break; - case "checkbox": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['type'] = "checkbox"; - $template_variables_array['key'] = $key; - $template_variables_array['description'] = $cfg_data['description']; - $template_variables_array['checked'] = $custom_cfg_data[$key] ? TRUE : NULL; - $template_variables_array['value'] = $key; - break; - case "group"; - $template_variables_array['type'] = "group"; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "header"; - $template_variables_array['type'] = "header"; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "textarea": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $template_variables_array['type'] = "textarea"; - if (isset($cfg_data['rows'])) { - $template_variables_array['rows'] = $cfg_data['rows']; - } - if (isset($cfg_data['cols'])) { - $template_variables_array['cols'] = $cfg_data['cols']; - } - $template_variables_array['key'] = $key; - $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "break": - if ($admin) { - $template_variables_array['type'] = "break"; - } else { - $template_variables_array['type'] = "NA"; - } - break; - default: - $template_variables_array['type'] = "NA"; - break; - } - - if (isset($cfg_data['tooltip'])) { - $template_variables_array['tooltip'] = htmlentities($cfg_data['tooltip']); - } - - if (($this->global_cfg['enable_ari']) AND ($admin) AND ($cfg_data['type'] != "break") AND ($cfg_data['type'] != "group") AND ($template_type == 'GENERAL')) { - - $template_variables_array['aried'] = 1; - $template_variables_array['ari']['key'] = $key; - - if (isset($extra_data[$key])) { - $template_variables_array['ari']['checked'] = "checked"; - } - } - - if ($template_type == 'GLOBAL') { - $template_variables_array['freepbxed'] = 1; - $template_variables_array['freepbx']['key'] = $key; - if (empty($extra_data)) { - $template_variables_array['freepbx']['checked'] = TRUE; - } elseif (isset($extra_data[$key])) { - $template_variables_array['freepbx']['checked'] = TRUE; - } - } - return($template_variables_array); - } + /** * Save template from the template view pain @@ -5524,13 +5515,13 @@ function save_template($id, $custom, $variables) { } } - + function display_configs() { } - + } -?> +?> \ No newline at end of file diff --git a/assets/css/coda-slider-2.0a.css b/assets/css/coda-slider-2.0a.css index 3a6b72cf..376e9510 100644 --- a/assets/css/coda-slider-2.0a.css +++ b/assets/css/coda-slider-2.0a.css @@ -6,44 +6,117 @@ /* Most common stuff you'll need to change */ +.coda-slider-wrapper { + padding: 20px 0 !important; + width: 100% !important; +} - .coda-slider-wrapper { padding: 20px 0 } - .coda-slider { background: #ebebeb } - - /* Use this to keep the slider content contained in a box even when JavaScript is disabled */ - .coda-slider-no-js .coda-slider { height: 200px; overflow: auto !important; padding-right: 20px } - - /* Change the width of the entire slider (without dynamic arrows) */ - .coda-slider, .coda-slider .panel { width: 900px } - - /* Change margin and width of the slider (with dynamic arrows) */ - .coda-slider-wrapper.arrows .coda-slider, .coda-slider-wrapper.arrows .coda-slider .panel { width: 600px } - .coda-slider-wrapper.arrows .coda-slider { margin: 0 10px } - - /* Arrow styling */ - .coda-nav-left a, .coda-nav-right a { background: #000; color: #fff; padding: 5px; width: 100px } - - /* Tab nav */ - .coda-nav ul li a.current { background: #39c } +.coda-slider { + background: #ebebeb !important; + border: solid 1px red !important; +} + +/* Panel padding */ +.coda-slider .panel-wrapper { padding: 20px } - /* Panel padding */ - .coda-slider .panel-wrapper { padding: 20px } +/* Preloader */ +.coda-slider p.loading { + padding: 20px !important; + text-align: center !important; + width: 100% !important; + border: solid 1px red !important; +} + + +.coda-slider-wrapper.arrows .coda-slider { + margin: 0 10px; +} + + + + + + + +/* Tabbed nav */ +.coda-nav ul { + clear: both !important; + display: block !important; + margin: auto !important; + overflow: hidden !important; +} +.coda-nav ul li { + display: inline !important; +} +.coda-nav ul li a { + background: #000 !important; + color: #fff !important; + /*display: block;*/ + /*float: left;*/ + width: 200px !important; + margin-right: 1px !important; + padding: 3px 6px !important; + text-decoration: none !important; + text-align: center !important; +} + +.coda-nav ul li a.current { + background: #39c +} + +.coda-nav-left a, .coda-nav-right a { + background: #000; + color: #fff; + padding: 5px; + width: 100px +} +*/ + + + + + + + + + + + + + + + + +/* Use this to keep the slider content contained in a box even when JavaScript is disabled */ +/* +.coda-slider-no-js .coda-slider { + height: 200px; + overflow: auto !important; + padding-right: 20px +} +*/ +/* Change the width of the entire slider (without dynamic arrows) */ +/* +.coda-slider, .coda-slider .panel { + width: 900px; +} +*/ +/* Change margin and width of the slider (with dynamic arrows) */ +/* +.coda-slider-wrapper.arrows .coda-slider, .coda-slider-wrapper.arrows .coda-slider .panel { + width: 600px; +} + + - /* Preloader */ - .coda-slider p.loading { padding: 20px; text-align: center } /* Don't change anything below here unless you know what you're doing */ - /* Tabbed nav */ - .coda-nav ul { clear: both; display: block; margin: auto; overflow: hidden } - .coda-nav ul li { display: inline } - .coda-nav ul li a { background: #000; color: #fff; display: block; float: left; width: 150px; margin-right: 1px; padding: 3px 6px; text-decoration: none } - - /* Miscellaneous */ - .coda-slider-wrapper { clear: both; overflow: auto } - .coda-slider { float: left; overflow: hidden; position: relative } - .coda-slider .panel { display: block; float: left } - .coda-slider .panel-container { position: relative } - .coda-nav-left, .coda-nav-right { float: left } - .coda-nav-left a, .coda-nav-right a { display: block; text-align: center; text-decoration: none } - \ No newline at end of file +/* Miscellaneous */ + +.coda-slider-wrapper { clear: both; overflow: auto } +.coda-slider { float: left; overflow: hidden; position: relative } +.coda-slider .panel { display: block; float: left } +.coda-slider .panel-container { position: relative } +.coda-nav-left, .coda-nav-right { float: left } +.coda-nav-left a, .coda-nav-right a { display: block; text-align: center; text-decoration: none } diff --git a/assets/css/epm_devices.css b/assets/css/epm_devices.css new file mode 100644 index 00000000..b5734659 --- /dev/null +++ b/assets/css/epm_devices.css @@ -0,0 +1 @@ +@CHARSET "ISO-8859-1"; \ No newline at end of file diff --git a/assets/css/epm_templates.css b/assets/css/epm_templates.css new file mode 100644 index 00000000..b5734659 --- /dev/null +++ b/assets/css/epm_templates.css @@ -0,0 +1 @@ +@CHARSET "ISO-8859-1"; \ No newline at end of file diff --git a/assets/js/epm_config.js b/assets/js/epm_config.js index 0ef6d37e..79e2cb4d 100644 --- a/assets/js/epm_config.js +++ b/assets/js/epm_config.js @@ -21,12 +21,17 @@ function epm_config_change_tab (nTab = "") { } + + + + + //**** INI: FUNCTION GLOBAL SEC **** function epm_config_select_tab_ajax(idtab) { clearTimeout(v_sTimerUpdateAjax); if (idtab == "") { - fpbxToast('epm_config_select_tab_ajax -> id invalid (' + idtab + ')!','JS!','warning'); + fpbxToast('epm_config_select_tab_ajax -> id no send!','JS!','warning'); return false; } @@ -401,7 +406,7 @@ function epm_config_tab_manager_ajax_get_add_data(data, idtab) function epm_config_tab_manager_bt_update_check_click() { - var urlStr = "config.php?display=epm_config&quietmode=1&module_tab=manager&command=check_for_updates"; + var urlStr = "config.php?display=epm_config&module_tab=manager&command=check_for_updates"; box = epm_global_dialog_action("bt_update_chkeck", urlStr); } @@ -410,7 +415,7 @@ function epm_config_tab_manager_bt(opt, idfw, command) if ((opt == "") || (idfw == "") || (command == "")) { return false; } clearTimeout(v_sTimerUpdateAjax); - var urlStr = "config.php?display=epm_config&quietmode=1&module_tab=manager&command=" + command + "&command_sub=" + opt + "&idfw=" + idfw; + var urlStr = "config.php?display=epm_config&module_tab=manager&command=" + command + "&command_sub=" + opt + "&idfw=" + idfw; box = epm_global_dialog_action("manager_bt", urlStr, null, "Status", 'epm_config_tab_manager_bt_dialog'); } diff --git a/assets/js/epm_devices.js b/assets/js/epm_devices.js new file mode 100644 index 00000000..c1aa05c6 --- /dev/null +++ b/assets/js/epm_devices.js @@ -0,0 +1,11 @@ +function epm_devices_document_ready () { + +} + +function epm_devices_windows_load (nTab = "") { + +} + +function epm_devices_change_tab (nTab = "") { + +} \ No newline at end of file diff --git a/assets/js/epm_global.js b/assets/js/epm_global.js index dd7198bf..5d2321d7 100644 --- a/assets/js/epm_global.js +++ b/assets/js/epm_global.js @@ -114,7 +114,7 @@ function epm_global_dialog_action(actionname, urlStr, formname = null, titleStr scroll: true, position: { my: "top-175", at: "center", of: window }, open: function (e) { - $('#moduledialogwrapper').html(_('Loading..' ) + ''); + $('#moduledialogwrapper').html(_('Loading...' ) + ''); if (formname == null) { var oData = null; diff --git a/assets/js/jquery.coda-slider-3.0.js b/assets/js/jquery.coda-slider-3.0.js index c7777b80..4dbbfa47 100644 --- a/assets/js/jquery.coda-slider-3.0.js +++ b/assets/js/jquery.coda-slider-3.0.js @@ -28,7 +28,7 @@ if ( typeof Object.create !== 'function' ) { $("body").removeClass("coda-slider-no-js"); //add preloader class (backwards compatible) - $('.coda-slider').prepend('

      Loading...
      loading...

      '); + $('.coda-slider').prepend('

      Loading...
      loading...

      '); // Cache the element self.elem = elem; diff --git a/i18n/es_ES/LC_MESSAGES/endpointman.mo b/i18n/es_ES/LC_MESSAGES/endpointman.mo index 832fdf588483bae6c913daa23b3fe8982a135109..90934f41e8f8ce38aea6d7f3d2cf6e93d65afcc0 100644 GIT binary patch literal 22985 zcmcJW37A}0b?2Y4jcwWS26$n;EnAzd?v}i}y|%hrQrl{&qi)Fy#Nu_;YjsK0Rps}p zB)7&Hmca}TBmoR&2nJ&(EFQ4&!ZH{;G423K24V(6SY~1mj=?}YNnkJuSzvzubMJdq z)!nkmH(%=0?f-lC-SwPv&pG$ptH)0~?A;N+Wrsx3%fafAQM8-qhmKcn6kUB%6rBiO z6R--tnD^I#D*rBU1$ZC$O7NTDE5M(DF9KhDaugj4t_F_)&j$|$FAMoYA%8n~0{Pd1 zM}bxFrQkmBQt%z%Dd1PZ!@(bdtHHkme+@i^kE*{CRDTzM$AO!`7lK!X_v=8FuYsE4 zjiBoNHmG^s4)QPhB!4uYuYj)tp8<~sk2%%T;}j55MQ4K7f#-l4&n@BmL*Po@9|JD~ ze+Iq`Jda7KzwO{lz%mG_q647D`3_KY`!Arz_i<2kdl+P@(HFw|UxCYc{~k!w(UCN+ z^2L!=U>8Lr~-T0;u-B2|Dn{A^$`wYh0%XyZ}`DTfl3; zDk#2x5p>{FpxQm0OpX5-a2$LwsBtHt`gsdD0^SLV?mqx801tuqXM+RaDzFA#0p1Gs zfZqi*oYWT;2(AOgmp$MyU8T%u_kRRMzr&ck@?Q+9 z-{qjju^!wA#^9mgN5P}OkAv#x)1b!jC@6kD1&W^086Hmp)&5#g?OqJ3+?C*&;BHX# zxdnt|(Y@jQn;`$9pYliieiemZ2%ZgUoCBcR-3+S!)u8y>0+)dYK*{$_pvLnaQ1$Kx zN5Rj9?}sC#NAi9$D84vQ?W_ck0?z~~8l4;7WAF&x_k!v-12vAfgX-^t;r)K_fa+WXuN>J_hfhT}Npz7@aH-p!K;>$-swSPY-d3qESpT7u75B?ZLWkjn{(x-!4 zKvZ&cJ$MZGc2IPBKX^2FCwMFi;~r4`K76hp$77)Q{uC&=`X>-pL_Kukz^$O@R|j7N zz7sqV{4gl`d=}LF9|1MrKLJI@CqdEo??K7)k>`7UoD2^0em*Gv-3Usa-VI8A-Un)Y zUjo(7w?WP48So_V=b-3yJW4_9=~VD|@FGy(w}1{Tff~=7!utn6mH(rF-v!m~p%?mo zjt52e)4(#=2T~-u1r&Y03_`l-NpK5z(txLX2^3x40*W8Efzq3gfTGXi;HlvEK+Wfu zp!z-WBA@>%Q2kyAUJed}Yrvbpmx7-FCAWVDI`A(*wexKFe&oeI|1|Jq@`pk3<29hl zmBE*R`$3KG7Vs4CGoa@6)$sm(Q2hTTsQItF#Lw@o;40ql1vQ^@qL6qoCIF>%pzyJ)q?4UqOx2UGC>|F-X(VZ-CxuTnm0J2xfpdMANue=VqSj)eD}pxUW} zYUd5$ec(M{3ci-bB6@xu%)pf+zW?6?MUUSHPY3S>)y_9SSQtGGYJR70^m^kuQ0?Cg zo(6sz)I7ces@`9N(o4^Rn)k9zK|g|8SC@tNoghPtYM|=f4{APt4898d1}OSH3qp!$ z^=40xz2I`*uLm9YF7OrLr$EWi*Fm*+*r?Z6CxL2jIVgRyA>cT8BJbCM(recT{7vvm z-fsqv0>1&O-6ue;zvHj)@_PnISJ8S<^F07w5B@GV2_8ZtYJVpvepSF1fNum>fj5DY z%ez6<{~J*9ETtfQ-3N+(mx7Y#SA#0IA5?p93-2Ea?+*t2I;i#X40sWE*ci4Nyc|3f zd@rbZy&n{vJ_4==KMTGRd=iu#9Kxc~`$|yyV+2(HuLT|00>!^uL5=e};7afxK-GWc zHZLbbpw>kLd?ENIP<(zXsQzyQB}eywM}S`gj|IO2s=ptCn*T3A(etI_$PCyET76LE z?*TQhhe5UTCGa@#F|Z$e0$c_j_v>C>UkXZ&P6IW*jo=C3wV?W~f>VdEj=;yjr?$gO z@;^E0?at9VJl)2@_2kcihk+jhC2#kF$ADi2CHH?7zW)>y|9=kBbkswmM}rxta<2m= zXSas@dqK_nAy9mH4AeY+6yBc&B@f46<#7$D`D_5y|IUCVa0TxTQ1rePJOg|XRQ>OP z;`c8=t*2KYG^&3Q2uq{Qp!$6eD7xMWN}lcq&jvpYUIzXsyq|H6my_!Pz7Bi|-#-W* zuJWMTe+Y!U(f3LE{XS`*J+=QFMS+ahQ%I+h#OH;-wISnSQ1hGbD3J1e1?ewICDIJ( zUr3T$jp0v8sH><>>LJ}tdMl|y`VXW(AnEsI52i;Y%X>*Tl75HuagyZpv!tJrBomSc z{rX71XHTBSqG$d)mWK;S;%(6@fyN&5Yabe}yDuK@p!^aIj^q%|b{UO@Z*3}O!KcR26*N!Bm2 zrzrYI@F(HDMH+NW-KFl772L`$_+Y z^d*vhk9jb8zcM^ar|Ne)X|p|fIXp2uYi%DvdXjV~bNE~E)1+C_yGh?6?I7v*c@L&P zKFssCNM9%IB%ucEr?v9Oq*s%!C%ucL-wmX@>}kOt`utJI`XKlr(&tFOAbp0U-*u#~ z*pvTrA@IJA_nUeCG3lR350HM7q~93n1Ei0V{v+xClJt8o=^OTh9twC1cqZu+q!*CR zC;bNL?WA8LJw-Z!bPnli(pO2}CFyrO>0;7Jq_>c^kbaw_-!r6bq`x73kMzGuZy@P+ zzX#JBZ|3>0N$(GN|2g1I;DPY`rhs1r-xHoY;SYJajP&=U)ucZo9Zrf#qoiMw^cy1m zC(;?Db4k~b?j?PJbSo(#y^f^c5%6cZe~cR7Ye*j>{R!z>l73|m(L2DGgy$6j1%FN& z2=6s;H|admw?p1E*h?BG{g5D>B!t z^S6(zkuZo7WB~hb#VK* z8@VAVwVLr%HF4u{b0!)rm69xT<)p@(dU$PC>a{EyESHtsP%CTJXWh0PqxQNr*$?iE zYbB;Oku)_73RkOcxL!-BUai*myWv)&S}DcNgx;D-E%Pll8cCcQ&889;yM1xBQg-7h zG*f{j?W-kCcg4iEt!^61G26brp?ZxTT67W(X3Zq6WP2A)U_%<$%8~tb!<7`W)zdk* zYDKn+F(p}TRg)@}tl8sMugKPfg5z;%Z@fG4Z>uslxDRfLC_X3ahdr%ol0`!kJKaWx z<2KgQ*|-@EY3fx$lVR4%Hr9b?XeKG`b=zuH`02viG!kLVNET%*E|M|ZMa7iqwh=M4 z=1ppb&&^u1u09R(Yz8Xv+@JLwZtQiNlN1gO)n{iRn5)&9K)qFi=VUdi2pkW!>B{bw z+OcTFY+LAEQOk1U9D@~Yg>b#tobchOJ z#frn819|jFZFu0Sy542!o&6bwQ4;syOvZH%RFV^FgA13DVl&%{=38x z6)3sw%<=@*GUkhfbMeQv=yrXauB5a3<5Vj@8mZa*Jhd&_1FIc0uwVChE2)je1s*Ug`^@wRKbRQk#_fTv$7kXs&p7T&Xz; zSPC6%gyozip12La^m`V5olYx8K-XO$lpAoq{D3Q#O;DPl^{mgK)=-z5(8FV~^sPzs zS~r-XbTqHY%4||^HQgu~30BUAHxR0Alse40joe5K+eH?uolrU0Nk~@G;`5rLt!T7V z*E;l*bcTDox&nF zi%ssR=q;34q_z^F?24@4n%c$si2L?r^&m9^h>Tm+@#%)y>MAo3&QxTZU=l4e!J4%f z8_A3Yk;}=BOhc9it-4vyjA=hs7!#L+XsAn?lGTOcUGpd=q7qpGZ$^g~=aoEPiVqWW zG(YRS+|k~|T&)y*m5r^MEvU6_i`0YohE}EK4YBM;#zO-WJ&TTvt9q%T%;H=aJ@qlQ zac*jHoG63_4-j;7STxog9~~ArFCb%VM8N))gNpP`II%*c^!BSHqZ3M~m*9j%ZCMLz z&vj(U{-A+HWO#vy?2RPCZq;-=TdB^qx!rawjIAPjA+G~Shp)C;8n>Uc#=qBcb<*SC z@sUJE+$$WTvYVPiNQ!X=Rp`cs&!z3MRwdp?X-0LumPDys-{M&osj!Hqa_vvFv4vAM z!IDa9ZsYp((WcQ!BXDUZ+Ei(F>z|%zQ?)*Yps|Gc>-DEw$!qAVutU*iWG}-s^zf7> z(dJ4yiCBAHlW2J%uGHTK2wA+vO5!YOdnC{CpiPm(LGEL06Y;0V$s#4GPDeJp#Hxp+3DX=%Z0egNS>#Ij;Z|{+pwCZ)ZBg%LSzYpMyF`t zVW=!^G6FSNf1Na1G-if7Yir+wt@8HcqE#L~6}ln3x3x>hK0^G##cfG(!u-6ag{tTv z#rlIn8JlBSnHR<;Eo(-jwdwjmZl}E+Dpo~*mqlW(VSk2urWH+}Do zKv8mALr#28@xC*zw$S@|Lz$c&_zkh~!+N4EZ1ZsW*$2wHd7F;prw%_O&?7h~juq2g z-1DtEhlVlj7z$>#gK(=WO$-R0z+BIofk=C2{;&w8eL6RBl$mWb=lcBDTxbeM(CVPTpc)|DJ)zHHIo?t~qwxxYwLS3z1uZ_7BF`4^c(hJTd7HoM`~C=Htp*JeA5IvF9| zKFk(ank6WAWsP6C$&84euO8dtpW`ZeWEL&3V{&8f1=?e!Xt^ZKaEdH|y;?@A zj!8=RtH4J8_GH#aI4sxiu{HVzf+afysfzu(4{B^38(bW6*t%_UWWdu1HH*&x*Qw61 zvv?nK%(tg?)OxS1GG@`0Td9Uv!$=k`h2Np{MZUo+lQ~&B*J1hAx{-+?$Mzpj9((A` zA?4%QPNPClqj1%kS!J3?NVK)izxGzbBwU=d2exf^EsItKybNk~A)nD_q%qLNfUlleweJ#_pHEYkBRr{^tM`vFuEyj2Fy?Zm6Yi_iD@xpCCSgbAgsnp-uy7jMV;@(Lqql|R1^+o7N>&=Xc= zq{tG!=^3;VU_4~A_^ZA50Fa>AjACMGryM4^4>Ek)4kMeY_nYPq$Z*Lm5z=ltDo zm!pFRHt5E0Owwek4*gc*!cVnCLD|KMSvUmR{FE#j_bWB{m_ftEO|8hD2>K`xCmCO{ zYkY8W^R5*OcNx+z6q84_Krlzj+FceO3-%p64A#MpT=t{w_;zzWz%=W5#!cE5+}1qd zuiy&uHRu3EJ-n)rwzE)GG{O3{KWrH_THZCGAqxpDon!GWzXH4r3`F70Os5o_pE7P+ zntK=KYn8oQSwn|O2500^6;6_Oi9&=@eyEQ!(sqbhPM|^=D`v|6^qVI;vA5D_XvF!B zdu+*CO|&eA8euz|@eMA~o_#GUJ=fXNiF~w;m3APuYl6DD6KwXl zCn~~7ft!=~ddq`hU+$(_%_g#4@rIr-DqnLq(<`Nh4+{hnJ1fPV$tBK$i7(c&+AW;N zqUBVKO?<<7Q{5eeCWC|OJ)5N)H=m_w*}IEuyr)qxHI!|jqMT<FB0JbxpMjy^1D25)lZaw4U5j~orE}V-ES$( zcUNcm&Vi9>!-3!wVzI9h`_LM~xp{JOypzcJ7{U_D9k%5RRiQw0a;4=hCYMY3QVsYh za^dkU4;zs-MR8;D)(bkg;DU$tWmMyAuhr2$WWOTV5Hr}&un7|Bmiz7&v2XtjW_Sq( zLVJ@8Z1Cz`8%MW{?3x(8c7%O}e3!~T$gQ1}8NfzTG7T-y zLX6lvIkrVynKd3Cyk-Ao*KB;lF4@kkazLA{ynPyL%ryEcwaOCBsNZ@GU!)NeTSkrN zz9?1~>eSp0;!qe0Z7+6sCzbXVorxfYL_+LO9xGhEwTQs3@gJ^5n(RpriU6=tq_k@7^5BdLl8+}TGnbatykN=A%s%!vRLWur?|bHD84S( zQ0%Dft>Ldz$IvUa;?2`H&$QJZ1tFC$Zf9fYNY|aI^Ou1!+O zKgKf5GA`Os6`wX*kj51UYVAt$E@TcQM8g}rUm7?U20;%nl?ch^9UEu?5mdxhnLYv< ztZf!u#mZt_TO)L!HeS^N}s$|Nomf~1r zkGbWpBw2Kg5-W9#QwF5M!UltREG`cQ45#&m1zi^vB@j}$r2XDWWgsDj&|Qt72>~W= z08Gkk0oYkq6<1bGix43g)S;nU4XF_JLF}@vkevAtnl&}KKdoa;(L|8~Gf-u!8rSwl zIuD9yC$$(BD+>d?2Qls)E%)y9CU(Fr6BE*A?^w3GQtsW*+MV@IvISo@zHPGCpYzmf zy~Ff9;LcjN{=D9GXZNl<*PV6Nz**;?xo-WsbrkH~&K6z7Sd|-^{hTCKY8Tm}B}R3LZSUIUG^S}bK_lAEA$SAsf~iV# z+10(9{Pt9X9j_;Ne{Ox>1%2o9#lQAWz_L<;1^=mF_H#5ObzcizrZSOjoTI$2d4W(*} zg`fhv*it@cne_v%vi^eFvT(*8r#fJY`O|&G&c;XQ?mA@macWd?i8FaCPj0W{6dV0q zIe;pvn@T{b<2#JWC#rXxw-0i>yt_pXBCNk=xZ-j>3+L{tZhDM!bv!Y`I@Y3Z2S2^@ z;JvHQP@=2Ic8=ZM2x1Wg1YXhWXmI{Mq6}${PFjpG6Ne2p zv2wlmvbB}$t4GLI9{Zku0E5IC{eid~N0W8tFysRRv~H2ACi}NSX<<&v=yT5N%Q1Tt zoSTxxR2_RgvA43X?sxV3=I`LdzTS4G!;w7%Le)#QIjR?ZqD3>+S(4)EV>B2?g_6^> z@#Juo$dQj^iEsBl`PQjf+J7k;{;!iyoz4t?K&Vv@{@h6e(&OxX>QbR-MAH|{hfMYyAa4#4fRY9>=&CfyvG1B;-FgMLL6mj#s9F(b~- zv?(Sgu4cGIK!5;8o47e5>%{}X$r~}2=HC?vD^_~A!?Xl z^3E-hN}1y;mR!DY^r4%boedD5vBlyg!rDmpp-xiUK6RE($Iu7|^a!NkdcfHH12!8Z z#_!GPiMtE%&{jW7tvP>}PJcN{pTC1mUYzRu#SfB}$~pf!s6C6?jq{Un^}a-*Dtkxo ze1>!C;<(zk9j-Jm`kdP)rJj)@OrcZiQ*1hL?K;JFEKXoVeXW~l$)eaYm#9_~&fP_T zaO~PE~GRAJP>|+;h6b&|;$rum)eTjnZ zVw5%{_zw&+pO$V}boS^Okkkm}Fz>EQ65g;=*?&Wasn??NgdCMwGa&?SOYC)UISU0x zfATgtgYcJluwPPM)ZU{TWGG>d8oMq`u-lQoZo51t!Ck%%bF=d*w9mLNXCmqkvD$s- zPE~%3B7Bh}6pW8fTruDn2jb6Wr6IUERk?}CJ1U&xPVJ7;>MpN=g#!@oRB$0h-@TTo z(gF4wZgj~y%E0V#Qh5-Fi4e`*!F6%C% z#ZxFPH6}Smx@33!5B5n@(t%t(xnadMjqUMl9O=FW?G}0#>lY4X(8`=XnWkL85l-#$ zFg?>{=ZmPC`xk91aU&6#K{=RAb*TvDVp8&(8g1R75299EmynS!hJ_#OrUsd&8tMan zxL&fjwIPM8NTgZ(Cc%tph+Qew-D+Z9YodvYY&uTIEGo^bAl8nwqM{OVJqpvA2V)tP zNnmNlU)*9r^*P!>5r|tsr9pEt!d(yZbx+Csq z4edGyJz4Bqq8+tXRJ_Dt znMywygFC#|qEN2;@@jUzYp-LLs+sl& z4T^_dX-iU<8ub@Pw8+yI;iE32%>+9)M7mQ^1R3&>gjnduvBG<_IaO8IB%=t;6*(q1 zne>au9E$bhoBI80TKKs6M>)*7IzvC@7fQ^=cI4-a8tt!}4Ebu0BMVR3Qb1LXnc=gq zK4h>~&)#J^xXFyRHOv<-8tsX8;z_1OFDSFz0Yxsjb>f+>^1d6C9XAmaF(+uGizjT% zTawcTDzif>3WCDec9qin1GDIHnP|9a5~9m>fnm9=1?TT}t5H7F^LLag)%+q#9BJcj zdc+iLm(fNivXkjs=-d}I3TZBK>Ui-e!rVM7+`u&x>mf`ebN-5o6b$oNvV!>=wnJ5T z3%(KsVS3~|`T7t0XSO0?y+PArgJSktQJl=#?G^T{W_^r7aGuDUY#^j>+dXA0b$5j> zQSI#JvT%8YgHb!f!5;eSD+=OxQY*@dmDLxmeVz2gn80waCGOY?PAK96f%tzY@|$5P ze4ggK!*-?YKDh2;+|U>PYlnOi*uxtfZphl^TlL6`D}ZC&A9mEN5HG~`KLunFm@BFk zbr>$Ym`lm(&DE9dEp6#6jDG1349-t89&jV=@>m$6$0^H2E~;IC2}GDvUs;_il(~b% z-4~n%DRXwl1T5L3@ZS&GyI@-gWI(c9I{HG7!dc;Fj2SS~V~yPTz@;_k!{3y# z0$E%oK1f@OJQOvmtDVJ?j9HTwe$4w7*#ZYC+ure-;Lzj_9~44=Fh}AVY=X;p#9KMO zCw|tcH(h`G_(F3P>naCut&$Xe+d%UWDYd<0nY$+8R*ahT5j-Q!^EA<+!s^jhg6;DU z%KF0^`kO`qLhIogjl>U8Qp{EkOYjXflO@N}ow;?}*oN&R9W5;wd3Wj2Vfj`|ls;%P zI|sLH+in#gU3cIv=*m84C%#Tm0f|=P`%-v2FIF^jO5Ox@s6>T=^lgxE*{>9n-xdbV;N{`vtU?)v3qZbqq^{x}4O=F;#kQAx59Q_` z3R)i7-oQ8ODJ z+=cNsl?q8N$D-1RqzgWzZ6oRfLy`gZ7+hScV2#a+g_}z{J$m$xVlU7573?4y&&?&Y zH{TSXsk*K#g*!NLn%}*_ZnxC~l{!SwhZPjp!c5s&9p53S zcYsCv_MVA-VSZVr-B-tkX*u0kc>Le7yF#=jJi3=-drJr^D-gE*C}3{Qa7f4hdG%-8 zd}$LvlR|;TZceU_dGxT=#H!$-99pQr9$rc+v;tEXk+|3jv}rA31}8=L6S(gbbAV$` zBcmwxeiY=Bz08`-stKAhe7(kE{mDrFFvu%L+rfGk*-0B z#SAFdJ8HK*u*IzwH1BM9Ny*O2@ZhUUHjT?EKjE=)#o5a@4Q=} zj9W9Tf5M=t_l_|0c2x@D=~(6pwDJGI?1Z{6+KiS*D~I3^)19nH^}DVMQ(TdXol2&a zIO=>66?#21RPPJ3C(&;R{{Yi6Q2vI>=z2gJ@U`nVplU?9Vy! z(rrO(TiT-2a16#iH#frVPyRku@d1w6oh(McfUr_|jSf3qD>Z??TZ*Kp^j&tL#eyvQ0F_qWo?Q4FGt7vZF*i8tz$H0Ge+uWK`tq>x%Lk(_r zA)mp~5G#lB@S@Z>ULP73w;0jJd1=24xGm^}u8R`{bkK?lIP6Ay*uIsF{P0hkHq(;9 zeItg~ao?*Q&&?d!cHe6UHdcqK#EII5E|nJZIzod**mtv=)T92lZ8X{9QR-MVxG<@O zB9l|ZLix7q?1Ug;JN@ zGW!+h@}iTk2}KC)G8mebW9^PrXr?C$CurC^&bzo8hT}lY-@+>qbJ5K(&PG@a{|_IA B%~b#Z delta 6804 zcmaKv34B%6oySku7ZVmEOG1+SfRF?d$OeS4W`$rDAPE7BJa68+2@l>9-g^lIwa?O8 zmll_tN?SKXTLoKiFcr1RP@Aftsa0AW>(aXQ(mC?{EW8uS0^frx;7K?Qeg;Rv zsi{iI-ZG$!n+IiqWWaLiuh9l#{Q5?t-%L{ZIxTfwJLKFdx1K=fIJe zO)QtsL;BZ3iTYho7EZXl4ax=&N=FfuCtxu=2gOGjL|z^&g0j$;phWo&I3MnTa^k~~ zA?hd;lMlLl7s~igpe#HSKZ~VGpjdo491j!g+{zaB#Wq;Ri>smd_(zb#sS{9w@pV`U z--ePkvkaxy!7{i2-UOxpNjMC?1o^2~ct~vh8Hy!SY4BY_Wl@oxlsX-1mD_HGa&i+& z-tL5Afdmv6+yaNg!%)T_ff8I#LdpL(p;+V-mnpoI`DR0zrxebT{I8-S13IDj@T*Wx z{4f+(JP#!X-hi@^ccD!5pHRMM7TXm$P)?Q)B@Gut*+3nXab8#lL+<;>;TYCer>Tf( z&p`3%Yfyak78Fzd-fjOK%Em^KYZ5E7ploC#lm$CrSrQiwya^u5c7kvzDKvuj+aMXM zLQv-aI!tf}sN38R4nYp3j<_GZ4DAa8O0=Gbqv1$$PfnB!WrOKZEK~^XlSA299hC1k z!!gi=^Wb(UmfN3;{bd6u=#T+tp-lKYC=>lRTmvu3b4=R`<-4okaM%TRz&M->--e6e zcp4Z>Rl4kea#7t3C04!-C5s-Ii~UoEVR||YI^H2^$rv@Pz%jK47SUb-`Kc}*2D}%F zrA|Vz(7RC5>aS2NF_zio;+Y7O;an&OErTg=9VCI2H$kPEicoy>Gbpj}78DD-2W8@q zp`2jM0>>4XK@O|(;TX6PdY~6dzJCRZ%le=J4@23|3vT;;mx+;u&Ifa#EVLT>;T2Hs zfs@cqBUnN^1#>jRN=Tfk{ZLH(6qJkTw@@tbDU|s}6g#e)3Rlsd31#CxNE#>9J}P7B zI0Oy&sPjVo(rurIV!8>eF2R%oC&L9$(zX)H2DU=6;9e*jzRPVNgA!~nKsnflki<|M zOXUFg{~9U;wmJx9=cl2V>SZXVJqN|~A3^y}Ep+;Gp-fZ+C&D&JysB*w>#EzK9PAl* z8GI353g3aU(U0K_$^R5WRwkYY<-=wu3kM+asG@HB0F>A`1jQ0Zp?rTF%7lY1e+MVg z{tU|aiHo@l;Bpv+e}WreJN`|?s60kR7R+1XoU|B`Di^B`f=e?ShQ zrj2?Ad z@NFo;mc*`zOO*v>;dM~*yB$h;g`uS1EiUhd5<3sW8hBzE_7@)wU+$bZ8A=Qk!)CYy z%1QRYo$!9x0#jEwCJ#Wa549IckX;Y?MEwxTxO0#zLH!S$01H++LAxBv`^^a|;=8cR z8=#oxK9~-lfWzUhpq%hEDCu(!X2R4}&c;iiv^T*txC_bxeNZ;`5H#RRP}+Zj;^M@V z3MVR;LOFR86c=oSvS25aAnJt@bPvK5cofP4C!lQf3>4Fzhhdmh>5T7!^8H>YmcAXz zJa<7Xl28v&k%9ei9DEMWgs;GQ_!lT?Q$e7}hFW2J5*vfRfG<=#SM;5=&R@Afm?h)k zCGbNiLHL>b{<77M1=HYo$^U99^1(Vd9d_C;xI&?9Y#$Vp-UnraPeF0nb5J(+TPO>C zzDkNe&BIQSzJM<>yDkVLiz zZ9r1m&?dX~`Qurt52HI!%tvh$p_{S5K!L%+PJPpXm_ zmfI(meFSBoeW(~o38Eu*&G~yHhPV%1iEcw;sDDLLB+MuY^>e3UyGg2dqBH2b2(Ml! zV%-)r1`&ShMRX8JdB}nNFQS*aghnztjO5RO#IA(JM%0CVjeIC9F^GrkzqaD;2J~-8 zibnUKCUgMJLQ=ksM%guz0M0?rp+UFr4R{KzM31|D{{p%9E|i_rPM~{P-@c@N2)~A2 zK+m98k(6x?)DK+N!{g|3w|yOa6v?&mV>BO0JlCROC?81z4V9lz$wTYW5|sEVkJ}NM zY?oj0yc^w$?n0ZoE zhnkV3>J?}Nx(a;*U5x@r%FoaZ=oo56uOKOF(DP_7k~IGolJYuw5?zbFiKd_(NaD}F z8SOfca<{U=Wjp*SI_tItooFHYzBDL3=wMT<6xGf;H#?w_O2mcIzYIQWSC9Prw=IF}M9aScnYtb<~TFqEw^`jH*aiz)JXy zY;SE{eT_HUh)3LdOOrQyK3~*Cqmii55a|hoJKa}}6%Bmq;bpBE2wHxlB_b2`UYLbf z1x9O^-;B$khKSz^8ufv&6`TKm3f~nJH0k40(nmRO^s7^Xx_0U#I&<1G9m$xk+oowf zI4v`EzN(6ZLT1=+gd=gIBhnrAdvwY457NBOZgLEH=Wer>UBwJtlIGDJX{9M~D;i>T zMsW~JznONE-km<7|Hky{q;y}@a(3wtL@i%D674PL7}a$fyxIEM8I6luBm z;n63JEA;|TSN}23!C^TuD{7xL+grJzqOsc9lhGcPO<@MpJ-6?P`{Vmr+enC(l5>N>NPnTbM2EgG*x@EbL>NRMXi_>jvIlnv9`IX z(dgimuGOy3`Hs%dP1CzGGj&JqdOet%)|a?XnwX{k(IA+%b(Rh zkpJv3-B!3$|9fGpUQtx8?<-nV^Zy$`Cc6+EwPq*~?EPoap+7B3*BQktwN-2-s?4xa z5sXEQ1~c4k1{q<`U>PmjEMo(Qiv`4YMrE&29oZEQMohnio)ZY$tf(bkZQW4st!u0! z$~Ra+%ZxcA-4`{D7+P(PbQ=xbvAEI97rwYr;Y6=~tGI8C^0A3_%V-ap;TBvE zi5kD^mQc66w!3rl%8hEPy}Q%kixxV*GXXO}kUy`@)7s5ir%-DW2nw_@I!X8lI#A6ooF$;lB+H{1R(Pp$BU z?>^5|CymXZ;UnYCsNs%gH=it=HSr>U+f{8W${mW2hDCeyFBT2z=NH!vYmDg3vUI(B zMY5h)_S0l5Y^*bPc3W|YL;ZG{=Tga1Vm?B^8a-w(;E#B8!IBRrSTQ$xOv7&(eqB(W zKGnF8x<)Ut*%PogZt6|th5GLDy2;hdD~Zc)yU5(oz!6=x^mKpfvTKvF1 zv8I2x*vM12K4AvAh(e}65;J^e)bw#mZmZUo+JdrtP8tie2dxl^ZjrdYNK~#R(`ox6 z{y;~-XZlU-Y`=(jRC9Ni6&>hjt}fHZ4!LkFBWN030Un`&gS!Kvh_dfsL64;uu1y{9 z*xtTe^xCy^hkV_;_BVR_<>~r{l{xyz<$ZcfeT9Cpe%TCG2nE;>hvgE9$O>|!ICsf| z4U2}xztiw7eQRxw4lc<`D%XE)Y|vdzTT)zuy6AtUDJ3bRiTMIiCW>K$PPrdd%>~Qq znd@g~I1wvk6xc&B5^q!;U$Jj7k$o=(xO**sz!ab2l%Ye*7R{({TcC$fAdd!) zeDRjzHCN3ZZb+gbVqbH_+E}^9?AuB|w&|2Uuz6}7;UjmE6(!%ka2XkL8~LrSZo*8= V#)TvSY!YEU+nfBUyXa<8{|n_-h{ON@ diff --git a/i18n/es_ES/LC_MESSAGES/endpointman.po b/i18n/es_ES/LC_MESSAGES/endpointman.po index 77e3b665..f29f0e4f 100644 --- a/i18n/es_ES/LC_MESSAGES/endpointman.po +++ b/i18n/es_ES/LC_MESSAGES/endpointman.po @@ -9,14 +9,14 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-03-03 11:01-0800\n" -"PO-Revision-Date: 2016-02-17 22:48+0100\n" +"POT-Creation-Date: 2016-03-05 22:27+0100\n" +"PO-Revision-Date: 2016-03-05 22:45+0100\n" "Last-Translator: Javier Pastor \n" "Language-Team: \n" +"Language: es_ES\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: es_ES\n" "X-Generator: Poedit 1.8.7\n" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-Basepath: ../../..\n" @@ -25,802 +25,1213 @@ msgstr "" "X-Poedit-SearchPathExcluded-0: _old\n" "X-Poedit-SearchPathExcluded-1: i18n\n" -#: views/epm_advanced_settings.page.php:90 -msgid " - Point your phones to: " -msgstr "" +#: assets/js/epm_global.js:117 views/epm_advanced_manual_upload.page.php:140 +msgid "Loading..." +msgstr "Cargando…" + +#: Endpointman.class.php:141 +msgid "Configuration Directory is not writable!" +msgstr "En el directorio de configuración no se puede escribir!" -#: Endpointman.class.php:2870 -msgid "- Copied %_FILE_% to %_FILETO_%." -msgstr "- Copiado %_FILE_% a %_FILETO_%." +#: Endpointman.class.php:142 +msgid "Please change the location:" +msgstr "Por favor, cambia la ubicación:" -#: Endpointman.class.php:3085 -msgid "- Error Moving %_FILENAME_%!" -msgstr "- Error Moviendo %_FILENAME_%!" +#: Endpointman.class.php:142 Endpointman.class.php:149 +#: Endpointman.class.php:1686 +msgid "Here" +msgstr "Aquí" -#: Endpointman.class.php:2866 -msgid "- Failed To Copy %_FILE_%!" -msgstr "- Error al copiar %_FILE_%!" +#: Endpointman.class.php:143 +msgid "Or run this command on SSH:" +msgstr "O ejecute este comando en SSH:" -#: Endpointman.class.php:3141 -msgid "-- Updating Model Lines................" -msgstr "-- Actualizando Lineas de Modelos................" +#: Endpointman.class.php:149 +msgid "" +"Configuration Directory is not a directory or does not exist! Please change " +"the location here:" +msgstr "" +"Directorio de configuración no es un directorio o no existe! Por favor, " +"cambia la ubicación aquí:" -#: Endpointman.class.php:3152 -msgid "----Old Data Detected! Migrating......" -msgstr "----Antiguos datos detectados! Migrando......" +#: Endpointman.class.php:206 +msgid "No command was sent!" +msgstr "Ningún comando fue enviado!" -#: Endpointman.class.php:3247 -msgid "---Inserting Model %_NAMEMOD_%" -msgstr "---Insertando Modelo %_NAMEMOD_%" +#: Endpointman.class.php:212 Endpointman.class.php:459 +msgid "Invalid section module!" +msgstr "Módulo de sección no válido!" -#: Endpointman.class.php:3243 -msgid "---Updating Model %_NAMEMOD_%" -msgstr "--Actualizando Modelo %_NAMEMOD_%" +#: Endpointman.class.php:242 Endpointman.class.php:305 +#: Endpointman.class.php:323 Endpointman.class.php:351 +#: Endpointman.class.php:379 Endpointman.class.php:388 +#: Endpointman.class.php:418 Endpointman.class.php:431 +msgid "Command not found!" +msgstr "Comando no valido!" -#: Endpointman.class.php:2574 Endpointman.class.php:2600 +#: Endpointman.class.php:251 msgid "" -"Click Here!" +"If we can activate the model set terminals of the models.
      If this " +"model is disabled will not appear in the list of models that can be " +"configured for PBX." msgstr "" +"Si activamos el modelo podremos configurar terminales de dicho modelos. Si " +"esta desactivado este modelo no aparecera en la lista de modelos que se " +"pueden configurar para la PBX." -#: views/epm_advanced_settings.page.php:244 -msgid "ARP Executable Path" -msgstr "Ruta Ejecutable ARP" - -#: Endpointman.class.php:2598 Endpointman.class.php:2599 +#: Endpointman.class.php:252 msgid "" -"Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" +"The button \"Install Firmware\" installs the necessary files to the server " +"for the terminal alone are updated via TFTP or HTTP.
      The button " +"\"Remove frimware\" delete files server products.
      The button \"Update " +"frimware\" appears if a newer frimware detected on the server and asks if " +"you want to update.
      The \"Update\" button appears when a new version " +"of this model pack is detected." msgstr "" +"El boton \"Instalar Firmware\" instala los archivos necesarios en el " +"servidor para que lo terminales se actualicen solos a traves de HTTP o TFTP." +"
      El boton \"Remover Frimware\" elimina los archivos de los productos " +"del servidor.
      El boton \"Actualizar Frimware\" aparece si se detectado " +"un frimware mas nuevo en el servidor y nos pregunta si deseas actualizar." +"
      El boton \"Actualizar\" aparece cuando se detecta una nueva version " +"de Paquete de este modelo." -#: provisioning/p.php:34 provisioning/p.php:130 -msgid "Access denied!" -msgstr "¡Acceso denegado!" - -#: views/epm_advanced/oui_manager.views.grid.php:27 -msgid "Actions" -msgstr "Accion" - -#: views/epm_advanced/oui_manager.views.grid.php:5 -msgid "Add Custom OUI" -msgstr "Añadir OUI Personalizado" - -#: views/epm_advanced/oui_manager.views.new.modal.php:62 -msgid "Add New" -msgstr "Añadir Nuevo" - -#: Endpointman.class.php:933 -msgid "Add New Template OK!" +#: Endpointman.class.php:253 +msgid "" +"The \"Install\" button installs the configuration package brand models we " +"selected.
      The \"Uninstall\" button removes the package configuration " +"models of the brand selected.
      The \"Update\" button appears if a new " +"version of the package that is already installed to upgrade to the latest " +"version is detected." msgstr "" +"El boton \"Instalar\" instala el paquete de configuracion de los modelos de " +"la marca que seleccionamos.
      El boton \"Desinstalar\" elimina el " +"paquete de configuracion de los modelos de la marca que seleccionamos.
      " +"El boton \"Actualizacion\" aparece si se detecta una nueva version del " +"paquete que esta ya instalado para actualizar a la ultima version." -#: page.epm_advanced.php:19 -msgid "Advanced Settings" -msgstr "Configuración Avanzada" +#: Endpointman.class.php:254 +msgid "New Package Modified" +msgstr "Nuevo paquete Modificado" -#: Endpointman.class.php:2955 -msgid "All Done!" -msgstr "Todo Correcto!" +#: Endpointman.class.php:255 +msgid "Package Last Modified" +msgstr "Paquete última actualización" -#: views/epm_advanced_settings.page.php:428 -msgid "Allow Duplicate Extensions" -msgstr "Permitir extensiones duplicadas" +#: Endpointman.class.php:256 +msgid "Check for Update " +msgstr "Comprobar se hay actualizaciones" -#: views/epm_advanced_settings.page.php:457 -msgid "Allow Saving Over Default Configuration Files" -msgstr "" +#: Endpointman.class.php:257 +msgid "Check Online " +msgstr "Revise en línea" -#: Endpointman.class.php:3058 -msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" -msgstr "Parece ser un archivo JSON válido Provisioner.net ..... Continuando" +#: Endpointman.class.php:258 +msgid "Install" +msgstr "Instalar" -#: views/epm_advanced_settings.page.php:268 -msgid "Asterisk Executable Path" -msgstr "Ruta Ejecutable Asterisk" +#: Endpointman.class.php:259 +msgid "Uninstall" +msgstr "Desisntalar" -#: views/epm_advanced/oui_manager.views.grid.php:25 -#: views/epm_advanced/oui_manager.views.new.modal.php:36 -#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 -msgid "Brand" -msgstr "Marca" +#: Endpointman.class.php:260 views/epm_devices_main.page.php:516 +msgid "Update" +msgstr "Actualizar" -#: views/epm_advanced_manual_upload.page.php:54 -msgid "Brand Package" -msgstr "Paquete de marcas" +#: Endpointman.class.php:261 +msgid "Install Firmware" +msgstr "Instalar Firmware" -#: views/epm_advanced_manual_upload.page.php:90 -msgid "Brand's Available" -msgstr "Marcas disponibles" +#: Endpointman.class.php:262 +msgid "Remove Firmware" +msgstr "Eliminar Firmware" -#: views/epm_config_editor.page.php:7 -msgid "Brands/Modules" -msgstr "Marca/Modelo" +#: Endpointman.class.php:263 +msgid "Update Firmware" +msgstr "Actualizar Firmware" -#: views/epm_advanced_iedl.page.php:78 -msgid "CSV File Format" -msgstr "Formato de archivo CSV" +#: Endpointman.class.php:264 +msgid "Enable" +msgstr "Activar" -#: Endpointman.class.php:1498 Endpointman.class.php:1575 -#: Endpointman.class.php:1734 -msgid "Can Not Find Uploaded Files!" -msgstr "" +#: Endpointman.class.php:265 +msgid "Disable" +msgstr "Desactivar" -#: Endpointman.class.php:3030 -msgid "Can't Find Downloaded File!" -msgstr "No puede encontrar el archivo descargado." +#: Endpointman.class.php:266 Endpointman.class.php:283 +#: Endpointman.class.php:287 +msgid "Ready!" +msgstr "Listo!" -#: views/epm_advanced/oui_manager.views.new.modal.php:61 -msgid "Cancel" -msgstr "Cancelar" +#: Endpointman.class.php:267 Endpointman.class.php:284 +#: Endpointman.class.php:336 Endpointman.class.php:1517 +#: Endpointman.class.php:1595 Endpointman.class.php:3050 +#: lib/epm_system.class.php:190 +msgid "Error!" +msgstr "Error!" -#: Endpointman.class.php:2478 -msgid "Cant find file:" -msgstr "No se puede encontrar el archivo:" +#: Endpointman.class.php:268 +msgid "Update!" +msgstr "Actualizado!" -#: Endpointman.class.php:279 -msgid "Check Online " -msgstr "Revise en línea" +#: Endpointman.class.php:269 Endpointman.class.php:285 +#: Endpointman.class.php:337 +msgid "Saving Changes..." +msgstr "Guardando cambios…" -#: views/epm_config_manager.page.php:10 -msgid "Check for Update" -msgstr "Buscar actualizaciones" +#: Endpointman.class.php:270 Endpointman.class.php:286 +#: Endpointman.class.php:338 +msgid "Saving Changes... Ok!" +msgstr "Guardando cambios… Listo!" -#: Endpointman.class.php:278 -msgid "Check for Update " -msgstr "Comprobar se hay actualizaciones" +#: Endpointman.class.php:271 Endpointman.class.php:288 +msgid "Upload Content!" +msgstr "Actualizar contenido...." -#: Endpointman.class.php:294 +#: Endpointman.class.php:272 msgid "Check for Updates..." msgstr "Buscar actualizaciones..." -#: Endpointman.class.php:295 +#: Endpointman.class.php:273 msgid "Check for Updates... Ok!" msgstr "Buscar actualizaciones... Listo!" -#: Endpointman.class.php:2850 -msgid "Checking MD5sum of Package..." -msgstr "Comprobando MD5sum en Paquete..." +#: Endpointman.class.php:274 +msgid "Update Content..." +msgstr "Actualizar contenido...." -#: Endpointman.class.php:3013 -msgid "Checking MD5sum of Package...." -msgstr "Comprobando MD5sum de paquete..." +#: Endpointman.class.php:275 Endpointman.class.php:289 +#: Endpointman.class.php:339 +msgid "Invalid Option!" +msgstr "Opcion no valida!" -#: Endpointman.class.php:1696 -msgid "Click this link to download:" +#: Endpointman.class.php:278 +msgid "" +"If you select Hide this brand will disappear and all products and models on " +"the list of Install/Uninstall." msgstr "" +"Si selecciona Ocultar desaparecerá esta marca y todos sus productos y " +"modelos en la lista de Instalar/Desinstalar." -#: Endpointman.class.php:916 -msgid "Clone Model is not number!" +#: Endpointman.class.php:279 +msgid "" +"If you select Hide disappear all models of the product selected from the " +"Install/Uninstall list." msgstr "" +"Si selecciona Ocultar desaparecieran todos los modelos del producto " +"seleccionado de la lista Instalar/Desinstalar." -#: Endpointman.class.php:919 -msgid "Clone Model send is negative!" +#: Endpointman.class.php:280 +msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" +"Si selecciona Ocultar desaparecieran este modelo de la lista Instalar/" +"Desinstalar." -#: Endpointman.class.php:265 Endpointman.class.php:327 -#: Endpointman.class.php:345 Endpointman.class.php:373 -#: Endpointman.class.php:401 Endpointman.class.php:410 -#: Endpointman.class.php:440 Endpointman.class.php:453 -msgid "Command not found!" -msgstr "Comando no valido!" +#: Endpointman.class.php:281 +msgid "Show" +msgstr "Mostrar" -#: Endpointman.class.php:147 -msgid "" -"Configuration Directory is not a directory or does not exist! Please change " -"the location here:" -msgstr "" -"Directorio de configuración no es un directorio o no existe! Por favor, " -"cambia la ubicación aquí:" +#: Endpointman.class.php:282 +msgid "Hide" +msgstr "Ocultar" -#: Endpointman.class.php:139 -msgid "Configuration Directory is not writable!" -msgstr "En el directorio de configuración no se puede escribir!" +#: Endpointman.class.php:329 Endpointman.class.php:436 +msgid "Tab is not valid!" +msgstr "Tab no es valida!" -#: views/epm_advanced_settings.page.php:81 -msgid "Configuration Type" -msgstr "Tipo de Configuracion" +#: Endpointman.class.php:570 +msgid "Devices" +msgstr "Dispositivos" -#: endpointman.i18n.php:6 endpointman.i18n.php:12 -msgid "Connectivity" -msgstr "" +#: Endpointman.class.php:580 +msgid "Current Templates" +msgstr "Plantillas actuales" -#: Endpointman.class.php:2882 -msgid "Copy Error Detected! Aborting Install!" -msgstr "Detectado error al copiar! Abortada la Instalacion!" +#: Endpointman.class.php:584 +msgid "Template Editor" +msgstr "Editor de plantillas" -#: Endpointman.class.php:3066 -msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." -msgstr "" -"Creando estructura de directorios para la Marca '% _NAME_%' y moviendo " -"archivos..." +#: Endpointman.class.php:594 +msgid "Install/Unistall" +msgstr "Instalar/Desisntalar" -#: Endpointman.class.php:2989 -msgid "Creating EPM temp directory" -msgstr "Creando directorio temporal para EPM" +#: Endpointman.class.php:598 +msgid "Show/Hide" +msgstr "Mostrar/Ocultar" -#: Endpointman.class.php:1524 -msgid "Creating EPM temp directory..." -msgstr "" +#: Endpointman.class.php:608 +msgid "Settings" +msgstr "Configuración" -#: Endpointman.class.php:1602 -msgid "Creating Provisioner Directory..." +#: Endpointman.class.php:612 +msgid "OUI Manager" +msgstr "Administrador OUI" + +#: Endpointman.class.php:616 +msgid "Product Configuration Editor" +msgstr "Editor de configuración de producto" + +#: Endpointman.class.php:620 +msgid "Import/Export My Devices List" +msgstr "Importar/exportar mi lista de dispositivos" + +#: Endpointman.class.php:624 +msgid "Package Import/Export" +msgstr "Paquete de importación/exportación" + +#: Endpointman.class.php:664 +msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:598 -msgid "Current Templates" +#: Endpointman.class.php:668 +msgid "Removing symlink to web provisioner" msgstr "" -#: views/epm_advanced/poce.views.button.up.files.php:19 -msgid "Custom Template Files" -msgstr "Archivos de plantilla personalizada" +#: Endpointman.class.php:676 +msgid "Dropping all relevant tables" +msgstr "" -#: views/epm_advanced_settings.page.php:305 -msgid "Default Mirror FreePBX" -msgstr "Mirror por defecto de FreePBX" +#: Endpointman.class.php:736 +msgid "ID Producto not is number" +msgstr "ID Producto no es numero" -#: views/epm_advanced/poce.views.textarea.file.php:36 -msgid "Delete" -msgstr "Borrar" +#: Endpointman.class.php:751 +msgid "ID Brand not is numbre" +msgstr "ID Marca no es numero" -#: Endpointman.class.php:889 -msgid "Delete Template OK!" +#: Endpointman.class.php:861 Endpointman.class.php:930 +msgid "No send ID!" +msgstr "No se ha enviado ID!" + +#: Endpointman.class.php:864 +msgid "ID is not number!" +msgstr "ID no es numero!" + +#: Endpointman.class.php:867 +msgid "ID send is negative!" msgstr "" -#: views/epm_advanced_settings.page.php:56 -#: views/epm_advanced_settings.page.php:191 -msgid "Determine for Me" -msgstr "Determinar por mí" +#: Endpointman.class.php:877 +msgid "Delete Template OK!" +msgstr "Eliminacion Plantilla OK!" -#: Endpointman.class.php:588 -msgid "Devices" +#: Endpointman.class.php:886 +msgid "No send Name!" +msgstr "No se ha enviado NOMBRE!" + +#: Endpointman.class.php:889 +msgid "Name is null!" msgstr "" -#: Endpointman.class.php:1965 -msgid "Directory Not Writable!" +#: Endpointman.class.php:892 +msgid "No send Product!" msgstr "" -#: Endpointman.class.php:1490 -msgid "Directory no exists: " +#: Endpointman.class.php:895 +msgid "Product is not number!" msgstr "" -#: Endpointman.class.php:287 -msgid "Disable" -msgstr "Desactivar" +#: Endpointman.class.php:898 +msgid "Product send is negative!" +msgstr "" -#: views/epm_advanced_settings.page.php:515 -msgid "Disable Configuration File Backups" -msgstr "Desactivar las copias de seguridad del archivo de configuración" +#: Endpointman.class.php:901 +msgid "No send Clone Model!" +msgstr "" -#: views/epm_advanced_settings.page.php:486 -msgid "Disable TFTP Server Check" -msgstr "Desactivar comprobación de servidor TFTP" +#: Endpointman.class.php:904 +msgid "Clone Model is not number!" +msgstr "" -#: views/epm_advanced_settings.page.php:399 -msgid "Disable Tooltips" -msgstr "Desactivar las sugerencias" +#: Endpointman.class.php:907 +msgid "Clone Model send is negative!" +msgstr "" -#: Endpointman.class.php:1526 Endpointman.class.php:1540 -#: Endpointman.class.php:1599 Endpointman.class.php:1604 -#: Endpointman.class.php:1619 Endpointman.class.php:1695 -#: Endpointman.class.php:1790 Endpointman.class.php:2834 -#: Endpointman.class.php:2846 Endpointman.class.php:2887 -#: Endpointman.class.php:2919 Endpointman.class.php:2973 -#: Endpointman.class.php:3001 Endpointman.class.php:3008 -#: Endpointman.class.php:3015 Endpointman.class.php:3019 -#: Endpointman.class.php:3092 Endpointman.class.php:3172 -#: Endpointman.class.php:3208 Endpointman.class.php:3237 -#: Endpointman.class.php:3284 Endpointman.class.php:3295 -#: Endpointman.class.php:3305 -msgid "Done!" -msgstr "Correcto!" +#: Endpointman.class.php:921 +msgid "Add New Template OK!" +msgstr "" -#: views/epm_advanced_manual_upload.page.php:13 -msgid "Download updated releases from " -msgstr "Descarga actualizada liberado de" +#: Endpointman.class.php:933 Endpointman.class.php:2132 +#: Endpointman.class.php:2267 +msgid "ID send is not number!" +msgstr "ID enviado no es numero!" -#: Endpointman.class.php:2997 -msgid "Downloading Brand JSON....." -msgstr "Descargando JSON Marca...." +#: Endpointman.class.php:936 +msgid "ID send is number not valid!" +msgstr "" -#: Endpointman.class.php:3006 -msgid "Downloading Brand Package..." -msgstr "Descargando paquete de Marca...." +#: Endpointman.class.php:951 +msgid "Generate list Ok!" +msgstr "" -#: Endpointman.class.php:2828 Endpointman.class.php:2840 -msgid "Downloading firmware..." -msgstr "Descargando Frimware..." +#: Endpointman.class.php:1023 Endpointman.class.php:1114 +#: Endpointman.class.php:1239 Endpointman.class.php:1287 +#: Endpointman.class.php:1381 +msgid "No send Product Select!" +msgstr "" -#: Endpointman.class.php:688 -msgid "Dropping all relevant tables" +#: Endpointman.class.php:1026 Endpointman.class.php:1117 +msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:286 -msgid "Enable" -msgstr "Activar" +#: Endpointman.class.php:1029 Endpointman.class.php:1120 +msgid "Product Select send is number not valid!" +msgstr "" -#: views/epm_advanced_settings.page.php:370 -msgid "Enable Debug Mode" -msgstr "Activar Debug Mode" +#: Endpointman.class.php:1123 +msgid "No send File ID!" +msgstr "" -#: views/epm_advanced_settings.page.php:334 -msgid "Enable FreePBX ARI Module" -msgstr "Activar FreePBX Modulo ARI " +#: Endpointman.class.php:1126 +msgid "No send File Name!" +msgstr "" -#: page.epm_advanced.php:18 page.epm_config.php:18 -msgid "End Point Configuraction Manager" -msgstr "Configurar Administracion End Point" +#: Endpointman.class.php:1129 Endpointman.class.php:1242 +#: Endpointman.class.php:1293 Endpointman.class.php:1384 +msgid "No send Type File!" +msgstr "" -#: functions.inc.php:234 -msgid "End Point Manager" -msgstr "Administracion End Point" +#: Endpointman.class.php:1185 +msgid "File not readable, check the permission! " +msgstr "" -#: provisioning/p.php:33 provisioning/p.php:129 -msgid "Error 403 Forbidden" -msgstr "Error 403 - Prohibido" +#: Endpointman.class.php:1245 Endpointman.class.php:1290 +msgid "No send SendID!" +msgstr "" -#: provisioning/p.php:107 provisioning/p.php:121 -msgid "Error 404 Not Found" -msgstr "Error 404, No encontrado" +#: Endpointman.class.php:1296 +msgid "No send Text File!" +msgstr "" -#: provisioning/p.php:98 -msgid "Error 500 Internal Server Error" -msgstr "Error 500 - Error Interno del Servidor" +#: Endpointman.class.php:1299 +msgid "No send Save Name!" +msgstr "" -#: Endpointman.class.php:3036 -msgid "" -"Error Connecting to the Package Repository. Module not installed. Please Try " -"again later." +#: Endpointman.class.php:1302 +msgid "No send Name File!" msgstr "" -"Error al conectar al repositorio de paquetes. Módulo no instalado. Por favor " -"Inténtalo más tarde." -#: Endpointman.class.php:2991 -msgid "Error creating directory: %_DIR_%" -msgstr "Error al crear el directorio: %_DIR_%" +#: Endpointman.class.php:1305 +msgid "No send Origianl Name File!" +msgstr "" -#: Endpointman.class.php:3033 -msgid "Error download Brand package!" -msgstr "Error de descarga paquete de marcas!" +#: Endpointman.class.php:1387 +msgid "No send SQL Select!" +msgstr "" -#: Endpointman.class.php:2831 Endpointman.class.php:2843 -msgid "Error download frimware package!" -msgstr "Error al descarga paquete del firmware!" +#: Endpointman.class.php:1400 +msgid "Type File not valid!" +msgstr "" -#: Endpointman.class.php:289 Endpointman.class.php:306 -#: Endpointman.class.php:358 Endpointman.class.php:1529 -#: Endpointman.class.php:1607 -msgid "Error!" -msgstr "Error!" +#: Endpointman.class.php:1469 +msgid "List Done!" +msgstr "" -#: Endpointman.class.php:2086 Endpointman.class.php:2123 -msgid "Error: Command not found!" -msgstr "Error: Comando no valido!" +#: Endpointman.class.php:1475 +msgid "Not is directory: " +msgstr "" -#: Endpointman.class.php:2572 -msgid "Error: No Local File for %_name_% !" +#: Endpointman.class.php:1478 +msgid "Directory no exists: " msgstr "" -#: views/epm_advanced_iedl.page.php:99 -msgid "Examples" -msgstr "Ejemplos" +#: Endpointman.class.php:1486 Endpointman.class.php:1563 +#: Endpointman.class.php:1722 +msgid "Can Not Find Uploaded Files!" +msgstr "" -#: views/epm_advanced_settings.page.php:323 -msgid "Experimental" -msgstr "Experimental" +#: Endpointman.class.php:1491 +msgid "Importing brand file %_FILE_%..." +msgstr "" -#: views/epm_advanced_manual_upload.page.php:122 -msgid "Explor a package brand's availables." -msgstr "Exportar paquete de Marcas disponibles." +#: Endpointman.class.php:1512 +msgid "Creating EPM temp directory..." +msgstr "" -#: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:109 -msgid "Export" -msgstr "Exportar" +#: Endpointman.class.php:1514 Endpointman.class.php:1528 +#: Endpointman.class.php:1587 Endpointman.class.php:1592 +#: Endpointman.class.php:1607 Endpointman.class.php:1683 +#: Endpointman.class.php:1778 Endpointman.class.php:2722 +#: Endpointman.class.php:2898 Endpointman.class.php:2931 +#: Endpointman.class.php:2986 Endpointman.class.php:3014 +#: Endpointman.class.php:3028 Endpointman.class.php:3033 +#: Endpointman.class.php:3121 Endpointman.class.php:3126 +#: Endpointman.class.php:3190 Endpointman.class.php:3226 +#: Endpointman.class.php:3255 Endpointman.class.php:3298 +#: Endpointman.class.php:3313 Endpointman.class.php:3323 +msgid "Done!" +msgstr "Correcto!" -#: views/epm_advanced_manual_upload.page.php:79 -msgid "Export Brand Packages" -msgstr "Paquetes de exportación de la marcas" +#: Endpointman.class.php:1523 +msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" +msgstr "" -#: views/epm_advanced_iedl.page.php:6 -msgid "Export CSV" -msgstr "Exportación CSV" +#: Endpointman.class.php:1525 Endpointman.class.php:3030 +msgid "Extracting Tarball........ " +msgstr "" -#: views/epm_advanced_iedl.page.php:16 -msgid "Export CSV file of devices" -msgstr "Archivo CSV exportación de dispositivos" +#: Endpointman.class.php:1534 +msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." +msgstr "" -#: views/epm_advanced_iedl.page.php:26 -msgid "Export data configuracion devices." -msgstr "Exportar datos de configuracion de dispositivo." +#: Endpointman.class.php:1536 +msgid "Looking file and update brand's...." +msgstr "" -#: Endpointman.class.php:1686 -msgid "Exporting %_NAME_%" +#: Endpointman.class.php:1543 +msgid "Please name the Package the same name as your brand!" msgstr "" -#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:95 -msgid "Extension" -msgstr "Extension" +#: Endpointman.class.php:1548 +msgid "No File Provided!" +msgstr "" -#: Endpointman.class.php:1597 -msgid "Extracting Provisioner Package..." +#: Endpointman.class.php:1553 Endpointman.class.php:1614 +msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:1535 -msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" +#: Endpointman.class.php:1568 +msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:3017 -msgid "Extracting Tarball........" +#: Endpointman.class.php:1585 +msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:1537 -msgid "Extracting Tarball........ " +#: Endpointman.class.php:1590 +msgid "Creating Provisioner Directory..." msgstr "" -#: functions.inc.php:343 -msgid "Failed to install " -msgstr "Fallo de installacion" +#: Endpointman.class.php:1604 +msgid "Updating Last Modified..." +msgstr "" -#: Endpointman.class.php:3782 -msgid "Failed to write file to disk" +#: Endpointman.class.php:1611 +msgid "File Temp no Exists!" msgstr "" -#: Endpointman.class.php:1752 -msgid "File %_FILE_% size is 0!" +#: Endpointman.class.php:1659 +msgid "No package set!" msgstr "" -#: views/epm_advanced_settings.page.php:86 -msgid "File (TFTP/FTP)" -msgstr "Archivos (TFTP/FTP)" +#: Endpointman.class.php:1662 +msgid "Package not valid!" +msgstr "" -#: Endpointman.class.php:1623 -msgid "File Temp no Exists!" +#: Endpointman.class.php:1671 +msgid "ID Package send not valid, brand not exist!" msgstr "" -#: provisioning/p.php:108 provisioning/p.php:122 -msgid "File not Found!" -msgstr "¡Archivo no encontrado!" +#: Endpointman.class.php:1674 +msgid "Exporting %_NAME_%" +msgstr "" -#: Endpointman.class.php:1197 -msgid "File not readable, check the permission! " +#: Endpointman.class.php:1684 +msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:3784 -msgid "File upload stopped by extension" +#: Endpointman.class.php:1729 +msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:2891 -msgid "Firmware MD5 didn't match!" -msgstr "MD5 de Frimware no coincide!" +#: Endpointman.class.php:1737 +msgid "We support only CVS and TXT files, type file %_FILE_% no support!" +msgstr "" -#: Endpointman.class.php:3122 -msgid "Firmware Requirment Detected!.........." -msgstr "Requisito firmware detectado .........." +#: Endpointman.class.php:1740 +msgid "File %_FILE_% size is 0!" +msgstr "" -#: views/epm_advanced/poce.views.textarea.file.php:23 -msgid "Full Screen F11" -msgstr "Pantalla Completa F11" +#: Endpointman.class.php:1780 +msgid "Invalid Extension Specified on line %_LINE_%!" +msgstr "" -#: views/epm_advanced_settings.page.php:606 -msgid "GIT Branch" -msgstr "GIT Rama" +#: Endpointman.class.php:1783 +msgid "Invalid Model Specified on line %_LINE_%!" +msgstr "" -#: Endpointman.class.php:963 -msgid "Generate list Ok!" +#: Endpointman.class.php:1786 +msgid "Invalid Brand Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1947 views/epm_advanced_settings.page.php:23 -msgid "Git not installed!" +#: Endpointman.class.php:1789 +msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: views/epm_advanced_settings.page.php:114 -msgid "Global Final Config & Firmware Directory" -msgstr "Directorio final de configuracion y firmware" +#: Endpointman.class.php:1796 +msgid "Please reboot & rebuild all imported phones" +msgstr "Por favor, reiniciar y reconstruir todos los teléfonos importados." -#: views/epm_advanced_manual_upload.page.php:97 -msgid "Heads up!" -msgstr "¡Aviso!" +#: Endpointman.class.php:1798 +msgid "Possible file upload attack!" +msgstr "Possible file upload attack!" -#: Endpointman.class.php:140 Endpointman.class.php:147 -#: Endpointman.class.php:1698 -msgid "Here" -msgstr "Aquí" - -#: Endpointman.class.php:304 -msgid "Hide" -msgstr "Ocultar" +#: Endpointman.class.php:1820 +msgid "No ID set!" +msgstr "No se ha enviado ID!" -#: Endpointman.class.php:1835 +#: Endpointman.class.php:1823 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:763 -msgid "ID Brand not is numbre" -msgstr "ID Marca no es numero" +#: Endpointman.class.php:1842 +msgid "No OUI set!" +msgstr "" -#: Endpointman.class.php:1683 -msgid "ID Package send not valid, brand not exist!" +#: Endpointman.class.php:1845 +msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:748 -msgid "ID Producto not is number" -msgstr "ID Producto no es numero" +#: Endpointman.class.php:1887 Endpointman.class.php:2120 +#: Endpointman.class.php:2251 +msgid "No send name!" +msgstr "No se ha enviado NOMBRE!" -#: Endpointman.class.php:876 -msgid "ID is not number!" -msgstr "" +#: Endpointman.class.php:1890 Endpointman.class.php:2123 +#: Endpointman.class.php:2254 +msgid "No send value!" +msgstr "No se ha enviado VALOR!" -#: Endpointman.class.php:879 -msgid "ID send is negative!" -msgstr "" +#: Endpointman.class.php:1935 views/epm_advanced_settings.page.php:23 +msgid "Git not installed!" +msgstr "GIT no instalado!" -#: Endpointman.class.php:945 Endpointman.class.php:2144 -#: Endpointman.class.php:2279 -msgid "ID send is not number!" -msgstr "ID enviado no es numero!" +#: Endpointman.class.php:1953 +msgid "Directory Not Writable!" +msgstr "Directorio no escribible!" -#: Endpointman.class.php:948 -msgid "ID send is number not valid!" -msgstr "" +#: Endpointman.class.php:1956 +msgid "Not a Vaild Directory.
      Try to run 'mkdir " +msgstr "No es un directorio válido.
      If this " -"model is disabled will not appear in the list of models that can be " -"configured for PBX." -msgstr "" -"Si activamos el modelo podremos configurar terminales de dicho modelos. Si " -"esta desactivado este modelo no aparecera en la lista de modelos que se " -"pueden configurar para la PBX." +#: Endpointman.class.php:2015 +msgid "Name invalid: " +msgstr "Nombre no validao!" -#: Endpointman.class.php:301 -msgid "" -"If you select Hide disappear all models of the product selected from the " -"Install/Uninstall list." -msgstr "" -"Si selecciona Ocultar desaparecieran todos los modelos del producto " -"seleccionado de la lista Instalar/Desinstalar." +#: Endpointman.class.php:2047 Endpointman.class.php:2084 +msgid "Error: Not send command!" +msgstr "Error: No se ha enviado comando!" -#: Endpointman.class.php:302 -msgid "If you select Hide disappear this model the Install/Uninstall list." -msgstr "" -"Si selecciona Ocultar desaparecieran este modelo de la lista Instalar/" -"Desinstalar." +#: Endpointman.class.php:2050 Endpointman.class.php:2087 +msgid "Error: Not send ID!" +msgstr "Error: No se ha enviado ID!" -#: Endpointman.class.php:300 -msgid "" -"If you select Hide this brand will disappear and all products and models on " -"the list of Install/Uninstall." -msgstr "" -"Si selecciona Ocultar desaparecerá esta marca y todos sus productos y " -"modelos en la lista de Instalar/Desinstalar." +#: Endpointman.class.php:2053 Endpointman.class.php:2090 +msgid "Error: ID not is number!" +msgstr "Error: ID no es numero!" -#: views/epm_advanced_iedl.page.php:52 views/epm_advanced_iedl.page.php:60 -#: views/epm_advanced_manual_upload.page.php:32 -#: views/epm_advanced_manual_upload.page.php:62 -msgid "Import" -msgstr "Importar" +#: Endpointman.class.php:2071 Endpointman.class.php:2108 +msgid "Error: Command not found!" +msgstr "Error: Comando no valido!" -#: views/epm_advanced_iedl.page.php:35 -msgid "Import CSV" -msgstr "Importar CSV" +#: Endpointman.class.php:2126 Endpointman.class.php:2261 +msgid "No send id!" +msgstr "No se ha enviado ID!" -#: views/epm_advanced_iedl.page.php:48 -msgid "Import CSV file of devices" -msgstr "Importar archivo CSV de dispositivos" +#: Endpointman.class.php:2129 Endpointman.class.php:2264 +msgid "No send idtype!" +msgstr "No se ha enviado IDType!" -#: views/epm_advanced_manual_upload.page.php:10 -msgid "Import Packages" -msgstr "Importar Paquetes" +#: Endpointman.class.php:2151 Endpointman.class.php:2290 +msgid "IDType invalid: " +msgstr "IDType no valido:" -#: views/epm_advanced_manual_upload.page.php:41 -msgid "Import a package Provisioner in manual mode." -msgstr "Importación de un paquete de Provisioner en el modo manual." +#: Endpointman.class.php:2258 +msgid "Invalid Value!" +msgstr "Valor no valido!" -#: views/epm_advanced_manual_upload.page.php:71 -msgid "Import a package brand in manual mode." -msgstr "Importación de un paquete de la marca en el modo manual." +#: Endpointman.class.php:2442 +msgid "Maximum stack depth exceeded" +msgstr "Se ha excedido la profundidad máxima de la pila" -#: Endpointman.class.php:638 -msgid "Import/Export My Devices List" -msgstr "Importar/exportar mi lista de dispositivos" +#: Endpointman.class.php:2445 +msgid "Underflow or the modes mismatch" +msgstr "JSON con formato incorrecto o inválido" -#: Endpointman.class.php:1741 -msgid "Importing CVS file %_FILE_%..." +#: Endpointman.class.php:2448 +msgid "Unexpected control character found" msgstr "" +"Error del carácter de control, posiblemente se ha codificado de forma " +"incorrecta" -#: Endpointman.class.php:1580 -msgid "Importing Provisioner file %_FILE_%..." -msgstr "" +#: Endpointman.class.php:2451 +msgid "Syntax error, malformed JSON" +msgstr "Error de sintaxis, JSON malformada" -#: Endpointman.class.php:1503 -msgid "Importing brand file %_FILE_%..." +#: Endpointman.class.php:2454 +msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "" +"Caracteres UTF-8 mal formados, posiblemente codificados de forma incorrecta" -#: Endpointman.class.php:3106 -msgid "Inserting %_BRANDNAME_% brand data.........." -msgstr "Insertando datos de la marca % _BRANDNAME_%.........." - -#: Endpointman.class.php:280 -msgid "Install" -msgstr "Instalar" +#: Endpointman.class.php:2457 +msgid "Unknown error" +msgstr "Error desconocido." -#: Endpointman.class.php:283 -msgid "Install Firmware" -msgstr "Instalar Firmware" +#: Endpointman.class.php:2466 +msgid "Cant find file:" +msgstr "No se puede encontrar el archivo:" -#: Endpointman.class.php:612 -msgid "Install/Unistall" -msgstr "Instalar/Desisntalar" +#: Endpointman.class.php:2486 +msgid "" +"Error: Not able to connect to repository. Using local master file instead." +msgstr "" +"Error: No es capaz de conectarse al repositorio. Usando archivo maestro " +"local." -#: Endpointman.class.php:2859 -msgid "Installing Firmware..." -msgstr "Instalando Frimware..." +#: Endpointman.class.php:2504 +msgid "Not able to connect to repository. Using local Provisioner.net Package" +msgstr "" +"No es capaz de conectarse al repositorio. Usando copia local del paquete " +"Provisioner.net" -#: Endpointman.class.php:3041 -msgid "Installing brands is disabled while in repo mode!" -msgstr "Instalación de marcas se desactiva en el modo de Repo!" +#: Endpointman.class.php:2533 +#, php-format +msgid "Update Brand (%s):" +msgstr "Actualizando Marca (%s):" -#: Endpointman.class.php:1798 -msgid "Invalid Brand Specified on line %_LINE_%!" +#: Endpointman.class.php:2539 +#, php-format +msgid "Not able to connect to repository. Using local brand [%s] file instead." msgstr "" -#: Endpointman.class.php:1792 -msgid "Invalid Extension Specified on line %_LINE_%!" +#: Endpointman.class.php:2569 +#, php-format +msgid "" +"You can not add the mark (%s) as the ID (%d) already exists in the database!" msgstr "" -#: Endpointman.class.php:1565 Endpointman.class.php:1626 -msgid "Invalid File Extension!" +#: Endpointman.class.php:2582 +#, php-format +msgid "Error: No Local File for %s !" msgstr "" -#: Endpointman.class.php:3297 -msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" -msgstr "Inválida estructura JSON en %_PATCH _%/brand_data.json" +#: Endpointman.class.php:2582 Endpointman.class.php:2606 +msgid "Learn how to manually upload packages here (it's easy!):" +msgstr "Aprender cómo cargar manualmente los paquetes aquí (es fácil!):" -#: Endpointman.class.php:3568 -msgid "Invalid MAC Address" -msgstr "Direccion MAC no valida" +#: Endpointman.class.php:2582 Endpointman.class.php:2606 +msgid "Click Here!" +msgstr "Click Aquí!" -#: Endpointman.class.php:1801 -msgid "Invalid Mac on line %_LINE_%!" +#: Endpointman.class.php:2606 +msgid "" +"Error: Aborting Brand Downloads. Can't Get Master File, Assuming Timeout " +"Issues!" msgstr "" +"Error: Abortar Descargas de Marca. No se puede obtener del archivo Maestro, " +"Suponiendo problemas de Timeout!" -#: Endpointman.class.php:3563 -msgid "Invalid Model Selected, Can't Sync System" -msgstr "Seleccionada Modelo no válido, no puede Sistema de sincronización" +#: Endpointman.class.php:2613 +msgid "" +"Error: The Remote Server Is Currently Syncing With the Master Server, Please " +"try again later" +msgstr "" -#: Endpointman.class.php:1795 -msgid "Invalid Model Specified on line %_LINE_%!" +#: Endpointman.class.php:2691 +#, php-format +msgid "Error: System Error in Sync Model [%s] Function, Load Failure!" msgstr "" -#: Endpointman.class.php:297 Endpointman.class.php:311 -#: Endpointman.class.php:361 -msgid "Invalid Option!" -msgstr "Opcion no valida!" +#: Endpointman.class.php:2708 +#, php-format +msgid "Moving/Removing Model '%s' not present in JSON file......" +msgstr "" -#: Endpointman.class.php:2270 -msgid "Invalid Value!" -msgstr "Valor no valido!" +#: Endpointman.class.php:2757 +#, php-format +msgid "Brand Directory '%s' Doesn't Exist! (%s)" +msgstr "Directorio de la marca '%s' no existe! (%s)" -#: views/epm_advanced/oui_manager.views.new.modal.php:55 -msgid "It is the brand of OUI we specified." -msgstr "" +#: Endpointman.class.php:2761 +#, php-format +msgid "Product Directory '%s' Doesn't Exist! (%s)" +msgstr "Directorio de productos '%s' no existe! (%s)" -#: views/epm_advanced_manual_upload.page.php:82 -msgid "Learn how to create your own brand package at " -msgstr "Aprender a crear su propio paquete de la marca en " +#: Endpointman.class.php:2765 +#, php-format +msgid "File 'family_data.json' Doesn't exist in directory: %s" +msgstr "Archivo 'family_data.json' no existe en el directorio: %s" -#: Endpointman.class.php:2573 -msgid "Learn how to manually upload packages here (it's easy!):" -msgstr "" +#: Endpointman.class.php:2827 +msgid "Installa frimware... " +msgstr "Instalando Frimware... " -#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:96 -msgid "Line" -msgstr "Linea" +#: Endpointman.class.php:2844 +msgid "Skipping download, updated local version..." +msgstr "Saltando descarga, version local actualizada..." -#: views/epm_advanced_manual_upload.page.php:97 -msgid "List Bran's Availables empty." -msgstr "Lista de Marcas disponibles vacia." +#: Endpointman.class.php:2846 Endpointman.class.php:2854 +msgid "Downloading firmware..." +msgstr "Descargando Frimware..." -#: Endpointman.class.php:1481 -msgid "List Done!" -msgstr "" +#: Endpointman.class.php:2848 Endpointman.class.php:2856 +msgid "Error download frimware package!" +msgstr "Error al descarga paquete del firmware!" -#: views/epm_config_manager.page.php:19 -msgid "List Packages Manager" -msgstr "Administracion Lista de Paquetes" +#: Endpointman.class.php:2862 +msgid "Checking MD5sum of Package... " +msgstr "Comprobando MD5sum de paquete... " -#: views/epm_advanced/poce.views.bootnav.php:5 -msgid "List Product's Empty" -msgstr "" +#: Endpointman.class.php:2864 +msgid "Matches!" +msgstr "Correcto!" -#: views/epm_advanced_manual_upload.page.php:133 -msgid "List of other exports" -msgstr "Lista de otras exportaciones." +#: Endpointman.class.php:2871 +msgid "Installing Firmware..." +msgstr "Instalando Frimware..." -#: views/epm_advanced_manual_upload.page.php:152 -msgid "List packages generated in other exports." -msgstr "Lista paquetes generados en otras exportaciones." +#: Endpointman.class.php:2879 +#, php-format +msgid "- Failed To Copy %s!" +msgstr "- Error al copiar %s!" -#: views/epm_config_editor.page.php:11 views/epm_config_manager.page.php:23 -msgid "Loading data...." -msgstr "Cargando datos..." +#: Endpointman.class.php:2882 +#, php-format +msgid "- Copied %s to %s." +msgstr "- Copiar %s a %s." -#: assets/js/epm_global.js:117 -msgid "Loading.." -msgstr "Cargando..." +#: Endpointman.class.php:2893 +msgid "Copy Error Detected! Aborting Install!" +msgstr "Detectado error al copiar! Abortada la Instalacion!" -#: views/epm_advanced_manual_upload.page.php:140 -msgid "Loading..." -msgstr "" +#: Endpointman.class.php:2895 +msgid "Info: Please Check Directory/Permissions!" +msgstr "Info: Compruebe los permisos del directorio!" -#: views/epm_advanced/poce.views.button.up.files.php:7 -msgid "Local File Configs" -msgstr "Cargar Archivo de Configuracion" +#: Endpointman.class.php:2902 +msgid "Firmware MD5 didn't match!" +msgstr "MD5 de Frimware no coincide!" -#: views/epm_advanced_settings.page.php:210 -msgid "Local Paths" -msgstr "Rutas Locales" +#: Endpointman.class.php:2906 +msgid "Your Firmware is already up to date." +msgstr "Tu Frimware ya esta actualizado." -#: Endpointman.class.php:1548 -msgid "Looking file and update brand's...." -msgstr "" +#: Endpointman.class.php:2915 +msgid "Uninstalla frimware... " +msgstr "Desisntalando Frimware..." -#: Endpointman.class.php:1546 -msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." +#: Endpointman.class.php:2939 +msgid "Uninstalla Brand..." +msgstr "Desisntalando Marca..." + +#: Endpointman.class.php:2968 Endpointman.class.php:3108 +#: Endpointman.class.php:3302 +msgid "All Done!" +msgstr "Todo Correcto!" + +#: Endpointman.class.php:2989 +msgid "Error: Not allowed in repo mode!!" +msgstr "Error: No permite en modo de repo!" + +#: Endpointman.class.php:2998 +msgid "Install/Update Brand..." +msgstr "Instalar/Actualizar Marca..." + +#: Endpointman.class.php:3003 +msgid "Creating EPM temp directory" +msgstr "Creando directorio temporal para EPM" + +#: Endpointman.class.php:3005 +#, php-format +msgid "Error: Failed to create the directory '%s', please Check Permissions!" msgstr "" +"Error: No se ha podido crear el directorio '%s', por favor verifique los " +"permisos!" -#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:92 -msgid "MAC Address" -msgstr "Direccion MAC" +#: Endpointman.class.php:3010 +msgid "Downloading Brand JSON..... " +msgstr "Descargando JSON Marca...." + +#: Endpointman.class.php:3019 +msgid "Downloading Brand Package..." +msgstr "Descargando paquete de Marca...." + +#: Endpointman.class.php:3026 +msgid "Checking MD5sum of Package.... " +msgstr "Comprobando MD5sum de paquete... " -#: Endpointman.class.php:3025 +#: Endpointman.class.php:3039 msgid "MD5 Did not match!" msgstr "- MD5 no coincide!" -#: Endpointman.class.php:3027 -msgid "MD5 PKG: %_MD5_%" +#: Endpointman.class.php:3040 +#, php-format +msgid "MD5 XML: %s" +msgstr "MD5 XML: %s" + +#: Endpointman.class.php:3041 +#, php-format +msgid "MD5 PKG: %s" +msgstr "MD5 PKG: %s" + +#: Endpointman.class.php:3044 +msgid "Error: Can't Find Downloaded File!" +msgstr "Error: No puede encontrar el archivo descargado." + +#: Endpointman.class.php:3047 +msgid "Error download Brand package!" +msgstr "Error de descarga paquete de marcas!" + +#: Endpointman.class.php:3051 +msgid "" +"Error Connecting to the Package Repository. Module not installed. Please Try " +"again later." msgstr "" +"Error al conectar al repositorio de paquetes. Módulo no instalado. Por favor " +"Inténtalo más tarde." -#: Endpointman.class.php:3026 -msgid "MD5 XML: %_MD5_%" +#: Endpointman.class.php:3052 +msgid "" +"You Can Also Manually Update The Repository By Downloading Files here: Release Repo " msgstr "" -#: Endpointman.class.php:2466 -msgid "Malformed UTF-8 characters, possibly incorrectly encoded" -msgstr "Malformados caracteres UTF-8, posiblemente incorrectamente codificada" +#: Endpointman.class.php:3053 +msgid "Then Use Manual Upload in Advanced Settings." +msgstr "Utilizar carga Manual en configuración avanzada." -#: Endpointman.class.php:2852 -msgid "Matches!" -msgstr "Correcto!" +#: Endpointman.class.php:3056 +msgid "Error: Installing brands is disabled while in repo mode!" +msgstr "Error: Instalación de marcas se desactiva en el modo de Repo!" -#: Endpointman.class.php:2454 -msgid "Maximum stack depth exceeded" -msgstr "Superó capacidad de la pila máximo" +#: Endpointman.class.php:3065 +#, php-format +msgid "Update Brand %s ... " +msgstr "Actualizando Marca %s ... " -#: Endpointman.class.php:3780 -msgid "Missing a temporary folder" -msgstr "" +#: Endpointman.class.php:3068 +msgid "Processing %_PATH_%/brand_data.json..." +msgstr "Procesando %_PATH_%/brand_data.json..." -#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:94 -msgid "Model" -msgstr "Modelo" +#: Endpointman.class.php:3073 +msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" +msgstr "Parece ser un archivo JSON válido Provisioner.net ..... Continuando" -#: Endpointman.class.php:3267 -msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" +#: Endpointman.class.php:3081 +#, php-format +msgid "Creating Directory Structure for Brand '%s' and Moving Files..." msgstr "" -"Mover/Eliminar Modelo '% _NAMEMOD_%' que no está presente en el archivo " -"JSON......" +"Creando Estructura de Directorios para la Marca '%s' y Moviendo Archivos..." -#: views/epm_advanced_settings.page.php:220 -msgid "NMAP Executable Path" -msgstr "Ruta Ejecutable NMAP" +#: Endpointman.class.php:3101 +#, php-format +msgid "- Error Moving %s!" +msgstr "- Error Moviendo %s!" + +#: Endpointman.class.php:3118 +#, php-format +msgid "Updating %s brand data ..." +msgstr "Actualizando datos de la marca %s ..." + +#: Endpointman.class.php:3123 +#, php-format +msgid "Inserting %s brand data ..." +msgstr "Insertando datos de la marca %s ..." + +#: Endpointman.class.php:3131 +msgid "Updating Family Lines ..." +msgstr "Actualizando líneas de familia ..." + +#: Endpointman.class.php:3140 +msgid "Firmware Requirment Detected!.........." +msgstr "Requisito firmware detectado .........." + +#: Endpointman.class.php:3159 +msgid "-- Updating Model Lines ... " +msgstr "-- Actualizando Lineas de Modelos ... " + +#: Endpointman.class.php:3170 +msgid "----Old Data Detected! Migrating ... " +msgstr "----Antiguos datos detectados! Migrando ... " + +#: Endpointman.class.php:3210 Endpointman.class.php:3235 +msgid "Old Data Detected! Migrating ... " +msgstr "Antiguos datos detectados! Migrando ... " + +#: Endpointman.class.php:3261 +msgid "---Updating Model %_NAMEMOD_%" +msgstr "--Actualizando Modelo %_NAMEMOD_%" + +#: Endpointman.class.php:3265 +msgid "---Inserting Model %_NAMEMOD_%" +msgstr "---Insertando Modelo %_NAMEMOD_%" + +#: Endpointman.class.php:3272 +msgid "Error: System Error in Sync Model Function, Load Failure!" +msgstr "Error: Sistema de sincronización de modelos, Error de Carga!" + +#: Endpointman.class.php:3273 +msgid "Error: " +msgstr "Error: " + +#: Endpointman.class.php:3286 +#, php-format +msgid "Moving/Removing Model '%s' not present in JSON file ... " +msgstr "" +"Mover/Eliminar Modelo '%s' que no está presente en el archivo JSON ... " + +#: Endpointman.class.php:3305 +msgid "Updating OUI list in DB ... " +msgstr "Actualizando la lista de OUI en la DB ... " + +#: Endpointman.class.php:3315 +#, php-format +msgid "Error: Invalid JSON Structure in %s/brand_data.json" +msgstr "Error: Estructura no valida JSON en %s/brand_data.json" + +#: Endpointman.class.php:3318 +msgid "Error: No 'brand_data.xml' file exists!" +msgstr "Error: No existe un archivo 'brand_data.xml'!" + +#: Endpointman.class.php:3321 +msgid "Removing Temporary Files... " +msgstr "Eliminando Archivos Temporales ... " + +#: Endpointman.class.php:3488 +msgid "You Must Select A Model From the Drop Down" +msgstr "Usted debe seleccionar un modelo de la gota de Down" + +#: Endpointman.class.php:3491 +msgid "You Must Select an Extension/Device From the Drop Down" +msgstr "Tu deves seleeciona una Extension/Disposito de listado de abajo" + +#: Endpointman.class.php:3551 +msgid "Invalid Model Selected, Can't Sync System" +msgstr "Seleccionada Modelo no válido, no puede Sistema de sincronización" + +#: Endpointman.class.php:3556 +msgid "Invalid MAC Address" +msgstr "Direccion MAC no valida" + +#: Endpointman.class.php:3589 Endpointman.class.php:3607 +msgid "No Devices/Extensions Left to Add" +msgstr "No hay dispositivos / Extensiones a la izquierdo para Añadir" + +#: Endpointman.class.php:3593 Endpointman.class.php:3611 +msgid "No Lines Left to Add" +msgstr "No hay líneas de a la izquierdo para Añadir" + +#: Endpointman.class.php:3760 +msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" +msgstr "El fichero subido excede la directiva upload_max_filesize de php.ini" + +#: Endpointman.class.php:3762 +msgid "" +"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " +"the HTML form" +msgstr "" +"El fichero subido excede la directiva MAX_FILE_SIZE especificada en el " +"formulario HTML" + +#: Endpointman.class.php:3764 +msgid "The uploaded file was only partially uploaded" +msgstr "El fichero fue sólo parcialmente subido" + +#: Endpointman.class.php:3766 +msgid "No file was uploaded" +msgstr "No se ha cargado el fichero" + +#: Endpointman.class.php:3768 +msgid "Missing a temporary folder" +msgstr "Falta la carpeta temporal" + +#: Endpointman.class.php:3770 +msgid "Failed to write file to disk" +msgstr "No se ha podido escribir el archivo en el disco" + +#: Endpointman.class.php:3772 +msgid "File upload stopped by extension" +msgstr "Una extensión de PHP detuvo la subida de ficheros" + +#: Endpointman.class.php:3774 +msgid "Unknown upload error" +msgstr "Error al subir Desconocido" + +#: Endpointman.class.php:3906 views/epm_devices_main.page.php:122 +msgid "Unknown" +msgstr "Desconocido" + +#: Endpointman.class.php:5339 +msgid "You can't remove the only line left" +msgstr "No se puede quitar la única línea de la izquierda" + +#: _functions.inc.php:234 +msgid "End Point Manager" +msgstr "Administracion End Point" + +#: _functions.inc.php:343 +msgid "Failed to install " +msgstr "Fallo de installacion" + +#: lib/epm_system.class.php:158 lib/epm_system.class.php:188 +#, php-format +msgid "Downloading %s ..." +msgstr "Descargando %s ..." + +#: lib/epm_system.class.php:160 lib/epm_system.class.php:170 +msgid "Complete" +msgstr "Completado" + +#: lib/epm_system.class.php:182 +msgid "Success" +msgstr "Correcto" + +#: page.epm_advanced.php:18 page.epm_config.php:18 page.epm_devices.php:18 +#: page.epm_templates.php:20 +msgid "End Point Configuraction Manager" +msgstr "Configurar Administracion End Point" + +#: page.epm_advanced.php:19 views/epm_devices_main.page.php:39 +msgid "Advanced Settings" +msgstr "Configuración Avanzada" + +#: page.epm_config.php:19 +msgid "Package Manager" +msgstr "Administracion de Paquetes" + +#: page.epm_devices.php:19 +msgid "Device List" +msgstr "" + +#: provisioning/p.php:33 provisioning/p.php:129 +msgid "Error 403 Forbidden" +msgstr "Error 403 - Prohibido" + +#: provisioning/p.php:34 provisioning/p.php:130 +msgid "Access denied!" +msgstr "¡Acceso denegado!" + +#: provisioning/p.php:98 +msgid "Error 500 Internal Server Error" +msgstr "Error 500 - Error Interno del Servidor" + +#: provisioning/p.php:99 +msgid "System Failure!" +msgstr "¡Fallo de sistema!" + +#: provisioning/p.php:107 provisioning/p.php:121 +msgid "Error 404 Not Found" +msgstr "Error 404, No encontrado" + +#: provisioning/p.php:108 provisioning/p.php:122 +msgid "File not Found!" +msgstr "¡Archivo no encontrado!" + +#: views/epm_advanced/oui_manager.views.grid.php:5 +msgid "Add Custom OUI" +msgstr "Añadir OUI Personalizado" + +#: views/epm_advanced/oui_manager.views.grid.php:6 +#: views/epm_templates/manager.views.grid.php:6 +msgid "Refresh Table" +msgstr "Actualizar Tabla" + +#: views/epm_advanced/oui_manager.views.grid.php:24 +#: views/epm_advanced/oui_manager.views.new.modal.php:14 +msgid "OUI" +msgstr "OUI" + +#: views/epm_advanced/oui_manager.views.grid.php:25 +#: views/epm_advanced/oui_manager.views.new.modal.php:36 +#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 +#: views/epm_devices_main.page.php:244 views/epm_devices_main.page.php:467 +#: views/epm_devices_main.page.php:518 +msgid "Brand" +msgstr "Marca" + +#: views/epm_advanced/oui_manager.views.grid.php:26 +msgid "Type" +msgstr "Tipo" + +#: views/epm_advanced/oui_manager.views.grid.php:27 +msgid "Actions" +msgstr "Accion" + +#: views/epm_advanced/oui_manager.views.new.modal.php:18 +msgid "OUI Brand" +msgstr "OUI Marca" + +#: views/epm_advanced/oui_manager.views.new.modal.php:26 +msgid "" +"They are the first 6 characters of the MAC device that identifies the brand " +"(manufacturer)." +msgstr "" + +#: views/epm_advanced/oui_manager.views.new.modal.php:41 +#: views/epm_advanced_manual_upload.page.php:101 +msgid "Select Brand:" +msgstr "Seleccionar Marca:" + +#: views/epm_advanced/oui_manager.views.new.modal.php:55 +msgid "It is the brand of OUI we specified." +msgstr "" + +#: views/epm_advanced/oui_manager.views.new.modal.php:61 +#: views/epm_templates/manager.views.new.modal.php:91 +msgid "Cancel" +msgstr "Cancelar" + +#: views/epm_advanced/oui_manager.views.new.modal.php:62 +msgid "Add New" +msgstr "Añadir Nuevo" + +#: views/epm_advanced/poce.views.bootnav.php:3 +msgid "In Developing!!" +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:7 +msgid "Local File Configs" +msgstr "Cargar Archivo de Configuracion" + +#: views/epm_advanced/poce.views.button.up.files.php:19 +msgid "Custom Template Files" +msgstr "Archivos de plantilla personalizada" + +#: views/epm_advanced/poce.views.button.up.files.php:31 +msgid "User File Configs" +msgstr "Usar Archivo de Configuracion" + +#: views/epm_advanced/poce.views.textarea.file.php:5 +#: views/epm_advanced/poce.views.textarea.file.php:24 +msgid "No Selected" +msgstr "No Seleccionado" + +#: views/epm_advanced/poce.views.textarea.file.php:23 +msgid "Full Screen F11" +msgstr "Pantalla Completa F11" + +#: views/epm_advanced/poce.views.textarea.file.php:26 +msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." +msgstr "" +"Nota: Presione F11 para modo pantalla completa, ESC para salir de Pantalla " +"Completa." + +#: views/epm_advanced/poce.views.textarea.file.php:32 +msgid "" +"NOTE: File may be over-written during next package update. We suggest also " +"using the Share button below to improve the next release." +msgstr "" + +#: views/epm_advanced/poce.views.textarea.file.php:35 +#: views/epm_devices_main.page.php:312 +#: views/epm_templates/manager.views.new.modal.php:92 +msgid "Save" +msgstr "Guardar" + +#: views/epm_advanced/poce.views.textarea.file.php:36 +#: views/epm_devices_main.page.php:473 views/epm_devices_main.page.php:491 +#: views/epm_devices_main.page.php:504 views/epm_devices_main.page.php:514 +msgid "Delete" +msgstr "Borrar" #: views/epm_advanced/poce.views.textarea.file.php:42 msgid "" @@ -830,673 +1241,778 @@ msgstr "" "Nota: El archivo se guarda permanentemente y no sobrescribir durante las " "siguientes actualizaciónes de paquetes." -#: views/epm_advanced/poce.views.textarea.file.php:32 +#: views/epm_advanced/poce.views.textarea.file.php:48 +msgid "Save As..." +msgstr "Gardar Como..." + +#: views/epm_advanced/poce.views.textarea.file.php:56 +msgid "" +"Upload this configuration file to the Provisioner.net Team. Files " +"shared are confidential and help improve the quality of releases." +msgstr "" + +#: views/epm_advanced/poce.views.textarea.file.php:59 +msgid "Share" +msgstr "Compartir" + +#: views/epm_advanced_iedl.page.php:6 +msgid "Export CSV" +msgstr "Exportación CSV" + +#: views/epm_advanced_iedl.page.php:16 +msgid "Export CSV file of devices" +msgstr "Archivo CSV exportación de dispositivos" + +#: views/epm_advanced_iedl.page.php:20 +#: views/epm_advanced_manual_upload.page.php:109 +msgid "Export" +msgstr "Exportar" + +#: views/epm_advanced_iedl.page.php:26 +msgid "Export data configuracion devices." +msgstr "Exportar datos de configuracion de dispositivo." + +#: views/epm_advanced_iedl.page.php:35 +msgid "Import CSV" +msgstr "Importar CSV" + +#: views/epm_advanced_iedl.page.php:48 +msgid "Import CSV file of devices" +msgstr "Importar archivo CSV de dispositivos" + +#: views/epm_advanced_iedl.page.php:52 views/epm_advanced_iedl.page.php:60 +#: views/epm_advanced_manual_upload.page.php:32 +#: views/epm_advanced_manual_upload.page.php:62 +msgid "Import" +msgstr "Importar" + +#: views/epm_advanced_iedl.page.php:67 +msgid "" +"Warning: The extensions need to be added into FreePBX before you import." +msgstr "" +"Advertencia: Las extensiones deben ser agregados en FreePBX antes de " +"importar." + +#: views/epm_advanced_iedl.page.php:78 +msgid "CSV File Format" +msgstr "Formato de archivo CSV" + +#: views/epm_advanced_iedl.page.php:87 +msgid "Structure" +msgstr "Estructura" + +#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:92 +#: views/epm_devices_main.page.php:243 views/epm_devices_main.page.php:466 +msgid "MAC Address" +msgstr "Direccion MAC" + +#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:94 +#: views/epm_devices_main.page.php:518 +msgid "Model" +msgstr "Modelo" + +#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:95 +msgid "Extension" +msgstr "Extension" + +#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:96 +#: views/epm_devices_main.page.php:246 views/epm_devices_main.page.php:469 +msgid "Line" +msgstr "Linea" + +#: views/epm_advanced_iedl.page.php:92 +msgid "is required" +msgstr "es requerido" + +#: views/epm_advanced_iedl.page.php:93 views/epm_advanced_iedl.page.php:94 +#: views/epm_advanced_iedl.page.php:95 views/epm_advanced_iedl.page.php:96 +msgid "can be blank" +msgstr "puede estar en blanco" + +#: views/epm_advanced_iedl.page.php:99 +msgid "Examples" +msgstr "Ejemplos" + +#: views/epm_advanced_manual_upload.page.php:10 +msgid "Import Packages" +msgstr "Importar Paquetes" + +#: views/epm_advanced_manual_upload.page.php:13 +msgid "Download updated releases from " +msgstr "Descarga actualizada liberado de" + +#: views/epm_advanced_manual_upload.page.php:24 +msgid "Provisioner Package" +msgstr "Provisioner Paquete" + +#: views/epm_advanced_manual_upload.page.php:41 +msgid "Import a package Provisioner in manual mode." +msgstr "Importación de un paquete de Provisioner en el modo manual." + +#: views/epm_advanced_manual_upload.page.php:54 +msgid "Brand Package" +msgstr "Paquete de marcas" + +#: views/epm_advanced_manual_upload.page.php:71 +msgid "Import a package brand in manual mode." +msgstr "Importación de un paquete de la marca en el modo manual." + +#: views/epm_advanced_manual_upload.page.php:79 +msgid "Export Brand Packages" +msgstr "Paquetes de exportación de la marcas" + +#: views/epm_advanced_manual_upload.page.php:82 +msgid "Learn how to create your own brand package at " +msgstr "Aprender a crear su propio paquete de la marca en " + +#: views/epm_advanced_manual_upload.page.php:90 +msgid "Brand's Available" +msgstr "Marcas disponibles" + +#: views/epm_advanced_manual_upload.page.php:97 +msgid "Heads up!" +msgstr "¡Aviso!" + +#: views/epm_advanced_manual_upload.page.php:97 +msgid "List Bran's Availables empty." +msgstr "Lista de Marcas disponibles vacia." + +#: views/epm_advanced_manual_upload.page.php:122 +msgid "Explor a package brand's availables." +msgstr "Exportar paquete de Marcas disponibles." + +#: views/epm_advanced_manual_upload.page.php:133 +msgid "List of other exports" +msgstr "Lista de otras exportaciones." + +#: views/epm_advanced_manual_upload.page.php:152 +msgid "List packages generated in other exports." +msgstr "Lista paquetes generados en otras exportaciones." + +#: views/epm_advanced_settings.page.php:38 +msgid "Setting Provision" +msgstr "Ajustes Provision" + +#: views/epm_advanced_settings.page.php:49 +msgid "IP address of phone server" +msgstr "Dirección IP del servidor telefónico (PBX)" + +#: views/epm_advanced_settings.page.php:56 +#: views/epm_advanced_settings.page.php:191 +msgid "Determine for Me" +msgstr "Determinar por mí" + +#: views/epm_advanced_settings.page.php:81 +msgid "Configuration Type" +msgstr "Tipo de Configuracion" + +#: views/epm_advanced_settings.page.php:86 +msgid "File (TFTP/FTP)" +msgstr "Archivos (TFTP/FTP)" + +#: views/epm_advanced_settings.page.php:87 +msgid "Web (HTTP)" +msgstr "Web (HTTP)" + +#: views/epm_advanced_settings.page.php:90 +msgid "Updated!" +msgstr "Actualizado!" + +#: views/epm_advanced_settings.page.php:90 +msgid " - Point your phones to: " +msgstr "" + +#: views/epm_advanced_settings.page.php:114 +msgid "Global Final Config & Firmware Directory" +msgstr "Directorio final de configuracion y firmware" + +#: views/epm_advanced_settings.page.php:134 +msgid "Time" +msgstr "Hora" + +#: views/epm_advanced_settings.page.php:152 +msgid "Time Zone" +msgstr "Zona Horaria" + +#: views/epm_advanced_settings.page.php:161 +msgid "TimeZone by PBX Setting" +msgstr "Zona Horaria de la PBX" + +#: views/epm_advanced_settings.page.php:184 +msgid "Time Server (NTP Server)" +msgstr "Servidor de Tiempo (NTP Server)" + +#: views/epm_advanced_settings.page.php:210 +msgid "Local Paths" +msgstr "Rutas Locales" + +#: views/epm_advanced_settings.page.php:220 +msgid "NMAP Executable Path" +msgstr "Ruta Ejecutable NMAP" + +#: views/epm_advanced_settings.page.php:244 +msgid "ARP Executable Path" +msgstr "Ruta Ejecutable ARP" + +#: views/epm_advanced_settings.page.php:268 +msgid "Asterisk Executable Path" +msgstr "Ruta Ejecutable Asterisk" + +#: views/epm_advanced_settings.page.php:288 +msgid "Web Directories" +msgstr "Directorios Web" + +#: views/epm_advanced_settings.page.php:298 +msgid "Package Server" +msgstr "Servidor de Paquetes" + +#: views/epm_advanced_settings.page.php:305 +msgid "Default Mirror FreePBX" +msgstr "Mirror por defecto de FreePBX" + +#: views/epm_advanced_settings.page.php:323 +msgid "Experimental" +msgstr "Experimental" + +#: views/epm_advanced_settings.page.php:334 +msgid "Enable FreePBX ARI Module" +msgstr "Activar FreePBX Modulo ARI " + +#: views/epm_advanced_settings.page.php:339 +#: views/epm_advanced_settings.page.php:375 +#: views/epm_advanced_settings.page.php:404 +#: views/epm_advanced_settings.page.php:433 +#: views/epm_advanced_settings.page.php:462 +#: views/epm_advanced_settings.page.php:491 +#: views/epm_advanced_settings.page.php:520 +#: views/epm_advanced_settings.page.php:549 +msgid "Yes" +msgstr "Yes" + +#: views/epm_advanced_settings.page.php:341 +#: views/epm_advanced_settings.page.php:377 +#: views/epm_advanced_settings.page.php:406 +#: views/epm_advanced_settings.page.php:435 +#: views/epm_advanced_settings.page.php:464 +#: views/epm_advanced_settings.page.php:493 +#: views/epm_advanced_settings.page.php:522 +#: views/epm_advanced_settings.page.php:551 +msgid "No" +msgstr "No" + +#: views/epm_advanced_settings.page.php:370 +msgid "Enable Debug Mode" +msgstr "Activar Debug Mode" + +#: views/epm_advanced_settings.page.php:399 +msgid "Disable Tooltips" +msgstr "Desactivar las sugerencias" + +#: views/epm_advanced_settings.page.php:428 +msgid "Allow Duplicate Extensions" +msgstr "Permitir extensiones duplicadas" + +#: views/epm_advanced_settings.page.php:457 +msgid "Allow Saving Over Default Configuration Files" +msgstr "" + +#: views/epm_advanced_settings.page.php:486 +msgid "Disable TFTP Server Check" +msgstr "Desactivar comprobación de servidor TFTP" + +#: views/epm_advanced_settings.page.php:515 +msgid "Disable Configuration File Backups" +msgstr "Desactivar las copias de seguridad del archivo de configuración" + +#: views/epm_advanced_settings.page.php:544 +msgid "Use GITHUB Live Repo" +msgstr "Utilice GitHub en directo Repo" + +#: views/epm_advanced_settings.page.php:606 +msgid "GIT Branch" +msgstr "GIT Rama" + +#: views/epm_config_editor.page.php:4 msgid "" -"NOTE: File may be over-written during next package update. We suggest also " -"using the Share button below to improve the next release." +"Select brands, products or models that do not need to hide from the list." msgstr "" +"Seleccione las Marcas, Productos y modelos que no necesite para ocultarlo en " +"la lista de Instalar/Desisntalar." -#: views/epm_advanced/poce.views.textarea.file.php:26 -msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." -msgstr "" -"Nota: Presione F11 para modo pantalla completa, ESC para salir de Pantalla " -"Completa." +#: views/epm_config_editor.page.php:7 +msgid "Brands/Modules" +msgstr "Marca/Modelo" -#: Endpointman.class.php:2027 -msgid "Name invalid: " -msgstr "" +#: views/epm_config_editor.page.php:11 views/epm_config_manager.page.php:23 +msgid "Loading data...." +msgstr "Cargando datos..." -#: Endpointman.class.php:901 -msgid "Name is null!" -msgstr "" +#: views/epm_config_manager.page.php:10 +msgid "Check for Update" +msgstr "Buscar actualizaciones" -#: Endpointman.class.php:276 -msgid "New Package Modified" -msgstr "Nuevo paquete Modificado" +#: views/epm_config_manager.page.php:19 +msgid "List Packages Manager" +msgstr "Administracion Lista de Paquetes" -#: views/epm_advanced_settings.page.php:341 -#: views/epm_advanced_settings.page.php:377 -#: views/epm_advanced_settings.page.php:406 -#: views/epm_advanced_settings.page.php:435 -#: views/epm_advanced_settings.page.php:464 -#: views/epm_advanced_settings.page.php:493 -#: views/epm_advanced_settings.page.php:522 -#: views/epm_advanced_settings.page.php:551 -msgid "No" -msgstr "No" +#: views/epm_devices_main.page.php:32 views/epm_devices_main.page.php:39 +#: views/epm_templates_editor.page.php:7 +#: views/epm_templates_manager.page.php:13 +#: views/epm_templates_manager.page.php:19 +msgid "Warning!" +msgstr "Advertencia!" -#: Endpointman.class.php:3300 -msgid "No 'brand_data.xml' file exists!" -msgstr "No existe un archivo 'brand_data.xml'!" +#: views/epm_devices_main.page.php:32 views/epm_templates_manager.page.php:13 +msgid "here" +msgstr "aquí" -#: Endpointman.class.php:1857 -msgid "No Brand set!" +#: views/epm_devices_main.page.php:32 views/epm_templates_manager.page.php:13 +msgid " to install some" msgstr "" -#: Endpointman.class.php:1971 -msgid "No Configuration Location Defined!" +#: views/epm_devices_main.page.php:39 +msgid " to setup your configuration" msgstr "" -#: Endpointman.class.php:3601 Endpointman.class.php:3619 -msgid "No Devices/Extensions Left to Add" -msgstr "No hay dispositivos / Extensiones a la izquierdo para Añadir" - -#: Endpointman.class.php:1560 -msgid "No File Provided!" +#: views/epm_devices_main.page.php:238 +msgid "Device" msgstr "" -#: Endpointman.class.php:1832 -msgid "No ID set!" -msgstr "No se ha enviado ID!" - -#: Endpointman.class.php:3605 Endpointman.class.php:3623 -msgid "No Lines Left to Add" -msgstr "No hay líneas de a la izquierdo para Añadir" +#: views/epm_devices_main.page.php:245 views/epm_devices_main.page.php:468 +msgid "Model of Phone" +msgstr "" -#: Endpointman.class.php:1854 -msgid "No OUI set!" +#: views/epm_devices_main.page.php:247 views/epm_devices_main.page.php:470 +msgid "Extension Number" msgstr "" -#: views/epm_advanced/poce.views.textarea.file.php:5 -#: views/epm_advanced/poce.views.textarea.file.php:24 -msgid "No Selected" -msgstr "No Seleccionado" +#: views/epm_devices_main.page.php:248 views/epm_devices_main.page.php:471 +msgid "Template" +msgstr "" -#: Endpointman.class.php:3778 -msgid "No file was uploaded" -msgstr "No se ha cargado el fichero" +#: views/epm_devices_main.page.php:314 +msgid "Add" +msgstr "Añadir" -#: Endpointman.class.php:1671 -msgid "No package set!" +#: views/epm_devices_main.page.php:319 +msgid "Reset" msgstr "" -#: Endpointman.class.php:913 -msgid "No send Clone Model!" +#: views/epm_devices_main.page.php:390 +msgid "Unmanaged Extensions" msgstr "" -#: Endpointman.class.php:1135 -msgid "No send File ID!" +#: views/epm_devices_main.page.php:437 +msgid "Add Selected Phones" msgstr "" -#: Endpointman.class.php:1138 -msgid "No send File Name!" +#: views/epm_devices_main.page.php:456 +msgid "Current Managed Extensions" msgstr "" -#: Endpointman.class.php:873 Endpointman.class.php:942 -msgid "No send ID!" +#: views/epm_devices_main.page.php:472 views/epm_devices_main.page.php:490 +#: views/epm_templates_editor.page.php:130 +msgid "Edit" msgstr "" -#: Endpointman.class.php:1314 -msgid "No send Name File!" +#: views/epm_devices_main.page.php:513 +msgid "Selected Phone(s) Options" msgstr "" -#: Endpointman.class.php:898 -msgid "No send Name!" +#: views/epm_devices_main.page.php:515 views/epm_devices_main.page.php:544 +msgid "Rebuild" msgstr "" -#: Endpointman.class.php:1317 -msgid "No send Origianl Name File!" +#: views/epm_devices_main.page.php:515 +msgid "Rebuild Configs for Selected Phones" msgstr "" -#: Endpointman.class.php:1035 Endpointman.class.php:1126 -#: Endpointman.class.php:1251 Endpointman.class.php:1299 -#: Endpointman.class.php:1393 -msgid "No send Product Select!" +#: views/epm_devices_main.page.php:517 +msgid "Change Selected Phones to" msgstr "" -#: Endpointman.class.php:904 -msgid "No send Product!" +#: views/epm_devices_main.page.php:531 +msgid "Global Phone Options" msgstr "" -#: Endpointman.class.php:1399 -msgid "No send SQL Select!" +#: views/epm_devices_main.page.php:535 +msgid "Search" msgstr "" -#: Endpointman.class.php:1311 -msgid "No send Save Name!" +#: views/epm_devices_main.page.php:536 +msgid "Search for new devices in netmask" msgstr "" -#: Endpointman.class.php:1257 Endpointman.class.php:1302 -msgid "No send SendID!" +#: views/epm_devices_main.page.php:538 +msgid "Use NMAP" msgstr "" -#: Endpointman.class.php:1308 -msgid "No send Text File!" +#: views/epm_devices_main.page.php:544 +msgid "Rebuild Configs for All Phones" msgstr "" -#: Endpointman.class.php:1141 Endpointman.class.php:1254 -#: Endpointman.class.php:1305 Endpointman.class.php:1396 -msgid "No send Type File!" +#: views/epm_devices_main.page.php:548 +msgid "Reboot" msgstr "" -#: Endpointman.class.php:2138 Endpointman.class.php:2273 -msgid "No send id!" -msgstr "No se ha enviado ID!" - -#: Endpointman.class.php:2141 Endpointman.class.php:2276 -msgid "No send idtype!" -msgstr "No se ha enviado IDType!" - -#: Endpointman.class.php:1899 Endpointman.class.php:2132 -#: Endpointman.class.php:2263 -msgid "No send name!" -msgstr "No se ha enviado NOMBRE!" - -#: Endpointman.class.php:1902 Endpointman.class.php:2135 -#: Endpointman.class.php:2266 -msgid "No send value!" -msgstr "No se ha enviado VALOR!" - -#: Endpointman.class.php:1968 -msgid "Not a Vaild Directory.
      Try to run 'mkdir " +#: views/epm_devices_main.page.php:548 +msgid "Reboot This Brand" msgstr "" -#: Endpointman.class.php:2510 -msgid "Not able to connect to repository. Using local Provisioner.net Package." +#: views/epm_devices_main.page.php:552 views/epm_devices_main.page.php:559 +msgid "Configure" msgstr "" -#: Endpointman.class.php:2540 -msgid "" -"Not able to connect to repository. Using local brand [%_brandname_%] file " -"instead." +#: views/epm_devices_main.page.php:553 views/epm_devices_main.page.php:560 +msgid "Reconfigure all" msgstr "" -#: Endpointman.class.php:2495 -msgid "Not able to connect to repository. Using local master file instead." +#: views/epm_devices_main.page.php:553 views/epm_devices_main.page.php:560 +msgid "with" msgstr "" -#: Endpointman.class.php:2976 -msgid "Not allowed in repo mode!!" -msgstr "No permite en modo de repo!" - -#: Endpointman.class.php:1487 -msgid "Not is directory: " +#: views/epm_devices_main.page.php:585 +msgid "The Endpoint Configuration Manager was originally written by" msgstr "" -#: endpointman.i18n.php:18 -msgid "OSS Endpoint Advanced Settings" +#: views/epm_devices_main.page.php:587 +msgid "The project is maintained at" msgstr "" -#: endpointman.i18n.php:10 -msgid "OSS Endpoint Device List" +#: views/epm_devices_main.page.php:895 views/epm_devices_main.page.php:960 +msgid "No Device Selected to Edit!" msgstr "" -#: endpointman.i18n.php:16 -msgid "OSS Endpoint Package Manager" +#: views/epm_devices_main.page.php:928 views/epm_devices_main.page.php:1169 +msgid "Saved" msgstr "" -#: endpointman.i18n.php:14 -msgid "OSS Endpoint Template Manager" +#: views/epm_devices_main.page.php:981 views/epm_devices_main.page.php:1014 +msgid "No Phones Selected" msgstr "" -#: endpointman.i18n.php:4 -msgid "OSS PBX End Point Manager" +#: views/epm_devices_main.page.php:1090 +msgid "No Phones to Reboot" msgstr "" -#: endpointman.i18n.php:8 -msgid "" -"OSS PBX End Point Manager is the free supported PBX Endpoint Manager for " -"FreePBX.\t\tIt is ***NOT*** supported by Schmoozecom. If you are looking for " -"a supported endpoint manager please look into the Commercial Endpoint " -"Manager by Schmoozecom, INC.\t\tThe front end gui is hosted at: https://" -"github.com/FreePBX/endpointman\t\tThe backend configurator is hosted at: " -"https://github.com/provisioner/Provisioner\t\tPull Requests can be made to " -"either of these and are encouraged." +#: views/epm_devices_main.page.php:1093 +msgid "No Brand Selected for Reboot" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:24 -#: views/epm_advanced/oui_manager.views.new.modal.php:14 -msgid "OUI" -msgstr "OUI" - -#: views/epm_advanced/oui_manager.views.new.modal.php:18 -msgid "OUI Brand" +#: views/epm_devices_main.page.php:1126 +msgid "No Devices Found" msgstr "" -#: Endpointman.class.php:630 -msgid "OUI Manager" -msgstr "Administrador OUI" - -#: Endpointman.class.php:3192 Endpointman.class.php:3217 -msgid "Old Data Detected! Migrating......" -msgstr "Antiguos datos detectados! Migrando......" - -#: Endpointman.class.php:141 -msgid "Or run this command on SSH:" -msgstr "O ejecute este comando en SSH:" - -#: Endpointman.class.php:642 -msgid "Package Import/Export" -msgstr "Paquete de importación/exportación" - -#: Endpointman.class.php:277 -msgid "Package Last Modified" -msgstr "Paquete última actualización" - -#: page.epm_config.php:19 -msgid "Package Manager" -msgstr "Administracion de Paquetes" - -#: views/epm_advanced_settings.page.php:298 -msgid "Package Server" -msgstr "Servidor de Paquetes" - -#: Endpointman.class.php:1674 -msgid "Package not valid!" +#: views/epm_devices_main.page.php:1172 +msgid "Please select a Brand and/or Model" msgstr "" -#: Endpointman.class.php:2884 Endpointman.class.php:2992 -msgid "Please Check Directory/Permissions!" -msgstr "Compruebe los permisos del directorio!" - -#: Endpointman.class.php:140 -msgid "Please change the location:" -msgstr "Por favor, cambia la ubicación:" - -#: Endpointman.class.php:1555 -msgid "Please name the Package the same name as your brand!" +#: views/epm_devices_main.page.php:1175 +msgid "No Phones Selected!" msgstr "" -#: Endpointman.class.php:1808 -msgid "Please reboot & rebuild all imported phones" +#: views/epm_devices_main.page.php:1183 +msgid "Please select a product" msgstr "" -#: Endpointman.class.php:1810 -msgid "Possible file upload attack!" +#: views/epm_devices_main.page.php:1185 views/epm_devices_main.page.php:1215 +msgid "Please select a template" msgstr "" -#: Endpointman.class.php:3053 -msgid "Processing %_PATH_%/brand_data.json..." -msgstr "Procesando %_PATH_%/brand_data.json..." - -#: Endpointman.class.php:634 -msgid "Product Configuration Editor" -msgstr "Editor de configuración de producto" - -#: Endpointman.class.php:1038 Endpointman.class.php:1129 -msgid "Product Select send is not number!" +#: views/epm_devices_main.page.php:1213 +msgid "Please select a model" msgstr "" -#: Endpointman.class.php:1041 Endpointman.class.php:1132 -msgid "Product Select send is number not valid!" +#: views/epm_templates/manager.views.grid.php:5 +#: views/epm_templates/manager.views.new.modal.php:5 +msgid "Add New Template" msgstr "" -#: Endpointman.class.php:907 -msgid "Product is not number!" +#: views/epm_templates/manager.views.grid.php:25 +#: views/epm_templates/manager.views.new.modal.php:15 +#: views/epm_templates/rnav.php:17 +msgid "Template Name" msgstr "" -#: Endpointman.class.php:910 -msgid "Product send is negative!" +#: views/epm_templates/manager.views.grid.php:26 +#: views/epm_templates/rnav.php:18 +msgid "Model Classification" msgstr "" -#: views/epm_advanced_manual_upload.page.php:24 -msgid "Provisioner Package" -msgstr "Provisioner Paquete" - -#: Endpointman.class.php:288 Endpointman.class.php:305 -#: Endpointman.class.php:309 -msgid "Ready!" -msgstr "Listo!" - -#: views/epm_advanced/oui_manager.views.grid.php:6 -msgid "Refresh Table" -msgstr "Actualizar Tabla" - -#: Endpointman.class.php:284 -msgid "Remove Firmware" -msgstr "Eliminar Firmware" - -#: Endpointman.class.php:676 -msgid "Removing Phone Modules Directory" +#: views/epm_templates/manager.views.grid.php:27 +#: views/epm_templates/rnav.php:19 +msgid "Model Clone" msgstr "" -#: Endpointman.class.php:3303 -msgid "Removing Temporary Files.............." -msgstr "Eliminando Archivos Temporales.............." - -#: Endpointman.class.php:680 -msgid "Removing symlink to web provisioner" +#: views/epm_templates/manager.views.grid.php:28 +msgid "Enabled" msgstr "" -#: views/epm_advanced/poce.views.textarea.file.php:35 -msgid "Save" -msgstr "Guardar" - -#: views/epm_advanced/poce.views.textarea.file.php:48 -msgid "Save As..." -msgstr "Gardar Como..." - -#: Endpointman.class.php:291 Endpointman.class.php:307 -#: Endpointman.class.php:359 -msgid "Saving Changes..." -msgstr "Guardando cambios…" - -#: Endpointman.class.php:292 Endpointman.class.php:308 -#: Endpointman.class.php:360 -msgid "Saving Changes... Ok!" -msgstr "Guardando cambios… Listo!" - -#: views/epm_advanced/oui_manager.views.new.modal.php:41 -#: views/epm_advanced_manual_upload.page.php:101 -msgid "Select Brand:" -msgstr "Seleccionar Marca:" - -#: views/epm_config_editor.page.php:4 -msgid "" -"Select brands, products or models that do not need to hide from the list." +#: views/epm_templates/manager.views.grid.php:29 +msgid "Action" msgstr "" -"Seleccione las Marcas, Productos y modelos que no necesite para ocultarlo en " -"la lista de Instalar/Desisntalar." - -#: views/epm_advanced_settings.page.php:38 -msgid "Setting Provision" -msgstr "Ajustes Provision" - -#: Endpointman.class.php:626 -msgid "Settings" -msgstr "Configuración" - -#: views/epm_advanced/poce.views.textarea.file.php:59 -msgid "Share" -msgstr "Compartir" -#: Endpointman.class.php:303 -msgid "Show" -msgstr "Mostrar" +#: views/epm_templates/manager.views.new.modal.php:19 +msgid "New Name Template...." +msgstr "" -#: Endpointman.class.php:616 -msgid "Show/Hide" -msgstr "Mostrar/Ocultar" +#: views/epm_templates/manager.views.new.modal.php:27 +#: views/epm_templates/manager.views.new.modal.php:61 +#: views/epm_templates/manager.views.new.modal.php:84 +msgid "Texto Ayuda." +msgstr "" -#: Endpointman.class.php:2824 -msgid "Skipping download..." -msgstr "Omitir descarga..." +#: views/epm_templates/manager.views.new.modal.php:38 +msgid "Product Select" +msgstr "" -#: views/epm_advanced_iedl.page.php:87 -msgid "Structure" -msgstr "Estructura" +#: views/epm_templates/manager.views.new.modal.php:43 +msgid "Select Product:" +msgstr "" -#: Endpointman.class.php:2463 -msgid "Syntax error, malformed JSON" -msgstr "Error de sintaxis, JSON malformada" +#: views/epm_templates/manager.views.new.modal.php:72 +msgid "Clone Template From" +msgstr "" -#: Endpointman.class.php:3253 -msgid "System Error in Sync Model Function, Load Failure!" +#: views/epm_templates/rnav.php:5 +msgid "List Tempalte Custom" msgstr "" -"Error del sistema en función de sincronización de modelos, Error de carga!" -#: Endpointman.class.php:2683 -msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" +#: views/epm_templates_editor.page.php:32 +msgid "Template Name:" msgstr "" -#: provisioning/p.php:99 -msgid "System Failure!" -msgstr "¡Fallo de sistema!" +#: views/epm_templates_editor.page.php:42 +msgid "Product Line:" +msgstr "" -#: Endpointman.class.php:351 Endpointman.class.php:458 -msgid "Tab is not valid!" -msgstr "Tab no es valida!" +#: views/epm_templates_editor.page.php:51 +#: views/epm_templates_editor.page.php:55 +msgid "Clone of Model:" +msgstr "" -#: Endpointman.class.php:602 -msgid "Template Editor" +#: views/epm_templates_editor.page.php:76 +msgid "Display:" msgstr "" -#: Endpointman.class.php:275 -msgid "" -"The \"Install\" button installs the configuration package brand models we " -"selected.
      The \"Uninstall\" button removes the package configuration " -"models of the brand selected.
      The \"Update\" button appears if a new " -"version of the package that is already installed to upgrade to the latest " -"version is detected." +#: views/epm_templates_editor.page.php:93 +msgid "Line settings on this page" msgstr "" -"El boton \"Instalar\" instala el paquete de configuracion de los modelos de " -"la marca que seleccionamos.
      El boton \"Desinstalar\" elimina el " -"paquete de configuracion de los modelos de la marca que seleccionamos.
      " -"El boton \"Actualizacion\" aparece si se detecta una nueva version del " -"paquete que esta ya instalado para actualizar a la ultima version." -#: Endpointman.class.php:2607 -msgid "" -"The Remote Server Is Currently Syncing With the Master Server, Please try " -"again later" +#: views/epm_templates_editor.page.php:110 +msgid "Edit Global Settings Overrides:" msgstr "" -#: Endpointman.class.php:274 -msgid "" -"The button \"Install Firmware\" installs the necessary files to the server " -"for the terminal alone are updated via TFTP or HTTP.
      The button " -"\"Remove frimware\" delete files server products.
      The button \"Update " -"frimware\" appears if a newer frimware detected on the server and asks if " -"you want to update.
      The \"Update\" button appears when a new version " -"of this model pack is detected." +#: views/epm_templates_editor.page.php:116 +msgid "Global Settings" msgstr "" -"El boton \"Instalar Firmware\" instala los archivos necesarios en el " -"servidor para que lo terminales se actualicen solos a traves de HTTP o TFTP." -"
      El boton \"Remover Frimware\" elimina los archivos de los productos " -"del servidor.
      El boton \"Actualizar Frimware\" aparece si se detectado " -"un frimware mas nuevo en el servidor y nos pregunta si deseas actualizar." -"
      El boton \"Actualizar\" aparece cuando se detecta una nueva version " -"de Paquete de este modelo." -#: Endpointman.class.php:3774 -msgid "" -"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " -"the HTML form" +#: views/epm_templates_editor.page.php:128 +#: views/epm_templates_editor.page.php:155 +msgid "Edit File Configurations for:" msgstr "" -#: Endpointman.class.php:3772 -msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" +#: views/epm_templates_editor.page.php:135 +msgid "Select Alternative File Configurations for " msgstr "" -#: Endpointman.class.php:3776 -msgid "The uploaded file was only partially uploaded" +#: views/epm_templates_editor.page.php:174 +msgid "Example of Variables allowed in boxes" msgstr "" -#: Endpointman.class.php:3038 -msgid "Then Use Manual Upload in Advanced Settings." -msgstr "Utilizar carga Manual en configuración avanzada." +#: views/epm_templates_editor.page.php:178 +msgid "Device's Username (usually the extension)" +msgstr "" -#: views/epm_advanced/oui_manager.views.new.modal.php:26 -msgid "" -"They are the first 6 characters of the MAC device that identifies the brand " -"(manufacturer)." +#: views/epm_templates_editor.page.php:179 +msgid "Device's Description in FreePBX (Usually the Full Name)" msgstr "" -#: views/epm_advanced_settings.page.php:134 -msgid "Time" -msgstr "Hora" +#: views/epm_templates_editor.page.php:180 +msgid "Server IP For Line 1" +msgstr "" -#: views/epm_advanced_settings.page.php:184 -msgid "Time Server (NTP Server)" -msgstr "Servidor de Tiempo (NTP Server)" +#: views/epm_templates_editor.page.php:181 +msgid "Server Port For Line 1" +msgstr "" -#: views/epm_advanced_settings.page.php:152 -msgid "Time Zone" -msgstr "Zona Horaria" +#: views/epm_templates_editor.page.php:182 +msgid "Device's Mac Address" +msgstr "" -#: views/epm_advanced_settings.page.php:161 -msgid "TimeZone by PBX Setting" -msgstr "Zona Horaria de la PBX" +#: views/epm_templates_editor.page.php:183 +msgid "Device's Model" +msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:26 -msgid "Type" -msgstr "Tipo" +#: views/epm_templates_editor.page.php:276 +msgid "Save Template" +msgstr "" -#: Endpointman.class.php:1412 -msgid "Type File not valid!" +#: views/epm_templates_manager.page.php:19 +msgid "Brand Configurations/Setup" msgstr "" -#: Endpointman.class.php:2457 -msgid "Underflow or the modes mismatch" +#: views/epm_templates_manager.page.php:19 +msgid " to setup and install phone configurations" msgstr "" -#: Endpointman.class.php:2460 -msgid "Unexpected control character found" -msgstr "Carácter de control inesperado encontró" +#~ msgid "MD5 Did not match!
      " +#~ msgstr "- MD5 no coincide!" -#: Endpointman.class.php:281 -msgid "Uninstall" -msgstr "Desisntalar" +#~ msgid "Error!
      " +#~ msgstr "Error!
      " -#: Endpointman.class.php:2927 -msgid "Uninstalla Brand..." -msgstr "Desisntalando Marca..." +#~ msgid "Then Use Manual Upload in Advanced Settings.
      " +#~ msgstr "Utilizar carga Manual en configuración avanzada.
      " -#: Endpointman.class.php:2904 -msgid "Uninstalla frimware..." -msgstr "Desisntalando Frimware..." +#~ msgid "Error: Error: Command not found!" +#~ msgstr "Error: Comando no valido!" -#: Endpointman.class.php:3918 -msgid "Unknown" -msgstr "Desconocido" +#~ msgid "Loading.." +#~ msgstr "Cargando..." -#: Endpointman.class.php:2469 -msgid "Unknown error" -msgstr "Error desconocido." +#~ msgid "Skipping download..." +#~ msgstr "Omitir descarga..." -#: Endpointman.class.php:3786 -msgid "Unknown upload error" -msgstr "Error al subir Desconocido" +#~ msgid "Checking MD5sum of Package..." +#~ msgstr "Comprobando MD5sum en Paquete..." -#: Endpointman.class.php:282 -msgid "Update" -msgstr "Actualizar" +#~ msgid "- Failed To Copy %_FILE_%!" +#~ msgstr "- Error al copiar %_FILE_%!" -#: Endpointman.class.php:296 -msgid "Update Content..." -msgstr "Actualizar contenido...." +#~ msgid "- Copied %_FILE_% to %_FILETO_%." +#~ msgstr "- Copiado %_FILE_% a %_FILETO_%." -#: Endpointman.class.php:285 -msgid "Update Firmware" -msgstr "Actualizar Firmware" +#~ msgid "Please Check Directory/Permissions!" +#~ msgstr "Compruebe los permisos del directorio!" -#: Endpointman.class.php:290 -msgid "Update!" -msgstr "Actualizado!" +#~ msgid "Your Firmware is already up to date" +#~ msgstr "Tu Frimware ya esta actualizado" -#: views/epm_advanced_settings.page.php:90 -msgid "Updated!" -msgstr "Actualizado!" +#~ msgid "Uninstalla frimware..." +#~ msgstr "Desisntalando Frimware..." -#: Endpointman.class.php:3102 -msgid "Updating %_BRANDNAME_% brand data.........." -msgstr "Actualizando datos de la marca % _BRANDNAME_%.........." +#~ msgid "Not allowed in repo mode!!" +#~ msgstr "No permite en modo de repo!" -#: Endpointman.class.php:3113 -msgid "Updating Family Lines................." -msgstr "Actualizando líneas de familia ................." +#~ msgid "Error creating directory: %_DIR_%" +#~ msgstr "Error al crear el directorio: %_DIR_%" -#: Endpointman.class.php:1616 -msgid "Updating Last Modified..." -msgstr "" +#~ msgid "Downloading Brand JSON....." +#~ msgstr "Descargando JSON Marca...." -#: Endpointman.class.php:3285 -msgid "Updating OUI list in DB" -msgstr "Actualizando la lista de OUI en la DB" +#~ msgid "Checking MD5sum of Package...." +#~ msgstr "Comprobando MD5sum de paquete..." -#: Endpointman.class.php:293 Endpointman.class.php:310 -msgid "Upload Content!" -msgstr "Actualizar contenido...." +#~ msgid "Can't Find Downloaded File!" +#~ msgstr "No puede encontrar el archivo descargado." -#: views/epm_advanced/poce.views.textarea.file.php:56 -msgid "" -"Upload this configuration file to the Provisioner.net Team. Files " -"shared are confidential and help improve the quality of releases." -msgstr "" +#~ msgid "" +#~ "You Can Also Manually Update The Repository By Downloading Files here: " +#~ "%_URL_INI_% Release Repo %_URL_END_%" +#~ msgstr "" +#~ "También puede actualizar manualmente el repositorio mediante la descarga " +#~ "de archivos aquí: %_URL_INI_% de lanzamiento Repo %_URL_END_%" -#: views/epm_advanced_settings.page.php:544 -msgid "Use GITHUB Live Repo" -msgstr "Utilice GitHub en directo Repo" +#~ msgid "Installing brands is disabled while in repo mode!" +#~ msgstr "Instalación de marcas se desactiva en el modo de Repo!" -#: views/epm_advanced/poce.views.button.up.files.php:31 -msgid "User File Configs" -msgstr "Usar Archivo de Configuracion" +#~ msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" +#~ msgstr "update_brand (): depuración se establece en %_DEBUG_MODE_%" -#: views/epm_advanced_iedl.page.php:67 -msgid "" -"Warning: The extensions need to be added into FreePBX before you import." -msgstr "" -"Advertencia: Las extensiones deben ser agregados en FreePBX antes de " -"importar." +#~ msgid "" +#~ "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." +#~ msgstr "" +#~ "Creando estructura de directorios para la Marca '% _NAME_%' y moviendo " +#~ "archivos..." -#: Endpointman.class.php:1749 -msgid "We support only CVS and TXT files, type file %_FILE_% no support!" -msgstr "" +#~ msgid "- Error Moving %_FILENAME_%!" +#~ msgstr "- Error Moviendo %_FILENAME_%!" -#: views/epm_advanced_settings.page.php:87 -msgid "Web (HTTP)" -msgstr "Web (HTTP)" +#~ msgid "Updating %_BRANDNAME_% brand data.........." +#~ msgstr "Actualizando datos de la marca % _BRANDNAME_%.........." -#: views/epm_advanced_settings.page.php:288 -msgid "Web Directories" -msgstr "Directorios Web" +#~ msgid "Inserting %_BRANDNAME_% brand data.........." +#~ msgstr "Insertando datos de la marca % _BRANDNAME_%.........." -#: views/epm_advanced_settings.page.php:339 -#: views/epm_advanced_settings.page.php:375 -#: views/epm_advanced_settings.page.php:404 -#: views/epm_advanced_settings.page.php:433 -#: views/epm_advanced_settings.page.php:462 -#: views/epm_advanced_settings.page.php:491 -#: views/epm_advanced_settings.page.php:520 -#: views/epm_advanced_settings.page.php:549 -msgid "Yes" -msgstr "Yes" +#~ msgid "Updating Family Lines................." +#~ msgstr "Actualizando líneas de familia ................." -#: Endpointman.class.php:3037 -msgid "" -"You Can Also Manually Update The Repository By Downloading Files here: %" -"_URL_INI_% Release Repo %_URL_END_%" -msgstr "" -"También puede actualizar manualmente el repositorio mediante la descarga de " -"archivos aquí: %_URL_INI_% de lanzamiento Repo %_URL_END_%" +#~ msgid "-- Updating Model Lines................" +#~ msgstr "-- Actualizando Lineas de Modelos................" -#: Endpointman.class.php:3500 -msgid "You Must Select A Model From the Drop Down" -msgstr "Usted debe seleccionar un modelo de la gota de Down" +#~ msgid "----Old Data Detected! Migrating......" +#~ msgstr "----Antiguos datos detectados! Migrando......" -#: Endpointman.class.php:3503 -msgid "You Must Select an Extension/Device From the Drop Down" -msgstr "Tu deves seleeciona una Extension/Disposito de listado de abajo" +#~ msgid "Old Data Detected! Migrating......" +#~ msgstr "Antiguos datos detectados! Migrando......" -#: Endpointman.class.php:4946 -msgid "You can't remove the only line left" -msgstr "No se puede quitar la única línea de la izquierda" +#~ msgid "System Error in Sync Model Function, Load Failure!" +#~ msgstr "" +#~ "Error del sistema en función de sincronización de modelos, Error de carga!" -#: Endpointman.class.php:2895 -msgid "Your Firmware is already up to date" -msgstr "Tu Frimware ya esta actualizado" +#~ msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" +#~ msgstr "" +#~ "Mover/Eliminar Modelo '% _NAMEMOD_%' que no está presente en el archivo " +#~ "JSON......" -#: Endpointman.class.php:2011 -msgid "Your permissions are wrong on " -msgstr "" +#~ msgid "Updating OUI list in DB" +#~ msgstr "Actualizando la lista de OUI en la DB" -#: views/epm_advanced_iedl.page.php:93 views/epm_advanced_iedl.page.php:94 -#: views/epm_advanced_iedl.page.php:95 views/epm_advanced_iedl.page.php:96 -msgid "can be blank" -msgstr "puede estar en blanco" +#~ msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" +#~ msgstr "Inválida estructura JSON en %_PATCH _%/brand_data.json" -#: views/epm_advanced_iedl.page.php:92 -msgid "is required" -msgstr "es requerido" +#~ msgid "No 'brand_data.xml' file exists!" +#~ msgstr "No existe un archivo 'brand_data.xml'!" + +#~ msgid "Removing Temporary Files.............." +#~ msgstr "Eliminando Archivos Temporales.............." -#: Endpointman.class.php:3050 -msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" -msgstr "update_brand (): depuración se establece en %_DEBUG_MODE_%" +#~ msgid "New OUI" +#~ msgstr "Nuevo OUI" #~ msgid "Empty list." #~ msgstr "Lista Vacia." -#~ msgid "New OUI" -#~ msgstr "Nuevo OUI" +#~ msgid "List Bran's Availables emtry." +#~ msgstr "Lista de Marcas disponibles vacia." -#~ msgid "' then 'chmod g+w " -#~ msgstr "' luego 'chmod g+w " +#~ msgid "Add Custom" +#~ msgstr "Añadir Personalizada" + +#~ msgid "File Configuration Editor" +#~ msgstr "Editar Archivo de Configuracion" + +#~ msgid "Select" +#~ msgstr "Seleccionado" + +#~ msgid "Save As" +#~ msgstr "Gardar como" + +#~ msgid "Web (HTTPS)" +#~ msgstr "Web (HTTPS)" + +#~ msgid "executable path" +#~ msgstr "ubicacion ejecutable" #~ msgid "- Firmware MD5 didn't match!" #~ msgstr "- MD5 de Frimware no coincide!" -#~ msgid "
      Or run this command on SSH: 'chown -hR root:" -#~ msgstr "
      O ejecutar este comando en SSH: 'chown -hR root:" +#~ msgid "" +#~ "List of brands, products and models, ready to install their packages " +#~ "configuration." +#~ msgstr "" +#~ "Lista de Marcas, Productos y Modelos, listos para instalar sus paquetes " +#~ "de configuración." + +#~ msgid "" +#~ "If we can activate the model set terminals of the models. If this model " +#~ "is disabled will not appear in the list of models that can be configured " +#~ "for PBX." +#~ msgstr "" +#~ "Si activamos el modelo podremos configurar terminales de dicho modelos." +#~ "
      Si esta desactivado este modelo no aparecera en la lista de " +#~ "modelos que se pueden configurar para la PBX." #~ msgid "" #~ "
      Please change the location:
      Aquí" -#~ msgid "Add" -#~ msgstr "Añadir" - -#~ msgid "Add Custom" -#~ msgstr "Añadir Personalizada" - -#~ msgid "CHECK FOR UPDATES..." -#~ msgstr "Buscar actualizaciones..." +#~ msgid "
      Or run this command on SSH: 'chown -hR root:" +#~ msgstr "
      O ejecutar este comando en SSH: 'chown -hR root:" -#~ msgid "CHECK FOR UPDATES... OK!" -#~ msgstr "Buscar actualizaciones... LISTO!" +#~ msgid "' then 'chmod g+w " +#~ msgstr "' luego 'chmod g+w " #~ msgid "" #~ "Configuration Directory is not a directory or does not exist! Please " @@ -1526,14 +2036,26 @@ msgstr "update_brand (): depuración se establece en %_DEBUG_MODE_%" #~ "cambia la ubicación aquí: Aquí" +#~ msgid "SAVING CHANGES..." +#~ msgstr "GUARDANDO CAMBIOS..." + +#~ msgid "SAVING CHANGES... OK!" +#~ msgstr "GUARDANDO CAMBIOS... LISTO!" + #~ msgid "ERROR!" #~ msgstr "ERROR!" -#~ msgid "Error: ID not is number!" -#~ msgstr "Error: ID no es numero!" +#~ msgid "CHECK FOR UPDATES..." +#~ msgstr "Buscar actualizaciones..." + +#~ msgid "CHECK FOR UPDATES... OK!" +#~ msgstr "Buscar actualizaciones... LISTO!" + +#~ msgid "UPDATE CONTENT..." +#~ msgstr "Actualizar contenido...." -#~ msgid "Error: Not send ID!" -#~ msgstr "Error: No se ha enviado ID!" +#~ msgid "INVALID OPTION!" +#~ msgstr "OPCION NO VALIDA!" #~ msgid "Error: Not send command_sub!" #~ msgstr "Error: No se ha enviado COMMAND_SUB!" @@ -1541,72 +2063,26 @@ msgstr "update_brand (): depuración se establece en %_DEBUG_MODE_%" #~ msgid "Exception:" #~ msgstr "Excepcion:" -#~ msgid "File Configuration Editor" -#~ msgstr "Editar Archivo de Configuracion" - -#~ msgid "Function:" -#~ msgstr "Funcion:" +#~ msgid "Invalid name!" +#~ msgstr "Nombre no validao!" #~ msgid "ID sent is not a number!" #~ msgstr "El ID que se ha envido no es un numero!" -#~ msgid "INVALID OPTION!" -#~ msgstr "OPCION NO VALIDA!" - -#~ msgid "" -#~ "If we can activate the model set terminals of the models. If this model " -#~ "is disabled will not appear in the list of models that can be configured " -#~ "for PBX." -#~ msgstr "" -#~ "Si activamos el modelo podremos configurar terminales de dicho modelos." -#~ "
      Si esta desactivado este modelo no aparecera en la lista de " -#~ "modelos que se pueden configurar para la PBX." +#~ msgid "Type invalid: " +#~ msgstr "Tipo no valido!" #~ msgid "Invalid level!" #~ msgstr "Nivel no válido!" -#~ msgid "Invalid name!" -#~ msgstr "Nombre no validao!" - -#~ msgid "List Bran's Availables emtry." -#~ msgstr "Lista de Marcas disponibles vacia." - -#~ msgid "" -#~ "List of brands, products and models, ready to install their packages " -#~ "configuration." -#~ msgstr "" -#~ "Lista de Marcas, Productos y Modelos, listos para instalar sus paquetes " -#~ "de configuración." +#~ msgid "Value sent is not a number!" +#~ msgstr "El valor que se ha envido no es un numero!" -#~ msgid "List the Brands and Models you can Uninstall." -#~ msgstr "Lista de Marcas y Modelos que puedes desisntalar." +#~ msgid "Function:" +#~ msgstr "Funcion:" #~ msgid "Messenge Error:" #~ msgstr "Mensaje Error:" -#~ msgid "SAVING CHANGES..." -#~ msgstr "GUARDANDO CAMBIOS..." - -#~ msgid "SAVING CHANGES... OK!" -#~ msgstr "GUARDANDO CAMBIOS... LISTO!" - -#~ msgid "Save As" -#~ msgstr "Gardar como" - -#~ msgid "Select" -#~ msgstr "Seleccionado" - -#~ msgid "Type invalid: " -#~ msgstr "Tipo no valido!" - -#~ msgid "UPDATE CONTENT..." -#~ msgstr "Actualizar contenido...." - -#~ msgid "Value sent is not a number!" -#~ msgstr "El valor que se ha envido no es un numero!" - -#~ msgid "Web (HTTPS)" -#~ msgstr "Web (HTTPS)" - -#~ msgid "executable path" -#~ msgstr "ubicacion ejecutable" +#~ msgid "List the Brands and Models you can Uninstall." +#~ msgstr "Lista de Marcas y Modelos que puedes desisntalar." diff --git a/install.php b/install.php index e83bba78..678695a4 100644 --- a/install.php +++ b/install.php @@ -1038,12 +1038,11 @@ function find_exec($exec) { $db->query($sql); out('Creating symlink to web provisioner'); - if(!file_exists($amp_conf['AMPWEBROOT'] . "/provisioning")) { - if (!symlink(LOCAL_PATH . "provisioning", $amp_conf['AMPWEBROOT'] . "/provisioning")) { - //out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); - } + if(!file_exists($amp_conf['AMPWEBROOT'] . "/provisioning")) { + if (!symlink(LOCAL_PATH . "provisioning", $amp_conf['AMPWEBROOT'] . "/provisioning")) { + //out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); } - + } } out("Update Version Number to " . $epmxmlversion); diff --git a/lib/Config.class.php b/lib/Config.class.php index 4350b874..a1d4792b 100644 --- a/lib/Config.class.php +++ b/lib/Config.class.php @@ -2,7 +2,6 @@ /** * Endpoint Manager Config * - * @author Javier Pastor * @license MPL / GPLv2 / LGPL * @package Provisioner diff --git a/lib/epm_data_abstraction.class.php b/lib/epm_data_abstraction.class.php index f99d4f9a..ee77f773 100644 --- a/lib/epm_data_abstraction.class.php +++ b/lib/epm_data_abstraction.class.php @@ -60,7 +60,7 @@ function escapeSimple($query) { */ function all_models() { $sql="SELECT endpointman_model_list.* FROM endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_model_list.enabled = 1 AND endpointman_product_list.hidden = 0"; - $result1 =& $this->sql($sql, 'getAll',DB_FETCHMODE_ASSOC); + $result1 =& sql($sql, 'getAll',DB_FETCHMODE_ASSOC); return($result1); } @@ -86,13 +86,13 @@ function all_active_brands() { function all_models_by_product($product_id) { $sql="SELECT * FROM endpointman_model_list WHERE product_id = ".$product_id; - $result1 =& $this->sql($sql, 'getAll',DB_FETCHMODE_ASSOC); + $result1 =& sql($sql, 'getAll',DB_FETCHMODE_ASSOC); return($result1); } function all_models_by_brand($brand_id) { $sql="SELECT endpointman_model_list.* FROM endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_model_list.enabled = 1 AND endpointman_product_list.hidden = 0 AND endpointman_model_list.brand = " . $brand_id; - $result1 =& $this->sql($sql, 'getAll',DB_FETCHMODE_ASSOC); + $result1 =& sql($sql, 'getAll',DB_FETCHMODE_ASSOC); return($result1); } @@ -114,7 +114,7 @@ function all_unused_registrations() { function all_used_registrations() { $not_added="SELECT devices.id, devices.description FROM devices WHERE tech in ('sip','pjsip') AND devices.id in (SELECT devices.id FROM devices, endpointman_line_list WHERE tech in ('sip','pjsip') AND devices.id = endpointman_line_list.ext ) ORDER BY devices.id"; - $result =& $this->sql($not_added,'getAll', DB_FETCHMODE_ASSOC); + $result =& sql($not_added,'getAll', DB_FETCHMODE_ASSOC); return($result); } diff --git a/lib/epm_system.class.php b/lib/epm_system.class.php index 6dea508a..b7756686 100644 --- a/lib/epm_system.class.php +++ b/lib/epm_system.class.php @@ -20,7 +20,7 @@ function display_htmlspecialchars($contents) { * @author http://www.php.net/manual/en/function.socket-create.php#43057 * @param string $host * @param string $filename - * @return mixed file contents + * @return mixed file contents */ function tftp_fetch($host, $filename) { //first off let's check if this is installed or disabled @@ -55,7 +55,7 @@ function tftp_fetch($host, $filename) { } while (strlen($buffer) == 516); // the first non-full packet is the last. return $ret; } - + /** * The RecursiveIteratorIterator must be told to provide children (files and subdirectories) before parents with its CHILD_FIRST constant. * Using RecursiveIteratorIterator is the only way PHP is able to see hidden files. @@ -77,7 +77,7 @@ function rmrf($dir) { @rmdir($dir); } } - + /** * Uses which to find executables that asterisk can run/use * @version 2.11 @@ -96,7 +96,7 @@ function find_exec($exec) { return(''); } } - + /** * Downloads a file and places it in the destination defined * @version 2.11 @@ -104,7 +104,7 @@ function find_exec($exec) { * @param string $destination_file Destination of file * @package epm_system */ - function download_file($url_file, $destination_file) { + function download_file($url_file, $destination_file, &$error = array()) { //Determine if file_get_contents_url exists which is the default FreePBX Standard for downloading straight files if(function_exists('file_get_contents_url')) { $contents = file_get_contents_url($url_file); @@ -112,7 +112,7 @@ function download_file($url_file, $destination_file) { //I really hope we NEVER get here. $contents = file_get_contents($url_file); if (!preg_match('/200/', $http_response_header[0])) { - $this->error['download_file'] = "Unknown Error in Download_file"; + $error['download_file'] = "Unknown Error in Download_file"; return false; } } @@ -123,22 +123,22 @@ function download_file($url_file, $destination_file) { mkdir($dirname); } if (!is_writable($dirname)) { - $this->error['download_file'] = "Directory '" . $dirname . "' is not writable! Unable to download files"; + $error['download_file'] = "Directory '" . $dirname . "' is not writable! Unable to download files"; return false; } file_put_contents($destination_file, $contents); //check file placement if (!file_exists($destination_file)) { - $this->error['download_file'] = "File Doesn't Exist in '" . $dirname . "'. Unable to download files"; + $error['download_file'] = "File Doesn't Exist in '" . $dirname . "'. Unable to download files"; return false; } return true; } else { - $this->error['download_file'] = "Contents of Remote file are blank! URL:".$url_file; + $error['download_file'] = "Contents of Remote file are blank! URL:".$url_file; return false; } } - + /** * Downloads a file and places it in the destination defined with progress * @version 2.11 @@ -146,36 +146,54 @@ function download_file($url_file, $destination_file) { * @param string $destination_file Destination of file * @package epm_system */ - function download_file_with_progress_bar($url_file, $destination_file) { + function download_file_with_progress_bar($url_file, $destination_file, &$error = array()) { set_time_limit(0); $headers = get_headers($url_file, 1); $size = $headers['Content-Length']; - + $randnumid = trim(mt_rand(1000000000,100000000000000).$pid); + if (preg_match('/200/', $headers[0])) { - $pid = $this->run_in_background("wget " . $url_file . " -O " . $destination_file); - + $pid = $this->run_in_background("wget --no-cache " . $url_file . " -O " . $destination_file); + + echo sprintf("
      "._("Downloading %s ...")."
      ", basename($destination_file)); + echo sprintf("
      ", $randnumid); + echo "
      0% ("._("Complete").")
      "; + echo "
      "; + usleep('300'); while ($this->is_process_running($pid)) { - - if(file_exists($destination_file)) { - $out = 100 * round(filesize($destination_file) / $size, 2); - echo ''; - } - + $out = 100 * round(filesize($destination_file) / $size, 2); + ?> + + + + "._("Downloading %s ...")."
      ", basename($destination_file)); + echo "
      "; + echo "
      0% ("._("Error!").")
      "; + echo "
      "; + return false; } } - + /** * Taken from http://www.php.net/manual/en/function.array-search.php#69232 * search haystack for needle and return an array of the key path, FALSE otherwise. @@ -231,4 +249,4 @@ function is_process_running($PID) { exec("ps $PID", $ProcessState); return(count($ProcessState) >= 2); } -} +} \ No newline at end of file diff --git a/lib/json.class.php b/lib/json.class.php index 31591334..4d867d33 100644 --- a/lib/json.class.php +++ b/lib/json.class.php @@ -1,4 +1,6 @@ endpointman unsupported OSS PBX End Point Manager - 13.0.6.6 + 13.0.6.7 setup Connectivity GPLv2+ @@ -21,6 +21,7 @@ Pull Requests can be made to either of these and are encouraged. + *13.0.6.7* Fix missing files issues *13.0.6.6* Fix missing files issues *13.0.6.5* Remove array by reference *13.0.6.4* Fix bug, generate file list export brands through AJAX, delete code not required, organize files. diff --git a/views/epm_advanced/poce.views.bootnav.php b/views/epm_advanced/poce.views.bootnav.php index 8699b8d2..f428302d 100644 --- a/views/epm_advanced/poce.views.bootnav.php +++ b/views/epm_advanced/poce.views.bootnav.php @@ -1,5 +1,7 @@
      \ No newline at end of file From 9da0a2af95efaa78aab4b6187a0dfb039ff6e709 Mon Sep 17 00:00:00 2001 From: vsc55 Date: Sat, 5 Mar 2016 23:18:24 +0100 Subject: [PATCH 439/623] Update module.xml --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index 24c6687a..f6a31196 100644 --- a/module.xml +++ b/module.xml @@ -21,7 +21,7 @@ Pull Requests can be made to either of these and are encouraged. - *13.0.6.7* Fix missing files issues + *13.0.6.7* More code updated and Fix Bug *13.0.6.6* Fix missing files issues *13.0.6.5* Remove array by reference *13.0.6.4* Fix bug, generate file list export brands through AJAX, delete code not required, organize files. From 88dd4ab0849187a419a0a33364089d08d8e23eed Mon Sep 17 00:00:00 2001 From: vsc55 Date: Tue, 8 Mar 2016 16:11:20 +0100 Subject: [PATCH 440/623] Fix Update branch master. Fix firmware_local_check version is null. --- Endpointman.class.php | 3063 +++++++++++---------- assets/css/coda-slider-2.0a.css | 143 +- assets/css/epm_devices.css | 1 + assets/js/epm_config.js | 23 +- assets/js/epm_devices.js | 11 + assets/js/epm_global.js | 2 +- assets/js/jquery.coda-slider-3.0.js | 2 +- i18n/es_ES/LC_MESSAGES/endpointman.mo | Bin 19217 -> 22985 bytes i18n/es_ES/LC_MESSAGES/endpointman.po | 2746 ++++++++++-------- install.php | 9 +- lib/Config.class.php | 1 - lib/epm_data_abstraction.class.php | 26 +- lib/epm_system.class.php | 68 +- lib/json.class.php | 4 +- module.xml | 4 +- views/epm_advanced/poce.views.bootnav.php | 5 +- 16 files changed, 3347 insertions(+), 2761 deletions(-) create mode 100644 assets/css/epm_devices.css create mode 100644 assets/js/epm_devices.js diff --git a/Endpointman.class.php b/Endpointman.class.php index b497f390..4abd6574 100644 --- a/Endpointman.class.php +++ b/Endpointman.class.php @@ -12,16 +12,16 @@ function format_txt($texto = "", $css_class = "", $remplace_txt = array()) { - if (count($remplace_txt) > 0) + if (count($remplace_txt) > 0) { foreach ($remplace_txt as $clave => $valor) { $texto = str_replace($clave, $valor, $texto); } } - return '

      '.$texto.'

      '; + return '

      '.$texto.'

      '; } -function generate_xml_from_array ($array, $node_name, &$tab = -1) +function generate_xml_from_array ($array, $node_name, &$tab = -1) { $tab++; $xml =""; @@ -30,11 +30,11 @@ function generate_xml_from_array ($array, $node_name, &$tab = -1) if (is_numeric($key)) { $key = $node_name; } - + $xml .= str_repeat(" ", $tab). '<' . $key . '>' . "\n"; $xml .= generate_xml_from_array($value, $node_name, $tab); $xml .= str_repeat(" ", $tab). '' . "\n"; - + } } else { $xml = str_repeat(" ", $tab) . htmlspecialchars($array, ENT_QUOTES) . "\n"; @@ -45,20 +45,22 @@ function generate_xml_from_array ($array, $node_name, &$tab = -1) class Endpointman implements \BMO { - - //public $eda; //endpoint data abstraction layer + + public $db; //Database from FreePBX + public $eda; //endpoint data abstraction layer + public $tpl; //Template System Object (RAIN TPL) //public $system; - + public $error; //error construct public $message; //message construct - + public $UPDATE_PATH; public $MODULES_PATH; public $LOCAL_PATH; public $PHONE_MODULES_PATH; public $PROVISIONER_BASE; - - + + public function __construct($freepbx = null) { if ($freepbx == null) { throw new \Exception("Not given a FreePBX Object"); @@ -68,34 +70,34 @@ public function __construct($freepbx = null) { require_once('lib/epm_system.class.php'); require_once('lib/datetimezone.class.php'); require_once('lib/epm_data_abstraction.class.php'); - - + //require_once("lib/RainTPL.class.php"); + $this->freepbx = $freepbx; $this->db = $freepbx->Database; $this->config = $freepbx->Config; $this->configmod = new Endpointman\Config(); $this->system = new epm_system(); $this->eda = new epm_data_abstraction($this->config, $this->configmod); - - + + $this->configmod->set('disable_epm', FALSE); $this->eda->global_cfg = $this->configmod->getall(); - + //Generate empty array $this->error = array(); $this->message = array(); - - + + $this->configmod->set('tz', $this->config->get('PHPTIMEZONE')); date_default_timezone_set($this->configmod->get('tz')); - + $this->UPDATE_PATH = $this->configmod->get('update_server'); $this->MODULES_PATH = $this->config->get('AMPWEBROOT') . '/admin/modules/'; - + define("UPDATE_PATH", $this->UPDATE_PATH); define("MODULES_PATH", $this->MODULES_PATH); - - + + //Determine if local path is correct! if (file_exists($this->MODULES_PATH . "endpointman/")) { $this->LOCAL_PATH = $this->MODULES_PATH . "endpointman/"; @@ -103,7 +105,7 @@ public function __construct($freepbx = null) { } else { die("Can't Load Local Endpoint Manager Directory!"); } - + //Define the location of phone modules, keeping it outside of the module directory so that when the user updates endpointmanager they don't lose all of their phones if (file_exists($this->MODULES_PATH . "_ep_phone_modules/")) { $this->PHONE_MODULES_PATH = $this->MODULES_PATH . "_ep_phone_modules/"; @@ -120,7 +122,7 @@ public function __construct($freepbx = null) { } } define("PHONE_MODULES_PATH", $this->PHONE_MODULES_PATH); - + //Define error reporting if (($this->configmod->get('debug')) AND (!isset($_REQUEST['quietmode']))) { error_reporting(E_ALL); @@ -128,7 +130,7 @@ public function __construct($freepbx = null) { } else { ini_set('display_errors', 0); } - + //Check if config location is writable and/or exists! if ($this->configmod->isExiste('config_location')) { $config_location = $this->configmod->get('config_location'); @@ -148,8 +150,11 @@ public function __construct($freepbx = null) { $this->configmod->set('disable_epm', TRUE); } } + + //$this->tpl = new RainTPL(LOCAL_PATH . '_old/templates/freepbx', LOCAL_PATH . '_old/templates/freepbx/compiled', '/admin/assets/endpointman/images'); + //$this->tpl = new RainTPL('/admin/assets/endpointman/images'); } - + public function chownFreepbx() { $webroot = $this->config->get('AMPWEBROOT'); $modulesdir = $webroot . '/admin/modules/'; @@ -165,75 +170,51 @@ public function chownFreepbx() { 'perms' => 0755); return $files; } - + public function ajaxRequest($req, &$setting) { - -//AVISO!!!!!!!!!!!!!!!!!!!!!!!!!! -//PERMITE TODO!!!!!!!!!!!!!!!!!!! -$setting['authenticate'] = true; -$setting['allowremote'] = true; -return true; - - switch ($_REQUEST['module_sec']) - { - case "epm_devices": break; - case "epm_templates": - switch ($req) - { - case "model_clone": - case "list_current_template": - case "add_template": - case "del_template": - $setting['authenticate'] = true; - $setting['allowremote'] = false; - return true; - break; - } - break; - - case "epm_config": - switch ($req) - { - case "saveconfig": - case "list_all_brand": - $setting['authenticate'] = true; - $setting['allowremote'] = false; - return true; - break; - } - break; - - case "epm_advanced": - switch ($req) - { - case "oui": - case "oui_add": - case "oui_del": - case "poce_select": - case "poce_select_file": - case "poce_save_file": - case "poce_save_as_file": - case "poce_sendid": - case "poce_delete_config_custom": - case "list_files_brands_export": - case "saveconfig": - $setting['authenticate'] = true; - $setting['allowremote'] = false; - return true; - break; - } - break; + $module_sec = isset($_REQUEST['module_sec'])? trim($_REQUEST['module_sec']) : ''; + if ($module_sec == "") { return false; } + + + $arrVal['epm_devices']= array(); + $arrVal['epm_templates']= array("model_clone","list_current_template","add_template","del_template"); + $arrVal['epm_config']= array("saveconfig","list_all_brand"); + $arrVal['epm_advanced']= array("oui", "oui_add", "oui_del", "poce_select", "poce_select_file", "poce_save_file", "poce_save_as_file", "poce_sendid", "poce_delete_config_custom", "list_files_brands_export", "saveconfig"); + if (!isset($arrVal[$module_sec])) { return false; } + + if (in_array($req, $arrVal[$module_sec])) { + $setting['authenticate'] = true; + $setting['allowremote'] = false; + return true; } + + //AVISO!!!!!!!!!!!!!!!!!!!!!!!!!! + //PERMITE TODO!!!!!!!!!!!!!!!!!!! + //$setting['authenticate'] = true; + //$setting['allowremote'] = true; + //return true; + return false; } - + public function ajaxHandler() { $module_sec = isset($_REQUEST['module_sec'])? trim($_REQUEST['module_sec']) : ''; $module_tab = isset($_REQUEST['module_tab'])? trim($_REQUEST['module_tab']) : ''; $command = isset($_REQUEST['command'])? trim($_REQUEST['command']) : ''; - + + if ($command == "") { + $retarr = array("status" => false, "message" => _("No command was sent!")); + return $retarr; + } + + $arrVal['mod_sec'] = array("epm_devices","epm_templates", "epm_config", "epm_advanced"); + if (! in_array($module_sec, $arrVal['mod_sec'])) { + $retarr = array("status" => false, "message" => _("Invalid section module!")); + return $retarr; + } + $txt = ""; - switch ($module_sec) + switch ($module_sec) { case "epm_devices": break; case "epm_templates": @@ -243,31 +224,28 @@ public function ajaxHandler() { { case "list_current_template": $retarr = $this->epm_templates_list_current_templates(); - return $retarr; break; - + case "model_clone": $retarr = $this->epm_templates_model_clone(); - return $retarr; break; - + case "add_template": $retarr = $this->epm_templates_add_template(); - return $retarr; break; - + case "del_template": $retarr = $this->epm_templates_del_template(); - return $retarr; break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; } + return $retarr; } break; - + case "epm_config": $txt['manager'] = array( 'ayuda_model' => _("If we can activate the model set terminals of the models.
      If this model is disabled will not appear in the list of models that can be configured for PBX."), @@ -280,7 +258,7 @@ public function ajaxHandler() { 'install' => _("Install"), 'uninstall' => _("Uninstall"), 'update' => _("Update"), - 'fw_install' => _('Install Firmware'), + 'fw_install' => _('Install Firmware'), 'fw_uninstall' => _('Remove Firmware'), 'fw_update' => _('Update Firmware'), 'enable' => _('Enable'), @@ -310,37 +288,37 @@ public function ajaxHandler() { 'err_upload_content' => _("Upload Content!"), 'opt_invalid' => _("Invalid Option!") ); - - if ($module_tab == "manager") + + if ($module_tab == "manager") { switch ($command) { - case "saveconfig": + case "saveconfig": $retarr = $this->epm_config_manager_saveconfig(); break; - - case "list_all_brand": + + case "list_all_brand": $retarr = array("status" => true, "message" => "OK", "datlist" => $this->epm_config_manager_hardware_get_list_all(false)); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; } $retarr['txt'] = $txt['manager']; } - elseif ($module_tab == "editor") + elseif ($module_tab == "editor") { - switch ($command) + switch ($command) { - case "saveconfig": + case "saveconfig": $retarr = $this->epm_config_editor_saveconfig(); break; - + case "list_all_brand": $retarr = array("status" => true, "message" => "OK", "datlist" => $this->epm_config_editor_hardware_get_list_all()); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -352,7 +330,7 @@ public function ajaxHandler() { } return $retarr; break; - + case "epm_advanced": $txt['settings'] = array( 'error' => _("Error!"), @@ -360,7 +338,7 @@ public function ajaxHandler() { 'save_changes_ok' => _("Saving Changes... Ok!"), 'opt_invalid' => _("Invalid Option!") ); - + if ($module_tab == "settings") { switch ($command) @@ -368,7 +346,7 @@ public function ajaxHandler() { case "saveconfig": $retarr = $this->epm_advanced_settings_saveconfig(); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -388,15 +366,15 @@ public function ajaxHandler() { } return $ret; break; - + case "oui_add": $retarr = $this->epm_advanced_oui_add(); break; - + case "oui_del": $retarr = $this->epm_advanced_oui_remove(); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -418,24 +396,24 @@ public function ajaxHandler() { case "poce_select": $retarr = $this->epm_advanced_poce_select(); break; - + case "poce_select_file": $retarr = $this->epm_advanced_poce_select_file(); break; - + case "poce_save_file": case "poce_save_as_file": $retarr = $this->epm_advanced_poce_save_file(); break; - + case "poce_sendid": $retarr = $this->epm_advanced_poce_sendid(); break; - + case "poce_delete_config_custom": $retarr = $this->epm_advanced_poce_delete_config_custom(); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -448,7 +426,7 @@ public function ajaxHandler() { case "list_files_brands_export": $retarr = $this->epm_advanced_manual_upload_list_files_brans_export(); break; - + default: $retarr = array("status" => false, "message" => _("Command not found!") . " [" .$command. "]"); break; @@ -462,48 +440,52 @@ public function ajaxHandler() { } return false; } - + public static function myDialplanHooks() { return true; } - + public function doConfigPageInit($page) { //TODO: Pendiente revisar y eliminar moule_tab. $module_tab = isset($_REQUEST['module_tab'])? trim($_REQUEST['module_tab']) : ''; if ($module_tab == "") { $module_tab = isset($_REQUEST['subpage'])? trim($_REQUEST['subpage']) : ''; } - $command = isset($_REQUEST['command'])? trim($_REQUEST['command']) : ''; - switch ($page) + + + $arrVal['mod_sec'] = array("epm_devices","epm_templates", "epm_config", "epm_advanced"); + if (! in_array($page, $arrVal['mod_sec'])) { + die(_("Invalid section module!")); + } + + switch ($page) { case "epm_devices": break; case "epm_templates": break; case "epm_config": - switch ($module_tab) + switch ($module_tab) { case "manager": switch ($command) { case "check_for_updates": - echo format_txt("Update data..."); - $this->update_check(); - echo format_txt("Done!"); + $this->epm_config_manager_check_for_updates(); echo "


      "; exit; break; - + case "manual_install": $this->epm_config_manual_install(); echo "


      "; exit; break; - + case "firmware": $this->epm_config_manager_firmware(); echo "


      "; exit; break; - + case "brand": $this->epm_config_manager_brand(); echo "


      "; @@ -511,18 +493,18 @@ public function doConfigPageInit($page) { break; } break; - + case "editor": break; } break; - + case "epm_advanced": switch ($module_tab) { case "oui_manager": break; - + case "iedl": switch ($command) { case "export": @@ -535,7 +517,7 @@ public function doConfigPageInit($page) { break; } break; - + case "manual_upload": switch ($command) { case "export_brands_availables": @@ -543,18 +525,18 @@ public function doConfigPageInit($page) { echo "


      "; exit; break; - + case "export_brands_availables_file": $this->epm_advanced_manual_upload_export_brans_available_file(); exit; break; - + case "upload_brand": $this->epm_advanced_manual_upload_brand(); echo "


      "; exit; break; - + case "upload_provisioner": $this->epm_advanced_manual_upload_provisioner(); echo "


      "; @@ -567,19 +549,19 @@ public function doConfigPageInit($page) { break; } } - + public function doGeneralPost() { if (!isset($_REQUEST['Submit'])) { return; } if (!isset($_REQUEST['display'])) { return; } - + needreload(); } - + public function myShowPage() { if (! isset($_REQUEST['display'])) return $this->pagedata; - - switch ($_REQUEST['display']) + + switch ($_REQUEST['display']) { case "epm_devices": if(empty($this->pagedata)) @@ -590,7 +572,7 @@ public function myShowPage() { ); } break; - + case "epm_templates": if(empty($this->pagedata)) { @@ -604,9 +586,9 @@ public function myShowPage() { ); } break; - + case "epm_config": - if(empty($this->pagedata)) + if(empty($this->pagedata)) { $this->pagedata['manager'] = array( "name" => _("Install/Unistall"), @@ -618,9 +600,9 @@ public function myShowPage() { ); } break; - - case "epm_advanced": - if(empty($this->pagedata)) + + case "epm_advanced": + if(empty($this->pagedata)) { $this->pagedata['settings'] = array( "name" => _("Settings"), @@ -645,7 +627,7 @@ public function myShowPage() { } break; } - + if(! empty($this->pagedata)) { foreach($this->pagedata as &$page) { ob_start(); @@ -656,35 +638,41 @@ public function myShowPage() { return $this->pagedata; } } - + public function getActiveModules() { } - + //http://wiki.freepbx.org/display/FOP/Adding+Floating+Right+Nav+to+Your+Module public function getRightNav($request) { + if(isset($request['subpage']) && $request['subpage'] == "editor") { + return load_view(__DIR__."/views/epm_templates/rnav.php",array()); + } else { + return ''; + } + } - + //http://wiki.freepbx.org/pages/viewpage.action?pageId=29753755 public function getActionBar($request) { } - + public function install() { - + } - + public function uninstall() { out(_("Removing Phone Modules Directory")); $this->system->rmrf($this->PHONE_MODULES_PATH); exec("rm -R ". $this->PHONE_MODULES_PATH); - + out(_('Removing symlink to web provisioner')); $provisioning_path = $this->config->get('AMPWEBROOT')."/provisioning"; if(is_link($provisioning_path)) { unlink($provisioning_path); } - + if(!is_link($this->config->get('AMPWEBROOT').'/admin/assets/endpointman')) { $this->system->rmrf($this->config->get('AMPWEBROOT').'/admin/assets/endpointman'); } - + out(_("Dropping all relevant tables")); $sql = "DROP TABLE `endpointman_brand_list`"; $sth = $this->db->prepare($sql); @@ -718,32 +706,32 @@ public function uninstall() { $sth->execute(); return true; } - + public function backup() { } - + public function restore($backup) { } - - - - - - - - - - - - - + + + + + + + + + + + + + /** * Get info models by product id selected. * @param int $id_product product ID * @param bool $show_all True return all, False return hidden = 0 * @return array */ - public function epm_config_hardware_get_list_models($id_product=NULL, $show_all = true) + public function epm_config_hardware_get_list_models($id_product=NULL, $show_all = true) { if(! is_numeric($id_product)) { throw new \Exception( _("ID Producto not is number")." (".$id_product.")"); } if($show_all == true) { $sql = 'SELECT * FROM endpointman_model_list WHERE product_id = '.$id_product; } @@ -751,14 +739,14 @@ public function epm_config_hardware_get_list_models($id_product=NULL, $show_all $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); return $result; } - + /** * Get info product by brand id selected. * @param int $id_brand brand ID * @param bool $show_all True return all, FAlse return hidde = 0 * @return array */ - public function epm_config_hardware_get_list_product($id_brand=NULL, $show_all = true) + public function epm_config_hardware_get_list_product($id_brand=NULL, $show_all = true) { if(! is_numeric($id_brand)) { throw new \Exception(_("ID Brand not is numbre")." (".$id_brand.")"); } if ($show_all == true) { $sql = 'SELECT * FROM endpointman_product_list WHERE brand = '.$id_brand.' ORDER BY long_name ASC'; } @@ -766,7 +754,7 @@ public function epm_config_hardware_get_list_product($id_brand=NULL, $show_all = $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); return $result; } - + /** * Get info all brands. * @param bool $show_all True return all, False return hidde = 0 @@ -778,48 +766,48 @@ public function epm_config_hardware_get_list_brand($show_all = true) { $result = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); return $result; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + private function epm_config_manual_install($install_type = "", $package ="") { if ($install_type == "") { throw new \Exception("Not send install_type!"); } - + switch($install_type) { case "export_brand": break; - + case "upload_master_xml": if (file_exists($this->PHONE_MODULES_PATH."temp/master.xml")) { $handle = fopen($this->PHONE_MODULES_PATH."temp/master.xml", "rb"); @@ -838,36 +826,36 @@ private function epm_config_manual_install($install_type = "", $package ="") } else { } break; - + case "upload_provisioner": - + break; - + case "upload_brand": - + break; } } - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + /****************************************************** **** FUNCIONES SEC MODULO "epm_template\manager". **** *****************************************************/ - - public function epm_templates_del_template() + + public function epm_templates_del_template() { if (! isset($_REQUEST['idsel'])) { $retarr = array("status" => false, "message" => _("No send ID!")); @@ -880,18 +868,18 @@ public function epm_templates_del_template() } else { $dget['idsel'] = $_REQUEST['idsel']; - + $sql = "DELETE FROM endpointman_template_list WHERE id = ". $dget['idsel']; sql($sql); $sql = "UPDATE endpointman_mac_list SET template_id = 0 WHERE template_id = ".$dget['idsel']; sql($sql); - + $retarr = array("status" => true, "message" => _("Delete Template OK!")); unset($dget); } return $retarr; } - + public function epm_templates_add_template () { if (! isset($_REQUEST['newnametemplate'])) { @@ -928,15 +916,15 @@ public function epm_templates_add_template () $q = $db->prepare($sql); $ob = $q->execute(array($dget['newproductselec'], addslashes($dget['newnametemplate']), $dget['newclonemodel'])); $newid = $db->lastInsertId(); - //$endpoint->edit_template_display($id,0); - + $this->edit_template_display($newid,0); + $retarr = array("status" => true, "message" => _("Add New Template OK!"), "newid" => $newid); unset($dget); } return $retarr; } - - public function epm_templates_model_clone () + + public function epm_templates_model_clone () { if (! isset($_REQUEST['id'])) { $retarr = array("status" => false, "message" => _("No send ID!")); @@ -950,7 +938,7 @@ public function epm_templates_model_clone () else { $dget['id'] = $_REQUEST['id']; - + $i=0; $out = array(); $sql = "SELECT endpointman_model_list.id, endpointman_model_list.model as model FROM endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND product_id = '". $dget['id']."'"; @@ -961,15 +949,15 @@ public function epm_templates_model_clone () $i++; } $retarr = array("status" => true, "message" => _("Generate list Ok!"), "listopt" => $out); - + unset($dget); } return $retarr; } - + public function epm_templates_list_current_templates () { - + $sql = 'SELECT endpointman_template_list.*, endpointman_product_list.short_name as model_class, endpointman_model_list.model as model_clone, endpointman_model_list.enabled FROM endpointman_template_list, endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.hidden = 0 AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.product_id = endpointman_product_list.id'; $template_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 0; @@ -982,7 +970,7 @@ public function epm_templates_list_current_templates () } $i++; } - + $sql = 'SELECT endpointman_mac_list.mac, endpointman_mac_list.id, endpointman_mac_list.model, endpointman_model_list.model as model_clone, endpointman_product_list.short_name as model_class FROM endpointman_mac_list, endpointman_model_list, endpointman_product_list WHERE endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.global_custom_cfg_data IS NOT NULL AND endpointman_model_list.id = endpointman_mac_list.model AND endpointman_mac_list.template_id = 0'; $template_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); foreach($template_list as $row) { @@ -1003,7 +991,7 @@ public function epm_templates_list_current_templates () $row_out[$i]['description'] = $description; $i++; } - + /* //$sql = 'SELECT endpointman_oui_list.id, endpointman_oui_list.oui , endpointman_brand_list.name, endpointman_oui_list.custom FROM endpointman_oui_list , endpointman_brand_list WHERE endpointman_oui_list.brand = endpointman_brand_list.id ORDER BY endpointman_oui_list.oui ASC'; $sql = 'SELECT T1.id, T1.oui, T2.name, T1.custom FROM endpointman_oui_list as T1 , endpointman_brand_list as T2 WHERE T1.brand = T2.id ORDER BY T1.oui ASC'; @@ -1015,21 +1003,21 @@ public function epm_templates_list_current_templates () */ return $row_out; } - + /******************** * END SEC FUNCTIONS * ********************/ - - - - - + + + + + /*************************************************** **** FUNCIONES SEC MODULO "epm_advanced\poce". **** ***************************************************/ - - public function epm_advanced_poce_select() + + public function epm_advanced_poce_select() { if (! isset($_REQUEST['product_select'])) { $retarr = array("status" => false, "message" => _("No send Product Select!")); @@ -1043,10 +1031,10 @@ public function epm_advanced_poce_select() else { $dget['product_select'] = $_REQUEST['product_select']; - + $sql = 'SELECT * FROM `endpointman_product_list` WHERE `hidden` = 0 AND `id` = '.$dget['product_select']; $product_select_info = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id ='" . $dget['product_select'] . "'"; $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $config_files = explode(",", $row['config_files']); @@ -1059,7 +1047,7 @@ public function epm_advanced_poce_select() $i++; } } else { $file_list = NULL; } - + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $dget['product_select'] . "'"; $data = sql($sql,'getAll', DB_FETCHMODE_ASSOC); $i = 0; @@ -1072,13 +1060,13 @@ public function epm_advanced_poce_select() $i++; } } else { $sql_file_list = NULL; } - - + + require_once($this->PHONE_MODULES_PATH . 'setup.php'); $class = "endpoint_" . $row['directory'] . "_" . $row['cfg_dir'] . '_phone'; $base_class = "endpoint_" . $row['directory'] . '_base'; $master_class = "endpoint_base"; - + /********************************************************************************* *** Quick Fix for FreePBX Distro *** I seriously want to figure out why ONLY the FreePBX Distro can't do autoloads. @@ -1094,11 +1082,11 @@ public function epm_advanced_poce_select() } //end quick fix $phone_config = new $class(); - + //TODO: remove $template_file_list[0]['value'] = "template_data_custom.xml"; $template_file_list[0]['text'] = "template_data_custom.xml"; - + $sql = "SELECT id, model FROM endpointman_model_list WHERE product_id = '" . $dget['product_select'] . "' AND enabled = 1 AND hidden = 0"; $data = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); $i = 1; @@ -1107,19 +1095,19 @@ public function epm_advanced_poce_select() $template_file_list[$i]['value'] = $list['id']; $template_file_list[$i]['text'] = "template_data_" . $list['model'] . "_custom.xml"; } - - $retarr = array("status" => true, - "message" => "OK", - "product_select" => $dget['product_select'], - "product_select_info" => $product_select_info, - "file_list" => $file_list, - "template_file_list" => $template_file_list, + + $retarr = array("status" => true, + "message" => "OK", + "product_select" => $dget['product_select'], + "product_select_info" => $product_select_info, + "file_list" => $file_list, + "template_file_list" => $template_file_list, "sql_file_list" => $sql_file_list); unset($dget); } return $retarr; } - + public function epm_advanced_poce_select_file() { if (! isset($_REQUEST['product_select'])) { @@ -1146,12 +1134,12 @@ public function epm_advanced_poce_select_file() $dget['file_name'] = $_REQUEST['file_name']; $dget['file_id'] = $_REQUEST['file_id']; $dget['type_file'] = $_REQUEST['type_file']; - - + + if ($dget['type_file'] == "sql") { $sql = 'SELECT * FROM endpointman_custom_configs WHERE id =' . $dget['file_id']; $row = sql($sql, 'getrow', DB_FETCHMODE_ASSOC); - + $type = $dget['type_file']; $sendidt = $row['id']; $product_select = $row['product_id']; @@ -1160,19 +1148,19 @@ public function epm_advanced_poce_select_file() $filename = $row['name']; $location = "SQL: ". $row['name']; $config_data = $this->display_htmlspecialchars($row['data']); - + } elseif ($dget['type_file'] == "file") { $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $config_files = explode(",", $row['config_files']); - //TODO: A�adir validacion para ver si $dget['file_name'] esta en el array $config_files - + //TODO: Aadir validacion para ver si $dget['file_name'] esta en el array $config_files + $filename = $dget['file_name']; - $pathfile = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $filename; - - + $pathfile = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/" . $filename; + + if (is_readable($pathfile)) { if(filesize($pathfile)>0) { $handle = fopen($pathfile, "rb"); @@ -1183,7 +1171,7 @@ public function epm_advanced_poce_select_file() else { $contents = ""; } - + $type = $dget['type_file']; $sendidt = $dget['file_id']; $product_select = $dget['product_select']; @@ -1197,7 +1185,7 @@ public function epm_advanced_poce_select_file() $retarr = array("status" => false, "message" => _("File not readable, check the permission! ").$filename); } } - elseif ($dget['type_file'] == "tfile") + elseif ($dget['type_file'] == "tfile") { if ($dget['file_id'] == "template_data_custom.xml") { @@ -1206,24 +1194,24 @@ public function epm_advanced_poce_select_file() $config_data = ""; } else { - + $sql = "SELECT * FROM endpointman_model_list WHERE id = '" . $dget['file_id'] . "'"; $data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $sendidt = $data['id']; $original_name = $dget['file_name']; $config_data = unserialize($data['template_data']); $config_data = generate_xml_from_array ($config_data, 'node'); } - + $type = $dget['type_file']; $product_select = $dget['product_select']; $save_as_name_value = $dget['file_name']; $filename = $dget['file_name']; $location = $dget['file_name']; } - - $retarr = array("status" => true, + + $retarr = array("status" => true, "message" => "OK", "type" => $type, "sendidt" => $sendidt, @@ -1237,13 +1225,13 @@ public function epm_advanced_poce_select_file() } return $retarr; } - - - - - - - + + + + + + + //TODO: PENDIENTE REVISAR function epm_advanced_poce_sendid() { @@ -1262,9 +1250,9 @@ function epm_advanced_poce_sendid() $dget['sendid'] = $_REQUEST['sendid']; $dget['original_name'] = $_REQUEST['original_name']; $dget['config_text'] = $_REQUEST['config_text']; - - - + + + //DEBUGGGGGGGGGGGGG return; if ($dget['type_file'] == "sql") { @@ -1286,13 +1274,13 @@ function epm_advanced_poce_sendid() } return $retarr; } - - - - - - - + + + + + + + function epm_advanced_poce_save_file() { if (! isset($_REQUEST['product_select'])) { @@ -1325,14 +1313,14 @@ function epm_advanced_poce_save_file() $dget['original_name'] = $_REQUEST['original_name']; $dget['file_name'] = $_REQUEST['file_name']; $dget['config_text'] = $_REQUEST['config_text']; - - - if ($dget['type_file'] == "file") + + + if ($dget['type_file'] == "file") { $sql = "SELECT cfg_dir,directory,config_files FROM endpointman_product_list,endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = '" . $dget['product_select'] . "'"; $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $config_files = explode(",", $row['config_files']); - + if ((is_array($config_files)) AND (in_array($dget['file_name'], $config_files))) { $pathdir = $this->PHONE_MODULES_PATH . 'endpoint/' . $row['directory'] . "/" . $row['cfg_dir'] . "/"; @@ -1343,7 +1331,7 @@ function epm_advanced_poce_save_file() elseif (! is_writable($pathfile)) { $retarr = array("status" => false, "message" => "File is not Writable (".$pathfile.")!"); } - else + else { $wfh = fopen($pathfile, 'w'); fwrite($wfh, $dget['config_text']); @@ -1355,7 +1343,7 @@ function epm_advanced_poce_save_file() $retarr = array("status" => false, "message" => "The File no existe in the DataBase!"); } } - elseif ($dget['type_file'] == "sql") + elseif ($dget['type_file'] == "sql") { $sql = "UPDATE endpointman_custom_configs SET data = '" . addslashes($dget['config_text']) . "' WHERE id = " . $dget['sendid']; sql($sql); @@ -1369,7 +1357,7 @@ function epm_advanced_poce_save_file() $ob = $q->execute(array(addslashes($dget['save_as_name']), addslashes($dget['original_name']), $dget['product_select'], addslashes($dget['config_text']))); $newidinsert = $db->lastInsertId(); $retarr = array("status" => true, "message" => "Saved to Database!"); - + $retarr['type_file'] = "sql"; $retarr['location'] = "SQL: ". $dget['save_as_name']; $retarr['sendidt'] = $newidinsert; @@ -1377,8 +1365,8 @@ function epm_advanced_poce_save_file() else { $retarr = array("status" => false, "message" => "Type not valid!"); } - - + + $retarr['original_name'] = $dget['original_name']; $retarr['file_name'] = $dget['file_name']; $retarr['save_as_name'] = $dget['save_as_name']; @@ -1386,7 +1374,7 @@ function epm_advanced_poce_save_file() } return $retarr; } - + function epm_advanced_poce_delete_config_custom() { if (! isset($_REQUEST['product_select'])) { @@ -1402,7 +1390,7 @@ function epm_advanced_poce_delete_config_custom() $dget['type_file'] = $_REQUEST['type_file']; $dget['product_select'] = $_REQUEST['product_select']; $dget['sql_select'] = $_REQUEST['sql_select']; - + if ($dget['type_file'] == "sql") { $sql = "DELETE FROM endpointman_custom_configs WHERE id =" . $dget['sql_select']; sql($sql); @@ -1410,7 +1398,7 @@ function epm_advanced_poce_delete_config_custom() $retarr = array("status" => true, "message" => "File delete ok!"); } else { $retarr = array("status" => false, "message" => _("Type File not valid!")); } - + unset($dget); } return $retarr; @@ -1418,25 +1406,25 @@ function epm_advanced_poce_delete_config_custom() /******************** * END SEC FUNCTIONS * ********************/ - - - - - - - - + + + + + + + + /************************************************************ **** FUNCIONES SEC MODULO "epm_advanced\manual_upload". **** ***********************************************************/ - + public function epm_advanced_manual_upload_list_files_brans_export() { $path_tmp_dir = $this->PHONE_MODULES_PATH."temp/export/"; $array_list_files = array(); $array_count_brand = array(); - - + + $array_list_exception= array(".", "..", ".htaccess"); if(file_exists($path_tmp_dir)) { @@ -1446,11 +1434,11 @@ public function epm_advanced_manual_upload_list_files_brans_export() $i = 0; foreach ($l_files as $archivo) { if (in_array($archivo, $array_list_exception)) { continue; } - + $pathandfile = $path_tmp_dir.$archivo; $brand = substr(pathinfo($archivo, PATHINFO_FILENAME), 0, -11); $ftime = substr(pathinfo($archivo, PATHINFO_FILENAME), -10); - + $array_count_brand[] = $brand; $array_list_files[$i] = array("brand" => $brand, "pathall" => $pathandfile, @@ -1465,19 +1453,19 @@ public function epm_advanced_manual_upload_list_files_brans_export() "is_file" => is_file($pathandfile), "is_link" => is_link($pathandfile), "readlink" => (is_link($pathandfile) == true ? readlink ($pathandfile) : NULL)); - + $i++; } unset ($l_files); - + $array_count_brand = array_count_values($array_count_brand); ksort ($array_count_brand); $array_count_brand_end = array(); - + foreach($array_count_brand as $key => $value) { $array_count_brand_end[] = array('name' => $key , 'num' => $value); } - + $retarr = array("status" => true, "message" => _("List Done!"), "countlist" => count($array_list_files), "list_files" => $array_list_files, "list_brands" => $array_count_brand_end ); unset ($array_count_brand_end); unset ($array_count_brand); @@ -1491,7 +1479,7 @@ public function epm_advanced_manual_upload_list_files_brans_export() } return $retarr; } - + public function epm_advanced_manual_upload_brand() { if (count($_FILES["files"]["error"]) == 0) { @@ -1501,23 +1489,23 @@ public function epm_advanced_manual_upload_brand() { foreach ($_FILES["files"]["error"] as $key => $error) { echo format_txt(_("Importing brand file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - + if ($error != UPLOAD_ERR_OK) { echo format_txt($this->file_upload_error_message($error), "error"); } - else + else { - + $uploads_dir = $this->PHONE_MODULES_PATH . "temp"; $name = $_FILES["files"]["name"][$key]; $extension = pathinfo($name, PATHINFO_EXTENSION); if ($extension == "tgz") { - + $tmp_name = $_FILES["files"]["tmp_name"][$key]; $uploads_dir_file = $uploads_dir."/".$name; move_uploaded_file($tmp_name, $uploads_dir_file); - - if (file_exists($uploads_dir_file)) + + if (file_exists($uploads_dir_file)) { $temp_directory = sys_get_temp_dir() . "/epm_temp/"; if (!file_exists($temp_directory)) { @@ -1529,7 +1517,7 @@ public function epm_advanced_manual_upload_brand() echo format_txt(_("Error!"), "error"); } } - if (file_exists($temp_directory)) + if (file_exists($temp_directory)) { if ($this->configmod->get('debug')) { echo format_txt(_("Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........"),"",array("%_FILEPACKAGE_%" => $uploads_dir_file, "%_TEMPDIR_%" => $temp_directory)); @@ -1538,16 +1526,16 @@ public function epm_advanced_manual_upload_brand() } exec("tar -xvf ".$uploads_dir_file." -C ".$temp_directory); echo format_txt(_("Done!"), "done"); - + $package = basename($name, ".tgz"); $package = explode("-",$package); - + if ($this->configmod->get('debug')) { echo format_txt(_("Looking for file %_FILEPACKAGE_% to pass on to update_brand()..."),"",array("%_FILEPACKAGE_%" => $temp_directory.$package[0])); } else { echo format_txt(_("Looking file and update brand's....")); } - + if(file_exists($temp_directory.$package[0])) { $this->update_brand($package[0],FALSE); // Note: no need to delete/unlink/rmdir as this is handled in update_brand() @@ -1555,12 +1543,12 @@ public function epm_advanced_manual_upload_brand() echo format_txt(_("Please name the Package the same name as your brand!")); } } - } + } else { echo format_txt(_("No File Provided!"), "error"); //echo "File ".$this->PHONE_MODULES_PATH."temp/".$_REQUEST['package']." not found.
      "; } - } + } else { echo format_txt(_("Invalid File Extension!"), "error"); } @@ -1568,7 +1556,7 @@ public function epm_advanced_manual_upload_brand() } } } - + public function epm_advanced_manual_upload_provisioner () { if (count($_FILES["files"]["error"]) == 0) { @@ -1578,26 +1566,26 @@ public function epm_advanced_manual_upload_provisioner () { foreach ($_FILES["files"]["error"] as $key => $error) { echo format_txt(_("Importing Provisioner file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - + if ($error != UPLOAD_ERR_OK) { echo format_txt($this->file_upload_error_message($error), "error"); } - else + else { $uploads_dir = $this->PHONE_MODULES_PATH . "temp"; $name = $_FILES["files"]["name"][$key]; $extension = pathinfo($name, PATHINFO_EXTENSION); - if ($extension == "tgz") + if ($extension == "tgz") { $tmp_name = $_FILES["files"]["tmp_name"][$key]; $uploads_dir_file = $uploads_dir."/".$name; move_uploaded_file($tmp_name, $uploads_dir_file); - + if (file_exists($uploads_dir_file)) { echo format_txt(_("Extracting Provisioner Package...")); exec("tar -xvf ".$uploads_dir_file." -C ".$uploads_dir."/"); echo format_txt(_("Done!"), "done"); - + if(!file_exists($this->PHONE_MODULES_PATH."endpoint")) { echo format_txt(_("Creating Provisioner Directory...")); if (mkdir($this->PHONE_MODULES_PATH."endpoint") == true) { @@ -1607,19 +1595,19 @@ public function epm_advanced_manual_upload_provisioner () echo format_txt(_("Error!"), "error"); } } - - if(file_exists($this->PHONE_MODULES_PATH."endpoint")) + + if(file_exists($this->PHONE_MODULES_PATH."endpoint")) { $endpoint_last_mod = filemtime($this->PHONE_MODULES_PATH."temp/endpoint/base.php"); rename($this->PHONE_MODULES_PATH."temp/endpoint/base.php", $this->PHONE_MODULES_PATH."endpoint/base.php"); - + echo format_txt(_("Updating Last Modified...")); $sql = "UPDATE endpointman_global_vars SET value = '".$endpoint_last_mod."' WHERE var_name = 'endpoint_vers'"; sql($sql); echo format_txt(_("Done!"),"done"); } - - } else { + + } else { echo format_txt(_("File Temp no Exists!"), "error"); } } else { @@ -1629,7 +1617,7 @@ public function epm_advanced_manual_upload_provisioner () } } } - + public function epm_advanced_manual_upload_export_brans_available_file() { if ((! isset($_REQUEST['file_package'])) OR ($_REQUEST['file_package'] == "")) { @@ -1641,7 +1629,7 @@ public function epm_advanced_manual_upload_export_brans_available_file() else { $dget['file_package'] = $_REQUEST['file_package']; $path_tmp_file = $this->PHONE_MODULES_PATH."/temp/export/".$_REQUEST['file_package']; - + if (! file_exists($path_tmp_file)) { header('HTTP/1.0 404 Not Found', true, 404); echo "

      Error 404 Not Found

      "; @@ -1664,7 +1652,7 @@ public function epm_advanced_manual_upload_export_brans_available_file() } exit; } - + public function epm_advanced_manual_upload_export_brans_available() { if ((! isset($_REQUEST['package'])) OR ($_REQUEST['package'] == "")) { @@ -1675,23 +1663,23 @@ public function epm_advanced_manual_upload_export_brans_available() } else { $dget['package'] = $_REQUEST['package']; - + $sql = 'SELECT `name`, `directory` FROM `endpointman_brand_list` WHERE `id` = '.$dget['package'].''; $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + if ($row == "") { echo format_txt(_("ID Package send not valid, brand not exist!"), "error"); } else { echo format_txt(_("Exporting %_NAME_%"), "", array("%_NAME_%" => $row['name'])); - + if(!file_exists($this->PHONE_MODULES_PATH."/temp/export/")) { mkdir($this->PHONE_MODULES_PATH."/temp/export/"); } $time = time(); exec("tar zcf ".$this->PHONE_MODULES_PATH."temp/export/".$row['directory']."-".$time.".tgz --exclude .svn --exclude firmware -C ".$this->PHONE_MODULES_PATH."/endpoint ".$row['directory']); - - + + echo format_txt(_("Done!"), "done"); echo format_txt(_("Click this link to download:")); echo ""; @@ -1702,17 +1690,17 @@ public function epm_advanced_manual_upload_export_brans_available() unset ($dget); } } - + /******************** * END SEC FUNCTIONS * ********************/ - - - + + + /*************************************************** **** FUNCIONES SEC MODULO "epm_advanced\iedl". **** **************************************************/ - + public function epm_advanced_iedl_export($sFileName = "devices_list.csv") { header("Content-type: text/csv"); @@ -1726,20 +1714,20 @@ public function epm_advanced_iedl_export($sFileName = "devices_list.csv") fclose($outstream); exit; } - + //Dave B's Q&D file upload security code (http://us2.php.net/manual/en/features.file-upload.php) public function epm_advanced_iedl_import() { if (count($_FILES["files"]["error"]) == 0) { echo format_txt(_("Can Not Find Uploaded Files!"), "error"); } - else + else { $allowedExtensions = array("application/csv", "text/plain"); - + foreach ($_FILES["files"]["error"] as $key => $error) { echo format_txt(_("Importing CVS file %_FILE_%..."), "", array("%_FILE_%" => $_FILES["files"]["name"][$key])); - + if ($error != UPLOAD_ERR_OK) { echo format_txt($this->file_upload_error_message($error), "error"); } @@ -1754,7 +1742,7 @@ public function epm_advanced_iedl_import() else { $uploadfile = $this->LOCAL_PATH . basename($_FILES["files"]["name"][$key]); $uploadtemp = $_FILES["files"]["tmp_name"][$key]; - + if (move_uploaded_file($uploadtemp, $uploadfile)) { //Parse the uploaded file $handle = fopen($uploadfile, "r"); @@ -1764,29 +1752,29 @@ public function epm_advanced_iedl_import() if ($mac = $this->mac_check_clean($device[0])) { $sql = "SELECT id FROM endpointman_brand_list WHERE name LIKE '%" . $device[1] . "%' LIMIT 1"; $res = sql($sql); - + if ($res->numRows() > 0) { $brand_id = sql($sql, 'getOne'); $brand_id = $brand_id[0]; - + $sql_model = "SELECT id FROM endpointman_model_list WHERE brand = " . $brand_id . " AND model LIKE '%" . $device[2] . "%' LIMIT 1"; $sql_ext = "SELECT extension, name FROM users WHERE extension LIKE '%" . $device[3] . "%' LIMIT 1"; - + $line_id = isset($device[4]) ? $device[4] : 1; - + $res_model = sql($sql_model); if ($res_model->numRows()) { $model_id = sql($sql_model, 'getRow', DB_FETCHMODE_ASSOC); $model_id = $model_id['id']; - + $res_ext = sql($sql_ext); if ($res_ext->numRows()) { $ext = sql($sql_ext, 'getRow', DB_FETCHMODE_ASSOC); $description = $ext['name']; $ext = $ext['extension']; - + $this->add_device($mac, $model_id, $ext, 0, $line_id, $description); - + echo format_txt(_("Done!"), "done"); } else { echo format_txt(_("Invalid Extension Specified on line %_LINE_%!"), "error", array("%_LINE_%" => $i)); @@ -1814,20 +1802,20 @@ public function epm_advanced_iedl_import() } } } - + /******************** * END SEC FUNCTIONS * ********************/ - - - + + + /********************************************************** **** FUNCIONES SEC MODULO "epm_advanced\oui_manager". **** *********************************************************/ - + private function epm_advanced_oui_remove() { - //TODO: A�adir validacion de si es custom o no + //TODO: Aadir validacion de si es custom o no if ((! isset($_REQUEST['id_del'])) OR ($_REQUEST['id_del'] == "")) { $retarr = array("status" => false, "message" => _("No ID set!")); } @@ -1837,19 +1825,19 @@ private function epm_advanced_oui_remove() else { $dget['id'] = $_REQUEST['id_del']; - + $sql = "DELETE FROM endpointman_oui_list WHERE id = " . $dget['id']; sql($sql); - + $retarr = array("status" => true, "message" => "OK", "id" => $dget['id']); unset($dget); } return $retarr; - } - - private function epm_advanced_oui_add() + } + + private function epm_advanced_oui_add() { - //TODO: Pendiente a�adir isExiste datos. + //TODO: Pendiente aadir isExiste datos. if ((! isset($_REQUEST['number_new_oui'])) OR ($_REQUEST['number_new_oui'] == "")) { $retarr = array("status" => false, "message" => _("No OUI set!")); } @@ -1859,26 +1847,26 @@ private function epm_advanced_oui_add() else { $dget['oui'] = $_REQUEST['number_new_oui']; $dget['brand'] = $_REQUEST['brand_new_oui']; - + $sql = "INSERT INTO endpointman_oui_list (oui, brand, custom) VALUES ('" . $dget['oui'] . "', '" . $dget['brand'] . "', '1')"; sql($sql); - + $retarr = array("status" => true, "message" => "OK", "oui" => $dget['oui'], "brand" => $dget['brand']); unset($dget); } return $retarr; } - + /******************** * END SEC FUNCTIONS * ********************/ - - - + + + /****************************************************** **** FUNCIONES SEC MODULO "epm_advanced\settings". **** ******************************************************/ - + public function epm_advanced_config_loc_is_writable() { $config_loc = $this->configmod->get("config_loc"); @@ -1887,12 +1875,12 @@ public function epm_advanced_config_loc_is_writable() if ((file_exists($config_loc)) AND (is_dir($config_loc))) { if (is_writable($config_loc)) { $tftp_writable = TRUE; - } + } } - } + } return $tftp_writable; } - + private function epm_advanced_settings_saveconfig () { if (! isset($_REQUEST['name'])) { @@ -1901,7 +1889,7 @@ private function epm_advanced_settings_saveconfig () elseif (! isset($_REQUEST['value'])) { $retarr = array("status" => false, "message" => _("No send value!")); } - else + else { $dget['name'] = strtolower($_REQUEST['name']); $dget['value'] = $_REQUEST['value']; @@ -1910,47 +1898,47 @@ private function epm_advanced_settings_saveconfig () $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='enable_ari'"; break; - + case "enable_debug": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='debug'"; break; - + case "disable_help": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='disable_help'"; break; - + case "allow_dupext": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='show_all_registrations'"; break; - + case "allow_hdfiles": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='allow_hdfiles'"; break; - + case "tftp_check": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='tftp_check'"; break; - + case "backup_check": $dget['value'] = strtolower($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='backup_check'"; break; - + case "use_repo": $dget['value'] = strtolower($dget['value']); if (($dget['value'] == "yes") and (! $this->has_git())) { - $retarr = array("status" => false, "message" => _("Git not installed!")); + $retarr = array("status" => false, "message" => _("Git not installed!")); } else { $sql = "UPDATE endpointman_global_vars SET value='" . ($dget['value'] == "yes" ? "1": "0") . "' WHERE var_name='use_repo'"; } break; - + case "config_loc": $dget['value'] = trim($dget['value']); //No trailing slash. Help the user out and add one :-) @@ -1962,53 +1950,53 @@ private function epm_advanced_settings_saveconfig () if (is_writable($dget['value'] = $dget['value'])) { $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='config_location'"; } else { - $retarr = array("status" => false, "message" => _("Directory Not Writable!")); + $retarr = array("status" => false, "message" => _("Directory Not Writable!")); } } else { - $retarr = array("status" => false, "message" => _("Not a Vaild Directory.
      Try to run 'mkdir " . $_POST['config_loc'] . "' as root.")); + $retarr = array("status" => false, "message" => _("Not a Vaild Directory.
      Try to run 'mkdir " . $_POST['config_loc'] . "' as root.")); } } else { - $retarr = array("status" => false, "message" => _("No Configuration Location Defined!")); + $retarr = array("status" => false, "message" => _("No Configuration Location Defined!")); } break; - + case "srvip": $dget['value'] = trim($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='srvip'"; break; - + case "tz": $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='tz'"; break; - + case "ntp_server": $dget['value'] = trim($dget['value']); $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='ntp'"; break; - + case "nmap_loc": $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='nmap_location'"; break; - + case "arp_loc": $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='arp_location'"; break; - + case "asterisk_loc": $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='asterisk_location'"; break; - + case "package_server": $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='update_server'"; break; - + case "cfg_type": if ($dget['value'] == 'http') { $symlink = $this->config->get('AMPWEBROOT') . "/provisioning"; $reallink = $this->LOCAL_PATH . "provisioning"; if ((!is_link($symlink)) OR (!readlink($symlink) == $reallink)) { if (!symlink($reallink, $symlink)) { - $retarr = array("status" => false, "message" => _("Your permissions are wrong on " . $this->config->get('AMPWEBROOT') . ", web provisioning link not created!")); + $retarr = array("status" => false, "message" => _("Your permissions are wrong on " . $this->config->get('AMPWEBROOT') . ", web provisioning link not created!")); //$dget['value'] = 'file'; break; } else { @@ -2022,9 +2010,9 @@ private function epm_advanced_settings_saveconfig () } $sql = "UPDATE endpointman_global_vars SET value='" . $dget['value'] . "' WHERE var_name='server_type'"; break; - + default: - $retarr = array("status" => false, "message" => _("Name invalid: ") . $dget['name'] ); + $retarr = array("status" => false, "message" => _("Name invalid: ") . $dget['name'] ); } if (isset($sql)) { sql($sql); @@ -2035,97 +2023,97 @@ private function epm_advanced_settings_saveconfig () } return $retarr; } - + /******************** * END SEC FUNCTIONS * ********************/ - - - + + + /*************************************************** **** FUNCIONES SEC MODULO "epm_config\manager". **** ***************************************************/ - + private function epm_config_manager_check_for_updates () { - $this->update_check(); - $retarr = array("status" => true, "message" => "OK"); - return $retarr; + out("

      Update data...

      "); + $this->update_check(true); + out ("All Done!"); } - + private function epm_config_manager_brand() { if (! isset($_REQUEST['command_sub'])) { - throw new \Exception("Not send command_sub!"); + out (_("Error: Not send command!")); } - elseif (! isset($_REQUEST['idfw'])) { - throw new \Exception("Not send ID!"); + elseif (! isset($_REQUEST['idfw'])) { + out (_("Error: Not send ID!")); } else if (! is_numeric($_REQUEST['idfw'])) { - throw new \Exception("ID not is numbre!"); + out (_("Error: ID not is number!")); } else { $dget['command'] = strtolower($_REQUEST['command_sub']); $dget['id'] = $_REQUEST['idfw']; - + switch($dget['command']) { case "brand_install": - $this->download_brand($dget['id']); - break; - case "brand_update": $this->download_brand($dget['id']); break; - + case "brand_uninstall": $this->remove_brand($dget['id']); break; - + default: - echo "
      " . _("Error: Command not found!"). " [" . $dget['command'] . "]" . "
      "; + out (_("Error: Command not found!")." [" . $dget['command'] . "]"); } $this->update_check(); unset ($dget); + + return true; } + return false; } - + private function epm_config_manager_firmware() { - if (! isset($_REQUEST['command_sub'])) { - throw new \Exception("Not send command_sub!"); + if (! isset($_REQUEST['command_sub'])) { + out (_("Error: Not send command!")); } - elseif (! isset($_REQUEST['idfw'])) { - throw new \Exception("Not send ID!"); + elseif (! isset($_REQUEST['idfw'])) { + out (_("Error: Not send ID!")); } - else if (! is_numeric($_REQUEST['idfw'])) { - throw new \Exception("ID not is numbre!"); + else if (! is_numeric($_REQUEST['idfw'])) { + out (_("Error: ID not is number!")); } else { $dget['command'] = strtolower($_REQUEST['command_sub']); $dget['id'] = $_REQUEST['idfw']; - + switch($dget['command']) { case "fw_install": - $this->install_firmware($dget['id']); - break; - case "fw_update": $this->install_firmware($dget['id']); break; - + case "fw_uninstall": $this->remove_firmware($dget['id']); break; - + default: - echo "
      " . _("Error: Command not found!"). " [" . $dget['command'] . "]" . "
      "; + out (_("Error: Command not found!")." [" . $dget['command'] . "]"); } unset ($dget); + + return true; } + return false; } - + private function epm_config_manager_saveconfig() { if (! isset($_REQUEST['name'])) { @@ -2143,24 +2131,24 @@ private function epm_config_manager_saveconfig() elseif (! is_numeric($_REQUEST['idbt'])) { $retarr = array("status" => false, "message" => _("ID send is not number!")); } - else + else { $dget['name'] = strtolower($_REQUEST['name']); $dget['value'] = strtolower($_REQUEST['value']); $dget['idtype'] = strtolower($_REQUEST['idtype']); $dget['id'] = $_REQUEST['idbt']; - + switch($dget['idtype']) { case "marca": $sql = "UPDATE endpointman_brand_list SET enabled = '" .$dget['value']. "' WHERE id = '".$dget['id']."'"; break; - + case "modelo": $sql = "UPDATE endpointman_model_list SET enabled = " .$dget['value']. " WHERE id = '".$dget['id']."'"; break; - + default: - $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); + $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); } if (isset($sql)) { sql($sql); @@ -2171,7 +2159,7 @@ private function epm_config_manager_saveconfig() } return $retarr; } - + public function epm_config_manager_hardware_get_list_all($check_for_updates = true) { $row_out = array(); @@ -2179,13 +2167,13 @@ public function epm_config_manager_hardware_get_list_all($check_for_updates = tr $brand_list = $this->epm_config_hardware_get_list_brand(true); //FIX: https://github.com/FreePBX-ContributedModules/endpointman/commit/2ad929d0b38f05c9da1b847426a4094c3314be3b if($check_for_updates) $brand_up = $this->update_check(); - foreach ($brand_list as $row) + foreach ($brand_list as $row) { $row_out[$i] = $row; $row_out[$i]['count'] = $i; $row_out[$i]['cfg_ver_datetime'] = date("c",$row['cfg_ver']); - - if($check_for_updates) + + if($check_for_updates) { $id = $this->system->arraysearchrecursive($row['name'], $brand_up,'name'); $id = $id[0]; @@ -2201,19 +2189,19 @@ public function epm_config_manager_hardware_get_list_all($check_for_updates = tr $row_out[$i]['update_vers'] = ""; } } - else + else { if (! isset($row_out[$i]['update'])) { $row_out[$i]['update'] = ""; } if (! isset($row_out[$i]['update_vers'])) { $row_out[$i]['update_vers'] = ""; } } if ($row['hidden'] == 1) { continue; } - - + + $j = 0; $product_list = $this->epm_config_hardware_get_list_product($row['id'], true); foreach($product_list as $row2) { $row_out[$i]['products'][$j] = $row2; - + if($check_for_updates) { if((array_key_exists('firmware_vers', $row2)) AND ($row2['firmware_vers'] > 0)) { $temp = $this->firmware_update_check($row2['id']); @@ -2224,17 +2212,17 @@ public function epm_config_manager_hardware_get_list_all($check_for_updates = tr $row_out[$i]['products'][$j]['update_vers_fw'] = ""; } } - else + else { if (! isset($row_out[$i]['products'][$j]['update_fw'])) { $row_out[$i]['products'][$j]['update_fw'] = 0; } if (! isset($row_out[$i]['products'][$j]['update_vers_fw'])) { $row_out[$i]['products'][$j]['update_vers_fw'] = ""; } } $row_out[$i]['products'][$j]['fw_type'] = $this->firmware_local_check($row2['id']); if ($row2['hidden'] == 1) { continue; } - + $k = 0; $model_list = $this->epm_config_hardware_get_list_models($row2['id'], true); - foreach($model_list as $row3) + foreach($model_list as $row3) { $row_out[$i]['products'][$j]['models'][$k] = $row3; if($row_out[$i]['products'][$j]['models'][$k]['enabled']){ @@ -2251,9 +2239,9 @@ public function epm_config_manager_hardware_get_list_all($check_for_updates = tr /******************** * END SEC FUNCTIONS * ********************/ - - - + + + /************************************************** **** FUNCIONES SEC MODULO "epm_config\editor". **** **************************************************/ @@ -2278,28 +2266,28 @@ private function epm_config_editor_saveconfig() elseif (! is_numeric($_REQUEST['idbt'])) { $retarr = array("status" => false, "message" => _("ID send is not number!")); } - else + else { $dget['name'] = strtolower($_REQUEST['name']); $dget['value'] = strtolower($_REQUEST['value']); $dget['idtype'] = strtolower($_REQUEST['idtype']); $dget['id'] = $_REQUEST['idbt']; - + switch($dget['idtype']) { case "marca": $sql = "UPDATE endpointman_brand_list SET hidden = '".$dget['value'] ."' WHERE id = '".$dget['id']."'"; break; - + case "producto": $sql = "UPDATE endpointman_product_list SET hidden = '". $dget['value'] ."' WHERE id = '".$dget['id']."'"; break; - + case "modelo": $sql = "UPDATE endpointman_model_list SET hidden = '". $dget['value'] ."' WHERE id = '".$dget['id']."'"; break; - + default: - $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); + $retarr = array("status" => false, "message" => _("IDType invalid: ") . $dget['idtype'] ); } if (isset($sql)) { sql($sql); @@ -2310,23 +2298,23 @@ private function epm_config_editor_saveconfig() } return $retarr; } - + /** * Get info all brdans, prodics, models. * @return array */ - public function epm_config_editor_hardware_get_list_all () + public function epm_config_editor_hardware_get_list_all () { $row_out = array(); $i = 0; - foreach ($this->epm_config_hardware_get_list_brand(true) as $row) + foreach ($this->epm_config_hardware_get_list_brand(true) as $row) { $row_out[$i] = $row; $row_out[$i]['count'] = $i; - if ($row['installed']) + if ($row['installed']) { $j = 0; - foreach ($this->epm_config_hardware_get_list_product($row['id'], true) as $row2) + foreach ($this->epm_config_hardware_get_list_product($row['id'], true) as $row2) { $row_out[$i]['products'][$j] = $row2; $k = 0; @@ -2344,33 +2332,33 @@ public function epm_config_editor_hardware_get_list_all () /******************** * END SEC FUNCTIONS * ********************/ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + /***************************************** ****** CODIGO ANTIGUO -- REVISADO ******** *****************************************/ - - + + /** * Check for new firmware on the servers * @param int $id Product ID @@ -2399,7 +2387,7 @@ function firmware_update_check($id=NULL) { } } } - + /** * Check to see the status of the firmware locally (installed or not) * @param int $id @@ -2408,10 +2396,10 @@ function firmware_update_check($id=NULL) { function firmware_local_check($id=NULL) { $sql = "SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id ='" . $id . "'"; $res = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - + if (count($res) > 0) { $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $sql = "SELECT directory FROM endpointman_brand_list WHERE hidden = 0 AND id ='" . $row['brand'] . "'"; $brand_directory = sql($sql, 'getOne'); @@ -2420,7 +2408,7 @@ function firmware_local_check($id=NULL) { return("nothing"); } else { $temp = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $brand_directory . "/" . $row['cfg_dir'] . "/family_data.json"); - if (isset($temp['data']['firmware_ver'])) { + if ( (isset($temp['data']['firmware_ver'])) AND (! empty ($temp['data']['firmware_ver'])) ) { if ($row['firmware_vers'] == "") { return("install"); } else { @@ -2434,7 +2422,7 @@ function firmware_local_check($id=NULL) { return("nothing"); } } - + /** * Reads a file. Json decodes it and will report any errors back * @param string $file location of file @@ -2479,22 +2467,28 @@ function file2json($file) { return(false); } } - + /** * Check for new packges for brands. These packages will include phone models and such which the user can remove if they want * This function will alos auto-update the provisioner.net library incase anything has changed * @return array An array of all the brands/products/models and information about what's enabled, installed or otherwise */ - function update_check($echotxt = false) { + function update_check($echomsg = false, &$error=array()) { $temp_location = $this->sys_get_temp_dir() . "/epm_temp/"; if (!$this->configmod->get('use_repo')) { - $master_result = $this->system->download_file($this->UPDATE_PATH . "master.json", $this->PHONE_MODULES_PATH . "endpoint/master.json"); + if ($echomsg == true) { + $master_result = $this->system->download_file_with_progress_bar($this->UPDATE_PATH . "master.json", $this->PHONE_MODULES_PATH . "endpoint/master.json"); + } else { + $master_result = $this->system->download_file($this->UPDATE_PATH . "master.json", $this->PHONE_MODULES_PATH . "endpoint/master.json"); + } if (!$master_result) { - $this->error['brand_update_check_master'] = "Not able to connect to repository. Using local master file instead."; -if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local master file instead."), "error"); } + $error['brand_update_check_master'] = _("Error: Not able to connect to repository. Using local master file instead."); + if ($echomsg == true ) { + out($error['brand_update_check_master']); + } } - + $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/master.json'); $endpoint_package = $temp['data']['package']; $endpoint_last_mod = $temp['data']['last_modified']; @@ -2505,12 +2499,14 @@ function update_check($echotxt = false) { $contents = file_get_contents($this->UPDATE_PATH . "/update_status"); if ($contents != '1') { if (($data == "") OR ($data <= $endpoint_last_mod)) { - if ((!$master_result) OR (!$this->system->download_file($this->UPDATE_PATH . '/' . $endpoint_package, $temp_location . $endpoint_package))) { - $this->error['brand_update_check_json'] = "
      Not able to connect to repository. Using local Provisioner.net Package"; -if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local Provisioner.net Package."), "error"); } + if ((!$master_result) OR (!$this->system->download_file($this->UPDATE_PATH . '/' . $endpoint_package, $temp_location . $endpoint_package))) + { + $error['brand_update_check_json'] = _("Not able to connect to repository. Using local Provisioner.net Package"); + if ($echomsg == true ) { + out($error['brand_update_check_json']); + } } else { exec("tar -xvf " . $temp_location . $endpoint_package . " -C " . $temp_location); - if (!file_exists($this->PHONE_MODULES_PATH . "endpoint")) { mkdir($this->PHONE_MODULES_PATH . "endpoint"); } @@ -2519,25 +2515,31 @@ function update_check($echotxt = false) { rename($temp_location . "setup.php", $this->PHONE_MODULES_PATH . "autoload.php"); rename($temp_location . "endpoint/base.php", $this->PHONE_MODULES_PATH . "endpoint/base.php"); rename($temp_location . "endpoint/global_template_data.json", $this->PHONE_MODULES_PATH . "endpoint/global_template_data.json"); - $sql = "UPDATE endpointman_global_vars SET value = '" . $endpoint_last_mod . "' WHERE var_name = 'endpoint_vers'"; sql($sql); } } - + $out = $temp['data']['brands']; //Assume that if we can't connect and find the master.xml file then why should we try to find every other file. if ($master_result) { - $row = sql('SELECT * FROM endpointman_brand_list WHERE id > 0', 'getAll', DB_FETCHMODE_ASSOC); + $sql = 'SELECT * FROM endpointman_brand_list WHERE id > 0'; + $row = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); foreach ($out as $data) { $local = sql("SELECT local FROM endpointman_brand_list WHERE directory = '" . $data['directory'] . "'", 'getOne'); - if (!$local) { - $result = $this->system->download_file($this->UPDATE_PATH . $data['directory'] . "/" . $data['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json"); + if ($echomsg == true) { + out(sprintf(_("Update Brand (%s):"), $data['name'])); + $result = $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $data['directory'] . "/" . $data['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json"); + } else { + $result = $this->system->download_file($this->UPDATE_PATH . $data['directory'] . "/" . $data['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $data['directory'] . "/brand_data.json"); + } if (!$result) { - $this->error['brand_update_check'] = "
      Not able to connect to repository. Using local brand [" . $data['name'] . "] file instead."; -if ($echotxt) { echo format_txt(_("Not able to connect to repository. Using local brand [%_brandname_%] file instead."), "error", array("%_brandname_%" => $data['name'])); } + $error['brand_update_check'] = sprintf(_("Not able to connect to repository. Using local brand [%s] file instead."), $data['name']); + if ($echomsg == true ) { + out($error['brand_update_check']); + } } } @@ -2558,21 +2560,29 @@ function update_check($echotxt = false) { } $last_mod = max($last_mod, $version[$brand_name]); $version[$brand_name] = $last_mod; - if (!($this->system->arraysearchrecursive($brand_name, $row, 'directory'))) { - //insert row - $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('" . $temp['brand_id'] . "', '" . $temp['name'] . "', '" . $temp['directory'] . "', '" . $version[$brand_name] . "')"; - $_SESSION["sqlerr"] = $sql; - sql($sql); + + if (!($this->system->arraysearchrecursive($brand_name, $row, 'directory'))) + { + $sql = 'SELECT directory FROM endpointman_brand_list where id = "'.$temp['brand_id'].'"'; + $datoif = sql($sql, 'getOne'); + if ($datoif != "") { + $error['brand_update_id_exist_other_brand'] = sprintf(_("You can not add the mark (%s) as the ID (%d) already exists in the database!"), $temp['name'], $temp['brand_id']); + if ($echomsg == true ) { + out($error['brand_update_id_exist_other_brand']); + } + } + else { + $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver) VALUES ('" . $temp['brand_id'] . "', '" . $temp['name'] . "', '" . $temp['directory'] . "', '" . $version[$brand_name] . "')"; + sql($sql); + } } else { //in database already! } } else { - $this->error['brand_update_check_local_file'] = "
      Error: No Local File for " . $data['name'] . "!

      Learn how to manually upload packages here (it's easy!):
      Click Here!"; -if ($echotxt) { - echo format_txt(_("Error: No Local File for %_name_% !"), "error", array("%_name_%" => $data['name'])); - echo format_txt(_("Learn how to manually upload packages here (it's easy!):"), "error"); - echo format_txt(_("Click Here!"), "error"); -} + $error['brand_update_check_local_file'] = sprintf(_("Error: No Local File for %s !"), $data['name'])."
      "._("Learn how to manually upload packages here (it's easy!):").""._("Click Here!").""; + if ($echomsg == true ) { + out($error['brand_update_check_local_file']); + } } } @@ -2593,18 +2603,17 @@ function update_check($echotxt = false) { } } } else { - $this->error['brand_update_check_master_file'] = "
      Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!

      Learn how to manually upload packages here (it's easy!): Click Here!"; -if ($echotxt) { - echo format_txt(_("Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"), "error"); - echo format_txt(_("Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!"), "error"); - echo format_txt(_("Click Here!"), "error"); -} + $error['brand_update_check_master_file'] = _("Error: Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!")."
      "._("Learn how to manually upload packages here (it's easy!):").""._("Click Here!").""; + if ($echomsg == true ) { + out($error['brand_update_check_local_file']); + } } - return $out; } else { - $this->error['remote_server'] = "The Remote Server Is Currently Syncing With the Master Server, Please try again later"; -if ($echotxt) { echo format_txt(_("The Remote Server Is Currently Syncing With the Master Server, Please try again later"), "error"); } + $error['remote_server'] = _("Error: The Remote Server Is Currently Syncing With the Master Server, Please try again later"); + if ($echomsg == true ) { + out($error['remote_server']); + } } } else { $o = getcwd(); @@ -2678,10 +2687,16 @@ function update_check($echotxt = false) { } sql($sql); - if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'])) { - echo "System Error in Sync Model Function, Load Failure!" . $model_list['model']; -if ($echotxt) { echo format_txt(_("System Error in Sync Model [%_name_%] Function, Load Failure!"), "error", array("%_name_%" => $model_list['model'])); } + if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'], $errsync_modal)) { + $error['sync_module_error'] = sprintf(_("Error: System Error in Sync Model [%s] Function, Load Failure!"), $model_list['model']); + if ($echomsg == true ) { + out($error['sync_module_error']); + foreach ($errsync_modal as $v) { + out($v); + } + } } + unset($errsync_modal); } //Phone Models Move Here $family_id = $brand_id . $family_line_xml['data']['id']; @@ -2689,7 +2704,10 @@ function update_check($echotxt = false) { $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); foreach ($products as $data) { if (!$this->system->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { - echo "Moving/Removing Model '" . $data['model'] . "' not present in JSON file......
      "; + if ($echomsg == true ) { + outn(sprintf(_("Moving/Removing Model '%s' not present in JSON file......"), $data['model'])); + } + $model_name = $data['model']; $sql = 'DELETE FROM endpointman_model_list WHERE id = ' . $data['id']; sql($sql); @@ -2701,6 +2719,7 @@ function update_check($echotxt = false) { $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '" . $data['id'] . "'"; } sql($sql); + out (_("Done!")); } } } @@ -2712,7 +2731,7 @@ function update_check($echotxt = false) { } } } - + /** * Sync the XML files (incuding all template files) from the hard drive with the database * @param int $model Model ID @@ -2729,27 +2748,26 @@ function sync_model($model, &$error = array()) { $sql = "SELECT * FROM endpointman_brand_list WHERE id=" . $model_row['brand']; $brand_row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'])) { - $error['sync_model'] = "Brand Directory '" . $brand_row['directory'] . "' Doesn't Exist! (" . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . ")"; + + $path_brand_dir = $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory']; + $path_brand_dir_cfg = $path_brand_dir . '/' . $product_row['cfg_dir']; + $path_brand_dir_cfg_json = $path_brand_dir_cfg . '/family_data.json'; + + if (!file_exists($path_brand_dir)) { + $error['sync_model'] = sprintf(_("Brand Directory '%s' Doesn't Exist! (%s)"), $brand_row['directory'], $path_brand_dir); return(FALSE); } - - if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'])) { - $error['sync_model'] = "Product Directory '" . $product_row['cfg_dir'] . "' Doesn't Exist! (" . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . ")"; + if (!file_exists($path_brand_dir_cfg)) { + $error['sync_model'] = sprintf(_("Product Directory '%s' Doesn't Exist! (%s)"), $product_row['cfg_dir'], $path_brand_dir_cfg); return(FALSE); } - - if (!file_exists($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/family_data.json')) { - - $error['sync_model'] = "File 'family_data.json Doesn't exist in directory: " . $this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir']; + if (!file_exists($path_brand_dir_cfg_json)) { + $error['sync_model'] = sprintf(_("File 'family_data.json' Doesn't exist in directory: %s"), $path_brand_dir_cfg); return(FALSE); } - - $family_line_json = $this->file2json($this->PHONE_MODULES_PATH . '/endpoint/' . $brand_row['directory'] . '/' . $product_row['cfg_dir'] . '/family_data.json'); - - - - + $family_line_json = $this->file2json($path_brand_dir_cfg_json); + + //TODO: Add local file checks to avoid slow reloading on PHP < 5.3 $key = $this->system->arraysearchrecursive($model_row['model'], $family_line_json['data']['model_list'], 'model'); if ($key === FALSE) { @@ -2782,7 +2800,7 @@ function sync_model($model, &$error = array()) { return(FALSE); } } - + function sys_get_temp_dir() { if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); @@ -2800,74 +2818,78 @@ function sys_get_temp_dir() { } } + /** * Install Firmware for the specified Product Line * @param $product_id Product ID */ function install_firmware($product_id) { + out(_("Installa frimware... ")); + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; $sql = 'SELECT endpointman_product_list.*, endpointman_brand_list.directory FROM endpointman_product_list, endpointman_brand_list WHERE endpointman_product_list.brand = endpointman_brand_list.id AND endpointman_product_list.id = ' . $product_id; $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $json_data = $this->file2json($this->PHONE_MODULES_PATH . "endpoint/" . $row['directory'] . "/" . $row['cfg_dir'] . "/family_data.json"); - + + if ((! isset($json_data['data']['firmware_ver'])) OR (empty($json_data['data']['firmware_ver']))) { + out (_("Error: The version of the firmware package is blank!")); + return false; + } + + if ((! isset($json_data['data']['firmware_pkg'])) OR (empty($json_data['data']['firmware_pkg'])) OR ($json_data['data']['firmware_pkg'] == "NULL")) { + out (_("Error: The package name of the firmware to be downloaded is Null or blank!")); + return false; + } + if ($json_data['data']['firmware_ver'] > $row['firmware_vers']) { if (!file_exists($temp_directory)) { mkdir($temp_directory); } $md5_xml = $json_data['data']['firmware_md5sum']; $firmware_pkg = $json_data['data']['firmware_pkg']; - + if (file_exists($temp_directory . $firmware_pkg)) { $md5_pkg = md5_file($temp_directory . $firmware_pkg); - if ($md5_xml == $md5_pkg) { - echo format_txt(_("Skipping download...")); - } - else - { - echo format_txt(_("Downloading firmware...")); - if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) - { - echo format_txt(_("Error download frimware package!"), "error"); + out(_("Skipping download, updated local version...")); + } else { + out(_("Downloading firmware...")); + if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) { + out(_("Error download frimware package!")); return false; } - echo format_txt(_("Done!"), "done"); $md5_pkg = md5_file($temp_directory . $firmware_pkg); } - } - else - { - echo format_txt(_("Downloading firmware...")); - if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) - { - echo format_txt(_("Error download frimware package!"), "error"); + } else { + out(_("Downloading firmware...")); + if (! $this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row['directory'] . "/" . $firmware_pkg, $temp_directory . $firmware_pkg)) { + out(_("Error download frimware package!")); return false; } - echo format_txt(_("Done!"), "done"); $md5_pkg = md5_file($temp_directory . $firmware_pkg); } - - echo format_txt(_("Checking MD5sum of Package...")); + + outn(_("Checking MD5sum of Package... ")); if ($md5_xml == $md5_pkg) { - echo format_txt(_("Matches!"), "done"); - + out(_("Matches!")); + if (file_exists($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware")) { $this->system->rmrf($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware"); } mkdir($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware", 0777, TRUE); - - echo format_txt(_("Installing Firmware...")); + + out(_("Installing Firmware...")); + //TODO: AADIR VALIDACION EXTRACCION CORRECTA exec("tar -xvf " . $temp_directory . $firmware_pkg . " -C " . $temp_directory . $row['directory'] . "/" . $row['cfg_dir']); $i = 0; foreach (glob($temp_directory . $row['directory'] . "/" . $row['cfg_dir'] . "/firmware/*") as $filename) { $file = basename($filename); $list[$i] = $file; if (!@copy($filename, $this->configmod->get('config_location') . $file)) { -echo format_txt(_("- Failed To Copy %_FILE_%!"), "error", array("%_FILE_%" => $file)); - + out(sprintf(_("- Failed To Copy %s!"), $file)); $copy_error = TRUE; } elseif ($this->configmod->get('debug')) { -echo format_txt(_("- Copied %_FILE_% to %_FILETO_%."), "txt", array("%_FILE_%" => $file, "%_FILETO_%" => $this->configmod->get('config_location'))); + out(sprintf(_("- Copied %s to %s."), $file, $this->configmod->get('config_location'))); } $i++; } @@ -2876,32 +2898,32 @@ function install_firmware($product_id) { $list = implode(",", $list); $sql = "UPDATE endpointman_product_list SET firmware_vers = '" . $json_data['data']['firmware_ver'] . "', firmware_files = '" . $list . "' WHERE id = " . $row['id']; sql($sql); - - + if (isset($copy_error)) { - echo format_txt(_("Copy Error Detected! Aborting Install!"), "error"); + out(_("Copy Error Detected! Aborting Install!")); $this->remove_firmware($product_id); - echo format_txt(_("Please Check Directory/Permissions!"), "error"); - } + out(_("Info: Please Check Directory/Permissions!")); + } else { - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } - } + } else { - echo format_txt(_("Firmware MD5 didn't match!"), "error"); + out(_("Firmware MD5 didn't match!")); } - } + } else { - echo format_txt(_("Your Firmware is already up to date"), "done"); + out(_("Your Firmware is already up to date.")); } } - + /** * Remove firmware from the Hard Drive * @param int $id Product ID */ function remove_firmware($id) { - echo format_txt(_("Uninstalla frimware...")); + outn(_("Uninstalla frimware... ")); + $sql = "SELECT firmware_files FROM endpointman_product_list WHERE id ='" . $id . "'"; $files = sql($sql, 'getOne'); @@ -2915,26 +2937,27 @@ function remove_firmware($id) { } $sql = "UPDATE endpointman_product_list SET firmware_files = '', firmware_vers = '' WHERE id = '" . $id . "'"; sql($sql); - - echo format_txt(_("Done!"), "done"); + + out(_("Done!")); } - + /** * Remove the brand * @param int $id Brand ID */ function remove_brand($id=NULL, $remove_configs=FALSE, $force=FALSE) { - echo format_txt(_("Uninstalla Brand...")); + out(_("Uninstalla Brand...")); + if (!$this->configmod->get('use_repo')) { $sql = "SELECT id, firmware_vers FROM endpointman_product_list WHERE brand = '" . $id . "'"; $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); - + foreach ($products as $data) { if ($data['firmware_vers'] != "") { $this->remove_firmware($data['id']); } } - + $sql = "SELECT directory FROM endpointman_brand_list WHERE id = '" . $id . "'"; $brand_dir = sql($sql, 'getOne'); $this->system->rmrf($this->PHONE_MODULES_PATH . "endpoint/" . $brand_dir); @@ -2951,9 +2974,9 @@ function remove_brand($id=NULL, $remove_configs=FALSE, $force=FALSE) { $this->system->rmrf($this->PHONE_MODULES_PATH . $brand_dir); $sql = "DELETE FROM endpointman_brand_list WHERE id = '" . $id . "'"; sql($sql); - - echo format_txt(_("All Done!"), "done"); - } + + out(_("All Done!")); + } elseif ($force) { $sql = "SELECT directory FROM endpointman_brand_list WHERE id = '" . $id . "'"; $brand_dir = sql($sql, 'getOne'); @@ -2969,76 +2992,78 @@ function remove_brand($id=NULL, $remove_configs=FALSE, $force=FALSE) { $sql = "DELETE FROM endpointman_brand_list WHERE id = '" . $id . "'"; sql($sql); - - echo format_txt(_("Done!"), "done"); - } + + out(_("Done!")); + } else { - echo format_txt(_("Not allowed in repo mode!!"), "error"); + out(_("Error: Not allowed in repo mode!!")); } } - + /** * This will download the xml & brand package remotely * @param integer $id Brand ID */ function download_brand($id) { + out(_("Install/Update Brand...")); if (!$this->configmod->get('use_repo')) { $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; - + if (!file_exists($temp_directory)) { - echo format_txt(_("Creating EPM temp directory")); + out(_("Creating EPM temp directory")); if (! mkdir($temp_directory)) { - echo format_txt(_("Error creating directory: %_DIR_%"), "error", array("%_DIR_%" => $temp_directory)); - echo format_txt(_("Please Check Directory/Permissions!"), "error"); + out(sprintf(_("Error: Failed to create the directory '%s', please Check Permissions!"), $temp_directory)); return false; } } - - echo format_txt(_("Downloading Brand JSON.....")); + + outn(_("Downloading Brand JSON..... ")); $row = sql('SELECT * FROM endpointman_brand_list WHERE id =' . $id, 'getAll', DB_FETCHMODE_ASSOC); $result = $this->system->download_file($this->UPDATE_PATH . $row[0]['directory'] . "/" . $row[0]['directory'] . ".json", $this->PHONE_MODULES_PATH . "endpoint/" . $row[0]['directory'] . "/brand_data.json"); if ($result) { - echo format_txt(_("Done!"), "done"); + out(_("Done!")); $temp = $this->file2json($this->PHONE_MODULES_PATH . 'endpoint/' . $row[0]['directory'] . '/brand_data.json'); $package = $temp['data']['brands']['package']; - echo format_txt(_("Downloading Brand Package...")); - if ($this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row[0]['directory'] . '/' . $package, $temp_directory . $package)) { - echo format_txt(_("Done!"), "done"); + out(_("Downloading Brand Package...")); + if ($this->system->download_file_with_progress_bar($this->UPDATE_PATH . $row[0]['directory'] . '/' . $package, $temp_directory . $package)) + { if (file_exists($temp_directory . $package)) { $md5_xml = $temp['data']['brands']['md5sum']; $md5_pkg = md5_file($temp_directory . $package); - - echo format_txt(_("Checking MD5sum of Package....")); + + outn(_("Checking MD5sum of Package.... ")); if ($md5_xml == $md5_pkg) { - echo format_txt(_("Done!"), "done"); - - echo format_txt(_("Extracting Tarball........")); + out(_("Done!")); + + outn(_("Extracting Tarball........ ")); + //TODO: PENDIENTE VALIDAR SI DA ERROR LA DESCOMPRESION exec("tar -xvf " . $temp_directory . $package . " -C " . $temp_directory); - echo format_txt(_("Done!"), "done"); - + out(_("Done!")); + //Update File in the temp directory copy($this->PHONE_MODULES_PATH . 'endpoint/' . $row[0]['directory'] . '/brand_data.json', $temp_directory . $row[0]['directory'] . '/brand_data.json'); $this->update_brand($row[0]['directory'], TRUE); } else { - echo format_txt(_("MD5 Did not match!"), "error"); - echo format_txt(_("MD5 XML: %_MD5_%"), "error", array("%_MD5_%" => $md5_xml)); - echo format_txt(_("MD5 PKG: %_MD5_%"), "error", array("%_MD5_%" => $md5_pkg)); + out(_("MD5 Did not match!")); + out(sprintf(_("MD5 XML: %s"), $md5_xml)); + out(sprintf(_("MD5 PKG: %s"), $md5_pkg)); } } else { - echo format_txt(_("Can't Find Downloaded File!"), "error"); + out(_("Error: Can't Find Downloaded File!")); } } else { - echo format_txt(_("Error download Brand package!"), "error"); + out(_("Error download Brand package!")); } } else { - echo format_txt(_("Error Connecting to the Package Repository. Module not installed. Please Try again later."), "error"); - echo format_txt(_("You Can Also Manually Update The Repository By Downloading Files here: %_URL_INI_% Release Repo %_URL_END_%"), "error", array ( "%_URL_INI_%" => "", "%_URL_END_%" => "")); - echo format_txt(_("Then Use Manual Upload in Advanced Settings."), "error"); + out(_("Error!")); + out(_("Error Connecting to the Package Repository. Module not installed. Please Try again later.")); + out(_("You Can Also Manually Update The Repository By Downloading Files here: Release Repo ")); + out(_("Then Use Manual Upload in Advanced Settings.")); } } else { - echo format_txt(_("Installing brands is disabled while in repo mode!"), "error"); + out(_("Error: Installing brands is disabled while in repo mode!")); } } @@ -3047,15 +3072,15 @@ function download_brand($id) { * Still needs way to determine when models move...perhaps another function? */ function update_brand($package, $remote=TRUE) { -if ($this->configmod->get('debug')) echo format_txt(_("update_brand(): Debug is set to %_DEBUG_MODE_%"), "",array("%_DEBUG_MODE_%" => $this->configmod->get('debug'))); - + out(sprintf(_("Update Brand %s ... "), $package)); + $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; if ($this->configmod->get('debug')) echo format_txt(_("Processing %_PATH_%/brand_data.json..."), "",array("%_PATH_%" => $temp_directory.$package)); - + if (file_exists($temp_directory . $package . '/brand_data.json')) { $temp = $this->file2json($temp_directory . $package . '/brand_data.json'); if (key_exists('directory', $temp['data']['brands'])) { - echo format_txt(_("Appears to be a valid Provisioner.net JSON file.....Continuing")); + out(_("Appears to be a valid Provisioner.net JSON file.....Continuing")); //Pull in all variables $directory = $temp['data']['brands']['directory']; $brand_name = $temp['data']['brands']['name']; @@ -3063,7 +3088,8 @@ function update_brand($package, $remote=TRUE) { $brand_version = $temp['data']['brands']['last_modified']; //create directory structure and move files - echo format_txt(_("Creating Directory Structure for Brand '%_NAME_%' and Moving Files .."), "",array("%_NAME_%" => $brand_name)); + out(sprintf(_("Creating Directory Structure for Brand '%s' and Moving Files..."), $brand_name)); + if (!file_exists($this->PHONE_MODULES_PATH . "endpoint/" . $directory)) { mkdir($this->PHONE_MODULES_PATH . "endpoint/" . $directory); } @@ -3082,14 +3108,14 @@ function update_brand($package, $remote=TRUE) { $dir = str_replace($temp_directory . $directory . "/", "", $file); $stats = rename($file, $this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir); if ($stats === FALSE) { - echo format_txt(_("- Error Moving %_FILENAME_%!"), "error",array("%_FILENAME_%" => basename($file))); + out(sprintf(_("- Error Moving %s!"), basename($file))); } chmod($this->PHONE_MODULES_PATH . "endpoint/" . $directory . "/" . $dir, 0775); //echo "."; } } } - echo format_txt(_("Done!"), "done"); + out(_("All Done!")); if ($remote) { $local = 0; @@ -3099,18 +3125,20 @@ function update_brand($package, $remote=TRUE) { $b_data = sql("SELECT id FROM endpointman_brand_list WHERE id = '" . $brand_id . "'", 'getOne'); if ($b_data) { -echo format_txt(_("Updating %_BRANDNAME_% brand data.........."), "", array("%_BRANDNAME_%" => $brand_name)); + outn(sprintf(_("Updating %s brand data ..."), $brand_name)); $sql = "UPDATE endpointman_brand_list SET local = '" . $local . "', name = '" . $brand_name . "', cfg_ver = '" . $brand_version . "', installed = 1, hidden = 0 WHERE id = " . $brand_id; sql($sql); + out(_("Done!")); } else { -echo format_txt(_("Inserting %_BRANDNAME_% brand data.........."), "", array("%_BRANDNAME_%" => $brand_name)); + outn(sprintf(_("Inserting %s brand data ..."), $brand_name)); $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, local, installed) VALUES ('" . $brand_id . "', '" . $brand_name . "', '" . $directory . "', '" . $brand_version . "', '" . $local . "', '1')"; sql($sql); + out(_("Done!")); } $last_mod = ""; foreach ($temp['data']['brands']['family_list'] as $family_list) { - echo format_txt(_("Updating Family Lines.................")); + out(_("Updating Family Lines ...")); $last_mod = max($last_mod, $family_list['last_modified']); @@ -3119,29 +3147,29 @@ function update_brand($package, $remote=TRUE) { $require_firmware = NULL; if ((key_exists('require_firmware', $family_line_xml['data'])) && ($remote) && ($family_line_xml['data']['require_firmware'] == "TRUE")) { - echo format_txt(_("Firmware Requirment Detected!..........")); - $this->install_firmware($family_line_xml['data']['id']); + out(_("Firmware Requirment Detected!..........")); + $this->install_firmware($family_line_xml['data']['id']); } $data = sql("SELECT id FROM endpointman_product_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . "'", 'getOne'); $short_name = preg_replace("/\[(.*?)\]/si", "", $family_line_xml['data']['name']); - + if ($data) { if ($this->configmod->get('debug')) echo "-Updating Family ".$short_name."
      "; $sql = "UPDATE endpointman_product_list SET short_name = '" . str_replace("'", "''", $short_name) . "', long_name = '" . str_replace("'", "''", $family_line_xml['data']['name']) . "', cfg_ver = '" . $family_line_xml['data']['version'] . "', config_files='" . $family_line_xml['data']['configuration_files'] . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . "'"; - } + } else { if ($this->configmod->get('debug')) echo "-Inserting Family ".$short_name."
      "; $sql = "INSERT INTO endpointman_product_list (`id`, `brand`, `short_name`, `long_name`, `cfg_dir`, `cfg_ver`, `config_files`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . "', '" . $brand_id . "', '" . str_replace("'", "''", $short_name) . "', '" . str_replace("'", "''", $family_line_xml['data']['name']) . "', '" . $family_line_xml['data']['directory'] . "', '" . $family_line_xml['data']['last_modified'] . "','" . $family_line_xml['data']['configuration_files'] . "', '0')"; } sql($sql); - + if (count($family_line_xml['data']['model_list']) > 0) { - echo format_txt(_("-- Updating Model Lines................")); + out(_("-- Updating Model Lines ... ")); foreach ($family_line_xml['data']['model_list'] as $model_list) { $template_list = implode(",", $model_list['template_data']); - + $model_final_id = $brand_id . $family_line_xml['data']['id'] . $model_list['id']; $sql = 'SELECT id, global_custom_cfg_data, global_user_cfg_data FROM endpointman_mac_list WHERE model = ' . $model_final_id; $old_data = NULL; @@ -3149,7 +3177,7 @@ function update_brand($package, $remote=TRUE) { foreach ($old_data as $data) { $global_custom_cfg_data = unserialize($data['global_custom_cfg_data']); if ((is_array($global_custom_cfg_data)) AND (!array_key_exists('data', $global_custom_cfg_data))) { -echo format_txt(_("----Old Data Detected! Migrating......")); +outn(_("----Old Data Detected! Migrating ... ")); $new_data = array(); $new_ari = array(); foreach ($global_custom_cfg_data as $key => $old_keys) { @@ -3169,9 +3197,9 @@ function update_brand($package, $remote=TRUE) { $final_data = serialize($final_data); $sql = "UPDATE endpointman_mac_list SET global_custom_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; sql($sql); - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } - + $global_user_cfg_data = unserialize($data['global_user_cfg_data']); $old_check = FALSE; if (is_array($global_user_cfg_data)) { @@ -3189,7 +3217,7 @@ function update_brand($package, $remote=TRUE) { } } if ((is_array($global_user_cfg_data)) AND ($old_check)) { -echo format_txt(_("Old Data Detected! Migrating......")); +outn(_("Old Data Detected! Migrating ... ")); $new_data = array(); foreach ($global_user_cfg_data as $key => $old_keys) { if (array_key_exists('value', $old_keys)) { @@ -3205,7 +3233,7 @@ function update_brand($package, $remote=TRUE) { $final_data = serialize($new_data); $sql = "UPDATE endpointman_mac_list SET global_user_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; sql($sql); - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } } $old_data = NULL; @@ -3214,7 +3242,7 @@ function update_brand($package, $remote=TRUE) { foreach ($old_data as $data) { $global_custom_cfg_data = unserialize($data['global_custom_cfg_data']); if ((is_array($global_custom_cfg_data)) AND (!array_key_exists('data', $global_custom_cfg_data))) { -echo format_txt(_("Old Data Detected! Migrating......")); +out(_("Old Data Detected! Migrating ... ")); $new_data = array(); $new_ari = array(); foreach ($global_custom_cfg_data as $key => $old_keys) { @@ -3234,37 +3262,38 @@ function update_brand($package, $remote=TRUE) { $final_data = serialize($final_data); $sql = "UPDATE endpointman_template_list SET global_custom_cfg_data = '" . $final_data . "' WHERE id =" . $data['id']; sql($sql); - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } } - + $m_data = sql("SELECT id FROM endpointman_model_list WHERE id='" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'", 'getOne'); if ($m_data) { if ($this->configmod->get('debug')) echo format_txt(_("---Updating Model %_NAMEMOD_%"), "", array("%_NAMEMOD_%" => $model_list['model'])); $sql = "UPDATE endpointman_model_list SET max_lines = '" . $model_list['lines'] . "', model = '" . $model_list['model'] . "', template_list = '" . $template_list . "' WHERE id = '" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "'"; - } + } else { if ($this->configmod->get('debug')) echo format_txt(_("---Inserting Model %_NAMEMOD_%"), "", array("%_NAMEMOD_%" => $model_list['model'])); $sql = "INSERT INTO endpointman_model_list (`id`, `brand`, `model`, `max_lines`, `product_id`, `template_list`, `enabled`, `hidden`) VALUES ('" . $brand_id . $family_line_xml['data']['id'] . $model_list['id'] . "', '" . $brand_id . "', '" . $model_list['model'] . "', '" . $model_list['lines'] . "', '" . $brand_id . $family_line_xml['data']['id'] . "', '" . $template_list . "', '0', '0')"; } sql($sql); - + + //echo "brand_id:".$brand_id. " - family_line_xml:" . $family_line_xml['data']['id'] . "- model_list:" . $model_list['id']."
      "; if (!$this->sync_model($brand_id . $family_line_xml['data']['id'] . $model_list['id'], $errlog)) { - echo format_txt(_("System Error in Sync Model Function, Load Failure!"), "error"); - echo format_txt($errlog['sync_model'], "error"); + out(_("Error: System Error in Sync Model Function, Load Failure!")); + out(_("Error: ").$errlog['sync_model']); } unset ($errlog); } } - - + //END Updating Model Lines................ + //Phone Models Move Here $family_id = $brand_id . $family_line_xml['data']['id']; $sql = "SELECT * FROM endpointman_model_list WHERE product_id = " . $family_id; $products = sql($sql, 'getall', DB_FETCHMODE_ASSOC); foreach ($products as $data) { if (!$this->system->arraysearchrecursive($data['model'], $family_line_xml['data']['model_list'], 'model')) { - echo format_txt(_("Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......"), "", array("%_NAMEMOD_%" => $data['model'])); + outn(sprintf(_("Moving/Removing Model '%s' not present in JSON file ... "), $data['model'])); $model_name = $data['model']; $sql = 'DELETE FROM endpointman_model_list WHERE id = ' . $data['id']; sql($sql); @@ -3276,14 +3305,14 @@ function update_brand($package, $remote=TRUE) { $sql = "UPDATE endpointman_mac_list SET model = '0' WHERE model = '" . $data['id'] . "'"; } sql($sql); + out(_("Done!")); } } } - - if ($this->configmod->get('debug')) { - echo format_txt(_("Done!"), "done"); - echo format_txt(_("Updating OUI list in DB")); - } + out(_("All Done!")); + //END Updating Family Lines + + outn(_("Updating OUI list in DB ... ")); if ((isset($temp['data']['brands']['oui_list'])) AND (count($temp['data']['brands']['oui_list']) > 0)) { foreach ($temp['data']['brands']['oui_list'] as $oui) { @@ -3291,50 +3320,20 @@ function update_brand($package, $remote=TRUE) { sql($sql); } } - - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } else { - echo format_txt(_("Invalid JSON Structure in %_PATH_%/brand_data.json"), "", array("%_PATH_%" => $temp_directory.$package), "error"); + outn(sprintf(_("Error: Invalid JSON Structure in %s/brand_data.json"), $temp_directory.$package)); } } else { - echo format_txt(_("No 'brand_data.xml' file exists!"), "error"); + out(_("Error: No 'brand_data.xml' file exists!")); } - echo format_txt(_("Removing Temporary Files..............")); + outn(_("Removing Temporary Files... ")); $this->system->rmrf($temp_directory . $package); - echo format_txt(_("Done!"), "done"); + out(_("Done!")); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + /** * Returns list of Brands that are installed and not hidden and that have at least one model enabled under them * @param integer $selected ID Number of the brand that is supposed to be selected in a drop-down list box @@ -3342,7 +3341,6 @@ function update_brand($package, $remote=TRUE) { */ function brands_available($selected = NULL, $show_blank=TRUE) { $data = $this->eda->all_active_brands(); - $temp = array(); if ($show_blank) { $temp[0]['value'] = ""; $temp[0]['text'] = ""; @@ -3362,7 +3360,7 @@ function brands_available($selected = NULL, $show_blank=TRUE) { } return($temp); } - + function listTZ($selected) { require_once('lib/datetimezone.class.php'); $data = \DateTimeZone::listIdentifiers(); @@ -3380,7 +3378,7 @@ function listTZ($selected) { return($temp); } - + function has_git() { exec('which git', $output); @@ -3395,7 +3393,7 @@ function has_git() { return!empty($matches[0]) ? $git : false; echo!empty($matches[0]) ? 'installed' : 'nope'; } - + function tftp_check() { //create a simple block here incase people have strange issues going on as we will kill http //by running this if the server isn't really running! @@ -3438,8 +3436,8 @@ function tftp_check() { echo 'TFTP Server check failed on last past. Skipping'; } } - - + + /** * Used to send sample configurations to provisioner.net * NOTE: The user has to explicitly click a link that states they are sending the configuration to the project @@ -3451,14 +3449,14 @@ function tftp_check() { */ function submit_config($brand, $product, $orig_name, $data) { $posturl = 'http://www.provisioner.net/submit_config.php'; - + $fp = fopen($this->LOCAL_PATH . 'data.txt', 'w'); fwrite($fp, $data); fclose($fp); $file_name_with_full_path = $this->LOCAL_PATH . "data.txt"; - + $postvars = array('brand' => $brand, 'product' => $product, 'origname' => htmlentities(addslashes($orig_name)), 'file_contents' => '@' . $file_name_with_full_path); - + $ch = curl_init($posturl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); @@ -3466,17 +3464,17 @@ function submit_config($brand, $product, $orig_name, $data) { curl_setopt($ch, CURLOPT_HEADER, 0); // DO NOT RETURN HTTP HEADERS curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // RETURN THE CONTENTS OF THE CALL, probably not needed $Rec_Data = curl_exec($ch); - + ob_start(); header("Content-Type: text/html"); $Final_Out = ob_get_clean(); curl_close($ch); unlink($file_name_with_full_path); - + return($Final_Out); } - - + + /** * Fixes the display are special strings so we can visible see them instead of them being transformed * @param string $contents a string of course @@ -3490,9 +3488,9 @@ function display_htmlspecialchars($contents) { $contents = str_replace("'", "&#039;", $contents); return($contents); } - - - + + + function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname=NULL) { $mac = $this->mac_check_clean($mac); if ($mac) { @@ -3506,12 +3504,12 @@ function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname if ($this->sync_model($model)) { $sql = "SELECT id,template_id FROM endpointman_mac_list WHERE mac = '" . $mac . "'"; $dup = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + if ($dup) { if (!isset($template)) { $template = $dup['template_id']; } - + $sql = "UPDATE endpointman_mac_list SET model = " . $model . ", template_id = " . $template . " WHERE id = " . $dup['id']; sql($sql); $return = $this->add_line($dup['id'], $line, $ext); @@ -3524,38 +3522,38 @@ function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname if (!isset($template)) { $template = 0; } - + $sql = "SELECT mac_id FROM endpointman_line_list WHERE ext = " . $ext; $used = sql($sql, 'getOne'); - + if (($used) AND (! $this->configmod->get('show_all_registrations'))) { $this->error['add_device'] = "You can't assign the same user to multiple devices!"; return(FALSE); } - + if (!isset($displayname)) { $sql = 'SELECT description FROM devices WHERE id = ' . $ext; $name = & sql($sql, 'getOne'); } else { $name = $displayname; } - + $sql = 'SELECT endpointman_product_list. * , endpointman_model_list.template_data, endpointman_brand_list.directory FROM endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_model_list.id = \'' . $model . '\' AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id'; $row = & sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $sql = "INSERT INTO `endpointman_mac_list` (`mac`, `model`, `template_id`) VALUES ('" . $mac . "', '" . $model . "', '" . $template . "')"; sql($sql); - + $sql = 'SELECT last_insert_id()'; $ext_id = & sql($sql, 'getOne'); - + if (empty($line)) { $line = 1; } - + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $ext_id . "', '" . $ext . "', '" . $line . "', '" . addslashes($name) . "')"; sql($sql); - + $this->message['add_device'][] = "Added " . $name . " to line " . $line; return($ext_id); } @@ -3569,32 +3567,32 @@ function add_device($mac, $model, $ext, $template=NULL, $line=NULL, $displayname return(FALSE); } } - - + + function add_line($mac_id, $line=NULL, $ext=NULL, $displayname=NULL) { if ((!isset($line)) AND (!isset($ext))) { if ($this->linesAvailable(NULL, $mac_id)) { if ($this->eda->all_unused_registrations()) { $sql = 'SELECT * FROM endpointman_line_list WHERE mac_id = ' . $mac_id; $lines_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - + foreach ($lines_list as $row) { $sql = "SELECT description FROM devices WHERE id = " . $row['ext']; $name = sql($sql, 'getOne'); - + $sql = "UPDATE endpointman_line_list SET line = '" . $row['line'] . "', ext = '" . $row['ext'] . "', description = '" . $this->eda->escapeSimple($name) . "' WHERE luid = " . $row['luid']; sql($sql); } - + $reg = array_values($this->display_registration_list()); $lines = array_values($this->linesAvailable(NULL, $mac_id)); - + $sql = "SELECT description FROM devices WHERE id = " . $reg[0]['value']; $name = $this->eda->sql($sql, 'getOne'); - + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $reg[0]['value'] . "', '" . $lines[0]['value'] . "', '" . addslashes($name) . "')"; $this->eda->sql($sql); - + $this->message['add_line'] = "Added '" . $name . "' to line '" . $lines[0]['value'] . "' on device '" . $reg[0]['value'] . "'
      Configuration Files will not be Generated until you click Save!"; return($mac_id); } else { @@ -3609,10 +3607,10 @@ function add_line($mac_id, $line=NULL, $ext=NULL, $displayname=NULL) { if ($this->linesAvailable(NULL, $mac_id)) { if ($this->eda->all_unused_registrations()) { $lines = array_values($this->linesAvailable(NULL, $mac_id)); - + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $ext . "', '" . $lines[0]['value'] . "', '" . addslashes($displayname) . "')"; sql($sql); - + $this->message['add_line'] = "Added '" . $name . "' to line '" . $lines[0]['value'] . "' on device '" . $reg[0]['value'] . "'
      Configuration Files will not be Generated until you click Save!"; return($mac_id); } else { @@ -3636,7 +3634,7 @@ function add_line($mac_id, $line=NULL, $ext=NULL, $displayname=NULL) { } else { $name = $displayname; } - + $sql = "INSERT INTO `endpointman_line_list` (`mac_id`, `ext`, `line`, `description`) VALUES ('" . $mac_id . "', '" . $ext . "', '" . $line . "', '" . addslashes($name) . "')"; sql($sql); $this->message['add_line'] .= "Added " . $name . " to line " . $line . "
      "; @@ -3645,25 +3643,25 @@ function add_line($mac_id, $line=NULL, $ext=NULL, $displayname=NULL) { } } - + function linesAvailable($lineid=NULL, $macid=NULL) { if (isset($lineid)) { $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = (SELECT endpointman_mac_list.model FROM endpointman_mac_list, endpointman_line_list WHERE endpointman_line_list.luid = " . $lineid . " AND endpointman_line_list.mac_id = endpointman_mac_list.id)"; - + $sql_l = "SELECT line, mac_id FROM `endpointman_line_list` WHERE luid = " . $lineid; $line = sql($sql_l, 'getRow', DB_FETCHMODE_ASSOC); - + $sql_lu = "SELECT line FROM endpointman_line_list WHERE mac_id = " . $line['mac_id']; } elseif (isset($macid)) { $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = (SELECT model FROM endpointman_mac_list WHERE id =" . $macid . ")"; $sql_lu = "SELECT line FROM endpointman_line_list WHERE mac_id = " . $macid; - + $line['line'] = 0; } - + $max_lines = sql($sql, 'getOne'); $lines_used = sql($sql_lu, 'getAll'); - + for ($i = 1; $i <= $max_lines; $i++) { if ($i == $line['line']) { $temp[$i]['value'] = $i; @@ -3682,8 +3680,8 @@ function linesAvailable($lineid=NULL, $macid=NULL) { return FALSE; } } - - + + /** * This function takes a string and tries to determine if it's a valid mac addess, return FALSE if invalid * @param string $mac The full mac address @@ -3728,13 +3726,13 @@ function mac_check_clean($mac) { return(FALSE); } } - + /** * Display all unused registrations from whatever manager we are using! * @return */ function display_registration_list($line_id=NULL) { - + if (isset($line_id)) { $result = $this->eda->all_unused_registrations(); $line_data = $this->eda->get_line_information($line_id); @@ -3742,7 +3740,7 @@ function display_registration_list($line_id=NULL) { $result = $this->eda->all_unused_registrations(); $line_data = NULL; } - + $i = 1; $temp = array(); foreach ($result as $row) { @@ -3750,17 +3748,17 @@ function display_registration_list($line_id=NULL) { $temp[$i]['text'] = $row['id'] . " --- " . $row['description']; $i++; } - + if (isset($line_data)) { $temp[$i]['value'] = $line_data['ext']; $temp[$i]['text'] = $line_data['ext'] . " --- " . $line_data['description']; $temp[$i]['selected'] = "selected"; } - + return($temp); } - - + + /** * Taken from PHP.net. A list of errors returned when uploading files. * @param $error_code @@ -3786,7 +3784,7 @@ function file_upload_error_message($error_code) { return _('Unknown upload error'); } } - + /** * Send this function an ID from the mac devices list table and you'll get all the information we have on that particular phone * @param integer $mac_id ID number reference from the MySQL database referencing the table endpointman_mac_list @@ -3840,23 +3838,23 @@ function get_phone_info($mac_id=NULL) { return(FALSE); } $sql = "SELECT id FROM endpointman_mac_list WHERE model > 0 AND id =" . $mac_id; - + $res = sql($sql); if ($res->numRows()) { //Returns Brand Name, Brand Directory, Model Name, Mac Address, Extension (FreePBX), Custom Configuration Template, Custom Configuration Data, Product Name, Product ID, Product Configuration Directory, Product Configuration Version, Product XML name, $sql = "SELECT endpointman_mac_list.specific_settings, endpointman_mac_list.config_files_override, endpointman_mac_list.global_user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_mac_list.template_id, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_model_list.template_data, endpointman_model_list.enabled, endpointman_mac_list.global_settings_override FROM endpointman_line_list, endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.id = " . $mac_id; $phone_info = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + if (!$phone_info) { $this->error['get_phone_info'] = "Error with SQL Statement"; } - + //If there is a template associated with this phone then pull that information and put it into the array if ($phone_info['template_id'] > 0) { $sql = "SELECT name, global_custom_cfg_data, config_files_override, global_settings_override FROM endpointman_template_list WHERE id = " . $phone_info['template_id']; $phone_info['template_data_info'] = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); } - + $sql = "SELECT endpointman_line_list.*, sip.data as secret, devices.*, endpointman_line_list.description AS epm_description FROM endpointman_line_list, sip, devices WHERE endpointman_line_list.ext = devices.id AND endpointman_line_list.ext = sip.id AND sip.keyword = 'secret' AND mac_id = " . $mac_id . " ORDER BY endpointman_line_list.line ASC"; $lines_info = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); foreach ($lines_info as $line) { @@ -3868,7 +3866,7 @@ function get_phone_info($mac_id=NULL) { $sql = "SELECT id, mac FROM endpointman_mac_list WHERE id =" . $mac_id; //Phone is unknown, we need to display this to the end user so that they can make corrections $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - + $brand = $this->get_brand_from_mac($row['mac']); if ($brand) { $phone_info['brand_id'] = $brand['id']; @@ -3877,7 +3875,7 @@ function get_phone_info($mac_id=NULL) { $phone_info['brand_id'] = 0; $phone_info['name'] = 'Unknown'; } - + $phone_info['id'] = $mac_id; $phone_info['model_id'] = 0; $phone_info['product_id'] = 0; @@ -3891,7 +3889,7 @@ function get_phone_info($mac_id=NULL) { } return $phone_info; } - + /** * Get the brand from any mac sent to this function * @param string $mac @@ -3902,16 +3900,16 @@ function get_brand_from_mac($mac) { if (!$this->mac_check_clean($mac)) { return(FALSE); } - + //Get the OUI only $oui = substr($this->mac_check_clean($mac), 0, 6); //Find the matching brand model to the oui $oui_sql = "SELECT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_oui_list, endpointman_brand_list WHERE oui LIKE '%" . $oui . "%' AND endpointman_brand_list.id = endpointman_oui_list.brand AND endpointman_brand_list.installed = 1 LIMIT 1"; $brand = sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); - + $res = sql($oui_sql); $brand_count = $res->numRows(); - + if (!$brand_count) { //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. $phone_info['id'] = 0; @@ -3920,19 +3918,19 @@ function get_brand_from_mac($mac) { $phone_info['id'] = $brand['id']; $phone_info['name'] = $brand['name']; } - + return($phone_info); } - - - + + + /** * Prepare and then send the data that Provisioner expects, then take what provisioner gives us and do what it says * @param array $phone_info Everything from get_phone_info * @param bool $reboot Reboot the Phone after write * @param bool $write Write out Directory structure. */ - function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) + function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) { $this->PROVISIONER_BASE = $this->PHONE_MODULES_PATH; //define('PROVISIONER_BASE', $this->PROVISIONER_BASE); @@ -3940,7 +3938,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) if (!class_exists('ProvisionerConfig')) { require($this->PHONE_MODULES_PATH . 'autoload.php'); } - + //Load Provisioner $class = "endpoint_" . $phone_info['directory'] . "_" . $phone_info['cfg_dir'] . '_phone'; $base_class = "endpoint_" . $phone_info['directory'] . '_base'; @@ -3954,10 +3952,10 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) if (!class_exists($class)) { ProvisionerConfig::endpointsAutoload($class); } - + if (class_exists($class)) { $provisioner_lib = new $class(); - + //Determine if global settings have been overridden if ($phone_info['template_id'] > 0) { if (isset($phone_info['template_data_info']['global_settings_override'])) { @@ -3978,25 +3976,25 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) $settings['tz'] = $this->configmod->get('tz'); } } - - - + + + //Tell the system who we are and were to find the data. $provisioner_lib->root_dir = $this->PHONE_MODULES_PATH; $provisioner_lib->engine = 'asterisk'; $provisioner_lib->engine_location = $this->configmod->get('asterisk_location','asterisk'); $provisioner_lib->system = 'unix'; - + //have to because of versions less than php5.3 $provisioner_lib->brand_name = $phone_info['directory']; $provisioner_lib->family_line = $phone_info['cfg_dir']; - - - + + + //Phone Model (Please reference family_data.xml in the family directory for a list of recognized models) //This has to match word for word. I really need to fix this.... $provisioner_lib->model = $phone_info['model']; - + //Timezone try { $provisioner_lib->DateTimeZone = new DateTimeZone($settings['tz']); @@ -4004,7 +4002,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) $this->error['parse_configs'] = 'Error Returned From Timezone Library: ' . $e->getMessage(); return(FALSE); } - + $temp = ""; $template_data = unserialize($phone_info['template_data']); $global_user_cfg_data = unserialize($phone_info['global_user_cfg_data']); @@ -4037,7 +4035,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) } } } - + if (!empty($global_custom_cfg_data)) { if (array_key_exists('data', $global_custom_cfg_data)) { $global_custom_cfg_ari = $global_custom_cfg_data['ari']; @@ -4047,7 +4045,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) $global_custom_cfg_ari = array(); } } - + $new_template_data = array(); $line_ops = array(); if (is_array($global_custom_cfg_data)) { @@ -4082,7 +4080,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) } } } - + if (!$write) { $new_template_data['provision']['type'] = 'dynamic'; $new_template_data['provision']['protocol'] = 'http'; @@ -4094,9 +4092,9 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) $new_template_data['provision']['path'] = $settings['srvip']; $new_template_data['provision']['encryption'] = FALSE; } - + $new_template_data['ntp'] = $settings['ntp']; - + //Overwrite all specific settings variables now if (!empty($phone_info['specific_settings'])) { $specific_settings = unserialize($phone_info['specific_settings']); @@ -4104,24 +4102,24 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) } else { $specific_settings = array(); } - + //Set Variables according to the template_data files included. We can include different template.xml files within family_data.xml also one can create //template_data_custom.xml which will get included or template_data__custom.xml which will also get included //line 'global' will set variables that aren't line dependant - - + + $provisioner_lib->settings = $new_template_data; - + //Loop through Lines! $li = 0; foreach ($phone_info['line'] as $line) { $line_options = is_array($line_ops[$line['line']]) ? $line_ops[$line['line']] : array(); $line_statics = array('line' => $line['line'], 'username' => $line['ext'], 'authname' => $line['ext'], 'secret' => $line['secret'], 'displayname' => $line['description'], 'server_host' => $this->global_cfg['srvip'], 'server_port' => '5060', 'user_extension' => $line['user_extension']); - + $provisioner_lib->settings['line'][$li] = array_merge($line_options, $line_statics); $li++; } - + if (array_key_exists('data', $specific_settings)) { foreach ($specific_settings['data'] as $key => $data) { $default_exp = preg_split("/\|/i", $key); @@ -4169,20 +4167,20 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) } } } - + $provisioner_lib->settings['mac'] = $phone_info['mac']; $provisioner_lib->mac = $phone_info['mac']; - + //Setting a line variable here...these aren't defined in the template_data.xml file yet. however they will still be parsed //and if they have defaults assigned in a future template_data.xml or in the config file using pipes (|) those will be used, pipes take precedence $provisioner_lib->processor_info = "EndPoint Manager Version " . $this->global_cfg['version']; - + // Because every brand is an extension (eventually) of endpoint, you know this function will exist regardless of who it is //Start timer $time_start = microtime(true); - + $provisioner_lib->debug = TRUE; - + try { $returned_data = $provisioner_lib->generate_all_files(); } catch (Exception $e) { @@ -4211,7 +4209,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) return(FALSE); } } - + function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $returned_data) { //Create Directory Structure (If needed) if (isset($provisioner_lib->directory_structure)) { @@ -4240,7 +4238,7 @@ function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $ret } } } - + //Copy Files (If needed) if (isset($provisioner_lib->copy_files)) { foreach ($provisioner_lib->copy_files as $data) { @@ -4264,7 +4262,7 @@ function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $ret } } } - + foreach ($returned_data as $file => $data) { if (((file_exists($write_path . $file)) AND (is_writable($write_path . $file)) AND (!in_array($file, $provisioner_lib->protected_files))) OR (!file_exists($write_path . $file))) { //Move old file to backup @@ -4290,116 +4288,691 @@ function write_configs($provisioner_lib, $reboot, $write_path, $phone_info, $ret return(FALSE); } } - + if ($reboot) { $provisioner_lib->reboot(); } } + + /** + * Custom Means specific to that MAC + * id is either the mac ID (not address) or the template ID + * @param integer $id + * @param integer $custom + */ + function edit_template_display($id, $custom) { + //endpointman_flush_buffers(); + + $alt_configs = NULL; + + if ($custom == 0) { + $sql = "SELECT model_id FROM endpointman_template_list WHERE id=" . $id; + } else { + $sql = "SELECT model FROM endpointman_mac_list WHERE id=" . $id; + } + + $model_id = sql($sql, 'getOne'); + + //Make sure the model data from the local confg files are stored in the database and vice-versa. Serious errors will occur if the database is not in sync with the local file + if (!$this->sync_model($model_id)) { + die("unable to sync local template files - TYPE:" . $custom); + } + + + + + + + + + $dReturn = array(); + + + //Determine if we are dealing with a general template or a specific [for that phone only] template (custom =0 means general) + if ($custom == 0) { + $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_template_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_product_list.short_name, endpointman_product_list.id as product_id, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = " . $id; + } else { + $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_line_list.*, endpointman_model_list.id as model_id, endpointman_model_list.template_data, endpointman_product_list.id as product_id, endpointman_product_list.short_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list, endpointman_line_list WHERE endpointman_mac_list.id=" . $id . " AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; + } + $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); + + + $dReturn['template_editor_display'] = 1; + + //Let the template system know if we are working with a general template or a specific [for that phone only] template + $dReturn['custom'] = $custom; + if ($custom) + { + $dReturn['ext'] = $row['ext']; + } + else + { + $dReturn['template_name'] = $row['name']; + } + $dReturn['product'] = $row['short_name']; + $dReturn['model'] = $row['model_name']; + + if ($ma = $this->models_available($row['model_id'], NULL, $row['product_id'])) { + $dReturn['models_ava'] = $ma; + } + + if (isset($_REQUEST['maxlines'])) { + $areas = $this->areaAvailable($row['model_id'], $_REQUEST['maxlines']); + } else { + $areas = $this->areaAvailable($row['model_id'], 1); + } + $dReturn['area_ava'] = $areas; + + + //Start the display of the html file in the product folder + if ($row['config_files_override'] == "") { + $config_files_saved = ""; + } else { + $config_files_saved = unserialize($row['config_files_override']); + } + $config_files_list = explode(",", $row['config_files']); + $i = 0; + $alt = 0; + + $i = 0; + $b = 0; + $only_configs = array(); + foreach ($config_files_list as $files) { + $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $row['product_id'] . "' AND original_name = '" . $files . "'"; + $alt_configs_list_count = sql($sql); + if (! empty($alt_configs_list_count)) { + $alt_configs_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); + $alt_configs[$i]['name'] = $files; + $files = str_replace(".", "_", $files); + $h = 0; + foreach ($alt_configs_list as $ccf) { + $alt_configs[$i]['list'][$h]['id'] = $ccf['id']; + $cf_key = $files; + if ((isset($config_files_saved[$cf_key])) AND (is_array($config_files_saved)) AND ($config_files_saved[$cf_key] == $ccf['id'])) { + $alt_configs[$i]['list'][$h]['selected'] = 'selected'; + } + $alt_configs[$i]['list'][$h]['name'] = $ccf['name']; + $h++; + } + $alt = 1; + } + else { + $only_configs[$b]['name'] = $files; + $b++; + } + $i++; + } + + $dReturn['only_configs'] = $only_configs; + $dReturn['alt_configs'] = $alt_configs; + $dReturn['alt'] = $alt; + + if (!isset($_REQUEST['maxlines'])) { + $maxlines = 1; + } else { + $maxlines = $_REQUEST['maxlines']; + } + if ($row['template_data'] != "") { + $out = $this->generate_gui_html($row['template_data'], $row['global_custom_cfg_data'], TRUE, NULL, $maxlines); + } else { + $out = "No Template Data has been defined for this Product
      "; + } + + $dReturn['template_editor'] = $out; + $dReturn['hidden_id'] = $row['id']; + $dReturn['hidden_custom'] = $custom; + return $dReturn; + } + + function merge_data($path, $template_list, $maxlines = 12) { + //TODO: fix + foreach ($template_list as $files_data) { + $full_path = $path . $files_data; + if (file_exists($full_path)) { + $temp_files_data = $this->file2json($full_path); + foreach ($temp_files_data['template_data']['category'] as $category) { + $category_name = $category['name']; + foreach ($category['subcategory'] as $subcategory) { + $subcategory_name = $subcategory['name']; + $items_fin = array(); + $items_loop = array(); + $break_count = 0; + foreach ($subcategory['item'] as $item) { + switch ($item['type']) { + case 'loop_line_options': + for ($i = 1; $i <= $maxlines; $i++) { + $var_nam = "lineloop|line_" . $i; + foreach ($item['data']['item'] as $item_loop) { + if ($item_loop['type'] != 'break') { + $z = str_replace("\$", "", $item_loop['variable']); + $items_loop[$var_nam][$z] = $item_loop; + $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); + $items_loop[$var_nam][$z]['default_value'] = $items_loop[$var_nam][$z]['default_value']; + $items_loop[$var_nam][$z]['default_value'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['default_value']); + $items_loop[$var_nam][$z]['line_loop'] = TRUE; + $items_loop[$var_nam][$z]['line_count'] = $i; + } elseif ($item_loop['type'] == 'break') { + $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; + $break_count++; + } + } + } + $items_fin = array_merge($items_fin, $items_loop); + break; + case 'loop': + for ($i = $item['loop_start']; $i <= $item['loop_end']; $i++) { + $name = explode("_", $item['data']['item'][0]['variable']); + $var_nam = "loop|" . str_replace("\$", "", $name[0]) . "_" . $i; + foreach ($item['data']['item'] as $item_loop) { + if ($item_loop['type'] != 'break') { + $z_tmp = explode("_", $item_loop['variable']); + $z = $z_tmp[1]; + $items_loop[$var_nam][$z] = $item_loop; + $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); + $items_loop[$var_nam][$z]['variable'] = str_replace('_', '_' . $i . '_', $items_loop[$var_nam][$z]['variable']); + $items_loop[$var_nam][$z]['default_value'] = isset($items_loop[$var_nam][$z]['default_value']) ? $items_loop[$var_nam][$z]['default_value'] : ''; + $items_loop[$var_nam][$z]['loop'] = TRUE; + $items_loop[$var_nam][$z]['loop_count'] = $i; + } elseif ($item_loop['type'] == 'break') { + $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; + $break_count++; + } + } + } + $items_fin = array_merge($items_fin, $items_loop); + break; + case 'break': + $items_fin['break|' . $break_count]['type'] = 'break'; + $break_count++; + break; + default: + $var_nam = "option|" . str_replace("\$", "", (isset($item['variable'])? $item['variable'] : "")); + $items_fin[$var_nam] = $item; + break; + } + } + if (isset($data['data'][$category_name][$subcategory_name])) { + $old_sc = $data['data'][$category_name][$subcategory_name]; + $sub_cat_data[$category_name][$subcategory_name] = array(); + $sub_cat_data[$category_name][$subcategory_name] = array_merge($old_sc, $items_fin); + } else { + $sub_cat_data[$category_name][$subcategory_name] = $items_fin; + } + } + if (isset($data['data'][$category_name])) { + $old_c = $data['data'][$category_name]; + $new_c = $sub_cat_data[$category_name]; + $sub_cat_data[$category_name] = array(); + $data['data'][$category_name] = array_merge($old_c, $new_c); + } else { + $data['data'][$category_name] = $sub_cat_data[$category_name]; + } + } + } + } + return($data); + } + + /** + * + * @param integer $model model ID + * @param integer $brand brand ID + * @param integer $product product ID + * @return array + */ + function models_available($model=NULL, $brand=NULL, $product=NULL) { + + if ((!isset($oui)) && (!isset($brand)) && (!isset($model))) { + $result1 = $this->eda->all_models(); + } elseif ((isset($brand)) && ($brand != 0)) { + $result1 = $this->eda->all_models_by_brand($brand); + } elseif ((isset($product)) && ($product != 0)) { + $result1 = $this->eda->all_models_by_product($product); + } else { + $result1 = $this->eda->all_models(); + } + + $i = 1; + foreach ($result1 as $row) { + if ($row['id'] == $model) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 'selected'; + } else { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 0; + } + $i++; + } + + if (!isset($temp)) { + if (! $this->configmod->isExiste('new')) { + $this->error['modelsAvailable'] = "You need to enable at least ONE model"; + } + return(FALSE); + } else { + return($temp); + } + } + + + function areaAvailable($model, $area=NULL) { + $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = '" . $model . "'"; + $count = sql($sql, 'getOne'); + + for ($z = 0; $z < $count; $z++) { + $result[$z]['id'] = $z + 1; + $result[$z]['model'] = $z + 1; + } + + $i = 1; + foreach ($result as $row) { + if ($row['id'] == $area) { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 'selected'; + } else { + $temp[$i]['value'] = $row['id']; + $temp[$i]['text'] = $row['model']; + $temp[$i]['selected'] = 0; + } + $i++; + } + + return($temp); + } + + /** + * Generates the Visual Display for the end user + * @param $cfg_data + * @param $custom_cfg_data + * @param $admin + * @param $user_cfg_data + * @return + */ + function generate_gui_html($cfg_data, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $max_lines=3, $ext=NULL) { + //take the data out of the database and turn it back into an array for use + $cfg_data = unserialize($cfg_data); + $template_type = 'GENERAL'; + //Check to see if there is a custom template for this phone already listed in the endpointman_mac_list database + if (!empty($custom_cfg_data)) { + $custom_cfg_data = unserialize($custom_cfg_data); + if (array_key_exists('data', $custom_cfg_data)) { + if (array_key_exists('ari', $custom_cfg_data)) { + $extra_data = $custom_cfg_data['ari']; + } else { + $template_type = 'GLOBAL'; + $extra_data = $custom_cfg_data['freepbx']; + } + $custom_cfg_data = $custom_cfg_data['data']; + } else { + $extra_data = array(); + } + } else { + $custom_cfg_data = array(); + $extra_data = array(); + } + if (isset($user_cfg_data)) { + $user_cfg_data = unserialize($user_cfg_data); + } + + $template_variables_array = array(); + $group_count = 0; + $variables_count = 0; + + foreach ($cfg_data['data'] as $cats_name => $cats) { + if ($admin) { + $group_count++; + $template_variables_array[$group_count]['title'] = $cats_name; + } else { + //Group all ARI stuff into one tab + $template_variables_array[$group_count]['title'] = "Your Phone Settings"; + } + foreach ($cats as $subcat_name => $subcats) { + foreach ($subcats as $item_var => $config_options) { + if (preg_match('/(.*)\|(.*)/i', $item_var, $matches)) { + $type = $matches[1]; + $variable = $matches[2]; + } else { + die('no matches!'); + } + if ($admin) { + //Administration View Only + switch ($type) { + case "lineloop": + //line|1|display_name + foreach ($config_options as $var_name => $var_items) { + $lcount = isset($var_items['line_count']) ? $var_items['line_count'] : $lcount; + $key = "line|" . $lcount . "|" . $var_name; + $items[$variables_count] = $items; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; + $variables_count++; + } + + if ($lcount <= $max_lines) { + $template_variables_array[$group_count]['title'] = "Line Options for Line " . $lcount; + $group_count++; + } else { + unset($template_variables_array[$group_count]); + } + + continue 2; + case "loop": + foreach ($config_options as $var_name => $var_items) { + //loop|remotephonebook_url_0 + $tv = explode('_', $variable); + $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; + $items[$variables_count] = $var_items; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; + $variables_count++; + } + continue 2; + } + } else { + //ARI View Only + switch ($type) { + case "loop_line_options": + //$a is the line number + $sql = "SELECT line FROM endpointman_line_list WHERE ext = " . $ext; + $a = $this->eda->sql($sql, 'getOne'); + //TODO: fix this area + $template_variables_array[$group_count]['data'][$variables_count]['type'] = "break"; + $variables_count++; + continue 2; + case "loop": + foreach ($config_options as $var_name => $var_items) { + $tv = explode('_', $variable); + $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; + if (isset($extra_data[$key])) { + $items[$variables_count] = $var_items; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; + $variables_count++; + } + } + continue 2; + } + } + //Both Views + switch ($config_options['type']) { + case "break": + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $variables_count++; + break; + default: + if (array_key_exists('variable', $config_options)) { + $key = str_replace('$', '', $config_options['variable']); + //TODO: Move this into the sync function + //Checks to see if values are defined in the database, if not then we assume this is a new option and we need a default value here! + if (!isset($custom_cfg_data[$key])) { + //xml2array will take values that have no data and turn them into arrays, we want to avoid the word 'array' as a default value, so we blank it out here if we are an array + if ((array_key_exists('default_value', $config_options)) AND (is_array($config_options['default_value']))) { + $custom_cfg_data[$key] = ""; + } elseif ((array_key_exists('default_value', $config_options)) AND (!is_array($config_options['default_value']))) { + $custom_cfg_data[$key] = $config_options['default_value']; + } + } + if ((!$admin) AND (isset($extra_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $variables_count++; + } elseif ($admin) { + $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); + $variables_count++; + } + } + break; + } + continue; + } + } + } + + return($template_variables_array); + } + + /** + * Generate an array that will get parsed as HTML from an array of values from XML + * @param int $i + * @param array $cfg_data + * @param string $key + * @param array $custom_cfg_data + * @return array + */ + function generate_form_data($i, $cfg_data, $key=NULL, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $extra_data=NULL, $template_type='GENERAL') { + switch ($cfg_data['type']) { + case "input": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $template_variables_array['type'] = "input"; + if (isset($cfg_data['max_chars'])) { + $template_variables_array['max_chars'] = $cfg_data['max_chars']; + } + $template_variables_array['key'] = $key; + $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['description'] = $cfg_data['description']; + break; + + case "radio": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['type'] = "radio"; + $template_variables_array['key'] = $key; + $template_variables_array['description'] = $cfg_data['description']; + $z = 0; + while ($z < count($cfg_data['data'])) { + $template_variables_array['data'][$z]['key'] = $key; + $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; + $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; + if ($cfg_data['data'][$z]['value'] == $num) { + $template_variables_array['data'][$z]['checked'] = 'checked'; + } + $z++; + } + break; + + case "list": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['type'] = "list"; + $template_variables_array['key'] = $key; + $template_variables_array['description'] = $cfg_data['description']; + $z = 0; + while ($z < count($cfg_data['data'])) { + $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; + $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; + if (isset($cfg_data['data'][$z]['disable'])) { + $cfg_data['data'][$z]['disable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['disable']); + $template_variables_array['data'][$z]['disables'] = explode(",", $cfg_data['data'][$z]['disable']); + } + if (isset($cfg_data['data'][$z]['enable'])) { + $cfg_data['data'][$z]['enable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['enable']); + $template_variables_array['data'][$z]['enables'] = explode(",", $cfg_data['data'][$z]['enable']); + } + if ($cfg_data['data'][$z]['value'] == $num) { + $template_variables_array['data'][$z]['selected'] = 'selected'; + } + $z++; + } + break; + + case "checkbox": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['type'] = "checkbox"; + $template_variables_array['key'] = $key; + $template_variables_array['description'] = $cfg_data['description']; + $template_variables_array['checked'] = $custom_cfg_data[$key] ? TRUE : NULL; + $template_variables_array['value'] = $key; + break; + + case "group"; + $template_variables_array['type'] = "group"; + $template_variables_array['description'] = $cfg_data['description']; + break; + + case "header"; + $template_variables_array['type'] = "header"; + $template_variables_array['description'] = $cfg_data['description']; + break; + + case "textarea": + if ((!$admin) && (isset($user_cfg_data[$key]))) { + $custom_cfg_data[$key] = $user_cfg_data[$key]; + } + $template_variables_array['type'] = "textarea"; + if (isset($cfg_data['rows'])) { + $template_variables_array['rows'] = $cfg_data['rows']; + } + if (isset($cfg_data['cols'])) { + $template_variables_array['cols'] = $cfg_data['cols']; + } + $template_variables_array['key'] = $key; + $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; + $template_variables_array['description'] = $cfg_data['description']; + break; + + case "break": + if ($admin) { + $template_variables_array['type'] = "break"; + } else { + $template_variables_array['type'] = "NA"; + } + break; + + default: + $template_variables_array['type'] = "NA"; + break; + } + + if (isset($cfg_data['tooltip'])) { + $template_variables_array['tooltip'] = htmlentities($cfg_data['tooltip']); + } + + if (($this->configmod->get('enable_ari')) AND ($admin) AND ($cfg_data['type'] != "break") AND ($cfg_data['type'] != "group") AND ($template_type == 'GENERAL')) { + + $template_variables_array['aried'] = 1; + $template_variables_array['ari']['key'] = $key; + + if (isset($extra_data[$key])) { + $template_variables_array['ari']['checked'] = "checked"; + } + } + + if ($template_type == 'GLOBAL') { + $template_variables_array['freepbxed'] = 1; + $template_variables_array['freepbx']['key'] = $key; + if (empty($extra_data)) { + $template_variables_array['freepbx']['checked'] = TRUE; + } elseif (isset($extra_data[$key])) { + $template_variables_array['freepbx']['checked'] = TRUE; + } + } + return($template_variables_array); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /********************************************* + ****** CODIGO ANTIGUO -- SIN REVISADO ******** + *********************************************/ + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /********************************************* - ****** CODIGO ANTIGUO -- SIN REVISADO ******** - *********************************************/ - - - - - - - - - - + function download_json($location, $directory=NULL) { $temp_directory = $this->sys_get_temp_dir() . "/epm_temp/"; @@ -4435,104 +5008,9 @@ function download_json($location, $directory=NULL) { } } + - - - - - - function merge_data($path, $template_list, $maxlines = 12) { - //TODO: fix - foreach ($template_list as $files_data) { - $full_path = $path . $files_data; - if (file_exists($full_path)) { - $temp_files_data = $this->file2json($full_path); - foreach ($temp_files_data['template_data']['category'] as $category) { - $category_name = $category['name']; - foreach ($category['subcategory'] as $subcategory) { - $subcategory_name = $subcategory['name']; - $items_fin = array(); - $items_loop = array(); - $break_count = 0; - foreach ($subcategory['item'] as $item) { - switch ($item['type']) { - case 'loop_line_options': - for ($i = 1; $i <= $maxlines; $i++) { - $var_nam = "lineloop|line_" . $i; - foreach ($item['data']['item'] as $item_loop) { - if ($item_loop['type'] != 'break') { - $z = str_replace("\$", "", $item_loop['variable']); - $items_loop[$var_nam][$z] = $item_loop; - $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); - $items_loop[$var_nam][$z]['default_value'] = $items_loop[$var_nam][$z]['default_value']; - $items_loop[$var_nam][$z]['default_value'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['default_value']); - $items_loop[$var_nam][$z]['line_loop'] = TRUE; - $items_loop[$var_nam][$z]['line_count'] = $i; - } elseif ($item_loop['type'] == 'break') { - $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; - $break_count++; - } - } - } - $items_fin = array_merge($items_fin, $items_loop); - break; - case 'loop': - for ($i = $item['loop_start']; $i <= $item['loop_end']; $i++) { - $name = explode("_", $item['data']['item'][0]['variable']); - $var_nam = "loop|" . str_replace("\$", "", $name[0]) . "_" . $i; - foreach ($item['data']['item'] as $item_loop) { - if ($item_loop['type'] != 'break') { - $z_tmp = explode("_", $item_loop['variable']); - $z = $z_tmp[1]; - $items_loop[$var_nam][$z] = $item_loop; - $items_loop[$var_nam][$z]['description'] = str_replace('{$count}', $i, $items_loop[$var_nam][$z]['description']); - $items_loop[$var_nam][$z]['variable'] = str_replace('_', '_' . $i . '_', $items_loop[$var_nam][$z]['variable']); - $items_loop[$var_nam][$z]['default_value'] = isset($items_loop[$var_nam][$z]['default_value']) ? $items_loop[$var_nam][$z]['default_value'] : ''; - $items_loop[$var_nam][$z]['loop'] = TRUE; - $items_loop[$var_nam][$z]['loop_count'] = $i; - } elseif ($item_loop['type'] == 'break') { - $items_loop[$var_nam]['break_' . $break_count]['type'] = 'break'; - $break_count++; - } - } - } - $items_fin = array_merge($items_fin, $items_loop); - break; - case 'break': - $items_fin['break|' . $break_count]['type'] = 'break'; - $break_count++; - break; - default: - $var_nam = "option|" . str_replace("\$", "", $item['variable']); - $items_fin[$var_nam] = $item; - break; - } - } - if (isset($data['data'][$category_name][$subcategory_name])) { - $old_sc = $data['data'][$category_name][$subcategory_name]; - $sub_cat_data[$category_name][$subcategory_name] = array(); - $sub_cat_data[$category_name][$subcategory_name] = array_merge($old_sc, $items_fin); - } else { - $sub_cat_data[$category_name][$subcategory_name] = $items_fin; - } - } - if (isset($data['data'][$category_name])) { - $old_c = $data['data'][$category_name]; - $new_c = $sub_cat_data[$category_name]; - $sub_cat_data[$category_name] = array(); - $data['data'][$category_name] = array_merge($old_c, $new_c); - } else { - $data['data'][$category_name] = $sub_cat_data[$category_name]; - } - } - } - } - return($data); - } - - - - + /** * Send process to run in background @@ -4558,7 +5036,7 @@ function is_process_running($PID) { return(count($ProcessState) >= 2); } - + /** * Uses which to find executables that asterisk can run/use @@ -4596,9 +5074,9 @@ function table_exists($table) { return FALSE; } + - - + /** * Check for valid netmast to avoid security issues @@ -4698,74 +5176,7 @@ function discover_new($netmask, $use_nmap=TRUE) { return !is_array($final) ? FALSE : $final; } - function areaAvailable($model, $area=NULL) { - $sql = "SELECT max_lines FROM endpointman_model_list WHERE id = '" . $model . "'"; - $count = $this->eda->sql($sql, 'getOne'); - - for ($z = 0; $z < $count; $z++) { - $result[$z]['id'] = $z + 1; - $result[$z]['model'] = $z + 1; - } - - $i = 1; - foreach ($result as $row) { - if ($row['id'] == $area) { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 'selected'; - } else { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 0; - } - $i++; - } - - return($temp); - } - - /** - * - * @param integer $model model ID - * @param integer $brand brand ID - * @param integer $product product ID - * @return array - */ - function models_available($model=NULL, $brand=NULL, $product=NULL) { - - if ((!isset($oui)) && (!isset($brand)) && (!isset($model))) { - $result1 = $this->eda->all_models(); - } elseif ((isset($brand)) && ($brand != 0)) { - $result1 = $this->eda->all_models_by_brand($brand); - } elseif ((isset($product)) && ($product != 0)) { - $result1 = $this->eda->all_models_by_product($product); - } else { - $result1 = $this->eda->all_models(); - } - - $i = 1; - foreach ($result1 as $row) { - if ($row['id'] == $model) { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 'selected'; - } else { - $temp[$i]['value'] = $row['id']; - $temp[$i]['text'] = $row['model']; - $temp[$i]['selected'] = 0; - } - $i++; - } - - if (!isset($temp)) { - if (!isset($this->global_cfg['new'])) { - $this->error['modelsAvailable'] = "You need to enable at least ONE model"; - } - return(FALSE); - } else { - return($temp); - } - } + function in_array_recursive($needle, $haystack) { @@ -4779,10 +5190,10 @@ function in_array_recursive($needle, $haystack) { return FALSE; } + + - - - + function display_templates($product_id, $temp_select = NULL) { $i = 0; @@ -4816,14 +5227,14 @@ function validate_json($json) { return(TRUE); } + + + + + + - - - - - - - + function prepare_message_box() { $error_message = NULL; @@ -4862,14 +5273,14 @@ function prepare_message_box() { } } + + + - - - - + function update_device($macid, $model, $template, $luid=NULL, $name=NULL, $line=NULL, $update_lines=TRUE) { $sql = "UPDATE endpointman_mac_list SET model = " . $model . ", template_id = " . $template . " WHERE id = " . $macid; @@ -4968,413 +5379,11 @@ function get_message($function_name) { } - /** - * Custom Means specific to that MAC - * id is either the mac ID (not address) or the template ID - * @param integer $id - * @param integer $custom - */ - function edit_template_display($id, $custom) { - //endpointman_flush_buffers(); - - - $alt_configs = NULL; - - if ($custom == 0) { - $sql = "SELECT model_id FROM endpointman_template_list WHERE id=" . $id; - } else { - $sql = "SELECT model FROM endpointman_mac_list WHERE id=" . $id; - } - - $model_id = $this->eda->sql($sql, 'getOne'); - - //Make sure the model data from the local confg files are stored in the database and vice-versa. Serious errors will occur if the database is not in sync with the local file - if (!$this->sync_model($model_id)) { - die("unable to sync local template files - TYPE:" . $custom); - } - - - //Determine if we are dealing with a general template or a specific [for that phone only] template (custom =0 means general) - if ($custom == 0) { - $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_template_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_product_list.short_name, endpointman_product_list.id as product_id, endpointman_model_list.template_data, endpointman_model_list.id as model_id, endpointman_template_list.* FROM endpointman_product_list, endpointman_model_list, endpointman_template_list WHERE endpointman_product_list.id = endpointman_template_list.product_id AND endpointman_template_list.model_id = endpointman_model_list.id AND endpointman_template_list.id = " . $id; - } else { - $sql = "SELECT endpointman_model_list.max_lines, endpointman_model_list.model as model_name, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.config_files, endpointman_mac_list.*, endpointman_line_list.*, endpointman_model_list.id as model_id, endpointman_model_list.template_data, endpointman_product_list.id as product_id, endpointman_product_list.short_name, endpointman_product_list.cfg_dir, endpointman_brand_list.directory FROM endpointman_brand_list, endpointman_mac_list, endpointman_model_list, endpointman_product_list, endpointman_line_list WHERE endpointman_mac_list.id=" . $id . " AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.model = endpointman_model_list.id AND endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.product_id = endpointman_product_list.id"; - } - - $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); - - $this->tpl->assign("template_editor_display", 1); - echo $this->tpl->draw('global_header'); - //Let the template system know if we are working with a general template or a specific [for that phone only] template - $this->tpl->assign("custom", $custom); - if ($custom) { - $this->tpl->assign("ext", $row['ext']); - } else { - $this->tpl->assign("template_name", $row['name']); - } - $this->tpl->assign("product", $row['short_name']); - $this->tpl->assign("model", $row['model_name']); - - if ($ma = $this->models_available($row['model_id'], NULL, $row['product_id'])) { - $this->tpl->assign("models_ava", $ma); - } - - if (isset($_REQUEST['maxlines'])) { - $areas = $this->areaAvailable($row['model_id'], $_REQUEST['maxlines']); - } else { - $areas = $this->areaAvailable($row['model_id'], 1); - } - - $this->tpl->assign("area_ava", $areas); - //Start the display of the html file in the product folder - if ($row['config_files_override'] == "") { - $config_files_saved = ""; - } else { - $config_files_saved = unserialize($row['config_files_override']); - } - $config_files_list = explode(",", $row['config_files']); - $i = 0; - $alt = 0; - - $i = 0; - $b = 0; - $only_configs = array(); - foreach ($config_files_list as $files) { - $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $row['product_id'] . "' AND original_name = '" . $files . "'"; - $alt_configs_list_count = $this->eda->sql($sql); - if ($alt_configs_list_count->numRows() > 0) { - $alt_configs_list = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - $alt_configs[$i]['name'] = $files; - $files = str_replace(".", "_", $files); - $h = 0; - foreach ($alt_configs_list as $ccf) { - $alt_configs[$i]['list'][$h]['id'] = $ccf['id']; - $cf_key = $files; - if ((isset($config_files_saved[$cf_key])) AND (is_array($config_files_saved)) AND ($config_files_saved[$cf_key] == $ccf['id'])) { - $alt_configs[$i]['list'][$h]['selected'] = 'selected'; - } - $alt_configs[$i]['list'][$h]['name'] = $ccf['name']; - $h++; - } - $alt = 1; - } else { - $only_configs[$b]['name'] = $files; - $b++; - } - $i++; - } - - $this->tpl->assign("only_configs", $only_configs); - $this->tpl->assign("alt_configs", $alt_configs); - $this->tpl->assign("alt", $alt); - if (!isset($_REQUEST['maxlines'])) { - $maxlines = 1; - } else { - $maxlines = $_REQUEST['maxlines']; - } - if ($row['template_data'] != "") { - $out = $this->generate_gui_html($row['template_data'], $row['global_custom_cfg_data'], TRUE, NULL, $maxlines); - } else { - echo "No Template Data has been defined for this Product
      "; - } - - $this->tpl->assign("template_editor", $out); - $this->tpl->assign("hidden_id", $row['id']); - $this->tpl->assign("hidden_custom", $custom); - echo $this->tpl->draw('template_editor'); - - $this->tpl->assign("debug", ""); - } - - /** - * Generates the Visual Display for the end user - * @param $cfg_data - * @param $custom_cfg_data - * @param $admin - * @param $user_cfg_data - * @return - */ - function generate_gui_html($cfg_data, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $max_lines=3, $ext=NULL) { - //take the data out of the database and turn it back into an array for use - $cfg_data = unserialize($cfg_data); - $template_type = 'GENERAL'; - //Check to see if there is a custom template for this phone already listed in the endpointman_mac_list database - if (!empty($custom_cfg_data)) { - $custom_cfg_data = unserialize($custom_cfg_data); - if (array_key_exists('data', $custom_cfg_data)) { - if (array_key_exists('ari', $custom_cfg_data)) { - $extra_data = $custom_cfg_data['ari']; - } else { - $template_type = 'GLOBAL'; - $extra_data = $custom_cfg_data['freepbx']; - } - $custom_cfg_data = $custom_cfg_data['data']; - } else { - $extra_data = array(); - } - } else { - $custom_cfg_data = array(); - $extra_data = array(); - } - if (isset($user_cfg_data)) { - $user_cfg_data = unserialize($user_cfg_data); - } - - $template_variables_array = array(); - $group_count = 0; - $variables_count = 0; - - foreach ($cfg_data['data'] as $cats_name => $cats) { - if ($admin) { - $group_count++; - $template_variables_array[$group_count]['title'] = $cats_name; - } else { - //Group all ARI stuff into one tab - $template_variables_array[$group_count]['title'] = "Your Phone Settings"; - } - foreach ($cats as $subcat_name => $subcats) { - foreach ($subcats as $item_var => $config_options) { - if (preg_match('/(.*)\|(.*)/i', $item_var, $matches)) { - $type = $matches[1]; - $variable = $matches[2]; - } else { - die('no matches!'); - } - if ($admin) { - //Administration View Only - switch ($type) { - case "lineloop": - //line|1|display_name - foreach ($config_options as $var_name => $var_items) { - $lcount = isset($var_items['line_count']) ? $var_items['line_count'] : $lcount; - $key = "line|" . $lcount . "|" . $var_name; - $items[$variables_count] = $items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; - $variables_count++; - } - - if ($lcount <= $max_lines) { - $template_variables_array[$group_count]['title'] = "Line Options for Line " . $lcount; - $group_count++; - } else { - unset($template_variables_array[$group_count]); - } - - continue 2; - case "loop": - foreach ($config_options as $var_name => $var_items) { - //loop|remotephonebook_url_0 - $tv = explode('_', $variable); - $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; - $items[$variables_count] = $var_items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; - $variables_count++; - } - continue 2; - } - } else { - //ARI View Only - switch ($type) { - case "loop_line_options": - //$a is the line number - $sql = "SELECT line FROM endpointman_line_list WHERE ext = " . $ext; - $a = $this->eda->sql($sql, 'getOne'); - //TODO: fix this area - $template_variables_array[$group_count]['data'][$variables_count]['type'] = "break"; - $variables_count++; - continue 2; - case "loop": - foreach ($config_options as $var_name => $var_items) { - $tv = explode('_', $variable); - $key = "loop|" . $tv[0] . "_" . $var_name . "_" . $var_items['loop_count']; - if (isset($extra_data[$key])) { - $items[$variables_count] = $var_items; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $var_items, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $template_variables_array[$group_count]['data'][$variables_count]['looping'] = TRUE; - $variables_count++; - } - } - continue 2; - } - } - //Both Views - switch ($config_options['type']) { - case "break": - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $variables_count++; - break; - default: - if (array_key_exists('variable', $config_options)) { - $key = str_replace('$', '', $config_options['variable']); - //TODO: Move this into the sync function - //Checks to see if values are defined in the database, if not then we assume this is a new option and we need a default value here! - if (!isset($custom_cfg_data[$key])) { - //xml2array will take values that have no data and turn them into arrays, we want to avoid the word 'array' as a default value, so we blank it out here if we are an array - if ((array_key_exists('default_value', $config_options)) AND (is_array($config_options['default_value']))) { - $custom_cfg_data[$key] = ""; - } elseif ((array_key_exists('default_value', $config_options)) AND (!is_array($config_options['default_value']))) { - $custom_cfg_data[$key] = $config_options['default_value']; - } - } - if ((!$admin) AND (isset($extra_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $variables_count++; - } elseif ($admin) { - $template_variables_array[$group_count]['data'][$variables_count] = $this->generate_form_data($variables_count, $config_options, $key, $custom_cfg_data, $admin, $user_cfg_data, $extra_data, $template_type); - $variables_count++; - } - } - break; - } - continue; - } - } - } - - return($template_variables_array); - } - - /** - * Generate an array that will get parsed as HTML from an array of values from XML - * @param int $i - * @param array $cfg_data - * @param string $key - * @param array $custom_cfg_data - * @return array - */ - function generate_form_data($i, $cfg_data, $key=NULL, $custom_cfg_data=NULL, $admin=FALSE, $user_cfg_data=NULL, $extra_data=NULL, $template_type='GENERAL') { - switch ($cfg_data['type']) { - case "input": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $template_variables_array['type'] = "input"; - if (isset($cfg_data['max_chars'])) { - $template_variables_array['max_chars'] = $cfg_data['max_chars']; - } - $template_variables_array['key'] = $key; - $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "radio": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['type'] = "radio"; - $template_variables_array['key'] = $key; - $template_variables_array['description'] = $cfg_data['description']; - $z = 0; - while ($z < count($cfg_data['data'])) { - $template_variables_array['data'][$z]['key'] = $key; - $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; - $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; - if ($cfg_data['data'][$z]['value'] == $num) { - $template_variables_array['data'][$z]['checked'] = 'checked'; - } - $z++; - } - break; - case "list": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['type'] = "list"; - $template_variables_array['key'] = $key; - $template_variables_array['description'] = $cfg_data['description']; - $z = 0; - while ($z < count($cfg_data['data'])) { - $template_variables_array['data'][$z]['value'] = $cfg_data['data'][$z]['value']; - $template_variables_array['data'][$z]['description'] = $cfg_data['data'][$z]['text']; - if (isset($cfg_data['data'][$z]['disable'])) { - $cfg_data['data'][$z]['disable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['disable']); - $template_variables_array['data'][$z]['disables'] = explode(",", $cfg_data['data'][$z]['disable']); - } - if (isset($cfg_data['data'][$z]['enable'])) { - $cfg_data['data'][$z]['enable'] = str_replace('{$count}', $z, $cfg_data['data'][$z]['enable']); - $template_variables_array['data'][$z]['enables'] = explode(",", $cfg_data['data'][$z]['enable']); - } - if ($cfg_data['data'][$z]['value'] == $num) { - $template_variables_array['data'][$z]['selected'] = 'selected'; - } - $z++; - } - break; - case "checkbox": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $num = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['type'] = "checkbox"; - $template_variables_array['key'] = $key; - $template_variables_array['description'] = $cfg_data['description']; - $template_variables_array['checked'] = $custom_cfg_data[$key] ? TRUE : NULL; - $template_variables_array['value'] = $key; - break; - case "group"; - $template_variables_array['type'] = "group"; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "header"; - $template_variables_array['type'] = "header"; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "textarea": - if ((!$admin) && (isset($user_cfg_data[$key]))) { - $custom_cfg_data[$key] = $user_cfg_data[$key]; - } - $template_variables_array['type'] = "textarea"; - if (isset($cfg_data['rows'])) { - $template_variables_array['rows'] = $cfg_data['rows']; - } - if (isset($cfg_data['cols'])) { - $template_variables_array['cols'] = $cfg_data['cols']; - } - $template_variables_array['key'] = $key; - $template_variables_array['value'] = isset($custom_cfg_data[$key]) ? $custom_cfg_data[$key] : $cfg_data['default_value']; - $template_variables_array['description'] = $cfg_data['description']; - break; - case "break": - if ($admin) { - $template_variables_array['type'] = "break"; - } else { - $template_variables_array['type'] = "NA"; - } - break; - default: - $template_variables_array['type'] = "NA"; - break; - } - - if (isset($cfg_data['tooltip'])) { - $template_variables_array['tooltip'] = htmlentities($cfg_data['tooltip']); - } - - if (($this->global_cfg['enable_ari']) AND ($admin) AND ($cfg_data['type'] != "break") AND ($cfg_data['type'] != "group") AND ($template_type == 'GENERAL')) { - - $template_variables_array['aried'] = 1; - $template_variables_array['ari']['key'] = $key; + - if (isset($extra_data[$key])) { - $template_variables_array['ari']['checked'] = "checked"; - } - } + - if ($template_type == 'GLOBAL') { - $template_variables_array['freepbxed'] = 1; - $template_variables_array['freepbx']['key'] = $key; - if (empty($extra_data)) { - $template_variables_array['freepbx']['checked'] = TRUE; - } elseif (isset($extra_data[$key])) { - $template_variables_array['freepbx']['checked'] = TRUE; - } - } - return($template_variables_array); - } + /** * Save template from the template view pain @@ -5524,13 +5533,13 @@ function save_template($id, $custom, $variables) { } } - + function display_configs() { } - + } -?> +?> \ No newline at end of file diff --git a/assets/css/coda-slider-2.0a.css b/assets/css/coda-slider-2.0a.css index 3a6b72cf..376e9510 100644 --- a/assets/css/coda-slider-2.0a.css +++ b/assets/css/coda-slider-2.0a.css @@ -6,44 +6,117 @@ /* Most common stuff you'll need to change */ +.coda-slider-wrapper { + padding: 20px 0 !important; + width: 100% !important; +} - .coda-slider-wrapper { padding: 20px 0 } - .coda-slider { background: #ebebeb } - - /* Use this to keep the slider content contained in a box even when JavaScript is disabled */ - .coda-slider-no-js .coda-slider { height: 200px; overflow: auto !important; padding-right: 20px } - - /* Change the width of the entire slider (without dynamic arrows) */ - .coda-slider, .coda-slider .panel { width: 900px } - - /* Change margin and width of the slider (with dynamic arrows) */ - .coda-slider-wrapper.arrows .coda-slider, .coda-slider-wrapper.arrows .coda-slider .panel { width: 600px } - .coda-slider-wrapper.arrows .coda-slider { margin: 0 10px } - - /* Arrow styling */ - .coda-nav-left a, .coda-nav-right a { background: #000; color: #fff; padding: 5px; width: 100px } - - /* Tab nav */ - .coda-nav ul li a.current { background: #39c } +.coda-slider { + background: #ebebeb !important; + border: solid 1px red !important; +} + +/* Panel padding */ +.coda-slider .panel-wrapper { padding: 20px } - /* Panel padding */ - .coda-slider .panel-wrapper { padding: 20px } +/* Preloader */ +.coda-slider p.loading { + padding: 20px !important; + text-align: center !important; + width: 100% !important; + border: solid 1px red !important; +} + + +.coda-slider-wrapper.arrows .coda-slider { + margin: 0 10px; +} + + + + + + + +/* Tabbed nav */ +.coda-nav ul { + clear: both !important; + display: block !important; + margin: auto !important; + overflow: hidden !important; +} +.coda-nav ul li { + display: inline !important; +} +.coda-nav ul li a { + background: #000 !important; + color: #fff !important; + /*display: block;*/ + /*float: left;*/ + width: 200px !important; + margin-right: 1px !important; + padding: 3px 6px !important; + text-decoration: none !important; + text-align: center !important; +} + +.coda-nav ul li a.current { + background: #39c +} + +.coda-nav-left a, .coda-nav-right a { + background: #000; + color: #fff; + padding: 5px; + width: 100px +} +*/ + + + + + + + + + + + + + + + + +/* Use this to keep the slider content contained in a box even when JavaScript is disabled */ +/* +.coda-slider-no-js .coda-slider { + height: 200px; + overflow: auto !important; + padding-right: 20px +} +*/ +/* Change the width of the entire slider (without dynamic arrows) */ +/* +.coda-slider, .coda-slider .panel { + width: 900px; +} +*/ +/* Change margin and width of the slider (with dynamic arrows) */ +/* +.coda-slider-wrapper.arrows .coda-slider, .coda-slider-wrapper.arrows .coda-slider .panel { + width: 600px; +} + + - /* Preloader */ - .coda-slider p.loading { padding: 20px; text-align: center } /* Don't change anything below here unless you know what you're doing */ - /* Tabbed nav */ - .coda-nav ul { clear: both; display: block; margin: auto; overflow: hidden } - .coda-nav ul li { display: inline } - .coda-nav ul li a { background: #000; color: #fff; display: block; float: left; width: 150px; margin-right: 1px; padding: 3px 6px; text-decoration: none } - - /* Miscellaneous */ - .coda-slider-wrapper { clear: both; overflow: auto } - .coda-slider { float: left; overflow: hidden; position: relative } - .coda-slider .panel { display: block; float: left } - .coda-slider .panel-container { position: relative } - .coda-nav-left, .coda-nav-right { float: left } - .coda-nav-left a, .coda-nav-right a { display: block; text-align: center; text-decoration: none } - \ No newline at end of file +/* Miscellaneous */ + +.coda-slider-wrapper { clear: both; overflow: auto } +.coda-slider { float: left; overflow: hidden; position: relative } +.coda-slider .panel { display: block; float: left } +.coda-slider .panel-container { position: relative } +.coda-nav-left, .coda-nav-right { float: left } +.coda-nav-left a, .coda-nav-right a { display: block; text-align: center; text-decoration: none } diff --git a/assets/css/epm_devices.css b/assets/css/epm_devices.css new file mode 100644 index 00000000..b5734659 --- /dev/null +++ b/assets/css/epm_devices.css @@ -0,0 +1 @@ +@CHARSET "ISO-8859-1"; \ No newline at end of file diff --git a/assets/js/epm_config.js b/assets/js/epm_config.js index 0ef6d37e..f1d8d00c 100644 --- a/assets/js/epm_config.js +++ b/assets/js/epm_config.js @@ -21,12 +21,17 @@ function epm_config_change_tab (nTab = "") { } + + + + + //**** INI: FUNCTION GLOBAL SEC **** function epm_config_select_tab_ajax(idtab) { clearTimeout(v_sTimerUpdateAjax); if (idtab == "") { - fpbxToast('epm_config_select_tab_ajax -> id invalid (' + idtab + ')!','JS!','warning'); + fpbxToast('epm_config_select_tab_ajax -> id no send!','JS!','warning'); return false; } @@ -401,7 +406,7 @@ function epm_config_tab_manager_ajax_get_add_data(data, idtab) function epm_config_tab_manager_bt_update_check_click() { - var urlStr = "config.php?display=epm_config&quietmode=1&module_tab=manager&command=check_for_updates"; + var urlStr = "config.php?display=epm_config&module_tab=manager&command=check_for_updates"; box = epm_global_dialog_action("bt_update_chkeck", urlStr); } @@ -410,7 +415,7 @@ function epm_config_tab_manager_bt(opt, idfw, command) if ((opt == "") || (idfw == "") || (command == "")) { return false; } clearTimeout(v_sTimerUpdateAjax); - var urlStr = "config.php?display=epm_config&quietmode=1&module_tab=manager&command=" + command + "&command_sub=" + opt + "&idfw=" + idfw; + var urlStr = "config.php?display=epm_config&module_tab=manager&command=" + command + "&command_sub=" + opt + "&idfw=" + idfw; box = epm_global_dialog_action("manager_bt", urlStr, null, "Status", 'epm_config_tab_manager_bt_dialog'); } @@ -426,19 +431,16 @@ function epm_config_tab_manager_bt_enable_disable_ajustar(iL0, itemData, level) } else if (level == "L2") { - if ((itemData.fw_type == "install") || (itemData.fw_type == "uninstall")) + if ((itemData.fw_type == "install") || (itemData.fw_type == "remove")) { epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_install", ((itemData.fw_type == "install") ? true : false)); epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_uninstall" , ((itemData.fw_type == "install") ? false : true)); epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_update" , ((itemData.update_fw == 0) ? false : true)); - //epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt-pr-update" , ((itemData.update == 0) ? false : true)); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt-pr-update", false); } else if (itemData.fw_type == "nothing") { epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_install", false); epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_uninstall", false); epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_update", false); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt-pr-update", false); } return; } @@ -582,13 +584,6 @@ function epm_config_tab_manager_html_L2(data, prefijoid, txt, idtab) $(this) .children('.col-md-9') .append( - $('', { - 'type' : 'button', - 'id' : prefijoid + '_bt-pr-update', - 'class' : 'btn btn-default', - 'value' : txt.update - }) - .on( "click", function(){ epm_config_tab_manager_bt('pr_update', data.id, 'firmware'); }), $('', { 'type' : 'button', 'id' : prefijoid + '_bt_fw_install', diff --git a/assets/js/epm_devices.js b/assets/js/epm_devices.js new file mode 100644 index 00000000..c1aa05c6 --- /dev/null +++ b/assets/js/epm_devices.js @@ -0,0 +1,11 @@ +function epm_devices_document_ready () { + +} + +function epm_devices_windows_load (nTab = "") { + +} + +function epm_devices_change_tab (nTab = "") { + +} \ No newline at end of file diff --git a/assets/js/epm_global.js b/assets/js/epm_global.js index dd7198bf..5d2321d7 100644 --- a/assets/js/epm_global.js +++ b/assets/js/epm_global.js @@ -114,7 +114,7 @@ function epm_global_dialog_action(actionname, urlStr, formname = null, titleStr scroll: true, position: { my: "top-175", at: "center", of: window }, open: function (e) { - $('#moduledialogwrapper').html(_('Loading..' ) + ''); + $('#moduledialogwrapper').html(_('Loading...' ) + ''); if (formname == null) { var oData = null; diff --git a/assets/js/jquery.coda-slider-3.0.js b/assets/js/jquery.coda-slider-3.0.js index c7777b80..4dbbfa47 100644 --- a/assets/js/jquery.coda-slider-3.0.js +++ b/assets/js/jquery.coda-slider-3.0.js @@ -28,7 +28,7 @@ if ( typeof Object.create !== 'function' ) { $("body").removeClass("coda-slider-no-js"); //add preloader class (backwards compatible) - $('.coda-slider').prepend('

      Loading...
      loading...

      '); + $('.coda-slider').prepend('

      Loading...
      loading...

      '); // Cache the element self.elem = elem; diff --git a/i18n/es_ES/LC_MESSAGES/endpointman.mo b/i18n/es_ES/LC_MESSAGES/endpointman.mo index 832fdf588483bae6c913daa23b3fe8982a135109..90934f41e8f8ce38aea6d7f3d2cf6e93d65afcc0 100644 GIT binary patch literal 22985 zcmcJW37A}0b?2Y4jcwWS26$n;EnAzd?v}i}y|%hrQrl{&qi)Fy#Nu_;YjsK0Rps}p zB)7&Hmca}TBmoR&2nJ&(EFQ4&!ZH{;G423K24V(6SY~1mj=?}YNnkJuSzvzubMJdq z)!nkmH(%=0?f-lC-SwPv&pG$ptH)0~?A;N+Wrsx3%fafAQM8-qhmKcn6kUB%6rBiO z6R--tnD^I#D*rBU1$ZC$O7NTDE5M(DF9KhDaugj4t_F_)&j$|$FAMoYA%8n~0{Pd1 zM}bxFrQkmBQt%z%Dd1PZ!@(bdtHHkme+@i^kE*{CRDTzM$AO!`7lK!X_v=8FuYsE4 zjiBoNHmG^s4)QPhB!4uYuYj)tp8<~sk2%%T;}j55MQ4K7f#-l4&n@BmL*Po@9|JD~ ze+Iq`Jda7KzwO{lz%mG_q647D`3_KY`!Arz_i<2kdl+P@(HFw|UxCYc{~k!w(UCN+ z^2L!=U>8Lr~-T0;u-B2|Dn{A^$`wYh0%XyZ}`DTfl3; zDk#2x5p>{FpxQm0OpX5-a2$LwsBtHt`gsdD0^SLV?mqx801tuqXM+RaDzFA#0p1Gs zfZqi*oYWT;2(AOgmp$MyU8T%u_kRRMzr&ck@?Q+9 z-{qjju^!wA#^9mgN5P}OkAv#x)1b!jC@6kD1&W^086Hmp)&5#g?OqJ3+?C*&;BHX# zxdnt|(Y@jQn;`$9pYliieiemZ2%ZgUoCBcR-3+S!)u8y>0+)dYK*{$_pvLnaQ1$Kx zN5Rj9?}sC#NAi9$D84vQ?W_ck0?z~~8l4;7WAF&x_k!v-12vAfgX-^t;r)K_fa+WXuN>J_hfhT}Npz7@aH-p!K;>$-swSPY-d3qESpT7u75B?ZLWkjn{(x-!4 zKvZ&cJ$MZGc2IPBKX^2FCwMFi;~r4`K76hp$77)Q{uC&=`X>-pL_Kukz^$O@R|j7N zz7sqV{4gl`d=}LF9|1MrKLJI@CqdEo??K7)k>`7UoD2^0em*Gv-3Usa-VI8A-Un)Y zUjo(7w?WP48So_V=b-3yJW4_9=~VD|@FGy(w}1{Tff~=7!utn6mH(rF-v!m~p%?mo zjt52e)4(#=2T~-u1r&Y03_`l-NpK5z(txLX2^3x40*W8Efzq3gfTGXi;HlvEK+Wfu zp!z-WBA@>%Q2kyAUJed}Yrvbpmx7-FCAWVDI`A(*wexKFe&oeI|1|Jq@`pk3<29hl zmBE*R`$3KG7Vs4CGoa@6)$sm(Q2hTTsQItF#Lw@o;40ql1vQ^@qL6qoCIF>%pzyJ)q?4UqOx2UGC>|F-X(VZ-CxuTnm0J2xfpdMANue=VqSj)eD}pxUW} zYUd5$ec(M{3ci-bB6@xu%)pf+zW?6?MUUSHPY3S>)y_9SSQtGGYJR70^m^kuQ0?Cg zo(6sz)I7ces@`9N(o4^Rn)k9zK|g|8SC@tNoghPtYM|=f4{APt4898d1}OSH3qp!$ z^=40xz2I`*uLm9YF7OrLr$EWi*Fm*+*r?Z6CxL2jIVgRyA>cT8BJbCM(recT{7vvm z-fsqv0>1&O-6ue;zvHj)@_PnISJ8S<^F07w5B@GV2_8ZtYJVpvepSF1fNum>fj5DY z%ez6<{~J*9ETtfQ-3N+(mx7Y#SA#0IA5?p93-2Ea?+*t2I;i#X40sWE*ci4Nyc|3f zd@rbZy&n{vJ_4==KMTGRd=iu#9Kxc~`$|yyV+2(HuLT|00>!^uL5=e};7afxK-GWc zHZLbbpw>kLd?ENIP<(zXsQzyQB}eywM}S`gj|IO2s=ptCn*T3A(etI_$PCyET76LE z?*TQhhe5UTCGa@#F|Z$e0$c_j_v>C>UkXZ&P6IW*jo=C3wV?W~f>VdEj=;yjr?$gO z@;^E0?at9VJl)2@_2kcihk+jhC2#kF$ADi2CHH?7zW)>y|9=kBbkswmM}rxta<2m= zXSas@dqK_nAy9mH4AeY+6yBc&B@f46<#7$D`D_5y|IUCVa0TxTQ1rePJOg|XRQ>OP z;`c8=t*2KYG^&3Q2uq{Qp!$6eD7xMWN}lcq&jvpYUIzXsyq|H6my_!Pz7Bi|-#-W* zuJWMTe+Y!U(f3LE{XS`*J+=QFMS+ahQ%I+h#OH;-wISnSQ1hGbD3J1e1?ewICDIJ( zUr3T$jp0v8sH><>>LJ}tdMl|y`VXW(AnEsI52i;Y%X>*Tl75HuagyZpv!tJrBomSc z{rX71XHTBSqG$d)mWK;S;%(6@fyN&5Yabe}yDuK@p!^aIj^q%|b{UO@Z*3}O!KcR26*N!Bm2 zrzrYI@F(HDMH+NW-KFl772L`$_+Y z^d*vhk9jb8zcM^ar|Ne)X|p|fIXp2uYi%DvdXjV~bNE~E)1+C_yGh?6?I7v*c@L&P zKFssCNM9%IB%ucEr?v9Oq*s%!C%ucL-wmX@>}kOt`utJI`XKlr(&tFOAbp0U-*u#~ z*pvTrA@IJA_nUeCG3lR350HM7q~93n1Ei0V{v+xClJt8o=^OTh9twC1cqZu+q!*CR zC;bNL?WA8LJw-Z!bPnli(pO2}CFyrO>0;7Jq_>c^kbaw_-!r6bq`x73kMzGuZy@P+ zzX#JBZ|3>0N$(GN|2g1I;DPY`rhs1r-xHoY;SYJajP&=U)ucZo9Zrf#qoiMw^cy1m zC(;?Db4k~b?j?PJbSo(#y^f^c5%6cZe~cR7Ye*j>{R!z>l73|m(L2DGgy$6j1%FN& z2=6s;H|admw?p1E*h?BG{g5D>B!t z^S6(zkuZo7WB~hb#VK* z8@VAVwVLr%HF4u{b0!)rm69xT<)p@(dU$PC>a{EyESHtsP%CTJXWh0PqxQNr*$?iE zYbB;Oku)_73RkOcxL!-BUai*myWv)&S}DcNgx;D-E%Pll8cCcQ&889;yM1xBQg-7h zG*f{j?W-kCcg4iEt!^61G26brp?ZxTT67W(X3Zq6WP2A)U_%<$%8~tb!<7`W)zdk* zYDKn+F(p}TRg)@}tl8sMugKPfg5z;%Z@fG4Z>uslxDRfLC_X3ahdr%ol0`!kJKaWx z<2KgQ*|-@EY3fx$lVR4%Hr9b?XeKG`b=zuH`02viG!kLVNET%*E|M|ZMa7iqwh=M4 z=1ppb&&^u1u09R(Yz8Xv+@JLwZtQiNlN1gO)n{iRn5)&9K)qFi=VUdi2pkW!>B{bw z+OcTFY+LAEQOk1U9D@~Yg>b#tobchOJ z#frn819|jFZFu0Sy542!o&6bwQ4;syOvZH%RFV^FgA13DVl&%{=38x z6)3sw%<=@*GUkhfbMeQv=yrXauB5a3<5Vj@8mZa*Jhd&_1FIc0uwVChE2)je1s*Ug`^@wRKbRQk#_fTv$7kXs&p7T&Xz; zSPC6%gyozip12La^m`V5olYx8K-XO$lpAoq{D3Q#O;DPl^{mgK)=-z5(8FV~^sPzs zS~r-XbTqHY%4||^HQgu~30BUAHxR0Alse40joe5K+eH?uolrU0Nk~@G;`5rLt!T7V z*E;l*bcTDox&nF zi%ssR=q;34q_z^F?24@4n%c$si2L?r^&m9^h>Tm+@#%)y>MAo3&QxTZU=l4e!J4%f z8_A3Yk;}=BOhc9it-4vyjA=hs7!#L+XsAn?lGTOcUGpd=q7qpGZ$^g~=aoEPiVqWW zG(YRS+|k~|T&)y*m5r^MEvU6_i`0YohE}EK4YBM;#zO-WJ&TTvt9q%T%;H=aJ@qlQ zac*jHoG63_4-j;7STxog9~~ArFCb%VM8N))gNpP`II%*c^!BSHqZ3M~m*9j%ZCMLz z&vj(U{-A+HWO#vy?2RPCZq;-=TdB^qx!rawjIAPjA+G~Shp)C;8n>Uc#=qBcb<*SC z@sUJE+$$WTvYVPiNQ!X=Rp`cs&!z3MRwdp?X-0LumPDys-{M&osj!Hqa_vvFv4vAM z!IDa9ZsYp((WcQ!BXDUZ+Ei(F>z|%zQ?)*Yps|Gc>-DEw$!qAVutU*iWG}-s^zf7> z(dJ4yiCBAHlW2J%uGHTK2wA+vO5!YOdnC{CpiPm(LGEL06Y;0V$s#4GPDeJp#Hxp+3DX=%Z0egNS>#Ij;Z|{+pwCZ)ZBg%LSzYpMyF`t zVW=!^G6FSNf1Na1G-if7Yir+wt@8HcqE#L~6}ln3x3x>hK0^G##cfG(!u-6ag{tTv z#rlIn8JlBSnHR<;Eo(-jwdwjmZl}E+Dpo~*mqlW(VSk2urWH+}Do zKv8mALr#28@xC*zw$S@|Lz$c&_zkh~!+N4EZ1ZsW*$2wHd7F;prw%_O&?7h~juq2g z-1DtEhlVlj7z$>#gK(=WO$-R0z+BIofk=C2{;&w8eL6RBl$mWb=lcBDTxbeM(CVPTpc)|DJ)zHHIo?t~qwxxYwLS3z1uZ_7BF`4^c(hJTd7HoM`~C=Htp*JeA5IvF9| zKFk(ank6WAWsP6C$&84euO8dtpW`ZeWEL&3V{&8f1=?e!Xt^ZKaEdH|y;?@A zj!8=RtH4J8_GH#aI4sxiu{HVzf+afysfzu(4{B^38(bW6*t%_UWWdu1HH*&x*Qw61 zvv?nK%(tg?)OxS1GG@`0Td9Uv!$=k`h2Np{MZUo+lQ~&B*J1hAx{-+?$Mzpj9((A` zA?4%QPNPClqj1%kS!J3?NVK)izxGzbBwU=d2exf^EsItKybNk~A)nD_q%qLNfUlleweJ#_pHEYkBRr{^tM`vFuEyj2Fy?Zm6Yi_iD@xpCCSgbAgsnp-uy7jMV;@(Lqql|R1^+o7N>&=Xc= zq{tG!=^3;VU_4~A_^ZA50Fa>AjACMGryM4^4>Ek)4kMeY_nYPq$Z*Lm5z=ltDo zm!pFRHt5E0Owwek4*gc*!cVnCLD|KMSvUmR{FE#j_bWB{m_ftEO|8hD2>K`xCmCO{ zYkY8W^R5*OcNx+z6q84_Krlzj+FceO3-%p64A#MpT=t{w_;zzWz%=W5#!cE5+}1qd zuiy&uHRu3EJ-n)rwzE)GG{O3{KWrH_THZCGAqxpDon!GWzXH4r3`F70Os5o_pE7P+ zntK=KYn8oQSwn|O2500^6;6_Oi9&=@eyEQ!(sqbhPM|^=D`v|6^qVI;vA5D_XvF!B zdu+*CO|&eA8euz|@eMA~o_#GUJ=fXNiF~w;m3APuYl6DD6KwXl zCn~~7ft!=~ddq`hU+$(_%_g#4@rIr-DqnLq(<`Nh4+{hnJ1fPV$tBK$i7(c&+AW;N zqUBVKO?<<7Q{5eeCWC|OJ)5N)H=m_w*}IEuyr)qxHI!|jqMT<FB0JbxpMjy^1D25)lZaw4U5j~orE}V-ES$( zcUNcm&Vi9>!-3!wVzI9h`_LM~xp{JOypzcJ7{U_D9k%5RRiQw0a;4=hCYMY3QVsYh za^dkU4;zs-MR8;D)(bkg;DU$tWmMyAuhr2$WWOTV5Hr}&un7|Bmiz7&v2XtjW_Sq( zLVJ@8Z1Cz`8%MW{?3x(8c7%O}e3!~T$gQ1}8NfzTG7T-y zLX6lvIkrVynKd3Cyk-Ao*KB;lF4@kkazLA{ynPyL%ryEcwaOCBsNZ@GU!)NeTSkrN zz9?1~>eSp0;!qe0Z7+6sCzbXVorxfYL_+LO9xGhEwTQs3@gJ^5n(RpriU6=tq_k@7^5BdLl8+}TGnbatykN=A%s%!vRLWur?|bHD84S( zQ0%Dft>Ldz$IvUa;?2`H&$QJZ1tFC$Zf9fYNY|aI^Ou1!+O zKgKf5GA`Os6`wX*kj51UYVAt$E@TcQM8g}rUm7?U20;%nl?ch^9UEu?5mdxhnLYv< ztZf!u#mZt_TO)L!HeS^N}s$|Nomf~1r zkGbWpBw2Kg5-W9#QwF5M!UltREG`cQ45#&m1zi^vB@j}$r2XDWWgsDj&|Qt72>~W= z08Gkk0oYkq6<1bGix43g)S;nU4XF_JLF}@vkevAtnl&}KKdoa;(L|8~Gf-u!8rSwl zIuD9yC$$(BD+>d?2Qls)E%)y9CU(Fr6BE*A?^w3GQtsW*+MV@IvISo@zHPGCpYzmf zy~Ff9;LcjN{=D9GXZNl<*PV6Nz**;?xo-WsbrkH~&K6z7Sd|-^{hTCKY8Tm}B}R3LZSUIUG^S}bK_lAEA$SAsf~iV# z+10(9{Pt9X9j_;Ne{Ox>1%2o9#lQAWz_L<;1^=mF_H#5ObzcizrZSOjoTI$2d4W(*} zg`fhv*it@cne_v%vi^eFvT(*8r#fJY`O|&G&c;XQ?mA@macWd?i8FaCPj0W{6dV0q zIe;pvn@T{b<2#JWC#rXxw-0i>yt_pXBCNk=xZ-j>3+L{tZhDM!bv!Y`I@Y3Z2S2^@ z;JvHQP@=2Ic8=ZM2x1Wg1YXhWXmI{Mq6}${PFjpG6Ne2p zv2wlmvbB}$t4GLI9{Zku0E5IC{eid~N0W8tFysRRv~H2ACi}NSX<<&v=yT5N%Q1Tt zoSTxxR2_RgvA43X?sxV3=I`LdzTS4G!;w7%Le)#QIjR?ZqD3>+S(4)EV>B2?g_6^> z@#Juo$dQj^iEsBl`PQjf+J7k;{;!iyoz4t?K&Vv@{@h6e(&OxX>QbR-MAH|{hfMYyAa4#4fRY9>=&CfyvG1B;-FgMLL6mj#s9F(b~- zv?(Sgu4cGIK!5;8o47e5>%{}X$r~}2=HC?vD^_~A!?Xl z^3E-hN}1y;mR!DY^r4%boedD5vBlyg!rDmpp-xiUK6RE($Iu7|^a!NkdcfHH12!8Z z#_!GPiMtE%&{jW7tvP>}PJcN{pTC1mUYzRu#SfB}$~pf!s6C6?jq{Un^}a-*Dtkxo ze1>!C;<(zk9j-Jm`kdP)rJj)@OrcZiQ*1hL?K;JFEKXoVeXW~l$)eaYm#9_~&fP_T zaO~PE~GRAJP>|+;h6b&|;$rum)eTjnZ zVw5%{_zw&+pO$V}boS^Okkkm}Fz>EQ65g;=*?&Wasn??NgdCMwGa&?SOYC)UISU0x zfATgtgYcJluwPPM)ZU{TWGG>d8oMq`u-lQoZo51t!Ck%%bF=d*w9mLNXCmqkvD$s- zPE~%3B7Bh}6pW8fTruDn2jb6Wr6IUERk?}CJ1U&xPVJ7;>MpN=g#!@oRB$0h-@TTo z(gF4wZgj~y%E0V#Qh5-Fi4e`*!F6%C% z#ZxFPH6}Smx@33!5B5n@(t%t(xnadMjqUMl9O=FW?G}0#>lY4X(8`=XnWkL85l-#$ zFg?>{=ZmPC`xk91aU&6#K{=RAb*TvDVp8&(8g1R75299EmynS!hJ_#OrUsd&8tMan zxL&fjwIPM8NTgZ(Cc%tph+Qew-D+Z9YodvYY&uTIEGo^bAl8nwqM{OVJqpvA2V)tP zNnmNlU)*9r^*P!>5r|tsr9pEt!d(yZbx+Csq z4edGyJz4Bqq8+tXRJ_Dt znMywygFC#|qEN2;@@jUzYp-LLs+sl& z4T^_dX-iU<8ub@Pw8+yI;iE32%>+9)M7mQ^1R3&>gjnduvBG<_IaO8IB%=t;6*(q1 zne>au9E$bhoBI80TKKs6M>)*7IzvC@7fQ^=cI4-a8tt!}4Ebu0BMVR3Qb1LXnc=gq zK4h>~&)#J^xXFyRHOv<-8tsX8;z_1OFDSFz0Yxsjb>f+>^1d6C9XAmaF(+uGizjT% zTawcTDzif>3WCDec9qin1GDIHnP|9a5~9m>fnm9=1?TT}t5H7F^LLag)%+q#9BJcj zdc+iLm(fNivXkjs=-d}I3TZBK>Ui-e!rVM7+`u&x>mf`ebN-5o6b$oNvV!>=wnJ5T z3%(KsVS3~|`T7t0XSO0?y+PArgJSktQJl=#?G^T{W_^r7aGuDUY#^j>+dXA0b$5j> zQSI#JvT%8YgHb!f!5;eSD+=OxQY*@dmDLxmeVz2gn80waCGOY?PAK96f%tzY@|$5P ze4ggK!*-?YKDh2;+|U>PYlnOi*uxtfZphl^TlL6`D}ZC&A9mEN5HG~`KLunFm@BFk zbr>$Ym`lm(&DE9dEp6#6jDG1349-t89&jV=@>m$6$0^H2E~;IC2}GDvUs;_il(~b% z-4~n%DRXwl1T5L3@ZS&GyI@-gWI(c9I{HG7!dc;Fj2SS~V~yPTz@;_k!{3y# z0$E%oK1f@OJQOvmtDVJ?j9HTwe$4w7*#ZYC+ure-;Lzj_9~44=Fh}AVY=X;p#9KMO zCw|tcH(h`G_(F3P>naCut&$Xe+d%UWDYd<0nY$+8R*ahT5j-Q!^EA<+!s^jhg6;DU z%KF0^`kO`qLhIogjl>U8Qp{EkOYjXflO@N}ow;?}*oN&R9W5;wd3Wj2Vfj`|ls;%P zI|sLH+in#gU3cIv=*m84C%#Tm0f|=P`%-v2FIF^jO5Ox@s6>T=^lgxE*{>9n-xdbV;N{`vtU?)v3qZbqq^{x}4O=F;#kQAx59Q_` z3R)i7-oQ8ODJ z+=cNsl?q8N$D-1RqzgWzZ6oRfLy`gZ7+hScV2#a+g_}z{J$m$xVlU7573?4y&&?&Y zH{TSXsk*K#g*!NLn%}*_ZnxC~l{!SwhZPjp!c5s&9p53S zcYsCv_MVA-VSZVr-B-tkX*u0kc>Le7yF#=jJi3=-drJr^D-gE*C}3{Qa7f4hdG%-8 zd}$LvlR|;TZceU_dGxT=#H!$-99pQr9$rc+v;tEXk+|3jv}rA31}8=L6S(gbbAV$` zBcmwxeiY=Bz08`-stKAhe7(kE{mDrFFvu%L+rfGk*-0B z#SAFdJ8HK*u*IzwH1BM9Ny*O2@ZhUUHjT?EKjE=)#o5a@4Q=} zj9W9Tf5M=t_l_|0c2x@D=~(6pwDJGI?1Z{6+KiS*D~I3^)19nH^}DVMQ(TdXol2&a zIO=>66?#21RPPJ3C(&;R{{Yi6Q2vI>=z2gJ@U`nVplU?9Vy! z(rrO(TiT-2a16#iH#frVPyRku@d1w6oh(McfUr_|jSf3qD>Z??TZ*Kp^j&tL#eyvQ0F_qWo?Q4FGt7vZF*i8tz$H0Ge+uWK`tq>x%Lk(_r zA)mp~5G#lB@S@Z>ULP73w;0jJd1=24xGm^}u8R`{bkK?lIP6Ay*uIsF{P0hkHq(;9 zeItg~ao?*Q&&?d!cHe6UHdcqK#EII5E|nJZIzod**mtv=)T92lZ8X{9QR-MVxG<@O zB9l|ZLix7q?1Ug;JN@ zGW!+h@}iTk2}KC)G8mebW9^PrXr?C$CurC^&bzo8hT}lY-@+>qbJ5K(&PG@a{|_IA B%~b#Z delta 6804 zcmaKv34B%6oySku7ZVmEOG1+SfRF?d$OeS4W`$rDAPE7BJa68+2@l>9-g^lIwa?O8 zmll_tN?SKXTLoKiFcr1RP@Aftsa0AW>(aXQ(mC?{EW8uS0^frx;7K?Qeg;Rv zsi{iI-ZG$!n+IiqWWaLiuh9l#{Q5?t-%L{ZIxTfwJLKFdx1K=fIJe zO)QtsL;BZ3iTYho7EZXl4ax=&N=FfuCtxu=2gOGjL|z^&g0j$;phWo&I3MnTa^k~~ zA?hd;lMlLl7s~igpe#HSKZ~VGpjdo491j!g+{zaB#Wq;Ri>smd_(zb#sS{9w@pV`U z--ePkvkaxy!7{i2-UOxpNjMC?1o^2~ct~vh8Hy!SY4BY_Wl@oxlsX-1mD_HGa&i+& z-tL5Afdmv6+yaNg!%)T_ff8I#LdpL(p;+V-mnpoI`DR0zrxebT{I8-S13IDj@T*Wx z{4f+(JP#!X-hi@^ccD!5pHRMM7TXm$P)?Q)B@Gut*+3nXab8#lL+<;>;TYCer>Tf( z&p`3%Yfyak78Fzd-fjOK%Em^KYZ5E7ploC#lm$CrSrQiwya^u5c7kvzDKvuj+aMXM zLQv-aI!tf}sN38R4nYp3j<_GZ4DAa8O0=Gbqv1$$PfnB!WrOKZEK~^XlSA299hC1k z!!gi=^Wb(UmfN3;{bd6u=#T+tp-lKYC=>lRTmvu3b4=R`<-4okaM%TRz&M->--e6e zcp4Z>Rl4kea#7t3C04!-C5s-Ii~UoEVR||YI^H2^$rv@Pz%jK47SUb-`Kc}*2D}%F zrA|Vz(7RC5>aS2NF_zio;+Y7O;an&OErTg=9VCI2H$kPEicoy>Gbpj}78DD-2W8@q zp`2jM0>>4XK@O|(;TX6PdY~6dzJCRZ%le=J4@23|3vT;;mx+;u&Ifa#EVLT>;T2Hs zfs@cqBUnN^1#>jRN=Tfk{ZLH(6qJkTw@@tbDU|s}6g#e)3Rlsd31#CxNE#>9J}P7B zI0Oy&sPjVo(rurIV!8>eF2R%oC&L9$(zX)H2DU=6;9e*jzRPVNgA!~nKsnflki<|M zOXUFg{~9U;wmJx9=cl2V>SZXVJqN|~A3^y}Ep+;Gp-fZ+C&D&JysB*w>#EzK9PAl* z8GI353g3aU(U0K_$^R5WRwkYY<-=wu3kM+asG@HB0F>A`1jQ0Zp?rTF%7lY1e+MVg z{tU|aiHo@l;Bpv+e}WreJN`|?s60kR7R+1XoU|B`Di^B`f=e?ShQ zrj2?Ad z@NFo;mc*`zOO*v>;dM~*yB$h;g`uS1EiUhd5<3sW8hBzE_7@)wU+$bZ8A=Qk!)CYy z%1QRYo$!9x0#jEwCJ#Wa549IckX;Y?MEwxTxO0#zLH!S$01H++LAxBv`^^a|;=8cR z8=#oxK9~-lfWzUhpq%hEDCu(!X2R4}&c;iiv^T*txC_bxeNZ;`5H#RRP}+Zj;^M@V z3MVR;LOFR86c=oSvS25aAnJt@bPvK5cofP4C!lQf3>4Fzhhdmh>5T7!^8H>YmcAXz zJa<7Xl28v&k%9ei9DEMWgs;GQ_!lT?Q$e7}hFW2J5*vfRfG<=#SM;5=&R@Afm?h)k zCGbNiLHL>b{<77M1=HYo$^U99^1(Vd9d_C;xI&?9Y#$Vp-UnraPeF0nb5J(+TPO>C zzDkNe&BIQSzJM<>yDkVLiz zZ9r1m&?dX~`Qurt52HI!%tvh$p_{S5K!L%+PJPpXm_ zmfI(meFSBoeW(~o38Eu*&G~yHhPV%1iEcw;sDDLLB+MuY^>e3UyGg2dqBH2b2(Ml! zV%-)r1`&ShMRX8JdB}nNFQS*aghnztjO5RO#IA(JM%0CVjeIC9F^GrkzqaD;2J~-8 zibnUKCUgMJLQ=ksM%guz0M0?rp+UFr4R{KzM31|D{{p%9E|i_rPM~{P-@c@N2)~A2 zK+m98k(6x?)DK+N!{g|3w|yOa6v?&mV>BO0JlCROC?81z4V9lz$wTYW5|sEVkJ}NM zY?oj0yc^w$?n0ZoE zhnkV3>J?}Nx(a;*U5x@r%FoaZ=oo56uOKOF(DP_7k~IGolJYuw5?zbFiKd_(NaD}F z8SOfca<{U=Wjp*SI_tItooFHYzBDL3=wMT<6xGf;H#?w_O2mcIzYIQWSC9Prw=IF}M9aScnYtb<~TFqEw^`jH*aiz)JXy zY;SE{eT_HUh)3LdOOrQyK3~*Cqmii55a|hoJKa}}6%Bmq;bpBE2wHxlB_b2`UYLbf z1x9O^-;B$khKSz^8ufv&6`TKm3f~nJH0k40(nmRO^s7^Xx_0U#I&<1G9m$xk+oowf zI4v`EzN(6ZLT1=+gd=gIBhnrAdvwY457NBOZgLEH=Wer>UBwJtlIGDJX{9M~D;i>T zMsW~JznONE-km<7|Hky{q;y}@a(3wtL@i%D674PL7}a$fyxIEM8I6luBm z;n63JEA;|TSN}23!C^TuD{7xL+grJzqOsc9lhGcPO<@MpJ-6?P`{Vmr+enC(l5>N>NPnTbM2EgG*x@EbL>NRMXi_>jvIlnv9`IX z(dgimuGOy3`Hs%dP1CzGGj&JqdOet%)|a?XnwX{k(IA+%b(Rh zkpJv3-B!3$|9fGpUQtx8?<-nV^Zy$`Cc6+EwPq*~?EPoap+7B3*BQktwN-2-s?4xa z5sXEQ1~c4k1{q<`U>PmjEMo(Qiv`4YMrE&29oZEQMohnio)ZY$tf(bkZQW4st!u0! z$~Ra+%ZxcA-4`{D7+P(PbQ=xbvAEI97rwYr;Y6=~tGI8C^0A3_%V-ap;TBvE zi5kD^mQc66w!3rl%8hEPy}Q%kixxV*GXXO}kUy`@)7s5ir%-DW2nw_@I!X8lI#A6ooF$;lB+H{1R(Pp$BU z?>^5|CymXZ;UnYCsNs%gH=it=HSr>U+f{8W${mW2hDCeyFBT2z=NH!vYmDg3vUI(B zMY5h)_S0l5Y^*bPc3W|YL;ZG{=Tga1Vm?B^8a-w(;E#B8!IBRrSTQ$xOv7&(eqB(W zKGnF8x<)Ut*%PogZt6|th5GLDy2;hdD~Zc)yU5(oz!6=x^mKpfvTKvF1 zv8I2x*vM12K4AvAh(e}65;J^e)bw#mZmZUo+JdrtP8tie2dxl^ZjrdYNK~#R(`ox6 z{y;~-XZlU-Y`=(jRC9Ni6&>hjt}fHZ4!LkFBWN030Un`&gS!Kvh_dfsL64;uu1y{9 z*xtTe^xCy^hkV_;_BVR_<>~r{l{xyz<$ZcfeT9Cpe%TCG2nE;>hvgE9$O>|!ICsf| z4U2}xztiw7eQRxw4lc<`D%XE)Y|vdzTT)zuy6AtUDJ3bRiTMIiCW>K$PPrdd%>~Qq znd@g~I1wvk6xc&B5^q!;U$Jj7k$o=(xO**sz!ab2l%Ye*7R{({TcC$fAdd!) zeDRjzHCN3ZZb+gbVqbH_+E}^9?AuB|w&|2Uuz6}7;UjmE6(!%ka2XkL8~LrSZo*8= V#)TvSY!YEU+nfBUyXa<8{|n_-h{ON@ diff --git a/i18n/es_ES/LC_MESSAGES/endpointman.po b/i18n/es_ES/LC_MESSAGES/endpointman.po index 77e3b665..f29f0e4f 100644 --- a/i18n/es_ES/LC_MESSAGES/endpointman.po +++ b/i18n/es_ES/LC_MESSAGES/endpointman.po @@ -9,14 +9,14 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-03-03 11:01-0800\n" -"PO-Revision-Date: 2016-02-17 22:48+0100\n" +"POT-Creation-Date: 2016-03-05 22:27+0100\n" +"PO-Revision-Date: 2016-03-05 22:45+0100\n" "Last-Translator: Javier Pastor \n" "Language-Team: \n" +"Language: es_ES\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: es_ES\n" "X-Generator: Poedit 1.8.7\n" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-Basepath: ../../..\n" @@ -25,802 +25,1213 @@ msgstr "" "X-Poedit-SearchPathExcluded-0: _old\n" "X-Poedit-SearchPathExcluded-1: i18n\n" -#: views/epm_advanced_settings.page.php:90 -msgid " - Point your phones to: " -msgstr "" +#: assets/js/epm_global.js:117 views/epm_advanced_manual_upload.page.php:140 +msgid "Loading..." +msgstr "Cargando…" + +#: Endpointman.class.php:141 +msgid "Configuration Directory is not writable!" +msgstr "En el directorio de configuración no se puede escribir!" -#: Endpointman.class.php:2870 -msgid "- Copied %_FILE_% to %_FILETO_%." -msgstr "- Copiado %_FILE_% a %_FILETO_%." +#: Endpointman.class.php:142 +msgid "Please change the location:" +msgstr "Por favor, cambia la ubicación:" -#: Endpointman.class.php:3085 -msgid "- Error Moving %_FILENAME_%!" -msgstr "- Error Moviendo %_FILENAME_%!" +#: Endpointman.class.php:142 Endpointman.class.php:149 +#: Endpointman.class.php:1686 +msgid "Here" +msgstr "Aquí" -#: Endpointman.class.php:2866 -msgid "- Failed To Copy %_FILE_%!" -msgstr "- Error al copiar %_FILE_%!" +#: Endpointman.class.php:143 +msgid "Or run this command on SSH:" +msgstr "O ejecute este comando en SSH:" -#: Endpointman.class.php:3141 -msgid "-- Updating Model Lines................" -msgstr "-- Actualizando Lineas de Modelos................" +#: Endpointman.class.php:149 +msgid "" +"Configuration Directory is not a directory or does not exist! Please change " +"the location here:" +msgstr "" +"Directorio de configuración no es un directorio o no existe! Por favor, " +"cambia la ubicación aquí:" -#: Endpointman.class.php:3152 -msgid "----Old Data Detected! Migrating......" -msgstr "----Antiguos datos detectados! Migrando......" +#: Endpointman.class.php:206 +msgid "No command was sent!" +msgstr "Ningún comando fue enviado!" -#: Endpointman.class.php:3247 -msgid "---Inserting Model %_NAMEMOD_%" -msgstr "---Insertando Modelo %_NAMEMOD_%" +#: Endpointman.class.php:212 Endpointman.class.php:459 +msgid "Invalid section module!" +msgstr "Módulo de sección no válido!" -#: Endpointman.class.php:3243 -msgid "---Updating Model %_NAMEMOD_%" -msgstr "--Actualizando Modelo %_NAMEMOD_%" +#: Endpointman.class.php:242 Endpointman.class.php:305 +#: Endpointman.class.php:323 Endpointman.class.php:351 +#: Endpointman.class.php:379 Endpointman.class.php:388 +#: Endpointman.class.php:418 Endpointman.class.php:431 +msgid "Command not found!" +msgstr "Comando no valido!" -#: Endpointman.class.php:2574 Endpointman.class.php:2600 +#: Endpointman.class.php:251 msgid "" -"Click Here!" +"If we can activate the model set terminals of the models.
      If this " +"model is disabled will not appear in the list of models that can be " +"configured for PBX." msgstr "" +"Si activamos el modelo podremos configurar terminales de dicho modelos. Si " +"esta desactivado este modelo no aparecera en la lista de modelos que se " +"pueden configurar para la PBX." -#: views/epm_advanced_settings.page.php:244 -msgid "ARP Executable Path" -msgstr "Ruta Ejecutable ARP" - -#: Endpointman.class.php:2598 Endpointman.class.php:2599 +#: Endpointman.class.php:252 msgid "" -"Aborting Brand Downloads. Can't Get Master File, Assuming Timeout Issues!" +"The button \"Install Firmware\" installs the necessary files to the server " +"for the terminal alone are updated via TFTP or HTTP.
      The button " +"\"Remove frimware\" delete files server products.
      The button \"Update " +"frimware\" appears if a newer frimware detected on the server and asks if " +"you want to update.
      The \"Update\" button appears when a new version " +"of this model pack is detected." msgstr "" +"El boton \"Instalar Firmware\" instala los archivos necesarios en el " +"servidor para que lo terminales se actualicen solos a traves de HTTP o TFTP." +"
      El boton \"Remover Frimware\" elimina los archivos de los productos " +"del servidor.
      El boton \"Actualizar Frimware\" aparece si se detectado " +"un frimware mas nuevo en el servidor y nos pregunta si deseas actualizar." +"
      El boton \"Actualizar\" aparece cuando se detecta una nueva version " +"de Paquete de este modelo." -#: provisioning/p.php:34 provisioning/p.php:130 -msgid "Access denied!" -msgstr "¡Acceso denegado!" - -#: views/epm_advanced/oui_manager.views.grid.php:27 -msgid "Actions" -msgstr "Accion" - -#: views/epm_advanced/oui_manager.views.grid.php:5 -msgid "Add Custom OUI" -msgstr "Añadir OUI Personalizado" - -#: views/epm_advanced/oui_manager.views.new.modal.php:62 -msgid "Add New" -msgstr "Añadir Nuevo" - -#: Endpointman.class.php:933 -msgid "Add New Template OK!" +#: Endpointman.class.php:253 +msgid "" +"The \"Install\" button installs the configuration package brand models we " +"selected.
      The \"Uninstall\" button removes the package configuration " +"models of the brand selected.
      The \"Update\" button appears if a new " +"version of the package that is already installed to upgrade to the latest " +"version is detected." msgstr "" +"El boton \"Instalar\" instala el paquete de configuracion de los modelos de " +"la marca que seleccionamos.
      El boton \"Desinstalar\" elimina el " +"paquete de configuracion de los modelos de la marca que seleccionamos.
      " +"El boton \"Actualizacion\" aparece si se detecta una nueva version del " +"paquete que esta ya instalado para actualizar a la ultima version." -#: page.epm_advanced.php:19 -msgid "Advanced Settings" -msgstr "Configuración Avanzada" +#: Endpointman.class.php:254 +msgid "New Package Modified" +msgstr "Nuevo paquete Modificado" -#: Endpointman.class.php:2955 -msgid "All Done!" -msgstr "Todo Correcto!" +#: Endpointman.class.php:255 +msgid "Package Last Modified" +msgstr "Paquete última actualización" -#: views/epm_advanced_settings.page.php:428 -msgid "Allow Duplicate Extensions" -msgstr "Permitir extensiones duplicadas" +#: Endpointman.class.php:256 +msgid "Check for Update " +msgstr "Comprobar se hay actualizaciones" -#: views/epm_advanced_settings.page.php:457 -msgid "Allow Saving Over Default Configuration Files" -msgstr "" +#: Endpointman.class.php:257 +msgid "Check Online " +msgstr "Revise en línea" -#: Endpointman.class.php:3058 -msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" -msgstr "Parece ser un archivo JSON válido Provisioner.net ..... Continuando" +#: Endpointman.class.php:258 +msgid "Install" +msgstr "Instalar" -#: views/epm_advanced_settings.page.php:268 -msgid "Asterisk Executable Path" -msgstr "Ruta Ejecutable Asterisk" +#: Endpointman.class.php:259 +msgid "Uninstall" +msgstr "Desisntalar" -#: views/epm_advanced/oui_manager.views.grid.php:25 -#: views/epm_advanced/oui_manager.views.new.modal.php:36 -#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 -msgid "Brand" -msgstr "Marca" +#: Endpointman.class.php:260 views/epm_devices_main.page.php:516 +msgid "Update" +msgstr "Actualizar" -#: views/epm_advanced_manual_upload.page.php:54 -msgid "Brand Package" -msgstr "Paquete de marcas" +#: Endpointman.class.php:261 +msgid "Install Firmware" +msgstr "Instalar Firmware" -#: views/epm_advanced_manual_upload.page.php:90 -msgid "Brand's Available" -msgstr "Marcas disponibles" +#: Endpointman.class.php:262 +msgid "Remove Firmware" +msgstr "Eliminar Firmware" -#: views/epm_config_editor.page.php:7 -msgid "Brands/Modules" -msgstr "Marca/Modelo" +#: Endpointman.class.php:263 +msgid "Update Firmware" +msgstr "Actualizar Firmware" -#: views/epm_advanced_iedl.page.php:78 -msgid "CSV File Format" -msgstr "Formato de archivo CSV" +#: Endpointman.class.php:264 +msgid "Enable" +msgstr "Activar" -#: Endpointman.class.php:1498 Endpointman.class.php:1575 -#: Endpointman.class.php:1734 -msgid "Can Not Find Uploaded Files!" -msgstr "" +#: Endpointman.class.php:265 +msgid "Disable" +msgstr "Desactivar" -#: Endpointman.class.php:3030 -msgid "Can't Find Downloaded File!" -msgstr "No puede encontrar el archivo descargado." +#: Endpointman.class.php:266 Endpointman.class.php:283 +#: Endpointman.class.php:287 +msgid "Ready!" +msgstr "Listo!" -#: views/epm_advanced/oui_manager.views.new.modal.php:61 -msgid "Cancel" -msgstr "Cancelar" +#: Endpointman.class.php:267 Endpointman.class.php:284 +#: Endpointman.class.php:336 Endpointman.class.php:1517 +#: Endpointman.class.php:1595 Endpointman.class.php:3050 +#: lib/epm_system.class.php:190 +msgid "Error!" +msgstr "Error!" -#: Endpointman.class.php:2478 -msgid "Cant find file:" -msgstr "No se puede encontrar el archivo:" +#: Endpointman.class.php:268 +msgid "Update!" +msgstr "Actualizado!" -#: Endpointman.class.php:279 -msgid "Check Online " -msgstr "Revise en línea" +#: Endpointman.class.php:269 Endpointman.class.php:285 +#: Endpointman.class.php:337 +msgid "Saving Changes..." +msgstr "Guardando cambios…" -#: views/epm_config_manager.page.php:10 -msgid "Check for Update" -msgstr "Buscar actualizaciones" +#: Endpointman.class.php:270 Endpointman.class.php:286 +#: Endpointman.class.php:338 +msgid "Saving Changes... Ok!" +msgstr "Guardando cambios… Listo!" -#: Endpointman.class.php:278 -msgid "Check for Update " -msgstr "Comprobar se hay actualizaciones" +#: Endpointman.class.php:271 Endpointman.class.php:288 +msgid "Upload Content!" +msgstr "Actualizar contenido...." -#: Endpointman.class.php:294 +#: Endpointman.class.php:272 msgid "Check for Updates..." msgstr "Buscar actualizaciones..." -#: Endpointman.class.php:295 +#: Endpointman.class.php:273 msgid "Check for Updates... Ok!" msgstr "Buscar actualizaciones... Listo!" -#: Endpointman.class.php:2850 -msgid "Checking MD5sum of Package..." -msgstr "Comprobando MD5sum en Paquete..." +#: Endpointman.class.php:274 +msgid "Update Content..." +msgstr "Actualizar contenido...." -#: Endpointman.class.php:3013 -msgid "Checking MD5sum of Package...." -msgstr "Comprobando MD5sum de paquete..." +#: Endpointman.class.php:275 Endpointman.class.php:289 +#: Endpointman.class.php:339 +msgid "Invalid Option!" +msgstr "Opcion no valida!" -#: Endpointman.class.php:1696 -msgid "Click this link to download:" +#: Endpointman.class.php:278 +msgid "" +"If you select Hide this brand will disappear and all products and models on " +"the list of Install/Uninstall." msgstr "" +"Si selecciona Ocultar desaparecerá esta marca y todos sus productos y " +"modelos en la lista de Instalar/Desinstalar." -#: Endpointman.class.php:916 -msgid "Clone Model is not number!" +#: Endpointman.class.php:279 +msgid "" +"If you select Hide disappear all models of the product selected from the " +"Install/Uninstall list." msgstr "" +"Si selecciona Ocultar desaparecieran todos los modelos del producto " +"seleccionado de la lista Instalar/Desinstalar." -#: Endpointman.class.php:919 -msgid "Clone Model send is negative!" +#: Endpointman.class.php:280 +msgid "If you select Hide disappear this model the Install/Uninstall list." msgstr "" +"Si selecciona Ocultar desaparecieran este modelo de la lista Instalar/" +"Desinstalar." -#: Endpointman.class.php:265 Endpointman.class.php:327 -#: Endpointman.class.php:345 Endpointman.class.php:373 -#: Endpointman.class.php:401 Endpointman.class.php:410 -#: Endpointman.class.php:440 Endpointman.class.php:453 -msgid "Command not found!" -msgstr "Comando no valido!" +#: Endpointman.class.php:281 +msgid "Show" +msgstr "Mostrar" -#: Endpointman.class.php:147 -msgid "" -"Configuration Directory is not a directory or does not exist! Please change " -"the location here:" -msgstr "" -"Directorio de configuración no es un directorio o no existe! Por favor, " -"cambia la ubicación aquí:" +#: Endpointman.class.php:282 +msgid "Hide" +msgstr "Ocultar" -#: Endpointman.class.php:139 -msgid "Configuration Directory is not writable!" -msgstr "En el directorio de configuración no se puede escribir!" +#: Endpointman.class.php:329 Endpointman.class.php:436 +msgid "Tab is not valid!" +msgstr "Tab no es valida!" -#: views/epm_advanced_settings.page.php:81 -msgid "Configuration Type" -msgstr "Tipo de Configuracion" +#: Endpointman.class.php:570 +msgid "Devices" +msgstr "Dispositivos" -#: endpointman.i18n.php:6 endpointman.i18n.php:12 -msgid "Connectivity" -msgstr "" +#: Endpointman.class.php:580 +msgid "Current Templates" +msgstr "Plantillas actuales" -#: Endpointman.class.php:2882 -msgid "Copy Error Detected! Aborting Install!" -msgstr "Detectado error al copiar! Abortada la Instalacion!" +#: Endpointman.class.php:584 +msgid "Template Editor" +msgstr "Editor de plantillas" -#: Endpointman.class.php:3066 -msgid "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." -msgstr "" -"Creando estructura de directorios para la Marca '% _NAME_%' y moviendo " -"archivos..." +#: Endpointman.class.php:594 +msgid "Install/Unistall" +msgstr "Instalar/Desisntalar" -#: Endpointman.class.php:2989 -msgid "Creating EPM temp directory" -msgstr "Creando directorio temporal para EPM" +#: Endpointman.class.php:598 +msgid "Show/Hide" +msgstr "Mostrar/Ocultar" -#: Endpointman.class.php:1524 -msgid "Creating EPM temp directory..." -msgstr "" +#: Endpointman.class.php:608 +msgid "Settings" +msgstr "Configuración" -#: Endpointman.class.php:1602 -msgid "Creating Provisioner Directory..." +#: Endpointman.class.php:612 +msgid "OUI Manager" +msgstr "Administrador OUI" + +#: Endpointman.class.php:616 +msgid "Product Configuration Editor" +msgstr "Editor de configuración de producto" + +#: Endpointman.class.php:620 +msgid "Import/Export My Devices List" +msgstr "Importar/exportar mi lista de dispositivos" + +#: Endpointman.class.php:624 +msgid "Package Import/Export" +msgstr "Paquete de importación/exportación" + +#: Endpointman.class.php:664 +msgid "Removing Phone Modules Directory" msgstr "" -#: Endpointman.class.php:598 -msgid "Current Templates" +#: Endpointman.class.php:668 +msgid "Removing symlink to web provisioner" msgstr "" -#: views/epm_advanced/poce.views.button.up.files.php:19 -msgid "Custom Template Files" -msgstr "Archivos de plantilla personalizada" +#: Endpointman.class.php:676 +msgid "Dropping all relevant tables" +msgstr "" -#: views/epm_advanced_settings.page.php:305 -msgid "Default Mirror FreePBX" -msgstr "Mirror por defecto de FreePBX" +#: Endpointman.class.php:736 +msgid "ID Producto not is number" +msgstr "ID Producto no es numero" -#: views/epm_advanced/poce.views.textarea.file.php:36 -msgid "Delete" -msgstr "Borrar" +#: Endpointman.class.php:751 +msgid "ID Brand not is numbre" +msgstr "ID Marca no es numero" -#: Endpointman.class.php:889 -msgid "Delete Template OK!" +#: Endpointman.class.php:861 Endpointman.class.php:930 +msgid "No send ID!" +msgstr "No se ha enviado ID!" + +#: Endpointman.class.php:864 +msgid "ID is not number!" +msgstr "ID no es numero!" + +#: Endpointman.class.php:867 +msgid "ID send is negative!" msgstr "" -#: views/epm_advanced_settings.page.php:56 -#: views/epm_advanced_settings.page.php:191 -msgid "Determine for Me" -msgstr "Determinar por mí" +#: Endpointman.class.php:877 +msgid "Delete Template OK!" +msgstr "Eliminacion Plantilla OK!" -#: Endpointman.class.php:588 -msgid "Devices" +#: Endpointman.class.php:886 +msgid "No send Name!" +msgstr "No se ha enviado NOMBRE!" + +#: Endpointman.class.php:889 +msgid "Name is null!" msgstr "" -#: Endpointman.class.php:1965 -msgid "Directory Not Writable!" +#: Endpointman.class.php:892 +msgid "No send Product!" msgstr "" -#: Endpointman.class.php:1490 -msgid "Directory no exists: " +#: Endpointman.class.php:895 +msgid "Product is not number!" msgstr "" -#: Endpointman.class.php:287 -msgid "Disable" -msgstr "Desactivar" +#: Endpointman.class.php:898 +msgid "Product send is negative!" +msgstr "" -#: views/epm_advanced_settings.page.php:515 -msgid "Disable Configuration File Backups" -msgstr "Desactivar las copias de seguridad del archivo de configuración" +#: Endpointman.class.php:901 +msgid "No send Clone Model!" +msgstr "" -#: views/epm_advanced_settings.page.php:486 -msgid "Disable TFTP Server Check" -msgstr "Desactivar comprobación de servidor TFTP" +#: Endpointman.class.php:904 +msgid "Clone Model is not number!" +msgstr "" -#: views/epm_advanced_settings.page.php:399 -msgid "Disable Tooltips" -msgstr "Desactivar las sugerencias" +#: Endpointman.class.php:907 +msgid "Clone Model send is negative!" +msgstr "" -#: Endpointman.class.php:1526 Endpointman.class.php:1540 -#: Endpointman.class.php:1599 Endpointman.class.php:1604 -#: Endpointman.class.php:1619 Endpointman.class.php:1695 -#: Endpointman.class.php:1790 Endpointman.class.php:2834 -#: Endpointman.class.php:2846 Endpointman.class.php:2887 -#: Endpointman.class.php:2919 Endpointman.class.php:2973 -#: Endpointman.class.php:3001 Endpointman.class.php:3008 -#: Endpointman.class.php:3015 Endpointman.class.php:3019 -#: Endpointman.class.php:3092 Endpointman.class.php:3172 -#: Endpointman.class.php:3208 Endpointman.class.php:3237 -#: Endpointman.class.php:3284 Endpointman.class.php:3295 -#: Endpointman.class.php:3305 -msgid "Done!" -msgstr "Correcto!" +#: Endpointman.class.php:921 +msgid "Add New Template OK!" +msgstr "" -#: views/epm_advanced_manual_upload.page.php:13 -msgid "Download updated releases from " -msgstr "Descarga actualizada liberado de" +#: Endpointman.class.php:933 Endpointman.class.php:2132 +#: Endpointman.class.php:2267 +msgid "ID send is not number!" +msgstr "ID enviado no es numero!" -#: Endpointman.class.php:2997 -msgid "Downloading Brand JSON....." -msgstr "Descargando JSON Marca...." +#: Endpointman.class.php:936 +msgid "ID send is number not valid!" +msgstr "" -#: Endpointman.class.php:3006 -msgid "Downloading Brand Package..." -msgstr "Descargando paquete de Marca...." +#: Endpointman.class.php:951 +msgid "Generate list Ok!" +msgstr "" -#: Endpointman.class.php:2828 Endpointman.class.php:2840 -msgid "Downloading firmware..." -msgstr "Descargando Frimware..." +#: Endpointman.class.php:1023 Endpointman.class.php:1114 +#: Endpointman.class.php:1239 Endpointman.class.php:1287 +#: Endpointman.class.php:1381 +msgid "No send Product Select!" +msgstr "" -#: Endpointman.class.php:688 -msgid "Dropping all relevant tables" +#: Endpointman.class.php:1026 Endpointman.class.php:1117 +msgid "Product Select send is not number!" msgstr "" -#: Endpointman.class.php:286 -msgid "Enable" -msgstr "Activar" +#: Endpointman.class.php:1029 Endpointman.class.php:1120 +msgid "Product Select send is number not valid!" +msgstr "" -#: views/epm_advanced_settings.page.php:370 -msgid "Enable Debug Mode" -msgstr "Activar Debug Mode" +#: Endpointman.class.php:1123 +msgid "No send File ID!" +msgstr "" -#: views/epm_advanced_settings.page.php:334 -msgid "Enable FreePBX ARI Module" -msgstr "Activar FreePBX Modulo ARI " +#: Endpointman.class.php:1126 +msgid "No send File Name!" +msgstr "" -#: page.epm_advanced.php:18 page.epm_config.php:18 -msgid "End Point Configuraction Manager" -msgstr "Configurar Administracion End Point" +#: Endpointman.class.php:1129 Endpointman.class.php:1242 +#: Endpointman.class.php:1293 Endpointman.class.php:1384 +msgid "No send Type File!" +msgstr "" -#: functions.inc.php:234 -msgid "End Point Manager" -msgstr "Administracion End Point" +#: Endpointman.class.php:1185 +msgid "File not readable, check the permission! " +msgstr "" -#: provisioning/p.php:33 provisioning/p.php:129 -msgid "Error 403 Forbidden" -msgstr "Error 403 - Prohibido" +#: Endpointman.class.php:1245 Endpointman.class.php:1290 +msgid "No send SendID!" +msgstr "" -#: provisioning/p.php:107 provisioning/p.php:121 -msgid "Error 404 Not Found" -msgstr "Error 404, No encontrado" +#: Endpointman.class.php:1296 +msgid "No send Text File!" +msgstr "" -#: provisioning/p.php:98 -msgid "Error 500 Internal Server Error" -msgstr "Error 500 - Error Interno del Servidor" +#: Endpointman.class.php:1299 +msgid "No send Save Name!" +msgstr "" -#: Endpointman.class.php:3036 -msgid "" -"Error Connecting to the Package Repository. Module not installed. Please Try " -"again later." +#: Endpointman.class.php:1302 +msgid "No send Name File!" msgstr "" -"Error al conectar al repositorio de paquetes. Módulo no instalado. Por favor " -"Inténtalo más tarde." -#: Endpointman.class.php:2991 -msgid "Error creating directory: %_DIR_%" -msgstr "Error al crear el directorio: %_DIR_%" +#: Endpointman.class.php:1305 +msgid "No send Origianl Name File!" +msgstr "" -#: Endpointman.class.php:3033 -msgid "Error download Brand package!" -msgstr "Error de descarga paquete de marcas!" +#: Endpointman.class.php:1387 +msgid "No send SQL Select!" +msgstr "" -#: Endpointman.class.php:2831 Endpointman.class.php:2843 -msgid "Error download frimware package!" -msgstr "Error al descarga paquete del firmware!" +#: Endpointman.class.php:1400 +msgid "Type File not valid!" +msgstr "" -#: Endpointman.class.php:289 Endpointman.class.php:306 -#: Endpointman.class.php:358 Endpointman.class.php:1529 -#: Endpointman.class.php:1607 -msgid "Error!" -msgstr "Error!" +#: Endpointman.class.php:1469 +msgid "List Done!" +msgstr "" -#: Endpointman.class.php:2086 Endpointman.class.php:2123 -msgid "Error: Command not found!" -msgstr "Error: Comando no valido!" +#: Endpointman.class.php:1475 +msgid "Not is directory: " +msgstr "" -#: Endpointman.class.php:2572 -msgid "Error: No Local File for %_name_% !" +#: Endpointman.class.php:1478 +msgid "Directory no exists: " msgstr "" -#: views/epm_advanced_iedl.page.php:99 -msgid "Examples" -msgstr "Ejemplos" +#: Endpointman.class.php:1486 Endpointman.class.php:1563 +#: Endpointman.class.php:1722 +msgid "Can Not Find Uploaded Files!" +msgstr "" -#: views/epm_advanced_settings.page.php:323 -msgid "Experimental" -msgstr "Experimental" +#: Endpointman.class.php:1491 +msgid "Importing brand file %_FILE_%..." +msgstr "" -#: views/epm_advanced_manual_upload.page.php:122 -msgid "Explor a package brand's availables." -msgstr "Exportar paquete de Marcas disponibles." +#: Endpointman.class.php:1512 +msgid "Creating EPM temp directory..." +msgstr "" -#: views/epm_advanced_iedl.page.php:20 -#: views/epm_advanced_manual_upload.page.php:109 -msgid "Export" -msgstr "Exportar" +#: Endpointman.class.php:1514 Endpointman.class.php:1528 +#: Endpointman.class.php:1587 Endpointman.class.php:1592 +#: Endpointman.class.php:1607 Endpointman.class.php:1683 +#: Endpointman.class.php:1778 Endpointman.class.php:2722 +#: Endpointman.class.php:2898 Endpointman.class.php:2931 +#: Endpointman.class.php:2986 Endpointman.class.php:3014 +#: Endpointman.class.php:3028 Endpointman.class.php:3033 +#: Endpointman.class.php:3121 Endpointman.class.php:3126 +#: Endpointman.class.php:3190 Endpointman.class.php:3226 +#: Endpointman.class.php:3255 Endpointman.class.php:3298 +#: Endpointman.class.php:3313 Endpointman.class.php:3323 +msgid "Done!" +msgstr "Correcto!" -#: views/epm_advanced_manual_upload.page.php:79 -msgid "Export Brand Packages" -msgstr "Paquetes de exportación de la marcas" +#: Endpointman.class.php:1523 +msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" +msgstr "" -#: views/epm_advanced_iedl.page.php:6 -msgid "Export CSV" -msgstr "Exportación CSV" +#: Endpointman.class.php:1525 Endpointman.class.php:3030 +msgid "Extracting Tarball........ " +msgstr "" -#: views/epm_advanced_iedl.page.php:16 -msgid "Export CSV file of devices" -msgstr "Archivo CSV exportación de dispositivos" +#: Endpointman.class.php:1534 +msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." +msgstr "" -#: views/epm_advanced_iedl.page.php:26 -msgid "Export data configuracion devices." -msgstr "Exportar datos de configuracion de dispositivo." +#: Endpointman.class.php:1536 +msgid "Looking file and update brand's...." +msgstr "" -#: Endpointman.class.php:1686 -msgid "Exporting %_NAME_%" +#: Endpointman.class.php:1543 +msgid "Please name the Package the same name as your brand!" msgstr "" -#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:95 -msgid "Extension" -msgstr "Extension" +#: Endpointman.class.php:1548 +msgid "No File Provided!" +msgstr "" -#: Endpointman.class.php:1597 -msgid "Extracting Provisioner Package..." +#: Endpointman.class.php:1553 Endpointman.class.php:1614 +msgid "Invalid File Extension!" msgstr "" -#: Endpointman.class.php:1535 -msgid "Extracting Tarball %_FILEPACKAGE_% to %_TEMPDIR_%........" +#: Endpointman.class.php:1568 +msgid "Importing Provisioner file %_FILE_%..." msgstr "" -#: Endpointman.class.php:3017 -msgid "Extracting Tarball........" +#: Endpointman.class.php:1585 +msgid "Extracting Provisioner Package..." msgstr "" -#: Endpointman.class.php:1537 -msgid "Extracting Tarball........ " +#: Endpointman.class.php:1590 +msgid "Creating Provisioner Directory..." msgstr "" -#: functions.inc.php:343 -msgid "Failed to install " -msgstr "Fallo de installacion" +#: Endpointman.class.php:1604 +msgid "Updating Last Modified..." +msgstr "" -#: Endpointman.class.php:3782 -msgid "Failed to write file to disk" +#: Endpointman.class.php:1611 +msgid "File Temp no Exists!" msgstr "" -#: Endpointman.class.php:1752 -msgid "File %_FILE_% size is 0!" +#: Endpointman.class.php:1659 +msgid "No package set!" msgstr "" -#: views/epm_advanced_settings.page.php:86 -msgid "File (TFTP/FTP)" -msgstr "Archivos (TFTP/FTP)" +#: Endpointman.class.php:1662 +msgid "Package not valid!" +msgstr "" -#: Endpointman.class.php:1623 -msgid "File Temp no Exists!" +#: Endpointman.class.php:1671 +msgid "ID Package send not valid, brand not exist!" msgstr "" -#: provisioning/p.php:108 provisioning/p.php:122 -msgid "File not Found!" -msgstr "¡Archivo no encontrado!" +#: Endpointman.class.php:1674 +msgid "Exporting %_NAME_%" +msgstr "" -#: Endpointman.class.php:1197 -msgid "File not readable, check the permission! " +#: Endpointman.class.php:1684 +msgid "Click this link to download:" msgstr "" -#: Endpointman.class.php:3784 -msgid "File upload stopped by extension" +#: Endpointman.class.php:1729 +msgid "Importing CVS file %_FILE_%..." msgstr "" -#: Endpointman.class.php:2891 -msgid "Firmware MD5 didn't match!" -msgstr "MD5 de Frimware no coincide!" +#: Endpointman.class.php:1737 +msgid "We support only CVS and TXT files, type file %_FILE_% no support!" +msgstr "" -#: Endpointman.class.php:3122 -msgid "Firmware Requirment Detected!.........." -msgstr "Requisito firmware detectado .........." +#: Endpointman.class.php:1740 +msgid "File %_FILE_% size is 0!" +msgstr "" -#: views/epm_advanced/poce.views.textarea.file.php:23 -msgid "Full Screen F11" -msgstr "Pantalla Completa F11" +#: Endpointman.class.php:1780 +msgid "Invalid Extension Specified on line %_LINE_%!" +msgstr "" -#: views/epm_advanced_settings.page.php:606 -msgid "GIT Branch" -msgstr "GIT Rama" +#: Endpointman.class.php:1783 +msgid "Invalid Model Specified on line %_LINE_%!" +msgstr "" -#: Endpointman.class.php:963 -msgid "Generate list Ok!" +#: Endpointman.class.php:1786 +msgid "Invalid Brand Specified on line %_LINE_%!" msgstr "" -#: Endpointman.class.php:1947 views/epm_advanced_settings.page.php:23 -msgid "Git not installed!" +#: Endpointman.class.php:1789 +msgid "Invalid Mac on line %_LINE_%!" msgstr "" -#: views/epm_advanced_settings.page.php:114 -msgid "Global Final Config & Firmware Directory" -msgstr "Directorio final de configuracion y firmware" +#: Endpointman.class.php:1796 +msgid "Please reboot & rebuild all imported phones" +msgstr "Por favor, reiniciar y reconstruir todos los teléfonos importados." -#: views/epm_advanced_manual_upload.page.php:97 -msgid "Heads up!" -msgstr "¡Aviso!" +#: Endpointman.class.php:1798 +msgid "Possible file upload attack!" +msgstr "Possible file upload attack!" -#: Endpointman.class.php:140 Endpointman.class.php:147 -#: Endpointman.class.php:1698 -msgid "Here" -msgstr "Aquí" - -#: Endpointman.class.php:304 -msgid "Hide" -msgstr "Ocultar" +#: Endpointman.class.php:1820 +msgid "No ID set!" +msgstr "No se ha enviado ID!" -#: Endpointman.class.php:1835 +#: Endpointman.class.php:1823 msgid "ID not valid!" msgstr "" -#: Endpointman.class.php:763 -msgid "ID Brand not is numbre" -msgstr "ID Marca no es numero" +#: Endpointman.class.php:1842 +msgid "No OUI set!" +msgstr "" -#: Endpointman.class.php:1683 -msgid "ID Package send not valid, brand not exist!" +#: Endpointman.class.php:1845 +msgid "No Brand set!" msgstr "" -#: Endpointman.class.php:748 -msgid "ID Producto not is number" -msgstr "ID Producto no es numero" +#: Endpointman.class.php:1887 Endpointman.class.php:2120 +#: Endpointman.class.php:2251 +msgid "No send name!" +msgstr "No se ha enviado NOMBRE!" -#: Endpointman.class.php:876 -msgid "ID is not number!" -msgstr "" +#: Endpointman.class.php:1890 Endpointman.class.php:2123 +#: Endpointman.class.php:2254 +msgid "No send value!" +msgstr "No se ha enviado VALOR!" -#: Endpointman.class.php:879 -msgid "ID send is negative!" -msgstr "" +#: Endpointman.class.php:1935 views/epm_advanced_settings.page.php:23 +msgid "Git not installed!" +msgstr "GIT no instalado!" -#: Endpointman.class.php:945 Endpointman.class.php:2144 -#: Endpointman.class.php:2279 -msgid "ID send is not number!" -msgstr "ID enviado no es numero!" +#: Endpointman.class.php:1953 +msgid "Directory Not Writable!" +msgstr "Directorio no escribible!" -#: Endpointman.class.php:948 -msgid "ID send is number not valid!" -msgstr "" +#: Endpointman.class.php:1956 +msgid "Not a Vaild Directory.
      Try to run 'mkdir " +msgstr "No es un directorio válido.
      If this " -"model is disabled will not appear in the list of models that can be " -"configured for PBX." -msgstr "" -"Si activamos el modelo podremos configurar terminales de dicho modelos. Si " -"esta desactivado este modelo no aparecera en la lista de modelos que se " -"pueden configurar para la PBX." +#: Endpointman.class.php:2015 +msgid "Name invalid: " +msgstr "Nombre no validao!" -#: Endpointman.class.php:301 -msgid "" -"If you select Hide disappear all models of the product selected from the " -"Install/Uninstall list." -msgstr "" -"Si selecciona Ocultar desaparecieran todos los modelos del producto " -"seleccionado de la lista Instalar/Desinstalar." +#: Endpointman.class.php:2047 Endpointman.class.php:2084 +msgid "Error: Not send command!" +msgstr "Error: No se ha enviado comando!" -#: Endpointman.class.php:302 -msgid "If you select Hide disappear this model the Install/Uninstall list." -msgstr "" -"Si selecciona Ocultar desaparecieran este modelo de la lista Instalar/" -"Desinstalar." +#: Endpointman.class.php:2050 Endpointman.class.php:2087 +msgid "Error: Not send ID!" +msgstr "Error: No se ha enviado ID!" -#: Endpointman.class.php:300 -msgid "" -"If you select Hide this brand will disappear and all products and models on " -"the list of Install/Uninstall." -msgstr "" -"Si selecciona Ocultar desaparecerá esta marca y todos sus productos y " -"modelos en la lista de Instalar/Desinstalar." +#: Endpointman.class.php:2053 Endpointman.class.php:2090 +msgid "Error: ID not is number!" +msgstr "Error: ID no es numero!" -#: views/epm_advanced_iedl.page.php:52 views/epm_advanced_iedl.page.php:60 -#: views/epm_advanced_manual_upload.page.php:32 -#: views/epm_advanced_manual_upload.page.php:62 -msgid "Import" -msgstr "Importar" +#: Endpointman.class.php:2071 Endpointman.class.php:2108 +msgid "Error: Command not found!" +msgstr "Error: Comando no valido!" -#: views/epm_advanced_iedl.page.php:35 -msgid "Import CSV" -msgstr "Importar CSV" +#: Endpointman.class.php:2126 Endpointman.class.php:2261 +msgid "No send id!" +msgstr "No se ha enviado ID!" -#: views/epm_advanced_iedl.page.php:48 -msgid "Import CSV file of devices" -msgstr "Importar archivo CSV de dispositivos" +#: Endpointman.class.php:2129 Endpointman.class.php:2264 +msgid "No send idtype!" +msgstr "No se ha enviado IDType!" -#: views/epm_advanced_manual_upload.page.php:10 -msgid "Import Packages" -msgstr "Importar Paquetes" +#: Endpointman.class.php:2151 Endpointman.class.php:2290 +msgid "IDType invalid: " +msgstr "IDType no valido:" -#: views/epm_advanced_manual_upload.page.php:41 -msgid "Import a package Provisioner in manual mode." -msgstr "Importación de un paquete de Provisioner en el modo manual." +#: Endpointman.class.php:2258 +msgid "Invalid Value!" +msgstr "Valor no valido!" -#: views/epm_advanced_manual_upload.page.php:71 -msgid "Import a package brand in manual mode." -msgstr "Importación de un paquete de la marca en el modo manual." +#: Endpointman.class.php:2442 +msgid "Maximum stack depth exceeded" +msgstr "Se ha excedido la profundidad máxima de la pila" -#: Endpointman.class.php:638 -msgid "Import/Export My Devices List" -msgstr "Importar/exportar mi lista de dispositivos" +#: Endpointman.class.php:2445 +msgid "Underflow or the modes mismatch" +msgstr "JSON con formato incorrecto o inválido" -#: Endpointman.class.php:1741 -msgid "Importing CVS file %_FILE_%..." +#: Endpointman.class.php:2448 +msgid "Unexpected control character found" msgstr "" +"Error del carácter de control, posiblemente se ha codificado de forma " +"incorrecta" -#: Endpointman.class.php:1580 -msgid "Importing Provisioner file %_FILE_%..." -msgstr "" +#: Endpointman.class.php:2451 +msgid "Syntax error, malformed JSON" +msgstr "Error de sintaxis, JSON malformada" -#: Endpointman.class.php:1503 -msgid "Importing brand file %_FILE_%..." +#: Endpointman.class.php:2454 +msgid "Malformed UTF-8 characters, possibly incorrectly encoded" msgstr "" +"Caracteres UTF-8 mal formados, posiblemente codificados de forma incorrecta" -#: Endpointman.class.php:3106 -msgid "Inserting %_BRANDNAME_% brand data.........." -msgstr "Insertando datos de la marca % _BRANDNAME_%.........." - -#: Endpointman.class.php:280 -msgid "Install" -msgstr "Instalar" +#: Endpointman.class.php:2457 +msgid "Unknown error" +msgstr "Error desconocido." -#: Endpointman.class.php:283 -msgid "Install Firmware" -msgstr "Instalar Firmware" +#: Endpointman.class.php:2466 +msgid "Cant find file:" +msgstr "No se puede encontrar el archivo:" -#: Endpointman.class.php:612 -msgid "Install/Unistall" -msgstr "Instalar/Desisntalar" +#: Endpointman.class.php:2486 +msgid "" +"Error: Not able to connect to repository. Using local master file instead." +msgstr "" +"Error: No es capaz de conectarse al repositorio. Usando archivo maestro " +"local." -#: Endpointman.class.php:2859 -msgid "Installing Firmware..." -msgstr "Instalando Frimware..." +#: Endpointman.class.php:2504 +msgid "Not able to connect to repository. Using local Provisioner.net Package" +msgstr "" +"No es capaz de conectarse al repositorio. Usando copia local del paquete " +"Provisioner.net" -#: Endpointman.class.php:3041 -msgid "Installing brands is disabled while in repo mode!" -msgstr "Instalación de marcas se desactiva en el modo de Repo!" +#: Endpointman.class.php:2533 +#, php-format +msgid "Update Brand (%s):" +msgstr "Actualizando Marca (%s):" -#: Endpointman.class.php:1798 -msgid "Invalid Brand Specified on line %_LINE_%!" +#: Endpointman.class.php:2539 +#, php-format +msgid "Not able to connect to repository. Using local brand [%s] file instead." msgstr "" -#: Endpointman.class.php:1792 -msgid "Invalid Extension Specified on line %_LINE_%!" +#: Endpointman.class.php:2569 +#, php-format +msgid "" +"You can not add the mark (%s) as the ID (%d) already exists in the database!" msgstr "" -#: Endpointman.class.php:1565 Endpointman.class.php:1626 -msgid "Invalid File Extension!" +#: Endpointman.class.php:2582 +#, php-format +msgid "Error: No Local File for %s !" msgstr "" -#: Endpointman.class.php:3297 -msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" -msgstr "Inválida estructura JSON en %_PATCH _%/brand_data.json" +#: Endpointman.class.php:2582 Endpointman.class.php:2606 +msgid "Learn how to manually upload packages here (it's easy!):" +msgstr "Aprender cómo cargar manualmente los paquetes aquí (es fácil!):" -#: Endpointman.class.php:3568 -msgid "Invalid MAC Address" -msgstr "Direccion MAC no valida" +#: Endpointman.class.php:2582 Endpointman.class.php:2606 +msgid "Click Here!" +msgstr "Click Aquí!" -#: Endpointman.class.php:1801 -msgid "Invalid Mac on line %_LINE_%!" +#: Endpointman.class.php:2606 +msgid "" +"Error: Aborting Brand Downloads. Can't Get Master File, Assuming Timeout " +"Issues!" msgstr "" +"Error: Abortar Descargas de Marca. No se puede obtener del archivo Maestro, " +"Suponiendo problemas de Timeout!" -#: Endpointman.class.php:3563 -msgid "Invalid Model Selected, Can't Sync System" -msgstr "Seleccionada Modelo no válido, no puede Sistema de sincronización" +#: Endpointman.class.php:2613 +msgid "" +"Error: The Remote Server Is Currently Syncing With the Master Server, Please " +"try again later" +msgstr "" -#: Endpointman.class.php:1795 -msgid "Invalid Model Specified on line %_LINE_%!" +#: Endpointman.class.php:2691 +#, php-format +msgid "Error: System Error in Sync Model [%s] Function, Load Failure!" msgstr "" -#: Endpointman.class.php:297 Endpointman.class.php:311 -#: Endpointman.class.php:361 -msgid "Invalid Option!" -msgstr "Opcion no valida!" +#: Endpointman.class.php:2708 +#, php-format +msgid "Moving/Removing Model '%s' not present in JSON file......" +msgstr "" -#: Endpointman.class.php:2270 -msgid "Invalid Value!" -msgstr "Valor no valido!" +#: Endpointman.class.php:2757 +#, php-format +msgid "Brand Directory '%s' Doesn't Exist! (%s)" +msgstr "Directorio de la marca '%s' no existe! (%s)" -#: views/epm_advanced/oui_manager.views.new.modal.php:55 -msgid "It is the brand of OUI we specified." -msgstr "" +#: Endpointman.class.php:2761 +#, php-format +msgid "Product Directory '%s' Doesn't Exist! (%s)" +msgstr "Directorio de productos '%s' no existe! (%s)" -#: views/epm_advanced_manual_upload.page.php:82 -msgid "Learn how to create your own brand package at " -msgstr "Aprender a crear su propio paquete de la marca en " +#: Endpointman.class.php:2765 +#, php-format +msgid "File 'family_data.json' Doesn't exist in directory: %s" +msgstr "Archivo 'family_data.json' no existe en el directorio: %s" -#: Endpointman.class.php:2573 -msgid "Learn how to manually upload packages here (it's easy!):" -msgstr "" +#: Endpointman.class.php:2827 +msgid "Installa frimware... " +msgstr "Instalando Frimware... " -#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:96 -msgid "Line" -msgstr "Linea" +#: Endpointman.class.php:2844 +msgid "Skipping download, updated local version..." +msgstr "Saltando descarga, version local actualizada..." -#: views/epm_advanced_manual_upload.page.php:97 -msgid "List Bran's Availables empty." -msgstr "Lista de Marcas disponibles vacia." +#: Endpointman.class.php:2846 Endpointman.class.php:2854 +msgid "Downloading firmware..." +msgstr "Descargando Frimware..." -#: Endpointman.class.php:1481 -msgid "List Done!" -msgstr "" +#: Endpointman.class.php:2848 Endpointman.class.php:2856 +msgid "Error download frimware package!" +msgstr "Error al descarga paquete del firmware!" -#: views/epm_config_manager.page.php:19 -msgid "List Packages Manager" -msgstr "Administracion Lista de Paquetes" +#: Endpointman.class.php:2862 +msgid "Checking MD5sum of Package... " +msgstr "Comprobando MD5sum de paquete... " -#: views/epm_advanced/poce.views.bootnav.php:5 -msgid "List Product's Empty" -msgstr "" +#: Endpointman.class.php:2864 +msgid "Matches!" +msgstr "Correcto!" -#: views/epm_advanced_manual_upload.page.php:133 -msgid "List of other exports" -msgstr "Lista de otras exportaciones." +#: Endpointman.class.php:2871 +msgid "Installing Firmware..." +msgstr "Instalando Frimware..." -#: views/epm_advanced_manual_upload.page.php:152 -msgid "List packages generated in other exports." -msgstr "Lista paquetes generados en otras exportaciones." +#: Endpointman.class.php:2879 +#, php-format +msgid "- Failed To Copy %s!" +msgstr "- Error al copiar %s!" -#: views/epm_config_editor.page.php:11 views/epm_config_manager.page.php:23 -msgid "Loading data...." -msgstr "Cargando datos..." +#: Endpointman.class.php:2882 +#, php-format +msgid "- Copied %s to %s." +msgstr "- Copiar %s a %s." -#: assets/js/epm_global.js:117 -msgid "Loading.." -msgstr "Cargando..." +#: Endpointman.class.php:2893 +msgid "Copy Error Detected! Aborting Install!" +msgstr "Detectado error al copiar! Abortada la Instalacion!" -#: views/epm_advanced_manual_upload.page.php:140 -msgid "Loading..." -msgstr "" +#: Endpointman.class.php:2895 +msgid "Info: Please Check Directory/Permissions!" +msgstr "Info: Compruebe los permisos del directorio!" -#: views/epm_advanced/poce.views.button.up.files.php:7 -msgid "Local File Configs" -msgstr "Cargar Archivo de Configuracion" +#: Endpointman.class.php:2902 +msgid "Firmware MD5 didn't match!" +msgstr "MD5 de Frimware no coincide!" -#: views/epm_advanced_settings.page.php:210 -msgid "Local Paths" -msgstr "Rutas Locales" +#: Endpointman.class.php:2906 +msgid "Your Firmware is already up to date." +msgstr "Tu Frimware ya esta actualizado." -#: Endpointman.class.php:1548 -msgid "Looking file and update brand's...." -msgstr "" +#: Endpointman.class.php:2915 +msgid "Uninstalla frimware... " +msgstr "Desisntalando Frimware..." -#: Endpointman.class.php:1546 -msgid "Looking for file %_FILEPACKAGE_% to pass on to update_brand()..." +#: Endpointman.class.php:2939 +msgid "Uninstalla Brand..." +msgstr "Desisntalando Marca..." + +#: Endpointman.class.php:2968 Endpointman.class.php:3108 +#: Endpointman.class.php:3302 +msgid "All Done!" +msgstr "Todo Correcto!" + +#: Endpointman.class.php:2989 +msgid "Error: Not allowed in repo mode!!" +msgstr "Error: No permite en modo de repo!" + +#: Endpointman.class.php:2998 +msgid "Install/Update Brand..." +msgstr "Instalar/Actualizar Marca..." + +#: Endpointman.class.php:3003 +msgid "Creating EPM temp directory" +msgstr "Creando directorio temporal para EPM" + +#: Endpointman.class.php:3005 +#, php-format +msgid "Error: Failed to create the directory '%s', please Check Permissions!" msgstr "" +"Error: No se ha podido crear el directorio '%s', por favor verifique los " +"permisos!" -#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:92 -msgid "MAC Address" -msgstr "Direccion MAC" +#: Endpointman.class.php:3010 +msgid "Downloading Brand JSON..... " +msgstr "Descargando JSON Marca...." + +#: Endpointman.class.php:3019 +msgid "Downloading Brand Package..." +msgstr "Descargando paquete de Marca...." + +#: Endpointman.class.php:3026 +msgid "Checking MD5sum of Package.... " +msgstr "Comprobando MD5sum de paquete... " -#: Endpointman.class.php:3025 +#: Endpointman.class.php:3039 msgid "MD5 Did not match!" msgstr "- MD5 no coincide!" -#: Endpointman.class.php:3027 -msgid "MD5 PKG: %_MD5_%" +#: Endpointman.class.php:3040 +#, php-format +msgid "MD5 XML: %s" +msgstr "MD5 XML: %s" + +#: Endpointman.class.php:3041 +#, php-format +msgid "MD5 PKG: %s" +msgstr "MD5 PKG: %s" + +#: Endpointman.class.php:3044 +msgid "Error: Can't Find Downloaded File!" +msgstr "Error: No puede encontrar el archivo descargado." + +#: Endpointman.class.php:3047 +msgid "Error download Brand package!" +msgstr "Error de descarga paquete de marcas!" + +#: Endpointman.class.php:3051 +msgid "" +"Error Connecting to the Package Repository. Module not installed. Please Try " +"again later." msgstr "" +"Error al conectar al repositorio de paquetes. Módulo no instalado. Por favor " +"Inténtalo más tarde." -#: Endpointman.class.php:3026 -msgid "MD5 XML: %_MD5_%" +#: Endpointman.class.php:3052 +msgid "" +"You Can Also Manually Update The Repository By Downloading Files here: Release Repo " msgstr "" -#: Endpointman.class.php:2466 -msgid "Malformed UTF-8 characters, possibly incorrectly encoded" -msgstr "Malformados caracteres UTF-8, posiblemente incorrectamente codificada" +#: Endpointman.class.php:3053 +msgid "Then Use Manual Upload in Advanced Settings." +msgstr "Utilizar carga Manual en configuración avanzada." -#: Endpointman.class.php:2852 -msgid "Matches!" -msgstr "Correcto!" +#: Endpointman.class.php:3056 +msgid "Error: Installing brands is disabled while in repo mode!" +msgstr "Error: Instalación de marcas se desactiva en el modo de Repo!" -#: Endpointman.class.php:2454 -msgid "Maximum stack depth exceeded" -msgstr "Superó capacidad de la pila máximo" +#: Endpointman.class.php:3065 +#, php-format +msgid "Update Brand %s ... " +msgstr "Actualizando Marca %s ... " -#: Endpointman.class.php:3780 -msgid "Missing a temporary folder" -msgstr "" +#: Endpointman.class.php:3068 +msgid "Processing %_PATH_%/brand_data.json..." +msgstr "Procesando %_PATH_%/brand_data.json..." -#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:94 -msgid "Model" -msgstr "Modelo" +#: Endpointman.class.php:3073 +msgid "Appears to be a valid Provisioner.net JSON file.....Continuing" +msgstr "Parece ser un archivo JSON válido Provisioner.net ..... Continuando" -#: Endpointman.class.php:3267 -msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" +#: Endpointman.class.php:3081 +#, php-format +msgid "Creating Directory Structure for Brand '%s' and Moving Files..." msgstr "" -"Mover/Eliminar Modelo '% _NAMEMOD_%' que no está presente en el archivo " -"JSON......" +"Creando Estructura de Directorios para la Marca '%s' y Moviendo Archivos..." -#: views/epm_advanced_settings.page.php:220 -msgid "NMAP Executable Path" -msgstr "Ruta Ejecutable NMAP" +#: Endpointman.class.php:3101 +#, php-format +msgid "- Error Moving %s!" +msgstr "- Error Moviendo %s!" + +#: Endpointman.class.php:3118 +#, php-format +msgid "Updating %s brand data ..." +msgstr "Actualizando datos de la marca %s ..." + +#: Endpointman.class.php:3123 +#, php-format +msgid "Inserting %s brand data ..." +msgstr "Insertando datos de la marca %s ..." + +#: Endpointman.class.php:3131 +msgid "Updating Family Lines ..." +msgstr "Actualizando líneas de familia ..." + +#: Endpointman.class.php:3140 +msgid "Firmware Requirment Detected!.........." +msgstr "Requisito firmware detectado .........." + +#: Endpointman.class.php:3159 +msgid "-- Updating Model Lines ... " +msgstr "-- Actualizando Lineas de Modelos ... " + +#: Endpointman.class.php:3170 +msgid "----Old Data Detected! Migrating ... " +msgstr "----Antiguos datos detectados! Migrando ... " + +#: Endpointman.class.php:3210 Endpointman.class.php:3235 +msgid "Old Data Detected! Migrating ... " +msgstr "Antiguos datos detectados! Migrando ... " + +#: Endpointman.class.php:3261 +msgid "---Updating Model %_NAMEMOD_%" +msgstr "--Actualizando Modelo %_NAMEMOD_%" + +#: Endpointman.class.php:3265 +msgid "---Inserting Model %_NAMEMOD_%" +msgstr "---Insertando Modelo %_NAMEMOD_%" + +#: Endpointman.class.php:3272 +msgid "Error: System Error in Sync Model Function, Load Failure!" +msgstr "Error: Sistema de sincronización de modelos, Error de Carga!" + +#: Endpointman.class.php:3273 +msgid "Error: " +msgstr "Error: " + +#: Endpointman.class.php:3286 +#, php-format +msgid "Moving/Removing Model '%s' not present in JSON file ... " +msgstr "" +"Mover/Eliminar Modelo '%s' que no está presente en el archivo JSON ... " + +#: Endpointman.class.php:3305 +msgid "Updating OUI list in DB ... " +msgstr "Actualizando la lista de OUI en la DB ... " + +#: Endpointman.class.php:3315 +#, php-format +msgid "Error: Invalid JSON Structure in %s/brand_data.json" +msgstr "Error: Estructura no valida JSON en %s/brand_data.json" + +#: Endpointman.class.php:3318 +msgid "Error: No 'brand_data.xml' file exists!" +msgstr "Error: No existe un archivo 'brand_data.xml'!" + +#: Endpointman.class.php:3321 +msgid "Removing Temporary Files... " +msgstr "Eliminando Archivos Temporales ... " + +#: Endpointman.class.php:3488 +msgid "You Must Select A Model From the Drop Down" +msgstr "Usted debe seleccionar un modelo de la gota de Down" + +#: Endpointman.class.php:3491 +msgid "You Must Select an Extension/Device From the Drop Down" +msgstr "Tu deves seleeciona una Extension/Disposito de listado de abajo" + +#: Endpointman.class.php:3551 +msgid "Invalid Model Selected, Can't Sync System" +msgstr "Seleccionada Modelo no válido, no puede Sistema de sincronización" + +#: Endpointman.class.php:3556 +msgid "Invalid MAC Address" +msgstr "Direccion MAC no valida" + +#: Endpointman.class.php:3589 Endpointman.class.php:3607 +msgid "No Devices/Extensions Left to Add" +msgstr "No hay dispositivos / Extensiones a la izquierdo para Añadir" + +#: Endpointman.class.php:3593 Endpointman.class.php:3611 +msgid "No Lines Left to Add" +msgstr "No hay líneas de a la izquierdo para Añadir" + +#: Endpointman.class.php:3760 +msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" +msgstr "El fichero subido excede la directiva upload_max_filesize de php.ini" + +#: Endpointman.class.php:3762 +msgid "" +"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " +"the HTML form" +msgstr "" +"El fichero subido excede la directiva MAX_FILE_SIZE especificada en el " +"formulario HTML" + +#: Endpointman.class.php:3764 +msgid "The uploaded file was only partially uploaded" +msgstr "El fichero fue sólo parcialmente subido" + +#: Endpointman.class.php:3766 +msgid "No file was uploaded" +msgstr "No se ha cargado el fichero" + +#: Endpointman.class.php:3768 +msgid "Missing a temporary folder" +msgstr "Falta la carpeta temporal" + +#: Endpointman.class.php:3770 +msgid "Failed to write file to disk" +msgstr "No se ha podido escribir el archivo en el disco" + +#: Endpointman.class.php:3772 +msgid "File upload stopped by extension" +msgstr "Una extensión de PHP detuvo la subida de ficheros" + +#: Endpointman.class.php:3774 +msgid "Unknown upload error" +msgstr "Error al subir Desconocido" + +#: Endpointman.class.php:3906 views/epm_devices_main.page.php:122 +msgid "Unknown" +msgstr "Desconocido" + +#: Endpointman.class.php:5339 +msgid "You can't remove the only line left" +msgstr "No se puede quitar la única línea de la izquierda" + +#: _functions.inc.php:234 +msgid "End Point Manager" +msgstr "Administracion End Point" + +#: _functions.inc.php:343 +msgid "Failed to install " +msgstr "Fallo de installacion" + +#: lib/epm_system.class.php:158 lib/epm_system.class.php:188 +#, php-format +msgid "Downloading %s ..." +msgstr "Descargando %s ..." + +#: lib/epm_system.class.php:160 lib/epm_system.class.php:170 +msgid "Complete" +msgstr "Completado" + +#: lib/epm_system.class.php:182 +msgid "Success" +msgstr "Correcto" + +#: page.epm_advanced.php:18 page.epm_config.php:18 page.epm_devices.php:18 +#: page.epm_templates.php:20 +msgid "End Point Configuraction Manager" +msgstr "Configurar Administracion End Point" + +#: page.epm_advanced.php:19 views/epm_devices_main.page.php:39 +msgid "Advanced Settings" +msgstr "Configuración Avanzada" + +#: page.epm_config.php:19 +msgid "Package Manager" +msgstr "Administracion de Paquetes" + +#: page.epm_devices.php:19 +msgid "Device List" +msgstr "" + +#: provisioning/p.php:33 provisioning/p.php:129 +msgid "Error 403 Forbidden" +msgstr "Error 403 - Prohibido" + +#: provisioning/p.php:34 provisioning/p.php:130 +msgid "Access denied!" +msgstr "¡Acceso denegado!" + +#: provisioning/p.php:98 +msgid "Error 500 Internal Server Error" +msgstr "Error 500 - Error Interno del Servidor" + +#: provisioning/p.php:99 +msgid "System Failure!" +msgstr "¡Fallo de sistema!" + +#: provisioning/p.php:107 provisioning/p.php:121 +msgid "Error 404 Not Found" +msgstr "Error 404, No encontrado" + +#: provisioning/p.php:108 provisioning/p.php:122 +msgid "File not Found!" +msgstr "¡Archivo no encontrado!" + +#: views/epm_advanced/oui_manager.views.grid.php:5 +msgid "Add Custom OUI" +msgstr "Añadir OUI Personalizado" + +#: views/epm_advanced/oui_manager.views.grid.php:6 +#: views/epm_templates/manager.views.grid.php:6 +msgid "Refresh Table" +msgstr "Actualizar Tabla" + +#: views/epm_advanced/oui_manager.views.grid.php:24 +#: views/epm_advanced/oui_manager.views.new.modal.php:14 +msgid "OUI" +msgstr "OUI" + +#: views/epm_advanced/oui_manager.views.grid.php:25 +#: views/epm_advanced/oui_manager.views.new.modal.php:36 +#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:93 +#: views/epm_devices_main.page.php:244 views/epm_devices_main.page.php:467 +#: views/epm_devices_main.page.php:518 +msgid "Brand" +msgstr "Marca" + +#: views/epm_advanced/oui_manager.views.grid.php:26 +msgid "Type" +msgstr "Tipo" + +#: views/epm_advanced/oui_manager.views.grid.php:27 +msgid "Actions" +msgstr "Accion" + +#: views/epm_advanced/oui_manager.views.new.modal.php:18 +msgid "OUI Brand" +msgstr "OUI Marca" + +#: views/epm_advanced/oui_manager.views.new.modal.php:26 +msgid "" +"They are the first 6 characters of the MAC device that identifies the brand " +"(manufacturer)." +msgstr "" + +#: views/epm_advanced/oui_manager.views.new.modal.php:41 +#: views/epm_advanced_manual_upload.page.php:101 +msgid "Select Brand:" +msgstr "Seleccionar Marca:" + +#: views/epm_advanced/oui_manager.views.new.modal.php:55 +msgid "It is the brand of OUI we specified." +msgstr "" + +#: views/epm_advanced/oui_manager.views.new.modal.php:61 +#: views/epm_templates/manager.views.new.modal.php:91 +msgid "Cancel" +msgstr "Cancelar" + +#: views/epm_advanced/oui_manager.views.new.modal.php:62 +msgid "Add New" +msgstr "Añadir Nuevo" + +#: views/epm_advanced/poce.views.bootnav.php:3 +msgid "In Developing!!" +msgstr "" + +#: views/epm_advanced/poce.views.button.up.files.php:7 +msgid "Local File Configs" +msgstr "Cargar Archivo de Configuracion" + +#: views/epm_advanced/poce.views.button.up.files.php:19 +msgid "Custom Template Files" +msgstr "Archivos de plantilla personalizada" + +#: views/epm_advanced/poce.views.button.up.files.php:31 +msgid "User File Configs" +msgstr "Usar Archivo de Configuracion" + +#: views/epm_advanced/poce.views.textarea.file.php:5 +#: views/epm_advanced/poce.views.textarea.file.php:24 +msgid "No Selected" +msgstr "No Seleccionado" + +#: views/epm_advanced/poce.views.textarea.file.php:23 +msgid "Full Screen F11" +msgstr "Pantalla Completa F11" + +#: views/epm_advanced/poce.views.textarea.file.php:26 +msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." +msgstr "" +"Nota: Presione F11 para modo pantalla completa, ESC para salir de Pantalla " +"Completa." + +#: views/epm_advanced/poce.views.textarea.file.php:32 +msgid "" +"NOTE: File may be over-written during next package update. We suggest also " +"using the Share button below to improve the next release." +msgstr "" + +#: views/epm_advanced/poce.views.textarea.file.php:35 +#: views/epm_devices_main.page.php:312 +#: views/epm_templates/manager.views.new.modal.php:92 +msgid "Save" +msgstr "Guardar" + +#: views/epm_advanced/poce.views.textarea.file.php:36 +#: views/epm_devices_main.page.php:473 views/epm_devices_main.page.php:491 +#: views/epm_devices_main.page.php:504 views/epm_devices_main.page.php:514 +msgid "Delete" +msgstr "Borrar" #: views/epm_advanced/poce.views.textarea.file.php:42 msgid "" @@ -830,673 +1241,778 @@ msgstr "" "Nota: El archivo se guarda permanentemente y no sobrescribir durante las " "siguientes actualizaciónes de paquetes." -#: views/epm_advanced/poce.views.textarea.file.php:32 +#: views/epm_advanced/poce.views.textarea.file.php:48 +msgid "Save As..." +msgstr "Gardar Como..." + +#: views/epm_advanced/poce.views.textarea.file.php:56 +msgid "" +"Upload this configuration file to the Provisioner.net Team. Files " +"shared are confidential and help improve the quality of releases." +msgstr "" + +#: views/epm_advanced/poce.views.textarea.file.php:59 +msgid "Share" +msgstr "Compartir" + +#: views/epm_advanced_iedl.page.php:6 +msgid "Export CSV" +msgstr "Exportación CSV" + +#: views/epm_advanced_iedl.page.php:16 +msgid "Export CSV file of devices" +msgstr "Archivo CSV exportación de dispositivos" + +#: views/epm_advanced_iedl.page.php:20 +#: views/epm_advanced_manual_upload.page.php:109 +msgid "Export" +msgstr "Exportar" + +#: views/epm_advanced_iedl.page.php:26 +msgid "Export data configuracion devices." +msgstr "Exportar datos de configuracion de dispositivo." + +#: views/epm_advanced_iedl.page.php:35 +msgid "Import CSV" +msgstr "Importar CSV" + +#: views/epm_advanced_iedl.page.php:48 +msgid "Import CSV file of devices" +msgstr "Importar archivo CSV de dispositivos" + +#: views/epm_advanced_iedl.page.php:52 views/epm_advanced_iedl.page.php:60 +#: views/epm_advanced_manual_upload.page.php:32 +#: views/epm_advanced_manual_upload.page.php:62 +msgid "Import" +msgstr "Importar" + +#: views/epm_advanced_iedl.page.php:67 +msgid "" +"Warning: The extensions need to be added into FreePBX before you import." +msgstr "" +"Advertencia: Las extensiones deben ser agregados en FreePBX antes de " +"importar." + +#: views/epm_advanced_iedl.page.php:78 +msgid "CSV File Format" +msgstr "Formato de archivo CSV" + +#: views/epm_advanced_iedl.page.php:87 +msgid "Structure" +msgstr "Estructura" + +#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:92 +#: views/epm_devices_main.page.php:243 views/epm_devices_main.page.php:466 +msgid "MAC Address" +msgstr "Direccion MAC" + +#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:94 +#: views/epm_devices_main.page.php:518 +msgid "Model" +msgstr "Modelo" + +#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:95 +msgid "Extension" +msgstr "Extension" + +#: views/epm_advanced_iedl.page.php:90 views/epm_advanced_iedl.page.php:96 +#: views/epm_devices_main.page.php:246 views/epm_devices_main.page.php:469 +msgid "Line" +msgstr "Linea" + +#: views/epm_advanced_iedl.page.php:92 +msgid "is required" +msgstr "es requerido" + +#: views/epm_advanced_iedl.page.php:93 views/epm_advanced_iedl.page.php:94 +#: views/epm_advanced_iedl.page.php:95 views/epm_advanced_iedl.page.php:96 +msgid "can be blank" +msgstr "puede estar en blanco" + +#: views/epm_advanced_iedl.page.php:99 +msgid "Examples" +msgstr "Ejemplos" + +#: views/epm_advanced_manual_upload.page.php:10 +msgid "Import Packages" +msgstr "Importar Paquetes" + +#: views/epm_advanced_manual_upload.page.php:13 +msgid "Download updated releases from " +msgstr "Descarga actualizada liberado de" + +#: views/epm_advanced_manual_upload.page.php:24 +msgid "Provisioner Package" +msgstr "Provisioner Paquete" + +#: views/epm_advanced_manual_upload.page.php:41 +msgid "Import a package Provisioner in manual mode." +msgstr "Importación de un paquete de Provisioner en el modo manual." + +#: views/epm_advanced_manual_upload.page.php:54 +msgid "Brand Package" +msgstr "Paquete de marcas" + +#: views/epm_advanced_manual_upload.page.php:71 +msgid "Import a package brand in manual mode." +msgstr "Importación de un paquete de la marca en el modo manual." + +#: views/epm_advanced_manual_upload.page.php:79 +msgid "Export Brand Packages" +msgstr "Paquetes de exportación de la marcas" + +#: views/epm_advanced_manual_upload.page.php:82 +msgid "Learn how to create your own brand package at " +msgstr "Aprender a crear su propio paquete de la marca en " + +#: views/epm_advanced_manual_upload.page.php:90 +msgid "Brand's Available" +msgstr "Marcas disponibles" + +#: views/epm_advanced_manual_upload.page.php:97 +msgid "Heads up!" +msgstr "¡Aviso!" + +#: views/epm_advanced_manual_upload.page.php:97 +msgid "List Bran's Availables empty." +msgstr "Lista de Marcas disponibles vacia." + +#: views/epm_advanced_manual_upload.page.php:122 +msgid "Explor a package brand's availables." +msgstr "Exportar paquete de Marcas disponibles." + +#: views/epm_advanced_manual_upload.page.php:133 +msgid "List of other exports" +msgstr "Lista de otras exportaciones." + +#: views/epm_advanced_manual_upload.page.php:152 +msgid "List packages generated in other exports." +msgstr "Lista paquetes generados en otras exportaciones." + +#: views/epm_advanced_settings.page.php:38 +msgid "Setting Provision" +msgstr "Ajustes Provision" + +#: views/epm_advanced_settings.page.php:49 +msgid "IP address of phone server" +msgstr "Dirección IP del servidor telefónico (PBX)" + +#: views/epm_advanced_settings.page.php:56 +#: views/epm_advanced_settings.page.php:191 +msgid "Determine for Me" +msgstr "Determinar por mí" + +#: views/epm_advanced_settings.page.php:81 +msgid "Configuration Type" +msgstr "Tipo de Configuracion" + +#: views/epm_advanced_settings.page.php:86 +msgid "File (TFTP/FTP)" +msgstr "Archivos (TFTP/FTP)" + +#: views/epm_advanced_settings.page.php:87 +msgid "Web (HTTP)" +msgstr "Web (HTTP)" + +#: views/epm_advanced_settings.page.php:90 +msgid "Updated!" +msgstr "Actualizado!" + +#: views/epm_advanced_settings.page.php:90 +msgid " - Point your phones to: " +msgstr "" + +#: views/epm_advanced_settings.page.php:114 +msgid "Global Final Config & Firmware Directory" +msgstr "Directorio final de configuracion y firmware" + +#: views/epm_advanced_settings.page.php:134 +msgid "Time" +msgstr "Hora" + +#: views/epm_advanced_settings.page.php:152 +msgid "Time Zone" +msgstr "Zona Horaria" + +#: views/epm_advanced_settings.page.php:161 +msgid "TimeZone by PBX Setting" +msgstr "Zona Horaria de la PBX" + +#: views/epm_advanced_settings.page.php:184 +msgid "Time Server (NTP Server)" +msgstr "Servidor de Tiempo (NTP Server)" + +#: views/epm_advanced_settings.page.php:210 +msgid "Local Paths" +msgstr "Rutas Locales" + +#: views/epm_advanced_settings.page.php:220 +msgid "NMAP Executable Path" +msgstr "Ruta Ejecutable NMAP" + +#: views/epm_advanced_settings.page.php:244 +msgid "ARP Executable Path" +msgstr "Ruta Ejecutable ARP" + +#: views/epm_advanced_settings.page.php:268 +msgid "Asterisk Executable Path" +msgstr "Ruta Ejecutable Asterisk" + +#: views/epm_advanced_settings.page.php:288 +msgid "Web Directories" +msgstr "Directorios Web" + +#: views/epm_advanced_settings.page.php:298 +msgid "Package Server" +msgstr "Servidor de Paquetes" + +#: views/epm_advanced_settings.page.php:305 +msgid "Default Mirror FreePBX" +msgstr "Mirror por defecto de FreePBX" + +#: views/epm_advanced_settings.page.php:323 +msgid "Experimental" +msgstr "Experimental" + +#: views/epm_advanced_settings.page.php:334 +msgid "Enable FreePBX ARI Module" +msgstr "Activar FreePBX Modulo ARI " + +#: views/epm_advanced_settings.page.php:339 +#: views/epm_advanced_settings.page.php:375 +#: views/epm_advanced_settings.page.php:404 +#: views/epm_advanced_settings.page.php:433 +#: views/epm_advanced_settings.page.php:462 +#: views/epm_advanced_settings.page.php:491 +#: views/epm_advanced_settings.page.php:520 +#: views/epm_advanced_settings.page.php:549 +msgid "Yes" +msgstr "Yes" + +#: views/epm_advanced_settings.page.php:341 +#: views/epm_advanced_settings.page.php:377 +#: views/epm_advanced_settings.page.php:406 +#: views/epm_advanced_settings.page.php:435 +#: views/epm_advanced_settings.page.php:464 +#: views/epm_advanced_settings.page.php:493 +#: views/epm_advanced_settings.page.php:522 +#: views/epm_advanced_settings.page.php:551 +msgid "No" +msgstr "No" + +#: views/epm_advanced_settings.page.php:370 +msgid "Enable Debug Mode" +msgstr "Activar Debug Mode" + +#: views/epm_advanced_settings.page.php:399 +msgid "Disable Tooltips" +msgstr "Desactivar las sugerencias" + +#: views/epm_advanced_settings.page.php:428 +msgid "Allow Duplicate Extensions" +msgstr "Permitir extensiones duplicadas" + +#: views/epm_advanced_settings.page.php:457 +msgid "Allow Saving Over Default Configuration Files" +msgstr "" + +#: views/epm_advanced_settings.page.php:486 +msgid "Disable TFTP Server Check" +msgstr "Desactivar comprobación de servidor TFTP" + +#: views/epm_advanced_settings.page.php:515 +msgid "Disable Configuration File Backups" +msgstr "Desactivar las copias de seguridad del archivo de configuración" + +#: views/epm_advanced_settings.page.php:544 +msgid "Use GITHUB Live Repo" +msgstr "Utilice GitHub en directo Repo" + +#: views/epm_advanced_settings.page.php:606 +msgid "GIT Branch" +msgstr "GIT Rama" + +#: views/epm_config_editor.page.php:4 msgid "" -"NOTE: File may be over-written during next package update. We suggest also " -"using the Share button below to improve the next release." +"Select brands, products or models that do not need to hide from the list." msgstr "" +"Seleccione las Marcas, Productos y modelos que no necesite para ocultarlo en " +"la lista de Instalar/Desisntalar." -#: views/epm_advanced/poce.views.textarea.file.php:26 -msgid "NOTE: Key F11 Full Screen, ESC Exit FullScreen." -msgstr "" -"Nota: Presione F11 para modo pantalla completa, ESC para salir de Pantalla " -"Completa." +#: views/epm_config_editor.page.php:7 +msgid "Brands/Modules" +msgstr "Marca/Modelo" -#: Endpointman.class.php:2027 -msgid "Name invalid: " -msgstr "" +#: views/epm_config_editor.page.php:11 views/epm_config_manager.page.php:23 +msgid "Loading data...." +msgstr "Cargando datos..." -#: Endpointman.class.php:901 -msgid "Name is null!" -msgstr "" +#: views/epm_config_manager.page.php:10 +msgid "Check for Update" +msgstr "Buscar actualizaciones" -#: Endpointman.class.php:276 -msgid "New Package Modified" -msgstr "Nuevo paquete Modificado" +#: views/epm_config_manager.page.php:19 +msgid "List Packages Manager" +msgstr "Administracion Lista de Paquetes" -#: views/epm_advanced_settings.page.php:341 -#: views/epm_advanced_settings.page.php:377 -#: views/epm_advanced_settings.page.php:406 -#: views/epm_advanced_settings.page.php:435 -#: views/epm_advanced_settings.page.php:464 -#: views/epm_advanced_settings.page.php:493 -#: views/epm_advanced_settings.page.php:522 -#: views/epm_advanced_settings.page.php:551 -msgid "No" -msgstr "No" +#: views/epm_devices_main.page.php:32 views/epm_devices_main.page.php:39 +#: views/epm_templates_editor.page.php:7 +#: views/epm_templates_manager.page.php:13 +#: views/epm_templates_manager.page.php:19 +msgid "Warning!" +msgstr "Advertencia!" -#: Endpointman.class.php:3300 -msgid "No 'brand_data.xml' file exists!" -msgstr "No existe un archivo 'brand_data.xml'!" +#: views/epm_devices_main.page.php:32 views/epm_templates_manager.page.php:13 +msgid "here" +msgstr "aquí" -#: Endpointman.class.php:1857 -msgid "No Brand set!" +#: views/epm_devices_main.page.php:32 views/epm_templates_manager.page.php:13 +msgid " to install some" msgstr "" -#: Endpointman.class.php:1971 -msgid "No Configuration Location Defined!" +#: views/epm_devices_main.page.php:39 +msgid " to setup your configuration" msgstr "" -#: Endpointman.class.php:3601 Endpointman.class.php:3619 -msgid "No Devices/Extensions Left to Add" -msgstr "No hay dispositivos / Extensiones a la izquierdo para Añadir" - -#: Endpointman.class.php:1560 -msgid "No File Provided!" +#: views/epm_devices_main.page.php:238 +msgid "Device" msgstr "" -#: Endpointman.class.php:1832 -msgid "No ID set!" -msgstr "No se ha enviado ID!" - -#: Endpointman.class.php:3605 Endpointman.class.php:3623 -msgid "No Lines Left to Add" -msgstr "No hay líneas de a la izquierdo para Añadir" +#: views/epm_devices_main.page.php:245 views/epm_devices_main.page.php:468 +msgid "Model of Phone" +msgstr "" -#: Endpointman.class.php:1854 -msgid "No OUI set!" +#: views/epm_devices_main.page.php:247 views/epm_devices_main.page.php:470 +msgid "Extension Number" msgstr "" -#: views/epm_advanced/poce.views.textarea.file.php:5 -#: views/epm_advanced/poce.views.textarea.file.php:24 -msgid "No Selected" -msgstr "No Seleccionado" +#: views/epm_devices_main.page.php:248 views/epm_devices_main.page.php:471 +msgid "Template" +msgstr "" -#: Endpointman.class.php:3778 -msgid "No file was uploaded" -msgstr "No se ha cargado el fichero" +#: views/epm_devices_main.page.php:314 +msgid "Add" +msgstr "Añadir" -#: Endpointman.class.php:1671 -msgid "No package set!" +#: views/epm_devices_main.page.php:319 +msgid "Reset" msgstr "" -#: Endpointman.class.php:913 -msgid "No send Clone Model!" +#: views/epm_devices_main.page.php:390 +msgid "Unmanaged Extensions" msgstr "" -#: Endpointman.class.php:1135 -msgid "No send File ID!" +#: views/epm_devices_main.page.php:437 +msgid "Add Selected Phones" msgstr "" -#: Endpointman.class.php:1138 -msgid "No send File Name!" +#: views/epm_devices_main.page.php:456 +msgid "Current Managed Extensions" msgstr "" -#: Endpointman.class.php:873 Endpointman.class.php:942 -msgid "No send ID!" +#: views/epm_devices_main.page.php:472 views/epm_devices_main.page.php:490 +#: views/epm_templates_editor.page.php:130 +msgid "Edit" msgstr "" -#: Endpointman.class.php:1314 -msgid "No send Name File!" +#: views/epm_devices_main.page.php:513 +msgid "Selected Phone(s) Options" msgstr "" -#: Endpointman.class.php:898 -msgid "No send Name!" +#: views/epm_devices_main.page.php:515 views/epm_devices_main.page.php:544 +msgid "Rebuild" msgstr "" -#: Endpointman.class.php:1317 -msgid "No send Origianl Name File!" +#: views/epm_devices_main.page.php:515 +msgid "Rebuild Configs for Selected Phones" msgstr "" -#: Endpointman.class.php:1035 Endpointman.class.php:1126 -#: Endpointman.class.php:1251 Endpointman.class.php:1299 -#: Endpointman.class.php:1393 -msgid "No send Product Select!" +#: views/epm_devices_main.page.php:517 +msgid "Change Selected Phones to" msgstr "" -#: Endpointman.class.php:904 -msgid "No send Product!" +#: views/epm_devices_main.page.php:531 +msgid "Global Phone Options" msgstr "" -#: Endpointman.class.php:1399 -msgid "No send SQL Select!" +#: views/epm_devices_main.page.php:535 +msgid "Search" msgstr "" -#: Endpointman.class.php:1311 -msgid "No send Save Name!" +#: views/epm_devices_main.page.php:536 +msgid "Search for new devices in netmask" msgstr "" -#: Endpointman.class.php:1257 Endpointman.class.php:1302 -msgid "No send SendID!" +#: views/epm_devices_main.page.php:538 +msgid "Use NMAP" msgstr "" -#: Endpointman.class.php:1308 -msgid "No send Text File!" +#: views/epm_devices_main.page.php:544 +msgid "Rebuild Configs for All Phones" msgstr "" -#: Endpointman.class.php:1141 Endpointman.class.php:1254 -#: Endpointman.class.php:1305 Endpointman.class.php:1396 -msgid "No send Type File!" +#: views/epm_devices_main.page.php:548 +msgid "Reboot" msgstr "" -#: Endpointman.class.php:2138 Endpointman.class.php:2273 -msgid "No send id!" -msgstr "No se ha enviado ID!" - -#: Endpointman.class.php:2141 Endpointman.class.php:2276 -msgid "No send idtype!" -msgstr "No se ha enviado IDType!" - -#: Endpointman.class.php:1899 Endpointman.class.php:2132 -#: Endpointman.class.php:2263 -msgid "No send name!" -msgstr "No se ha enviado NOMBRE!" - -#: Endpointman.class.php:1902 Endpointman.class.php:2135 -#: Endpointman.class.php:2266 -msgid "No send value!" -msgstr "No se ha enviado VALOR!" - -#: Endpointman.class.php:1968 -msgid "Not a Vaild Directory.
      Try to run 'mkdir " +#: views/epm_devices_main.page.php:548 +msgid "Reboot This Brand" msgstr "" -#: Endpointman.class.php:2510 -msgid "Not able to connect to repository. Using local Provisioner.net Package." +#: views/epm_devices_main.page.php:552 views/epm_devices_main.page.php:559 +msgid "Configure" msgstr "" -#: Endpointman.class.php:2540 -msgid "" -"Not able to connect to repository. Using local brand [%_brandname_%] file " -"instead." +#: views/epm_devices_main.page.php:553 views/epm_devices_main.page.php:560 +msgid "Reconfigure all" msgstr "" -#: Endpointman.class.php:2495 -msgid "Not able to connect to repository. Using local master file instead." +#: views/epm_devices_main.page.php:553 views/epm_devices_main.page.php:560 +msgid "with" msgstr "" -#: Endpointman.class.php:2976 -msgid "Not allowed in repo mode!!" -msgstr "No permite en modo de repo!" - -#: Endpointman.class.php:1487 -msgid "Not is directory: " +#: views/epm_devices_main.page.php:585 +msgid "The Endpoint Configuration Manager was originally written by" msgstr "" -#: endpointman.i18n.php:18 -msgid "OSS Endpoint Advanced Settings" +#: views/epm_devices_main.page.php:587 +msgid "The project is maintained at" msgstr "" -#: endpointman.i18n.php:10 -msgid "OSS Endpoint Device List" +#: views/epm_devices_main.page.php:895 views/epm_devices_main.page.php:960 +msgid "No Device Selected to Edit!" msgstr "" -#: endpointman.i18n.php:16 -msgid "OSS Endpoint Package Manager" +#: views/epm_devices_main.page.php:928 views/epm_devices_main.page.php:1169 +msgid "Saved" msgstr "" -#: endpointman.i18n.php:14 -msgid "OSS Endpoint Template Manager" +#: views/epm_devices_main.page.php:981 views/epm_devices_main.page.php:1014 +msgid "No Phones Selected" msgstr "" -#: endpointman.i18n.php:4 -msgid "OSS PBX End Point Manager" +#: views/epm_devices_main.page.php:1090 +msgid "No Phones to Reboot" msgstr "" -#: endpointman.i18n.php:8 -msgid "" -"OSS PBX End Point Manager is the free supported PBX Endpoint Manager for " -"FreePBX.\t\tIt is ***NOT*** supported by Schmoozecom. If you are looking for " -"a supported endpoint manager please look into the Commercial Endpoint " -"Manager by Schmoozecom, INC.\t\tThe front end gui is hosted at: https://" -"github.com/FreePBX/endpointman\t\tThe backend configurator is hosted at: " -"https://github.com/provisioner/Provisioner\t\tPull Requests can be made to " -"either of these and are encouraged." +#: views/epm_devices_main.page.php:1093 +msgid "No Brand Selected for Reboot" msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:24 -#: views/epm_advanced/oui_manager.views.new.modal.php:14 -msgid "OUI" -msgstr "OUI" - -#: views/epm_advanced/oui_manager.views.new.modal.php:18 -msgid "OUI Brand" +#: views/epm_devices_main.page.php:1126 +msgid "No Devices Found" msgstr "" -#: Endpointman.class.php:630 -msgid "OUI Manager" -msgstr "Administrador OUI" - -#: Endpointman.class.php:3192 Endpointman.class.php:3217 -msgid "Old Data Detected! Migrating......" -msgstr "Antiguos datos detectados! Migrando......" - -#: Endpointman.class.php:141 -msgid "Or run this command on SSH:" -msgstr "O ejecute este comando en SSH:" - -#: Endpointman.class.php:642 -msgid "Package Import/Export" -msgstr "Paquete de importación/exportación" - -#: Endpointman.class.php:277 -msgid "Package Last Modified" -msgstr "Paquete última actualización" - -#: page.epm_config.php:19 -msgid "Package Manager" -msgstr "Administracion de Paquetes" - -#: views/epm_advanced_settings.page.php:298 -msgid "Package Server" -msgstr "Servidor de Paquetes" - -#: Endpointman.class.php:1674 -msgid "Package not valid!" +#: views/epm_devices_main.page.php:1172 +msgid "Please select a Brand and/or Model" msgstr "" -#: Endpointman.class.php:2884 Endpointman.class.php:2992 -msgid "Please Check Directory/Permissions!" -msgstr "Compruebe los permisos del directorio!" - -#: Endpointman.class.php:140 -msgid "Please change the location:" -msgstr "Por favor, cambia la ubicación:" - -#: Endpointman.class.php:1555 -msgid "Please name the Package the same name as your brand!" +#: views/epm_devices_main.page.php:1175 +msgid "No Phones Selected!" msgstr "" -#: Endpointman.class.php:1808 -msgid "Please reboot & rebuild all imported phones" +#: views/epm_devices_main.page.php:1183 +msgid "Please select a product" msgstr "" -#: Endpointman.class.php:1810 -msgid "Possible file upload attack!" +#: views/epm_devices_main.page.php:1185 views/epm_devices_main.page.php:1215 +msgid "Please select a template" msgstr "" -#: Endpointman.class.php:3053 -msgid "Processing %_PATH_%/brand_data.json..." -msgstr "Procesando %_PATH_%/brand_data.json..." - -#: Endpointman.class.php:634 -msgid "Product Configuration Editor" -msgstr "Editor de configuración de producto" - -#: Endpointman.class.php:1038 Endpointman.class.php:1129 -msgid "Product Select send is not number!" +#: views/epm_devices_main.page.php:1213 +msgid "Please select a model" msgstr "" -#: Endpointman.class.php:1041 Endpointman.class.php:1132 -msgid "Product Select send is number not valid!" +#: views/epm_templates/manager.views.grid.php:5 +#: views/epm_templates/manager.views.new.modal.php:5 +msgid "Add New Template" msgstr "" -#: Endpointman.class.php:907 -msgid "Product is not number!" +#: views/epm_templates/manager.views.grid.php:25 +#: views/epm_templates/manager.views.new.modal.php:15 +#: views/epm_templates/rnav.php:17 +msgid "Template Name" msgstr "" -#: Endpointman.class.php:910 -msgid "Product send is negative!" +#: views/epm_templates/manager.views.grid.php:26 +#: views/epm_templates/rnav.php:18 +msgid "Model Classification" msgstr "" -#: views/epm_advanced_manual_upload.page.php:24 -msgid "Provisioner Package" -msgstr "Provisioner Paquete" - -#: Endpointman.class.php:288 Endpointman.class.php:305 -#: Endpointman.class.php:309 -msgid "Ready!" -msgstr "Listo!" - -#: views/epm_advanced/oui_manager.views.grid.php:6 -msgid "Refresh Table" -msgstr "Actualizar Tabla" - -#: Endpointman.class.php:284 -msgid "Remove Firmware" -msgstr "Eliminar Firmware" - -#: Endpointman.class.php:676 -msgid "Removing Phone Modules Directory" +#: views/epm_templates/manager.views.grid.php:27 +#: views/epm_templates/rnav.php:19 +msgid "Model Clone" msgstr "" -#: Endpointman.class.php:3303 -msgid "Removing Temporary Files.............." -msgstr "Eliminando Archivos Temporales.............." - -#: Endpointman.class.php:680 -msgid "Removing symlink to web provisioner" +#: views/epm_templates/manager.views.grid.php:28 +msgid "Enabled" msgstr "" -#: views/epm_advanced/poce.views.textarea.file.php:35 -msgid "Save" -msgstr "Guardar" - -#: views/epm_advanced/poce.views.textarea.file.php:48 -msgid "Save As..." -msgstr "Gardar Como..." - -#: Endpointman.class.php:291 Endpointman.class.php:307 -#: Endpointman.class.php:359 -msgid "Saving Changes..." -msgstr "Guardando cambios…" - -#: Endpointman.class.php:292 Endpointman.class.php:308 -#: Endpointman.class.php:360 -msgid "Saving Changes... Ok!" -msgstr "Guardando cambios… Listo!" - -#: views/epm_advanced/oui_manager.views.new.modal.php:41 -#: views/epm_advanced_manual_upload.page.php:101 -msgid "Select Brand:" -msgstr "Seleccionar Marca:" - -#: views/epm_config_editor.page.php:4 -msgid "" -"Select brands, products or models that do not need to hide from the list." +#: views/epm_templates/manager.views.grid.php:29 +msgid "Action" msgstr "" -"Seleccione las Marcas, Productos y modelos que no necesite para ocultarlo en " -"la lista de Instalar/Desisntalar." - -#: views/epm_advanced_settings.page.php:38 -msgid "Setting Provision" -msgstr "Ajustes Provision" - -#: Endpointman.class.php:626 -msgid "Settings" -msgstr "Configuración" - -#: views/epm_advanced/poce.views.textarea.file.php:59 -msgid "Share" -msgstr "Compartir" -#: Endpointman.class.php:303 -msgid "Show" -msgstr "Mostrar" +#: views/epm_templates/manager.views.new.modal.php:19 +msgid "New Name Template...." +msgstr "" -#: Endpointman.class.php:616 -msgid "Show/Hide" -msgstr "Mostrar/Ocultar" +#: views/epm_templates/manager.views.new.modal.php:27 +#: views/epm_templates/manager.views.new.modal.php:61 +#: views/epm_templates/manager.views.new.modal.php:84 +msgid "Texto Ayuda." +msgstr "" -#: Endpointman.class.php:2824 -msgid "Skipping download..." -msgstr "Omitir descarga..." +#: views/epm_templates/manager.views.new.modal.php:38 +msgid "Product Select" +msgstr "" -#: views/epm_advanced_iedl.page.php:87 -msgid "Structure" -msgstr "Estructura" +#: views/epm_templates/manager.views.new.modal.php:43 +msgid "Select Product:" +msgstr "" -#: Endpointman.class.php:2463 -msgid "Syntax error, malformed JSON" -msgstr "Error de sintaxis, JSON malformada" +#: views/epm_templates/manager.views.new.modal.php:72 +msgid "Clone Template From" +msgstr "" -#: Endpointman.class.php:3253 -msgid "System Error in Sync Model Function, Load Failure!" +#: views/epm_templates/rnav.php:5 +msgid "List Tempalte Custom" msgstr "" -"Error del sistema en función de sincronización de modelos, Error de carga!" -#: Endpointman.class.php:2683 -msgid "System Error in Sync Model [%_name_%] Function, Load Failure!" +#: views/epm_templates_editor.page.php:32 +msgid "Template Name:" msgstr "" -#: provisioning/p.php:99 -msgid "System Failure!" -msgstr "¡Fallo de sistema!" +#: views/epm_templates_editor.page.php:42 +msgid "Product Line:" +msgstr "" -#: Endpointman.class.php:351 Endpointman.class.php:458 -msgid "Tab is not valid!" -msgstr "Tab no es valida!" +#: views/epm_templates_editor.page.php:51 +#: views/epm_templates_editor.page.php:55 +msgid "Clone of Model:" +msgstr "" -#: Endpointman.class.php:602 -msgid "Template Editor" +#: views/epm_templates_editor.page.php:76 +msgid "Display:" msgstr "" -#: Endpointman.class.php:275 -msgid "" -"The \"Install\" button installs the configuration package brand models we " -"selected.
      The \"Uninstall\" button removes the package configuration " -"models of the brand selected.
      The \"Update\" button appears if a new " -"version of the package that is already installed to upgrade to the latest " -"version is detected." +#: views/epm_templates_editor.page.php:93 +msgid "Line settings on this page" msgstr "" -"El boton \"Instalar\" instala el paquete de configuracion de los modelos de " -"la marca que seleccionamos.
      El boton \"Desinstalar\" elimina el " -"paquete de configuracion de los modelos de la marca que seleccionamos.
      " -"El boton \"Actualizacion\" aparece si se detecta una nueva version del " -"paquete que esta ya instalado para actualizar a la ultima version." -#: Endpointman.class.php:2607 -msgid "" -"The Remote Server Is Currently Syncing With the Master Server, Please try " -"again later" +#: views/epm_templates_editor.page.php:110 +msgid "Edit Global Settings Overrides:" msgstr "" -#: Endpointman.class.php:274 -msgid "" -"The button \"Install Firmware\" installs the necessary files to the server " -"for the terminal alone are updated via TFTP or HTTP.
      The button " -"\"Remove frimware\" delete files server products.
      The button \"Update " -"frimware\" appears if a newer frimware detected on the server and asks if " -"you want to update.
      The \"Update\" button appears when a new version " -"of this model pack is detected." +#: views/epm_templates_editor.page.php:116 +msgid "Global Settings" msgstr "" -"El boton \"Instalar Firmware\" instala los archivos necesarios en el " -"servidor para que lo terminales se actualicen solos a traves de HTTP o TFTP." -"
      El boton \"Remover Frimware\" elimina los archivos de los productos " -"del servidor.
      El boton \"Actualizar Frimware\" aparece si se detectado " -"un frimware mas nuevo en el servidor y nos pregunta si deseas actualizar." -"
      El boton \"Actualizar\" aparece cuando se detecta una nueva version " -"de Paquete de este modelo." -#: Endpointman.class.php:3774 -msgid "" -"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in " -"the HTML form" +#: views/epm_templates_editor.page.php:128 +#: views/epm_templates_editor.page.php:155 +msgid "Edit File Configurations for:" msgstr "" -#: Endpointman.class.php:3772 -msgid "The uploaded file exceeds the upload_max_filesize directive in php.ini" +#: views/epm_templates_editor.page.php:135 +msgid "Select Alternative File Configurations for " msgstr "" -#: Endpointman.class.php:3776 -msgid "The uploaded file was only partially uploaded" +#: views/epm_templates_editor.page.php:174 +msgid "Example of Variables allowed in boxes" msgstr "" -#: Endpointman.class.php:3038 -msgid "Then Use Manual Upload in Advanced Settings." -msgstr "Utilizar carga Manual en configuración avanzada." +#: views/epm_templates_editor.page.php:178 +msgid "Device's Username (usually the extension)" +msgstr "" -#: views/epm_advanced/oui_manager.views.new.modal.php:26 -msgid "" -"They are the first 6 characters of the MAC device that identifies the brand " -"(manufacturer)." +#: views/epm_templates_editor.page.php:179 +msgid "Device's Description in FreePBX (Usually the Full Name)" msgstr "" -#: views/epm_advanced_settings.page.php:134 -msgid "Time" -msgstr "Hora" +#: views/epm_templates_editor.page.php:180 +msgid "Server IP For Line 1" +msgstr "" -#: views/epm_advanced_settings.page.php:184 -msgid "Time Server (NTP Server)" -msgstr "Servidor de Tiempo (NTP Server)" +#: views/epm_templates_editor.page.php:181 +msgid "Server Port For Line 1" +msgstr "" -#: views/epm_advanced_settings.page.php:152 -msgid "Time Zone" -msgstr "Zona Horaria" +#: views/epm_templates_editor.page.php:182 +msgid "Device's Mac Address" +msgstr "" -#: views/epm_advanced_settings.page.php:161 -msgid "TimeZone by PBX Setting" -msgstr "Zona Horaria de la PBX" +#: views/epm_templates_editor.page.php:183 +msgid "Device's Model" +msgstr "" -#: views/epm_advanced/oui_manager.views.grid.php:26 -msgid "Type" -msgstr "Tipo" +#: views/epm_templates_editor.page.php:276 +msgid "Save Template" +msgstr "" -#: Endpointman.class.php:1412 -msgid "Type File not valid!" +#: views/epm_templates_manager.page.php:19 +msgid "Brand Configurations/Setup" msgstr "" -#: Endpointman.class.php:2457 -msgid "Underflow or the modes mismatch" +#: views/epm_templates_manager.page.php:19 +msgid " to setup and install phone configurations" msgstr "" -#: Endpointman.class.php:2460 -msgid "Unexpected control character found" -msgstr "Carácter de control inesperado encontró" +#~ msgid "MD5 Did not match!
      " +#~ msgstr "- MD5 no coincide!" -#: Endpointman.class.php:281 -msgid "Uninstall" -msgstr "Desisntalar" +#~ msgid "Error!
      " +#~ msgstr "Error!
      " -#: Endpointman.class.php:2927 -msgid "Uninstalla Brand..." -msgstr "Desisntalando Marca..." +#~ msgid "Then Use Manual Upload in Advanced Settings.
      " +#~ msgstr "Utilizar carga Manual en configuración avanzada.
      " -#: Endpointman.class.php:2904 -msgid "Uninstalla frimware..." -msgstr "Desisntalando Frimware..." +#~ msgid "Error: Error: Command not found!" +#~ msgstr "Error: Comando no valido!" -#: Endpointman.class.php:3918 -msgid "Unknown" -msgstr "Desconocido" +#~ msgid "Loading.." +#~ msgstr "Cargando..." -#: Endpointman.class.php:2469 -msgid "Unknown error" -msgstr "Error desconocido." +#~ msgid "Skipping download..." +#~ msgstr "Omitir descarga..." -#: Endpointman.class.php:3786 -msgid "Unknown upload error" -msgstr "Error al subir Desconocido" +#~ msgid "Checking MD5sum of Package..." +#~ msgstr "Comprobando MD5sum en Paquete..." -#: Endpointman.class.php:282 -msgid "Update" -msgstr "Actualizar" +#~ msgid "- Failed To Copy %_FILE_%!" +#~ msgstr "- Error al copiar %_FILE_%!" -#: Endpointman.class.php:296 -msgid "Update Content..." -msgstr "Actualizar contenido...." +#~ msgid "- Copied %_FILE_% to %_FILETO_%." +#~ msgstr "- Copiado %_FILE_% a %_FILETO_%." -#: Endpointman.class.php:285 -msgid "Update Firmware" -msgstr "Actualizar Firmware" +#~ msgid "Please Check Directory/Permissions!" +#~ msgstr "Compruebe los permisos del directorio!" -#: Endpointman.class.php:290 -msgid "Update!" -msgstr "Actualizado!" +#~ msgid "Your Firmware is already up to date" +#~ msgstr "Tu Frimware ya esta actualizado" -#: views/epm_advanced_settings.page.php:90 -msgid "Updated!" -msgstr "Actualizado!" +#~ msgid "Uninstalla frimware..." +#~ msgstr "Desisntalando Frimware..." -#: Endpointman.class.php:3102 -msgid "Updating %_BRANDNAME_% brand data.........." -msgstr "Actualizando datos de la marca % _BRANDNAME_%.........." +#~ msgid "Not allowed in repo mode!!" +#~ msgstr "No permite en modo de repo!" -#: Endpointman.class.php:3113 -msgid "Updating Family Lines................." -msgstr "Actualizando líneas de familia ................." +#~ msgid "Error creating directory: %_DIR_%" +#~ msgstr "Error al crear el directorio: %_DIR_%" -#: Endpointman.class.php:1616 -msgid "Updating Last Modified..." -msgstr "" +#~ msgid "Downloading Brand JSON....." +#~ msgstr "Descargando JSON Marca...." -#: Endpointman.class.php:3285 -msgid "Updating OUI list in DB" -msgstr "Actualizando la lista de OUI en la DB" +#~ msgid "Checking MD5sum of Package...." +#~ msgstr "Comprobando MD5sum de paquete..." -#: Endpointman.class.php:293 Endpointman.class.php:310 -msgid "Upload Content!" -msgstr "Actualizar contenido...." +#~ msgid "Can't Find Downloaded File!" +#~ msgstr "No puede encontrar el archivo descargado." -#: views/epm_advanced/poce.views.textarea.file.php:56 -msgid "" -"Upload this configuration file to the Provisioner.net Team. Files " -"shared are confidential and help improve the quality of releases." -msgstr "" +#~ msgid "" +#~ "You Can Also Manually Update The Repository By Downloading Files here: " +#~ "%_URL_INI_% Release Repo %_URL_END_%" +#~ msgstr "" +#~ "También puede actualizar manualmente el repositorio mediante la descarga " +#~ "de archivos aquí: %_URL_INI_% de lanzamiento Repo %_URL_END_%" -#: views/epm_advanced_settings.page.php:544 -msgid "Use GITHUB Live Repo" -msgstr "Utilice GitHub en directo Repo" +#~ msgid "Installing brands is disabled while in repo mode!" +#~ msgstr "Instalación de marcas se desactiva en el modo de Repo!" -#: views/epm_advanced/poce.views.button.up.files.php:31 -msgid "User File Configs" -msgstr "Usar Archivo de Configuracion" +#~ msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" +#~ msgstr "update_brand (): depuración se establece en %_DEBUG_MODE_%" -#: views/epm_advanced_iedl.page.php:67 -msgid "" -"Warning: The extensions need to be added into FreePBX before you import." -msgstr "" -"Advertencia: Las extensiones deben ser agregados en FreePBX antes de " -"importar." +#~ msgid "" +#~ "Creating Directory Structure for Brand '%_NAME_%' and Moving Files .." +#~ msgstr "" +#~ "Creando estructura de directorios para la Marca '% _NAME_%' y moviendo " +#~ "archivos..." -#: Endpointman.class.php:1749 -msgid "We support only CVS and TXT files, type file %_FILE_% no support!" -msgstr "" +#~ msgid "- Error Moving %_FILENAME_%!" +#~ msgstr "- Error Moviendo %_FILENAME_%!" -#: views/epm_advanced_settings.page.php:87 -msgid "Web (HTTP)" -msgstr "Web (HTTP)" +#~ msgid "Updating %_BRANDNAME_% brand data.........." +#~ msgstr "Actualizando datos de la marca % _BRANDNAME_%.........." -#: views/epm_advanced_settings.page.php:288 -msgid "Web Directories" -msgstr "Directorios Web" +#~ msgid "Inserting %_BRANDNAME_% brand data.........." +#~ msgstr "Insertando datos de la marca % _BRANDNAME_%.........." -#: views/epm_advanced_settings.page.php:339 -#: views/epm_advanced_settings.page.php:375 -#: views/epm_advanced_settings.page.php:404 -#: views/epm_advanced_settings.page.php:433 -#: views/epm_advanced_settings.page.php:462 -#: views/epm_advanced_settings.page.php:491 -#: views/epm_advanced_settings.page.php:520 -#: views/epm_advanced_settings.page.php:549 -msgid "Yes" -msgstr "Yes" +#~ msgid "Updating Family Lines................." +#~ msgstr "Actualizando líneas de familia ................." -#: Endpointman.class.php:3037 -msgid "" -"You Can Also Manually Update The Repository By Downloading Files here: %" -"_URL_INI_% Release Repo %_URL_END_%" -msgstr "" -"También puede actualizar manualmente el repositorio mediante la descarga de " -"archivos aquí: %_URL_INI_% de lanzamiento Repo %_URL_END_%" +#~ msgid "-- Updating Model Lines................" +#~ msgstr "-- Actualizando Lineas de Modelos................" -#: Endpointman.class.php:3500 -msgid "You Must Select A Model From the Drop Down" -msgstr "Usted debe seleccionar un modelo de la gota de Down" +#~ msgid "----Old Data Detected! Migrating......" +#~ msgstr "----Antiguos datos detectados! Migrando......" -#: Endpointman.class.php:3503 -msgid "You Must Select an Extension/Device From the Drop Down" -msgstr "Tu deves seleeciona una Extension/Disposito de listado de abajo" +#~ msgid "Old Data Detected! Migrating......" +#~ msgstr "Antiguos datos detectados! Migrando......" -#: Endpointman.class.php:4946 -msgid "You can't remove the only line left" -msgstr "No se puede quitar la única línea de la izquierda" +#~ msgid "System Error in Sync Model Function, Load Failure!" +#~ msgstr "" +#~ "Error del sistema en función de sincronización de modelos, Error de carga!" -#: Endpointman.class.php:2895 -msgid "Your Firmware is already up to date" -msgstr "Tu Frimware ya esta actualizado" +#~ msgid "Moving/Removing Model '%_NAMEMOD_%' not present in JSON file......" +#~ msgstr "" +#~ "Mover/Eliminar Modelo '% _NAMEMOD_%' que no está presente en el archivo " +#~ "JSON......" -#: Endpointman.class.php:2011 -msgid "Your permissions are wrong on " -msgstr "" +#~ msgid "Updating OUI list in DB" +#~ msgstr "Actualizando la lista de OUI en la DB" -#: views/epm_advanced_iedl.page.php:93 views/epm_advanced_iedl.page.php:94 -#: views/epm_advanced_iedl.page.php:95 views/epm_advanced_iedl.page.php:96 -msgid "can be blank" -msgstr "puede estar en blanco" +#~ msgid "Invalid JSON Structure in %_PATH_%/brand_data.json" +#~ msgstr "Inválida estructura JSON en %_PATCH _%/brand_data.json" -#: views/epm_advanced_iedl.page.php:92 -msgid "is required" -msgstr "es requerido" +#~ msgid "No 'brand_data.xml' file exists!" +#~ msgstr "No existe un archivo 'brand_data.xml'!" + +#~ msgid "Removing Temporary Files.............." +#~ msgstr "Eliminando Archivos Temporales.............." -#: Endpointman.class.php:3050 -msgid "update_brand(): Debug is set to %_DEBUG_MODE_%" -msgstr "update_brand (): depuración se establece en %_DEBUG_MODE_%" +#~ msgid "New OUI" +#~ msgstr "Nuevo OUI" #~ msgid "Empty list." #~ msgstr "Lista Vacia." -#~ msgid "New OUI" -#~ msgstr "Nuevo OUI" +#~ msgid "List Bran's Availables emtry." +#~ msgstr "Lista de Marcas disponibles vacia." -#~ msgid "' then 'chmod g+w " -#~ msgstr "' luego 'chmod g+w " +#~ msgid "Add Custom" +#~ msgstr "Añadir Personalizada" + +#~ msgid "File Configuration Editor" +#~ msgstr "Editar Archivo de Configuracion" + +#~ msgid "Select" +#~ msgstr "Seleccionado" + +#~ msgid "Save As" +#~ msgstr "Gardar como" + +#~ msgid "Web (HTTPS)" +#~ msgstr "Web (HTTPS)" + +#~ msgid "executable path" +#~ msgstr "ubicacion ejecutable" #~ msgid "- Firmware MD5 didn't match!" #~ msgstr "- MD5 de Frimware no coincide!" -#~ msgid "
      Or run this command on SSH: 'chown -hR root:" -#~ msgstr "
      O ejecutar este comando en SSH: 'chown -hR root:" +#~ msgid "" +#~ "List of brands, products and models, ready to install their packages " +#~ "configuration." +#~ msgstr "" +#~ "Lista de Marcas, Productos y Modelos, listos para instalar sus paquetes " +#~ "de configuración." + +#~ msgid "" +#~ "If we can activate the model set terminals of the models. If this model " +#~ "is disabled will not appear in the list of models that can be configured " +#~ "for PBX." +#~ msgstr "" +#~ "Si activamos el modelo podremos configurar terminales de dicho modelos." +#~ "
      Si esta desactivado este modelo no aparecera en la lista de " +#~ "modelos que se pueden configurar para la PBX." #~ msgid "" #~ "
      Please change the location:
      Aquí" -#~ msgid "Add" -#~ msgstr "Añadir" - -#~ msgid "Add Custom" -#~ msgstr "Añadir Personalizada" - -#~ msgid "CHECK FOR UPDATES..." -#~ msgstr "Buscar actualizaciones..." +#~ msgid "
      Or run this command on SSH: 'chown -hR root:" +#~ msgstr "
      O ejecutar este comando en SSH: 'chown -hR root:" -#~ msgid "CHECK FOR UPDATES... OK!" -#~ msgstr "Buscar actualizaciones... LISTO!" +#~ msgid "' then 'chmod g+w " +#~ msgstr "' luego 'chmod g+w " #~ msgid "" #~ "Configuration Directory is not a directory or does not exist! Please " @@ -1526,14 +2036,26 @@ msgstr "update_brand (): depuración se establece en %_DEBUG_MODE_%" #~ "cambia la ubicación aquí: Aquí" +#~ msgid "SAVING CHANGES..." +#~ msgstr "GUARDANDO CAMBIOS..." + +#~ msgid "SAVING CHANGES... OK!" +#~ msgstr "GUARDANDO CAMBIOS... LISTO!" + #~ msgid "ERROR!" #~ msgstr "ERROR!" -#~ msgid "Error: ID not is number!" -#~ msgstr "Error: ID no es numero!" +#~ msgid "CHECK FOR UPDATES..." +#~ msgstr "Buscar actualizaciones..." + +#~ msgid "CHECK FOR UPDATES... OK!" +#~ msgstr "Buscar actualizaciones... LISTO!" + +#~ msgid "UPDATE CONTENT..." +#~ msgstr "Actualizar contenido...." -#~ msgid "Error: Not send ID!" -#~ msgstr "Error: No se ha enviado ID!" +#~ msgid "INVALID OPTION!" +#~ msgstr "OPCION NO VALIDA!" #~ msgid "Error: Not send command_sub!" #~ msgstr "Error: No se ha enviado COMMAND_SUB!" @@ -1541,72 +2063,26 @@ msgstr "update_brand (): depuración se establece en %_DEBUG_MODE_%" #~ msgid "Exception:" #~ msgstr "Excepcion:" -#~ msgid "File Configuration Editor" -#~ msgstr "Editar Archivo de Configuracion" - -#~ msgid "Function:" -#~ msgstr "Funcion:" +#~ msgid "Invalid name!" +#~ msgstr "Nombre no validao!" #~ msgid "ID sent is not a number!" #~ msgstr "El ID que se ha envido no es un numero!" -#~ msgid "INVALID OPTION!" -#~ msgstr "OPCION NO VALIDA!" - -#~ msgid "" -#~ "If we can activate the model set terminals of the models. If this model " -#~ "is disabled will not appear in the list of models that can be configured " -#~ "for PBX." -#~ msgstr "" -#~ "Si activamos el modelo podremos configurar terminales de dicho modelos." -#~ "
      Si esta desactivado este modelo no aparecera en la lista de " -#~ "modelos que se pueden configurar para la PBX." +#~ msgid "Type invalid: " +#~ msgstr "Tipo no valido!" #~ msgid "Invalid level!" #~ msgstr "Nivel no válido!" -#~ msgid "Invalid name!" -#~ msgstr "Nombre no validao!" - -#~ msgid "List Bran's Availables emtry." -#~ msgstr "Lista de Marcas disponibles vacia." - -#~ msgid "" -#~ "List of brands, products and models, ready to install their packages " -#~ "configuration." -#~ msgstr "" -#~ "Lista de Marcas, Productos y Modelos, listos para instalar sus paquetes " -#~ "de configuración." +#~ msgid "Value sent is not a number!" +#~ msgstr "El valor que se ha envido no es un numero!" -#~ msgid "List the Brands and Models you can Uninstall." -#~ msgstr "Lista de Marcas y Modelos que puedes desisntalar." +#~ msgid "Function:" +#~ msgstr "Funcion:" #~ msgid "Messenge Error:" #~ msgstr "Mensaje Error:" -#~ msgid "SAVING CHANGES..." -#~ msgstr "GUARDANDO CAMBIOS..." - -#~ msgid "SAVING CHANGES... OK!" -#~ msgstr "GUARDANDO CAMBIOS... LISTO!" - -#~ msgid "Save As" -#~ msgstr "Gardar como" - -#~ msgid "Select" -#~ msgstr "Seleccionado" - -#~ msgid "Type invalid: " -#~ msgstr "Tipo no valido!" - -#~ msgid "UPDATE CONTENT..." -#~ msgstr "Actualizar contenido...." - -#~ msgid "Value sent is not a number!" -#~ msgstr "El valor que se ha envido no es un numero!" - -#~ msgid "Web (HTTPS)" -#~ msgstr "Web (HTTPS)" - -#~ msgid "executable path" -#~ msgstr "ubicacion ejecutable" +#~ msgid "List the Brands and Models you can Uninstall." +#~ msgstr "Lista de Marcas y Modelos que puedes desisntalar." diff --git a/install.php b/install.php index e83bba78..678695a4 100644 --- a/install.php +++ b/install.php @@ -1038,12 +1038,11 @@ function find_exec($exec) { $db->query($sql); out('Creating symlink to web provisioner'); - if(!file_exists($amp_conf['AMPWEBROOT'] . "/provisioning")) { - if (!symlink(LOCAL_PATH . "provisioning", $amp_conf['AMPWEBROOT'] . "/provisioning")) { - //out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); - } + if(!file_exists($amp_conf['AMPWEBROOT'] . "/provisioning")) { + if (!symlink(LOCAL_PATH . "provisioning", $amp_conf['AMPWEBROOT'] . "/provisioning")) { + //out("Your permissions are wrong on ".$amp_conf['AMPWEBROOT'].", web provisioning link not created!"); } - + } } out("Update Version Number to " . $epmxmlversion); diff --git a/lib/Config.class.php b/lib/Config.class.php index 4350b874..a1d4792b 100644 --- a/lib/Config.class.php +++ b/lib/Config.class.php @@ -2,7 +2,6 @@ /** * Endpoint Manager Config * - * @author Javier Pastor * @license MPL / GPLv2 / LGPL * @package Provisioner diff --git a/lib/epm_data_abstraction.class.php b/lib/epm_data_abstraction.class.php index f99d4f9a..6e30b736 100644 --- a/lib/epm_data_abstraction.class.php +++ b/lib/epm_data_abstraction.class.php @@ -10,18 +10,18 @@ class epm_data_abstraction { function __construct($config, $configmod) { - $this->config =& $config; - $this->configmod =& $configmod; + $this->config = $config; + $this->configmod = $configmod; } function all_products() { - $temp =& sql("SELECT * FROM endpointman_product_list WHERE id > 0",'getAll',DB_FETCHMODE_ASSOC); + $temp = sql("SELECT * FROM endpointman_product_list WHERE id > 0",'getAll',DB_FETCHMODE_ASSOC); return($temp); } function all_devices() { $sql = 'SELECT endpointman_mac_list.id , endpointman_mac_list.mac , endpointman_model_list.model, endpointman_model_list.enabled , endpointman_brand_list.name, endpointman_mac_list.global_custom_cfg_data, endpointman_mac_list.template_id FROM endpointman_mac_list , endpointman_model_list , endpointman_brand_list WHERE ( endpointman_model_list.id = endpointman_mac_list.model ) AND ( endpointman_model_list.brand = endpointman_brand_list.id )'; - $temp =& sql($sql,'getAll',DB_FETCHMODE_ASSOC); + $temp = sql($sql,'getAll',DB_FETCHMODE_ASSOC); return($temp); } @@ -60,7 +60,7 @@ function escapeSimple($query) { */ function all_models() { $sql="SELECT endpointman_model_list.* FROM endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_model_list.enabled = 1 AND endpointman_product_list.hidden = 0"; - $result1 =& $this->sql($sql, 'getAll',DB_FETCHMODE_ASSOC); + $result1 = sql($sql, 'getAll',DB_FETCHMODE_ASSOC); return($result1); } @@ -80,25 +80,25 @@ function all_models() { */ function all_active_brands() { $sql="SELECT DISTINCT endpointman_brand_list.name, endpointman_brand_list.id FROM endpointman_brand_list,endpointman_model_list WHERE endpointman_model_list.brand = endpointman_brand_list.id AND endpointman_model_list.enabled = 1 AND endpointman_model_list.hidden = 0 AND endpointman_brand_list.installed = 1 AND endpointman_brand_list.hidden = 0"; - $data =& sql($sql,'getAll', DB_FETCHMODE_ASSOC); + $data = sql($sql,'getAll', DB_FETCHMODE_ASSOC); return($data); } function all_models_by_product($product_id) { $sql="SELECT * FROM endpointman_model_list WHERE product_id = ".$product_id; - $result1 =& $this->sql($sql, 'getAll',DB_FETCHMODE_ASSOC); + $result1 = sql($sql, 'getAll',DB_FETCHMODE_ASSOC); return($result1); } function all_models_by_brand($brand_id) { $sql="SELECT endpointman_model_list.* FROM endpointman_model_list, endpointman_product_list WHERE endpointman_model_list.product_id = endpointman_product_list.id AND endpointman_model_list.enabled = 1 AND endpointman_product_list.hidden = 0 AND endpointman_model_list.brand = " . $brand_id; - $result1 =& $this->sql($sql, 'getAll',DB_FETCHMODE_ASSOC); + $result1 = sql($sql, 'getAll',DB_FETCHMODE_ASSOC); return($result1); } function all_unknown_devices() { $sql = 'SELECT * FROM endpointman_mac_list WHERE model = 0'; - $unknown_list =& sql($sql,'getAll',DB_FETCHMODE_ASSOC); + $unknown_list = sql($sql,'getAll',DB_FETCHMODE_ASSOC); return($unknown_list); } @@ -108,25 +108,25 @@ function all_unused_registrations() { } else { $not_added="SELECT devices.id, devices.description FROM devices WHERE tech in('sip','pjsip') AND devices.id not in (SELECT devices.id FROM devices, endpointman_line_list WHERE tech in ('sip','pjsip') AND devices.id = endpointman_line_list.ext ) ORDER BY devices.id"; } - $result =& sql($not_added,'getAll', DB_FETCHMODE_ASSOC); + $result = sql($not_added,'getAll', DB_FETCHMODE_ASSOC); return($result); } function all_used_registrations() { $not_added="SELECT devices.id, devices.description FROM devices WHERE tech in ('sip','pjsip') AND devices.id in (SELECT devices.id FROM devices, endpointman_line_list WHERE tech in ('sip','pjsip') AND devices.id = endpointman_line_list.ext ) ORDER BY devices.id"; - $result =& $this->sql($not_added,'getAll', DB_FETCHMODE_ASSOC); + $result = sql($not_added,'getAll', DB_FETCHMODE_ASSOC); return($result); } function get_lines_from_device($device_id) { $sql = 'SELECT * FROM endpointman_line_list WHERE mac_id = '.$device_id. ' ORDER BY endpointman_line_list.line ASC'; - $line_list =& sql($sql,'getAll',DB_FETCHMODE_ASSOC); + $line_list = sql($sql,'getAll',DB_FETCHMODE_ASSOC); return($line_list); } function get_line_information($line_id) { $sql = 'SELECT * FROM endpointman_line_list WHERE luid = '.$line_id; - $line_list =& sql($sql,'getRow',DB_FETCHMODE_ASSOC); + $line_list = sql($sql,'getRow',DB_FETCHMODE_ASSOC); return($line_list); } } diff --git a/lib/epm_system.class.php b/lib/epm_system.class.php index 6dea508a..13ed1d81 100644 --- a/lib/epm_system.class.php +++ b/lib/epm_system.class.php @@ -20,7 +20,7 @@ function display_htmlspecialchars($contents) { * @author http://www.php.net/manual/en/function.socket-create.php#43057 * @param string $host * @param string $filename - * @return mixed file contents + * @return mixed file contents */ function tftp_fetch($host, $filename) { //first off let's check if this is installed or disabled @@ -55,7 +55,7 @@ function tftp_fetch($host, $filename) { } while (strlen($buffer) == 516); // the first non-full packet is the last. return $ret; } - + /** * The RecursiveIteratorIterator must be told to provide children (files and subdirectories) before parents with its CHILD_FIRST constant. * Using RecursiveIteratorIterator is the only way PHP is able to see hidden files. @@ -77,7 +77,7 @@ function rmrf($dir) { @rmdir($dir); } } - + /** * Uses which to find executables that asterisk can run/use * @version 2.11 @@ -96,7 +96,7 @@ function find_exec($exec) { return(''); } } - + /** * Downloads a file and places it in the destination defined * @version 2.11 @@ -104,7 +104,7 @@ function find_exec($exec) { * @param string $destination_file Destination of file * @package epm_system */ - function download_file($url_file, $destination_file) { + function download_file($url_file, $destination_file, &$error = array()) { //Determine if file_get_contents_url exists which is the default FreePBX Standard for downloading straight files if(function_exists('file_get_contents_url')) { $contents = file_get_contents_url($url_file); @@ -112,7 +112,7 @@ function download_file($url_file, $destination_file) { //I really hope we NEVER get here. $contents = file_get_contents($url_file); if (!preg_match('/200/', $http_response_header[0])) { - $this->error['download_file'] = "Unknown Error in Download_file"; + $error['download_file'] = "Unknown Error in Download_file"; return false; } } @@ -123,22 +123,22 @@ function download_file($url_file, $destination_file) { mkdir($dirname); } if (!is_writable($dirname)) { - $this->error['download_file'] = "Directory '" . $dirname . "' is not writable! Unable to download files"; + $error['download_file'] = "Directory '" . $dirname . "' is not writable! Unable to download files"; return false; } file_put_contents($destination_file, $contents); //check file placement if (!file_exists($destination_file)) { - $this->error['download_file'] = "File Doesn't Exist in '" . $dirname . "'. Unable to download files"; + $error['download_file'] = "File Doesn't Exist in '" . $dirname . "'. Unable to download files"; return false; } return true; } else { - $this->error['download_file'] = "Contents of Remote file are blank! URL:".$url_file; + $error['download_file'] = "Contents of Remote file are blank! URL:".$url_file; return false; } } - + /** * Downloads a file and places it in the destination defined with progress * @version 2.11 @@ -146,36 +146,54 @@ function download_file($url_file, $destination_file) { * @param string $destination_file Destination of file * @package epm_system */ - function download_file_with_progress_bar($url_file, $destination_file) { + function download_file_with_progress_bar($url_file, $destination_file, &$error = array()) { set_time_limit(0); $headers = get_headers($url_file, 1); $size = $headers['Content-Length']; - + $randnumid = trim(mt_rand(1000000000,100000000000000).$pid); + if (preg_match('/200/', $headers[0])) { - $pid = $this->run_in_background("wget " . $url_file . " -O " . $destination_file); - + $pid = $this->run_in_background("wget --no-cache " . $url_file . " -O " . $destination_file); + + echo sprintf("
      "._("Downloading %s ...")."
      ", basename($destination_file)); + echo sprintf("
      ", $randnumid); + echo "
      0% ("._("Complete").")
      "; + echo "
      "; + usleep('300'); while ($this->is_process_running($pid)) { - - if(file_exists($destination_file)) { - $out = 100 * round(filesize($destination_file) / $size, 2); - echo ''; - } - + $out = 100 * round(filesize($destination_file) / $size, 2); + ?> + + + + "._("Downloading %s ...")."
      ", basename($destination_file)); + echo "
      "; + echo "
      0% ("._("Error: ").$headers[0]."!)
      "; + echo "
      "; + return false; } } - + /** * Taken from http://www.php.net/manual/en/function.array-search.php#69232 * search haystack for needle and return an array of the key path, FALSE otherwise. @@ -231,4 +249,4 @@ function is_process_running($PID) { exec("ps $PID", $ProcessState); return(count($ProcessState) >= 2); } -} +} \ No newline at end of file diff --git a/lib/json.class.php b/lib/json.class.php index 31591334..4d867d33 100644 --- a/lib/json.class.php +++ b/lib/json.class.php @@ -1,4 +1,6 @@ endpointman unsupported OSS PBX End Point Manager - 13.0.6.6 + 13.0.6.8 setup Connectivity GPLv2+ @@ -21,6 +21,8 @@ Pull Requests can be made to either of these and are encouraged. + *13.0.6.8* Fix Bug Package Version Firmware is null. + *13.0.6.7* More code updated and Fix Bug *13.0.6.6* Fix missing files issues *13.0.6.5* Remove array by reference *13.0.6.4* Fix bug, generate file list export brands through AJAX, delete code not required, organize files. diff --git a/views/epm_advanced/poce.views.bootnav.php b/views/epm_advanced/poce.views.bootnav.php index 8699b8d2..f428302d 100644 --- a/views/epm_advanced/poce.views.bootnav.php +++ b/views/epm_advanced/poce.views.bootnav.php @@ -1,5 +1,7 @@
      \ No newline at end of file From 2f8832e4e738751006ad1b0f61cd5ca74b85ad2b Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Wed, 9 Mar 2016 10:30:00 -0800 Subject: [PATCH 441/623] cleanup re forum comments --- Endpointman.class.php | 8 +- ari/modules/phonesettings.module | 6 +- assets/js/epm_advanced.js | 1562 +++++++++++----------- assets/js/epm_config.js | 1925 ++++++++++++++------------- assets/js/epm_global.js | 482 +++---- bin/freepbx_engine_hook_endpointman | 0 includes/abstraction/freepbx.inc | 24 +- includes/brand_model_manager.inc | 6 +- includes/devices_manager.inc | 22 +- includes/functions.inc | 21 +- includes/popup.inc | 62 +- includes/template_manager.inc | 14 +- install/phonesettings.module | 8 +- lib/epm_data_abstraction.class.php | 34 +- 14 files changed, 2108 insertions(+), 2066 deletions(-) mode change 100644 => 100755 bin/freepbx_engine_hook_endpointman diff --git a/Endpointman.class.php b/Endpointman.class.php index b497f390..a803e2a2 100644 --- a/Endpointman.class.php +++ b/Endpointman.class.php @@ -87,19 +87,19 @@ public function __construct($freepbx = null) { $this->configmod->set('tz', $this->config->get('PHPTIMEZONE')); - date_default_timezone_set($this->configmod->get('tz')); + //date_default_timezone_set($this->configmod->get('tz')); $this->UPDATE_PATH = $this->configmod->get('update_server'); $this->MODULES_PATH = $this->config->get('AMPWEBROOT') . '/admin/modules/'; -define("UPDATE_PATH", $this->UPDATE_PATH); -define("MODULES_PATH", $this->MODULES_PATH); + define("UPDATE_PATH", $this->UPDATE_PATH); + define("MODULES_PATH", $this->MODULES_PATH); //Determine if local path is correct! if (file_exists($this->MODULES_PATH . "endpointman/")) { $this->LOCAL_PATH = $this->MODULES_PATH . "endpointman/"; -define("LOCAL_PATH", $this->LOCAL_PATH); + define("LOCAL_PATH", $this->LOCAL_PATH); } else { die("Can't Load Local Endpoint Manager Directory!"); } diff --git a/ari/modules/phonesettings.module b/ari/modules/phonesettings.module index 6e9e8ebb..abb22e55 100644 --- a/ari/modules/phonesettings.module +++ b/ari/modules/phonesettings.module @@ -70,7 +70,7 @@ class phonesettings { $endpoint = new endpointmanager(); $sql = "SELECT mac_id, line FROM endpointman_line_list WHERE ext = '".$_SESSION['ari_user']['extension']."' "; - $mac_row =& $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); + $mac_row = $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); $mac_id = $mac_row['mac_id']; $line = $mac_row['line']; @@ -157,10 +157,10 @@ class phonesettings { $sql = "SELECT mac_id, line FROM endpointman_line_list WHERE ext = '".$_SESSION['ari_user']['extension']."' "; - $res =& $endpoint->eda->sql($sql); + $res = $endpoint->eda->sql($sql); if($res->numRows()) { - $mac_row =& $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); + $mac_row = $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); $mac_id = $mac_row['mac_id']; $line = $mac_row['line']; diff --git a/assets/js/epm_advanced.js b/assets/js/epm_advanced.js index 6ffe525b..45cb673f 100644 --- a/assets/js/epm_advanced.js +++ b/assets/js/epm_advanced.js @@ -1,775 +1,787 @@ -var cmeditor = null; - -function epm_advanced_document_ready () { - - var arrayJs = ['assets/endpointman/js/addon/simplescrollbars.js', 'assets/endpointman/js/mode/xml.js', 'assets/endpointman/js/addon/fullscreen.js']; - arrayJs.forEach(function (item, index, array) { - var x = document.createElement('script'); - x.src = item; - document.getElementsByTagName("head")[0].appendChild(x); - }); - - - //TAB SETTING - $('#settings input[type=text]').change(function(){ epm_advanced_tab_setting_input_change(this) }); - $('#settings input[type=radio]').change(function(){ epm_advanced_tab_setting_input_change(this) }); - $('#settings select').change(function(){ epm_advanced_tab_setting_input_change(this) }); - - - //TAB OUT_MANAGER - $('#AddDlgModal').on('show.bs.modal', function (event) { - $(this).find('input, select').val(""); - }); - $('#AddDlgModal_bt_new').on("click", function(){ epm_advanced_tab_oui_manager_bt_new(); }); - - - //TAB POCE - - - //TAB IEDL - - - //TAB MANUAL_UPLOAD - - -} - -function epm_advanced_windows_load (nTab = "") { - epm_advanced_select_tab_ajax(nTab); -} - -function epm_advanced_change_tab (nTab = "") { - epm_advanced_select_tab_ajax(nTab); -} - - -// INI: FUNCTION GLOBAL SEC - -function epm_advanced_select_tab_ajax(idtab) -{ - if (idtab == "") { - fpbxToast('epm_advanced_select_tab_ajax -> id invalid (' + idtab + ')!','JS!','warning'); - return false; - } - - if (idtab == "poce") - { - if (cmeditor == null) { - cmeditor = CodeMirror.fromTextArea(document.getElementById("config_textarea"), { - lineNumbers: true, - matchBrackets: true, - readOnly: true, - viewportMargin: Infinity, - scrollbarStyle: "simple", - extraKeys: { - "F11": function(cm) { - cm.setOption("fullScreen", !cm.getOption("fullScreen")); - }, - "Esc": function(cm) { - if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false); - } - } - }); - } - } - else if (idtab == "manual_upload") { - epm_advanced_tab_manual_upload_list_files_brand_expor(); - } - return true; -} - - -function close_module_actions_epm_advanced(goback, acctionname = "") -{ - -} - -function end_module_actions_epm_advanced(acctionname = "") -{ - if (acctionname == "manual_upload_bt_export_brand") { - epm_advanced_tab_manual_upload_list_files_brand_expor(); - } -} - -// END: FUNCTION GLOBAL SEC - - - - - - - - -// INI: FUNCTION TAB UPLOAD_MANUAL - -function epm_advanced_tab_manual_upload_bt_explor_brand() -{ - var packageid = $('#brand_export_pack_selected').val(); - if (packageid == "") { - alert ("You have not selected a brand from the list!"); - } - else if (packageid < 0) { - alert ("The id of the selected mark is invalid!"); - } - else { - var urlStr = "config.php?display=epm_advanced&subpage=manual_upload&command=export_brands_availables&package="+packageid; - epm_global_dialog_action("manual_upload_bt_export_brand", urlStr); - } -} - -function epm_advanced_tab_manual_upload_bt_upload(command, formname) -{ - if ((command == "") || (formname == "")) { return; } - var urlStr = "config.php?display=epm_advanced&subpage=manual_upload&command="+command; - epm_global_dialog_action("manual_upload_bt_upload", urlStr, formname); -} - -function epm_advanced_tab_manual_upload_list_files_brand_expor() -{ - epm_global_html_find_show_hide("#list-brands-export-item-loading", true, 0, true); - if ($("#list-brands-export li.item-list-brand-export").length > 0) { - $("#list-brands-export li.item-list-brand-export").hide("slow" , function () { - $(this).remove(); - epm_advanced_tab_manual_upload_list_files_brand_expor(); - }); - } - else { - $.ajax({ - type: 'POST', - url: "ajax.php", - data: { - module: "endpointman", - module_sec: "epm_advanced", - module_tab: "manual_upload", - command: "list_files_brands_export" - }, - dataType: 'json', - timeout: 60000, - error: function(xhr, ajaxOptions, thrownError) { - fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); - $("#list-brands-export").append($('
    • ', { 'class' : 'list-group-item item-list-brand-export text-center bg-warning' }).text('ERROR AJAX:' + thrownError)); - return false; - }, - beforeSend: function(){ - epm_global_html_find_show_hide("#list-brands-export-item-loading", true, 0, true); - }, - complete: function(){ - epm_global_html_find_show_hide("#list-brands-export-item-loading", false, 1000, true); - }, - success: function(data) { - if (data.status == true) { - if (data.countlist == 0) { - $("#list-brands-export").append($('
    • ', { 'class' : 'list-group-item item-list-brand-export' }).text("Empty list").append($('', { 'class' : 'label label-default label-pill pull-xs-right' }).text("0"))); - } - else { - $(data.list_brands).each(function(index, itemData) - { - $("#list-brands-export").append( - $('
    • ', { 'class' : 'list-group-item item-list-brand-export', 'id' : 'item-list-brans-export-' + itemData.name }) - .append( - $('', { - 'data-toggle' : 'collapse', - 'href' : '#box_list_files_brand_' + itemData.name, - 'aria-expanded' : 'false', - 'aria-controls' : 'box_list_files_brand_' + itemData.name, - 'class' : 'collapse-item list-group-item' - }) - .append( - $('', { 'class' : 'label label-default label-pill pull-xs-right' }).text(itemData.num), - $('', { 'class' : 'fa fa-expand' }) - ) - .append( - $("", {}).text(" " + itemData.name) - ) - ) - ); - if (itemData.num > 0) { - $('#item-list-brans-export-' + itemData.name).append( - $('
      ', { - 'class' : 'list-group collapse', - 'id' : 'box_list_files_brand_'+ itemData.name - }) - ); - } - }); - - $(data.list_files).each(function(index, itemData) - { - $('#box_list_files_brand_' + itemData.brand).append( - $('', { - 'href' : 'config.php?display=epm_advanced&subpage=manual_upload&command=export_brands_availables_file&file_package=' + itemData.file, - 'target': '_blank', - 'class' : 'list-group-item' - }) - .append( - $('', {'class' : 'label label-default label-pill pull-xs-right'}).text(itemData.timestamp), - $('', {'class' : 'fa fa-file-archive-o' }) - ) - .append($("", {}).text(" " + itemData.pathall)) - ); - }); - } - - //$('#manual_upload a.collapse-item').removeattr('onclick'); - $('#manual_upload a.collapse-item').on("click", function(){ - epm_global_html_css_name(this,"auto","active"); - $(this).blur(); - }); - - fpbxToast(data.message, '', 'success'); - return true; - } - else { - $("#list-brands-export").append( $('
    • ', { 'class' : 'list-group-item item-list-brand-export text-center bg-warning' }).text(data.message)); - fpbxToast(data.message, data.txt.error, 'error'); - return false; - } - }, - }); - } -} - -// END: FUNCTION TAB UPLOAD_MANUAL - - - - - - - - -// INI: FUNCTION TAB IEDL -function epm_advanced_tab_iedl_bt_import() -{ - var urlStr = "config.php?display=epm_advanced&subpage=iedl&command=import"; - var formname = "iedl_form_import_cvs"; - epm_global_dialog_action("iedlimport", urlStr, formname); -} -// END: FUNCTION TAB IEDL - - - - - - - - -// INI: FUNCTION TAB POCE -function epm_advanced_tab_poce_select_product(idsel, bclear = true) -{ - if ($.isNumeric(idsel) == false) { return; } - $("div.list-group>a.active").removeClass("active"); - $("#list_product_"+idsel).addClass("active").blur(); - - $.ajax({ - type: 'POST', - url: "ajax.php", - data: { - module: "endpointman", - module_sec: "epm_advanced", - module_tab: "poce", - command: "poce_select", - product_select: idsel - }, - dataType: 'json', - timeout: 60000, - error: function(xhr, ajaxOptions, thrownError) { - fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); - return false; - }, - success: function(data) { - if (bclear == true) { - $("#poce_file_name_path").text("No Selected"); - $('#config_textarea').prop('disabled', true); - if (cmeditor != null) { - cmeditor.setValue("Select file to config..."); - cmeditor.setOption("readOnly",true); - } - $("#box_sec_source button").prop('disabled', true); - $("#box_bt_save button").prop('disabled', true); - $("#box_bt_share button").prop('disabled', true); - $("#box_bt_save_as button").prop('disabled', true); - $("#box_bt_save_as input").prop('disabled', true).val(""); - $('form[name=form_config_text_sec_button] input[name=datosok]').val("false"); - } - - if (data.status == true) { - epm_advanced_tab_poce_create_file_list("#select_product_list_files_config", data.file_list, data.product_select, "file"); - epm_advanced_tab_poce_create_file_list("#select_product_list_files_template_custom", data.template_file_list, data.product_select, "tfile"); - epm_advanced_tab_poce_create_file_list("#select_product_list_files_user_config", data.sql_file_list, data.product_select, "sql"); - - if (bclear == true) { - $("#poce_NameProductSelect").text(data.product_select_info.long_name); - } - fpbxToast('Load date Done!', '', 'success'); - return true; - } - else { - epm_advanced_tab_poce_create_file_list("#select_product_list_files_config", "Error"); - epm_advanced_tab_poce_create_file_list("#select_product_list_files_template_custom", "Error"); - epm_advanced_tab_poce_create_file_list("#select_product_list_files_user_config", "Error"); - - $("#poce_NameProductSelect").text("Error get data!"); - - fpbxToast(data.message, data.txt.error, 'error'); - return false; - } - }, - }); -} - -function epm_advanced_tab_poce_create_file_list(idname, data = "", product_select = "", typefile="") -{ - $(idname + " div.dropdown-menu").empty(); - if (Array.isArray(data) == false) - { - $(idname + " span.label").text(0); - if (data == null) { data = "Emtry"; } - $(idname + " div.dropdown-menu") - .append( - $('', { 'href' : '#', 'class' : 'dropdown-item disable' }).text(data) - ) - return; - } - $(idname + " span.label").text(data.length); - $(data).each(function(index, itemData) - { - $(idname + " div.dropdown-menu") - .append( - $('', { - 'href' : 'javascript:epm_advanced_tab_poce_select_file_edit("'+ product_select +'", "'+ itemData.text +'", "'+ itemData.value +'", "'+ typefile +'");', - 'class' : 'dropdown-item bt', - 'id' : typefile + '_' + product_select + '_' + itemData.text +'_'+ itemData.value - }) - .text(itemData.text) - ) - }); - return; -} - -function epm_advanced_tab_poce_select_file_edit (idpro_select, txtnamefile, idnamefile, typefile) -{ - $.ajax({ - type: 'POST', - url: "ajax.php", - data: { - module: "endpointman", - module_sec: "epm_advanced", - module_tab: "poce", - command: "poce_select_file", - product_select: idpro_select, - file_id : idnamefile, - file_name : txtnamefile, - type_file : typefile - }, - dataType: 'json', - timeout: 60000, - error: function(xhr, ajaxOptions, thrownError) { - fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); - $("#poce_file_name_path").text("Error ajax!"); - - $('#config_textarea').prop('disabled', true); - if (cmeditor != null) { - cmeditor.setValue(""); - cmeditor.setOption("readOnly",true); - } - $("#box_sec_source button").prop('disabled', true); - $("#box_bt_save button").prop('disabled', true); - $("#box_bt_share button").prop('disabled', true); - $("#box_bt_save_as button").prop('disabled', true); - $("#box_bt_save_as input").prop('disabled', true).val(""); - $('form[name=form_config_text_sec_button] input[name=datosok]').val("false"); - return false; - }, - success: function(data) { - if (data.status == true) { - $("#poce_file_name_path").text(data.location); - $('#config_textarea').prop('disabled', false); - if (cmeditor != null) { - $("#box_sec_source button").prop('disabled', false); - cmeditor.setValue(data.config_data); - cmeditor.setOption("readOnly",false); - } - - if (data.type == "file") { - $("#box_bt_save button[name=button_save]").prop('disabled', false); - $("#box_bt_save button[name=button_delete]").prop('disabled', true); - $("#box_bt_share button").prop('disabled', false); - - $("#box_bt_save_as button").prop('disabled', true); - $("#box_bt_save_as input").prop('disabled', true).val(""); - } - else if (data.type == "tfile") { - $("#box_bt_save button").prop('disabled', true); - $("#box_bt_share button").prop('disabled', true); - - $("#box_bt_save_as button").prop('disabled', false); - $("#box_bt_save_as input").prop('disabled', false).val(data.save_as_name_value); - } - else if (data.type == "sql") { - $("#box_bt_save button").prop('disabled', false); - $("#box_bt_share button").prop('disabled', false); - - $("#box_bt_save_as button").prop('disabled', true); - $("#box_bt_save_as input").prop('disabled', true).val(data.save_as_name_value); - } - - $('form[name=form_config_text_sec_button] input[name=type_file]').val(data.type); - $('form[name=form_config_text_sec_button] input[name=sendid]').val(data.sendidt); - $('form[name=form_config_text_sec_button] input[name=product_select]').val(data.product_select); - $('form[name=form_config_text_sec_button] input[name=save_as_name]').val(data.save_as_name_value); - $('form[name=form_config_text_sec_button] input[name=original_name]').val(data.original_name); - $('form[name=form_config_text_sec_button] input[name=filename]').val(data.filename); - $('form[name=form_config_text_sec_button] input[name=location]').val(data.location); - $('form[name=form_config_text_sec_button] input[name=datosok]').val("true"); - - fpbxToast('File Load date Done!', '', 'success'); - return true; - } - else { - $("#poce_file_name_path").text("Error obteniendo datos!"); - $('#config_textarea').prop('disabled', true); - if (cmeditor != null) { - cmeditor.setValue(""); - cmeditor.setOption("readOnly",true); - } - $("#box_sec_source button").prop('disabled', true); - $("#box_bt_save button").prop('disabled', true); - $("#box_bt_share button").prop('disabled', true); - $("#box_bt_save_as button").prop('disabled', true); - $("#box_bt_save_as input").prop('disabled', true).val(""); - $('form[name=form_config_text_sec_button] input[name=datosok]').val("false"); - fpbxToast(data.message, "Error!", 'error'); - return false; - } - }, - }); - -} - -function epm_advanced_tab_poce_bt_acction (command) -{ - if (command == "") { return; } - var obj_name = $(command).attr("name").toLowerCase(); - - if (obj_name == "bt_source_full_screen") - { - cmeditor.setOption('fullScreen', !cmeditor.getOption('fullScreen')); - return true; - } - - if (epm_advanced_get_value_by_form("form_config_text_sec_button","datosok") == false) - { - fpbxToast("The form is not ready!", "Error!", 'error'); - return false; - } - - switch(obj_name) { - case "button_save": - if (confirm("Are you sure to save your changes will be overwritten irreversibly?") == false) { - return; - } - - var cfg_data = { - module: "endpointman", - module_sec: "epm_advanced", - module_tab: "poce", - command: "poce_save_file", - type_file: epm_advanced_get_value_by_form("form_config_text_sec_button","type_file"), - sendid : epm_advanced_get_value_by_form("form_config_text_sec_button","sendid"), - product_select: epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), - save_as_name: epm_advanced_get_value_by_form("form_config_text_sec_button","save_as_name"), - original_name: epm_advanced_get_value_by_form("form_config_text_sec_button","original_name"), - file_name: epm_advanced_get_value_by_form("form_config_text_sec_button","filename"), - config_text: cmeditor.getValue() - }; - break; - - case "button_save_as": - var cfg_data = { - module: "endpointman", - module_sec: "epm_advanced", - module_tab: "poce", - command: "poce_save_as_file", - type_file: epm_advanced_get_value_by_form("form_config_text_sec_button","type_file"), - sendid : epm_advanced_get_value_by_form("form_config_text_sec_button","sendid"), - product_select: epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), - save_as_name: epm_advanced_get_value_by_form("form_config_text_sec_button","save_as_name"), - original_name: epm_advanced_get_value_by_form("form_config_text_sec_button","original_name"), - file_name: epm_advanced_get_value_by_form("form_config_text_sec_button","filename"), - config_text: cmeditor.getValue() - }; - break; - - case "button_delete": - if (confirm("Are you sure you want to delete this file from the database?") == false) { - return; - } - - var cfg_data = { - module: "endpointman", - module_sec: "epm_advanced", - module_tab: "poce", - command: "poce_delete_config_custom", - type_file : epm_advanced_get_value_by_form("form_config_text_sec_button","type_file"), - product_select: epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), - sql_select: epm_advanced_get_value_by_form("form_config_text_sec_button","sendid"), - }; - break; - - case "button_share": - var cfg_data = { - module: "endpointman", - module_sec: "epm_advanced", - module_tab: "poce", - command: "poce_sendid", - type_file : epm_advanced_get_value_by_form("form_config_text_sec_button","type_file"), - sendid : epm_advanced_get_value_by_form("form_config_text_sec_button","sendid"), - product_select: epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), - original_name: epm_advanced_get_value_by_form("form_config_text_sec_button","original_name"), - file_name: epm_advanced_get_value_by_form("form_config_text_sec_button","filename"), - config_text : cmeditor.getValue() - }; - break; - - default: - alert ("Command not found!"); - return false; - } - - $.ajax({ - type: 'POST', - url: "ajax.php", - data: cfg_data, - dataType: 'json', - timeout: 60000, - error: function(xhr, ajaxOptions, thrownError) { - fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); - $("#poce_file_name_path").text("Error ajax!"); - return false; - }, - success: function(data) { - if (data.status == true) { - switch(obj_name) { - case "button_save": - - epm_advanced_tab_poce_select_product(epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), false); - fpbxToast(data.message, 'Save!', 'success'); - break; - - case "button_save_as": - $('form[name=form_config_text_sec_button] input[name=type_file]').val(data.type_file); - $('form[name=form_config_text_sec_button] input[name=sendid]').val(data.sendidt); - $('form[name=form_config_text_sec_button] input[name=location]').val(data.location); - - $("#poce_file_name_path").text(data.location); - $("#box_bt_save button").prop('disabled', false); - $("#box_bt_share button").prop('disabled', false); - $("#box_bt_save_as button").prop('disabled', true); - $("#box_bt_save_as input").prop('disabled', true); - - epm_advanced_tab_poce_select_product(epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), false); - fpbxToast(data.message, 'Save as!', 'success'); - break; - - case "button_delete": - - epm_advanced_tab_poce_select_product(epm_advanced_get_value_by_form("form_config_text_sec_button","product_select")); - fpbxToast(data.message, 'Delete!', 'success'); - break; - - case "button_share": - fpbxToast(data.message, 'Share!', 'success'); - break; - - default: - fpbxToast(data.message, '', 'success'); - } - return true; - } - else { - fpbxToast(data.message, "Error!", 'error'); - return false; - } - }, - }); - -} -// END: FUNCTION TAB POCE - - - - - - - - -// INI: FUNCTION TAB OUI MANAGER -function epm_advanced_tab_oui_manager_grid_actionFormatter(value, row, index){ - var html = ''; - if (row.custom == 1) { - html += ''; - } - else { - html += ''; - } - return html; -} - -function epm_advanced_tab_oui_manager_grid_customFormatter(value, row, index){ - var html = ''; - if (value == 1) { - html += ' Custom'; - } - else { - html += ' Required'; - } - return html; -} - - -function epm_advanced_tab_oui_manager_refresh_table(showmsg = true) -{ - $("#mygrid").bootstrapTable('refresh'); - if (showmsg == true) { - fpbxToast("Table Refrash Ok!", '', 'success'); - } -} - -function epm_advanced_tab_oui_manager_bt_new() -{ - var new_oui = $("#number_new_oui").val().trim(); - var new_brand = $("#brand_new_oui").val(); - - if (new_oui.length < "6") { - fpbxToast('New: Input OUI not valid!','Warning!','warning'); - } - else if (new_brand == "") { - fpbxToast('New: No select Brand!','Warning!','warning'); - } - else { - var data_ajax = { module: "endpointman", module_sec: "epm_advanced", module_tab: "oui_manager", command: "oui_add", number_new_oui: new_oui, brand_new_oui: new_brand }; - if (epm_advanced_tab_oui_manager_ajax(data_ajax) == true) { - fpbxToast("New OUI add Ok!", '', 'success'); - $("#mygrid").bootstrapTable('refresh'); - $("#AddDlgModal").modal('hide'); - } - - //epm_advanced_tab_oui_manager_ajax("new", data_ajax, objbox); - } -} - -function epm_advanced_tab_oui_manager_bt_del(id_del) -{ - if (id_del == "") { - fpbxToast('Delete: No ID set!','Warning!','warning'); - } - else { - var data_ajax = { module: "endpointman", module_sec: "epm_advanced", module_tab: "oui_manager", command: "oui_del", id_del: id_del }; - if (epm_advanced_tab_oui_manager_ajax(data_ajax) == true) { - fpbxToast("OUI delete Ok!", '', 'success'); - $("#mygrid").bootstrapTable('refresh'); - } - - //epm_advanced_tab_oui_manager_ajax("del", data_ajax); - } -} - -function epm_advanced_tab_oui_manager_ajax (data_ajax = ""){ - var response = false; - if (data_ajax != "") { - $.ajax({ - async: false, - type: 'POST', - url: "ajax.php", - data: data_ajax, - dataType: 'json', - timeout: 60000, - error: function(xhr, ajaxOptions, thrownError) { - fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); - return false; - }, - success: function(data) { - if (data.status == true) { - response = true; - } - else { - fpbxToast(data.message, "Error!", 'error'); - response = false; - } - } - }); - } - return response; -} -// END: FUNCTION TAB OUI MANAGER - - - - -// INI: FUNCTION TAB SETTING -function epm_advanced_tab_setting_input_value_change_bt(sNameID, sValue = "", bSaveChange = true, bSetFocus = false) -{ - $(sNameID).val(sValue); - if (bSetFocus == true) { $(sNameID).focus(); } - if (bSaveChange == true) { - epm_advanced_tab_setting_input_change(sNameID); - - } -} - -function epm_advanced_tab_setting_input_change(obt) -{ - idtab = epm_global_get_tab_actual(); - if (idtab == "") { return; } - - var obt_name = $(obt).attr("name").toLowerCase(); - var obt_val = $(obt).val().toLowerCase(); - - $.ajax({ - type: 'POST', - url: "ajax.php", - data: { - module: "endpointman", - module_sec: "epm_advanced", - module_tab: idtab, - command: "saveconfig", - name: obt_name, - value: obt_val - }, - dataType: 'json', - timeout: 60000, - error: function(xhr, ajaxOptions, thrownError) { - fpbxToast('ERROR AJAX 1:' + thrownError,'ERROR (' + xhr.status + ')!','error'); - $("#" + obt_name + "_no").attr("disabled", true).prop( "checked", false); - $("#" + obt_name + "_yes").attr("disabled", true).prop( "checked", false); - return false; - }, - success: function(data) { - if (data.status == true) { - if (obt_val == "1") - { - //true - } - else - { - //false - } - fpbxToast(data.txt.save_changes_ok, '', 'success'); - //if (data.reload == true) { location.reload(); } - //if (data.name == "tftp_check") { location.reload(); } - //if (data.name == "use_repo") { location.reload(); } - - - return true; - } - else { - fpbxToast(data.message, data.txt.error, 'error'); - $("#" + obt_name + "_no").attr("disabled", true).prop("checked", false); - $("#" + obt_name + "_yes").attr("disabled", true).prop("checked", false); - return false; - } - }, - }); -} -// END: FUNCTION TAB SETTING \ No newline at end of file +var cmeditor = null; + +function epm_advanced_document_ready () { + + var arrayJs = ['assets/endpointman/js/addon/simplescrollbars.js', 'assets/endpointman/js/mode/xml.js', 'assets/endpointman/js/addon/fullscreen.js']; + arrayJs.forEach(function (item, index, array) { + var x = document.createElement('script'); + x.src = item; + document.getElementsByTagName("head")[0].appendChild(x); + }); + + + //TAB SETTING + $('#settings input[type=text]').change(function(){ epm_advanced_tab_setting_input_change(this); }); + $('#settings input[type=radio]').change(function(){ epm_advanced_tab_setting_input_change(this); }); + $('#settings select').change(function(){ epm_advanced_tab_setting_input_change(this); }); + + + //TAB OUT_MANAGER + $('#AddDlgModal').on('show.bs.modal', function (event) { + $(this).find('input, select').val(""); + }); + $('#AddDlgModal_bt_new').on("click", function(){ epm_advanced_tab_oui_manager_bt_new(); }); + + + //TAB POCE + + + //TAB IEDL + + + //TAB MANUAL_UPLOAD + + +} + +function epm_advanced_windows_load (nTab) { + nTab = typeof nTab !== "undefined" ? nTab : ""; + epm_advanced_select_tab_ajax(nTab); +} + +function epm_advanced_change_tab (nTab) { + nTab = typeof nTab !== "undefined" ? nTab : ""; + epm_advanced_select_tab_ajax(nTab); +} + + +// INI: FUNCTION GLOBAL SEC + +function epm_advanced_select_tab_ajax(idtab) { + idtab = typeof idtab !== "undefined" ? idtab : ""; + if (idtab === "") { + fpbxToast('epm_advanced_select_tab_ajax -> id invalid (' + idtab + ')!','JS!','warning'); + return false; + } + + if (idtab == "poce") + { + if (cmeditor === null) { + cmeditor = CodeMirror.fromTextArea(document.getElementById("config_textarea"), { + lineNumbers: true, + matchBrackets: true, + readOnly: true, + viewportMargin: Infinity, + scrollbarStyle: "simple", + extraKeys: { + "F11": function(cm) { + cm.setOption("fullScreen", !cm.getOption("fullScreen")); + }, + "Esc": function(cm) { + if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false); + } + } + }); + } + } + else if (idtab == "manual_upload") { + epm_advanced_tab_manual_upload_list_files_brand_expor(); + } + return true; +} + + +function close_module_actions_epm_advanced(goback, acctionname) { + goback = typeof goback !== "undefined" ? goback : ""; + acctionname = typeof acctionname !== "undefined" ? acctionname : ""; +} + +function end_module_actions_epm_advanced(acctionname) { + acctionname = typeof acctionname !== "undefined" ? acctionname : ""; + if (acctionname == "manual_upload_bt_export_brand") { + epm_advanced_tab_manual_upload_list_files_brand_expor(); + } +} + +// END: FUNCTION GLOBAL SEC + + + + + + + + +// INI: FUNCTION TAB UPLOAD_MANUAL + +function epm_advanced_tab_manual_upload_bt_explor_brand() { + var packageid = $('#brand_export_pack_selected').val(); + if (packageid === "") { + alert ("You have not selected a brand from the list!"); + } + else if (packageid < 0) { + alert ("The id of the selected mark is invalid!"); + } + else { + var urlStr = "config.php?display=epm_advanced&subpage=manual_upload&command=export_brands_availables&package="+packageid; + epm_global_dialog_action("manual_upload_bt_export_brand", urlStr); + } +} + +function epm_advanced_tab_manual_upload_bt_upload(command, formname) { + command = typeof command !== "undefined" ? command : ""; + formname = typeof formnname !== "undefined" ? formname : ""; + + if ((command === "") || (formname === "")) { return; } + var urlStr = "config.php?display=epm_advanced&subpage=manual_upload&command="+command; + epm_global_dialog_action("manual_upload_bt_upload", urlStr, formname); +} + +function epm_advanced_tab_manual_upload_list_files_brand_expor() { + epm_global_html_find_show_hide("#list-brands-export-item-loading", true, 0, true); + if ($("#list-brands-export li.item-list-brand-export").length > 0) { + $("#list-brands-export li.item-list-brand-export").hide("slow" , function () { + $(this).remove(); + epm_advanced_tab_manual_upload_list_files_brand_expor(); + }); + } + else { + $.ajax({ + type: 'POST', + url: "ajax.php", + data: { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "manual_upload", + command: "list_files_brands_export" + }, + dataType: 'json', + timeout: 60000, + error: function(xhr, ajaxOptions, thrownError) { + fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); + $("#list-brands-export").append($('
    • ', { 'class' : 'list-group-item item-list-brand-export text-center bg-warning' }).text('ERROR AJAX:' + thrownError)); + return false; + }, + beforeSend: function(){ + epm_global_html_find_show_hide("#list-brands-export-item-loading", true, 0, true); + }, + complete: function(){ + epm_global_html_find_show_hide("#list-brands-export-item-loading", false, 1000, true); + }, + success: function(data) { + if (data.status === true) { + if (data.countlist === 0) { + $("#list-brands-export").append($('
    • ', { 'class' : 'list-group-item item-list-brand-export' }).text("Empty list").append($('', { 'class' : 'label label-default label-pill pull-xs-right' }).text("0"))); + } + else { + $(data.list_brands).each(function(index, itemData) + { + $("#list-brands-export").append( + $('
    • ', { 'class' : 'list-group-item item-list-brand-export', 'id' : 'item-list-brans-export-' + itemData.name }) + .append( + $('', { + 'data-toggle' : 'collapse', + 'href' : '#box_list_files_brand_' + itemData.name, + 'aria-expanded' : 'false', + 'aria-controls' : 'box_list_files_brand_' + itemData.name, + 'class' : 'collapse-item list-group-item' + }) + .append( + $('', { 'class' : 'label label-default label-pill pull-xs-right' }).text(itemData.num), + $('', { 'class' : 'fa fa-expand' }) + ) + .append( + $("", {}).text(" " + itemData.name) + ) + ) + ); + if (itemData.num > 0) { + $('#item-list-brans-export-' + itemData.name).append( + $('
      ', { + 'class' : 'list-group collapse', + 'id' : 'box_list_files_brand_'+ itemData.name + }) + ); + } + }); + + $(data.list_files).each(function(index, itemData) + { + $('#box_list_files_brand_' + itemData.brand).append( + $('', { + 'href' : 'config.php?display=epm_advanced&subpage=manual_upload&command=export_brands_availables_file&file_package=' + itemData.file, + 'target': '_blank', + 'class' : 'list-group-item' + }) + .append( + $('', {'class' : 'label label-default label-pill pull-xs-right'}).text(itemData.timestamp), + $('', {'class' : 'fa fa-file-archive-o' }) + ) + .append($("", {}).text(" " + itemData.pathall)) + ); + }); + } + + //$('#manual_upload a.collapse-item').removeattr('onclick'); + $('#manual_upload a.collapse-item').on("click", function(){ + epm_global_html_css_name(this,"auto","active"); + $(this).blur(); + }); + + fpbxToast(data.message, '', 'success'); + return true; + } + else { + $("#list-brands-export").append( $('
    • ', { 'class' : 'list-group-item item-list-brand-export text-center bg-warning' }).text(data.message)); + fpbxToast(data.message, data.txt.error, 'error'); + return false; + } + }, + }); + } +} + +// END: FUNCTION TAB UPLOAD_MANUAL + + + + + + + + +// INI: FUNCTION TAB IEDL +function epm_advanced_tab_iedl_bt_import() +{ + var urlStr = "config.php?display=epm_advanced&subpage=iedl&command=import"; + var formname = "iedl_form_import_cvs"; + epm_global_dialog_action("iedlimport", urlStr, formname); +} +// END: FUNCTION TAB IEDL + + + + + + + + +// INI: FUNCTION TAB POCE +function epm_advanced_tab_poce_select_product(idsel, bclear) { + bclear = typeof bclear !== "undefined" ? bclear : true; + + if ($.isNumeric(idsel) === false) { return; } + $("div.list-group>a.active").removeClass("active"); + $("#list_product_"+idsel).addClass("active").blur(); + + $.ajax({ + type: 'POST', + url: "ajax.php", + data: { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "poce", + command: "poce_select", + product_select: idsel + }, + dataType: 'json', + timeout: 60000, + error: function(xhr, ajaxOptions, thrownError) { + fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); + return false; + }, + success: function(data) { + if (bclear === true) { + $("#poce_file_name_path").text("No Selected"); + $('#config_textarea').prop('disabled', true); + if (cmeditor !== null) { + cmeditor.setValue("Select file to config..."); + cmeditor.setOption("readOnly",true); + } + $("#box_sec_source button").prop('disabled', true); + $("#box_bt_save button").prop('disabled', true); + $("#box_bt_share button").prop('disabled', true); + $("#box_bt_save_as button").prop('disabled', true); + $("#box_bt_save_as input").prop('disabled', true).val(""); + $('form[name=form_config_text_sec_button] input[name=datosok]').val("false"); + } + + if (data.status === true) { + epm_advanced_tab_poce_create_file_list("#select_product_list_files_config", data.file_list, data.product_select, "file"); + epm_advanced_tab_poce_create_file_list("#select_product_list_files_template_custom", data.template_file_list, data.product_select, "tfile"); + epm_advanced_tab_poce_create_file_list("#select_product_list_files_user_config", data.sql_file_list, data.product_select, "sql"); + + if (bclear === true) { + $("#poce_NameProductSelect").text(data.product_select_info.long_name); + } + fpbxToast('Load date Done!', '', 'success'); + return true; + } + else { + epm_advanced_tab_poce_create_file_list("#select_product_list_files_config", "Error"); + epm_advanced_tab_poce_create_file_list("#select_product_list_files_template_custom", "Error"); + epm_advanced_tab_poce_create_file_list("#select_product_list_files_user_config", "Error"); + + $("#poce_NameProductSelect").text("Error get data!"); + + fpbxToast(data.message, data.txt.error, 'error'); + return false; + } + }, + }); +} + +function epm_advanced_tab_poce_create_file_list(idname, data, product_select, typefile) { + data = typeof data !== "undefined" ? data : ""; + product_select = typeof product_select !== "undefined" ? product_select : ""; + typefile = typeof typefile !== "undefined" ? typefile : ""; + + $(idname + " div.dropdown-menu").empty(); + if (Array.isArray(data) === false) + { + $(idname + " span.label").text(0); + if (data === null) { data = "Emtry"; } + $(idname + " div.dropdown-menu") + .append( + $('', { 'href' : '#', 'class' : 'dropdown-item disable' }).text(data) + ); + return; + } + $(idname + " span.label").text(data.length); + $(data).each(function(index, itemData) + { + $(idname + " div.dropdown-menu") + .append( + $('', { + 'href' : 'javascript:epm_advanced_tab_poce_select_file_edit("'+ product_select +'", "'+ itemData.text +'", "'+ itemData.value +'", "'+ typefile +'");', + 'class' : 'dropdown-item bt', + 'id' : typefile + '_' + product_select + '_' + itemData.text +'_'+ itemData.value + }) + .text(itemData.text) + ); + }); + return; +} + +function epm_advanced_tab_poce_select_file_edit (idpro_select, txtnamefile, idnamefile, typefile) +{ + $.ajax({ + type: 'POST', + url: "ajax.php", + data: { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "poce", + command: "poce_select_file", + product_select: idpro_select, + file_id : idnamefile, + file_name : txtnamefile, + type_file : typefile + }, + dataType: 'json', + timeout: 60000, + error: function(xhr, ajaxOptions, thrownError) { + fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); + $("#poce_file_name_path").text("Error ajax!"); + + $('#config_textarea').prop('disabled', true); + if (cmeditor !== null) { + cmeditor.setValue(""); + cmeditor.setOption("readOnly",true); + } + $("#box_sec_source button").prop('disabled', true); + $("#box_bt_save button").prop('disabled', true); + $("#box_bt_share button").prop('disabled', true); + $("#box_bt_save_as button").prop('disabled', true); + $("#box_bt_save_as input").prop('disabled', true).val(""); + $('form[name=form_config_text_sec_button] input[name=datosok]').val("false"); + return false; + }, + success: function(data) { + if (data.status === true) { + $("#poce_file_name_path").text(data.location); + $('#config_textarea').prop('disabled', false); + if (cmeditor !== null) { + $("#box_sec_source button").prop('disabled', false); + cmeditor.setValue(data.config_data); + cmeditor.setOption("readOnly",false); + } + + if (data.type == "file") { + $("#box_bt_save button[name=button_save]").prop('disabled', false); + $("#box_bt_save button[name=button_delete]").prop('disabled', true); + $("#box_bt_share button").prop('disabled', false); + + $("#box_bt_save_as button").prop('disabled', true); + $("#box_bt_save_as input").prop('disabled', true).val(""); + } + else if (data.type == "tfile") { + $("#box_bt_save button").prop('disabled', true); + $("#box_bt_share button").prop('disabled', true); + + $("#box_bt_save_as button").prop('disabled', false); + $("#box_bt_save_as input").prop('disabled', false).val(data.save_as_name_value); + } + else if (data.type == "sql") { + $("#box_bt_save button").prop('disabled', false); + $("#box_bt_share button").prop('disabled', false); + + $("#box_bt_save_as button").prop('disabled', true); + $("#box_bt_save_as input").prop('disabled', true).val(data.save_as_name_value); + } + + $('form[name=form_config_text_sec_button] input[name=type_file]').val(data.type); + $('form[name=form_config_text_sec_button] input[name=sendid]').val(data.sendidt); + $('form[name=form_config_text_sec_button] input[name=product_select]').val(data.product_select); + $('form[name=form_config_text_sec_button] input[name=save_as_name]').val(data.save_as_name_value); + $('form[name=form_config_text_sec_button] input[name=original_name]').val(data.original_name); + $('form[name=form_config_text_sec_button] input[name=filename]').val(data.filename); + $('form[name=form_config_text_sec_button] input[name=location]').val(data.location); + $('form[name=form_config_text_sec_button] input[name=datosok]').val("true"); + + fpbxToast('File Load date Done!', '', 'success'); + return true; + } + else { + $("#poce_file_name_path").text("Error obteniendo datos!"); + $('#config_textarea').prop('disabled', true); + if (cmeditor !== null) { + cmeditor.setValue(""); + cmeditor.setOption("readOnly",true); + } + $("#box_sec_source button").prop('disabled', true); + $("#box_bt_save button").prop('disabled', true); + $("#box_bt_share button").prop('disabled', true); + $("#box_bt_save_as button").prop('disabled', true); + $("#box_bt_save_as input").prop('disabled', true).val(""); + $('form[name=form_config_text_sec_button] input[name=datosok]').val("false"); + fpbxToast(data.message, "Error!", 'error'); + return false; + } + }, + }); + +} + +function epm_advanced_tab_poce_bt_acction (command) +{ + if (command === "") { return; } + var obj_name = $(command).attr("name").toLowerCase(); + + if (obj_name == "bt_source_full_screen") + { + cmeditor.setOption('fullScreen', !cmeditor.getOption('fullScreen')); + return true; + } + + if (epm_advanced_get_value_by_form("form_config_text_sec_button","datosok") === false) + { + fpbxToast("The form is not ready!", "Error!", 'error'); + return false; + } + + var cfg_data; + switch(obj_name) { + case "button_save": + if (confirm("Are you sure to save your changes will be overwritten irreversibly?") === false) { + return; + } + + cfg_data = { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "poce", + command: "poce_save_file", + type_file: epm_advanced_get_value_by_form("form_config_text_sec_button","type_file"), + sendid : epm_advanced_get_value_by_form("form_config_text_sec_button","sendid"), + product_select: epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), + save_as_name: epm_advanced_get_value_by_form("form_config_text_sec_button","save_as_name"), + original_name: epm_advanced_get_value_by_form("form_config_text_sec_button","original_name"), + file_name: epm_advanced_get_value_by_form("form_config_text_sec_button","filename"), + config_text: cmeditor.getValue() + }; + break; + + case "button_save_as": + cfg_data = { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "poce", + command: "poce_save_as_file", + type_file: epm_advanced_get_value_by_form("form_config_text_sec_button","type_file"), + sendid : epm_advanced_get_value_by_form("form_config_text_sec_button","sendid"), + product_select: epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), + save_as_name: epm_advanced_get_value_by_form("form_config_text_sec_button","save_as_name"), + original_name: epm_advanced_get_value_by_form("form_config_text_sec_button","original_name"), + file_name: epm_advanced_get_value_by_form("form_config_text_sec_button","filename"), + config_text: cmeditor.getValue() + }; + break; + + case "button_delete": + if (confirm("Are you sure you want to delete this file from the database?") === false) { + return; + } + + cfg_data = { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "poce", + command: "poce_delete_config_custom", + type_file : epm_advanced_get_value_by_form("form_config_text_sec_button","type_file"), + product_select: epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), + sql_select: epm_advanced_get_value_by_form("form_config_text_sec_button","sendid"), + }; + break; + + case "button_share": + cfg_data = { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: "poce", + command: "poce_sendid", + type_file : epm_advanced_get_value_by_form("form_config_text_sec_button","type_file"), + sendid : epm_advanced_get_value_by_form("form_config_text_sec_button","sendid"), + product_select: epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), + original_name: epm_advanced_get_value_by_form("form_config_text_sec_button","original_name"), + file_name: epm_advanced_get_value_by_form("form_config_text_sec_button","filename"), + config_text : cmeditor.getValue() + }; + break; + + default: + alert ("Command not found!"); + return false; + } + + $.ajax({ + type: 'POST', + url: "ajax.php", + data: cfg_data, + dataType: 'json', + timeout: 60000, + error: function(xhr, ajaxOptions, thrownError) { + fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); + $("#poce_file_name_path").text("Error ajax!"); + return false; + }, + success: function(data) { + if (data.status === true) { + switch(obj_name) { + case "button_save": + + epm_advanced_tab_poce_select_product(epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), false); + fpbxToast(data.message, 'Save!', 'success'); + break; + + case "button_save_as": + $('form[name=form_config_text_sec_button] input[name=type_file]').val(data.type_file); + $('form[name=form_config_text_sec_button] input[name=sendid]').val(data.sendidt); + $('form[name=form_config_text_sec_button] input[name=location]').val(data.location); + + $("#poce_file_name_path").text(data.location); + $("#box_bt_save button").prop('disabled', false); + $("#box_bt_share button").prop('disabled', false); + $("#box_bt_save_as button").prop('disabled', true); + $("#box_bt_save_as input").prop('disabled', true); + + epm_advanced_tab_poce_select_product(epm_advanced_get_value_by_form("form_config_text_sec_button","product_select"), false); + fpbxToast(data.message, 'Save as!', 'success'); + break; + + case "button_delete": + + epm_advanced_tab_poce_select_product(epm_advanced_get_value_by_form("form_config_text_sec_button","product_select")); + fpbxToast(data.message, 'Delete!', 'success'); + break; + + case "button_share": + fpbxToast(data.message, 'Share!', 'success'); + break; + + default: + fpbxToast(data.message, '', 'success'); + } + return true; + } + else { + fpbxToast(data.message, "Error!", 'error'); + return false; + } + }, + }); + +} +// END: FUNCTION TAB POCE + + + + + + + + +// INI: FUNCTION TAB OUI MANAGER +function epm_advanced_tab_oui_manager_grid_actionFormatter(value, row, index){ + var html = ''; + if (row.custom == 1) { + html += ''; + } + else { + html += ''; + } + return html; +} + +function epm_advanced_tab_oui_manager_grid_customFormatter(value, row, index){ + var html = ''; + if (value == 1) { + html += ' Custom'; + } + else { + html += ' Required'; + } + return html; +} + + +function epm_advanced_tab_oui_manager_refresh_table(showmsg) +{ + showmsg = typeof showmsg !== "undefined" ? showmsg : true; + $("#mygrid").bootstrapTable('refresh'); + if (showmsg === true) { + fpbxToast("Table Refrash Ok!", '', 'success'); + } +} + +function epm_advanced_tab_oui_manager_bt_new() +{ + var new_oui = $("#number_new_oui").val().trim(); + var new_brand = $("#brand_new_oui").val(); + + if (new_oui.length < "6") { + fpbxToast('New: Input OUI not valid!','Warning!','warning'); + } + else if (new_brand === "") { + fpbxToast('New: No select Brand!','Warning!','warning'); + } + else { + var data_ajax = { module: "endpointman", module_sec: "epm_advanced", module_tab: "oui_manager", command: "oui_add", number_new_oui: new_oui, brand_new_oui: new_brand }; + if (epm_advanced_tab_oui_manager_ajax(data_ajax) === true) { + fpbxToast("New OUI add Ok!", '', 'success'); + $("#mygrid").bootstrapTable('refresh'); + $("#AddDlgModal").modal('hide'); + } + + //epm_advanced_tab_oui_manager_ajax("new", data_ajax, objbox); + } +} + +function epm_advanced_tab_oui_manager_bt_del(id_del) +{ + if (id_del === "") { + fpbxToast('Delete: No ID set!','Warning!','warning'); + } + else { + var data_ajax = { module: "endpointman", module_sec: "epm_advanced", module_tab: "oui_manager", command: "oui_del", id_del: id_del }; + if (epm_advanced_tab_oui_manager_ajax(data_ajax) === true) { + fpbxToast("OUI delete Ok!", '', 'success'); + $("#mygrid").bootstrapTable('refresh'); + } + + //epm_advanced_tab_oui_manager_ajax("del", data_ajax); + } +} + +function epm_advanced_tab_oui_manager_ajax (data_ajax){ + data_ajax = typeof dataajax !== "undefined" ? data_ajax : ""; + var response = false; + if (data_ajax !== "") { + $.ajax({ + async: false, + type: 'POST', + url: "ajax.php", + data: data_ajax, + dataType: 'json', + timeout: 60000, + error: function(xhr, ajaxOptions, thrownError) { + fpbxToast('ERROR AJAX:' + thrownError,'ERROR (' + xhr.status + ')!','error'); + return false; + }, + success: function(data) { + if (data.status === true) { + response = true; + } + else { + fpbxToast(data.message, "Error!", 'error'); + response = false; + } + } + }); + } + return response; +} +// END: FUNCTION TAB OUI MANAGER + + + + +// INI: FUNCTION TAB SETTING +function epm_advanced_tab_setting_input_value_change_bt(sNameID, sValue, bSaveChange, bSetFocus) +{ + sValue = typeof sValue !== "undefined" ? sValue : ""; + bSaveChange = typeof bSaveChange !== "undefined" ? bSaveChange : true; + bSetFocus = typeof bSetFocus !== "undefined" ? bSetFocus : false; + $(sNameID).val(sValue); + if (bSetFocus === true) { $(sNameID).focus(); } + if (bSaveChange === true) { + epm_advanced_tab_setting_input_change(sNameID); + + } +} + +function epm_advanced_tab_setting_input_change(obt) +{ + idtab = epm_global_get_tab_actual(); + if (idtab === "") { return; } + + var obt_name = $(obt).attr("name").toLowerCase(); + var obt_val = $(obt).val().toLowerCase(); + + $.ajax({ + type: 'POST', + url: "ajax.php", + data: { + module: "endpointman", + module_sec: "epm_advanced", + module_tab: idtab, + command: "saveconfig", + name: obt_name, + value: obt_val + }, + dataType: 'json', + timeout: 60000, + error: function(xhr, ajaxOptions, thrownError) { + fpbxToast('ERROR AJAX 1:' + thrownError,'ERROR (' + xhr.status + ')!','error'); + $("#" + obt_name + "_no").attr("disabled", true).prop( "checked", false); + $("#" + obt_name + "_yes").attr("disabled", true).prop( "checked", false); + return false; + }, + success: function(data) { + if (data.status === true) { + if (obt_val == "1") + { + //true + } + else + { + //false + } + fpbxToast(data.txt.save_changes_ok, '', 'success'); + //if (data.reload == true) { location.reload(); } + //if (data.name == "tftp_check") { location.reload(); } + //if (data.name == "use_repo") { location.reload(); } + + + return true; + } + else { + fpbxToast(data.message, data.txt.error, 'error'); + $("#" + obt_name + "_no").attr("disabled", true).prop("checked", false); + $("#" + obt_name + "_yes").attr("disabled", true).prop("checked", false); + return false; + } + }, + }); +} +// END: FUNCTION TAB SETTING diff --git a/assets/js/epm_config.js b/assets/js/epm_config.js index 0ef6d37e..f44c0089 100644 --- a/assets/js/epm_config.js +++ b/assets/js/epm_config.js @@ -1,959 +1,966 @@ -var v_sTimerUpdateAjax = ""; - -function epm_config_document_ready () { - -} - -function epm_config_windows_load (nTab = "") { - epm_config_select_tab_ajax(nTab); - - $("#epm_config_" + nTab + "_all_list_box").children("div").hide("slow", function () { - $(this).remove(); - }); -} - -function epm_config_change_tab (nTab = "") { - epm_config_select_tab_ajax(nTab); - - $("#epm_config_" + nTab + "_all_list_box").children("div").hide("slow", function () { - $(this).remove(); - }); -} - - -//**** INI: FUNCTION GLOBAL SEC **** -function epm_config_select_tab_ajax(idtab) -{ - clearTimeout(v_sTimerUpdateAjax); - if (idtab == "") { - fpbxToast('epm_config_select_tab_ajax -> id invalid (' + idtab + ')!','JS!','warning'); - return false; - } - - clearTimeout(v_sTimerUpdateAjax); - $("#epm_config_"+ idtab +"_load_init").each(function() { - if ($(this).css('display') == "none") - { - $(this).show("slow", function() { - var $tmp = epm_config_LoadContenidoAjax(idtab, "list_all_brand"); - }); - } - else { - var $tmp = epm_config_LoadContenidoAjax(idtab, "list_all_brand"); - } - }); - return true; -} - -function end_module_actions_epm_config(acctionname = "") -{ - var actTab = epm_global_get_tab_actual(); - switch(acctionname) { - case "bt_update_chkeck": - epm_config_select_tab_ajax(actTab); - break; - - case "manager_bt": - epm_config_select_tab_ajax(actTab); - break; - } -} - -function epm_config_LoadContenidoAjax(idtab, opt) -{ - clearTimeout(v_sTimerUpdateAjax); - opt = opt.trim(); - idtab = idtab.trim(); - statustab = $("#" + idtab).css('display').trim(); - - if ((idtab == "") || (statustab == "") || (opt == "")) { return false; } - if (statustab == "none") { return false; } - - $.ajax({ - type: 'POST', - url: "ajax.php", - data: { - module: "endpointman", - module_sec: "epm_config", - module_tab: idtab, - command: opt - }, - dataType: 'json', - timeout: 60000, - error: function(xhr, ajaxOptions, thrownError) { - fpbxToast('ERROR AJAX 1:' + thrownError,'ERROR (' + xhr.status + ')!','error'); - return; - }, - success: function(data) { - var tTimer = 20000; - if (idtab == "editor") { - switch(opt) { - case "list_all_brand": - epm_config_tab_editor_ajax_get_add_data(data, idtab); - break; - - default: - tTimer = 5000; - fpbxToast(data.txt.opt_invalid, data.txt.error, 'error'); - break; - } - } - else if (idtab == "manager") { - switch(opt) { - case "check_for_updates": - if (data.status == true) - { - fpbxToast(data.txt.update_content, data.txt.title_update, 'info'); - epm_config_tab_manager_ajax_get_add_data(data, idtab); - fpbxToast(data.txt.ready, '', 'success'); - } - else { fpbxToast(data.message, data.txt.error, 'error'); } - break; - - case "list_all_brand": - epm_config_tab_manager_ajax_get_add_data(data, idtab); - break; - - default: - tTimer = 5000; - fpbxToast(data.txt.opt_invalid, data.txt.error, 'error'); - break; - } - } - v_sTimerUpdateAjax = setTimeout(function () { epm_config_LoadContenidoAjax(idtab, "list_all_brand"); }, tTimer); - epm_global_html_find_show_hide("#epm_config_"+ idtab +"_load_init", false, 800, true); - } - }); - return true; -} - -function epm_config_html_ordenar_lista(box_root, orden) -{ - var lista = $(box_root); - - var vL0 = lista.children("div.element-container").get().length - var vL1 = lista.children("div.element-container").children("div.section-title").get().length - var vLT = vL0 - vL1 - - if (vL0 == 0 ) { return; } - if (vLT == 0) - { - var elemLista = lista.children("div.element-container").get(); - elemLista.sort(function(a, b) { - var compA = $(a).children("div.section-title").find('h3').text().toUpperCase().trim(); - var compB = $(b).children("div.section-title").find('h3').text().toUpperCase().trim(); - return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; - }) - } - else if (vLT > 0) - { - var elemLista = lista.children("div.element-container").get(); - elemLista.sort(function(a, b) { - var compA = $(a).find('.form-group').find('div.col-md-3 > label').first().text().toUpperCase().trim(); - var compB = $(b).find('.form-group').find('div.col-md-3 > label').first().text().toUpperCase().trim(); - return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; - }) - } - else { return; } - if(orden){ - $(elemLista).each( function(ind, elem) { $(lista).append(elem); }); - }else{ - $(elemLista).each( function(ind, elem) { $(lista).prepend(elem); }); - } -} - -function epm_config_tab_html_L0(prefijoid, txt_ayuda) -{ - var htmlReturn = $('
      ', { - 'class' : 'element-container', - 'id' : prefijoid + '_box' - }) - .append( - $('
      ', { 'class' : 'row' }) - .append( - $('
      ', { 'class' : 'col-md-12' }) - .append( - $('
      ', { 'class' : 'row' }) - .append( - $('
      ', { 'class' : 'form-group' }) - .append( - $('
      ', { - 'class' : 'col-md-3' - }), - $('
      ', { - 'class' : 'col-md-9', - 'id' : prefijoid + '_box_select' - }) - ) - ) - ) - ), - $('
      ', { 'class' : 'row' }) - .append( - $('
      ', { 'class' : 'col-md-12' }) - .append( - $('', { - 'class' : 'help-block fpbx-help-block', - 'id' : prefijoid + '-help' - }).text(txt_ayuda) - ) - ) - ); - return htmlReturn; -} - -function epm_config_tab_html_L1(boxpadre, prefijoid, titulo, txt_ayuda) -{ - $(boxpadre) - .append( - $('
      ', { - 'class' : 'element-container', - 'id' : prefijoid + '_box' - }) - .append( - $('
      ', { - 'class' : 'section-title', - 'data-for' : prefijoid + '_section_title' - }) - .append( - $('

      ', { }) - .text(titulo) - .on( "click", function(){ epm_global_html_find_show_hide('#' + prefijoid + '_section_box', 'auto' , 0, true); }) - ), - $('
      ', { - 'class' : 'section', - 'data-id' : prefijoid + '_section_title', - 'id' : prefijoid + '_section_box', - }) - .append( - - - $('
      ', { 'class' : 'row' }) - .append( - $('
      ', { 'class' : 'col-md-12' }) - .append( - $('
      ', { 'class' : 'row' }) - .append( - $('
      ', { 'class' : 'form-group' }) - .append( - $('
      ', { - 'class' : 'col-md-12', - 'id' : prefijoid + '_box_select' - }) - ) - ) - ) - ), - $('
      ', { 'class' : 'row' }) - .append( - $('
      ', { 'class' : 'col-md-12' }) - .append( - $('', { - 'class' : 'help-block fpbx-help-block', - 'id' : prefijoid + '-help' - }).text(txt_ayuda) - ) - ) - - - ) - ) - ); -} - -function ItemsLevel(idtab = "", prefijo = "", id = 0) -{ - this.def_box = "_box"; - this.def_sel = "_box_select"; - this.def_sit = "_box_subitems"; - - this.id = id; - this.tab = idtab; - this.prefijo = prefijo; - - this.prefijoid = this.tab + "_" + this.prefijo + "_" + this.id; - this.boxelemen = this.prefijoid + this.def_box; - this.boxappend = this.prefijoid + this.def_sel; - this.boxsubite = this.prefijoid + this.def_sit; -} - -function CrearSubListItem(iL0) -{ - if ( $('#' + iL0.boxsubite).length == 0 ) { - $('#' + iL0.boxappend).append( $('
      ', { 'class' : 'sortable', 'id' : iL0.boxsubite }) ) - } -} -//**** END: FUNCTION GLOBAL SEC **** - - - - - - - - - -//**** INI: TAB/MANAGER **** -function epm_config_tab_manager_ajax_get_add_data(data, idtab) -{ - if ($('#button_check_for_updates').is(':disabled') == true) { - $("#button_check_for_updates").attr("disabled", false).on( "click", function(){ epm_config_tab_manager_bt_update_check_click(); }); - } - if (data.status == true) { - var boxappendL0 = "#epm_config_manager_all_list_box"; - if ((data.datlist == null) || (data.datlist == "")) - { - if ( $('#manager_alert_list_emtry').length == 0 ) - { - $(boxappendL0).children("div").hide("slow", function () { $(this).remove(); }); - $(boxappendL0).append( - $('
      ', { - 'class' : 'alert alert-info', - 'role': 'alert', - 'id' : 'manager_alert_list_emtry' - }) - .text('List empty. Click the "check for updates" button to search for data on the server.') - ); - } - } - else - { - epm_global_html_find_hide_and_remove('#manager_alert_list_emtry'); - epm_global_html_find_hide_and_remove('#manager_alert_list_hiden'); - - //L1: INI loop marcas - $(data.datlist).each(function(index, itemData) - { - var iL1 = new ItemsLevel(idtab, "marca", itemData.id); - if (itemData.hidden == 1) { epm_global_html_find_hide_and_remove('#' + iL1.boxelemen); return; } - if ( $('#' + iL1.boxelemen).length == 0 ) - { - $(boxappendL0).append(epm_config_tab_html_L0(iL1.prefijoid, data.txt.ayuda_marca)); - epm_config_tab_manager_html_L1(itemData, iL1.prefijoid, data.txt, idtab); - } - - $('#' + iL1.prefijoid + "_txt_update").text(data.txt.new_pack_mod + ' [' + itemData.update_vers + ']'); - $('#' + iL1.prefijoid + "_txt_last_update").text(data.txt.pack_last_mod + ' [' + itemData.cfg_ver_datetime + ']'); - $('#' + iL1.prefijoid + "_checkbox_install").prop({'checked' : (itemData.local == 0 ? true : false)}); - epm_config_tab_manager_bt_enable_disable_ajustar(iL1, itemData, "L1"); - if (itemData.installed == 0) { epm_global_html_find_hide_and_remove('#' + iL1.boxsubite); return; } - - //L2: ini loop productos - $(itemData.products).each(function(indexL2, itemDataL2) - { - var iL2 = new ItemsLevel(idtab, "producto", itemDataL2.id); - if (itemDataL2.hidden == 1) { epm_global_html_find_hide_and_remove('#' + iL2.boxelemen); return; } - if ( $('#' + iL2.boxelemen).length == 0 ) - { - CrearSubListItem(iL1); - $('#' + iL1.boxsubite).append(epm_config_tab_html_L0(iL2.prefijoid, data.txt.ayuda_producto)); - epm_config_tab_manager_html_L2(itemDataL2, iL2.prefijoid, data.txt, idtab); - } - epm_config_tab_manager_bt_enable_disable_ajustar(iL2, itemDataL2, "L2"); - - //L3: Ini loop modelos - $(itemDataL2.models).each(function(indexL3, itemDataL3) - { - var iL3 = new ItemsLevel(idtab, "modelo", itemDataL3.id); - if (itemDataL3.hidden == 1) { epm_global_html_find_hide_and_remove('#' + iL3.boxelemen); return; } - if ( $('#' + iL3.boxelemen).length == 0 ) - { - CrearSubListItem(iL2); - $('#' + iL2.boxsubite).append(epm_config_tab_html_L0(iL3.prefijoid, data.txt.ayuda_model)); - epm_config_tab_manager_html_L3(itemDataL3, iL3.prefijo, iL3.prefijoid, itemDataL3.model, "0", data.txt.disable + " ", "1", data.txt.enable + " ", idtab); - } - epm_config_tab_manager_bt_enable_disable_ajustar(iL3, itemDataL3, "L3"); - }); - //L3: end loop modelos - epm_config_html_ordenar_lista(iL2.boxappend, true); - - }); - //L2: end loop productos - epm_config_html_ordenar_lista(iL1.boxappend, true); - - }); - //L1: end loop marcas - epm_config_html_ordenar_lista(boxappendL0, true); - - if ($(boxappendL0).children("div").length == 0) - { - if ( $('#manager_alert_list_hiden').length == 0 ) - { - $(boxappendL0).append( - $('
      ', { - 'class' : 'alert alert-info', - 'role': 'alert', - 'id' : 'manager_alert_list_hiden' - }) - .text("All brand's are hidden. Go to the Show/Hide tab shows you need.") - ); - } - } - epm_global_update_jquery_msg_help(); - } - return true; - } - else { - fpbxToast(data.message,'ERROR!','error'); - return false; - } -} - -function epm_config_tab_manager_bt_update_check_click() -{ - var urlStr = "config.php?display=epm_config&quietmode=1&module_tab=manager&command=check_for_updates"; - box = epm_global_dialog_action("bt_update_chkeck", urlStr); -} - -function epm_config_tab_manager_bt(opt, idfw, command) -{ - if ((opt == "") || (idfw == "") || (command == "")) { return false; } - clearTimeout(v_sTimerUpdateAjax); - - var urlStr = "config.php?display=epm_config&quietmode=1&module_tab=manager&command=" + command + "&command_sub=" + opt + "&idfw=" + idfw; - box = epm_global_dialog_action("manager_bt", urlStr, null, "Status", 'epm_config_tab_manager_bt_dialog'); -} - -function epm_config_tab_manager_bt_enable_disable_ajustar(iL0, itemData, level) -{ - if (level == "L1") - { - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_brand_install", ((itemData.installed == 1) ? false : true)); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_brand_uninstall" , ((itemData.installed == 1) ? true : false)); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_brand_update", ((itemData.update == 0) ? false : true)); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_txt_update" , ((itemData.update == 0) ? false : true)); - return; - } - else if (level == "L2") - { - if ((itemData.fw_type == "install") || (itemData.fw_type == "uninstall")) - { - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_install", ((itemData.fw_type == "install") ? true : false)); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_uninstall" , ((itemData.fw_type == "install") ? false : true)); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_update" , ((itemData.update_fw == 0) ? false : true)); - //epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt-pr-update" , ((itemData.update == 0) ? false : true)); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt-pr-update", false); - } - else if (itemData.fw_type == "nothing") { - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_install", false); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_uninstall", false); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt_fw_update", false); - epm_global_html_find_show_hide('#' + iL0.prefijoid + "_bt-pr-update", false); - } - return; - } - else if (level == "L3") - { - //AJUSTAMOS BOTOSNES EN SU STATUS CORRECTO - if (itemData.enabled == "") { - $("#" + iL0.prefijoid + "_enable").attr("disabled", true).prop( "checked", false); - $("#" + iL0.prefijoid + "_disable").attr("disabled", true).prop( "checked", false); - epm_global_html_find_hide_and_remove('#' + iL0.boxsubite); - } - else { - var temp_input = $('input[name = "'+ iL0.prefijoid + '"]:checked'); - if (temp_input.length == 0) { - temp_input = "-1"; - } - if (itemData.enabled != temp_input) { - $("#" + iL0.prefijoid + "_enable").attr("disabled", false).prop( "checked", ((itemData.enabled == 1) ? true : false)); - $("#" + iL0.prefijoid + "_disable").attr("disabled", false).prop( "checked", ((itemData.enabled == 0) ? true : false)); - } - } - return; - } -} - -function epm_config_tab_manager_bt_enable_disable_change(obt, idtab, idtype, idbt) -{ - if ((idtab == "") || (idbt == "") || (idtype == "")) { return false; } - - var obt_name = $(obt).attr("name").toLowerCase(); - var obt_val = $(obt).val().toLowerCase(); - - $.ajax({ - type: 'POST', - url: "ajax.php", - data: { - module: "endpointman", - module_sec: "epm_config", - module_tab: idtab, - command: "saveconfig", - name: obt_name, - value: obt_val, - idtype: idtype, - idbt: idbt - }, - dataType: 'json', - timeout: 60000, - error: function(data) { - fpbxToast('ERROR AJAX 2!', 'ERROR!', 'error'); - $("#" + obt_name + "_enable").attr("disabled", true).prop( "checked", false); - $("#" + obt_name + "_disable").attr("disabled", true).prop( "checked", false); - epm_global_html_find_hide_and_remove('#' + obt_name + '_box_subitems'); - return false; - }, - success: function(data) { - if (data.status == true) { - epm_global_html_find_hide_and_remove('#' + obt_name + '_box_subitems'); - fpbxToast(data.txt.save_changes_ok, '', 'success'); - return true; - } - else { - $("#" + obt_name + "_enable").attr("disabled", true).prop( "checked", false); - $("#" + obt_name + "_disable").attr("disabled", true).prop( "checked", false); - fpbxToast(data.message, data.txt.error, 'error'); - return false; - } - }, - }); -} - -function epm_config_tab_manager_html_L1(data, prefijoid, txt, idtab) -{ - $('#' + prefijoid + '_box' ) - .each( function() { - $(this).find('.form-group').each( function() { - $(this) - .children('.col-md-3') - .append( - $('