Example #1
0
 function main()
 {
     $this->PageSubtitle = "Documentation Generation";
     if (gp('gp_posted') == '1') {
         return $this->ehProcess();
     }
     ?>
   <h1>Code And Data Dictionary Scanning</h1>
   
   <p>This process will scan all code in this application and
      rebuild the documentation.  The program also scans the data
      dictionary and regenerates table definitions.
      Table definitions are not automatically
      rebuilt during a build, so this process must be run manually
      after each database rebuild.
   
   <p>The process can take anywhere from a few seconds to
      several minutes, depending on how many files and table are
      in the application.
      
   <p><font color=red>This process completely purges out and replaces
      the contents of the DOCPAGES table.  Any changes made to that
      table from other sources will be lost every time this program
      runs.</font></p>
      
   <br><br>
   <p>
   <a href="javascript:Popup('?gp_page=x_docgen&gp_posted=1','Code Scan')">
      Generate Documentation</a>
   <?php 
 }
 public function personadd()
 {
     $id = (int) $this->_get("id");
     $pid = (int) $this->_get("pid");
     $t = $this->_get("t");
     //        $parentid = (int) $this->_get("parentid");
     $aname = $t == 'a' ? '增加' : '修改';
     //$param1 = gp($this->_get('param')); //htmlspecialchars
     //$param1 = json_encode(ser($this->_post('param'),1)); //htmlspecialchars
     $pinfo = $this->Cusperson->where(array('id' => $pid))->find();
     if ($t == 'a') {
         $_defsts = 'N';
         $pinfo['default_zh'] = '2';
         $param1 = gp($this->_get('param'));
         //htmlspecialchars
     } else {
         $_defsts = $pinfo['sts'];
         $param1 = json_encode(ser($this->_post('param'), 1));
         //htmlspecialchars
     }
     //echo $param1;
     $sel = new stdClass();
     $sel->sts = nysts('使用', '停用', 'sts', $_defsts, '', 'class="length_2"');
     $this->assign('sel', $sel);
     $info = $this->Cusperson->where(array('wtf_id' => $id))->order(array("sts" => "ASC"))->select();
     $this->assign("parentid", $id);
     $this->assign("info", $info);
     $this->assign("pinfo", $pinfo);
     $this->assign("t", $t);
     $this->assign("aname", $aname);
     $this->assign('param', $param1);
     //        $this->display("Dcustomermsg:personadd");
     $this->display();
 }
Example #3
0
function callback($data)
{
    $data = json_encode($data);
    if (gp("callback")) {
        return gp("callback") . "({$data});";
    } else {
        return $data;
    }
}
Example #4
0
 function main()
 {
     $file = $GLOBALS['AG']['dirs']['root'] . 'application/' . gp('file');
     include_once "spyc.php";
     echo "\n<h2>Examine YAML file {$file}</h2>";
     echo "\n<h3>HERE IS THE SOURCE FILE:</h3>";
     echo "\n<pre>";
     readfile($file);
     echo "\n</pre>";
     $temparray = Spyc::YAMLLoad($file);
     echo "<h3>HERE IT IS PARSED:</h3>";
     hprint_r($temparray);
 }
Example #5
0
    function main()
    {
        if (gp('gp_posted') == 1) {
            return $this->PullCode();
        }
        if (gp('gp_posted') == 2) {
            return $this->PullAndro();
        }
        sourceDeprecated();
        ?>
      <h1>Upgrade Node Manager Only</h1>

      <p>This program below will download the latest available code
         for the node manager only.
      </p>
      
      <p style="color:red">Warning!  This program will overwrite the live
      running code of the Node Manager.  Any programs directly linked to the
      node manager will be instantly updated (this does not apply to 
         instances).  Remember to always keep production databases running
      as instances so that they are unaffected by this action.
      </p>
      
      <a href="javascript:Popup('?gp_page=a_pullcode&gp_posted=2')">Step 1: Get Code</a>
      <br/>
      <br/>
      <?php 
        echo hLinkBuild('andro', 'Step 2: Rebuild Node Manager');
        ?>
     
      <h1>Download Latest Software Updates</h1>      

      <p>This program downloads the latest available version
         of each program listed in the table of applications.
         The code is pulled from the 'Authoritative Node' for 
         that application (applications without an authoritative
         node are not reviewed).
      </p>
      
      <p>This program does not actually run updates to any running
         instances, each instance is upgraded manually at the 
         discretion of the administrator.
      </p>
      
      <br>
      <p>
      <a href="javascript:Popup('?gp_page=a_pullcode&gp_posted=1')">Pull Now</a>

      <?php 
    }
Example #6
0
 function main()
 {
     if (gpExists('gp_xajax')) {
         $sq = "UPDATE variables\n                    SET variable_value = " . SQLFC(gp('varval')) . "\n                  WHERE variable = " . SQLFC(gp('variable'));
         SQL($sq);
     }
     if (gpExists('gp_cache')) {
         //unlink($GLOBALS['AG']['dirs']['dynamic'].'table_variables.php');
         OptionGet('X');
     }
     if (gpExists('gp_xajax')) {
         return;
     }
     parent::main();
 }
 function main()
 {
     // Basically three items.  Either give them back the latest
     // filename, give them contents of latest, or give them
     // contents of a specific version of Andromeda
     if (gp('gp0') == 'latest_filename.php') {
         echo LatestAndro();
     } else {
         $file = gp('gp0');
         if (strpos($file, 'andro') === false) {
             echo "File not found";
         } else {
             $this->GiveEmFile($file);
         }
     }
     // Exit prevents any further extraneous output.
     exit;
 }
Example #8
0
 function processSubmit()
 {
     // Get the submitted data
     $table = gp('gp_table_upd', '');
     // Get the flat table def
     $table_dd = dd_TableRef($table);
     $tabflat = ArraySafe($table_dd, 'flat');
     //hprint_r($table);
     $row = aFromGP('gp_upd_');
     //hprint_r($row);
     //hprint_r($row);
     // Build a WHERE clause
     $where = array();
     foreach ($row as $col => $val) {
         if (ArraySafe($tabflat[$col], 'primary_key', 'N') != 'Y') {
             continue;
         }
         $where[] = $col . " = '" . $val . "'";
     }
     //hprint_r($where);
     $where = implode(' AND ', $where);
     // Build a SELECT
     $sql = "SELECT skey\n                 FROM " . ddTable_IDResolve($table) . "\n                WHERE " . $where;
     //hprint_r($sql);
     $records = SQL_AllRows($sql);
     if (count($records) != 1) {
         echo "Invalid or non-unique key supplied\n<br>";
         return;
     }
     // Well, we haven't failed yet, let's add the skey before the update, just to be safe.
     $row['skey'] = $records[0]['skey'];
     $skey = $records[0]['skey'];
     //hprint_r($row);
     SQLX_Update($table_dd, $row);
     if (Errors()) {
         echo hErrors();
     } else {
         echo "Update Successful.  <a href=\"?gp_page={$table}&gp_skey={$skey}\">View Record</a> <br>\n";
     }
 }
Example #9
0
    function main()
    {
        echo "<h1>View Build Log</h1>";
        ?>
<p>Currently viewing the log for application code "
  <b><?php 
        echo gp('application');
        ?>
</b>".  Click any
   of the links below to see the logs for the particular application:</p>
<?php 
        // Run out list of apps they can see
        echo "<hr>\n";
        $results = SQL("select * from applications");
        while ($row = pg_fetch_array($results)) {
            echo HTMLE_A_STD($row["application"] . " - " . $row["description"], "a_builder_log", "gp_out=info&application=" . $row["application"]) . "<br>\n";
        }
        echo "<hr>\n";
        // Make up a filename
        global $AG;
        $t = pathinfo(__FILE__);
        $pLogDir = $t["dirname"];
        $pLogFile = "AndroDBB." . CleanGet("application") . ".log";
        $pLogPath = "{$pLogDir}/{$pLogFile}";
        if (!file_exists($pLogPath)) {
            echo "<p>There is no build log file for this application at this time.  This usually\n\t\t\t\tmeans that the application has not been built yet.  Try launching a build process\n\t\t\t\tand then coming back to this page.</p>";
            return;
        }
        //echo "<pre style=\"background-color: silver; color: blue\">";
        $fgc = file_get_contents($pLogPath);
        $fgc = str_replace("\n", "<br>", $fgc);
        echo "<div style=\"font: 10pt courier; color: navy;\">" . $fgc . "</div>";
        //echo file_get_contents($pLogPath);
        //echo "</pre>";
        return "View Build/Update Log for: " . CleanGet("application");
    }
Example #10
0
 function makeDefault()
 {
     $col = SQLFN(gp('column'));
     $skey = SQLFN(gp('skey'));
     SQL("update configuser set {$col} = null WHERE skey = {$skey}");
     configWrite('user');
 }
Example #11
0
<?php

include_once "common.php";
if ($connection["ticket"] == gp("ticket")) {
    echo "ok";
} else {
    header("HTTP/1.0 404 Not Found");
    echo "No client.";
}
Example #12
0
<?php

include_once 'common.php';
require 'http_client.php';
$ticket = gp('ticket');
$room_id = gp('id');
$nick = gp('nick');
if (!empty($ticket)) {
    $data = array('ticket' => $ticket, 'nick' => $nick, 'domain' => $_IMC['domain'], 'apikey' => $_IMC['apikey'], 'room' => $room_id, 'endpoint' => $space['uid']);
    $client = new HttpClient($_IMC['imsvr'], $_IMC['impost']);
    $client->post('/room/leave', $data);
    $pageContents = $client->getContent();
    echo $pageContents;
}
Example #13
0
<?php

