Пример #1
0
        $smsc_sel .= "</select>";
        $html = "<form name=\"smsc_bind\" action=\"{$selfurl}&op=smsc_bind\" method=\"post\">\n            <p/>{$smsc_sel}\n            <p/><input type=\"submit\" class=\"button\" value=\"Bind\"/>\n        </form>\n        ";
        echo $html;
        break;
    case "smsc_bind":
        $smsc = $_POST['smsc'];
        echo "you chose {$smsc} <br/>\n";
        // now run the binding script with the smsc address
        // the user chose earlier (note we must run the
        // script as root)
        //
        $output = exec("sudo {$apps_path['bin']}/bind-bluetooth-smsc.pl {$smsc}");
        echo "{$output}<br/>\n";
        break;
    default:
        makeEditForm($selfurl);
        break;
}
function makeEditForm($selfurl)
{
    // nice names for each field
    $formNames = array('cfg_incoming_path' => 'Kannel Incoming Path: ', 'cfg_username' => 'Username:'******'cfg_password' => 'Password:'******'cfg_global_sender' => 'Global Sender:', 'cfg_bearerbox_host' => 'Bearerbox IP:', 'cfg_sendsms_port' => 'Send SMS Port:', 'cfg_playsms_web' => 'PlaySMS web url:', 'cfg_restart_frequency' => 'Restart Kannel Regularly?');
    // infer the fields we're going to show
    // from the list of formNames
    $renderFields = array();
    foreach ($formNames as $field => $name) {
        $renderFields[] = $field;
    }
    // find the first record in the config table
    $do = DB_DataObject::factory('playsms_gwmodKannel_config');
    $do->get(1);
Пример #2
0
if ($err) {
    echo "<p><font color=red>{$err}</font><p>\n";
}
require_once 'DB/DataObject.php';
require_once 'DB/DataObject/FormBuilder.php';
error_log(print_r($_GET, true));
error_log(print_r($_POST, true));
switch ($op) {
    case "list":
        echo makeList($selfurl);
        break;
    case "add":
        echo makeEditForm($selfurl);
        break;
    case "edit":
        echo makeEditForm($selfurl, $_GET[id]);
        break;
    case "del":
        doDelete($selfurl, $_POST[id]);
        break;
}
function makeList($selfurl)
{
    $html = "\n\t\t\t<h2>List/Manage/Delete SMS autosend</h2>\n\t\t\t<p/>\n\t\t\t<a href=\"{$selfurl}&op=add\">[ Add ]</a>\n\t\t\t<p/>";
    // create hidden form with the
    // id to delete, this way it will
    // get POSTed
    //
    $formName = "delForm";
    $html .= "\n\t\t\t<form name=\"{$formName}\" method=\"post\" action=\"{$selfurl}&op=del\">\n\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"\"/>\n\t\t\t\t<script language=\"JavaScript\"><!--\n   \t\t\t\t\tfunction del(id, msg) {\n\t\t\t\t\t\tif (confirm(msg)) {\n\t\t\t\t\t\t\tdocument.forms.{$formName}.id.value=id;\n\t\t\t\t\t\t\tdocument.forms.{$formName}.submit();\n\t\t\t\t\t\t}\n\t\t\t\t   }\n\t\t\t\t--></script>\n\t\t\t </form>";
    // iterate through each item in the db