Пример #1
0
<?php

include 'phplib/prepend.php';
page_open(array("sess" => $_ENV["SessionClass"], "auth" => $_ENV["AuthClass"], "perm" => $_ENV["PermClass"], "silent" => "silent"));
get_request_values("val,index,col,table,key");
switch ($table) {
    default:
        $requires = "admin";
        break;
    case "menu":
        $requires = "admin";
        break;
}
if (!$perm->have_perm($requires)) {
    echo "Access Denied";
} else {
    $db = new $_ENV["DatabaseClass"]();
    $v = urldecode($val);
    $i = urldecode($index);
    // Get Old Value
    $db->query("SELECT {$col} FROM {$table} WHERE {$key}='{$i}'");
    if ($db->next_record()) {
        $oldval = $db->f(0);
    }
    // Set New Value
    $db->query("UPDATE {$table} SET {$col}='{$v}' WHERE {$key}='{$i}'");
    EventLog("Cell Edit by " . $auth->auth["uname"], $sql);
    // Get New Value
    $db->query("SELECT {$col} FROM {$table} WHERE {$key}='{$i}'");
    if ($db->next_record()) {
        echo $db->f(0);
Пример #2
0
     $sess->register("q_SupportTickets");
     // and don't forget this!
 }
 if ($rowcount) {
     $q_SupportTickets->start_row = $startingwith;
     $q_SupportTickets->row_count = $rowcount;
 }
 if ($submit == 'Search') {
     $query = $q_SupportTickets->search($t->map_cols);
 }
 // When we hit that page a second time, the array named
 // by $base will be set and we must generate the $query.
 // Ah, and don\'t set $base to "q" when $q is your Sql_Query
 // object... :-)
 if (array_key_exists("x", $_POST)) {
     get_request_values("x");
     $query = $q_SupportTickets->where("x", 1);
     $hideQuery = "";
 } else {
     $hideQuery = "style='display:none'";
 }
 if (!$sortorder) {
     $sortorder = "id";
 }
 if (empty($query)) {
     $query = "1 order by  " . $db->qi("id") . " desc";
 }
 $db->query("SELECT COUNT(*) as total from " . $db->qi("SupportTickets") . " where " . $query);
 $db->next_record();
 if ($db->f("total") < $q_SupportTickets->start_row - $q_SupportTickets->row_count) {
     $q_SupportTickets->start_row = $db->f("total") - $q_SupportTickets->row_count;
     $q->translate = "on";
     // ... column names are to be translated
     $q->container = "on";
     // ... with a nice container table
     $q->variable = "on";
     // ... # of conditions is variable
     $q->lang = "en";
     // ... in English, please
     $sess->register("q");
     // and don't forget this!
 }
 if (!empty($rowcount)) {
     $q->start_row = $startingwith;
     $q->row_count = $rowcount;
 }
 get_request_values("x,domain");
 // When we hit that page a second time, the array named
 // by $base will be set and we must generate the $query.
 // Ah, and don\'t set $base to "q" when $q is your Sql_Query
 // object... :-)
 if (!empty($x)) {
     $query = $q->where("x", 1);
 }
 if ($submit == 'Search') {
     $query = $q->search($t->map_cols);
 }
 if (!$query) {
     $query = "id!='0'";
 }
 if ($domain or !$perm->have_perm("admin")) {
     $query .= " and address like '%" . $domain . "'";
Пример #4
0
<?php

include 'phplib/prepend.php';
page_open(array("sess" => $_ENV["SessionClass"], "auth" => $_ENV["AuthClass"], "perm" => $_ENV["PermClass"]));
get_request_values("table,FieldName,LinkTable,LinkField,LinkDesc,DefaultValue");
echo "<h2>Linked tables</h2>";
$f = new LinkedTablesform();
if ($submit) {
    switch ($submit) {
        case "Save":
            if ($id) {
                $submit = "Edit";
            } else {
                $submit = "Add";
            }
        case "Add":
        case "Edit":
            if (isset($auth)) {
                if (!$f->validate($result)) {
                    $cmd = $submit;
                    echo "<font class=bigTextBold>{$cmd} Linked Tables</font>\n";
                    $f->display();
                    page_close();
                    exit;
                } else {
                    echo "Saving....";
                    $f->save_values();
                    echo "<b>Done!</b><br>\n";
                    $QUERY_STRING = "";
                    echo "<META HTTP-EQUIV=REFRESH CONTENT=\"2; URL=" . $sess->self_url() . "\">";
                    echo "&nbsp<a href=\"" . $sess->self_url() . "\">Back to LinkedTables.</a><br>\n";
Пример #5
0
    error_fatal(E_ALL & ~(E_STRICT | E_NOTICE));
    ini_set('display_errors', 'Off');
    set_error_handler('my_error_handler');
}
$_ENV["local"] = getcwd() . "/phplib/";
if (!file_exists($_ENV["libdir"] = "/usr/share/phplib/")) {
    $_ENV["libdir"] = $_ENV["local"];
}
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$_page_start_time = $time;
if (array_key_exists("widemode", $_REQUEST)) {
    $GLOBALS["widemode"] = $_REQUEST["widemode"];
}
get_request_values("id,cmd,submit,rowcount,sortorder,sortdesc,startingwith,start,prev,next,last,cond,EditMode,WithSelected,widemode,Field,_http_referer,export_results");
$orig_cmd = $cmd;
$PWD = array_key_exists("PWD", $_SERVER) ? $_SERVER["PWD"] : "";
$PHP_SELF = $_SERVER["PHP_SELF"];
if (substr($_SERVER["PHP_SELF"], 0, 1) == "/") {
    $SELF = $_SERVER["PHP_SELF"];
} else {
    $SELF = "{$PWD}/" . $_SERVER["PHP_SELF"];
}
$docroot = substr($SELF, 0, strrpos($SELF, '/'));
if (!$DOCUMENT_ROOT) {
    $DOCUMENT_ROOT = $docroot;
}
$_ENV["libdir"] = "/usr/share/phplib/";
$_ENV["local"] = $DOCUMENT_ROOT . "/phplib/";
$QUERY_STRING = "";
Пример #6
0
        echo "</td>";
    }
    function table_insert_row_add_extra($data, $class)
    {
        global $parent, $level;
        echo "<td class='btable'>";
        $this->form->form_data->show_element('submit', 'Add');
        $this->form->form_data->elements["submit"]["ob"]->extrahtml = "onclick='this.form.onsubmit=\"\"'";
        $this->form->form_data->show_element('submit', 'Search');
        echo "<input type='hidden' value='" . $parent . "' name='parent'> ";
        echo "</td>";
    }
}
echo "<p align=right><a href='AuditPerms.php'>Menu Audit</a></p>";
echo "<h2>Menu Editor</h2>";
get_request_values("id,submit,cmd,parent,menufieldsi,target");
$f = new menuform();
function FixWidth()
{
    $sitewidth = 880;
    $db = new $_ENV["DatabaseClass"]();
    $total = 0;
    $db->query("select id, title from menu where parent=0");
    while ($db->next_record()) {
        $length[$db->f(0)] = strlen($db->f(1)) + 3;
        $total += $length[$db->f(0)];
        echo "total {$total}<br>";
    }
    foreach ($length as $id => $len) {
        $new = $sitewidth / $total * $len;
        $sql = "update menu set width='{$new}' where id='{$id}'";
Пример #7
0
    {
        global $sess, $auth, $perm, $Path;
        echo "<td>";
        if ($perm) {
            if ($perm->have_perm("admin") or $perm->have_perm("support")) {
                echo "<a href=\"" . $sess->self_url() . $sess->add_query(array("cmd" => "Edit", $this->primary_key => $data[$this->primary_key])) . "\" title='Edit'><img src='/images/edit.jpg'></img></a>";
                echo "<a href=\"" . $sess->self_url() . $sess->add_query(array("cmd" => "Close", $this->primary_key => $data[$this->primary_key])) . "\" title='Close'><img src='/images/close.jpg'></img></a>";
            }
        } else {
            echo "<a href=\"" . $sess->self_url() . $sess->add_query(array("cmd" => "View", $this->primary_key => $data[$this->primary_key])) . "\" title='View'><img src='/images/view.jpg'></img></a>";
        }
        echo "</td>";
    }
}
$QUERY_STRING = "";
get_request_values("SrchLevel,SrchState,assigned,SrchTicketNo,SrchShortDesc,SrchUserName,SrchEntBy,AssignedTo,TicketNo,Comment,Level,Closed,Status,OldStatus,Mail,Severity");
$f = new my_SupportTicketsform();
$f->setup();
$f->form_data->before = <<<BEFORE
if (f.elements['AssignedTo'].value=='') {
\tif (!confirm('Ticket has not been assigned to anyone. OK to accept Cancel to change.')) {
\t\treturn false;
\t}
}\t
if (f.elements['UserName'].value.length<3) {
\tf.elements['UserName'].value=prompt('Please enter Username','unknown');
}
if (f.elements['ShortDesc'].value.length<3) {
\tf.elements['ShortDesc'].value=prompt('Please enter Short Description of Problem','');
}
if ((f.elements['RoomNo'].value.length<1) and (false)) {
Пример #8
0
class my_SupportTicketsform extends SupportTicketsform
{
    var $classname = "my_SupportTicketsform";
}
class my_SupportCommentsform extends SupportCommentsform
{
    var $classname = "my_SupportCommentsform";
}
if (!class_exists("userinfoform")) {
    include "phplib/userinfo.inc";
}
class my_userinfoform extends userinfoform
{
    var $classname = "my_userinfoform";
}
get_request_values("TicketNo,EMAILTXT,SMSTEXT,EMAIL,MOBILE");
if (!$TicketNo && !$id) {
    echo "<META HTTP-EQUIV=REFRESH CONTENT=\"2; URL=" . $sess->url("/SupportTickets.php") . "\">";
    page_close();
    exit;
}
$db = new DB_hotspot();
$f = new my_SupportCommentsform();
if ($submit) {
    switch ($submit) {
        case "Send":
            $hdrs = "From: Help Desk<ticket+" . $TicketNo . "@accessplus.net.au>";
            $hdrs .= "\r\nContent-type: text/html; charset=utf-8";
            if ($EMAILTXT) {
                mail($EMAIL, "Hotspot Support", $EMAILTXT, $hdrs);
                echo "<P>sending email to {$EMAIL}</P>";