include_once 'common.php';
if (empty($space)) {
    exit;
}
$name = nick($space);
require 'http_client.php';
$stranger_ids = ids_except($space['uid'], ids_array(gp("stranger_ids")));
//陌生人
$friend_ids = ids_array($space['friends']);
//好友
$buddy_ids = ids_array(gp("buddy_ids"));
//正在聊天的联系人
$new_messages = find_new_message();
//查找离线消息
for ($i = 0; $i < count($new_messages); $i++) {
    $msg_uid = $new_messages[$i]["from"];
    array_push($buddy_ids, $msg_uid);
    array_push($stranger_ids, $msg_uid);
}
//Login webim server.
$nick = to_utf8($name);
$setting = setting();
$block_list = is_array($setting->block_list) ? $setting->block_list : array();
$rooms = find_room();
$room_ids = array();
foreach ($rooms as $key => $value) {
    if (in_array($key, $block_list)) {
        $rooms[$key]['blocked'] = true;
    } else {
Example #14
0
 function mainDiff($quiet = false)
 {
     $app = gp('gp_app');
     $file = gp('gpfile');
     $d1 = AppDir($app);
     $f1 = $d1 . $file;
     $f2 = $d1 . '/ref/' . $file;
     $diff = shell_exec("diff -u {$f2} {$f1}");
     if ($quiet) {
         return $diff;
     }
     // If not in quiet mode, they want to view the diff
     x_EchoFlush("<h1>File Diff</h1>");
     x_EchoFlush("Application {$app}");
     x_EchoFlush("Local file is: {$f1}");
     x_EchoFlush("Reference file is: {$f2}");
     echo "<pre>";
     echo htmlentities($diff);
     echo "</pre>";
 }
Example #15
0
    function main()
    {
        # KFD 2/17/09.  If installed with Debian package, will
        #               have username and password of "start".
        #               Must force a new id now.
        #
        if (SessionGet('UID') == 'start') {
            if (gp('user_id') != '') {
                if (gp('user_id') == '') {
                    ErrorAdd("User Id may not be empty");
                }
                if (substr(gp('user_id'), 0, 5) == 'andro') {
                    ErrorAdd("User Id may not begin with 'andro'");
                }
                if (gp('password1') != gp('password2')) {
                    ErrorAdd("Passwords do not match");
                }
                if (strlen(trim(gp('password1'))) == 0) {
                    ErrorAdd("Password may not be empty");
                }
                if (!Errors()) {
                    $row = array('user_id' => gp('user_id'), 'member_password' => gp('password1'));
                    SQLX_Insert('usersroot', $row);
                    if (!Errors()) {
                        scDBConn_Pop();
                        SessionSet('UID', gp('user_id'));
                        SessionSet('PWD', gp('password1'));
                        scDBConn_Push();
                        SQL("DELETE FROM USERSROOT WHERE user_id='start'");
                        # Get rid of the form that replaces login
                        $file = fsDirTop() . 'application/x_login_form.inc.html';
                        $fileto = $file . '.done';
                        @rename($file, $fileto);
                        ?>
                        <h1>New Root User Created</h1>
                        
                        <p>Your new user is created.</p>
                        
                        <p><a href="index.php?st2logout=1">
                           Return to Login Page</a></p>
                        <?php 
                        return;
                    }
                }
            }
            ?>
            <h1>New Install - Must Create User</h1>
            
            <p>You are logged into your Node Manager with the default
               username of "start" and password "start".  We have to change
               this right now so nobody can get into your new system.
            </p>
            
            <p>Please provide a new ROOT (superuser) user id and password
               below.  Andromeda will create the new user, log you in as
               that user, and remove the "start" user.
            </p>
            
            <table>
              <tr><td align="left">User Name
                  <td><input name = 'user_id' /> (may not begin with 'andro')
              <tr><td align="left">Password
                  <td><input type="password" name = 'password1'/>
              <tr><td align="left">Password (verify)
                  <td><input type="password" name = 'password2'/>
            </table>
            <input type="submit" value="Create User Now" />
            <?php 
            return;
        }
        /* FUTURE X6 VERSION OF NODE MANAGER
           ?>
           <h1>Node Manager Upgrade Required</h1>
           
           <p>The new version of the Node Manager uses the "x6" 
              interface to provide a richer experience.  Please click
              the link below to upgrade your Node Manager.  Once the
              upgrade is complete, log out and back in.
           </p>
           
           <p><a href="javascript:Popup('index.php?gp_page=a_builder&gp_out=none&x2=1&txt_application=andro','Build')"
               >Upgrade Node Manager Now</a>.</p>
               
           <p><a href="?st2logout=1">Logout After Upgrade</a>.</p>
           
           <?php
           return;
           */
        # <------- EARLY RETURN.
        # KFD 1/10/08, The old x_welcome screen is not used anymore,
        #              we have the new 'cpanel' now in x6.
        # ===============================================================
        ?>
        <h1>Welcome to the Andromeda Node Manager</h1>
        <?php 
        // Work out if there is a new release available
        //
        $apps = svnVersions();
        $andro = a($apps, 'andro', array('svn_url' => ''));
        if (trim($andro['svn_url']) == '') {
            $htmlVersions = '';
        } else {
            $htmlVersions = @file_get_contents($andro['svn_url']);
        }
        $matches = array();
        preg_match_all('/<li><a href=.*\\>(.*)<\\/a><\\/li>/', $htmlVersions, $matches);
        $versions = ArraySafe($matches, 1, array());
        if (count($versions) > 0) {
            $latest = array_pop($versions);
            $latest = str_replace('/', '', $latest);
            // Get current latest
            $current = $andro['local'];
            if ($latest > $current) {
                ?>
            <br/>
            <div style="border: 5px solid gray; color: blue
            font-weight: bolder; margin: 8px; padding: 0 8px 8px 8px">
            <h2>New Version of Andromeda Available</h2>
            
            <p>Version <?php 
                echo $latest;
                ?>
 is available.   <a href="?gp_page=a_pullsvn"
            >Click Here </a> to go to the Pull Code From Subversion.
            </div>
            <?php 
            }
        }
        $dirs = SQL_AllRows("select * from webpaths where webpath='DEFAULT'");
        ?>
<div style="font-size: 120%; line-height: 120%; padding: 10px">

<h2>For First Time Users</h2>
    This program is the Andromeda <b>Node Manager</b>.  You use this
    program to build your applications.
    <br/>
    <br/>
    Our main documentation is <a target="_blank" href=
    "http://www.andromeda-project.org/">here</a>.
    <br/>
    <br/>

    If you want to start programming a new application right away, 
    <a target="_blank"  href=
    "http://www.andromeda-project.org/creatinganapplication.html"
    >The instructions are here</a>, or you can just 
    <a href="?gp_page=applications&gp_mode=ins">define a new application here.</a>
    <br/>
    <br/>

After you defined an application, click on the "build this application"
link to create all of the directories and the empty database.</p>
<br/>
<br/>

<h2>Your Application Program Files</h2>

After building the application skeleton you can start working on the
   database specification.  If your application code is "test", then put
   the database specification into the file
   <br/>
   <br/>
   <b><?php 
        echo $dirs[0]['dir_pub'];
        ?>
/test/application/test.dd.yaml</b>
<br/>
<br/>

All Andromeda applications start with
a database specification.  These specifications are 
more powerful than anything else out there, 
and you will want learn the Andromeda's 
<a target="_blank" href=
"http://www.andromeda-project.org/databaseprogramming.html"
>Database Programming</a> language.

<br/>
<br/>
Once you are ready to try some custom pages, you are ready to look
at <a target="_blank" href=
"http://www.andromeda-project.org/webprogramming.html"
>Web Programming</a>.
   
    
</div>        
        <?php 
    }
Example #16
0
 function updateWallet($tenant_id, $property_id, $invoice_amount)
 {
     $this->db->limit(1);
     $this->db->order_by('id', 'desc');
     $rs = $this->db->get('tenant_wallet')->result_array();
     if (count($rs)) {
         $rs = current($rs);
     }
     $wallet_id = gp('id', $rs, 0);
     $walletAmount = gp('amount', $rs, 0);
     $data['amount'] = $walletAmount - $invoice_amount;
     $data['updated_by'] = curUsrId();
     $this->db->where('id', $wallet_id);
     $this->db->update('tenant_wallet', $data);
 }
Example #17
0
function showdir($s_cwd)
{
    global $s_self, $s_win, $s_posix, $s_tar;
    $s_fname = $s_dname = array();
    $s_total_file = $s_total_dir = 0;
    if ($s_dh = @opendir($s_cwd)) {
        while ($s_file = @readdir($s_dh)) {
            if (@is_dir($s_file)) {
                $s_dname[] = $s_file;
            } elseif (@is_file($s_file)) {
                $s_fname[] = $s_file;
            }
        }
        closedir($s_dh);
    }
    natcasesort($s_fname);
    natcasesort($s_dname);
    $s_list = array_merge($s_dname, $s_fname);
    if ($s_win) {
        //check if this root directory
        chdir("..");
        if (cp(getcwd()) == cp($s_cwd)) {
            array_unshift($s_list, ".");
        }
        chdir($s_cwd);
    }
    $s_path = explode(DS, $s_cwd);
    $s_tree = sizeof($s_path);
    $s_parent = "";
    if ($s_tree > 2) {
        for ($s_i = 0; $s_i < $s_tree - 2; $s_i++) {
            $s_parent .= $s_path[$s_i] . DS;
        }
    } else {
        $s_parent = $s_cwd;
    }
    $s_owner_html = !$s_win && $s_posix ? "<th style='width:140px;min-width:140px;'>owner:group</th>" : "";
    $s_colspan = !$s_win && $s_posix ? "5" : "4";
    $s_buff = "<table class='explore sortable'><thead><tr><th style='width:24px;min-width:24px;' class='sorttable_nosort'></th><th style='min-width:150px;'>name</th><th style='width:74px;min-width:74px;'>size</th>" . $s_owner_html . "<th style='width:80px;min-width:80px;'>perms</th><th style='width:150px;min-width:150px;'>modified</th><th style='width:200px;min-width:200px;' class='sorttable_nosort'>action</th></tr></thead><tbody>";
    foreach ($s_list as $s_l) {
        if (!$s_win && $s_posix) {
            $s_name = posix_getpwuid(fileowner($s_l));
            $s_group = posix_getgrgid(filegroup($s_l));
            $s_owner = $s_name['name'] . "<span class='gaya'>:</span>" . $s_group['name'];
            $s_owner_html = "<td style='text-align:center;'>" . $s_owner . "</td>";
        }
        $s_lhref = $s_lname = $s_laction = "";
        if (@is_dir($s_l)) {
            if ($s_l == ".") {
                $s_lhref = $s_self . "cd=" . pl($s_cwd);
                $s_lsize = "LINK";
                $s_laction = "<span id='titik1'><a href='" . $s_self . "cd=" . pl($s_cwd) . "&find=" . pl($s_cwd) . "'>find</a> | <a href='" . $s_self . "cd=" . pl($s_cwd) . "&x=upload" . "'>upl</a> | <a href='" . $s_self . "cd=" . pl($s_cwd) . "&edit=" . pl($s_cwd) . "newfile_1&new=yes" . "'>+file</a> | <a href=\"javascript:tukar('titik1','', 'mkdir','newfolder_1');\">+dir</a></span><div id='titik1_form'></div>";
            } elseif ($s_l == "..") {
                $s_lhref = $s_self . "cd=" . pl($s_parent);
                $s_lsize = "LINK";
                $s_laction = "<span id='titik2'><a href='" . $s_self . "cd=" . pl($s_parent) . "&find=" . pl($s_parent) . "'>find</a> | <a href='" . $s_self . "cd=" . pl($s_parent) . "&x=upload" . "'>upl</a> | <a href='" . $s_self . "cd=" . pl($s_parent) . "&edit=" . pl($s_parent) . "newfile_1&new=yes" . "'>+file</a> | <a href=\"javascript:tukar('titik2','" . adds($s_parent) . "', 'mkdir','newfolder_1');\">+dir</a></span><div id='titik2_form'></div>";
            } else {
                $s_lhref = $s_self . "cd=" . pl($s_cwd . $s_l . DS);
                $s_lsize = "DIR";
                $s_laction = "<span id='" . cs($s_l) . "_'><a href='" . $s_self . "cd=" . pl($s_cwd . $s_l . DS) . "&find=" . pl($s_cwd . $s_l . DS) . "'>find</a> | <a href='" . $s_self . "cd=" . pl($s_cwd . $s_l . DS) . "&x=upload" . "'>upl</a> | <a href=\"javascript:tukar('" . cs($s_l) . "_','','rename','" . adds($s_l) . "','" . adds($s_l) . "');\">ren</a> | <a href='" . $s_self . "cd=" . pl($s_cwd) . "&del=" . pl($s_l) . "'>del</a></span><div id='" . cs($s_l) . "__form'></div>";
                $s_total_dir++;
            }
            $s_lname = "[ " . $s_l . " ]";
            $s_lsizetit = "0";
            $s_lnametit = "dir : " . $s_l;
        } else {
            $s_lhref = $s_self . "view=" . pl($s_cwd . $s_l);
            $s_lname = $s_l;
            $s_lsize = gs($s_l);
            $s_lsizetit = @filesize($s_l);
            $s_lnametit = "file : " . $s_l;
            $s_laction = "<span id='" . cs($s_l) . "_'><a href='" . $s_self . "edit=" . pl($s_cwd . $s_l) . "'>edit</a> | <a href='" . $s_self . "hexedit=" . pl($s_cwd . $s_l) . "'>hex</a> | <a href=\"javascript:tukar('" . cs($s_l) . "_','','rename','" . adds($s_l) . "','" . adds($s_l) . "');\">ren</a> | <a href='" . $s_self . "del=" . pl($s_cwd . $s_l) . "'>del</a> | <a href='" . $s_self . "dl=" . pl($s_cwd . $s_l) . "'>dl</a></span><div id='" . cs($s_l) . "__form'></div>";
            $s_total_file++;
        }
        $s_cboxval = $s_cwd . $s_l;
        if ($s_l == '.') {
            $s_cboxval = $s_cwd;
        }
        if ($s_l == '..') {
            $s_cboxval = $s_parent;
        }
        $s_cboxes_id = substr(md5($s_lhref), 0, 8);
        $s_cboxes = "<input id='" . $s_cboxes_id . "' name='cbox' value='" . hss($s_cboxval) . "' type='checkbox' class='css-checkbox' onchange='hilite(this);' /><label for='" . $s_cboxes_id . "' class='css-label'></label>";
        $s_ltime = filemtime($s_l);
        $s_buff .= "<tr><td style='text-align:center;text-indent:4px;'>" . $s_cboxes . "</td><td class='xpl' title='" . $s_lnametit . "' ondblclick=\"return go('" . adds($s_lhref) . "',event);\"><a href='" . $s_lhref . "'>" . $s_lname . "</a></td><td title='" . $s_lsizetit . "'>" . $s_lsize . "</td>" . $s_owner_html . "<td class='ce'>" . gp($s_l) . "</td><td class='ce' title='" . $s_ltime . "'>" . @date("d-M-Y H:i:s", $s_ltime) . "</td><td>" . $s_laction . "</td></tr>";
    }
    $s_buff .= "</tbody>";
    $s_extract = "";
    $s_compress = "";
    if (class_exists("ZipArchive")) {
        $s_extract .= "<option value='extractzip'>extract (zip)</option>";
        $s_compress .= "<option value='compresszip'>compress (zip)</option>";
    }
    if ($s_tar) {
        $s_extract .= "<option value='extracttar'>extract (tar)</option><option value='extracttargz'>extract (tar.gz)</option>";
        $s_compress .= "<option value='compresstar'>compress (tar)</option><option value='compresstargz'>compress (tar.gz)</option>";
    }
    $s_extcom = $s_extract != "" && $s_compress != "" ? $s_extract . "<option value='' disabled>-</option>" . $s_compress : $s_extract . $s_compress;
    $s_buff .= "<tfoot><tr class='cbox_selected'><td class='cbox_all'><input id='checkalll' type='checkbox' name='abox' class='css-checkbox' onclick='checkall();' /> <label for='checkalll' class='css-label'></label></td><td><form action='" . $s_self . "' method='post'><select id='massact' class='inputzbut' onchange='massactgo();' style='width:100%;height:20px;margin:0;'><option value='' disabled selected>Action</option><option value='cut'>cut</option><option value='copy'>copy</option><option value='paste'>paste</option><option value='delete'>delete</option><option value='' disabled>-</option><option value='chmod'>chmod</option><option value='touch'>touch</option><option value='' disabled>-</option>" . $s_extcom . "</select><noscript><input type='button' value='Go !' class='inputzbut' onclick='massactgo();' /></noscript></form></td><td colspan='" . $s_colspan . "' style='text-align:left;'>Total : " . $s_total_file . " files, " . $s_total_dir . " Directories<span id='total_selected'></span></td></tr></tfoot></table>";
    return $s_buff;
}
Example #18
0
    }
    //while ($kount++ < 30) { echo "<br>"; }
}
# ========================================================
# Get some cookie stuff taken care of before header
# ========================================================
$template = $mainframe->getTemplate();
$app = $GLOBALS['AG']['application'];
if (gpExists('p2c')) {
    $color = gp('p2c');
    setCookie($app . "_color", hx($color), strtotime("+5 years", time()));
} else {
    $color = a($_REQUEST, $app . "_color", 'blue');
}
if (gpExists('p2s')) {
    $size = gp('p2s');
    setCookie($app . "_size", hx($size), strtotime("+5 years", time()));
} else {
    $size = a($_REQUEST, $app . "_size", '1024');
}
?>
<!DOCTYPE html>
<html lang="en">
	<head>
