diff --git a/HelloWorld/HelloWorld/functions.inc.php b/HelloWorld/HelloWorld/functions.inc.php new file mode 100644 index 0000000..7d2eaaa --- /dev/null +++ b/HelloWorld/HelloWorld/functions.inc.php @@ -0,0 +1,37 @@ +get_filename() as $f){ + if(!file_exists($amp_conf['ASTETCDIR'] . "/$f")) { + touch($amp_conf['ASTETCDIR'] . "/$f"); + }//if + }//foreach + switch($file) { + case extensions_additional.conf: + return $this->generate_extensions_conf($version); + break; + }//switch + }//generateConf + function generate_extensions_conf($ast_version) { + global $ext + //create a dialplan + //www.freepbx.org/trac/wiki/ApiExtensions + $id = 'app-HelloWorld'; + $dial = '*42'; + $ext->add($id, $dial, '', new ext_answer('')); + $ext->add($id, $dial, '', new ext_playback('hello-world')); + $ext->add($id, $dial, '', new ext_macro('hangupcall')); + return $ext->generateConf(); + }//generate_extensions_conf() +}//class HelloWorld + +?> diff --git a/HelloWorld/README b/HelloWorld/README new file mode 100644 index 0000000..b7282c6 --- /dev/null +++ b/HelloWorld/README @@ -0,0 +1,47 @@ +Copyright (c) 2012/2013, James Finstrom +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. 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 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. +------------------------------------------------------------------------------ +Now that that's is out of the way.... + +Hello world, FreePBX module edition. + +THE GOAL +--------- +Create a skeliton people (mainly me but probably you) can build off of. +This will be losely documented and should serve as an example. +This is setup for those who learn by example code. + +SPAM +-------- +Please note that my contributions and what I do is made possible because +of my awesome employer. Please consider buying stuff from them to keep me +employed. I like paying my bills they make that possible too. If anything +I do helps you please consider buying a Rhino Card or server to show my +time diung this stuff makes the company money. + +TODO: +------- +page +function +module xml <-- Done + diff --git a/HelloWorld/functions.inc.php b/HelloWorld/functions.inc.php new file mode 100644 index 0000000..7d2eaaa --- /dev/null +++ b/HelloWorld/functions.inc.php @@ -0,0 +1,37 @@ +get_filename() as $f){ + if(!file_exists($amp_conf['ASTETCDIR'] . "/$f")) { + touch($amp_conf['ASTETCDIR'] . "/$f"); + }//if + }//foreach + switch($file) { + case extensions_additional.conf: + return $this->generate_extensions_conf($version); + break; + }//switch + }//generateConf + function generate_extensions_conf($ast_version) { + global $ext + //create a dialplan + //www.freepbx.org/trac/wiki/ApiExtensions + $id = 'app-HelloWorld'; + $dial = '*42'; + $ext->add($id, $dial, '', new ext_answer('')); + $ext->add($id, $dial, '', new ext_playback('hello-world')); + $ext->add($id, $dial, '', new ext_macro('hangupcall')); + return $ext->generateConf(); + }//generate_extensions_conf() +}//class HelloWorld + +?> diff --git a/HelloWorld/install.php b/HelloWorld/install.php new file mode 100644 index 0000000..5e7c464 --- /dev/null +++ b/HelloWorld/install.php @@ -0,0 +1,29 @@ +"; + } +} + +if (! function_exists("outn")) { + function outn($text) { + echo $text; + } +} + +$sql = "CREATE TABLE IF NOT EXISTS HelloWorld_settings ( +hwid varchar(32) NOT NULL default '', +hwset varchar(32) NOT NULL default '', +PRIMARY KEY (hwid) +);"; + +$check = $db->query($sql); +if (DB::IsError($check)) { + die_freepbx( "Can not create `HelloWorld` table: " . $check->getMessage() . "\n"); +} + +?> diff --git a/HelloWorld/module.xml b/HelloWorld/module.xml new file mode 100644 index 0000000..604254f --- /dev/null +++ b/HelloWorld/module.xml @@ -0,0 +1,26 @@ + + HelloWorld + Hello World + 0.1.0.0 + yes + yes + + *0.1.0.0* Original Release (beta) + + + provides a hello world example + + http://github.com/jfinstrom/ + + Hello World + + + core + ge2.2 + + setup + Basic + x + x + + diff --git a/HelloWorld/page.HelloWorld.php b/HelloWorld/page.HelloWorld.php new file mode 100644 index 0000000..eedce8e --- /dev/null +++ b/HelloWorld/page.HelloWorld.php @@ -0,0 +1,25 @@ +escapeSimple($_REQUEST['itemid']):$itemid=''; + +switch ($action) { + case "add": + needreload(); + break; + case "delete": + needreload(); + redirect_standard(); + break; + case "edit": + needreload(); + redirect_standard(); + break; +echo "

"._("Hello World")."

"; + +} + +?> diff --git a/HelloWorld/uninstall.php b/HelloWorld/uninstall.php new file mode 100644 index 0000000..0aff90d --- /dev/null +++ b/HelloWorld/uninstall.php @@ -0,0 +1,20 @@ +"; + } +} + +if (! function_exists("outn")) { + function outn($text) { + echo $text; + } +} +//Johnny Drop Tables +out("Dropping all relevant tables"); +$sql = "DROP TABLE `HelloWorld_settings`"; +$result = $db->query($sql); + +?>