<?php 
cssInclude("clib/bootstrap-wysiwyg/bootstrap-wysihtml5.css");
cssInclude("templates/{$template}/bootstrap/css/bootstrap.min.css");
cssInclude("templates/{$template}/bootstrap/css/bootstrap-responsive.min.css");
cssInclude("templates/{$template}/bootstrap/datepicker/css/datepicker.css");
cssInclude("clib/bootstrap-wysiwyg/wysiwyg-color.css");
include 'androHTMLHead.php';
Example #19
0
 /**
  *  Automated report setup.  Establishes all hardcoded
  *  defaults, all overrides from YAML file, captions, column
  *  sizes, page orientation, and so forth and so on.
  *
  *  @param string $yamlP2  The processed page definition     
  *  @since 12/16/07
  */
 function mainSetup($yamlP2)
 {
     // Default UOM is points, so these are 1/2 inch margins
     $this->margin_left = 36;
     $this->margin_top = 36;
     $this->SetMargins($this->margin_left, $this->margin_top);
     // Set defaults.  As of 1/20/08 they are all hardcoded, but
     // the idea is to let them be set in the YAML file.
     $this->fontname = 'Arial';
     $this->fontsize = 12;
     $this->linespacing = 1;
     $this->cpi = 120 / $this->fontsize;
     $this->lineheight = $this->fontsize * $this->linespacing;
     // Pull options from Yamlp2
     $this->title1 = $yamlP2['options']['title'];
     // Determine if there are filters to list:
     $uifilters = ArraySafe($yamlP2, 'uifilter', array());
     $atitle2 = array();
     foreach ($uifilters as $name => $info) {
         $atitle2[] = $info['description'] . ':' . trim(gp('ap_' . $name));
     }
     $this->title2 = count($atitle2) == 0 ? '' : implode(", ", $atitle2);
     // Tell the fpdf parent class about our setting choices
     $this->SetTextColor(0, 0, 0);
     $this->SetFont($this->fontname);
     $this->SetFontSize($this->fontsize);
     // Set up titles and columns by looping through and figuring
     // out justification and size
     $setupArr = array();
     $width = 0;
     foreach ($yamlP2['table'] as $table => $columns) {
         $dd = dd_tableRef($table);
         foreach ($columns['column'] as $colname => $colinfo) {
             if (ArraySafe($colinfo, 'uino', 'N') == 'Y') {
                 continue;
             }
             // Use type to figure out if right or left
             $type_id = $dd['flat'][$colname]['type_id'];
             $suffix = '';
             if (in_array(trim($type_id), array('money', 'numb', 'int'))) {
                 $suffix .= ':R';
                 $suffix .= ':' . trim($dd['flat'][$colname]['colscale']);
             }
             if (trim($type_id) == 'money') {
                 $suffix .= ':M';
             }
             if (ArraySafe($colinfo, 'dispsize', '') != '') {
                 $suffix .= ':C' . $colinfo['dispsize'];
             }
             // Work out size using cpi setting
             $dispsize = ArraySafe($colinfo, 'dispsize', '');
             $dispsize = $dispsize != '' ? $dispsize : $dd['flat'][$colname]['dispsize'];
             $setupArr[] = round($dispsize / $this->cpi, 1) . $suffix;
             $width += $dispsize * $this->cpi + 0.1;
             // Save the captions for displaying in header
             $caption = ArraySafe($colinfo, 'description', '');
             $caption = $caption != '' ? $caption : $dd['flat'][$colname]['description'];
             $this->captions[] = $caption;
         }
     }
     $this->setupColumns(0.1, implode(',', $setupArr));
     // Finally, establish orientation by looking at size of report
     if ($width / 72 < 7.5) {
         $this->orientation = 'P';
     } else {
         $this->orientation = 'L';
     }
 }
Example #20
0
<?php

include_once "common.php";
if ($connection["ticket"] == gp("ticket") && !empty($id)) {
    echo callback("ok");
} else {
    header("HTTP/1.0 404 Not Found");
    echo "No client.";
}
function showdir($cwd)
{
    global $s_self;
    $posix = function_exists("posix_getpwuid") && function_exists("posix_getgrgid") ? true : false;
    $win = strtolower(substr(php_uname(), 0, 3)) == "win" ? true : false;
    $fname = array();
    $dname = array();
    if (function_exists("scandir") && ($dh = @scandir($cwd))) {
        foreach ($dh as $file) {
            if (is_dir($file)) {
                $dname[] = $file;
            } elseif (is_file($file)) {
                $fname[] = $file;
            }
        }
    } else {
        if ($dh = @opendir($cwd)) {
            while ($file = readdir($dh)) {
                if (is_dir($file)) {
                    $dname[] = $file;
                } elseif (is_file($file)) {
                    $fname[] = $file;
                }
            }
            closedir($dh);
        }
    }
    sort($fname);
    sort($dname);
    $list = array_merge($dname, $fname);
    if ($win) {
        //check if this root directory
        chdir("..");
        if (cp(getcwd()) == cp($cwd)) {
            array_unshift($list, ".");
        }
        chdir($cwd);
    }
    $path = explode(DIRECTORY_SEPARATOR, $cwd);
    $tree = sizeof($path);
    $parent = "";
    if ($tree > 2) {
        for ($i = 0; $i < $tree - 2; $i++) {
            $parent .= $path[$i] . DIRECTORY_SEPARATOR;
        }
    } else {
        $parent = $cwd;
    }
    $owner_html = !$win && $posix ? "<th style='width:120px;'>owner:group</th>" : "";
    $buff = "\n\t<table class='explore sortable'>\n\t<tr><th>name</th><th style='width:60px;'>size</th>" . $owner_html . "<th style='width:70px;'>perms</th><th style='width:110px;'>modified</th><th style='width:180px;' class='sorttable_nosort'>action</th><th style='width:90px;' class='sorttable_nosort'>download</th></tr>\n\t";
    $arc = get_archiver_available();
    foreach ($list as $l) {
        if (!$win && $posix) {
            $name = posix_getpwuid(fileowner($l));
            $group = posix_getgrgid(filegroup($l));
            $owner = $name['name'] . "<span class='gaya'>:</span>" . $group['name'];
            $owner_html = "<td style='text-align:center;'>" . $owner . "</td>";
        }
        $lhref = "";
        $lname = "";
        $laction = "";
        if (is_dir($l)) {
            if ($l == ".") {
                $lhref = $s_self . "cd=" . $cwd;
                $lsize = "LINK";
                $laction = "\n\t\t\t\t<span id='titik1'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . "&find=" . $cwd . "' title='find something'>find</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . "&upload' title='upload'>upl</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . "&edit=" . $cwd . "newfile_1&new' title='create new file'>+file</a> |\n\t\t\t\t\t<a href=\"javascript:tukar('titik1','titik1_form');\" title='create new directory'>+dir</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='titik1_form' class='sembunyi'>\n\t\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t\t<input type='hidden' name='cd' value=" . $cwd . "' />\n\t\t\t\t\t<input class='inputz' id='titik1_' style='width:80px;' type='text' name='mkdir' value='newfolder' />\n\t\t\t\t\t<input class='inputzbut' type='submit' name='rename' style='width:35px;' value='Go !' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('titik1_form','titik1');\" />\n\t\t\t\t</div>";
            } elseif ($l == "..") {
                $lhref = $s_self . "cd=" . $parent;
                $lsize = "LINK";
                $laction = "\n\t\t\t\t<span id='titik2'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $parent . "&find=" . $parent . "' title='find something'>find</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $parent . "&upload' title='upload'>upl</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $parent . "&edit=" . $parent . "newfile_1&new' title='create new file'>+file</a> |\n\t\t\t\t\t<a href=\"javascript:tukar('titik2','titik2_form');\" title='create new directory'>+dir</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='titik2_form' class='sembunyi'>\n\t\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t\t<input type='hidden' name='cd' value='" . $parent . "' />\n\t\t\t\t\t<input class='inputz' id='titik2_' style='width:80px;' type='text' name='mkdir' value='newfolder' />\n\t\t\t\t\t<input class='inputzbut' type='submit' name='rename' style='width:35px;' value='Go !' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('titik2_form','titik2');\" />\n\t\t\t\t</div>";
            } else {
                $lhref = $s_self . "cd=" . $cwd . $l . DIRECTORY_SEPARATOR;
                $lsize = "DIR";
                $laction = "\n\t\t\t\t<span id='" . cs($l) . "_link'>\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . $l . DIRECTORY_SEPARATOR . "&find=" . $cwd . $l . DIRECTORY_SEPARATOR . "' title='find something'>find</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . $l . DIRECTORY_SEPARATOR . "&upload' title='upload'>upl</a> |\n\t\t\t\t\t<a href=\"javascript:tukar('" . cs($l) . "_link','" . cs($l) . "_form');\" title='rename'>ren</a> |\n\t\t\t\t\t<a href='" . $s_self . "cd=" . $cwd . "&del=" . $l . "' title='delete'>del</a>\n\t\t\t\t</span>\n\t\t\t\t<div id='" . cs($l) . "_form' class='sembunyi'>\n\t\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t\t<input type='hidden' name='oldname' value='" . $l . "' />\n\t\t\t\t\t<input type='hidden' name='cd' value='" . $cwd . "' />\n\t\t\t\t\t<input class='inputz' style='width:80px;' type='text' id='" . cs($l) . "_link_' name='newname' value='" . $l . "' />\n\t\t\t\t\t<input class='inputzbut' type='submit' name='rename' value='ren' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('" . cs($l) . "_form','" . cs($l) . "_link');\" />\n\t\t\t\t</div>";
            }
            $lname = "[ " . $l . " ]";
            $lsizetit = "0";
        } else {
            $lhref = $s_self . "view=" . $l;
            $lname = $l;
            $lsize = gs($l);
            $lsizetit = @filesize($l);
            $laction = "\n\t\t\t<div id='" . cs($l) . "_form' class='sembunyi'>\n\t\t\t\t<form action='" . $s_self . "' method='post'>\n\t\t\t\t<input type='hidden' name='oldname' value='" . $l . "' />\n\t\t\t\t<input class='inputz' style='width:80px;' type='text' id='" . cs($l) . "_link_' name='newname' value='" . $l . "' />\n\t\t\t\t<input class='inputzbut' type='submit' name='rename' value='ren' />\n\t\t\t\t</form>\n\t\t\t\t<input class='inputzbut' type='button' value='x' onclick=\"tukar('" . cs($l) . "_form','" . cs($l) . "_link');\" />\n\t\t\t</div>\n\t\t\t<span id='" . cs($l) . "_link'>\n\t\t\t\t<a href='" . $s_self . "edit=" . cs($cwd . $l) . "' title='edit'>edit</a> |\n\t\t\t\t<a href='" . $s_self . "hexedit=" . cs($cwd . $l) . "' title='edit as hex'>hex</a> |\n\t\t\t\t<a href=\"javascript:tukar('" . cs($l) . "_link','" . cs($l) . "_form');\" title='rename'>ren</a> |\n\t\t\t\t<a href='" . $s_self . "del=" . $l . "' title='delete'>del</a>\n\t\t\t</span>";
        }
        $ldl = str_replace("__dlpath__", $l, $arc);
        $buff .= "\n\t\t<tr>\n\t\t<td class='explorelist' onmouseup=\"return go('" . addslashes($lhref) . "',event);\">\n\t\t\t<a href='" . $lhref . "'>" . $lname . "</a>\n\t\t</td>\n\t\t<td title='" . $lsizetit . "'>" . $lsize . "</td>\n\t\t" . $owner_html . "\n\t\t<td style='text-align:center;'>" . gp($l) . "</td>\n\t\t<td style='text-align:center;'>" . @date("d-M-Y H:i", filemtime($l)) . "</td>\n\t\t<td>" . $laction . "</td>\n\t\t<td>" . $ldl . "</td></tr>";
    }
    $buff .= "</table>";
    return $buff;
}
Example #22
0
function showdir($cwd)
{
    $posix = function_exists("posix_getpwuid") && function_exists("posix_getgrgid") ? true : false;
    $win = strtolower(substr(php_uname(), 0, 3)) == "win" ? true : false;
    $fname = array();
    $dname = array();
    if (function_exists("scandir") && ($dh = @scandir($cwd))) {
        foreach ($dh as $file) {
            if (is_dir($file)) {
                $dname[] = $file;
            } elseif (is_file($file)) {
                $fname[] = $file;
            }
        }
    } else {
        if ($dh = @opendir($cwd)) {
            while ($file = readdir($dh)) {
                if (is_dir($file)) {
                    $dname[] = $file;
                } elseif (is_file($file)) {
                    $fname[] = $file;
                }
            }
            closedir($dh);
        }
    }
    sort($fname);
    sort($dname);
    $path = explode(DIRECTORY_SEPARATOR, $cwd);
    $tree = sizeof($path);
    $parent = "";
    $owner_html = !$win && $posix ? "<th style=\"width:120px;\">owner : group</th>" : "";
    $buff = "\r\n\t<table class=\"explore sortable\">\r\n\t<tr><th>name</th><th style=\"width:60px;\">size</th>" . $owner_html . "<th style=\"width:70px;\">perms</th><th style=\"width:110px;\">modified</th><th style=\"width:180px;\">action</th><th style=\"width:90px;\">download</th></tr>\r\n\t";
    if ($tree > 2) {
        for ($i = 0; $i < $tree - 2; $i++) {
            $parent .= $path[$i] . DIRECTORY_SEPARATOR;
        }
    } else {
        $parent = $cwd;
    }
    $dlfile = get_archiver_available();
    foreach ($dname as $folder) {
        if (!$win && $posix) {
            $name = posix_getpwuid(fileowner($folder));
            $group = posix_getgrgid(filegroup($folder));
            $owner = $name['name'] . "<span class=\"gaya\"> : </span>" . $group['name'];
            $owner_html = "<td style=\"text-align:center;\">" . $owner . "</td>";
        }
        $dlfile_ = str_replace("<option value=\"raw\">raw</option>", "", $dlfile);
        $dlfile_ = str_replace("__dlpath__", $folder, $dlfile_);
        $dlfile_ = str_replace("__dlcwd__", $cwd, $dlfile_);
        if ($folder == ".") {
            $buff .= "<tr><td class=\"explorelist\" onmouseup=\"xplgo('" . addslashes($cwd) . "');\"><a href=\"?d=" . $cwd . "\">[ {$folder} ]</a></td><td>LINK</td>" . $owner_html . "<td style=\"text-align:center;\">" . gp($cwd) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($cwd)) . "</td><td><span id=\"titik1\"><a href=\"?upload&amp;d={$cwd}\">upload</a> | <a href=\"?d={$cwd}&amp;edit=" . $cwd . "newfile.php\">newfile</a> | <a href=\"javascript:tukar('titik1','titik1_form');\">newfolder</a></span>\r\n\t\t\t<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"get\" id=\"titik1_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\r\n\t\t\t<input type=\"hidden\" name=\"d\" value=\"" . $cwd . "\" />\r\n\t\t\t<input class=\"inputz\" id=\"titik1_\" style=\"width:110px;\" type=\"text\" name=\"mkdir\" value=\"a_new_folder\" />\r\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" style=\"width:35px;\" value=\"Go !\" />\r\n\t\t\t</form></td><td>" . $dlfile_ . "</td></tr>\r\n\t\t\t";
        } elseif ($folder == "..") {
            $buff .= "<tr><td class=\"explorelist\" onmouseup=\"xplgo('" . addslashes($parent) . "');\"><a href=\"?d=" . $parent . "\">[ {$folder} ]</a></td><td>LINK</td>" . $owner_html . "<td style=\"text-align:center;\">" . gp($parent) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($parent)) . "</td><td><span id=\"titik2\"><a href=\"?upload&amp;d={$parent}\">upload</a> | <a href=\"?d={$cwd}&amp;edit=" . $parent . "newfile.php\">newfile</a> | <a href=\"javascript:tukar('titik2','titik2_form');\">newfolder</a></span>\r\n\t\t\t<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"get\" id=\"titik2_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\r\n\t\t\t<input type=\"hidden\" name=\"d\" value=\"" . $cwd . "\" />\r\n\t\t\t<input class=\"inputz\" id=\"titik2_\" style=\"width:110px;\" type=\"text\" name=\"mkdir\" value=\"a_new_folder\" />\r\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" style=\"width:35px;\" value=\"Go !\" />\r\n\t\t\t</form>\r\n\t\t\t</td><td>" . $dlfile_ . "</td></tr>";
        } else {
            $buff .= "<tr><td class=\"explorelist\" onmouseup=\"xplgo('" . addslashes($cwd . $folder . DIRECTORY_SEPARATOR) . "');\"><a id=\"" . cs($folder) . "_link\" href=\"?d=" . $cwd . $folder . DIRECTORY_SEPARATOR . "\">[ {$folder} ]</a>\r\n\t\t\t<form onclick=\"cancelBubble(event);\" action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\" id=\"" . cs($folder) . "_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\r\n\t\t\t<input type=\"hidden\" name=\"oldname\" value=\"" . $folder . "\" style=\"margin:0;padding:0;\" />\r\n\t\t\t<input type=\"hidden\" name=\"d\" value=\"" . $cwd . "\" />\r\n\t\t\t<input class=\"inputz\" style=\"width:200px;\" id=\"" . cs($folder) . "_link_\" type=\"text\" name=\"newname\" value=\"" . $folder . "\" />\r\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" value=\"rename\" />\r\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"cancel\" value=\"cancel\" onclick=\"tukar('" . cs($folder) . "_form','" . cs($folder) . "_link');\" />\r\n\t\t\t</form>\r\n\t\t\t<td>DIR</td>" . $owner_html . "<td style=\"text-align:center;\">" . gp($cwd . $folder) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($folder)) . "</td><td><a href=\"?upload&amp;d=" . $cwd . $folder . "\">upload</a> | <a href=\"javascript:tukar('" . cs($folder) . "_link','" . cs($folder) . "_form');\">rename</a> | <a href=\"?d=" . $cwd . "&amp;rmdir=" . $cwd . $folder . "\">delete</a></td><td>" . $dlfile_ . "</td></tr>";
        }
    }
    foreach ($fname as $file) {
        $full = $cwd . $file;
        if (!$win && $posix) {
            $name = posix_getpwuid(fileowner($full));
            $group = posix_getgrgid(filegroup($full));
            $owner = $name['name'] . "<span class=\"gaya\"> : </span>" . $group['name'];
            $owner_html = "<td style=\"text-align:center;\">" . $owner . "</td>";
        }
        $dlfile_ = str_replace("__dlpath__", $file, $dlfile);
        $dlfile_ = str_replace("__dlcwd__", $cwd, $dlfile_);
        $buff .= "<tr><td class=\"explorelist\" onmouseup=\"xplgo('" . addslashes($cwd) . "&view=" . addslashes($full) . "');\"><a id=\"" . cs($file) . "_link\" href=\"?d={$cwd}&amp;view={$full}\">{$file}</a>\r\n\t\t<form onclick=\"cancelBubble(event);\" action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\" id=\"" . cs($file) . "_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\r\n\t\t<input type=\"hidden\" name=\"oldname\" value=\"" . $file . "\" style=\"margin:0;padding:0;\" />\r\n\t\t<input type=\"hidden\" name=\"d\" value=\"" . $cwd . "\" />\r\n\t\t<input class=\"inputz\" style=\"width:200px;\" type=\"text\" id=\"" . cs($file) . "_link_\" name=\"newname\" value=\"" . $file . "\" />\r\n\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" value=\"rename\" />\r\n\t\t<input class=\"inputzbut\" type=\"submit\" name=\"cancel\" value=\"cancel\" onclick=\"tukar('" . cs($file) . "_link','" . cs($file) . "_form');\" />\r\n\t\t</form>\r\n\t\t</td><td title=\"" . filesize($full) . "\">" . gs($full) . "</td>" . $owner_html . "<td style=\"text-align:center;\">" . gp($full) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($full)) . "</td>\r\n\t\t<td><a href=\"?d={$cwd}&amp;edit={$full}\">edit</a> | <a href=\"javascript:tukar('" . cs($file) . "_link','" . cs($file) . "_form');\">rename</a> | <a href=\"?d={$cwd}&amp;delete={$full}\">delete</a></td><td>" . $dlfile_ . "</td></tr>";
    }
    $buff .= "</table>";
    return $buff;
}
Example #23
0
function showdir($pwd, $prompt, $win)
{
    if (function_exists("posix_getpwuid") && function_exists("posix_getgrgid")) {
        $posix = TRUE;
    } else {
        $posix = FALSE;
    }
    $user = "******";
    $fname = array();
    $dname = array();
    if ($dh = scandir($pwd)) {
        foreach ($dh as $file) {
            if (is_dir($file)) {
                $dname[] = $file;
            } elseif (is_file($file)) {
                $fname[] = $file;
            }
        }
    } else {
        if ($dh = opendir($pwd)) {
            while ($file = readdir($dh)) {
                if (is_dir($file)) {
                    $dname[] = $file;
                } elseif (is_file($file)) {
                    $fname[] = $file;
                }
            }
            closedir($dh);
        }
    }
    sort($fname);
    sort($dname);
    $path = explode(DIRECTORY_SEPARATOR, $pwd);
    $tree = sizeof($path);
    $parent = "";
    $buff = "\n<table class=\"explore sortable\">\n\t<tr><th>name</th><th style=\"width:60px;\">size</th><th style=\"width:100px;\">owner : group</th><th style=\"width:70px;\">perms</th><th style=\"width:110px;\">modified</th><th style=\"width:210px;\">actions</th></tr>\n\t";
    if ($tree > 2) {
        for ($i = 0; $i < $tree - 2; $i++) {
            $parent .= $path[$i] . DIRECTORY_SEPARATOR;
        }
    } else {
        $parent = $pwd;
    }
    foreach ($dname as $folder) {
        if ($folder == ".") {
            if (!$win && $posix) {
                $name = posix_getpwuid(fileowner($folder));
                $group = posix_getgrgid(filegroup($folder));
                $owner = $name['name'] . "<span class=\"gaya\"> : </span>" . $group['name'];
            } else {
                $owner = $user;
            }
            $buff .= "<tr><td><a href=\"?d=" . $pwd . "\">[ {$folder} ]</a></td><td>LINK</td><td style=\"text-align:center;\">" . $owner . "</td><td  style=\"text-align:center;\">" . gp($pwd) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($pwd)) . "</td><td><span id=\"titik1\"><a href=\"?d={$pwd}&amp;edit=" . $pwd . "newfile.php\">newfile</a> | <a href=\"javascript:tukar('titik1','titik1_form');\">newfolder</a> | <a href=\"?upload&amp;d={$pwd}\">upload</a></span>\n\t\t\t<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"get\" id=\"titik1_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\n\t\t\t<input type=\"hidden\" name=\"d\" value=\"" . $pwd . "\" />\n\t\t\t<input class=\"inputz\" id=\"titik1_\" style=\"width:140px;\" type=\"text\" name=\"mkdir\" value=\"a_new_folder\" />\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" style=\"width:35px;\" value=\"Go !\" />\n\t\t\t</form></td></tr>\n\t\t\t";
        } elseif ($folder == "..") {
            if (!$win && $posix) {
                $name = posix_getpwuid(fileowner($folder));
                $group = posix_getgrgid(filegroup($folder));
                $owner = $name['name'] . "<span class=\"gaya\"> : </span>" . $group['name'];
            } else {
                $owner = $user;
            }
            $buff .= "<tr><td><a href=\"?d=" . $parent . "\">[ {$folder} ]</a></td><td>LINK</td><td style=\"text-align:center;\">" . $owner . "</td><td style=\"text-align:center;\">" . gp($parent) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($parent)) . "</td><td><span id=\"titik2\"><a href=\"?d={$pwd}&amp;edit=" . $parent . "newfile.php\">newfile</a> | <a href=\"javascript:tukar('titik2','titik2_form');\">newfolder</a> | <a href=\"?upload&amp;d={$parent}\">upload</a></span>\n\t\t\t<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"get\" id=\"titik2_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\n\t\t\t<input type=\"hidden\" name=\"d\" value=\"" . $pwd . "\" />\n\t\t\t<input class=\"inputz\" id=\"titik2_\" style=\"width:140px;\" type=\"text\" name=\"mkdir\" value=\"a_new_folder\" />\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" style=\"width:35px;\" value=\"Go !\" />\n\t\t\t</form>\n\t\t\t</td></tr>";
        } else {
            if (!$win && $posix) {
                $name = posix_getpwuid(fileowner($folder));
                $group = posix_getgrgid(filegroup($folder));
                $owner = $name['name'] . "<span class=\"gaya\"> : </span>" . $group['name'];
            } else {
                $owner = $user;
            }
            $buff .= "<tr><td><a id=\"" . cs($folder) . "_link\" href=\"?d=" . $pwd . $folder . DIRECTORY_SEPARATOR . "\">[ {$folder} ]</a>\n\t\t\t<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\" id=\"" . cs($folder) . "_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\n\t\t\t<input type=\"hidden\" name=\"oldname\" value=\"" . $folder . "\" style=\"margin:0;padding:0;\" />\n\t\t\t<input type=\"hidden\" name=\"d\" value=\"" . $pwd . "\" />\n\t\t\t<input class=\"inputz\" style=\"width:200px;\" id=\"" . cs($folder) . "_link_\" type=\"text\" name=\"newname\" value=\"" . $folder . "\" />\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" value=\"rename\" />\n\t\t\t<input class=\"inputzbut\" type=\"submit\" name=\"cancel\" value=\"cancel\" onclick=\"tukar('" . cs($folder) . "_form','" . cs($folder) . "_link');\" />\n\t\t\t</form>\n\t\t\t<td>DIR</td><td style=\"text-align:center;\">" . $owner . "</td><td style=\"text-align:center;\">" . gp($pwd . $folder) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($folder)) . "</td><td><a href=\"javascript:tukar('" . cs($folder) . "_link','" . cs($folder) . "_form');\">rename</a> | <a href=\"?d=" . $pwd . "&amp;rmdir=" . $pwd . $folder . "\">delete</a> | <a href=\"?upload&amp;d=" . $pwd . $folder . "\">upload</a></td></tr>";
        }
    }
    foreach ($fname as $file) {
        $full = $pwd . $file;
        if (!$win && $posix) {
            $name = posix_getpwuid(fileowner($full));
            $group = posix_getgrgid(filegroup($full));
            $owner = $name['name'] . "<span class=\"gaya\"> : </span>" . $group['name'];
        } else {
            $owner = $user;
        }
        $buff .= "<tr><td><a id=\"" . cs($file) . "_link\" href=\"?d={$pwd}&amp;view={$full}\">{$file}</a>\n\t\t<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\" id=\"" . cs($file) . "_form\" class=\"sembunyi\" style=\"margin:0;padding:0;\">\n\t\t<input type=\"hidden\" name=\"oldname\" value=\"" . $file . "\" style=\"margin:0;padding:0;\" />\n\t\t<input type=\"hidden\" name=\"d\" value=\"" . $pwd . "\" />\n\t\t<input class=\"inputz\" style=\"width:200px;\" type=\"text\" id=\"" . cs($file) . "_link_\" name=\"newname\" value=\"" . $file . "\" />\n\t\t<input class=\"inputzbut\" type=\"submit\" name=\"rename\" value=\"rename\" />\n\t\t<input class=\"inputzbut\" type=\"submit\" name=\"cancel\" value=\"cancel\" onclick=\"tukar('" . cs($file) . "_link','" . cs($file) . "_form');\" />\n\t\t</form>\n\t\t</td><td>" . gs($full) . "</td><td style=\"text-align:center;\">" . $owner . "</td><td style=\"text-align:center;\">" . gp($full) . "</td><td style=\"text-align:center;\">" . date("d-M-Y H:i", filemtime($full)) . "</td>\n\t\t<td><a href=\"?d={$pwd}&amp;edit={$full}\">edit</a> | <a href=\"javascript:tukar('" . cs($file) . "_link','" . cs($file) . "_form');\">rename</a> | <a href=\"?d={$pwd}&amp;delete={$full}\">delete</a> | <a href=\"?d={$pwd}&amp;dl={$full}\">download</a>&nbsp;(<a href=\"?d={$pwd}&amp;dlgzip={$full}\">gzip</a>)</td></tr>";
    }
    $buff .= "</table>";
    return $buff;
}
Example #24
0
</td>
                                <td><?php 
                echo 'Rent';
                ?>
</td>
                                <td><?php 
                echo gp('created_on', $invoice) . ' To ' . gp('end_period_date', $invoice);
                ?>
</td>
                                <td>&pound;<?php 
                echo $total_amount = gp('total_amount', $invoice);
                ?>
</td>
                                <td>
                                    <?php 
                $payment_amount = gp('amount', $invoice);
                echo $payment_amount;
                ?>
                                </td>
                                <td><?php 
                $valuee = $total_amount - $payment_amount;
                if ($valuee >= 0) {
                    echo '&pound' . $valuee;
                } else {
                    echo '-&pound' . $valuee * -1;
                }
                ?>
</td>
                            </tr>
                        <?php 
            }
Example #25
0
<?php

include_once 'common.php';
require 'http_client.php';
$ticket = gp('ticket');
$body = gp('body', '');
$style = gp('style', 'msg');
$to = gp('to');
$from = $space['uid'];
$time = microtime(true) * 1000;
if (empty($to) || empty($from)) {
    echo '{error:true}';
    exit;
}
$client = new HttpClient($_IMC['imsvr'], $_IMC['impost']);
$nick = to_unicode(to_utf8(nick($space)));
$client->post('/messages', array('domain' => $_IMC['domain'], 'apikey' => $_IMC['apikey'], 'ticket' => $ticket, 'nick' => $nick, 'to' => $to, 'body' => to_unicode($body), 'timestamp' => (string) $time, 'style' => $style));
//TODO: if forward message successfully.
$message = array('to' => $to, 'from' => $from, 'style' => $style, 'body' => from_utf8($body), 'timestamp' => $time);
inserttable('im_histories', $message);
echo "ok";
Example #26
0
 function ehProcessDisplay($SQ, $rows_col, $row_rep)
 {
     $gp_process = gp('gp_process');
     $this->dispmode = $gp_process == 1 ? 'screen' : 'print';
     // Set the template
     $html_main = gp('gp_process') == 1 ? 'html_skin_tc_prscreen' : 'html_print';
     vgaSet('html_main', $html_main);
     // Execute the query, but do not retrieve
     $result = SQL($SQ);
     // Two counters:  PageNum, and RowNum, the row number
     // inside of a page.
     $this->PageNum = 1;
     $this->RowNum = 1;
     $this->RowsPerPage = 66;
     // In all cases, begin with a header
     $this->ehPDInit();
     if ($this->PageNum == 1) {
         $this->ehPDHeader($row_rep, $rows_col);
     }
     //  This is the basic output loop
     while ($row = SQL_Fetch_Array($result)) {
         arrayStripNumericIndexes($row);
         $this->ehPDRow($row);
         // Always increase row count.  For PDF, look for reset
         $RowNum++;
         if ($dispmode == 'print') {
             if ($RowNum > $RowsPerPage) {
                 $this->ehPDFooter();
                 $this->RowNum = 1;
                 $this->PageNum++;
                 $this->ehPDHeader($PageNum);
             }
         }
     }
     // In all Cases, end with a footer
     $this->ehPDFooter();
     $this->ehPDClose();
 }
Example #27
0
    function main()
    {
        // Get top page
        $this->PageSubtitle = "Documentation";
        //$sq="SELECT pagename FROM docpageshier WHERE pagehier=1";
        //$pageroot=SQL_OneValue('pagename',$sq);
        $pageroot = 'Data Dictionary';
        $pn = gp('gppn');
        $pn = $pn == '' ? $pageroot : $pn;
        $sq = "SELECT * from docpages \n            WHERE pagename = " . sql_format('char', $pn);
        $row = SQL_oneRow($sq);
        if ($row === false) {
            echo "Page does not exist: " . $pn;
            return;
        }
        // Get one parent.  We used to get all of them, but now
        // we only want one
        $hmenu = '';
        $attop = false;
        $parents = array();
        $peers = array();
        $kids = array();
        $pparent = $pprev = $pnext = '';
        $plast = $pn;
        while ($plast != $pageroot) {
            $sq = "SELECT pagename_par FROM docpages \n               WHERE pagename = '{$plast}'";
            $rownew = SQL_AllRows($sq);
            $plast = $rownew[0]['pagename_par'];
            $parents[] = $plast;
            //if ($rownew[0]['pagename_par'] == $pageroot) {
            //   break;
            //}
        }
        if (count($parents) > 0) {
            $parents = array_reverse($parents);
            //$hmenu=adocs_makemenu($parents,'Parent Topics');
            // Grab this page's peers
            $pparent = $parents[count($parents) - 1];
            $sq = "SELECT pagename FROM docpages \n               WHERE pagename_par = '{$pparent}'\n               ORDER BY sequence";
            $rs = SQL($sq);
            while ($rowx = SQL_Fetch_Array($rs)) {
                $peers[] = $rowx['pagename'];
            }
            $peersr = array_flip($peers);
            $pprev = $peersr[$pn] == 0 ? '' : $peers[$peersr[$pn] - 1];
            $pnext = $peersr[$pn] == count($peers) - 1 ? '' : $peers[$peersr[$pn] + 1];
        }
        // Now pull out the kids
        $sq = "SELECT pagename FROM docpages \n            WHERE pagename_par = '{$pn}'\n            ORDER BY sequence";
        $rs = SQL($sq);
        while ($rowx = SQL_Fetch_Array($rs)) {
            $kids[] = $rowx['pagename'];
        }
        // Make and save a menu out of what we've discovered
        adocs_makemenu($pageroot, $pn, $parents, $peers);
        // Now format the page and save it.  No caching for now.
        $html = $row['pagetext'];
        $html = $this->WikiProcess($html);
        /*
        // Remove carriage returns, makes things much easier
        $html=str_replace("\r",'',$html);
        
        // Convert newlines to double br's, but first don't do doubles
        // after headings
        $html=str_replace("=\n\n","=\n",$html);
        $html=preg_replace("/\n\s*\n/","\n<br><br>\n",$html);
             
        // Convert bold & italitcs 
        $html=preg_replace(
           "/'{4,}(.*)'{4,}/xmsU"
           ,'<b><i>$1</i></b>'
           ,$html);
        $html=preg_replace(
           "/'{3}(.*)'{3}/xmsU"
           ,'<i>$1</i>'
           ,$html);
        $html=preg_replace(
           "/\'{2}(.*)\'{2}/xmsU"
           ,'<b>$1</b>'
           ,$html);
             
        
        // Convert 6 levels of title
        $html=preg_replace(
           "/={6}(.*)={6}/xsU"
           ,'<head6>$1</head6>'
           ,$html);
        $html=preg_replace(
           "/={5}(.*)={5}/xsU"
           ,'<head5>$1</head5>'
           ,$html);
        $html=preg_replace(
           "/={4}(.*)={4}/xsU"
           ,'<head4>$1</head4>'
           ,$html);
        $html=preg_replace(
           "/={3}(.*)={3}/xsU"
           ,'<head3>$1</head3>'
           ,$html);
        $html=preg_replace(
           "/={2}(.*)={2}/xsU"
           ,'<head2>$1</head2>'
           ,$html);
           
        $html=preg_replace(
           '/^=(.*)=$/U'
           ,'<head1>$1</head1>'
           ,$html);
        
        // convert hyperlinks and images
        $matches=array();
        while(preg_match('/\[{2,}(.*)\]{2,}/xmsU',$html,$matches)>0) {
           $search=$matches[1];
           $asearch=explode(':',$search);
           if(count($asearch)==2) {
              $type=$asearch[0];
              $match=$asearch[1];
           }
           else {
              $type='ilink';
              $match=$search;
           }
           
           switch(strtolower($type)) {
              case 'ilink': $this->Linkilink($html,$match); break;
              case 'image': $this->LinkImage($html,$match,$type); break;
           }
           
           $matches=array();
        }
        */
        // Prepare a list of parents
        if (count($parents) == 0) {
            $apars = array($pn);
        } else {
            $apars = $parents;
            $apars[] = $pn;
        }
        $hpars = '';
        foreach ($apars as $apar) {
            $hpars .= ($hpars == '' ? '' : ' &gt; ') . '<a href="?gp_page=x_docview&gppn=' . urlencode($apar) . '">' . $apar . '</a>';
        }
        // Prepare the prev, next stuff
        $hpn = '';
        if ($pprev . $pnext != '') {
            $hp = $pprev == '' ? '' : '<a href="?gp_page=x_docview&gppn=' . urlencode($pprev) . '">PREV: ' . $pprev . '</a>';
            $hn = $pnext == '' ? '' : '<a href="?gp_page=x_docview&gppn=' . urlencode($pnext) . '">NEXT: ' . $pnext . '</a>';
            $hpn = "\n\t\t\t<div class=\"row\">\n\t\t\t<div class=\"span9\">\n\t\t\t\t<div class=\"pull-left\">{$hp}</div>\n\t\t\t\t<div class=\"pull-right\">{$hn}</div>\n\t\t\t</div>\n\t\t\t</div>";
        }
        // Pull out and assemble the see-also groups
        $hsa = '';
        /*
        $hsa='';
        $sq='SELECT DISTINCT seealso FROM seealsoxpages '
           ." WHERE pagename='$pn'";
        $sas=SQL_AllRows($sq);
        foreach($sas as $sa) {
           $hsa.="<hr>";
           $seealso=$sa['seealso'];
           $hsa.="<hr><h2>See Also ($seealso):</h2><p>";
           $sq="SELECT pagename FROM seealsoxpages "
              ." WHERE seealso = '$seealso' "
              ."  AND  pagename <> '$pn'"
              ." ORDER By pagename ";
           $sarows=SQL_AllRows($sq);
           foreach($sarows as $index=>$sarow) {
              $hsa.=($index==0 ? '' : ', ')
                 .'<a href="?gppn='.urlencode($sarow['pagename']).'">'
                 .$sarow['pagename'].'</a>';
           }
           $sarows.='</p>';
        }
        */
        // Now the actual output and formatting
        //
        $this->PageSubtitle = $pn;
        echo "<div class=\"hero-unit\">Database Specification</div>";
        echo $hpars . "<br><br>";
        echo $hpn;
        echo "\n<hr>";
        echo "\n<h2>" . $pn . "</h2>\n";
        echo $html;
        if (count($kids) > 0 && $pn == 'Data Dictionary') {
            echo "\n<hr>";
            echo "\n<head2>Child Topics</head2>";
            foreach ($kids as $kid) {
                echo "\n<div><a href=\"?gp_page=x_docview&gppn=" . urlencode($kid) . "\">{$kid}</a></div>";
            }
        }
        echo $hsa;
        echo "<hr>";
        echo $hpn;
        ?>
      <hr>
      Page last modified <?php 
        echo date('r', dEnsureTS($row['ts_upd']));
        ?>
 by 
         <?php 
        echo $row['uid_upd'];
        ?>
<br><br>
      <?php 
    }
Example #28
0
 function Login_Process()
 {
     $arg2 = $this->directlogin == true ? 'direct' : '';
     // only process if user hit "post"
     if (gp('gp_posted', '', false) == '') {
         return;
     }
     vgfSet('LoginAttemptOK', false);
     // Error title
     vgfSet('ERROR_TITLE', '*');
     // If the user supplied a loginUID, this is a post and we
     // must process the request.
     $ale = vgaGet('login_errors', array());
     $app = $GLOBALS['AG']['application'];
     $em000 = isset($ale['000']) ? $ale['000'] : "That username/password combination did not work.  Please try again.";
     $em001 = isset($ale['001']) ? $ale['001'] : "That username/password combination did not work.  Please try again.";
     $em002 = isset($ale['002']) ? $ale['002'] : "That username/password combination did not work.  Please try again.";
     $em099 = isset($ale['099']) ? $ale['099'] : "That username/password combination did not work.  Please try again.";
     $terror = "";
     $uid = gp('loginUID');
     $uid = MakeUserID($uid);
     //$uid = str_replace('@','_',$uid);
     //$uid = str_replace('.','_',$uid);
     $pwd = gp("loginPWD", "", false);
     // First check, never allow the database server's superuser
     // account
     //
     if ($uid == "postgres") {
         ErrorAdd($em000);
         if (vgfGet('loglogins', false)) {
             sysLog(LOG_WARNING, "Andromeda:{$app}:Bad login attempt as postgres");
             fwLogEntry('1011', 'Attempt login as postgres', '', $arg2);
         }
         return;
     }
     $app = $GLOBALS['AG']['application'];
     if (substr($uid, 0, strlen($app)) == $app) {
         ErrorAdd($em001);
         if (vgfGet('loglogins', false)) {
             sysLog(LOG_WARNING, "Andromeda:{$app}:Bad login attempt as group role");
             fwLogEntry('1012', 'Attempt login as group role', $uid, $arg2);
         }
         return;
     }
     // Begin with a connection attempt.
     // on fail, otherwise continue
     $tcs = @SQL_CONN($uid, $pwd);
     if ($tcs === false) {
         ErrorAdd($em099);
         if (vgfGet('loglogins', false)) {
             sysLog(LOG_NOTICE, "Andromeda:{$app}:Bad login attempt server rejected");
             fwLogEntry('1013', 'Server rejected username/password', $uid, $arg2);
         }
         return;
     } else {
         SQL_CONNCLOSE($tcs);
     }
     // The rest of this routine uses an admin connection.  If we
     // have an error, we must close the connection before returning!
     //    ...yes, yes, that's bad form, all complaints to /dev/null
     //
     if (vgfGet('loglogins', false)) {
         fwLogEntry('1010', 'Login OK', $uid, $arg2);
     }
     scDBConn_Push();
     // See if they are a root user.  If not, do they have an
     //  active account?
     $root = false;
     $admin = false;
     $group_id_eff = '';
     $results = SQL("\n         Select oid\n           FROM pg_roles   \n          WHERE rolname = CAST('{$uid}' as name)\n            AND rolsuper= true");
     $cr = SQL_NUMROWS($results);
     if ($cr != 0) {
         $root = true;
     } else {
         $results = SQL("Select * from users WHERE LOWER(user_id)='{$uid}'" . "AND (user_disabled<>'Y' or user_disabled IS NULL)");
         $cr = SQL_NUMROWS($results);
         if ($cr == 0) {
             scDBConn_Pop();
             ErrorAdd($em002);
             sysLog(LOG_WARNING, "Andromeda:{$app}:Bad login attempt code 002");
             return;
         } else {
             $userinfo = SQL_Fetch_Array($results);
             $group_id_eff = $userinfo['group_id_eff'];
             SessionSet('user_name', $userinfo['user_name']);
         }
     }
     // Flag if the user is an administrator
     if ($root == true) {
         $admin = true;
     } else {
         $results = SQL("select count(*) as admin from usersxgroups " . "where user_id='{$uid}' and group_id ='{$app}" . "_admin'");
         $row = SQL_FETCH_ARRAY($results);
         $admin = intval($row["admin"]) > 0 ? true : false;
     }
     // Get the users' groups
     $groups = "";
     if ($root) {
         $results = SQL("\n            select group_id \n              from zdd.groups \n             where COALESCE(grouplist,'')=''");
     } else {
         $results = SQL("select group_id from usersxgroups WHERE LOWER(user_id)='{$uid}'");
     }
     while ($row = SQL_FETCH_ARRAY($results)) {
         $agroups[] = "'" . trim($row['group_id']) . "'";
         #$groups.=ListDelim($groups)."'".trim($row["group_id"])."'";
     }
     $groups = array();
     if (!empty($agroups)) {
         $groups = implode(",", $agroups);
     }
     //scDBConn_Pop();
     // We have a successful login.  If somebody else was already
     // logged in, we need to wipe out that person's session.  But
     // don't do this if there was an anonymous login.
     if (LoggedIn()) {
         $uid_previous = SessionGet('UID');
         if ($uid != $uid_previous) {
             //Session_Destroy();
             SessionReset();
             //Index_Hidden_Session_Start(false);
         }
     }
     // We know who they are and that they can connect,
     // see if there is any app-specific confirmation required
     //
     if (function_exists('app_login_process')) {
         //echo "Calling the process now";
         if (!app_login_process($uid, $pwd, $admin, $groups)) {
             return;
         }
     }
     // Protect the session from hijacking, generate a new ID
     Session_regenerate_id();
     // We now have a successful connection, set some
     // flags and lets go
     //
     vgfSet('LoginAttemptOK', true);
     SessionSet("UID", $uid);
     SessionSet("PWD", $pwd);
     SessionSet("ADMIN", $admin);
     SessionSet("ROOT", $root);
     SessionSet("GROUP_ID_EFF", $group_id_eff);
     SessionSet("groups", $groups);
     if (gp('gpz_page') == '') {
         # KFD 9/12/08, extra command to not change page
         if (gp('st2keep') != 1) {
             gpSet('gp_page', '');
         }
     }
     $GLOBALS['session_st'] = 'N';
     // for "N"ormal
     // -------------------------------------------------------------------
     // We are about to make the menu.  Before doing so, see if there
     // are any variables set for the menu layout.  Set defaults and then
     // load from database.
     //
     $this->pmenu = array('MENU_TYPE' => vgaGet('MENU_TYPE', 'div'), 'MENU_CLASS_MODL' => vgaGet('MENU_CLASS_MODL', 'modulename'), 'MENU_CLASS_ITEM' => vgaGet('MENU_CLASS_ITEM', 'menuentry'), 'MENU_TICK' => vgaGET('MENU_TICK', ' - '));
     //$sql = "SELECT * from variables WHERE variable like 'MENU%'";
     //$dbres = SQL($sql);
     //while ($row = SQL_FETCH_ARRAY($dbres)) {
     //   $this->pmenu[trim($row['variable'])]=trim($row['variable_value']);
     //}
     // -------------------------------------------------------------------
     // KFD 10/28/06, Modified to examine "nomenu" instead of permsel
     //   pulls all tables user has nomenu='N'.  The basic idea is
     //   to remove from $AGMENU the stuff they don't see
     //
     // GET AGMENU
     $AGMENU = array();
     // avoid compiler warning, populated next line
     include "ddmodules.php";
     // Pull distinct modules person has any menu options in.
     $sq = "SELECT DISTINCT module\n             FROM zdd.perm_tabs \n            WHERE nomenu='N'\n              AND group_id iN ({$groups})";
     $modules = SQL_AllRows($sq, 'module');
     $AGkeys = array_keys($AGMENU);
     foreach ($AGkeys as $AGkey) {
         if (!isset($modules[$AGkey])) {
             unset($AGMENU[$AGkey]);
         }
     }
     // Now recurse the remaining modules and do the same trick
     // for each one, removing the tables that don't exist
     foreach ($AGMENU as $module => $moduleinfo) {
         $sq = "SELECT DISTINCT table_id\n                FROM zdd.perm_tabs \n               WHERE nomenu='N'\n                 AND module = '{$module}'\n                 AND group_id iN ({$groups})";
         $tables = SQL_AllRows($sq, 'table_id');
         $tkeys = array_keys($moduleinfo['items']);
         foreach ($tkeys as $tkey) {
             if (!isset($tables[$tkey])) {
                 unset($AGMENU[$module]['items'][$tkey]);
             }
         }
     }
     // KFD 12/18/06.  Put all table permissions into session
     $table_perms = SQL_AllRows("Select distinct table_id FROM zdd.perm_tabs\n           WHERE group_id IN ({$groups})\n             AND nomenu='N'", 'table_id');
     SessionSet('TABLEPERMSMENU', array_keys($table_perms));
     $table_perms = SQL_AllRows("Select distinct table_id FROM zdd.perm_tabs\n           WHERE group_id IN ({$groups})\n             AND permsel='Y'", 'table_id');
     SessionSet('TABLEPERMSSEL', array_keys($table_perms));
     $table_perms = SQL_AllRows("Select distinct table_id FROM zdd.perm_tabs\n           WHERE group_id IN ({$groups})\n             AND permins='Y'", 'table_id');
     SessionSet('TABLEPERMSINS', array_keys($table_perms));
     $table_perms = SQL_AllRows("Select distinct table_id FROM zdd.perm_tabs\n           WHERE group_id IN ({$groups})\n             AND permupd='Y'", 'table_id');
     SessionSet('TABLEPERMSUPD', array_keys($table_perms));
     $table_perms = SQL_AllRows("Select distinct table_id FROM zdd.perm_tabs\n           WHERE group_id IN ({$groups})\n             AND permdel='Y'", 'table_id');
     SessionSet('TABLEPERMSDEL', array_keys($table_perms));
     //echo "<div style='background-color:white'>";
     //echo "$uid $groups $group_id_eff";
     //hprint_r(SessionGet('TABLEPERMSMENU'));
     //hprint_r(SessionGet('TABLEPERMSSEL'));
     //echo "</div>";
     // KFD 7/9/07, we always use joomla templates now, don't need
     // options to turn them off
     //if(defined('_ANDROMEDA_JOOMLA')) {
     // In a hybrid situation, put the menu into the session
     SessionSet('AGMENU', $AGMENU);
     //}
     $HTML_Menu = "";
     $WML_Menu = "";
     /*
     foreach ($AGMENU as $key=>$module) {
        //if($key=="datadict") continue;
        //if($key=="sysref")   continue;
        $HTML_Module="";
        $WML_Module="";
        foreach($module["items"] as $itemname=>$item) {
           if (!isset($item["mode"])) { $item["mode"]="normal"; }
           switch ($item["mode"]) {
              case "normal":
                 $ins=false;
                 $extra=array();
                 if($item['menu_parms']<>'') {
                    $aextras=explode('&',$item['menu_parms']);
                    foreach($aextras as $aextra) {
                       list($var,$value)=explode("=",$aextra);
                       $extra[$var]=$value;
                    }
                 }
                 $HTML_Module.=$this->_MenuItem(
                    $item['description'],$itemname,$ins,$extra
                 );
                 $WML_Module.="<div>";
                 $WML_Module.=hLink(
                    '',$item['description'],'?gp_page='.$itemname
                 );
                 $WML_Module.="</div>";
                 break;
              case "ins":
                 //if ($admin || isset($tables_ins[$item["name"]]))  {
                    $HTML_Module.=$this->_MenuItem(
                       $item['description'],$itemname,true
                    );
                 //}
                 break;
                    
                    #$HTML_Module.=
                    #   "\n<font class=\"tablename\">- <a href=\"index.php?gp_page=".$itemname."\">".
                    #   $item["description"]."</a></font><br />";
                    
              }
        }
        
        // the module is defined AFTER its contents so it can be
        // left off if it has no entries
        if ($HTML_Module!="") {
           $HTML_Menu.=$this->_MenuModule($module['description']);
           $HTML_Menu.=$HTML_Module;
        }
        if ($WML_Module!="") {
           $WML_Menu.="<div><b>".$module['description']."</b></div>";
           $WML_Menu.=$WML_Module;
        }
     }
     */
     DynamicSave("menu_" . $uid . ".php", $HTML_Menu);
     DynamicSave("menu_wml_" . $uid . ".php", $WML_Menu);
     // -------------------------------------------------------------------
     // Fetch and cache user preferences
     if (vgaGet('member_profiles')) {
         cacheMember_Profiles();
     }
     // -------------------------------------------------------------------
     // Now find the user's table permissions more precisely table by table
     $sql = "select p.table_id,\n\t\t\t\tmax(case when p.permins='Y' then 1 else 0 end) as permins,\n\t\t\t\tmax(case when p.permupd='Y' then 1 else 0 end) as permupd,\n\t\t\t\tmax(case when p.permdel='Y' then 1 else 0 end) as permdel,\n\t\t\t\tmax(case when p.permsel='Y' then 1 else 0 end) as permsel\n\t\t\t\tfrom zdd.perm_tabs  P\n\t\t\t\tWHERE group_id in ({$groups})\n\t\t\t\tGROUP BY p.table_id";
     //echo $sql;
     $results = SQL($sql);
     $HTML_Perms = "<?php\n\$table_perms = array();\n";
     while ($row = SQL_FETCH_ARRAY($results)) {
         $tn = $row["table_id"];
         $ti = $row["permins"];
         $tu = $row["permupd"];
         $td = $row["permdel"];
         $ts = $row["permsel"];
         $HTML_Perms .= "\$table_perms[\"{$tn}\"]=array(\"ins\"=>{$ti},\"upd\"=>{$tu},\"del\"=>{$td},\"sel\"=>{$ts});\n";
     }
     $HTML_Perms .= "?>\n";
     DynamicSave("perms_" . $uid . ".php", $HTML_Perms);
     /* October 28, 2006, KFD.  Rem'd this all out, column and row security
              made this irrelevant
     		// -------------------------------------------------------------------
     		// Find out if this user has any UID Columns, columns that create
     		// filters on the user's UID
     		$sql = "Select column_id FROM groupuids WHERE group_id IN ($groups)";
     		//echo $sql;
     		$results = SQL($sql);
     		$groupuids = array();
     		while ($row = SQL_FETCH_ARRAY($results)) {
     			//echo "Found this one".$row["column_id"];
     			$groupuids[$row["column_id"]] = $row["column_id"];
     		}
     		SessionSet("groupuids",$groupuids);
           */
     scDBConn_Pop();
     return;
 }
Example #29
0
 function account($tenant_id, $property_id = null)
 {
     $inner = $page = array();
     $this->load->model('reports/reportsmodel');
     $inner['pendingInvoices'] = $this->reportsmodel->getTenantProperty($tenant_id, $property_id);
     $inner['tenant'] = $this->commonmodel->getByPk($tenant_id, 'applicants', 'applicant_id');
     //e($inner['pendingInvoices']);
     foreach ($inner['pendingInvoices'] as $key => $value) {
         $property_id = gp('id', $value);
         $walletAmount = $inner['pendingInvoices'][$key]['walletAmount'] = $this->reportsmodel->walletAmount($tenant_id, $property_id);
         $invoices = array();
         if ($walletAmount) {
             $isHandled = false;
             $invoices = gp('invoices', $value, array());
             //		e($invoices);
             foreach ($invoices as $skey => $invoice) {
                 if (!gp('is_paid', $invoice)) {
                     //e($invoices[$skey],0);
                     $walletAmount = round($walletAmount, 2);
                     $invoices[$skey]['amount'] += $walletAmount;
                     //e($invoices[$skey]);
                     $isHandled = true;
                     break;
                 }
             }
             if (!$isHandled) {
                 //e(123);
                 $invoices = array_reverse(gp('invoices', $value, array()));
                 foreach ($invoices as $skey => $invoice) {
                     $walletAmount = round($walletAmount, 2);
                     $invoices[$skey]['amount'] += $walletAmount;
                     break;
                 }
                 $invoices = array_reverse($invoices);
             }
             //e($invoices,0);
             //e($inner['pendingInvoices'][$key]['invoices'],0);
         }
         $inner['pendingInvoices'][$key]['invoices'] = $invoices;
         //e($inner['pendingInvoices'][$key]['invoices']);
     }
     //e($inner);
     //e('end');
     $page['content'] = $this->load->view('account', $inner, TRUE);
     $this->load->view($this->default, $page);
 }
Example #30
0
 /**
  *  Takes a list of tables and JOINs them together
  *  and builds the complete query for them.
  *
  *  Returns: A SQL SELECT statement
  */
 function genSQLSectionJoin($yamlP2)
 {
     $page = $this->page;
     $uifilter = a($this->yamlP2, 'uifilter', array());
     // Go get the joins
     $SQL_FROMJOINS = $this->genSQLFromJoins($yamlP2);
     $SQL_COLSWHA = array();
     // See if any of the columns have a GROUP setting,
     // if so, all others must get group: Y
     $yamlP2['groupby'] = array();
     $group = false;
     foreach ($yamlP2['table'] as $table_id => $tabinfo) {
         foreach ($tabinfo['column'] as $colname => $colinfo) {
             if (ArraySafe($colinfo, 'group', '') != '') {
                 $group = true;
                 break;
             }
         }
     }
     if ($group) {
         foreach ($yamlP2['table'] as $table_id => $tabinfo) {
             foreach ($tabinfo['column'] as $colname => $colinfo) {
                 if (ArraySafe($colinfo, 'group', '') == '') {
                     //if(ArraySafe($colinfo,'uino','N')=='N') {
                     $yamlP2['groupby'][] = "{$table_id}.{$colname}";
                     //}
                 }
             }
         }
     }
     // Build various lists of columns
     $SQL_COLSA = array();
     $SQL_COLSOBA = array();
     foreach ($yamlP2['table'] as $table => $table_info) {
         $table_dd = dd_TableRef($table);
         foreach ($table_info['column'] as $colname => $colinfo) {
             // order by
             if (ArraySafe($colinfo, 'order', 'N') == 'Y') {
                 $SQL_COLSOBA[] = "{$table}.{$colname}";
             }
             // comparison
             if (isset($colinfo['compare'])) {
                 $compare = $this->SQLCompare($table, $colname, $colinfo);
                 if ($compare != '') {
                     $SQL_COLSWHA[] = $compare;
                 }
             }
             // group by
             if (a($colinfo, 'group', '') != '') {
                 //$coldef = str_replace("as $colname","",$coldef);
                 $coldef = $colinfo['group'] . "({$table}.{$colname})";
             } else {
                 $coldef = "{$table}.{$colname}";
             }
             // If not in output, stop now
             // KFD 5/31/08, no, keep going and filter out at
             //     output.  We need all columns in case they
             //     are orderby columns
             if (a($colinfo, 'uino', 'N') == 'Y') {
                 continue;
             }
             // if a constant, add the constant and skip the rest
             $constant = a($colinfo, 'constant', '');
             if (ArraySafe($table_info, 'left_join', 'N') == 'Y') {
                 $z = SQL_Format($table_dd['flat'][$colname]['type_id'], '');
                 $cval = $constant == '' ? $coldef : "'{$constant}'";
                 $coldef = "COALESCE({$cval},{$z}) as {$colname}";
             } else {
                 $coldef = $constant == '' ? "{$coldef} as {$colname}" : "'{$constant}' as {$colname}";
             }
             $SQL_COLSA[] = $coldef;
         }
     }
     // Collapse the lists into strings
     $SQL_COLS = implode("\n       ,", $SQL_COLSA);
     # KFD 4/9/09.  Slip in skey and source from first table.
     $tables = array_keys($yamlP2['table']);
     $skeytable = $tables[0];
     $SQL_COLS = $skeytable . ".skey,'{$skeytable}' as _source," . $SQL_COLS;
     $SQL_COLSOB = '';
     if (isset($yamlP2['orderby'])) {
         $SQL_COLSOB = "\n ORDER BY " . $yamlP2['orderby'];
     } else {
         if (count($SQL_COLSOBA) > 0) {
             ksort($SQL_COLSOBA);
             $SQL_COLSOB = "\n ORDER BY " . implode(',', $SQL_COLSOBA);
         }
     }
     // For the UI Filter values, add in the values provided by the user
     $SQL_WHERE = '';
     if (count($SQL_COLSWHA) > 0) {
         $SQL_WHERE = "\n WHERE " . implode("\n   AND ", $SQL_COLSWHA);
     }
     // Collapse the group by
     $SQL_GROUPBY = '';
     if (count($yamlP2['groupby']) > 0) {
         $SQL_GROUPBY = "\n GROUP BY " . implode(',', $yamlP2['groupby']);
     }
     // Now build the final SQL
     $SQ = " SELECT " . $SQL_COLS . $SQL_FROMJOINS . $SQL_WHERE . $SQL_GROUPBY . $SQL_COLSOB;
     if (gp('gp_post') == 'onscreen') {
         $SQ .= " LIMIT 300";
     }
     return $SQ;
 }